-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
2430 lines (2402 loc) · 258 KB
/
main.js
File metadata and controls
2430 lines (2402 loc) · 258 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// node_modules/cross-fetch/dist/browser-ponyfill.js
var require_browser_ponyfill = __commonJS({
"node_modules/cross-fetch/dist/browser-ponyfill.js"(exports, module2) {
var global = typeof self !== "undefined" ? self : exports;
var __self__ = function() {
function F() {
this.fetch = false;
this.DOMException = global.DOMException;
}
F.prototype = global;
return new F();
}();
(function(self2) {
var irrelevant = function(exports2) {
var support = {
searchParams: "URLSearchParams" in self2,
iterable: "Symbol" in self2 && "iterator" in Symbol,
blob: "FileReader" in self2 && "Blob" in self2 && function() {
try {
new Blob();
return true;
} catch (e) {
return false;
}
}(),
formData: "FormData" in self2,
arrayBuffer: "ArrayBuffer" in self2
};
function isDataView(obj) {
return obj && DataView.prototype.isPrototypeOf(obj);
}
if (support.arrayBuffer) {
var viewClasses = [
"[object Int8Array]",
"[object Uint8Array]",
"[object Uint8ClampedArray]",
"[object Int16Array]",
"[object Uint16Array]",
"[object Int32Array]",
"[object Uint32Array]",
"[object Float32Array]",
"[object Float64Array]"
];
var isArrayBufferView = ArrayBuffer.isView || function(obj) {
return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1;
};
}
function normalizeName(name) {
if (typeof name !== "string") {
name = String(name);
}
if (/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(name)) {
throw new TypeError("Invalid character in header field name");
}
return name.toLowerCase();
}
function normalizeValue(value) {
if (typeof value !== "string") {
value = String(value);
}
return value;
}
function iteratorFor(items) {
var iterator = {
next: function() {
var value = items.shift();
return { done: value === void 0, value };
}
};
if (support.iterable) {
iterator[Symbol.iterator] = function() {
return iterator;
};
}
return iterator;
}
function Headers2(headers) {
this.map = {};
if (headers instanceof Headers2) {
headers.forEach(function(value, name) {
this.append(name, value);
}, this);
} else if (Array.isArray(headers)) {
headers.forEach(function(header) {
this.append(header[0], header[1]);
}, this);
} else if (headers) {
Object.getOwnPropertyNames(headers).forEach(function(name) {
this.append(name, headers[name]);
}, this);
}
}
Headers2.prototype.append = function(name, value) {
name = normalizeName(name);
value = normalizeValue(value);
var oldValue = this.map[name];
this.map[name] = oldValue ? oldValue + ", " + value : value;
};
Headers2.prototype["delete"] = function(name) {
delete this.map[normalizeName(name)];
};
Headers2.prototype.get = function(name) {
name = normalizeName(name);
return this.has(name) ? this.map[name] : null;
};
Headers2.prototype.has = function(name) {
return this.map.hasOwnProperty(normalizeName(name));
};
Headers2.prototype.set = function(name, value) {
this.map[normalizeName(name)] = normalizeValue(value);
};
Headers2.prototype.forEach = function(callback, thisArg) {
for (var name in this.map) {
if (this.map.hasOwnProperty(name)) {
callback.call(thisArg, this.map[name], name, this);
}
}
};
Headers2.prototype.keys = function() {
var items = [];
this.forEach(function(value, name) {
items.push(name);
});
return iteratorFor(items);
};
Headers2.prototype.values = function() {
var items = [];
this.forEach(function(value) {
items.push(value);
});
return iteratorFor(items);
};
Headers2.prototype.entries = function() {
var items = [];
this.forEach(function(value, name) {
items.push([name, value]);
});
return iteratorFor(items);
};
if (support.iterable) {
Headers2.prototype[Symbol.iterator] = Headers2.prototype.entries;
}
function consumed(body) {
if (body.bodyUsed) {
return Promise.reject(new TypeError("Already read"));
}
body.bodyUsed = true;
}
function fileReaderReady(reader) {
return new Promise(function(resolve, reject) {
reader.onload = function() {
resolve(reader.result);
};
reader.onerror = function() {
reject(reader.error);
};
});
}
function readBlobAsArrayBuffer(blob) {
var reader = new FileReader();
var promise = fileReaderReady(reader);
reader.readAsArrayBuffer(blob);
return promise;
}
function readBlobAsText(blob) {
var reader = new FileReader();
var promise = fileReaderReady(reader);
reader.readAsText(blob);
return promise;
}
function readArrayBufferAsText(buf) {
var view = new Uint8Array(buf);
var chars = new Array(view.length);
for (var i = 0; i < view.length; i++) {
chars[i] = String.fromCharCode(view[i]);
}
return chars.join("");
}
function bufferClone(buf) {
if (buf.slice) {
return buf.slice(0);
} else {
var view = new Uint8Array(buf.byteLength);
view.set(new Uint8Array(buf));
return view.buffer;
}
}
function Body() {
this.bodyUsed = false;
this._initBody = function(body) {
this._bodyInit = body;
if (!body) {
this._bodyText = "";
} else if (typeof body === "string") {
this._bodyText = body;
} else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
this._bodyBlob = body;
} else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
this._bodyFormData = body;
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
this._bodyText = body.toString();
} else if (support.arrayBuffer && support.blob && isDataView(body)) {
this._bodyArrayBuffer = bufferClone(body.buffer);
this._bodyInit = new Blob([this._bodyArrayBuffer]);
} else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
this._bodyArrayBuffer = bufferClone(body);
} else {
this._bodyText = body = Object.prototype.toString.call(body);
}
if (!this.headers.get("content-type")) {
if (typeof body === "string") {
this.headers.set("content-type", "text/plain;charset=UTF-8");
} else if (this._bodyBlob && this._bodyBlob.type) {
this.headers.set("content-type", this._bodyBlob.type);
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8");
}
}
};
if (support.blob) {
this.blob = function() {
var rejected = consumed(this);
if (rejected) {
return rejected;
}
if (this._bodyBlob) {
return Promise.resolve(this._bodyBlob);
} else if (this._bodyArrayBuffer) {
return Promise.resolve(new Blob([this._bodyArrayBuffer]));
} else if (this._bodyFormData) {
throw new Error("could not read FormData body as blob");
} else {
return Promise.resolve(new Blob([this._bodyText]));
}
};
this.arrayBuffer = function() {
if (this._bodyArrayBuffer) {
return consumed(this) || Promise.resolve(this._bodyArrayBuffer);
} else {
return this.blob().then(readBlobAsArrayBuffer);
}
};
}
this.text = function() {
var rejected = consumed(this);
if (rejected) {
return rejected;
}
if (this._bodyBlob) {
return readBlobAsText(this._bodyBlob);
} else if (this._bodyArrayBuffer) {
return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer));
} else if (this._bodyFormData) {
throw new Error("could not read FormData body as text");
} else {
return Promise.resolve(this._bodyText);
}
};
if (support.formData) {
this.formData = function() {
return this.text().then(decode);
};
}
this.json = function() {
return this.text().then(JSON.parse);
};
return this;
}
var methods = ["DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT"];
function normalizeMethod(method) {
var upcased = method.toUpperCase();
return methods.indexOf(upcased) > -1 ? upcased : method;
}
function Request(input, options) {
options = options || {};
var body = options.body;
if (input instanceof Request) {
if (input.bodyUsed) {
throw new TypeError("Already read");
}
this.url = input.url;
this.credentials = input.credentials;
if (!options.headers) {
this.headers = new Headers2(input.headers);
}
this.method = input.method;
this.mode = input.mode;
this.signal = input.signal;
if (!body && input._bodyInit != null) {
body = input._bodyInit;
input.bodyUsed = true;
}
} else {
this.url = String(input);
}
this.credentials = options.credentials || this.credentials || "same-origin";
if (options.headers || !this.headers) {
this.headers = new Headers2(options.headers);
}
this.method = normalizeMethod(options.method || this.method || "GET");
this.mode = options.mode || this.mode || null;
this.signal = options.signal || this.signal;
this.referrer = null;
if ((this.method === "GET" || this.method === "HEAD") && body) {
throw new TypeError("Body not allowed for GET or HEAD requests");
}
this._initBody(body);
}
Request.prototype.clone = function() {
return new Request(this, { body: this._bodyInit });
};
function decode(body) {
var form = new FormData();
body.trim().split("&").forEach(function(bytes) {
if (bytes) {
var split = bytes.split("=");
var name = split.shift().replace(/\+/g, " ");
var value = split.join("=").replace(/\+/g, " ");
form.append(decodeURIComponent(name), decodeURIComponent(value));
}
});
return form;
}
function parseHeaders(rawHeaders) {
var headers = new Headers2();
var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, " ");
preProcessedHeaders.split(/\r?\n/).forEach(function(line) {
var parts = line.split(":");
var key = parts.shift().trim();
if (key) {
var value = parts.join(":").trim();
headers.append(key, value);
}
});
return headers;
}
Body.call(Request.prototype);
function Response2(bodyInit, options) {
if (!options) {
options = {};
}
this.type = "default";
this.status = options.status === void 0 ? 200 : options.status;
this.ok = this.status >= 200 && this.status < 300;
this.statusText = "statusText" in options ? options.statusText : "OK";
this.headers = new Headers2(options.headers);
this.url = options.url || "";
this._initBody(bodyInit);
}
Body.call(Response2.prototype);
Response2.prototype.clone = function() {
return new Response2(this._bodyInit, {
status: this.status,
statusText: this.statusText,
headers: new Headers2(this.headers),
url: this.url
});
};
Response2.error = function() {
var response = new Response2(null, { status: 0, statusText: "" });
response.type = "error";
return response;
};
var redirectStatuses = [301, 302, 303, 307, 308];
Response2.redirect = function(url, status) {
if (redirectStatuses.indexOf(status) === -1) {
throw new RangeError("Invalid status code");
}
return new Response2(null, { status, headers: { location: url } });
};
exports2.DOMException = self2.DOMException;
try {
new exports2.DOMException();
} catch (err) {
exports2.DOMException = function(message, name) {
this.message = message;
this.name = name;
var error = Error(message);
this.stack = error.stack;
};
exports2.DOMException.prototype = Object.create(Error.prototype);
exports2.DOMException.prototype.constructor = exports2.DOMException;
}
function fetch2(input, init) {
return new Promise(function(resolve, reject) {
var request = new Request(input, init);
if (request.signal && request.signal.aborted) {
return reject(new exports2.DOMException("Aborted", "AbortError"));
}
var xhr = new XMLHttpRequest();
function abortXhr() {
xhr.abort();
}
xhr.onload = function() {
var options = {
status: xhr.status,
statusText: xhr.statusText,
headers: parseHeaders(xhr.getAllResponseHeaders() || "")
};
options.url = "responseURL" in xhr ? xhr.responseURL : options.headers.get("X-Request-URL");
var body = "response" in xhr ? xhr.response : xhr.responseText;
resolve(new Response2(body, options));
};
xhr.onerror = function() {
reject(new TypeError("Network request failed"));
};
xhr.ontimeout = function() {
reject(new TypeError("Network request failed"));
};
xhr.onabort = function() {
reject(new exports2.DOMException("Aborted", "AbortError"));
};
xhr.open(request.method, request.url, true);
if (request.credentials === "include") {
xhr.withCredentials = true;
} else if (request.credentials === "omit") {
xhr.withCredentials = false;
}
if ("responseType" in xhr && support.blob) {
xhr.responseType = "blob";
}
request.headers.forEach(function(value, name) {
xhr.setRequestHeader(name, value);
});
if (request.signal) {
request.signal.addEventListener("abort", abortXhr);
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
request.signal.removeEventListener("abort", abortXhr);
}
};
}
xhr.send(typeof request._bodyInit === "undefined" ? null : request._bodyInit);
});
}
fetch2.polyfill = true;
if (!self2.fetch) {
self2.fetch = fetch2;
self2.Headers = Headers2;
self2.Request = Request;
self2.Response = Response2;
}
exports2.Headers = Headers2;
exports2.Request = Request;
exports2.Response = Response2;
exports2.fetch = fetch2;
Object.defineProperty(exports2, "__esModule", { value: true });
return exports2;
}({});
})(__self__);
__self__.fetch.ponyfill = true;
delete __self__.fetch.polyfill;
var ctx = __self__;
exports = ctx.fetch;
exports.default = ctx.fetch;
exports.fetch = ctx.fetch;
exports.Headers = ctx.Headers;
exports.Request = ctx.Request;
exports.Response = ctx.Response;
module2.exports = exports;
}
});
// node_modules/deepmerge/dist/cjs.js
var require_cjs = __commonJS({
"node_modules/deepmerge/dist/cjs.js"(exports, module2) {
"use strict";
var isMergeableObject = function isMergeableObject2(value) {
return isNonNullObject(value) && !isSpecial(value);
};
function isNonNullObject(value) {
return !!value && typeof value === "object";
}
function isSpecial(value) {
var stringValue = Object.prototype.toString.call(value);
return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
}
var canUseSymbol = typeof Symbol === "function" && Symbol.for;
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
function isReactElement(value) {
return value.$$typeof === REACT_ELEMENT_TYPE;
}
function emptyTarget(val) {
return Array.isArray(val) ? [] : {};
}
function cloneUnlessOtherwiseSpecified(value, options) {
return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
}
function defaultArrayMerge(target, source, options) {
return target.concat(source).map(function(element) {
return cloneUnlessOtherwiseSpecified(element, options);
});
}
function getMergeFunction(key, options) {
if (!options.customMerge) {
return deepmerge;
}
var customMerge = options.customMerge(key);
return typeof customMerge === "function" ? customMerge : deepmerge;
}
function getEnumerableOwnPropertySymbols(target) {
return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
return Object.propertyIsEnumerable.call(target, symbol);
}) : [];
}
function getKeys(target) {
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
}
function propertyIsOnObject(object, property) {
try {
return property in object;
} catch (_) {
return false;
}
}
function propertyIsUnsafe(target, key) {
return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
}
function mergeObject(target, source, options) {
var destination = {};
if (options.isMergeableObject(target)) {
getKeys(target).forEach(function(key) {
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
});
}
getKeys(source).forEach(function(key) {
if (propertyIsUnsafe(target, key)) {
return;
}
if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
} else {
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
}
});
return destination;
}
function deepmerge(target, source, options) {
options = options || {};
options.arrayMerge = options.arrayMerge || defaultArrayMerge;
options.isMergeableObject = options.isMergeableObject || isMergeableObject;
options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
var sourceIsArray = Array.isArray(source);
var targetIsArray = Array.isArray(target);
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
if (!sourceAndTargetTypesMatch) {
return cloneUnlessOtherwiseSpecified(source, options);
} else if (sourceIsArray) {
return options.arrayMerge(target, source, options);
} else {
return mergeObject(target, source, options);
}
}
deepmerge.all = function deepmergeAll(array, options) {
if (!Array.isArray(array)) {
throw new Error("first argument should be an array");
}
return array.reduce(function(prev, next) {
return deepmerge(prev, next, options);
}, {});
};
var deepmerge_1 = deepmerge;
module2.exports = deepmerge_1;
}
});
// node_modules/es5-ext/global.js
var require_global = __commonJS({
"node_modules/es5-ext/global.js"(exports, module2) {
var naiveFallback = function() {
if (typeof self === "object" && self)
return self;
if (typeof window === "object" && window)
return window;
throw new Error("Unable to resolve global `this`");
};
module2.exports = function() {
if (this)
return this;
if (typeof globalThis === "object" && globalThis)
return globalThis;
try {
Object.defineProperty(Object.prototype, "__global__", {
get: function() {
return this;
},
configurable: true
});
} catch (error) {
return naiveFallback();
}
try {
if (!__global__)
return naiveFallback();
return __global__;
} finally {
delete Object.prototype.__global__;
}
}();
}
});
// node_modules/websocket/package.json
var require_package = __commonJS({
"node_modules/websocket/package.json"(exports, module2) {
module2.exports = {
_from: "websocket@^1.0.34",
_id: "websocket@1.0.34",
_inBundle: false,
_integrity: "sha512-PRDso2sGwF6kM75QykIesBijKSVceR6jL2G8NGYyq2XrItNC2P5/qL5XeR056GhA+Ly7JMFvJb9I312mJfmqnQ==",
_location: "/websocket",
_phantomChildren: {},
_requested: {
type: "range",
registry: true,
raw: "websocket@^1.0.34",
name: "websocket",
escapedName: "websocket",
rawSpec: "^1.0.34",
saveSpec: null,
fetchSpec: "^1.0.34"
},
_requiredBy: [
"/@deepgram/sdk"
],
_resolved: "https://registry.npmjs.org/websocket/-/websocket-1.0.34.tgz",
_shasum: "2bdc2602c08bf2c82253b730655c0ef7dcab3111",
_spec: "websocket@^1.0.34",
_where: "/Users/samfarrar/Documents/transcription_test/deepgram-transcription/node_modules/@deepgram/sdk",
author: {
name: "Brian McKelvey",
email: "theturtle32@gmail.com",
url: "https://github.com/theturtle32"
},
browser: "lib/browser.js",
bugs: {
url: "https://github.com/theturtle32/WebSocket-Node/issues"
},
bundleDependencies: false,
config: {
verbose: false
},
contributors: [
{
name: "I\xF1aki Baz Castillo",
email: "ibc@aliax.net",
url: "http://dev.sipdoc.net"
}
],
dependencies: {
bufferutil: "^4.0.1",
debug: "^2.2.0",
"es5-ext": "^0.10.50",
"typedarray-to-buffer": "^3.1.5",
"utf-8-validate": "^5.0.2",
yaeti: "^0.0.6"
},
deprecated: false,
description: "Websocket Client & Server Library implementing the WebSocket protocol as specified in RFC 6455.",
devDependencies: {
"buffer-equal": "^1.0.0",
gulp: "^4.0.2",
"gulp-jshint": "^2.0.4",
jshint: "^2.0.0",
"jshint-stylish": "^2.2.1",
tape: "^4.9.1"
},
directories: {
lib: "./lib"
},
engines: {
node: ">=4.0.0"
},
homepage: "https://github.com/theturtle32/WebSocket-Node",
keywords: [
"websocket",
"websockets",
"socket",
"networking",
"comet",
"push",
"RFC-6455",
"realtime",
"server",
"client"
],
license: "Apache-2.0",
main: "index",
name: "websocket",
repository: {
type: "git",
url: "git+https://github.com/theturtle32/WebSocket-Node.git"
},
scripts: {
gulp: "gulp",
test: "tape test/unit/*.js"
},
version: "1.0.34"
};
}
});
// node_modules/websocket/lib/version.js
var require_version = __commonJS({
"node_modules/websocket/lib/version.js"(exports, module2) {
module2.exports = require_package().version;
}
});
// node_modules/websocket/lib/browser.js
var require_browser = __commonJS({
"node_modules/websocket/lib/browser.js"(exports, module2) {
var _globalThis;
if (typeof globalThis === "object") {
_globalThis = globalThis;
} else {
try {
_globalThis = require_global();
} catch (error) {
} finally {
if (!_globalThis && typeof window !== "undefined") {
_globalThis = window;
}
if (!_globalThis) {
throw new Error("Could not determine global this");
}
}
}
var NativeWebSocket = _globalThis.WebSocket || _globalThis.MozWebSocket;
var websocket_version = require_version();
function W3CWebSocket(uri, protocols) {
var native_instance;
if (protocols) {
native_instance = new NativeWebSocket(uri, protocols);
} else {
native_instance = new NativeWebSocket(uri);
}
return native_instance;
}
if (NativeWebSocket) {
["CONNECTING", "OPEN", "CLOSING", "CLOSED"].forEach(function(prop) {
Object.defineProperty(W3CWebSocket, prop, {
get: function() {
return NativeWebSocket[prop];
}
});
});
}
module2.exports = {
"w3cwebsocket": NativeWebSocket ? W3CWebSocket : null,
"version": websocket_version
};
}
});
// main.ts
var main_exports = {};
__export(main_exports, {
default: () => DeepgramPlugin
});
module.exports = __toCommonJS(main_exports);
var import_obsidian = require("obsidian");
// node_modules/@deepgram/sdk/dist/module/lib/errors.js
var DeepgramError = class extends Error {
constructor(message) {
super(message);
this.__dgError = true;
this.name = "DeepgramError";
}
};
function isDeepgramError(error) {
return typeof error === "object" && error !== null && "__dgError" in error;
}
var DeepgramApiError = class extends DeepgramError {
constructor(message, status) {
super(message);
this.name = "DeepgramApiError";
this.status = status;
}
toJSON() {
return {
name: this.name,
message: this.message,
status: this.status
};
}
};
var DeepgramUnknownError = class extends DeepgramError {
constructor(message, originalError) {
super(message);
this.name = "DeepgramUnknownError";
this.originalError = originalError;
}
};
var DeepgramVersionError = class extends DeepgramError {
constructor() {
super(`You are attempting to use an old format for a newer SDK version. Read more here: https://dpgr.am/js-v3`);
this.name = "DeepgramVersionError";
}
};
// node_modules/@deepgram/sdk/dist/module/lib/helpers.js
var import_cross_fetch = __toESM(require_browser_ponyfill());
var import_deepmerge = __toESM(require_cjs());
function stripTrailingSlash(url) {
return url.replace(/\/$/, "");
}
var isBrowser = () => typeof window !== "undefined";
function applySettingDefaults(options, defaults) {
return (0, import_deepmerge.default)(defaults, options);
}
function appendSearchParams(searchParams, options) {
Object.keys(options).forEach((i) => {
if (Array.isArray(options[i])) {
const arrayParams = options[i];
arrayParams.forEach((param) => {
searchParams.append(i, String(param));
});
} else {
searchParams.append(i, String(options[i]));
}
});
}
var resolveHeadersConstructor = () => {
if (typeof Headers === "undefined") {
return import_cross_fetch.Headers;
}
return Headers;
};
var isUrlSource = (providedSource) => {
if (providedSource.url)
return true;
return false;
};
var isTextSource = (providedSource) => {
if (providedSource.text)
return true;
return false;
};
var isFileSource = (providedSource) => {
if (isReadStreamSource(providedSource) || isBufferSource(providedSource))
return true;
return false;
};
var isBufferSource = (providedSource) => {
if (providedSource)
return true;
return false;
};
var isReadStreamSource = (providedSource) => {
if (providedSource)
return true;
return false;
};
// node_modules/@deepgram/sdk/dist/module/lib/version.js
var version = "3.3.1";
// node_modules/@deepgram/sdk/dist/module/lib/constants.js
var NODE_VERSION = process.versions.node;
var DEFAULT_HEADERS = {
"Content-Type": `application/json`,
"X-Client-Info": `@deepgram/sdk; ${isBrowser() ? "browser" : "server"}; v${version}`,
"User-Agent": `@deepgram/sdk/${version} ${isBrowser() ? "javascript" : `node/${NODE_VERSION}`}`
};
var DEFAULT_URL = "https://api.deepgram.com";
var DEFAULT_GLOBAL_OPTIONS = {
url: DEFAULT_URL
};
var DEFAULT_FETCH_OPTIONS = {
headers: DEFAULT_HEADERS
};
var DEFAULT_OPTIONS = {
global: DEFAULT_GLOBAL_OPTIONS,
fetch: DEFAULT_FETCH_OPTIONS
};
// node_modules/@deepgram/sdk/dist/module/packages/AbstractClient.js
var AbstractClient = class {
constructor(key, options) {
var _a, _b;
this.key = key;
this.options = options;
this.key = key;
if (!key) {
this.key = process.env.DEEPGRAM_API_KEY;
}
if (!this.key) {
throw new DeepgramError("A deepgram API key is required");
}
this.options = applySettingDefaults(options, DEFAULT_OPTIONS);
if (!((_a = this.options.global) === null || _a === void 0 ? void 0 : _a.url)) {
throw new DeepgramError(`An API URL is required. It should be set to ${DEFAULT_URL} by default. No idea what happened!`);
}
let baseUrlString = this.options.global.url;
let proxyUrlString;
if (!baseUrlString.startsWith("http") && !baseUrlString.startsWith("ws")) {
console.warn(`The base URL provided does not begin with http, https, ws, or wss and will default to https as standard.`);
}
if ((_b = this.options.restProxy) === null || _b === void 0 ? void 0 : _b.url) {
if (this.key !== "proxy") {
throw new DeepgramError(`Do not attempt to pass any other API key than the string "proxy" when making proxied REST requests. Please ensure your proxy application is responsible for writing our API key to the Authorization header.`);
}
proxyUrlString = this.options.restProxy.url;
if (!proxyUrlString.startsWith("http") && !proxyUrlString.startsWith("ws")) {
console.warn(`The proxy URL provided does not begin with http, https, ws, or wss and will default to https as standard.`);
}
baseUrlString = proxyUrlString;
}
this.baseUrl = this.resolveBaseUrl(baseUrlString);
}
resolveBaseUrl(url) {
if (!/^https?:\/\//i.test(url)) {
url = "https://" + url;
}
return new URL(stripTrailingSlash(url));
}
willProxy() {
var _a;
const proxyUrl = (_a = this.options.restProxy) === null || _a === void 0 ? void 0 : _a.url;
return !!proxyUrl;
}
};
// node_modules/@deepgram/sdk/dist/module/packages/AbstractWsClient.js
var import_events = require("events");
var AbstractWsClient = class extends import_events.EventEmitter {
constructor(key, options = DEFAULT_OPTIONS) {
var _a;
super();
this.key = key;
this.options = options;
this.key = key;
if (!key) {
this.key = process.env.DEEPGRAM_API_KEY;
}
if (!this.key) {
throw new Error("A deepgram API key is required");
}
this.options = applySettingDefaults(options, DEFAULT_OPTIONS);
if (!((_a = this.options.global) === null || _a === void 0 ? void 0 : _a.url)) {
throw new Error(`An API URL is required. It should be set to ${DEFAULT_URL} by default. No idea what happened!`);
}
let url = this.options.global.url;
if (!/^https?:\/\//i.test(url)) {
url = "https://" + url;
}
this.baseUrl = new URL(stripTrailingSlash(url));
this.baseUrl.protocol = this.baseUrl.protocol.toLowerCase().replace(/(http)(s)?/gi, "ws$2");
}
};
// node_modules/@deepgram/sdk/dist/module/lib/enums/LiveConnectionState.js
var LiveConnectionState;
(function(LiveConnectionState2) {
LiveConnectionState2[LiveConnectionState2["CONNECTING"] = 0] = "CONNECTING";
LiveConnectionState2[LiveConnectionState2["OPEN"] = 1] = "OPEN";
LiveConnectionState2[LiveConnectionState2["CLOSING"] = 2] = "CLOSING";
LiveConnectionState2[LiveConnectionState2["CLOSED"] = 3] = "CLOSED";
})(LiveConnectionState || (LiveConnectionState = {}));
// node_modules/@deepgram/sdk/dist/module/lib/enums/LiveTranscriptionEvents.js
var LiveTranscriptionEvents;