@stripchatdev/ext-helper 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ext-helper.js +154 -140
- package/package.json +1 -1
package/dist/ext-helper.js
CHANGED
|
@@ -8,31 +8,31 @@ class f extends Error {
|
|
|
8
8
|
super(`${r} (${t})`), this.name = "ULIDError", this.code = t;
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function _(e) {
|
|
12
12
|
const t = Math.floor(e() * 32) % 32;
|
|
13
13
|
return w.charAt(t);
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
const t =
|
|
15
|
+
function P(e) {
|
|
16
|
+
const t = S(), r = t && (t.crypto || t.msCrypto) || null;
|
|
17
17
|
if (typeof (r == null ? void 0 : r.getRandomValues) == "function")
|
|
18
18
|
return () => {
|
|
19
|
-
const
|
|
20
|
-
return r.getRandomValues(
|
|
19
|
+
const n = new Uint8Array(1);
|
|
20
|
+
return r.getRandomValues(n), n[0] / 255;
|
|
21
21
|
};
|
|
22
22
|
if (typeof (r == null ? void 0 : r.randomBytes) == "function")
|
|
23
23
|
return () => r.randomBytes(1).readUInt8() / 255;
|
|
24
24
|
throw new f(l.PRNGDetectFailure, "Failed to find a reliable PRNG");
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
return
|
|
26
|
+
function S() {
|
|
27
|
+
return q() ? self : typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : null;
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function H(e, t) {
|
|
30
30
|
let r = "";
|
|
31
31
|
for (; e > 0; e--)
|
|
32
|
-
r =
|
|
32
|
+
r = _(t) + r;
|
|
33
33
|
return r;
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function O(e, t = 10) {
|
|
36
36
|
if (isNaN(e))
|
|
37
37
|
throw new f(l.EncodeTimeValueMalformed, `Time must be a number: ${e}`);
|
|
38
38
|
if (e > 281474976710655)
|
|
@@ -41,19 +41,19 @@ function L(e, t = 10) {
|
|
|
41
41
|
throw new f(l.EncodeTimeNegative, `Time must be positive: ${e}`);
|
|
42
42
|
if (Number.isInteger(e) === !1)
|
|
43
43
|
throw new f(l.EncodeTimeValueMalformed, `Time must be an integer: ${e}`);
|
|
44
|
-
let r,
|
|
45
|
-
for (let
|
|
46
|
-
r = e % 32,
|
|
47
|
-
return
|
|
44
|
+
let r, n = "";
|
|
45
|
+
for (let s = t; s > 0; s--)
|
|
46
|
+
r = e % 32, n = w.charAt(r) + n, e = (e - r) / 32;
|
|
47
|
+
return n;
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function q() {
|
|
50
50
|
return typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope;
|
|
51
51
|
}
|
|
52
|
-
function
|
|
53
|
-
const r =
|
|
54
|
-
return
|
|
52
|
+
function b(e, t) {
|
|
53
|
+
const r = P(), n = Date.now();
|
|
54
|
+
return O(n, 10) + H(16, r);
|
|
55
55
|
}
|
|
56
|
-
const
|
|
56
|
+
const L = ({ seq: e, uniqId: t }) => (r) => ({
|
|
57
57
|
...{
|
|
58
58
|
protocol: "iframe_pubsub",
|
|
59
59
|
version: "1.0",
|
|
@@ -62,83 +62,97 @@ const S = ({ seq: e, uniqId: t }) => (r) => ({
|
|
|
62
62
|
timestamp: Date.now()
|
|
63
63
|
},
|
|
64
64
|
...r
|
|
65
|
-
}),
|
|
66
|
-
uniqId: () =>
|
|
67
|
-
seq: () =>
|
|
65
|
+
}), g = L({
|
|
66
|
+
uniqId: () => b(),
|
|
67
|
+
seq: () => b()
|
|
68
68
|
});
|
|
69
|
-
class
|
|
69
|
+
class A {
|
|
70
70
|
constructor(t) {
|
|
71
|
-
this.eventHandlerMap = /* @__PURE__ */ new Map(), this.globalMessageHandler = (
|
|
72
|
-
if (T(
|
|
73
|
-
if (
|
|
74
|
-
const { eventName: i } =
|
|
71
|
+
this.eventHandlerMap = /* @__PURE__ */ new Map(), this.globalMessageHandler = (s, o) => {
|
|
72
|
+
if (T(s)) {
|
|
73
|
+
if (s.type === "event") {
|
|
74
|
+
const { eventName: i } = s, a = this.eventHandlerMap.get(i);
|
|
75
75
|
if (!a)
|
|
76
76
|
return;
|
|
77
77
|
a.forEach((c) => {
|
|
78
78
|
try {
|
|
79
|
-
c(
|
|
80
|
-
} catch (
|
|
81
|
-
console.error("[PubSubSubscriber] globalMessageHandler: failed to handle income message",
|
|
79
|
+
c(s.data, o.id);
|
|
80
|
+
} catch (h) {
|
|
81
|
+
console.error("[PubSubSubscriber] globalMessageHandler: failed to handle income message", h);
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
|
-
console.error("[PubSubSubscriber] globalMessageHandler: unhandled message",
|
|
86
|
+
console.error("[PubSubSubscriber] globalMessageHandler: unhandled message", s);
|
|
87
87
|
}
|
|
88
88
|
};
|
|
89
|
-
const { brokerId: r, transport:
|
|
90
|
-
this.brokerId = r, this.transport =
|
|
89
|
+
const { brokerId: r, transport: n } = t;
|
|
90
|
+
this.brokerId = r, this.transport = n, this.transport.onMessage(this.globalMessageHandler);
|
|
91
91
|
}
|
|
92
92
|
subscribe(t, r) {
|
|
93
|
-
const
|
|
94
|
-
let
|
|
95
|
-
|
|
96
|
-
const o =
|
|
93
|
+
const n = y(t);
|
|
94
|
+
let s = this.eventHandlerMap.get(n);
|
|
95
|
+
s || (s = /* @__PURE__ */ new Set(), this.eventHandlerMap.set(n, s)), s.add(r);
|
|
96
|
+
const o = g({
|
|
97
97
|
type: "subscribe",
|
|
98
98
|
eventName: t
|
|
99
99
|
});
|
|
100
100
|
this.transport.send(this.brokerId, o);
|
|
101
101
|
}
|
|
102
102
|
unsubscribe(t, r) {
|
|
103
|
-
const
|
|
104
|
-
let
|
|
105
|
-
if (!
|
|
103
|
+
const n = y(t);
|
|
104
|
+
let s = this.eventHandlerMap.get(n);
|
|
105
|
+
if (!s)
|
|
106
106
|
return;
|
|
107
|
-
r ?
|
|
108
|
-
const o =
|
|
107
|
+
r ? s.delete(r) : this.eventHandlerMap.delete(n);
|
|
108
|
+
const o = g({
|
|
109
109
|
type: "unsubscribe",
|
|
110
110
|
eventName: t
|
|
111
111
|
});
|
|
112
112
|
this.transport.send(this.brokerId, o);
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
const
|
|
115
|
+
const C = !!Error.captureStackTrace, D = "APP_ERROR";
|
|
116
116
|
class E extends Error {
|
|
117
117
|
constructor(t, r) {
|
|
118
|
-
super(t), this.name = new.target.name || D, this.cause = r,
|
|
118
|
+
super(t), this.name = new.target.name || D, this.cause = r, C && Error.captureStackTrace(this, this.constructor);
|
|
119
119
|
}
|
|
120
|
-
static
|
|
121
|
-
|
|
122
|
-
return t instanceof E && t.cause && (r += `
|
|
123
|
-
Caused by: ${E.getChainedMessage(t.cause)}`), r;
|
|
120
|
+
static serializeCause(t) {
|
|
121
|
+
return t instanceof E ? t.toJSON() : t instanceof Error ? { name: t.name, message: t.message } : t !== null && typeof t == "object" ? t : String(t);
|
|
124
122
|
}
|
|
125
123
|
toJSON() {
|
|
126
124
|
return {
|
|
127
125
|
name: this.name,
|
|
128
126
|
message: this.message,
|
|
129
|
-
cause: this.cause ? E.
|
|
127
|
+
cause: this.cause ? E.serializeCause(this.cause) : void 0
|
|
130
128
|
};
|
|
131
129
|
}
|
|
130
|
+
toString() {
|
|
131
|
+
try {
|
|
132
|
+
const t = this.toJSON();
|
|
133
|
+
return JSON.stringify(t);
|
|
134
|
+
} catch {
|
|
135
|
+
return `failed to stringify error: ${this.name}: ${this.message}`;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
132
138
|
}
|
|
133
139
|
const x = {
|
|
134
140
|
INTERNAL_ERROR: "INTERNAL_ERROR"
|
|
135
141
|
}, G = "RPC_ERROR";
|
|
136
|
-
class
|
|
142
|
+
class j extends E {
|
|
137
143
|
constructor(t) {
|
|
138
|
-
super(t.message || "
|
|
144
|
+
super(t.message || "rpc error", t.cause), this.name = G, this.code = (t == null ? void 0 : t.code) || x.INTERNAL_ERROR, this.method = t.method, this.params = t.params;
|
|
145
|
+
}
|
|
146
|
+
toJSON() {
|
|
147
|
+
return {
|
|
148
|
+
...super.toJSON(),
|
|
149
|
+
code: this.code,
|
|
150
|
+
method: this.method,
|
|
151
|
+
params: this.params
|
|
152
|
+
};
|
|
139
153
|
}
|
|
140
154
|
}
|
|
141
|
-
const
|
|
155
|
+
const F = (e) => !!e && typeof e == "object" && "protocol" in e && e.protocol === "iframe_rpc" && "version" in e && e.version === "1.0", B = ({ uniqId: e }) => (t) => ({
|
|
142
156
|
...{
|
|
143
157
|
protocol: "iframe_rpc",
|
|
144
158
|
version: "1.0",
|
|
@@ -147,43 +161,43 @@ const j = (e) => !!e && typeof e == "object" && "protocol" in e && e.protocol ==
|
|
|
147
161
|
},
|
|
148
162
|
...t
|
|
149
163
|
}), X = B({
|
|
150
|
-
uniqId: () =>
|
|
164
|
+
uniqId: () => b()
|
|
151
165
|
});
|
|
152
166
|
class U {
|
|
153
167
|
constructor(t) {
|
|
154
|
-
this.pendingEntryMap = /* @__PURE__ */ new Map(), this.globalMessageHandler = (
|
|
155
|
-
if (
|
|
156
|
-
if (
|
|
157
|
-
const o =
|
|
168
|
+
this.pendingEntryMap = /* @__PURE__ */ new Map(), this.globalMessageHandler = (s) => {
|
|
169
|
+
if (F(s)) {
|
|
170
|
+
if (s.type === "response" && s.status === "ok") {
|
|
171
|
+
const o = s.id, i = this.pendingEntryMap.get(o);
|
|
158
172
|
if (!i) {
|
|
159
|
-
console.error("[RpcClient] globalMessageHandler: got success response without pending request",
|
|
173
|
+
console.error("[RpcClient] globalMessageHandler: got success response without pending request", s);
|
|
160
174
|
return;
|
|
161
175
|
}
|
|
162
|
-
this.pendingEntryMap.delete(o), i.resolve(
|
|
176
|
+
this.pendingEntryMap.delete(o), i.resolve(s.result);
|
|
163
177
|
return;
|
|
164
178
|
}
|
|
165
|
-
if (
|
|
166
|
-
const o =
|
|
179
|
+
if (s.type === "response" && s.status === "error") {
|
|
180
|
+
const o = s.id, i = this.pendingEntryMap.get(o);
|
|
167
181
|
if (!i) {
|
|
168
|
-
console.error("[RpcClient] globalMessageHandler: got error response without pending request",
|
|
182
|
+
console.error("[RpcClient] globalMessageHandler: got error response without pending request", s);
|
|
169
183
|
return;
|
|
170
184
|
}
|
|
171
|
-
this.pendingEntryMap.delete(o), i.reject(new
|
|
185
|
+
this.pendingEntryMap.delete(o), i.reject(new j(s.error));
|
|
172
186
|
return;
|
|
173
187
|
}
|
|
174
|
-
console.error("[RpcClient] globalMessageHandler: invalid message schema",
|
|
188
|
+
console.error("[RpcClient] globalMessageHandler: invalid message schema", s);
|
|
175
189
|
}
|
|
176
190
|
};
|
|
177
|
-
const { serverId: r, transport:
|
|
178
|
-
this.serverId = r, this.transport =
|
|
191
|
+
const { serverId: r, transport: n } = t;
|
|
192
|
+
this.serverId = r, this.transport = n, this.transport.onMessage(this.globalMessageHandler);
|
|
179
193
|
}
|
|
180
194
|
makeRequest(t, r) {
|
|
181
|
-
const
|
|
195
|
+
const n = X({
|
|
182
196
|
type: "request",
|
|
183
197
|
method: t,
|
|
184
198
|
params: r
|
|
185
|
-
}),
|
|
186
|
-
this.pendingEntryMap.set(
|
|
199
|
+
}), s = new Promise((o, i) => {
|
|
200
|
+
this.pendingEntryMap.set(n.id, {
|
|
187
201
|
method: t,
|
|
188
202
|
resolve: (a) => {
|
|
189
203
|
o(a);
|
|
@@ -194,42 +208,42 @@ class U {
|
|
|
194
208
|
});
|
|
195
209
|
});
|
|
196
210
|
try {
|
|
197
|
-
this.transport.send(this.serverId,
|
|
211
|
+
this.transport.send(this.serverId, n);
|
|
198
212
|
} catch (o) {
|
|
199
213
|
console.error("[RpcClient] makeRequest: failed to send rpc message", o);
|
|
200
|
-
const i = this.pendingEntryMap.get(
|
|
201
|
-
i && (this.pendingEntryMap.delete(
|
|
214
|
+
const i = this.pendingEntryMap.get(n.id);
|
|
215
|
+
i && (this.pendingEntryMap.delete(n.id), i.reject(o));
|
|
202
216
|
}
|
|
203
|
-
return
|
|
217
|
+
return s;
|
|
204
218
|
}
|
|
205
219
|
}
|
|
206
220
|
class W {
|
|
207
221
|
constructor(t) {
|
|
208
|
-
this.peers = /* @__PURE__ */ new Map(), this.onMessage = (
|
|
209
|
-
const
|
|
222
|
+
this.peers = /* @__PURE__ */ new Map(), this.onMessage = (n) => {
|
|
223
|
+
const s = (o) => {
|
|
210
224
|
const { data: i, origin: a, source: c } = o;
|
|
211
225
|
if (!c) {
|
|
212
226
|
console.error("[PostMessageTransport] onMessage: source could not be empty");
|
|
213
227
|
return;
|
|
214
228
|
}
|
|
215
|
-
const
|
|
216
|
-
if (
|
|
229
|
+
const h = this.findPeer(c, a);
|
|
230
|
+
if (h)
|
|
217
231
|
try {
|
|
218
|
-
|
|
219
|
-
} catch (
|
|
220
|
-
console.error("[PostMessageTransport] onMessage: failed to call cb on message",
|
|
232
|
+
n(i, h);
|
|
233
|
+
} catch (m) {
|
|
234
|
+
console.error("[PostMessageTransport] onMessage: failed to call cb on message", m);
|
|
221
235
|
}
|
|
222
236
|
};
|
|
223
|
-
return this.localWindow.addEventListener("message",
|
|
224
|
-
this.localWindow.removeEventListener("message",
|
|
237
|
+
return this.localWindow.addEventListener("message", s), () => {
|
|
238
|
+
this.localWindow.removeEventListener("message", s);
|
|
225
239
|
};
|
|
226
240
|
};
|
|
227
241
|
const { localWindow: r } = t;
|
|
228
242
|
this.localWindow = r || window;
|
|
229
243
|
}
|
|
230
244
|
send(t, r) {
|
|
231
|
-
const
|
|
232
|
-
|
|
245
|
+
const n = this.peers.get(t);
|
|
246
|
+
n && n.source.postMessage(r, n.origin);
|
|
233
247
|
}
|
|
234
248
|
broadcast(t) {
|
|
235
249
|
this.peers.forEach((r) => {
|
|
@@ -237,8 +251,8 @@ class W {
|
|
|
237
251
|
});
|
|
238
252
|
}
|
|
239
253
|
broadcastGroup(t, r) {
|
|
240
|
-
t.forEach((
|
|
241
|
-
this.send(
|
|
254
|
+
t.forEach((n) => {
|
|
255
|
+
this.send(n, r);
|
|
242
256
|
});
|
|
243
257
|
}
|
|
244
258
|
addPeer(t) {
|
|
@@ -248,64 +262,64 @@ class W {
|
|
|
248
262
|
this.peers.delete(t);
|
|
249
263
|
}
|
|
250
264
|
findPeer(t, r) {
|
|
251
|
-
for (const [
|
|
252
|
-
if (
|
|
253
|
-
return
|
|
265
|
+
for (const [n, s] of this.peers)
|
|
266
|
+
if (s.source === t && s.origin === r)
|
|
267
|
+
return s;
|
|
254
268
|
return null;
|
|
255
269
|
}
|
|
256
270
|
}
|
|
257
|
-
const
|
|
271
|
+
const p = {
|
|
258
272
|
name: "UnknownError",
|
|
259
273
|
message: "Unknown error"
|
|
260
274
|
}, M = (e, t = 3, r = 0) => {
|
|
261
275
|
if (e instanceof Error) {
|
|
262
|
-
const
|
|
276
|
+
const n = r < t && e.cause ? M(e.cause, t, r + 1) : void 0;
|
|
263
277
|
return {
|
|
264
278
|
name: e.name,
|
|
265
279
|
message: e.message,
|
|
266
280
|
stack: e.stack,
|
|
267
|
-
cause:
|
|
281
|
+
cause: n
|
|
268
282
|
};
|
|
269
283
|
}
|
|
270
284
|
if (typeof e == "string")
|
|
271
285
|
return {
|
|
272
|
-
name:
|
|
286
|
+
name: p.name,
|
|
273
287
|
message: e
|
|
274
288
|
};
|
|
275
289
|
if (typeof e == "number" || typeof e == "bigint" || typeof e == "boolean")
|
|
276
290
|
return {
|
|
277
|
-
name:
|
|
291
|
+
name: p.name,
|
|
278
292
|
message: String(e)
|
|
279
293
|
};
|
|
280
294
|
if (e && typeof e == "object")
|
|
281
295
|
try {
|
|
282
296
|
return {
|
|
283
|
-
name:
|
|
297
|
+
name: p.name,
|
|
284
298
|
message: "message" in e && typeof e.message == "string" && e.message !== "" ? e.message : JSON.stringify(e)
|
|
285
299
|
};
|
|
286
300
|
} catch {
|
|
287
301
|
return {
|
|
288
|
-
name:
|
|
302
|
+
name: p.name,
|
|
289
303
|
message: "Unserializable error object"
|
|
290
304
|
};
|
|
291
305
|
}
|
|
292
|
-
return
|
|
306
|
+
return p;
|
|
293
307
|
}, $ = "get", I = (e, t) => {
|
|
294
|
-
var
|
|
295
|
-
let r,
|
|
296
|
-
return e instanceof Request ? (r = e.url,
|
|
297
|
-
method:
|
|
308
|
+
var s;
|
|
309
|
+
let r, n;
|
|
310
|
+
return e instanceof Request ? (r = e.url, n = e.method) : e instanceof URL ? r = e.toString() : r = e, {
|
|
311
|
+
method: n || ((s = t == null ? void 0 : t.method) == null ? void 0 : s.toString()) || $,
|
|
298
312
|
url: r
|
|
299
313
|
};
|
|
300
|
-
},
|
|
314
|
+
}, z = (e, t, r) => ({
|
|
301
315
|
statusCode: r.status,
|
|
302
316
|
...I(e, t)
|
|
303
|
-
}),
|
|
317
|
+
}), V = (e) => {
|
|
304
318
|
const t = window.fetch;
|
|
305
319
|
Object.defineProperty(window, "fetch", {
|
|
306
|
-
value: async (
|
|
320
|
+
value: async (n, s) => {
|
|
307
321
|
try {
|
|
308
|
-
const o = new Error("synthetic error"), i = await t(
|
|
322
|
+
const o = new Error("synthetic error"), i = await t(n, s), a = i.clone(), c = z(n, s, a);
|
|
309
323
|
if (i.status >= 500) {
|
|
310
324
|
const u = new Error("fetch response error");
|
|
311
325
|
u.stack = o.stack, e.report({
|
|
@@ -316,14 +330,14 @@ const h = {
|
|
|
316
330
|
});
|
|
317
331
|
}
|
|
318
332
|
const {
|
|
319
|
-
arrayBuffer:
|
|
320
|
-
blob:
|
|
321
|
-
json:
|
|
322
|
-
text:
|
|
333
|
+
arrayBuffer: h,
|
|
334
|
+
blob: m,
|
|
335
|
+
json: N,
|
|
336
|
+
text: k
|
|
323
337
|
} = i;
|
|
324
338
|
return i.json = async function() {
|
|
325
339
|
try {
|
|
326
|
-
return await
|
|
340
|
+
return await N.call(this);
|
|
327
341
|
} catch (u) {
|
|
328
342
|
throw e.report({
|
|
329
343
|
type: "network",
|
|
@@ -337,7 +351,7 @@ const h = {
|
|
|
337
351
|
}
|
|
338
352
|
}, i.text = async function() {
|
|
339
353
|
try {
|
|
340
|
-
return await
|
|
354
|
+
return await k.call(this);
|
|
341
355
|
} catch (u) {
|
|
342
356
|
throw e.report({
|
|
343
357
|
type: "network",
|
|
@@ -351,7 +365,7 @@ const h = {
|
|
|
351
365
|
}
|
|
352
366
|
}, i.blob = async function() {
|
|
353
367
|
try {
|
|
354
|
-
return await
|
|
368
|
+
return await m.call(this);
|
|
355
369
|
} catch (u) {
|
|
356
370
|
throw e.report({
|
|
357
371
|
type: "network",
|
|
@@ -365,7 +379,7 @@ const h = {
|
|
|
365
379
|
}
|
|
366
380
|
}, i.arrayBuffer = async function() {
|
|
367
381
|
try {
|
|
368
|
-
return await
|
|
382
|
+
return await h.call(this);
|
|
369
383
|
} catch (u) {
|
|
370
384
|
throw e.report({
|
|
371
385
|
type: "network",
|
|
@@ -383,40 +397,40 @@ const h = {
|
|
|
383
397
|
type: "network",
|
|
384
398
|
kind: "fetchRequestError",
|
|
385
399
|
error: o,
|
|
386
|
-
data: I(
|
|
400
|
+
data: I(n, s)
|
|
387
401
|
}), o;
|
|
388
402
|
}
|
|
389
403
|
},
|
|
390
404
|
configurable: !1,
|
|
391
405
|
writable: !1
|
|
392
406
|
});
|
|
393
|
-
},
|
|
407
|
+
}, J = (e) => {
|
|
394
408
|
window.addEventListener("unhandledrejection", ({ reason: t }) => {
|
|
395
409
|
e.report({
|
|
396
410
|
type: "runtime",
|
|
397
411
|
kind: "unhandledRejection",
|
|
398
412
|
error: t
|
|
399
413
|
});
|
|
400
|
-
}), window.addEventListener("error", ({ colno: t, error: r, filename:
|
|
414
|
+
}), window.addEventListener("error", ({ colno: t, error: r, filename: n, lineno: s, message: o }) => {
|
|
401
415
|
e.report({
|
|
402
416
|
type: "runtime",
|
|
403
417
|
kind: "uncaughtError",
|
|
404
418
|
error: r,
|
|
405
419
|
data: {
|
|
406
|
-
lineno:
|
|
420
|
+
lineno: s,
|
|
407
421
|
colno: t,
|
|
408
422
|
message: o,
|
|
409
|
-
filename:
|
|
423
|
+
filename: n
|
|
410
424
|
}
|
|
411
425
|
});
|
|
412
426
|
});
|
|
413
|
-
}, v = Symbol("patchedXHLHttpRequest"), d = Symbol("requestInfo"),
|
|
427
|
+
}, v = Symbol("patchedXHLHttpRequest"), d = Symbol("requestInfo"), K = (e) => ({
|
|
414
428
|
statusCode: e.status,
|
|
415
429
|
...e[d]
|
|
416
430
|
}), Z = (e) => (e[d] || (e[d] = {}), e[d]), Q = (e) => {
|
|
417
431
|
e[v] = !0;
|
|
418
432
|
}, Y = (e) => e[v] === !0, ee = (e) => {
|
|
419
|
-
const t = XMLHttpRequest.prototype.send, r = XMLHttpRequest.prototype.open,
|
|
433
|
+
const t = XMLHttpRequest.prototype.send, r = XMLHttpRequest.prototype.open, n = function(...o) {
|
|
420
434
|
const [i, a] = o;
|
|
421
435
|
this[d] = {
|
|
422
436
|
method: i,
|
|
@@ -443,7 +457,7 @@ const h = {
|
|
|
443
457
|
e.report({
|
|
444
458
|
type: "network",
|
|
445
459
|
kind: "xmlHttpRequestLoadError",
|
|
446
|
-
data:
|
|
460
|
+
data: K(this),
|
|
447
461
|
error: c
|
|
448
462
|
});
|
|
449
463
|
}
|
|
@@ -458,7 +472,7 @@ const h = {
|
|
|
458
472
|
data: this[d]
|
|
459
473
|
}), c;
|
|
460
474
|
}
|
|
461
|
-
},
|
|
475
|
+
}, s = function(o) {
|
|
462
476
|
try {
|
|
463
477
|
const i = Z(this), a = new Error("XMLHttpRequest request initiator");
|
|
464
478
|
i.requestStack = a.stack, t.call(this, o);
|
|
@@ -472,11 +486,11 @@ const h = {
|
|
|
472
486
|
}
|
|
473
487
|
};
|
|
474
488
|
Object.defineProperty(XMLHttpRequest.prototype, "open", {
|
|
475
|
-
value:
|
|
489
|
+
value: n,
|
|
476
490
|
configurable: !1,
|
|
477
491
|
writable: !1
|
|
478
492
|
}), Object.defineProperty(XMLHttpRequest.prototype, "send", {
|
|
479
|
-
value:
|
|
493
|
+
value: s,
|
|
480
494
|
configurable: !1,
|
|
481
495
|
writable: !1
|
|
482
496
|
});
|
|
@@ -487,9 +501,9 @@ class te {
|
|
|
487
501
|
this.onError = t;
|
|
488
502
|
}
|
|
489
503
|
report(t) {
|
|
490
|
-
const { error: r, ...
|
|
504
|
+
const { error: r, ...n } = t;
|
|
491
505
|
this.onError({
|
|
492
|
-
...
|
|
506
|
+
...n,
|
|
493
507
|
error: r ? M(r) : void 0
|
|
494
508
|
});
|
|
495
509
|
}
|
|
@@ -497,25 +511,25 @@ class te {
|
|
|
497
511
|
this.applyIntegrations();
|
|
498
512
|
}
|
|
499
513
|
applyIntegrations() {
|
|
500
|
-
R || (R = !0,
|
|
514
|
+
R || (R = !0, J(this), ee(this), V(this));
|
|
501
515
|
}
|
|
502
516
|
}
|
|
503
517
|
class re {
|
|
504
518
|
constructor(t) {
|
|
505
519
|
const {
|
|
506
520
|
serverId: r,
|
|
507
|
-
serverOrigin:
|
|
508
|
-
serverSource:
|
|
521
|
+
serverOrigin: n,
|
|
522
|
+
serverSource: s,
|
|
509
523
|
theme: o
|
|
510
524
|
} = t, i = {
|
|
511
525
|
id: r,
|
|
512
|
-
origin:
|
|
513
|
-
source:
|
|
526
|
+
origin: n,
|
|
527
|
+
source: s
|
|
514
528
|
}, a = new W({});
|
|
515
529
|
a.addPeer(i), this.rpcClient = new U({
|
|
516
530
|
transport: a,
|
|
517
531
|
serverId: r
|
|
518
|
-
}), this.subscriber = new
|
|
532
|
+
}), this.subscriber = new A({
|
|
519
533
|
transport: a,
|
|
520
534
|
brokerId: i.id
|
|
521
535
|
}), document.documentElement.dataset.theme = o, this.crashReporter = new te((c) => {
|
|
@@ -539,17 +553,17 @@ class re {
|
|
|
539
553
|
a.offsetHeight,
|
|
540
554
|
a.scrollHeight
|
|
541
555
|
);
|
|
542
|
-
},
|
|
556
|
+
}, n = () => {
|
|
543
557
|
const a = document.body;
|
|
544
558
|
return Math.max(
|
|
545
559
|
a.offsetWidth,
|
|
546
560
|
a.scrollWidth
|
|
547
561
|
);
|
|
548
|
-
},
|
|
549
|
-
const a =
|
|
562
|
+
}, s = () => {
|
|
563
|
+
const a = n(), c = r();
|
|
550
564
|
(t.height !== c || t.width !== a) && (t = { height: c, width: a }, this.makeRequest("v1.system.resize.notify", { height: c, width: a }));
|
|
551
565
|
};
|
|
552
|
-
|
|
566
|
+
s(), new ResizeObserver(s).observe(document.body), new MutationObserver(s).observe(document.body, {
|
|
553
567
|
childList: !0,
|
|
554
568
|
subtree: !0,
|
|
555
569
|
attributes: !0,
|
|
@@ -557,15 +571,15 @@ class re {
|
|
|
557
571
|
}), this.crashReporter.init();
|
|
558
572
|
}
|
|
559
573
|
}
|
|
560
|
-
const
|
|
561
|
-
const e = new URL(window.location.href), t = e.searchParams.get("origin") || "", r = e.searchParams.get("theme") || "dark",
|
|
574
|
+
const ne = () => {
|
|
575
|
+
const e = new URL(window.location.href), t = e.searchParams.get("origin") || "", r = e.searchParams.get("theme") || "dark", n = new re({
|
|
562
576
|
serverId: "server",
|
|
563
577
|
serverOrigin: t || window.parent.origin,
|
|
564
578
|
serverSource: window.parent,
|
|
565
579
|
theme: r
|
|
566
580
|
});
|
|
567
|
-
return
|
|
581
|
+
return n.bootstrap(), n;
|
|
568
582
|
};
|
|
569
583
|
export {
|
|
570
|
-
|
|
584
|
+
ne as createExtHelper
|
|
571
585
|
};
|