@luxonis/visualizer-protobuf 2.16.2 → 2.18.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/dist/FoxgloveServer-C39Uooyk.js +1172 -0
- package/dist/{WorkerImageDecoder.worker-DCoSYoLL.js → WorkerImageDecoder.worker-tkX9-IYo.js} +3 -2
- package/dist/_commonjsHelpers-E-ZsRS8r.js +32 -0
- package/dist/{comlink-D0blLC4P.js → comlink-DHMAu6X7.js} +1 -1
- package/dist/{communicator-CkB-oBVq.js → communicator-D49kmBTQ.js} +1 -1
- package/dist/{decodeImage-NYPkamnK.js → decodeImage-C8kB6T3V.js} +1 -1
- package/dist/deserialization.worker-DsG76nP8.js +1326 -0
- package/dist/{foxglove-protocol-RZlF5fna.js → foxglove-protocol-CYoMweAY.js} +1 -1
- package/dist/{i18next-C5Qe4-E1.js → i18next-IYI3-Nuv.js} +1624 -3124
- package/dist/{i420ToRgbaToPoitcloud.worker-CQFm7P7B.js → i420ToRgbaToPoitcloud.worker-CzFC0VI1.js} +1 -1
- package/dist/{index-_CotNV5x.js → index-4PQpGzhb.js} +10 -8
- package/dist/{index-C8kEVNt8.js → index-BFMXTxLw.js} +10 -8
- package/dist/{index-D7BaFI3k.js → index-BQecGu9I.js} +10 -8
- package/dist/{index-BFmZhB_k.js → index-BT9CBn7l.js} +2663 -2658
- package/dist/{index-CGZy-t2h.js → index-BWittpbR.js} +10 -8
- package/dist/{index-BRyhvg1u.js → index-BeQ1w8aW.js} +10 -8
- package/dist/{index-B-NuHgKz.js → index-BomoqOv5.js} +10 -8
- package/dist/{index-qRQvVkdj.js → index-ByIsztCr.js} +10 -8
- package/dist/{index-C7bn4vhH.js → index-CJRhjhJ0.js} +10 -8
- package/dist/{index-De_-85Dx.js → index-CR6XGTJc.js} +26206 -31958
- package/dist/{index-BflsEH7y.js → index-CXIVXFcJ.js} +13 -10
- package/dist/{index-DeqZpaJF.js → index-CXThSQcL.js} +10 -8
- package/dist/{index-BA7oWwVg.js → index-CcIi7pJR.js} +10 -8
- package/dist/{index-BDNOxLbq.js → index-CcP1Qppv.js} +10 -8
- package/dist/{index-BsSLQ0Qh.js → index-Ci0X5xT3.js} +10 -8
- package/dist/{index-D_n427cy.js → index-CrtBH66u.js} +10 -8
- package/dist/{index--q0v8_7h.js → index-DUUnuN10.js} +10 -8
- package/dist/{index-C3EAt3Mi.js → index-DchGURxJ.js} +10 -8
- package/dist/{index-Cls5O6Ds.js → index-DdKOhCXT.js} +10 -8
- package/dist/index.js +10 -8
- package/dist/isArrayLikeObject-Bytw9p-q.js +1503 -0
- package/dist/lib/src/components/Panel.d.ts +1 -0
- package/dist/lib/src/components/Panel.d.ts.map +1 -1
- package/dist/lib/src/components/Panel.js +2 -2
- package/dist/lib/src/components/Panel.js.map +1 -1
- package/dist/lib/src/components/PanelToolbar.d.ts +1 -0
- package/dist/lib/src/components/PanelToolbar.d.ts.map +1 -1
- package/dist/lib/src/components/PanelToolbar.js +6 -3
- package/dist/lib/src/components/PanelToolbar.js.map +1 -1
- package/dist/lib/src/components/measure-render-delay.d.ts.map +1 -1
- package/dist/lib/src/components/measure-render-delay.js +5 -0
- package/dist/lib/src/components/measure-render-delay.js.map +1 -1
- package/dist/lib/src/messaging/{deserialization.d.ts → deserialization.worker.d.ts} +6 -2
- package/dist/lib/src/messaging/deserialization.worker.d.ts.map +1 -0
- package/dist/lib/src/messaging/{deserialization.js → deserialization.worker.js} +28 -3
- package/dist/lib/src/messaging/deserialization.worker.js.map +1 -0
- package/dist/lib/src/messaging/message-handler.d.ts.map +1 -1
- package/dist/lib/src/messaging/message-handler.js +14 -20
- package/dist/lib/src/messaging/message-handler.js.map +1 -1
- package/dist/lib/src/panels/ImagePanel.d.ts +3 -5
- package/dist/lib/src/panels/ImagePanel.d.ts.map +1 -1
- package/dist/lib/src/panels/ImagePanel.js +1 -0
- package/dist/lib/src/panels/ImagePanel.js.map +1 -1
- package/dist/lib/src/panels/PointCloudPanel.d.ts +2 -0
- package/dist/lib/src/panels/PointCloudPanel.d.ts.map +1 -1
- package/dist/lib/src/panels/PointCloudPanel.js +29 -4
- package/dist/lib/src/panels/PointCloudPanel.js.map +1 -1
- package/dist/lib/src/utils/poitcloud-sync.d.ts.map +1 -1
- package/dist/lib/src/utils/poitcloud-sync.js +5 -2
- package/dist/lib/src/utils/poitcloud-sync.js.map +1 -1
- package/dist/packages/studio-base/src/panels/ThreeDeeRender/ThreeDeeRender.d.ts.map +1 -1
- package/dist/packages/studio-base/src/panels/ThreeDeeRender/ThreeDeeRender.js +3 -0
- package/dist/packages/studio-base/src/panels/ThreeDeeRender/ThreeDeeRender.js.map +1 -1
- package/dist/packages/studio-base/src/panels/ThreeDeeRender/renderables/CameraStateSettings.js +2 -2
- package/dist/packages/studio-base/src/panels/ThreeDeeRender/renderables/CameraStateSettings.js.map +1 -1
- package/dist/packages/studio-base/src/panels/ThreeDeeRender/renderables/ImageMode/ImageMode.d.ts.map +1 -1
- package/dist/packages/studio-base/src/panels/ThreeDeeRender/renderables/ImageMode/ImageMode.js +0 -1
- package/dist/packages/studio-base/src/panels/ThreeDeeRender/renderables/ImageMode/ImageMode.js.map +1 -1
- package/dist/{FoxgloveServer-DiLI7KZU.js → protobuf-Cr0sn6Ua.js} +996 -2196
- package/dist/tslib.es6-D98N6tjc.js +4116 -0
- package/dist/useMessageReducer-Cg30zaG9.js +422 -0
- package/dist/{worker-CtuCYYTr.js → worker-B5OJw-Fq.js} +5 -3
- package/dist/{worker-Bd7K1fGT.js → worker-aVL4LGa3.js} +5 -3
- package/package.json +1 -1
- package/dist/lib/src/messaging/deserialization.d.ts.map +0 -1
- package/dist/lib/src/messaging/deserialization.js.map +0 -1
|
@@ -0,0 +1,1172 @@
|
|
|
1
|
+
import { g as getDefaultExportFromCjs } from './_commonjsHelpers-E-ZsRS8r.js';
|
|
2
|
+
import require$$0 from 'ms';
|
|
3
|
+
|
|
4
|
+
var eventemitter3 = {exports: {}};
|
|
5
|
+
|
|
6
|
+
(function (module) {
|
|
7
|
+
|
|
8
|
+
var has = Object.prototype.hasOwnProperty
|
|
9
|
+
, prefix = '~';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Constructor to create a storage for our `EE` objects.
|
|
13
|
+
* An `Events` instance is a plain object whose properties are event names.
|
|
14
|
+
*
|
|
15
|
+
* @constructor
|
|
16
|
+
* @private
|
|
17
|
+
*/
|
|
18
|
+
function Events() {}
|
|
19
|
+
|
|
20
|
+
//
|
|
21
|
+
// We try to not inherit from `Object.prototype`. In some engines creating an
|
|
22
|
+
// instance in this way is faster than calling `Object.create(null)` directly.
|
|
23
|
+
// If `Object.create(null)` is not supported we prefix the event names with a
|
|
24
|
+
// character to make sure that the built-in object properties are not
|
|
25
|
+
// overridden or used as an attack vector.
|
|
26
|
+
//
|
|
27
|
+
if (Object.create) {
|
|
28
|
+
Events.prototype = Object.create(null);
|
|
29
|
+
|
|
30
|
+
//
|
|
31
|
+
// This hack is needed because the `__proto__` property is still inherited in
|
|
32
|
+
// some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
|
|
33
|
+
//
|
|
34
|
+
if (!new Events().__proto__) prefix = false;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Representation of a single event listener.
|
|
39
|
+
*
|
|
40
|
+
* @param {Function} fn The listener function.
|
|
41
|
+
* @param {*} context The context to invoke the listener with.
|
|
42
|
+
* @param {Boolean} [once=false] Specify if the listener is a one-time listener.
|
|
43
|
+
* @constructor
|
|
44
|
+
* @private
|
|
45
|
+
*/
|
|
46
|
+
function EE(fn, context, once) {
|
|
47
|
+
this.fn = fn;
|
|
48
|
+
this.context = context;
|
|
49
|
+
this.once = once || false;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Add a listener for a given event.
|
|
54
|
+
*
|
|
55
|
+
* @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
|
|
56
|
+
* @param {(String|Symbol)} event The event name.
|
|
57
|
+
* @param {Function} fn The listener function.
|
|
58
|
+
* @param {*} context The context to invoke the listener with.
|
|
59
|
+
* @param {Boolean} once Specify if the listener is a one-time listener.
|
|
60
|
+
* @returns {EventEmitter}
|
|
61
|
+
* @private
|
|
62
|
+
*/
|
|
63
|
+
function addListener(emitter, event, fn, context, once) {
|
|
64
|
+
if (typeof fn !== 'function') {
|
|
65
|
+
throw new TypeError('The listener must be a function');
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
var listener = new EE(fn, context || emitter, once)
|
|
69
|
+
, evt = prefix ? prefix + event : event;
|
|
70
|
+
|
|
71
|
+
if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;
|
|
72
|
+
else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);
|
|
73
|
+
else emitter._events[evt] = [emitter._events[evt], listener];
|
|
74
|
+
|
|
75
|
+
return emitter;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Clear event by name.
|
|
80
|
+
*
|
|
81
|
+
* @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
|
|
82
|
+
* @param {(String|Symbol)} evt The Event name.
|
|
83
|
+
* @private
|
|
84
|
+
*/
|
|
85
|
+
function clearEvent(emitter, evt) {
|
|
86
|
+
if (--emitter._eventsCount === 0) emitter._events = new Events();
|
|
87
|
+
else delete emitter._events[evt];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Minimal `EventEmitter` interface that is molded against the Node.js
|
|
92
|
+
* `EventEmitter` interface.
|
|
93
|
+
*
|
|
94
|
+
* @constructor
|
|
95
|
+
* @public
|
|
96
|
+
*/
|
|
97
|
+
function EventEmitter() {
|
|
98
|
+
this._events = new Events();
|
|
99
|
+
this._eventsCount = 0;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Return an array listing the events for which the emitter has registered
|
|
104
|
+
* listeners.
|
|
105
|
+
*
|
|
106
|
+
* @returns {Array}
|
|
107
|
+
* @public
|
|
108
|
+
*/
|
|
109
|
+
EventEmitter.prototype.eventNames = function eventNames() {
|
|
110
|
+
var names = []
|
|
111
|
+
, events
|
|
112
|
+
, name;
|
|
113
|
+
|
|
114
|
+
if (this._eventsCount === 0) return names;
|
|
115
|
+
|
|
116
|
+
for (name in (events = this._events)) {
|
|
117
|
+
if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (Object.getOwnPropertySymbols) {
|
|
121
|
+
return names.concat(Object.getOwnPropertySymbols(events));
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return names;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Return the listeners registered for a given event.
|
|
129
|
+
*
|
|
130
|
+
* @param {(String|Symbol)} event The event name.
|
|
131
|
+
* @returns {Array} The registered listeners.
|
|
132
|
+
* @public
|
|
133
|
+
*/
|
|
134
|
+
EventEmitter.prototype.listeners = function listeners(event) {
|
|
135
|
+
var evt = prefix ? prefix + event : event
|
|
136
|
+
, handlers = this._events[evt];
|
|
137
|
+
|
|
138
|
+
if (!handlers) return [];
|
|
139
|
+
if (handlers.fn) return [handlers.fn];
|
|
140
|
+
|
|
141
|
+
for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
|
|
142
|
+
ee[i] = handlers[i].fn;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return ee;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Return the number of listeners listening to a given event.
|
|
150
|
+
*
|
|
151
|
+
* @param {(String|Symbol)} event The event name.
|
|
152
|
+
* @returns {Number} The number of listeners.
|
|
153
|
+
* @public
|
|
154
|
+
*/
|
|
155
|
+
EventEmitter.prototype.listenerCount = function listenerCount(event) {
|
|
156
|
+
var evt = prefix ? prefix + event : event
|
|
157
|
+
, listeners = this._events[evt];
|
|
158
|
+
|
|
159
|
+
if (!listeners) return 0;
|
|
160
|
+
if (listeners.fn) return 1;
|
|
161
|
+
return listeners.length;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Calls each of the listeners registered for a given event.
|
|
166
|
+
*
|
|
167
|
+
* @param {(String|Symbol)} event The event name.
|
|
168
|
+
* @returns {Boolean} `true` if the event had listeners, else `false`.
|
|
169
|
+
* @public
|
|
170
|
+
*/
|
|
171
|
+
EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
|
|
172
|
+
var evt = prefix ? prefix + event : event;
|
|
173
|
+
|
|
174
|
+
if (!this._events[evt]) return false;
|
|
175
|
+
|
|
176
|
+
var listeners = this._events[evt]
|
|
177
|
+
, len = arguments.length
|
|
178
|
+
, args
|
|
179
|
+
, i;
|
|
180
|
+
|
|
181
|
+
if (listeners.fn) {
|
|
182
|
+
if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
|
|
183
|
+
|
|
184
|
+
switch (len) {
|
|
185
|
+
case 1: return listeners.fn.call(listeners.context), true;
|
|
186
|
+
case 2: return listeners.fn.call(listeners.context, a1), true;
|
|
187
|
+
case 3: return listeners.fn.call(listeners.context, a1, a2), true;
|
|
188
|
+
case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
|
|
189
|
+
case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
|
|
190
|
+
case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
for (i = 1, args = new Array(len -1); i < len; i++) {
|
|
194
|
+
args[i - 1] = arguments[i];
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
listeners.fn.apply(listeners.context, args);
|
|
198
|
+
} else {
|
|
199
|
+
var length = listeners.length
|
|
200
|
+
, j;
|
|
201
|
+
|
|
202
|
+
for (i = 0; i < length; i++) {
|
|
203
|
+
if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
|
|
204
|
+
|
|
205
|
+
switch (len) {
|
|
206
|
+
case 1: listeners[i].fn.call(listeners[i].context); break;
|
|
207
|
+
case 2: listeners[i].fn.call(listeners[i].context, a1); break;
|
|
208
|
+
case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
|
|
209
|
+
case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
|
|
210
|
+
default:
|
|
211
|
+
if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
|
|
212
|
+
args[j - 1] = arguments[j];
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
listeners[i].fn.apply(listeners[i].context, args);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
return true;
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Add a listener for a given event.
|
|
225
|
+
*
|
|
226
|
+
* @param {(String|Symbol)} event The event name.
|
|
227
|
+
* @param {Function} fn The listener function.
|
|
228
|
+
* @param {*} [context=this] The context to invoke the listener with.
|
|
229
|
+
* @returns {EventEmitter} `this`.
|
|
230
|
+
* @public
|
|
231
|
+
*/
|
|
232
|
+
EventEmitter.prototype.on = function on(event, fn, context) {
|
|
233
|
+
return addListener(this, event, fn, context, false);
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Add a one-time listener for a given event.
|
|
238
|
+
*
|
|
239
|
+
* @param {(String|Symbol)} event The event name.
|
|
240
|
+
* @param {Function} fn The listener function.
|
|
241
|
+
* @param {*} [context=this] The context to invoke the listener with.
|
|
242
|
+
* @returns {EventEmitter} `this`.
|
|
243
|
+
* @public
|
|
244
|
+
*/
|
|
245
|
+
EventEmitter.prototype.once = function once(event, fn, context) {
|
|
246
|
+
return addListener(this, event, fn, context, true);
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Remove the listeners of a given event.
|
|
251
|
+
*
|
|
252
|
+
* @param {(String|Symbol)} event The event name.
|
|
253
|
+
* @param {Function} fn Only remove the listeners that match this function.
|
|
254
|
+
* @param {*} context Only remove the listeners that have this context.
|
|
255
|
+
* @param {Boolean} once Only remove one-time listeners.
|
|
256
|
+
* @returns {EventEmitter} `this`.
|
|
257
|
+
* @public
|
|
258
|
+
*/
|
|
259
|
+
EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
|
|
260
|
+
var evt = prefix ? prefix + event : event;
|
|
261
|
+
|
|
262
|
+
if (!this._events[evt]) return this;
|
|
263
|
+
if (!fn) {
|
|
264
|
+
clearEvent(this, evt);
|
|
265
|
+
return this;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
var listeners = this._events[evt];
|
|
269
|
+
|
|
270
|
+
if (listeners.fn) {
|
|
271
|
+
if (
|
|
272
|
+
listeners.fn === fn &&
|
|
273
|
+
(!once || listeners.once) &&
|
|
274
|
+
(!context || listeners.context === context)
|
|
275
|
+
) {
|
|
276
|
+
clearEvent(this, evt);
|
|
277
|
+
}
|
|
278
|
+
} else {
|
|
279
|
+
for (var i = 0, events = [], length = listeners.length; i < length; i++) {
|
|
280
|
+
if (
|
|
281
|
+
listeners[i].fn !== fn ||
|
|
282
|
+
(once && !listeners[i].once) ||
|
|
283
|
+
(context && listeners[i].context !== context)
|
|
284
|
+
) {
|
|
285
|
+
events.push(listeners[i]);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
//
|
|
290
|
+
// Reset the array, or remove it completely if we have no more listeners.
|
|
291
|
+
//
|
|
292
|
+
if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
|
|
293
|
+
else clearEvent(this, evt);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
return this;
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Remove all listeners, or those of the specified event.
|
|
301
|
+
*
|
|
302
|
+
* @param {(String|Symbol)} [event] The event name.
|
|
303
|
+
* @returns {EventEmitter} `this`.
|
|
304
|
+
* @public
|
|
305
|
+
*/
|
|
306
|
+
EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
|
|
307
|
+
var evt;
|
|
308
|
+
|
|
309
|
+
if (event) {
|
|
310
|
+
evt = prefix ? prefix + event : event;
|
|
311
|
+
if (this._events[evt]) clearEvent(this, evt);
|
|
312
|
+
} else {
|
|
313
|
+
this._events = new Events();
|
|
314
|
+
this._eventsCount = 0;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
return this;
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
//
|
|
321
|
+
// Alias methods names because people roll like that.
|
|
322
|
+
//
|
|
323
|
+
EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
|
|
324
|
+
EventEmitter.prototype.addListener = EventEmitter.prototype.on;
|
|
325
|
+
|
|
326
|
+
//
|
|
327
|
+
// Expose the prefix.
|
|
328
|
+
//
|
|
329
|
+
EventEmitter.prefixed = prefix;
|
|
330
|
+
|
|
331
|
+
//
|
|
332
|
+
// Allow `EventEmitter` to be imported as module namespace.
|
|
333
|
+
//
|
|
334
|
+
EventEmitter.EventEmitter = EventEmitter;
|
|
335
|
+
|
|
336
|
+
//
|
|
337
|
+
// Expose the module.
|
|
338
|
+
//
|
|
339
|
+
{
|
|
340
|
+
module.exports = EventEmitter;
|
|
341
|
+
}
|
|
342
|
+
} (eventemitter3));
|
|
343
|
+
|
|
344
|
+
var eventemitter3Exports = eventemitter3.exports;
|
|
345
|
+
var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports);
|
|
346
|
+
|
|
347
|
+
var BinaryOpcode;
|
|
348
|
+
(function (BinaryOpcode) {
|
|
349
|
+
BinaryOpcode[BinaryOpcode["MESSAGE_DATA"] = 1] = "MESSAGE_DATA";
|
|
350
|
+
BinaryOpcode[BinaryOpcode["TIME"] = 2] = "TIME";
|
|
351
|
+
BinaryOpcode[BinaryOpcode["SERVICE_CALL_RESPONSE"] = 3] = "SERVICE_CALL_RESPONSE";
|
|
352
|
+
BinaryOpcode[BinaryOpcode["FETCH_ASSET_RESPONSE"] = 4] = "FETCH_ASSET_RESPONSE";
|
|
353
|
+
})(BinaryOpcode || (BinaryOpcode = {}));
|
|
354
|
+
var ClientBinaryOpcode;
|
|
355
|
+
(function (ClientBinaryOpcode) {
|
|
356
|
+
ClientBinaryOpcode[ClientBinaryOpcode["MESSAGE_DATA"] = 1] = "MESSAGE_DATA";
|
|
357
|
+
ClientBinaryOpcode[ClientBinaryOpcode["SERVICE_CALL_REQUEST"] = 2] = "SERVICE_CALL_REQUEST";
|
|
358
|
+
})(ClientBinaryOpcode || (ClientBinaryOpcode = {}));
|
|
359
|
+
var StatusLevel;
|
|
360
|
+
(function (StatusLevel) {
|
|
361
|
+
StatusLevel[StatusLevel["INFO"] = 0] = "INFO";
|
|
362
|
+
StatusLevel[StatusLevel["WARNING"] = 1] = "WARNING";
|
|
363
|
+
StatusLevel[StatusLevel["ERROR"] = 2] = "ERROR";
|
|
364
|
+
})(StatusLevel || (StatusLevel = {}));
|
|
365
|
+
var ServerCapability;
|
|
366
|
+
(function (ServerCapability) {
|
|
367
|
+
ServerCapability["clientPublish"] = "clientPublish";
|
|
368
|
+
ServerCapability["time"] = "time";
|
|
369
|
+
ServerCapability["parameters"] = "parameters";
|
|
370
|
+
ServerCapability["parametersSubscribe"] = "parametersSubscribe";
|
|
371
|
+
ServerCapability["services"] = "services";
|
|
372
|
+
ServerCapability["connectionGraph"] = "connectionGraph";
|
|
373
|
+
ServerCapability["assets"] = "assets";
|
|
374
|
+
})(ServerCapability || (ServerCapability = {}));
|
|
375
|
+
var FetchAssetStatus;
|
|
376
|
+
(function (FetchAssetStatus) {
|
|
377
|
+
FetchAssetStatus[FetchAssetStatus["SUCCESS"] = 0] = "SUCCESS";
|
|
378
|
+
FetchAssetStatus[FetchAssetStatus["ERROR"] = 1] = "ERROR";
|
|
379
|
+
})(FetchAssetStatus || (FetchAssetStatus = {}));
|
|
380
|
+
|
|
381
|
+
const textDecoder = new TextDecoder();
|
|
382
|
+
function parseServerMessage(buffer) {
|
|
383
|
+
const view = new DataView(buffer);
|
|
384
|
+
let offset = 0;
|
|
385
|
+
const op = view.getUint8(offset);
|
|
386
|
+
offset += 1;
|
|
387
|
+
switch (op) {
|
|
388
|
+
case BinaryOpcode.MESSAGE_DATA: {
|
|
389
|
+
const subscriptionId = view.getUint32(offset, true);
|
|
390
|
+
offset += 4;
|
|
391
|
+
const timestamp = view.getBigUint64(offset, true);
|
|
392
|
+
offset += 8;
|
|
393
|
+
const data = new DataView(buffer, offset);
|
|
394
|
+
return { op, subscriptionId, timestamp, data };
|
|
395
|
+
}
|
|
396
|
+
case BinaryOpcode.TIME: {
|
|
397
|
+
const timestamp = view.getBigUint64(offset, true);
|
|
398
|
+
return { op, timestamp };
|
|
399
|
+
}
|
|
400
|
+
case BinaryOpcode.SERVICE_CALL_RESPONSE: {
|
|
401
|
+
const serviceId = view.getUint32(offset, true);
|
|
402
|
+
offset += 4;
|
|
403
|
+
const callId = view.getUint32(offset, true);
|
|
404
|
+
offset += 4;
|
|
405
|
+
const encodingLength = view.getUint32(offset, true);
|
|
406
|
+
offset += 4;
|
|
407
|
+
const encodingBytes = new DataView(buffer, offset, encodingLength);
|
|
408
|
+
const encoding = textDecoder.decode(encodingBytes);
|
|
409
|
+
offset += encodingLength;
|
|
410
|
+
const data = new DataView(buffer, offset, buffer.byteLength - offset);
|
|
411
|
+
return { op, serviceId, callId, encoding, data };
|
|
412
|
+
}
|
|
413
|
+
case BinaryOpcode.FETCH_ASSET_RESPONSE: {
|
|
414
|
+
const requestId = view.getUint32(offset, true);
|
|
415
|
+
offset += 4;
|
|
416
|
+
const status = view.getUint8(offset);
|
|
417
|
+
offset += 1;
|
|
418
|
+
const errorMsgLength = view.getUint32(offset, true);
|
|
419
|
+
offset += 4;
|
|
420
|
+
const error = textDecoder.decode(new DataView(buffer, offset, errorMsgLength));
|
|
421
|
+
offset += errorMsgLength;
|
|
422
|
+
switch (status) {
|
|
423
|
+
case FetchAssetStatus.SUCCESS: {
|
|
424
|
+
const data = new DataView(buffer, offset, buffer.byteLength - offset);
|
|
425
|
+
return { op, requestId, status, data };
|
|
426
|
+
}
|
|
427
|
+
case FetchAssetStatus.ERROR:
|
|
428
|
+
return { op, requestId, status, error };
|
|
429
|
+
default:
|
|
430
|
+
throw new Error(`Unrecognized fetch asset status: ${status}`);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
throw new Error(`Unrecognized server opcode in binary message: ${op.toString(16)}`);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
const textEncoder = new TextEncoder();
|
|
438
|
+
class FoxgloveClient {
|
|
439
|
+
static SUPPORTED_SUBPROTOCOL = "foxglove.websocket.v1";
|
|
440
|
+
#emitter = new EventEmitter();
|
|
441
|
+
#ws;
|
|
442
|
+
#nextSubscriptionId = 0;
|
|
443
|
+
#nextAdvertisementId = 0;
|
|
444
|
+
constructor({ ws }) {
|
|
445
|
+
this.#ws = ws;
|
|
446
|
+
this.#reconnect();
|
|
447
|
+
}
|
|
448
|
+
on(name, listener) {
|
|
449
|
+
this.#emitter.on(name, listener);
|
|
450
|
+
}
|
|
451
|
+
off(name, listener) {
|
|
452
|
+
this.#emitter.off(name, listener);
|
|
453
|
+
}
|
|
454
|
+
#reconnect() {
|
|
455
|
+
this.#ws.binaryType = "arraybuffer";
|
|
456
|
+
this.#ws.onerror = (event) => {
|
|
457
|
+
this.#emitter.emit("error", event.error);
|
|
458
|
+
};
|
|
459
|
+
this.#ws.onopen = (_event) => {
|
|
460
|
+
if (this.#ws.protocol !== FoxgloveClient.SUPPORTED_SUBPROTOCOL) {
|
|
461
|
+
throw new Error(`Expected subprotocol ${FoxgloveClient.SUPPORTED_SUBPROTOCOL}, got '${this.#ws.protocol}'`);
|
|
462
|
+
}
|
|
463
|
+
this.#emitter.emit("open");
|
|
464
|
+
};
|
|
465
|
+
this.#ws.onmessage = (event) => {
|
|
466
|
+
let message;
|
|
467
|
+
try {
|
|
468
|
+
if (event.data instanceof ArrayBuffer) {
|
|
469
|
+
message = parseServerMessage(event.data);
|
|
470
|
+
}
|
|
471
|
+
else {
|
|
472
|
+
message = JSON.parse(event.data);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
catch (error) {
|
|
476
|
+
this.#emitter.emit("error", error);
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
479
|
+
switch (message.op) {
|
|
480
|
+
case "serverInfo":
|
|
481
|
+
this.#emitter.emit("serverInfo", message);
|
|
482
|
+
return;
|
|
483
|
+
case "status":
|
|
484
|
+
this.#emitter.emit("status", message);
|
|
485
|
+
return;
|
|
486
|
+
case "advertise":
|
|
487
|
+
this.#emitter.emit("advertise", message.channels);
|
|
488
|
+
return;
|
|
489
|
+
case "unadvertise":
|
|
490
|
+
this.#emitter.emit("unadvertise", message.channelIds);
|
|
491
|
+
return;
|
|
492
|
+
case "parameterValues":
|
|
493
|
+
this.#emitter.emit("parameterValues", message);
|
|
494
|
+
return;
|
|
495
|
+
case "advertiseServices":
|
|
496
|
+
this.#emitter.emit("advertiseServices", message.services);
|
|
497
|
+
return;
|
|
498
|
+
case "unadvertiseServices":
|
|
499
|
+
this.#emitter.emit("unadvertiseServices", message.serviceIds);
|
|
500
|
+
return;
|
|
501
|
+
case "connectionGraphUpdate":
|
|
502
|
+
this.#emitter.emit("connectionGraphUpdate", message);
|
|
503
|
+
return;
|
|
504
|
+
case BinaryOpcode.MESSAGE_DATA:
|
|
505
|
+
this.#emitter.emit("message", message);
|
|
506
|
+
return;
|
|
507
|
+
case BinaryOpcode.TIME:
|
|
508
|
+
this.#emitter.emit("time", message);
|
|
509
|
+
return;
|
|
510
|
+
case BinaryOpcode.SERVICE_CALL_RESPONSE:
|
|
511
|
+
this.#emitter.emit("serviceCallResponse", message);
|
|
512
|
+
return;
|
|
513
|
+
case BinaryOpcode.FETCH_ASSET_RESPONSE:
|
|
514
|
+
this.#emitter.emit("fetchAssetResponse", message);
|
|
515
|
+
return;
|
|
516
|
+
}
|
|
517
|
+
this.#emitter.emit("error", new Error(`Unrecognized server opcode: ${message.op}`));
|
|
518
|
+
};
|
|
519
|
+
this.#ws.onclose = (event) => {
|
|
520
|
+
this.#emitter.emit("close", event);
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
close() {
|
|
524
|
+
this.#ws.close();
|
|
525
|
+
}
|
|
526
|
+
subscribe(channelId) {
|
|
527
|
+
const id = this.#nextSubscriptionId++;
|
|
528
|
+
const subscriptions = [{ id, channelId }];
|
|
529
|
+
this.#send({ op: "subscribe", subscriptions });
|
|
530
|
+
return id;
|
|
531
|
+
}
|
|
532
|
+
unsubscribe(subscriptionId) {
|
|
533
|
+
this.#send({ op: "unsubscribe", subscriptionIds: [subscriptionId] });
|
|
534
|
+
}
|
|
535
|
+
advertise(clientChannel) {
|
|
536
|
+
const id = ++this.#nextAdvertisementId;
|
|
537
|
+
const channels = [{ id, ...clientChannel }];
|
|
538
|
+
this.#send({ op: "advertise", channels });
|
|
539
|
+
return id;
|
|
540
|
+
}
|
|
541
|
+
unadvertise(channelId) {
|
|
542
|
+
this.#send({ op: "unadvertise", channelIds: [channelId] });
|
|
543
|
+
}
|
|
544
|
+
getParameters(parameterNames, id) {
|
|
545
|
+
this.#send({ op: "getParameters", parameterNames, id });
|
|
546
|
+
}
|
|
547
|
+
setParameters(parameters, id) {
|
|
548
|
+
this.#send({ op: "setParameters", parameters, id });
|
|
549
|
+
}
|
|
550
|
+
subscribeParameterUpdates(parameterNames) {
|
|
551
|
+
this.#send({ op: "subscribeParameterUpdates", parameterNames });
|
|
552
|
+
}
|
|
553
|
+
unsubscribeParameterUpdates(parameterNames) {
|
|
554
|
+
this.#send({ op: "unsubscribeParameterUpdates", parameterNames });
|
|
555
|
+
}
|
|
556
|
+
sendMessage(channelId, data) {
|
|
557
|
+
const payload = new Uint8Array(5 + data.byteLength);
|
|
558
|
+
const view = new DataView(payload.buffer, payload.byteOffset, payload.byteLength);
|
|
559
|
+
view.setUint8(0, ClientBinaryOpcode.MESSAGE_DATA);
|
|
560
|
+
view.setUint32(1, channelId, true);
|
|
561
|
+
payload.set(data, 5);
|
|
562
|
+
this.#ws.send(payload);
|
|
563
|
+
}
|
|
564
|
+
sendServiceCallRequest(request) {
|
|
565
|
+
const encoding = textEncoder.encode(request.encoding);
|
|
566
|
+
const payload = new Uint8Array(1 + 4 + 4 + 4 + encoding.length + request.data.byteLength);
|
|
567
|
+
const view = new DataView(payload.buffer, payload.byteOffset, payload.byteLength);
|
|
568
|
+
let offset = 0;
|
|
569
|
+
view.setUint8(offset, ClientBinaryOpcode.SERVICE_CALL_REQUEST);
|
|
570
|
+
offset += 1;
|
|
571
|
+
view.setUint32(offset, request.serviceId, true);
|
|
572
|
+
offset += 4;
|
|
573
|
+
view.setUint32(offset, request.callId, true);
|
|
574
|
+
offset += 4;
|
|
575
|
+
view.setUint32(offset, request.encoding.length, true);
|
|
576
|
+
offset += 4;
|
|
577
|
+
payload.set(encoding, offset);
|
|
578
|
+
offset += encoding.length;
|
|
579
|
+
const data = new Uint8Array(request.data.buffer, request.data.byteOffset, request.data.byteLength);
|
|
580
|
+
payload.set(data, offset);
|
|
581
|
+
this.#ws.send(payload);
|
|
582
|
+
}
|
|
583
|
+
subscribeConnectionGraph() {
|
|
584
|
+
this.#send({ op: "subscribeConnectionGraph" });
|
|
585
|
+
}
|
|
586
|
+
unsubscribeConnectionGraph() {
|
|
587
|
+
this.#send({ op: "unsubscribeConnectionGraph" });
|
|
588
|
+
}
|
|
589
|
+
fetchAsset(uri, requestId) {
|
|
590
|
+
this.#send({ op: "fetchAsset", uri, requestId });
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* @deprecated Use `sendServiceCallRequest` instead
|
|
594
|
+
*/
|
|
595
|
+
sendCallServiceRequest(request) {
|
|
596
|
+
this.sendServiceCallRequest(request);
|
|
597
|
+
}
|
|
598
|
+
#send(message) {
|
|
599
|
+
this.#ws.send(JSON.stringify(message));
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
var browser = {exports: {}};
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* This is the common logic for both the Node.js and web browser
|
|
607
|
+
* implementations of `debug()`.
|
|
608
|
+
*/
|
|
609
|
+
|
|
610
|
+
function setup(env) {
|
|
611
|
+
createDebug.debug = createDebug;
|
|
612
|
+
createDebug.default = createDebug;
|
|
613
|
+
createDebug.coerce = coerce;
|
|
614
|
+
createDebug.disable = disable;
|
|
615
|
+
createDebug.enable = enable;
|
|
616
|
+
createDebug.enabled = enabled;
|
|
617
|
+
createDebug.humanize = require$$0;
|
|
618
|
+
createDebug.destroy = destroy;
|
|
619
|
+
|
|
620
|
+
Object.keys(env).forEach(key => {
|
|
621
|
+
createDebug[key] = env[key];
|
|
622
|
+
});
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* The currently active debug mode names, and names to skip.
|
|
626
|
+
*/
|
|
627
|
+
|
|
628
|
+
createDebug.names = [];
|
|
629
|
+
createDebug.skips = [];
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* Map of special "%n" handling functions, for the debug "format" argument.
|
|
633
|
+
*
|
|
634
|
+
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
|
635
|
+
*/
|
|
636
|
+
createDebug.formatters = {};
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* Selects a color for a debug namespace
|
|
640
|
+
* @param {String} namespace The namespace string for the debug instance to be colored
|
|
641
|
+
* @return {Number|String} An ANSI color code for the given namespace
|
|
642
|
+
* @api private
|
|
643
|
+
*/
|
|
644
|
+
function selectColor(namespace) {
|
|
645
|
+
let hash = 0;
|
|
646
|
+
|
|
647
|
+
for (let i = 0; i < namespace.length; i++) {
|
|
648
|
+
hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
|
|
649
|
+
hash |= 0; // Convert to 32bit integer
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
653
|
+
}
|
|
654
|
+
createDebug.selectColor = selectColor;
|
|
655
|
+
|
|
656
|
+
/**
|
|
657
|
+
* Create a debugger with the given `namespace`.
|
|
658
|
+
*
|
|
659
|
+
* @param {String} namespace
|
|
660
|
+
* @return {Function}
|
|
661
|
+
* @api public
|
|
662
|
+
*/
|
|
663
|
+
function createDebug(namespace) {
|
|
664
|
+
let prevTime;
|
|
665
|
+
let enableOverride = null;
|
|
666
|
+
let namespacesCache;
|
|
667
|
+
let enabledCache;
|
|
668
|
+
|
|
669
|
+
function debug(...args) {
|
|
670
|
+
// Disabled?
|
|
671
|
+
if (!debug.enabled) {
|
|
672
|
+
return;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
const self = debug;
|
|
676
|
+
|
|
677
|
+
// Set `diff` timestamp
|
|
678
|
+
const curr = Number(new Date());
|
|
679
|
+
const ms = curr - (prevTime || curr);
|
|
680
|
+
self.diff = ms;
|
|
681
|
+
self.prev = prevTime;
|
|
682
|
+
self.curr = curr;
|
|
683
|
+
prevTime = curr;
|
|
684
|
+
|
|
685
|
+
args[0] = createDebug.coerce(args[0]);
|
|
686
|
+
|
|
687
|
+
if (typeof args[0] !== 'string') {
|
|
688
|
+
// Anything else let's inspect with %O
|
|
689
|
+
args.unshift('%O');
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
// Apply any `formatters` transformations
|
|
693
|
+
let index = 0;
|
|
694
|
+
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
|
695
|
+
// If we encounter an escaped % then don't increase the array index
|
|
696
|
+
if (match === '%%') {
|
|
697
|
+
return '%';
|
|
698
|
+
}
|
|
699
|
+
index++;
|
|
700
|
+
const formatter = createDebug.formatters[format];
|
|
701
|
+
if (typeof formatter === 'function') {
|
|
702
|
+
const val = args[index];
|
|
703
|
+
match = formatter.call(self, val);
|
|
704
|
+
|
|
705
|
+
// Now we need to remove `args[index]` since it's inlined in the `format`
|
|
706
|
+
args.splice(index, 1);
|
|
707
|
+
index--;
|
|
708
|
+
}
|
|
709
|
+
return match;
|
|
710
|
+
});
|
|
711
|
+
|
|
712
|
+
// Apply env-specific formatting (colors, etc.)
|
|
713
|
+
createDebug.formatArgs.call(self, args);
|
|
714
|
+
|
|
715
|
+
const logFn = self.log || createDebug.log;
|
|
716
|
+
logFn.apply(self, args);
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
debug.namespace = namespace;
|
|
720
|
+
debug.useColors = createDebug.useColors();
|
|
721
|
+
debug.color = createDebug.selectColor(namespace);
|
|
722
|
+
debug.extend = extend;
|
|
723
|
+
debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
|
|
724
|
+
|
|
725
|
+
Object.defineProperty(debug, 'enabled', {
|
|
726
|
+
enumerable: true,
|
|
727
|
+
configurable: false,
|
|
728
|
+
get: () => {
|
|
729
|
+
if (enableOverride !== null) {
|
|
730
|
+
return enableOverride;
|
|
731
|
+
}
|
|
732
|
+
if (namespacesCache !== createDebug.namespaces) {
|
|
733
|
+
namespacesCache = createDebug.namespaces;
|
|
734
|
+
enabledCache = createDebug.enabled(namespace);
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
return enabledCache;
|
|
738
|
+
},
|
|
739
|
+
set: v => {
|
|
740
|
+
enableOverride = v;
|
|
741
|
+
}
|
|
742
|
+
});
|
|
743
|
+
|
|
744
|
+
// Env-specific initialization logic for debug instances
|
|
745
|
+
if (typeof createDebug.init === 'function') {
|
|
746
|
+
createDebug.init(debug);
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
return debug;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
function extend(namespace, delimiter) {
|
|
753
|
+
const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
|
|
754
|
+
newDebug.log = this.log;
|
|
755
|
+
return newDebug;
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
/**
|
|
759
|
+
* Enables a debug mode by namespaces. This can include modes
|
|
760
|
+
* separated by a colon and wildcards.
|
|
761
|
+
*
|
|
762
|
+
* @param {String} namespaces
|
|
763
|
+
* @api public
|
|
764
|
+
*/
|
|
765
|
+
function enable(namespaces) {
|
|
766
|
+
createDebug.save(namespaces);
|
|
767
|
+
createDebug.namespaces = namespaces;
|
|
768
|
+
|
|
769
|
+
createDebug.names = [];
|
|
770
|
+
createDebug.skips = [];
|
|
771
|
+
|
|
772
|
+
let i;
|
|
773
|
+
const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
|
|
774
|
+
const len = split.length;
|
|
775
|
+
|
|
776
|
+
for (i = 0; i < len; i++) {
|
|
777
|
+
if (!split[i]) {
|
|
778
|
+
// ignore empty strings
|
|
779
|
+
continue;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
namespaces = split[i].replace(/\*/g, '.*?');
|
|
783
|
+
|
|
784
|
+
if (namespaces[0] === '-') {
|
|
785
|
+
createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));
|
|
786
|
+
} else {
|
|
787
|
+
createDebug.names.push(new RegExp('^' + namespaces + '$'));
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
/**
|
|
793
|
+
* Disable debug output.
|
|
794
|
+
*
|
|
795
|
+
* @return {String} namespaces
|
|
796
|
+
* @api public
|
|
797
|
+
*/
|
|
798
|
+
function disable() {
|
|
799
|
+
const namespaces = [
|
|
800
|
+
...createDebug.names.map(toNamespace),
|
|
801
|
+
...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
|
|
802
|
+
].join(',');
|
|
803
|
+
createDebug.enable('');
|
|
804
|
+
return namespaces;
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
/**
|
|
808
|
+
* Returns true if the given mode name is enabled, false otherwise.
|
|
809
|
+
*
|
|
810
|
+
* @param {String} name
|
|
811
|
+
* @return {Boolean}
|
|
812
|
+
* @api public
|
|
813
|
+
*/
|
|
814
|
+
function enabled(name) {
|
|
815
|
+
if (name[name.length - 1] === '*') {
|
|
816
|
+
return true;
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
let i;
|
|
820
|
+
let len;
|
|
821
|
+
|
|
822
|
+
for (i = 0, len = createDebug.skips.length; i < len; i++) {
|
|
823
|
+
if (createDebug.skips[i].test(name)) {
|
|
824
|
+
return false;
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
for (i = 0, len = createDebug.names.length; i < len; i++) {
|
|
829
|
+
if (createDebug.names[i].test(name)) {
|
|
830
|
+
return true;
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
return false;
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
/**
|
|
838
|
+
* Convert regexp to namespace
|
|
839
|
+
*
|
|
840
|
+
* @param {RegExp} regxep
|
|
841
|
+
* @return {String} namespace
|
|
842
|
+
* @api private
|
|
843
|
+
*/
|
|
844
|
+
function toNamespace(regexp) {
|
|
845
|
+
return regexp.toString()
|
|
846
|
+
.substring(2, regexp.toString().length - 2)
|
|
847
|
+
.replace(/\.\*\?$/, '*');
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
/**
|
|
851
|
+
* Coerce `val`.
|
|
852
|
+
*
|
|
853
|
+
* @param {Mixed} val
|
|
854
|
+
* @return {Mixed}
|
|
855
|
+
* @api private
|
|
856
|
+
*/
|
|
857
|
+
function coerce(val) {
|
|
858
|
+
if (val instanceof Error) {
|
|
859
|
+
return val.stack || val.message;
|
|
860
|
+
}
|
|
861
|
+
return val;
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
/**
|
|
865
|
+
* XXX DO NOT USE. This is a temporary stub function.
|
|
866
|
+
* XXX It WILL be removed in the next major release.
|
|
867
|
+
*/
|
|
868
|
+
function destroy() {
|
|
869
|
+
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
createDebug.enable(createDebug.load());
|
|
873
|
+
|
|
874
|
+
return createDebug;
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
var common = setup;
|
|
878
|
+
|
|
879
|
+
/* eslint-env browser */
|
|
880
|
+
|
|
881
|
+
(function (module, exports) {
|
|
882
|
+
/**
|
|
883
|
+
* This is the web browser implementation of `debug()`.
|
|
884
|
+
*/
|
|
885
|
+
|
|
886
|
+
exports.formatArgs = formatArgs;
|
|
887
|
+
exports.save = save;
|
|
888
|
+
exports.load = load;
|
|
889
|
+
exports.useColors = useColors;
|
|
890
|
+
exports.storage = localstorage();
|
|
891
|
+
exports.destroy = (() => {
|
|
892
|
+
let warned = false;
|
|
893
|
+
|
|
894
|
+
return () => {
|
|
895
|
+
if (!warned) {
|
|
896
|
+
warned = true;
|
|
897
|
+
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
|
898
|
+
}
|
|
899
|
+
};
|
|
900
|
+
})();
|
|
901
|
+
|
|
902
|
+
/**
|
|
903
|
+
* Colors.
|
|
904
|
+
*/
|
|
905
|
+
|
|
906
|
+
exports.colors = [
|
|
907
|
+
'#0000CC',
|
|
908
|
+
'#0000FF',
|
|
909
|
+
'#0033CC',
|
|
910
|
+
'#0033FF',
|
|
911
|
+
'#0066CC',
|
|
912
|
+
'#0066FF',
|
|
913
|
+
'#0099CC',
|
|
914
|
+
'#0099FF',
|
|
915
|
+
'#00CC00',
|
|
916
|
+
'#00CC33',
|
|
917
|
+
'#00CC66',
|
|
918
|
+
'#00CC99',
|
|
919
|
+
'#00CCCC',
|
|
920
|
+
'#00CCFF',
|
|
921
|
+
'#3300CC',
|
|
922
|
+
'#3300FF',
|
|
923
|
+
'#3333CC',
|
|
924
|
+
'#3333FF',
|
|
925
|
+
'#3366CC',
|
|
926
|
+
'#3366FF',
|
|
927
|
+
'#3399CC',
|
|
928
|
+
'#3399FF',
|
|
929
|
+
'#33CC00',
|
|
930
|
+
'#33CC33',
|
|
931
|
+
'#33CC66',
|
|
932
|
+
'#33CC99',
|
|
933
|
+
'#33CCCC',
|
|
934
|
+
'#33CCFF',
|
|
935
|
+
'#6600CC',
|
|
936
|
+
'#6600FF',
|
|
937
|
+
'#6633CC',
|
|
938
|
+
'#6633FF',
|
|
939
|
+
'#66CC00',
|
|
940
|
+
'#66CC33',
|
|
941
|
+
'#9900CC',
|
|
942
|
+
'#9900FF',
|
|
943
|
+
'#9933CC',
|
|
944
|
+
'#9933FF',
|
|
945
|
+
'#99CC00',
|
|
946
|
+
'#99CC33',
|
|
947
|
+
'#CC0000',
|
|
948
|
+
'#CC0033',
|
|
949
|
+
'#CC0066',
|
|
950
|
+
'#CC0099',
|
|
951
|
+
'#CC00CC',
|
|
952
|
+
'#CC00FF',
|
|
953
|
+
'#CC3300',
|
|
954
|
+
'#CC3333',
|
|
955
|
+
'#CC3366',
|
|
956
|
+
'#CC3399',
|
|
957
|
+
'#CC33CC',
|
|
958
|
+
'#CC33FF',
|
|
959
|
+
'#CC6600',
|
|
960
|
+
'#CC6633',
|
|
961
|
+
'#CC9900',
|
|
962
|
+
'#CC9933',
|
|
963
|
+
'#CCCC00',
|
|
964
|
+
'#CCCC33',
|
|
965
|
+
'#FF0000',
|
|
966
|
+
'#FF0033',
|
|
967
|
+
'#FF0066',
|
|
968
|
+
'#FF0099',
|
|
969
|
+
'#FF00CC',
|
|
970
|
+
'#FF00FF',
|
|
971
|
+
'#FF3300',
|
|
972
|
+
'#FF3333',
|
|
973
|
+
'#FF3366',
|
|
974
|
+
'#FF3399',
|
|
975
|
+
'#FF33CC',
|
|
976
|
+
'#FF33FF',
|
|
977
|
+
'#FF6600',
|
|
978
|
+
'#FF6633',
|
|
979
|
+
'#FF9900',
|
|
980
|
+
'#FF9933',
|
|
981
|
+
'#FFCC00',
|
|
982
|
+
'#FFCC33'
|
|
983
|
+
];
|
|
984
|
+
|
|
985
|
+
/**
|
|
986
|
+
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
|
987
|
+
* and the Firebug extension (any Firefox version) are known
|
|
988
|
+
* to support "%c" CSS customizations.
|
|
989
|
+
*
|
|
990
|
+
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
|
991
|
+
*/
|
|
992
|
+
|
|
993
|
+
// eslint-disable-next-line complexity
|
|
994
|
+
function useColors() {
|
|
995
|
+
// NB: In an Electron preload script, document will be defined but not fully
|
|
996
|
+
// initialized. Since we know we're in Chrome, we'll just detect this case
|
|
997
|
+
// explicitly
|
|
998
|
+
if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
|
|
999
|
+
return true;
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
// Internet Explorer and Edge do not support colors.
|
|
1003
|
+
if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
1004
|
+
return false;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
// Is webkit? http://stackoverflow.com/a/16459606/376773
|
|
1008
|
+
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
|
1009
|
+
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
|
|
1010
|
+
// Is firebug? http://stackoverflow.com/a/398120/376773
|
|
1011
|
+
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
|
|
1012
|
+
// Is firefox >= v31?
|
|
1013
|
+
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
1014
|
+
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
|
|
1015
|
+
// Double check webkit in userAgent just in case we are in a worker
|
|
1016
|
+
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
/**
|
|
1020
|
+
* Colorize log arguments if enabled.
|
|
1021
|
+
*
|
|
1022
|
+
* @api public
|
|
1023
|
+
*/
|
|
1024
|
+
|
|
1025
|
+
function formatArgs(args) {
|
|
1026
|
+
args[0] = (this.useColors ? '%c' : '') +
|
|
1027
|
+
this.namespace +
|
|
1028
|
+
(this.useColors ? ' %c' : ' ') +
|
|
1029
|
+
args[0] +
|
|
1030
|
+
(this.useColors ? '%c ' : ' ') +
|
|
1031
|
+
'+' + module.exports.humanize(this.diff);
|
|
1032
|
+
|
|
1033
|
+
if (!this.useColors) {
|
|
1034
|
+
return;
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
const c = 'color: ' + this.color;
|
|
1038
|
+
args.splice(1, 0, c, 'color: inherit');
|
|
1039
|
+
|
|
1040
|
+
// The final "%c" is somewhat tricky, because there could be other
|
|
1041
|
+
// arguments passed either before or after the %c, so we need to
|
|
1042
|
+
// figure out the correct index to insert the CSS into
|
|
1043
|
+
let index = 0;
|
|
1044
|
+
let lastC = 0;
|
|
1045
|
+
args[0].replace(/%[a-zA-Z%]/g, match => {
|
|
1046
|
+
if (match === '%%') {
|
|
1047
|
+
return;
|
|
1048
|
+
}
|
|
1049
|
+
index++;
|
|
1050
|
+
if (match === '%c') {
|
|
1051
|
+
// We only are interested in the *last* %c
|
|
1052
|
+
// (the user may have provided their own)
|
|
1053
|
+
lastC = index;
|
|
1054
|
+
}
|
|
1055
|
+
});
|
|
1056
|
+
|
|
1057
|
+
args.splice(lastC, 0, c);
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
/**
|
|
1061
|
+
* Invokes `console.debug()` when available.
|
|
1062
|
+
* No-op when `console.debug` is not a "function".
|
|
1063
|
+
* If `console.debug` is not available, falls back
|
|
1064
|
+
* to `console.log`.
|
|
1065
|
+
*
|
|
1066
|
+
* @api public
|
|
1067
|
+
*/
|
|
1068
|
+
exports.log = console.debug || console.log || (() => {});
|
|
1069
|
+
|
|
1070
|
+
/**
|
|
1071
|
+
* Save `namespaces`.
|
|
1072
|
+
*
|
|
1073
|
+
* @param {String} namespaces
|
|
1074
|
+
* @api private
|
|
1075
|
+
*/
|
|
1076
|
+
function save(namespaces) {
|
|
1077
|
+
try {
|
|
1078
|
+
if (namespaces) {
|
|
1079
|
+
exports.storage.setItem('debug', namespaces);
|
|
1080
|
+
} else {
|
|
1081
|
+
exports.storage.removeItem('debug');
|
|
1082
|
+
}
|
|
1083
|
+
} catch (error) {
|
|
1084
|
+
// Swallow
|
|
1085
|
+
// XXX (@Qix-) should we be logging these?
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
/**
|
|
1090
|
+
* Load `namespaces`.
|
|
1091
|
+
*
|
|
1092
|
+
* @return {String} returns the previously persisted debug modes
|
|
1093
|
+
* @api private
|
|
1094
|
+
*/
|
|
1095
|
+
function load() {
|
|
1096
|
+
let r;
|
|
1097
|
+
try {
|
|
1098
|
+
r = exports.storage.getItem('debug');
|
|
1099
|
+
} catch (error) {
|
|
1100
|
+
// Swallow
|
|
1101
|
+
// XXX (@Qix-) should we be logging these?
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
|
|
1105
|
+
if (!r && typeof process !== 'undefined' && 'env' in process) {
|
|
1106
|
+
r = process.env.DEBUG;
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
return r;
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
/**
|
|
1113
|
+
* Localstorage attempts to return the localstorage.
|
|
1114
|
+
*
|
|
1115
|
+
* This is necessary because safari throws
|
|
1116
|
+
* when a user disables cookies/localstorage
|
|
1117
|
+
* and you attempt to access it.
|
|
1118
|
+
*
|
|
1119
|
+
* @return {LocalStorage}
|
|
1120
|
+
* @api private
|
|
1121
|
+
*/
|
|
1122
|
+
|
|
1123
|
+
function localstorage() {
|
|
1124
|
+
try {
|
|
1125
|
+
// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
|
|
1126
|
+
// The Browser also has localStorage in the global context.
|
|
1127
|
+
return localStorage;
|
|
1128
|
+
} catch (error) {
|
|
1129
|
+
// Swallow
|
|
1130
|
+
// XXX (@Qix-) should we be logging these?
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
module.exports = common(exports);
|
|
1135
|
+
|
|
1136
|
+
const {formatters} = module.exports;
|
|
1137
|
+
|
|
1138
|
+
/**
|
|
1139
|
+
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
|
1140
|
+
*/
|
|
1141
|
+
|
|
1142
|
+
formatters.j = function (v) {
|
|
1143
|
+
try {
|
|
1144
|
+
return JSON.stringify(v);
|
|
1145
|
+
} catch (error) {
|
|
1146
|
+
return '[UnexpectedJSONParseError]: ' + error.message;
|
|
1147
|
+
}
|
|
1148
|
+
};
|
|
1149
|
+
} (browser, browser.exports));
|
|
1150
|
+
|
|
1151
|
+
var browserExports = browser.exports;
|
|
1152
|
+
var createDebug = /*@__PURE__*/getDefaultExportFromCjs(browserExports);
|
|
1153
|
+
|
|
1154
|
+
createDebug("foxglove:server");
|
|
1155
|
+
new TextEncoder();
|
|
1156
|
+
({
|
|
1157
|
+
subscribe: undefined,
|
|
1158
|
+
unsubscribe: undefined,
|
|
1159
|
+
advertise: ServerCapability.clientPublish,
|
|
1160
|
+
unadvertise: ServerCapability.clientPublish,
|
|
1161
|
+
[ClientBinaryOpcode.MESSAGE_DATA]: ServerCapability.clientPublish,
|
|
1162
|
+
getParameters: ServerCapability.parameters,
|
|
1163
|
+
setParameters: ServerCapability.parameters,
|
|
1164
|
+
subscribeParameterUpdates: ServerCapability.parametersSubscribe,
|
|
1165
|
+
unsubscribeParameterUpdates: ServerCapability.parametersSubscribe,
|
|
1166
|
+
[ClientBinaryOpcode.SERVICE_CALL_REQUEST]: ServerCapability.services,
|
|
1167
|
+
subscribeConnectionGraph: ServerCapability.connectionGraph,
|
|
1168
|
+
unsubscribeConnectionGraph: ServerCapability.connectionGraph,
|
|
1169
|
+
fetchAsset: ServerCapability.assets,
|
|
1170
|
+
});
|
|
1171
|
+
|
|
1172
|
+
export { BinaryOpcode as B, ClientBinaryOpcode as C, EventEmitter as E, FoxgloveClient as F };
|