@sap/ux-ui5-tooling 1.18.4 → 1.18.6

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.
@@ -4325,8 +4325,8 @@ var require_DataView = __commonJS({
4325
4325
  "../../node_modules/lodash/_DataView.js"(exports2, module2) {
4326
4326
  var getNative = require_getNative();
4327
4327
  var root = require_root();
4328
- var DataView = getNative(root, "DataView");
4329
- module2.exports = DataView;
4328
+ var DataView2 = getNative(root, "DataView");
4329
+ module2.exports = DataView2;
4330
4330
  }
4331
4331
  });
4332
4332
 
@@ -4355,19 +4355,19 @@ var require_WeakMap = __commonJS({
4355
4355
  "../../node_modules/lodash/_WeakMap.js"(exports2, module2) {
4356
4356
  var getNative = require_getNative();
4357
4357
  var root = require_root();
4358
- var WeakMap = getNative(root, "WeakMap");
4359
- module2.exports = WeakMap;
4358
+ var WeakMap2 = getNative(root, "WeakMap");
4359
+ module2.exports = WeakMap2;
4360
4360
  }
4361
4361
  });
4362
4362
 
4363
4363
  // ../../node_modules/lodash/_getTag.js
4364
4364
  var require_getTag = __commonJS({
4365
4365
  "../../node_modules/lodash/_getTag.js"(exports2, module2) {
4366
- var DataView = require_DataView();
4366
+ var DataView2 = require_DataView();
4367
4367
  var Map2 = require_Map();
4368
4368
  var Promise2 = require_Promise();
4369
4369
  var Set2 = require_Set();
4370
- var WeakMap = require_WeakMap();
4370
+ var WeakMap2 = require_WeakMap();
4371
4371
  var baseGetTag = require_baseGetTag();
4372
4372
  var toSource = require_toSource();
4373
4373
  var mapTag = "[object Map]";
@@ -4376,13 +4376,13 @@ var require_getTag = __commonJS({
4376
4376
  var setTag = "[object Set]";
4377
4377
  var weakMapTag = "[object WeakMap]";
4378
4378
  var dataViewTag = "[object DataView]";
4379
- var dataViewCtorString = toSource(DataView);
4379
+ var dataViewCtorString = toSource(DataView2);
4380
4380
  var mapCtorString = toSource(Map2);
4381
4381
  var promiseCtorString = toSource(Promise2);
4382
4382
  var setCtorString = toSource(Set2);
4383
- var weakMapCtorString = toSource(WeakMap);
4383
+ var weakMapCtorString = toSource(WeakMap2);
4384
4384
  var getTag = baseGetTag;
4385
- if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map2 && getTag(new Map2()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set2 && getTag(new Set2()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) {
4385
+ if (DataView2 && getTag(new DataView2(new ArrayBuffer(1))) != dataViewTag || Map2 && getTag(new Map2()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set2 && getTag(new Set2()) != setTag || WeakMap2 && getTag(new WeakMap2()) != weakMapTag) {
4386
4386
  getTag = function(value) {
4387
4387
  var result = baseGetTag(value), Ctor = result == objectTag ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
4388
4388
  if (ctorString) {
@@ -21074,10 +21074,10 @@ var require_lodash = __commonJS({
21074
21074
  }();
21075
21075
  var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
21076
21076
  var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : undefined2, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax = Math2.max, nativeMin = Math2.min, nativeNow = Date2.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse;
21077
- var DataView = getNative(context, "DataView"), Map2 = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set2 = getNative(context, "Set"), WeakMap = getNative(context, "WeakMap"), nativeCreate = getNative(Object2, "create");
21078
- var metaMap = WeakMap && new WeakMap();
21077
+ var DataView2 = getNative(context, "DataView"), Map2 = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set2 = getNative(context, "Set"), WeakMap2 = getNative(context, "WeakMap"), nativeCreate = getNative(Object2, "create");
21078
+ var metaMap = WeakMap2 && new WeakMap2();
21079
21079
  var realNames = {};
21080
- var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map2), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set2), weakMapCtorString = toSource(WeakMap);
21080
+ var dataViewCtorString = toSource(DataView2), mapCtorString = toSource(Map2), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set2), weakMapCtorString = toSource(WeakMap2);
21081
21081
  var symbolProto = Symbol2 ? Symbol2.prototype : undefined2, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined2, symbolToString = symbolProto ? symbolProto.toString : undefined2;
21082
21082
  function lodash(value) {
21083
21083
  if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
@@ -23131,7 +23131,7 @@ var require_lodash = __commonJS({
23131
23131
  return result2;
23132
23132
  };
23133
23133
  var getTag = baseGetTag;
23134
- if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map2 && getTag(new Map2()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set2 && getTag(new Set2()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) {
23134
+ if (DataView2 && getTag(new DataView2(new ArrayBuffer(1))) != dataViewTag || Map2 && getTag(new Map2()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set2 && getTag(new Set2()) != setTag || WeakMap2 && getTag(new WeakMap2()) != weakMapTag) {
23135
23135
  getTag = function(value) {
23136
23136
  var result2 = baseGetTag(value), Ctor = result2 == objectTag ? value.constructor : undefined2, ctorString = Ctor ? toSource(Ctor) : "";
23137
23137
  if (ctorString) {
@@ -34769,9 +34769,1017 @@ var require_asynckit = __commonJS({
34769
34769
  }
34770
34770
  });
34771
34771
 
34772
+ // ../../node_modules/es-object-atoms/index.js
34773
+ var require_es_object_atoms = __commonJS({
34774
+ "../../node_modules/es-object-atoms/index.js"(exports2, module2) {
34775
+ "use strict";
34776
+ module2.exports = Object;
34777
+ }
34778
+ });
34779
+
34780
+ // ../../node_modules/es-errors/index.js
34781
+ var require_es_errors = __commonJS({
34782
+ "../../node_modules/es-errors/index.js"(exports2, module2) {
34783
+ "use strict";
34784
+ module2.exports = Error;
34785
+ }
34786
+ });
34787
+
34788
+ // ../../node_modules/es-errors/eval.js
34789
+ var require_eval = __commonJS({
34790
+ "../../node_modules/es-errors/eval.js"(exports2, module2) {
34791
+ "use strict";
34792
+ module2.exports = EvalError;
34793
+ }
34794
+ });
34795
+
34796
+ // ../../node_modules/es-errors/range.js
34797
+ var require_range = __commonJS({
34798
+ "../../node_modules/es-errors/range.js"(exports2, module2) {
34799
+ "use strict";
34800
+ module2.exports = RangeError;
34801
+ }
34802
+ });
34803
+
34804
+ // ../../node_modules/es-errors/ref.js
34805
+ var require_ref = __commonJS({
34806
+ "../../node_modules/es-errors/ref.js"(exports2, module2) {
34807
+ "use strict";
34808
+ module2.exports = ReferenceError;
34809
+ }
34810
+ });
34811
+
34812
+ // ../../node_modules/es-errors/syntax.js
34813
+ var require_syntax = __commonJS({
34814
+ "../../node_modules/es-errors/syntax.js"(exports2, module2) {
34815
+ "use strict";
34816
+ module2.exports = SyntaxError;
34817
+ }
34818
+ });
34819
+
34820
+ // ../../node_modules/es-errors/type.js
34821
+ var require_type = __commonJS({
34822
+ "../../node_modules/es-errors/type.js"(exports2, module2) {
34823
+ "use strict";
34824
+ module2.exports = TypeError;
34825
+ }
34826
+ });
34827
+
34828
+ // ../../node_modules/es-errors/uri.js
34829
+ var require_uri = __commonJS({
34830
+ "../../node_modules/es-errors/uri.js"(exports2, module2) {
34831
+ "use strict";
34832
+ module2.exports = URIError;
34833
+ }
34834
+ });
34835
+
34836
+ // ../../node_modules/math-intrinsics/abs.js
34837
+ var require_abs = __commonJS({
34838
+ "../../node_modules/math-intrinsics/abs.js"(exports2, module2) {
34839
+ "use strict";
34840
+ module2.exports = Math.abs;
34841
+ }
34842
+ });
34843
+
34844
+ // ../../node_modules/math-intrinsics/floor.js
34845
+ var require_floor = __commonJS({
34846
+ "../../node_modules/math-intrinsics/floor.js"(exports2, module2) {
34847
+ "use strict";
34848
+ module2.exports = Math.floor;
34849
+ }
34850
+ });
34851
+
34852
+ // ../../node_modules/math-intrinsics/max.js
34853
+ var require_max = __commonJS({
34854
+ "../../node_modules/math-intrinsics/max.js"(exports2, module2) {
34855
+ "use strict";
34856
+ module2.exports = Math.max;
34857
+ }
34858
+ });
34859
+
34860
+ // ../../node_modules/math-intrinsics/min.js
34861
+ var require_min = __commonJS({
34862
+ "../../node_modules/math-intrinsics/min.js"(exports2, module2) {
34863
+ "use strict";
34864
+ module2.exports = Math.min;
34865
+ }
34866
+ });
34867
+
34868
+ // ../../node_modules/math-intrinsics/pow.js
34869
+ var require_pow = __commonJS({
34870
+ "../../node_modules/math-intrinsics/pow.js"(exports2, module2) {
34871
+ "use strict";
34872
+ module2.exports = Math.pow;
34873
+ }
34874
+ });
34875
+
34876
+ // ../../node_modules/math-intrinsics/round.js
34877
+ var require_round = __commonJS({
34878
+ "../../node_modules/math-intrinsics/round.js"(exports2, module2) {
34879
+ "use strict";
34880
+ module2.exports = Math.round;
34881
+ }
34882
+ });
34883
+
34884
+ // ../../node_modules/math-intrinsics/isNaN.js
34885
+ var require_isNaN = __commonJS({
34886
+ "../../node_modules/math-intrinsics/isNaN.js"(exports2, module2) {
34887
+ "use strict";
34888
+ module2.exports = Number.isNaN || function isNaN2(a) {
34889
+ return a !== a;
34890
+ };
34891
+ }
34892
+ });
34893
+
34894
+ // ../../node_modules/math-intrinsics/sign.js
34895
+ var require_sign = __commonJS({
34896
+ "../../node_modules/math-intrinsics/sign.js"(exports2, module2) {
34897
+ "use strict";
34898
+ var $isNaN = require_isNaN();
34899
+ module2.exports = function sign(number) {
34900
+ if ($isNaN(number) || number === 0) {
34901
+ return number;
34902
+ }
34903
+ return number < 0 ? -1 : 1;
34904
+ };
34905
+ }
34906
+ });
34907
+
34908
+ // ../../node_modules/form-data/node_modules/gopd/gOPD.js
34909
+ var require_gOPD = __commonJS({
34910
+ "../../node_modules/form-data/node_modules/gopd/gOPD.js"(exports2, module2) {
34911
+ "use strict";
34912
+ module2.exports = Object.getOwnPropertyDescriptor;
34913
+ }
34914
+ });
34915
+
34916
+ // ../../node_modules/form-data/node_modules/gopd/index.js
34917
+ var require_gopd = __commonJS({
34918
+ "../../node_modules/form-data/node_modules/gopd/index.js"(exports2, module2) {
34919
+ "use strict";
34920
+ var $gOPD = require_gOPD();
34921
+ if ($gOPD) {
34922
+ try {
34923
+ $gOPD([], "length");
34924
+ } catch (e) {
34925
+ $gOPD = null;
34926
+ }
34927
+ }
34928
+ module2.exports = $gOPD;
34929
+ }
34930
+ });
34931
+
34932
+ // ../../node_modules/form-data/node_modules/es-define-property/index.js
34933
+ var require_es_define_property = __commonJS({
34934
+ "../../node_modules/form-data/node_modules/es-define-property/index.js"(exports2, module2) {
34935
+ "use strict";
34936
+ var $defineProperty = Object.defineProperty || false;
34937
+ if ($defineProperty) {
34938
+ try {
34939
+ $defineProperty({}, "a", { value: 1 });
34940
+ } catch (e) {
34941
+ $defineProperty = false;
34942
+ }
34943
+ }
34944
+ module2.exports = $defineProperty;
34945
+ }
34946
+ });
34947
+
34948
+ // ../../node_modules/form-data/node_modules/get-intrinsic/node_modules/has-symbols/shams.js
34949
+ var require_shams = __commonJS({
34950
+ "../../node_modules/form-data/node_modules/get-intrinsic/node_modules/has-symbols/shams.js"(exports2, module2) {
34951
+ "use strict";
34952
+ module2.exports = function hasSymbols() {
34953
+ if (typeof Symbol !== "function" || typeof Object.getOwnPropertySymbols !== "function") {
34954
+ return false;
34955
+ }
34956
+ if (typeof Symbol.iterator === "symbol") {
34957
+ return true;
34958
+ }
34959
+ var obj = {};
34960
+ var sym = Symbol("test");
34961
+ var symObj = Object(sym);
34962
+ if (typeof sym === "string") {
34963
+ return false;
34964
+ }
34965
+ if (Object.prototype.toString.call(sym) !== "[object Symbol]") {
34966
+ return false;
34967
+ }
34968
+ if (Object.prototype.toString.call(symObj) !== "[object Symbol]") {
34969
+ return false;
34970
+ }
34971
+ var symVal = 42;
34972
+ obj[sym] = symVal;
34973
+ for (var _ in obj) {
34974
+ return false;
34975
+ }
34976
+ if (typeof Object.keys === "function" && Object.keys(obj).length !== 0) {
34977
+ return false;
34978
+ }
34979
+ if (typeof Object.getOwnPropertyNames === "function" && Object.getOwnPropertyNames(obj).length !== 0) {
34980
+ return false;
34981
+ }
34982
+ var syms = Object.getOwnPropertySymbols(obj);
34983
+ if (syms.length !== 1 || syms[0] !== sym) {
34984
+ return false;
34985
+ }
34986
+ if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) {
34987
+ return false;
34988
+ }
34989
+ if (typeof Object.getOwnPropertyDescriptor === "function") {
34990
+ var descriptor = (
34991
+ /** @type {PropertyDescriptor} */
34992
+ Object.getOwnPropertyDescriptor(obj, sym)
34993
+ );
34994
+ if (descriptor.value !== symVal || descriptor.enumerable !== true) {
34995
+ return false;
34996
+ }
34997
+ }
34998
+ return true;
34999
+ };
35000
+ }
35001
+ });
35002
+
35003
+ // ../../node_modules/form-data/node_modules/get-intrinsic/node_modules/has-symbols/index.js
35004
+ var require_has_symbols = __commonJS({
35005
+ "../../node_modules/form-data/node_modules/get-intrinsic/node_modules/has-symbols/index.js"(exports2, module2) {
35006
+ "use strict";
35007
+ var origSymbol = typeof Symbol !== "undefined" && Symbol;
35008
+ var hasSymbolSham = require_shams();
35009
+ module2.exports = function hasNativeSymbols() {
35010
+ if (typeof origSymbol !== "function") {
35011
+ return false;
35012
+ }
35013
+ if (typeof Symbol !== "function") {
35014
+ return false;
35015
+ }
35016
+ if (typeof origSymbol("foo") !== "symbol") {
35017
+ return false;
35018
+ }
35019
+ if (typeof Symbol("bar") !== "symbol") {
35020
+ return false;
35021
+ }
35022
+ return hasSymbolSham();
35023
+ };
35024
+ }
35025
+ });
35026
+
35027
+ // ../../node_modules/get-proto/Reflect.getPrototypeOf.js
35028
+ var require_Reflect_getPrototypeOf = __commonJS({
35029
+ "../../node_modules/get-proto/Reflect.getPrototypeOf.js"(exports2, module2) {
35030
+ "use strict";
35031
+ module2.exports = typeof Reflect !== "undefined" && Reflect.getPrototypeOf || null;
35032
+ }
35033
+ });
35034
+
35035
+ // ../../node_modules/get-proto/Object.getPrototypeOf.js
35036
+ var require_Object_getPrototypeOf = __commonJS({
35037
+ "../../node_modules/get-proto/Object.getPrototypeOf.js"(exports2, module2) {
35038
+ "use strict";
35039
+ var $Object = require_es_object_atoms();
35040
+ module2.exports = $Object.getPrototypeOf || null;
35041
+ }
35042
+ });
35043
+
35044
+ // ../../node_modules/call-bind-apply-helpers/node_modules/function-bind/implementation.js
35045
+ var require_implementation = __commonJS({
35046
+ "../../node_modules/call-bind-apply-helpers/node_modules/function-bind/implementation.js"(exports2, module2) {
35047
+ "use strict";
35048
+ var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
35049
+ var toStr = Object.prototype.toString;
35050
+ var max = Math.max;
35051
+ var funcType = "[object Function]";
35052
+ var concatty = function concatty2(a, b) {
35053
+ var arr = [];
35054
+ for (var i = 0; i < a.length; i += 1) {
35055
+ arr[i] = a[i];
35056
+ }
35057
+ for (var j = 0; j < b.length; j += 1) {
35058
+ arr[j + a.length] = b[j];
35059
+ }
35060
+ return arr;
35061
+ };
35062
+ var slicy = function slicy2(arrLike, offset) {
35063
+ var arr = [];
35064
+ for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) {
35065
+ arr[j] = arrLike[i];
35066
+ }
35067
+ return arr;
35068
+ };
35069
+ var joiny = function(arr, joiner) {
35070
+ var str = "";
35071
+ for (var i = 0; i < arr.length; i += 1) {
35072
+ str += arr[i];
35073
+ if (i + 1 < arr.length) {
35074
+ str += joiner;
35075
+ }
35076
+ }
35077
+ return str;
35078
+ };
35079
+ module2.exports = function bind(that) {
35080
+ var target = this;
35081
+ if (typeof target !== "function" || toStr.apply(target) !== funcType) {
35082
+ throw new TypeError(ERROR_MESSAGE + target);
35083
+ }
35084
+ var args = slicy(arguments, 1);
35085
+ var bound;
35086
+ var binder = function() {
35087
+ if (this instanceof bound) {
35088
+ var result = target.apply(
35089
+ this,
35090
+ concatty(args, arguments)
35091
+ );
35092
+ if (Object(result) === result) {
35093
+ return result;
35094
+ }
35095
+ return this;
35096
+ }
35097
+ return target.apply(
35098
+ that,
35099
+ concatty(args, arguments)
35100
+ );
35101
+ };
35102
+ var boundLength = max(0, target.length - args.length);
35103
+ var boundArgs = [];
35104
+ for (var i = 0; i < boundLength; i++) {
35105
+ boundArgs[i] = "$" + i;
35106
+ }
35107
+ bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
35108
+ if (target.prototype) {
35109
+ var Empty = function Empty2() {
35110
+ };
35111
+ Empty.prototype = target.prototype;
35112
+ bound.prototype = new Empty();
35113
+ Empty.prototype = null;
35114
+ }
35115
+ return bound;
35116
+ };
35117
+ }
35118
+ });
35119
+
35120
+ // ../../node_modules/call-bind-apply-helpers/node_modules/function-bind/index.js
35121
+ var require_function_bind = __commonJS({
35122
+ "../../node_modules/call-bind-apply-helpers/node_modules/function-bind/index.js"(exports2, module2) {
35123
+ "use strict";
35124
+ var implementation = require_implementation();
35125
+ module2.exports = Function.prototype.bind || implementation;
35126
+ }
35127
+ });
35128
+
35129
+ // ../../node_modules/call-bind-apply-helpers/functionCall.js
35130
+ var require_functionCall = __commonJS({
35131
+ "../../node_modules/call-bind-apply-helpers/functionCall.js"(exports2, module2) {
35132
+ "use strict";
35133
+ module2.exports = Function.prototype.call;
35134
+ }
35135
+ });
35136
+
35137
+ // ../../node_modules/call-bind-apply-helpers/functionApply.js
35138
+ var require_functionApply = __commonJS({
35139
+ "../../node_modules/call-bind-apply-helpers/functionApply.js"(exports2, module2) {
35140
+ "use strict";
35141
+ module2.exports = Function.prototype.apply;
35142
+ }
35143
+ });
35144
+
35145
+ // ../../node_modules/call-bind-apply-helpers/reflectApply.js
35146
+ var require_reflectApply = __commonJS({
35147
+ "../../node_modules/call-bind-apply-helpers/reflectApply.js"(exports2, module2) {
35148
+ "use strict";
35149
+ module2.exports = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
35150
+ }
35151
+ });
35152
+
35153
+ // ../../node_modules/call-bind-apply-helpers/actualApply.js
35154
+ var require_actualApply = __commonJS({
35155
+ "../../node_modules/call-bind-apply-helpers/actualApply.js"(exports2, module2) {
35156
+ "use strict";
35157
+ var bind = require_function_bind();
35158
+ var $apply = require_functionApply();
35159
+ var $call = require_functionCall();
35160
+ var $reflectApply = require_reflectApply();
35161
+ module2.exports = $reflectApply || bind.call($call, $apply);
35162
+ }
35163
+ });
35164
+
35165
+ // ../../node_modules/call-bind-apply-helpers/index.js
35166
+ var require_call_bind_apply_helpers = __commonJS({
35167
+ "../../node_modules/call-bind-apply-helpers/index.js"(exports2, module2) {
35168
+ "use strict";
35169
+ var bind = require_function_bind();
35170
+ var $TypeError = require_type();
35171
+ var $call = require_functionCall();
35172
+ var $actualApply = require_actualApply();
35173
+ module2.exports = function callBindBasic(args) {
35174
+ if (args.length < 1 || typeof args[0] !== "function") {
35175
+ throw new $TypeError("a function is required");
35176
+ }
35177
+ return $actualApply(bind, $call, args);
35178
+ };
35179
+ }
35180
+ });
35181
+
35182
+ // ../../node_modules/dunder-proto/node_modules/gopd/gOPD.js
35183
+ var require_gOPD2 = __commonJS({
35184
+ "../../node_modules/dunder-proto/node_modules/gopd/gOPD.js"(exports2, module2) {
35185
+ "use strict";
35186
+ module2.exports = Object.getOwnPropertyDescriptor;
35187
+ }
35188
+ });
35189
+
35190
+ // ../../node_modules/dunder-proto/node_modules/gopd/index.js
35191
+ var require_gopd2 = __commonJS({
35192
+ "../../node_modules/dunder-proto/node_modules/gopd/index.js"(exports2, module2) {
35193
+ "use strict";
35194
+ var $gOPD = require_gOPD2();
35195
+ if ($gOPD) {
35196
+ try {
35197
+ $gOPD([], "length");
35198
+ } catch (e) {
35199
+ $gOPD = null;
35200
+ }
35201
+ }
35202
+ module2.exports = $gOPD;
35203
+ }
35204
+ });
35205
+
35206
+ // ../../node_modules/dunder-proto/get.js
35207
+ var require_get = __commonJS({
35208
+ "../../node_modules/dunder-proto/get.js"(exports2, module2) {
35209
+ "use strict";
35210
+ var callBind = require_call_bind_apply_helpers();
35211
+ var gOPD = require_gopd2();
35212
+ var hasProtoAccessor;
35213
+ try {
35214
+ hasProtoAccessor = /** @type {{ __proto__?: typeof Array.prototype }} */
35215
+ [].__proto__ === Array.prototype;
35216
+ } catch (e) {
35217
+ if (!e || typeof e !== "object" || !("code" in e) || e.code !== "ERR_PROTO_ACCESS") {
35218
+ throw e;
35219
+ }
35220
+ }
35221
+ var desc = !!hasProtoAccessor && gOPD && gOPD(
35222
+ Object.prototype,
35223
+ /** @type {keyof typeof Object.prototype} */
35224
+ "__proto__"
35225
+ );
35226
+ var $Object = Object;
35227
+ var $getPrototypeOf = $Object.getPrototypeOf;
35228
+ module2.exports = desc && typeof desc.get === "function" ? callBind([desc.get]) : typeof $getPrototypeOf === "function" ? (
35229
+ /** @type {import('./get')} */
35230
+ function getDunder(value) {
35231
+ return $getPrototypeOf(value == null ? value : $Object(value));
35232
+ }
35233
+ ) : false;
35234
+ }
35235
+ });
35236
+
35237
+ // ../../node_modules/get-proto/index.js
35238
+ var require_get_proto = __commonJS({
35239
+ "../../node_modules/get-proto/index.js"(exports2, module2) {
35240
+ "use strict";
35241
+ var reflectGetProto = require_Reflect_getPrototypeOf();
35242
+ var originalGetProto = require_Object_getPrototypeOf();
35243
+ var getDunderProto = require_get();
35244
+ module2.exports = reflectGetProto ? function getProto(O) {
35245
+ return reflectGetProto(O);
35246
+ } : originalGetProto ? function getProto(O) {
35247
+ if (!O || typeof O !== "object" && typeof O !== "function") {
35248
+ throw new TypeError("getProto: not an object");
35249
+ }
35250
+ return originalGetProto(O);
35251
+ } : getDunderProto ? function getProto(O) {
35252
+ return getDunderProto(O);
35253
+ } : null;
35254
+ }
35255
+ });
35256
+
35257
+ // ../../node_modules/form-data/node_modules/function-bind/implementation.js
35258
+ var require_implementation2 = __commonJS({
35259
+ "../../node_modules/form-data/node_modules/function-bind/implementation.js"(exports2, module2) {
35260
+ "use strict";
35261
+ var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
35262
+ var toStr = Object.prototype.toString;
35263
+ var max = Math.max;
35264
+ var funcType = "[object Function]";
35265
+ var concatty = function concatty2(a, b) {
35266
+ var arr = [];
35267
+ for (var i = 0; i < a.length; i += 1) {
35268
+ arr[i] = a[i];
35269
+ }
35270
+ for (var j = 0; j < b.length; j += 1) {
35271
+ arr[j + a.length] = b[j];
35272
+ }
35273
+ return arr;
35274
+ };
35275
+ var slicy = function slicy2(arrLike, offset) {
35276
+ var arr = [];
35277
+ for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) {
35278
+ arr[j] = arrLike[i];
35279
+ }
35280
+ return arr;
35281
+ };
35282
+ var joiny = function(arr, joiner) {
35283
+ var str = "";
35284
+ for (var i = 0; i < arr.length; i += 1) {
35285
+ str += arr[i];
35286
+ if (i + 1 < arr.length) {
35287
+ str += joiner;
35288
+ }
35289
+ }
35290
+ return str;
35291
+ };
35292
+ module2.exports = function bind(that) {
35293
+ var target = this;
35294
+ if (typeof target !== "function" || toStr.apply(target) !== funcType) {
35295
+ throw new TypeError(ERROR_MESSAGE + target);
35296
+ }
35297
+ var args = slicy(arguments, 1);
35298
+ var bound;
35299
+ var binder = function() {
35300
+ if (this instanceof bound) {
35301
+ var result = target.apply(
35302
+ this,
35303
+ concatty(args, arguments)
35304
+ );
35305
+ if (Object(result) === result) {
35306
+ return result;
35307
+ }
35308
+ return this;
35309
+ }
35310
+ return target.apply(
35311
+ that,
35312
+ concatty(args, arguments)
35313
+ );
35314
+ };
35315
+ var boundLength = max(0, target.length - args.length);
35316
+ var boundArgs = [];
35317
+ for (var i = 0; i < boundLength; i++) {
35318
+ boundArgs[i] = "$" + i;
35319
+ }
35320
+ bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
35321
+ if (target.prototype) {
35322
+ var Empty = function Empty2() {
35323
+ };
35324
+ Empty.prototype = target.prototype;
35325
+ bound.prototype = new Empty();
35326
+ Empty.prototype = null;
35327
+ }
35328
+ return bound;
35329
+ };
35330
+ }
35331
+ });
35332
+
35333
+ // ../../node_modules/form-data/node_modules/function-bind/index.js
35334
+ var require_function_bind2 = __commonJS({
35335
+ "../../node_modules/form-data/node_modules/function-bind/index.js"(exports2, module2) {
35336
+ "use strict";
35337
+ var implementation = require_implementation2();
35338
+ module2.exports = Function.prototype.bind || implementation;
35339
+ }
35340
+ });
35341
+
35342
+ // ../../node_modules/form-data/node_modules/hasown/index.js
35343
+ var require_hasown = __commonJS({
35344
+ "../../node_modules/form-data/node_modules/hasown/index.js"(exports2, module2) {
35345
+ "use strict";
35346
+ var call = Function.prototype.call;
35347
+ var $hasOwn = Object.prototype.hasOwnProperty;
35348
+ var bind = require_function_bind2();
35349
+ module2.exports = bind.call(call, $hasOwn);
35350
+ }
35351
+ });
35352
+
35353
+ // ../../node_modules/form-data/node_modules/get-intrinsic/index.js
35354
+ var require_get_intrinsic = __commonJS({
35355
+ "../../node_modules/form-data/node_modules/get-intrinsic/index.js"(exports2, module2) {
35356
+ "use strict";
35357
+ var undefined2;
35358
+ var $Object = require_es_object_atoms();
35359
+ var $Error = require_es_errors();
35360
+ var $EvalError = require_eval();
35361
+ var $RangeError = require_range();
35362
+ var $ReferenceError = require_ref();
35363
+ var $SyntaxError = require_syntax();
35364
+ var $TypeError = require_type();
35365
+ var $URIError = require_uri();
35366
+ var abs = require_abs();
35367
+ var floor = require_floor();
35368
+ var max = require_max();
35369
+ var min = require_min();
35370
+ var pow = require_pow();
35371
+ var round = require_round();
35372
+ var sign = require_sign();
35373
+ var $Function = Function;
35374
+ var getEvalledConstructor = function(expressionSyntax) {
35375
+ try {
35376
+ return $Function('"use strict"; return (' + expressionSyntax + ").constructor;")();
35377
+ } catch (e) {
35378
+ }
35379
+ };
35380
+ var $gOPD = require_gopd();
35381
+ var $defineProperty = require_es_define_property();
35382
+ var throwTypeError = function() {
35383
+ throw new $TypeError();
35384
+ };
35385
+ var ThrowTypeError = $gOPD ? function() {
35386
+ try {
35387
+ arguments.callee;
35388
+ return throwTypeError;
35389
+ } catch (calleeThrows) {
35390
+ try {
35391
+ return $gOPD(arguments, "callee").get;
35392
+ } catch (gOPDthrows) {
35393
+ return throwTypeError;
35394
+ }
35395
+ }
35396
+ }() : throwTypeError;
35397
+ var hasSymbols = require_has_symbols()();
35398
+ var getProto = require_get_proto();
35399
+ var $ObjectGPO = require_Object_getPrototypeOf();
35400
+ var $ReflectGPO = require_Reflect_getPrototypeOf();
35401
+ var $apply = require_functionApply();
35402
+ var $call = require_functionCall();
35403
+ var needsEval = {};
35404
+ var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined2 : getProto(Uint8Array);
35405
+ var INTRINSICS = {
35406
+ __proto__: null,
35407
+ "%AggregateError%": typeof AggregateError === "undefined" ? undefined2 : AggregateError,
35408
+ "%Array%": Array,
35409
+ "%ArrayBuffer%": typeof ArrayBuffer === "undefined" ? undefined2 : ArrayBuffer,
35410
+ "%ArrayIteratorPrototype%": hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined2,
35411
+ "%AsyncFromSyncIteratorPrototype%": undefined2,
35412
+ "%AsyncFunction%": needsEval,
35413
+ "%AsyncGenerator%": needsEval,
35414
+ "%AsyncGeneratorFunction%": needsEval,
35415
+ "%AsyncIteratorPrototype%": needsEval,
35416
+ "%Atomics%": typeof Atomics === "undefined" ? undefined2 : Atomics,
35417
+ "%BigInt%": typeof BigInt === "undefined" ? undefined2 : BigInt,
35418
+ "%BigInt64Array%": typeof BigInt64Array === "undefined" ? undefined2 : BigInt64Array,
35419
+ "%BigUint64Array%": typeof BigUint64Array === "undefined" ? undefined2 : BigUint64Array,
35420
+ "%Boolean%": Boolean,
35421
+ "%DataView%": typeof DataView === "undefined" ? undefined2 : DataView,
35422
+ "%Date%": Date,
35423
+ "%decodeURI%": decodeURI,
35424
+ "%decodeURIComponent%": decodeURIComponent,
35425
+ "%encodeURI%": encodeURI,
35426
+ "%encodeURIComponent%": encodeURIComponent,
35427
+ "%Error%": $Error,
35428
+ "%eval%": eval,
35429
+ // eslint-disable-line no-eval
35430
+ "%EvalError%": $EvalError,
35431
+ "%Float16Array%": typeof Float16Array === "undefined" ? undefined2 : Float16Array,
35432
+ "%Float32Array%": typeof Float32Array === "undefined" ? undefined2 : Float32Array,
35433
+ "%Float64Array%": typeof Float64Array === "undefined" ? undefined2 : Float64Array,
35434
+ "%FinalizationRegistry%": typeof FinalizationRegistry === "undefined" ? undefined2 : FinalizationRegistry,
35435
+ "%Function%": $Function,
35436
+ "%GeneratorFunction%": needsEval,
35437
+ "%Int8Array%": typeof Int8Array === "undefined" ? undefined2 : Int8Array,
35438
+ "%Int16Array%": typeof Int16Array === "undefined" ? undefined2 : Int16Array,
35439
+ "%Int32Array%": typeof Int32Array === "undefined" ? undefined2 : Int32Array,
35440
+ "%isFinite%": isFinite,
35441
+ "%isNaN%": isNaN,
35442
+ "%IteratorPrototype%": hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined2,
35443
+ "%JSON%": typeof JSON === "object" ? JSON : undefined2,
35444
+ "%Map%": typeof Map === "undefined" ? undefined2 : Map,
35445
+ "%MapIteratorPrototype%": typeof Map === "undefined" || !hasSymbols || !getProto ? undefined2 : getProto((/* @__PURE__ */ new Map())[Symbol.iterator]()),
35446
+ "%Math%": Math,
35447
+ "%Number%": Number,
35448
+ "%Object%": $Object,
35449
+ "%Object.getOwnPropertyDescriptor%": $gOPD,
35450
+ "%parseFloat%": parseFloat,
35451
+ "%parseInt%": parseInt,
35452
+ "%Promise%": typeof Promise === "undefined" ? undefined2 : Promise,
35453
+ "%Proxy%": typeof Proxy === "undefined" ? undefined2 : Proxy,
35454
+ "%RangeError%": $RangeError,
35455
+ "%ReferenceError%": $ReferenceError,
35456
+ "%Reflect%": typeof Reflect === "undefined" ? undefined2 : Reflect,
35457
+ "%RegExp%": RegExp,
35458
+ "%Set%": typeof Set === "undefined" ? undefined2 : Set,
35459
+ "%SetIteratorPrototype%": typeof Set === "undefined" || !hasSymbols || !getProto ? undefined2 : getProto((/* @__PURE__ */ new Set())[Symbol.iterator]()),
35460
+ "%SharedArrayBuffer%": typeof SharedArrayBuffer === "undefined" ? undefined2 : SharedArrayBuffer,
35461
+ "%String%": String,
35462
+ "%StringIteratorPrototype%": hasSymbols && getProto ? getProto(""[Symbol.iterator]()) : undefined2,
35463
+ "%Symbol%": hasSymbols ? Symbol : undefined2,
35464
+ "%SyntaxError%": $SyntaxError,
35465
+ "%ThrowTypeError%": ThrowTypeError,
35466
+ "%TypedArray%": TypedArray,
35467
+ "%TypeError%": $TypeError,
35468
+ "%Uint8Array%": typeof Uint8Array === "undefined" ? undefined2 : Uint8Array,
35469
+ "%Uint8ClampedArray%": typeof Uint8ClampedArray === "undefined" ? undefined2 : Uint8ClampedArray,
35470
+ "%Uint16Array%": typeof Uint16Array === "undefined" ? undefined2 : Uint16Array,
35471
+ "%Uint32Array%": typeof Uint32Array === "undefined" ? undefined2 : Uint32Array,
35472
+ "%URIError%": $URIError,
35473
+ "%WeakMap%": typeof WeakMap === "undefined" ? undefined2 : WeakMap,
35474
+ "%WeakRef%": typeof WeakRef === "undefined" ? undefined2 : WeakRef,
35475
+ "%WeakSet%": typeof WeakSet === "undefined" ? undefined2 : WeakSet,
35476
+ "%Function.prototype.call%": $call,
35477
+ "%Function.prototype.apply%": $apply,
35478
+ "%Object.defineProperty%": $defineProperty,
35479
+ "%Object.getPrototypeOf%": $ObjectGPO,
35480
+ "%Math.abs%": abs,
35481
+ "%Math.floor%": floor,
35482
+ "%Math.max%": max,
35483
+ "%Math.min%": min,
35484
+ "%Math.pow%": pow,
35485
+ "%Math.round%": round,
35486
+ "%Math.sign%": sign,
35487
+ "%Reflect.getPrototypeOf%": $ReflectGPO
35488
+ };
35489
+ if (getProto) {
35490
+ try {
35491
+ null.error;
35492
+ } catch (e) {
35493
+ errorProto = getProto(getProto(e));
35494
+ INTRINSICS["%Error.prototype%"] = errorProto;
35495
+ }
35496
+ }
35497
+ var errorProto;
35498
+ var doEval = function doEval2(name) {
35499
+ var value;
35500
+ if (name === "%AsyncFunction%") {
35501
+ value = getEvalledConstructor("async function () {}");
35502
+ } else if (name === "%GeneratorFunction%") {
35503
+ value = getEvalledConstructor("function* () {}");
35504
+ } else if (name === "%AsyncGeneratorFunction%") {
35505
+ value = getEvalledConstructor("async function* () {}");
35506
+ } else if (name === "%AsyncGenerator%") {
35507
+ var fn = doEval2("%AsyncGeneratorFunction%");
35508
+ if (fn) {
35509
+ value = fn.prototype;
35510
+ }
35511
+ } else if (name === "%AsyncIteratorPrototype%") {
35512
+ var gen = doEval2("%AsyncGenerator%");
35513
+ if (gen && getProto) {
35514
+ value = getProto(gen.prototype);
35515
+ }
35516
+ }
35517
+ INTRINSICS[name] = value;
35518
+ return value;
35519
+ };
35520
+ var LEGACY_ALIASES = {
35521
+ __proto__: null,
35522
+ "%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"],
35523
+ "%ArrayPrototype%": ["Array", "prototype"],
35524
+ "%ArrayProto_entries%": ["Array", "prototype", "entries"],
35525
+ "%ArrayProto_forEach%": ["Array", "prototype", "forEach"],
35526
+ "%ArrayProto_keys%": ["Array", "prototype", "keys"],
35527
+ "%ArrayProto_values%": ["Array", "prototype", "values"],
35528
+ "%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"],
35529
+ "%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"],
35530
+ "%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"],
35531
+ "%BooleanPrototype%": ["Boolean", "prototype"],
35532
+ "%DataViewPrototype%": ["DataView", "prototype"],
35533
+ "%DatePrototype%": ["Date", "prototype"],
35534
+ "%ErrorPrototype%": ["Error", "prototype"],
35535
+ "%EvalErrorPrototype%": ["EvalError", "prototype"],
35536
+ "%Float32ArrayPrototype%": ["Float32Array", "prototype"],
35537
+ "%Float64ArrayPrototype%": ["Float64Array", "prototype"],
35538
+ "%FunctionPrototype%": ["Function", "prototype"],
35539
+ "%Generator%": ["GeneratorFunction", "prototype"],
35540
+ "%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"],
35541
+ "%Int8ArrayPrototype%": ["Int8Array", "prototype"],
35542
+ "%Int16ArrayPrototype%": ["Int16Array", "prototype"],
35543
+ "%Int32ArrayPrototype%": ["Int32Array", "prototype"],
35544
+ "%JSONParse%": ["JSON", "parse"],
35545
+ "%JSONStringify%": ["JSON", "stringify"],
35546
+ "%MapPrototype%": ["Map", "prototype"],
35547
+ "%NumberPrototype%": ["Number", "prototype"],
35548
+ "%ObjectPrototype%": ["Object", "prototype"],
35549
+ "%ObjProto_toString%": ["Object", "prototype", "toString"],
35550
+ "%ObjProto_valueOf%": ["Object", "prototype", "valueOf"],
35551
+ "%PromisePrototype%": ["Promise", "prototype"],
35552
+ "%PromiseProto_then%": ["Promise", "prototype", "then"],
35553
+ "%Promise_all%": ["Promise", "all"],
35554
+ "%Promise_reject%": ["Promise", "reject"],
35555
+ "%Promise_resolve%": ["Promise", "resolve"],
35556
+ "%RangeErrorPrototype%": ["RangeError", "prototype"],
35557
+ "%ReferenceErrorPrototype%": ["ReferenceError", "prototype"],
35558
+ "%RegExpPrototype%": ["RegExp", "prototype"],
35559
+ "%SetPrototype%": ["Set", "prototype"],
35560
+ "%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"],
35561
+ "%StringPrototype%": ["String", "prototype"],
35562
+ "%SymbolPrototype%": ["Symbol", "prototype"],
35563
+ "%SyntaxErrorPrototype%": ["SyntaxError", "prototype"],
35564
+ "%TypedArrayPrototype%": ["TypedArray", "prototype"],
35565
+ "%TypeErrorPrototype%": ["TypeError", "prototype"],
35566
+ "%Uint8ArrayPrototype%": ["Uint8Array", "prototype"],
35567
+ "%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"],
35568
+ "%Uint16ArrayPrototype%": ["Uint16Array", "prototype"],
35569
+ "%Uint32ArrayPrototype%": ["Uint32Array", "prototype"],
35570
+ "%URIErrorPrototype%": ["URIError", "prototype"],
35571
+ "%WeakMapPrototype%": ["WeakMap", "prototype"],
35572
+ "%WeakSetPrototype%": ["WeakSet", "prototype"]
35573
+ };
35574
+ var bind = require_function_bind2();
35575
+ var hasOwn = require_hasown();
35576
+ var $concat = bind.call($call, Array.prototype.concat);
35577
+ var $spliceApply = bind.call($apply, Array.prototype.splice);
35578
+ var $replace = bind.call($call, String.prototype.replace);
35579
+ var $strSlice = bind.call($call, String.prototype.slice);
35580
+ var $exec = bind.call($call, RegExp.prototype.exec);
35581
+ var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
35582
+ var reEscapeChar = /\\(\\)?/g;
35583
+ var stringToPath = function stringToPath2(string) {
35584
+ var first = $strSlice(string, 0, 1);
35585
+ var last = $strSlice(string, -1);
35586
+ if (first === "%" && last !== "%") {
35587
+ throw new $SyntaxError("invalid intrinsic syntax, expected closing `%`");
35588
+ } else if (last === "%" && first !== "%") {
35589
+ throw new $SyntaxError("invalid intrinsic syntax, expected opening `%`");
35590
+ }
35591
+ var result = [];
35592
+ $replace(string, rePropName, function(match, number, quote, subString) {
35593
+ result[result.length] = quote ? $replace(subString, reEscapeChar, "$1") : number || match;
35594
+ });
35595
+ return result;
35596
+ };
35597
+ var getBaseIntrinsic = function getBaseIntrinsic2(name, allowMissing) {
35598
+ var intrinsicName = name;
35599
+ var alias;
35600
+ if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
35601
+ alias = LEGACY_ALIASES[intrinsicName];
35602
+ intrinsicName = "%" + alias[0] + "%";
35603
+ }
35604
+ if (hasOwn(INTRINSICS, intrinsicName)) {
35605
+ var value = INTRINSICS[intrinsicName];
35606
+ if (value === needsEval) {
35607
+ value = doEval(intrinsicName);
35608
+ }
35609
+ if (typeof value === "undefined" && !allowMissing) {
35610
+ throw new $TypeError("intrinsic " + name + " exists, but is not available. Please file an issue!");
35611
+ }
35612
+ return {
35613
+ alias,
35614
+ name: intrinsicName,
35615
+ value
35616
+ };
35617
+ }
35618
+ throw new $SyntaxError("intrinsic " + name + " does not exist!");
35619
+ };
35620
+ module2.exports = function GetIntrinsic(name, allowMissing) {
35621
+ if (typeof name !== "string" || name.length === 0) {
35622
+ throw new $TypeError("intrinsic name must be a non-empty string");
35623
+ }
35624
+ if (arguments.length > 1 && typeof allowMissing !== "boolean") {
35625
+ throw new $TypeError('"allowMissing" argument must be a boolean');
35626
+ }
35627
+ if ($exec(/^%?[^%]*%?$/, name) === null) {
35628
+ throw new $SyntaxError("`%` may not be present anywhere but at the beginning and end of the intrinsic name");
35629
+ }
35630
+ var parts = stringToPath(name);
35631
+ var intrinsicBaseName = parts.length > 0 ? parts[0] : "";
35632
+ var intrinsic = getBaseIntrinsic("%" + intrinsicBaseName + "%", allowMissing);
35633
+ var intrinsicRealName = intrinsic.name;
35634
+ var value = intrinsic.value;
35635
+ var skipFurtherCaching = false;
35636
+ var alias = intrinsic.alias;
35637
+ if (alias) {
35638
+ intrinsicBaseName = alias[0];
35639
+ $spliceApply(parts, $concat([0, 1], alias));
35640
+ }
35641
+ for (var i = 1, isOwn = true; i < parts.length; i += 1) {
35642
+ var part = parts[i];
35643
+ var first = $strSlice(part, 0, 1);
35644
+ var last = $strSlice(part, -1);
35645
+ if ((first === '"' || first === "'" || first === "`" || (last === '"' || last === "'" || last === "`")) && first !== last) {
35646
+ throw new $SyntaxError("property names with quotes must have matching quotes");
35647
+ }
35648
+ if (part === "constructor" || !isOwn) {
35649
+ skipFurtherCaching = true;
35650
+ }
35651
+ intrinsicBaseName += "." + part;
35652
+ intrinsicRealName = "%" + intrinsicBaseName + "%";
35653
+ if (hasOwn(INTRINSICS, intrinsicRealName)) {
35654
+ value = INTRINSICS[intrinsicRealName];
35655
+ } else if (value != null) {
35656
+ if (!(part in value)) {
35657
+ if (!allowMissing) {
35658
+ throw new $TypeError("base intrinsic for " + name + " exists, but the property is not available.");
35659
+ }
35660
+ return void undefined2;
35661
+ }
35662
+ if ($gOPD && i + 1 >= parts.length) {
35663
+ var desc = $gOPD(value, part);
35664
+ isOwn = !!desc;
35665
+ if (isOwn && "get" in desc && !("originalValue" in desc.get)) {
35666
+ value = desc.get;
35667
+ } else {
35668
+ value = value[part];
35669
+ }
35670
+ } else {
35671
+ isOwn = hasOwn(value, part);
35672
+ value = value[part];
35673
+ }
35674
+ if (isOwn && !skipFurtherCaching) {
35675
+ INTRINSICS[intrinsicRealName] = value;
35676
+ }
35677
+ }
35678
+ }
35679
+ return value;
35680
+ };
35681
+ }
35682
+ });
35683
+
35684
+ // ../../node_modules/has-symbols/shams.js
35685
+ var require_shams2 = __commonJS({
35686
+ "../../node_modules/has-symbols/shams.js"(exports2, module2) {
35687
+ "use strict";
35688
+ module2.exports = function hasSymbols() {
35689
+ if (typeof Symbol !== "function" || typeof Object.getOwnPropertySymbols !== "function") {
35690
+ return false;
35691
+ }
35692
+ if (typeof Symbol.iterator === "symbol") {
35693
+ return true;
35694
+ }
35695
+ var obj = {};
35696
+ var sym = Symbol("test");
35697
+ var symObj = Object(sym);
35698
+ if (typeof sym === "string") {
35699
+ return false;
35700
+ }
35701
+ if (Object.prototype.toString.call(sym) !== "[object Symbol]") {
35702
+ return false;
35703
+ }
35704
+ if (Object.prototype.toString.call(symObj) !== "[object Symbol]") {
35705
+ return false;
35706
+ }
35707
+ var symVal = 42;
35708
+ obj[sym] = symVal;
35709
+ for (sym in obj) {
35710
+ return false;
35711
+ }
35712
+ if (typeof Object.keys === "function" && Object.keys(obj).length !== 0) {
35713
+ return false;
35714
+ }
35715
+ if (typeof Object.getOwnPropertyNames === "function" && Object.getOwnPropertyNames(obj).length !== 0) {
35716
+ return false;
35717
+ }
35718
+ var syms = Object.getOwnPropertySymbols(obj);
35719
+ if (syms.length !== 1 || syms[0] !== sym) {
35720
+ return false;
35721
+ }
35722
+ if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) {
35723
+ return false;
35724
+ }
35725
+ if (typeof Object.getOwnPropertyDescriptor === "function") {
35726
+ var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
35727
+ if (descriptor.value !== symVal || descriptor.enumerable !== true) {
35728
+ return false;
35729
+ }
35730
+ }
35731
+ return true;
35732
+ };
35733
+ }
35734
+ });
35735
+
35736
+ // ../../node_modules/form-data/node_modules/has-tostringtag/shams.js
35737
+ var require_shams3 = __commonJS({
35738
+ "../../node_modules/form-data/node_modules/has-tostringtag/shams.js"(exports2, module2) {
35739
+ "use strict";
35740
+ var hasSymbols = require_shams2();
35741
+ module2.exports = function hasToStringTagShams() {
35742
+ return hasSymbols() && !!Symbol.toStringTag;
35743
+ };
35744
+ }
35745
+ });
35746
+
35747
+ // ../../node_modules/form-data/node_modules/es-set-tostringtag/index.js
35748
+ var require_es_set_tostringtag = __commonJS({
35749
+ "../../node_modules/form-data/node_modules/es-set-tostringtag/index.js"(exports2, module2) {
35750
+ "use strict";
35751
+ var GetIntrinsic = require_get_intrinsic();
35752
+ var $defineProperty = GetIntrinsic("%Object.defineProperty%", true);
35753
+ var hasToStringTag = require_shams3()();
35754
+ var hasOwn = require_hasown();
35755
+ var $TypeError = require_type();
35756
+ var toStringTag = hasToStringTag ? Symbol.toStringTag : null;
35757
+ module2.exports = function setToStringTag(object, value) {
35758
+ var overrideIfSet = arguments.length > 2 && !!arguments[2] && arguments[2].force;
35759
+ var nonConfigurable = arguments.length > 2 && !!arguments[2] && arguments[2].nonConfigurable;
35760
+ if (typeof overrideIfSet !== "undefined" && typeof overrideIfSet !== "boolean" || typeof nonConfigurable !== "undefined" && typeof nonConfigurable !== "boolean") {
35761
+ throw new $TypeError("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");
35762
+ }
35763
+ if (toStringTag && (overrideIfSet || !hasOwn(object, toStringTag))) {
35764
+ if ($defineProperty) {
35765
+ $defineProperty(object, toStringTag, {
35766
+ configurable: !nonConfigurable,
35767
+ enumerable: false,
35768
+ value,
35769
+ writable: false
35770
+ });
35771
+ } else {
35772
+ object[toStringTag] = value;
35773
+ }
35774
+ }
35775
+ };
35776
+ }
35777
+ });
35778
+
34772
35779
  // ../../node_modules/form-data/lib/populate.js
34773
35780
  var require_populate = __commonJS({
34774
35781
  "../../node_modules/form-data/lib/populate.js"(exports2, module2) {
35782
+ "use strict";
34775
35783
  module2.exports = function(dst, src) {
34776
35784
  Object.keys(src).forEach(function(prop) {
34777
35785
  dst[prop] = dst[prop] || src[prop];
@@ -34784,6 +35792,7 @@ var require_populate = __commonJS({
34784
35792
  // ../../node_modules/form-data/lib/form_data.js
34785
35793
  var require_form_data = __commonJS({
34786
35794
  "../../node_modules/form-data/lib/form_data.js"(exports2, module2) {
35795
+ "use strict";
34787
35796
  var CombinedStream = require_combined_stream();
34788
35797
  var util = require("util");
34789
35798
  var path = require("path");
@@ -34792,11 +35801,12 @@ var require_form_data = __commonJS({
34792
35801
  var parseUrl = require("url").parse;
34793
35802
  var fs = require("fs");
34794
35803
  var Stream = require("stream").Stream;
35804
+ var crypto = require("crypto");
34795
35805
  var mime = require_mime_types();
34796
35806
  var asynckit = require_asynckit();
35807
+ var setToStringTag = require_es_set_tostringtag();
35808
+ var hasOwn = require_hasown();
34797
35809
  var populate = require_populate();
34798
- module2.exports = FormData2;
34799
- util.inherits(FormData2, CombinedStream);
34800
35810
  function FormData2(options2) {
34801
35811
  if (!(this instanceof FormData2)) {
34802
35812
  return new FormData2(options2);
@@ -34810,18 +35820,19 @@ var require_form_data = __commonJS({
34810
35820
  this[option] = options2[option];
34811
35821
  }
34812
35822
  }
35823
+ util.inherits(FormData2, CombinedStream);
34813
35824
  FormData2.LINE_BREAK = "\r\n";
34814
35825
  FormData2.DEFAULT_CONTENT_TYPE = "application/octet-stream";
34815
35826
  FormData2.prototype.append = function(field, value, options2) {
34816
35827
  options2 = options2 || {};
34817
- if (typeof options2 == "string") {
35828
+ if (typeof options2 === "string") {
34818
35829
  options2 = { filename: options2 };
34819
35830
  }
34820
35831
  var append = CombinedStream.prototype.append.bind(this);
34821
- if (typeof value == "number") {
34822
- value = "" + value;
35832
+ if (typeof value === "number" || value == null) {
35833
+ value = String(value);
34823
35834
  }
34824
- if (util.isArray(value)) {
35835
+ if (Array.isArray(value)) {
34825
35836
  this._error(new Error("Arrays are not supported."));
34826
35837
  return;
34827
35838
  }
@@ -34835,7 +35846,7 @@ var require_form_data = __commonJS({
34835
35846
  FormData2.prototype._trackLength = function(header, value, options2) {
34836
35847
  var valueLength = 0;
34837
35848
  if (options2.knownLength != null) {
34838
- valueLength += +options2.knownLength;
35849
+ valueLength += Number(options2.knownLength);
34839
35850
  } else if (Buffer.isBuffer(value)) {
34840
35851
  valueLength = value.length;
34841
35852
  } else if (typeof value === "string") {
@@ -34843,7 +35854,7 @@ var require_form_data = __commonJS({
34843
35854
  }
34844
35855
  this._valueLength += valueLength;
34845
35856
  this._overheadLength += Buffer.byteLength(header) + FormData2.LINE_BREAK.length;
34846
- if (!value || !value.path && !(value.readable && value.hasOwnProperty("httpVersion")) && !(value instanceof Stream)) {
35857
+ if (!value || !value.path && !(value.readable && hasOwn(value, "httpVersion")) && !(value instanceof Stream)) {
34847
35858
  return;
34848
35859
  }
34849
35860
  if (!options2.knownLength) {
@@ -34851,26 +35862,25 @@ var require_form_data = __commonJS({
34851
35862
  }
34852
35863
  };
34853
35864
  FormData2.prototype._lengthRetriever = function(value, callback) {
34854
- if (value.hasOwnProperty("fd")) {
35865
+ if (hasOwn(value, "fd")) {
34855
35866
  if (value.end != void 0 && value.end != Infinity && value.start != void 0) {
34856
35867
  callback(null, value.end + 1 - (value.start ? value.start : 0));
34857
35868
  } else {
34858
35869
  fs.stat(value.path, function(err, stat) {
34859
- var fileSize;
34860
35870
  if (err) {
34861
35871
  callback(err);
34862
35872
  return;
34863
35873
  }
34864
- fileSize = stat.size - (value.start ? value.start : 0);
35874
+ var fileSize = stat.size - (value.start ? value.start : 0);
34865
35875
  callback(null, fileSize);
34866
35876
  });
34867
35877
  }
34868
- } else if (value.hasOwnProperty("httpVersion")) {
34869
- callback(null, +value.headers["content-length"]);
34870
- } else if (value.hasOwnProperty("httpModule")) {
35878
+ } else if (hasOwn(value, "httpVersion")) {
35879
+ callback(null, Number(value.headers["content-length"]));
35880
+ } else if (hasOwn(value, "httpModule")) {
34871
35881
  value.on("response", function(response) {
34872
35882
  value.pause();
34873
- callback(null, +response.headers["content-length"]);
35883
+ callback(null, Number(response.headers["content-length"]));
34874
35884
  });
34875
35885
  value.resume();
34876
35886
  } else {
@@ -34878,7 +35888,7 @@ var require_form_data = __commonJS({
34878
35888
  }
34879
35889
  };
34880
35890
  FormData2.prototype._multiPartHeader = function(field, value, options2) {
34881
- if (typeof options2.header == "string") {
35891
+ if (typeof options2.header === "string") {
34882
35892
  return options2.header;
34883
35893
  }
34884
35894
  var contentDisposition = this._getContentDisposition(value, options2);
@@ -34890,54 +35900,54 @@ var require_form_data = __commonJS({
34890
35900
  // if no content type. allow it to be empty array
34891
35901
  "Content-Type": [].concat(contentType || [])
34892
35902
  };
34893
- if (typeof options2.header == "object") {
35903
+ if (typeof options2.header === "object") {
34894
35904
  populate(headers, options2.header);
34895
35905
  }
34896
35906
  var header;
34897
35907
  for (var prop in headers) {
34898
- if (!headers.hasOwnProperty(prop)) continue;
34899
- header = headers[prop];
34900
- if (header == null) {
34901
- continue;
34902
- }
34903
- if (!Array.isArray(header)) {
34904
- header = [header];
34905
- }
34906
- if (header.length) {
34907
- contents += prop + ": " + header.join("; ") + FormData2.LINE_BREAK;
35908
+ if (hasOwn(headers, prop)) {
35909
+ header = headers[prop];
35910
+ if (header == null) {
35911
+ continue;
35912
+ }
35913
+ if (!Array.isArray(header)) {
35914
+ header = [header];
35915
+ }
35916
+ if (header.length) {
35917
+ contents += prop + ": " + header.join("; ") + FormData2.LINE_BREAK;
35918
+ }
34908
35919
  }
34909
35920
  }
34910
35921
  return "--" + this.getBoundary() + FormData2.LINE_BREAK + contents + FormData2.LINE_BREAK;
34911
35922
  };
34912
35923
  FormData2.prototype._getContentDisposition = function(value, options2) {
34913
- var filename, contentDisposition;
35924
+ var filename;
34914
35925
  if (typeof options2.filepath === "string") {
34915
35926
  filename = path.normalize(options2.filepath).replace(/\\/g, "/");
34916
- } else if (options2.filename || value.name || value.path) {
34917
- filename = path.basename(options2.filename || value.name || value.path);
34918
- } else if (value.readable && value.hasOwnProperty("httpVersion")) {
35927
+ } else if (options2.filename || value && (value.name || value.path)) {
35928
+ filename = path.basename(options2.filename || value && (value.name || value.path));
35929
+ } else if (value && value.readable && hasOwn(value, "httpVersion")) {
34919
35930
  filename = path.basename(value.client._httpMessage.path || "");
34920
35931
  }
34921
35932
  if (filename) {
34922
- contentDisposition = 'filename="' + filename + '"';
35933
+ return 'filename="' + filename + '"';
34923
35934
  }
34924
- return contentDisposition;
34925
35935
  };
34926
35936
  FormData2.prototype._getContentType = function(value, options2) {
34927
35937
  var contentType = options2.contentType;
34928
- if (!contentType && value.name) {
35938
+ if (!contentType && value && value.name) {
34929
35939
  contentType = mime.lookup(value.name);
34930
35940
  }
34931
- if (!contentType && value.path) {
35941
+ if (!contentType && value && value.path) {
34932
35942
  contentType = mime.lookup(value.path);
34933
35943
  }
34934
- if (!contentType && value.readable && value.hasOwnProperty("httpVersion")) {
35944
+ if (!contentType && value && value.readable && hasOwn(value, "httpVersion")) {
34935
35945
  contentType = value.headers["content-type"];
34936
35946
  }
34937
35947
  if (!contentType && (options2.filepath || options2.filename)) {
34938
35948
  contentType = mime.lookup(options2.filepath || options2.filename);
34939
35949
  }
34940
- if (!contentType && typeof value == "object") {
35950
+ if (!contentType && value && typeof value === "object") {
34941
35951
  contentType = FormData2.DEFAULT_CONTENT_TYPE;
34942
35952
  }
34943
35953
  return contentType;
@@ -34961,13 +35971,16 @@ var require_form_data = __commonJS({
34961
35971
  "content-type": "multipart/form-data; boundary=" + this.getBoundary()
34962
35972
  };
34963
35973
  for (header in userHeaders) {
34964
- if (userHeaders.hasOwnProperty(header)) {
35974
+ if (hasOwn(userHeaders, header)) {
34965
35975
  formHeaders[header.toLowerCase()] = userHeaders[header];
34966
35976
  }
34967
35977
  }
34968
35978
  return formHeaders;
34969
35979
  };
34970
35980
  FormData2.prototype.setBoundary = function(boundary) {
35981
+ if (typeof boundary !== "string") {
35982
+ throw new TypeError("FormData boundary must be a string");
35983
+ }
34971
35984
  this._boundary = boundary;
34972
35985
  };
34973
35986
  FormData2.prototype.getBoundary = function() {
@@ -34994,11 +36007,7 @@ var require_form_data = __commonJS({
34994
36007
  return Buffer.concat([dataBuffer, Buffer.from(this._lastBoundary())]);
34995
36008
  };
34996
36009
  FormData2.prototype._generateBoundary = function() {
34997
- var boundary = "--------------------------";
34998
- for (var i = 0; i < 24; i++) {
34999
- boundary += Math.floor(Math.random() * 10).toString(16);
35000
- }
35001
- this._boundary = boundary;
36010
+ this._boundary = "--------------------------" + crypto.randomBytes(12).toString("hex");
35002
36011
  };
35003
36012
  FormData2.prototype.getLengthSync = function() {
35004
36013
  var knownLength = this._overheadLength + this._valueLength;
@@ -35038,8 +36047,10 @@ var require_form_data = __commonJS({
35038
36047
  });
35039
36048
  };
35040
36049
  FormData2.prototype.submit = function(params, cb) {
35041
- var request, options2, defaults = { method: "post" };
35042
- if (typeof params == "string") {
36050
+ var request;
36051
+ var options2;
36052
+ var defaults = { method: "post" };
36053
+ if (typeof params === "string") {
35043
36054
  params = parseUrl(params);
35044
36055
  options2 = populate({
35045
36056
  port: params.port,
@@ -35050,11 +36061,11 @@ var require_form_data = __commonJS({
35050
36061
  } else {
35051
36062
  options2 = populate(params, defaults);
35052
36063
  if (!options2.port) {
35053
- options2.port = options2.protocol == "https:" ? 443 : 80;
36064
+ options2.port = options2.protocol === "https:" ? 443 : 80;
35054
36065
  }
35055
36066
  }
35056
36067
  options2.headers = this.getHeaders(params.headers);
35057
- if (options2.protocol == "https:") {
36068
+ if (options2.protocol === "https:") {
35058
36069
  request = https.request(options2);
35059
36070
  } else {
35060
36071
  request = http.request(options2);
@@ -35092,6 +36103,8 @@ var require_form_data = __commonJS({
35092
36103
  FormData2.prototype.toString = function() {
35093
36104
  return "[object FormData]";
35094
36105
  };
36106
+ setToStringTag(FormData2, "FormData");
36107
+ module2.exports = FormData2;
35095
36108
  }
35096
36109
  });
35097
36110
 
@@ -36340,6 +37353,7 @@ var require_axios = __commonJS({
36340
37353
  }
36341
37354
  var { toString } = Object.prototype;
36342
37355
  var { getPrototypeOf } = Object;
37356
+ var { iterator, toStringTag } = Symbol;
36343
37357
  var kindOf = /* @__PURE__ */ ((cache) => (thing) => {
36344
37358
  const str = toString.call(thing);
36345
37359
  return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
@@ -36374,7 +37388,17 @@ var require_axios = __commonJS({
36374
37388
  return false;
36375
37389
  }
36376
37390
  const prototype2 = getPrototypeOf(val);
36377
- return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
37391
+ return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(toStringTag in val) && !(iterator in val);
37392
+ };
37393
+ var isEmptyObject = (val) => {
37394
+ if (!isObject(val) || isBuffer(val)) {
37395
+ return false;
37396
+ }
37397
+ try {
37398
+ return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
37399
+ } catch (e) {
37400
+ return false;
37401
+ }
36378
37402
  };
36379
37403
  var isDate = kindOfTest("Date");
36380
37404
  var isFile = kindOfTest("File");
@@ -36403,6 +37427,9 @@ var require_axios = __commonJS({
36403
37427
  fn.call(null, obj[i], i, obj);
36404
37428
  }
36405
37429
  } else {
37430
+ if (isBuffer(obj)) {
37431
+ return;
37432
+ }
36406
37433
  const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
36407
37434
  const len = keys.length;
36408
37435
  let key;
@@ -36413,6 +37440,9 @@ var require_axios = __commonJS({
36413
37440
  }
36414
37441
  }
36415
37442
  function findKey(obj, key) {
37443
+ if (isBuffer(obj)) {
37444
+ return null;
37445
+ }
36416
37446
  key = key.toLowerCase();
36417
37447
  const keys = Object.keys(obj);
36418
37448
  let i = keys.length;
@@ -36521,10 +37551,10 @@ var require_axios = __commonJS({
36521
37551
  };
36522
37552
  })(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array));
36523
37553
  var forEachEntry = (obj, fn) => {
36524
- const generator = obj && obj[Symbol.iterator];
36525
- const iterator = generator.call(obj);
37554
+ const generator = obj && obj[iterator];
37555
+ const _iterator = generator.call(obj);
36526
37556
  let result;
36527
- while ((result = iterator.next()) && !result.done) {
37557
+ while ((result = _iterator.next()) && !result.done) {
36528
37558
  const pair = result.value;
36529
37559
  fn.call(obj, pair[0], pair[1]);
36530
37560
  }
@@ -36594,7 +37624,7 @@ var require_axios = __commonJS({
36594
37624
  return value != null && Number.isFinite(value = +value) ? value : defaultValue;
36595
37625
  };
36596
37626
  function isSpecCompliantForm(thing) {
36597
- return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === "FormData" && thing[Symbol.iterator]);
37627
+ return !!(thing && isFunction(thing.append) && thing[toStringTag] === "FormData" && thing[iterator]);
36598
37628
  }
36599
37629
  var toJSONObject = (obj) => {
36600
37630
  const stack = new Array(10);
@@ -36603,6 +37633,9 @@ var require_axios = __commonJS({
36603
37633
  if (stack.indexOf(source) >= 0) {
36604
37634
  return;
36605
37635
  }
37636
+ if (isBuffer(source)) {
37637
+ return source;
37638
+ }
36606
37639
  if (!("toJSON" in source)) {
36607
37640
  stack[i] = source;
36608
37641
  const target = isArray(source) ? [] : {};
@@ -36640,6 +37673,7 @@ var require_axios = __commonJS({
36640
37673
  isFunction(_global.postMessage)
36641
37674
  );
36642
37675
  var asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global) : typeof process !== "undefined" && process.nextTick || _setImmediate;
37676
+ var isIterable = (thing) => thing != null && isFunction(thing[iterator]);
36643
37677
  var utils$1 = {
36644
37678
  isArray,
36645
37679
  isArrayBuffer,
@@ -36651,6 +37685,7 @@ var require_axios = __commonJS({
36651
37685
  isBoolean,
36652
37686
  isObject,
36653
37687
  isPlainObject,
37688
+ isEmptyObject,
36654
37689
  isReadableStream,
36655
37690
  isRequest,
36656
37691
  isResponse,
@@ -36696,7 +37731,8 @@ var require_axios = __commonJS({
36696
37731
  isAsyncFn,
36697
37732
  isThenable,
36698
37733
  setImmediate: _setImmediate,
36699
- asap
37734
+ asap,
37735
+ isIterable
36700
37736
  };
36701
37737
  function AxiosError(message, code, config, request, response) {
36702
37738
  Error.call(this);
@@ -36815,6 +37851,9 @@ var require_axios = __commonJS({
36815
37851
  if (utils$1.isDate(value)) {
36816
37852
  return value.toISOString();
36817
37853
  }
37854
+ if (utils$1.isBoolean(value)) {
37855
+ return value.toString();
37856
+ }
36818
37857
  if (!useBlob && utils$1.isBlob(value)) {
36819
37858
  throw new AxiosError("Blob is not supported. Use a Buffer instead.");
36820
37859
  }
@@ -37055,15 +38094,16 @@ var require_axios = __commonJS({
37055
38094
  ...platform$1
37056
38095
  };
37057
38096
  function toURLEncodedForm(data, options2) {
37058
- return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
38097
+ return toFormData(data, new platform.classes.URLSearchParams(), {
37059
38098
  visitor: function(value, key, path, helpers) {
37060
38099
  if (platform.isNode && utils$1.isBuffer(value)) {
37061
38100
  this.append(key, value.toString("base64"));
37062
38101
  return false;
37063
38102
  }
37064
38103
  return helpers.defaultVisitor.apply(this, arguments);
37065
- }
37066
- }, options2));
38104
+ },
38105
+ ...options2
38106
+ });
37067
38107
  }
37068
38108
  function parsePropPath(name) {
37069
38109
  return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
@@ -37337,10 +38377,15 @@ var require_axios = __commonJS({
37337
38377
  setHeaders(header, valueOrRewrite);
37338
38378
  } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
37339
38379
  setHeaders(parseHeaders(header), valueOrRewrite);
37340
- } else if (utils$1.isHeaders(header)) {
37341
- for (const [key, value] of header.entries()) {
37342
- setHeader(value, key, rewrite);
38380
+ } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
38381
+ let obj = {}, dest, key;
38382
+ for (const entry of header) {
38383
+ if (!utils$1.isArray(entry)) {
38384
+ throw TypeError("Object iterator must return a key-value pair");
38385
+ }
38386
+ obj[key = entry[0]] = (dest = obj[key]) ? utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]] : entry[1];
37343
38387
  }
38388
+ setHeaders(obj, valueOrRewrite);
37344
38389
  } else {
37345
38390
  header != null && setHeader(valueOrRewrite, header, rewrite);
37346
38391
  }
@@ -37444,6 +38489,9 @@ var require_axios = __commonJS({
37444
38489
  toString() {
37445
38490
  return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
37446
38491
  }
38492
+ getSetCookie() {
38493
+ return this.get("set-cookie") || [];
38494
+ }
37447
38495
  get [Symbol.toStringTag]() {
37448
38496
  return "AxiosHeaders";
37449
38497
  }
@@ -37527,12 +38575,12 @@ var require_axios = __commonJS({
37527
38575
  }
37528
38576
  function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
37529
38577
  let isRelativeUrl = !isAbsoluteURL(requestedURL);
37530
- if (baseURL && isRelativeUrl || allowAbsoluteUrls == false) {
38578
+ if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
37531
38579
  return combineURLs(baseURL, requestedURL);
37532
38580
  }
37533
38581
  return requestedURL;
37534
38582
  }
37535
- var VERSION = "1.8.2";
38583
+ var VERSION = "1.11.0";
37536
38584
  function parseProtocol(url2) {
37537
38585
  const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url2);
37538
38586
  return match && match[1] || "";
@@ -37741,7 +38789,7 @@ var require_axios = __commonJS({
37741
38789
  throw Error("boundary must be 10-70 characters long");
37742
38790
  }
37743
38791
  const boundaryBytes = textEncoder.encode("--" + boundary + CRLF);
37744
- const footerBytes = textEncoder.encode("--" + boundary + "--" + CRLF + CRLF);
38792
+ const footerBytes = textEncoder.encode("--" + boundary + "--" + CRLF);
37745
38793
  let contentLength = footerBytes.byteLength;
37746
38794
  const parts = Array.from(form.entries()).map(([name, value]) => {
37747
38795
  const part = new FormDataPart(name, value);
@@ -37843,7 +38891,7 @@ var require_axios = __commonJS({
37843
38891
  clearTimeout(timer);
37844
38892
  timer = null;
37845
38893
  }
37846
- fn.apply(null, args);
38894
+ fn(...args);
37847
38895
  };
37848
38896
  const throttled = (...args) => {
37849
38897
  const now = Date.now();
@@ -38504,7 +39552,7 @@ var require_axios = __commonJS({
38504
39552
  validateStatus: mergeDirectKeys,
38505
39553
  headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
38506
39554
  };
38507
- utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
39555
+ utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
38508
39556
  const merge2 = mergeMap[prop] || mergeDeepProperties;
38509
39557
  const configValue = merge2(config1[prop], config2[prop], prop);
38510
39558
  utils$1.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
@@ -38515,7 +39563,7 @@ var require_axios = __commonJS({
38515
39563
  const newConfig = mergeConfig({}, config);
38516
39564
  let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
38517
39565
  newConfig.headers = headers = AxiosHeaders$1.from(headers);
38518
- newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);
39566
+ newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
38519
39567
  if (auth) {
38520
39568
  headers.set(
38521
39569
  "Authorization",
@@ -38739,7 +39787,7 @@ var require_axios = __commonJS({
38739
39787
  }
38740
39788
  };
38741
39789
  var trackStream = (stream2, chunkSize, onProgress, onFinish) => {
38742
- const iterator = readBytes(stream2, chunkSize);
39790
+ const iterator2 = readBytes(stream2, chunkSize);
38743
39791
  let bytes = 0;
38744
39792
  let done;
38745
39793
  let _onFinish = (e) => {
@@ -38751,7 +39799,7 @@ var require_axios = __commonJS({
38751
39799
  return new ReadableStream({
38752
39800
  async pull(controller) {
38753
39801
  try {
38754
- const { done: done2, value } = await iterator.next();
39802
+ const { done: done2, value } = await iterator2.next();
38755
39803
  if (done2) {
38756
39804
  _onFinish();
38757
39805
  controller.close();
@@ -38770,7 +39818,7 @@ var require_axios = __commonJS({
38770
39818
  },
38771
39819
  cancel(reason) {
38772
39820
  _onFinish(reason);
38773
- return iterator.return();
39821
+ return iterator2.return();
38774
39822
  }
38775
39823
  }, {
38776
39824
  highWaterMark: 2
@@ -38892,7 +39940,7 @@ var require_axios = __commonJS({
38892
39940
  duplex: "half",
38893
39941
  credentials: isCredentialsSupported ? withCredentials : void 0
38894
39942
  });
38895
- let response = await fetch(request);
39943
+ let response = await fetch(request, fetchOptions);
38896
39944
  const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
38897
39945
  if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
38898
39946
  const options2 = {};
@@ -38927,7 +39975,7 @@ var require_axios = __commonJS({
38927
39975
  });
38928
39976
  } catch (err) {
38929
39977
  unsubscribe && unsubscribe();
38930
- if (err && err.name === "TypeError" && /fetch/i.test(err.message)) {
39978
+ if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) {
38931
39979
  throw Object.assign(
38932
39980
  new AxiosError("Network Error", AxiosError.ERR_NETWORK, config, request),
38933
39981
  {
@@ -39098,7 +40146,7 @@ var require_axios = __commonJS({
39098
40146
  var validators = validator.validators;
39099
40147
  var Axios = class {
39100
40148
  constructor(instanceConfig) {
39101
- this.defaults = instanceConfig;
40149
+ this.defaults = instanceConfig || {};
39102
40150
  this.interceptors = {
39103
40151
  request: new InterceptorManager$1(),
39104
40152
  response: new InterceptorManager$1()
@@ -39200,8 +40248,8 @@ var require_axios = __commonJS({
39200
40248
  let len;
39201
40249
  if (!synchronousRequestInterceptors) {
39202
40250
  const chain = [dispatchRequest.bind(this), void 0];
39203
- chain.unshift.apply(chain, requestInterceptorChain);
39204
- chain.push.apply(chain, responseInterceptorChain);
40251
+ chain.unshift(...requestInterceptorChain);
40252
+ chain.push(...responseInterceptorChain);
39205
40253
  len = chain.length;
39206
40254
  promise = Promise.resolve(config);
39207
40255
  while (i < len) {
@@ -39848,12 +40896,18 @@ var require_create_destination = __commonJS({
39848
40896
  var require_constants = __commonJS({
39849
40897
  "../../node_modules/ws/lib/constants.js"(exports2, module2) {
39850
40898
  "use strict";
40899
+ var BINARY_TYPES = ["nodebuffer", "arraybuffer", "fragments"];
40900
+ var hasBlob = typeof Blob !== "undefined";
40901
+ if (hasBlob) BINARY_TYPES.push("blob");
39851
40902
  module2.exports = {
39852
- BINARY_TYPES: ["nodebuffer", "arraybuffer", "fragments"],
40903
+ BINARY_TYPES,
40904
+ EMPTY_BUFFER: Buffer.alloc(0),
39853
40905
  GUID: "258EAFA5-E914-47DA-95CA-C5AB0DC85B11",
40906
+ hasBlob,
40907
+ kForOnEventAttribute: Symbol("kIsForOnEventAttribute"),
40908
+ kListener: Symbol("kListener"),
39854
40909
  kStatusCode: Symbol("status-code"),
39855
40910
  kWebSocket: Symbol("websocket"),
39856
- EMPTY_BUFFER: Buffer.alloc(0),
39857
40911
  NOOP: () => {
39858
40912
  }
39859
40913
  };
@@ -39865,6 +40919,7 @@ var require_buffer_util = __commonJS({
39865
40919
  "../../node_modules/ws/lib/buffer-util.js"(exports2, module2) {
39866
40920
  "use strict";
39867
40921
  var { EMPTY_BUFFER } = require_constants();
40922
+ var FastBuffer = Buffer[Symbol.species];
39868
40923
  function concat2(list, totalLength) {
39869
40924
  if (list.length === 0) return EMPTY_BUFFER;
39870
40925
  if (list.length === 1) return list[0];
@@ -39875,7 +40930,9 @@ var require_buffer_util = __commonJS({
39875
40930
  target.set(buf, offset);
39876
40931
  offset += buf.length;
39877
40932
  }
39878
- if (offset < totalLength) return target.slice(0, offset);
40933
+ if (offset < totalLength) {
40934
+ return new FastBuffer(target.buffer, target.byteOffset, offset);
40935
+ }
39879
40936
  return target;
39880
40937
  }
39881
40938
  function _mask(source, mask, output, offset, length) {
@@ -39884,55 +40941,50 @@ var require_buffer_util = __commonJS({
39884
40941
  }
39885
40942
  }
39886
40943
  function _unmask(buffer, mask) {
39887
- const length = buffer.length;
39888
- for (let i = 0; i < length; i++) {
40944
+ for (let i = 0; i < buffer.length; i++) {
39889
40945
  buffer[i] ^= mask[i & 3];
39890
40946
  }
39891
40947
  }
39892
40948
  function toArrayBuffer(buf) {
39893
- if (buf.byteLength === buf.buffer.byteLength) {
40949
+ if (buf.length === buf.buffer.byteLength) {
39894
40950
  return buf.buffer;
39895
40951
  }
39896
- return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
40952
+ return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.length);
39897
40953
  }
39898
40954
  function toBuffer(data) {
39899
40955
  toBuffer.readOnly = true;
39900
40956
  if (Buffer.isBuffer(data)) return data;
39901
40957
  let buf;
39902
40958
  if (data instanceof ArrayBuffer) {
39903
- buf = Buffer.from(data);
40959
+ buf = new FastBuffer(data);
39904
40960
  } else if (ArrayBuffer.isView(data)) {
39905
- buf = Buffer.from(data.buffer, data.byteOffset, data.byteLength);
40961
+ buf = new FastBuffer(data.buffer, data.byteOffset, data.byteLength);
39906
40962
  } else {
39907
40963
  buf = Buffer.from(data);
39908
40964
  toBuffer.readOnly = false;
39909
40965
  }
39910
40966
  return buf;
39911
40967
  }
39912
- try {
39913
- const bufferUtil = require("bufferutil");
39914
- const bu = bufferUtil.BufferUtil || bufferUtil;
39915
- module2.exports = {
39916
- concat: concat2,
39917
- mask(source, mask, output, offset, length) {
40968
+ module2.exports = {
40969
+ concat: concat2,
40970
+ mask: _mask,
40971
+ toArrayBuffer,
40972
+ toBuffer,
40973
+ unmask: _unmask
40974
+ };
40975
+ if (!process.env.WS_NO_BUFFER_UTIL) {
40976
+ try {
40977
+ const bufferUtil = require("bufferutil");
40978
+ module2.exports.mask = function(source, mask, output, offset, length) {
39918
40979
  if (length < 48) _mask(source, mask, output, offset, length);
39919
- else bu.mask(source, mask, output, offset, length);
39920
- },
39921
- toArrayBuffer,
39922
- toBuffer,
39923
- unmask(buffer, mask) {
40980
+ else bufferUtil.mask(source, mask, output, offset, length);
40981
+ };
40982
+ module2.exports.unmask = function(buffer, mask) {
39924
40983
  if (buffer.length < 32) _unmask(buffer, mask);
39925
- else bu.unmask(buffer, mask);
39926
- }
39927
- };
39928
- } catch (e) {
39929
- module2.exports = {
39930
- concat: concat2,
39931
- mask: _mask,
39932
- toArrayBuffer,
39933
- toBuffer,
39934
- unmask: _unmask
39935
- };
40984
+ else bufferUtil.unmask(buffer, mask);
40985
+ };
40986
+ } catch (e) {
40987
+ }
39936
40988
  }
39937
40989
  }
39938
40990
  });
@@ -39994,7 +41046,8 @@ var require_permessage_deflate = __commonJS({
39994
41046
  var zlib = require("zlib");
39995
41047
  var bufferUtil = require_buffer_util();
39996
41048
  var Limiter = require_limiter();
39997
- var { kStatusCode, NOOP } = require_constants();
41049
+ var { kStatusCode } = require_constants();
41050
+ var FastBuffer = Buffer[Symbol.species];
39998
41051
  var TRAILER = Buffer.from([0, 0, 255, 255]);
39999
41052
  var kPerMessageDeflate = Symbol("permessage-deflate");
40000
41053
  var kTotalLength = Symbol("total-length");
@@ -40007,22 +41060,22 @@ var require_permessage_deflate = __commonJS({
40007
41060
  * Creates a PerMessageDeflate instance.
40008
41061
  *
40009
41062
  * @param {Object} [options] Configuration options
40010
- * @param {Boolean} [options.serverNoContextTakeover=false] Request/accept
40011
- * disabling of server context takeover
41063
+ * @param {(Boolean|Number)} [options.clientMaxWindowBits] Advertise support
41064
+ * for, or request, a custom client window size
40012
41065
  * @param {Boolean} [options.clientNoContextTakeover=false] Advertise/
40013
41066
  * acknowledge disabling of client context takeover
41067
+ * @param {Number} [options.concurrencyLimit=10] The number of concurrent
41068
+ * calls to zlib
40014
41069
  * @param {(Boolean|Number)} [options.serverMaxWindowBits] Request/confirm the
40015
41070
  * use of a custom server window size
40016
- * @param {(Boolean|Number)} [options.clientMaxWindowBits] Advertise support
40017
- * for, or request, a custom client window size
41071
+ * @param {Boolean} [options.serverNoContextTakeover=false] Request/accept
41072
+ * disabling of server context takeover
41073
+ * @param {Number} [options.threshold=1024] Size (in bytes) below which
41074
+ * messages should not be compressed if context takeover is disabled
40018
41075
  * @param {Object} [options.zlibDeflateOptions] Options to pass to zlib on
40019
41076
  * deflate
40020
41077
  * @param {Object} [options.zlibInflateOptions] Options to pass to zlib on
40021
41078
  * inflate
40022
- * @param {Number} [options.threshold=1024] Size (in bytes) below which
40023
- * messages should not be compressed
40024
- * @param {Number} [options.concurrencyLimit=10] The number of concurrent
40025
- * calls to zlib
40026
41079
  * @param {Boolean} [isServer=false] Create the instance in either server or
40027
41080
  * client mode
40028
41081
  * @param {Number} [maxPayload=0] The maximum allowed message length
@@ -40232,7 +41285,7 @@ var require_permessage_deflate = __commonJS({
40232
41285
  /**
40233
41286
  * Compress data. Concurrency limited.
40234
41287
  *
40235
- * @param {Buffer} data Data to compress
41288
+ * @param {(Buffer|String)} data Data to compress
40236
41289
  * @param {Boolean} fin Specifies whether or not this is the last fragment
40237
41290
  * @param {Function} callback Callback
40238
41291
  * @public
@@ -40299,7 +41352,7 @@ var require_permessage_deflate = __commonJS({
40299
41352
  /**
40300
41353
  * Compress data.
40301
41354
  *
40302
- * @param {Buffer} data Data to compress
41355
+ * @param {(Buffer|String)} data Data to compress
40303
41356
  * @param {Boolean} fin Specifies whether or not this is the last fragment
40304
41357
  * @param {Function} callback Callback
40305
41358
  * @private
@@ -40315,7 +41368,6 @@ var require_permessage_deflate = __commonJS({
40315
41368
  });
40316
41369
  this._deflate[kTotalLength] = 0;
40317
41370
  this._deflate[kBuffers] = [];
40318
- this._deflate.on("error", NOOP);
40319
41371
  this._deflate.on("data", deflateOnData);
40320
41372
  }
40321
41373
  this._deflate[kCallback] = callback;
@@ -40328,7 +41380,9 @@ var require_permessage_deflate = __commonJS({
40328
41380
  this._deflate[kBuffers],
40329
41381
  this._deflate[kTotalLength]
40330
41382
  );
40331
- if (fin) data2 = data2.slice(0, data2.length - 4);
41383
+ if (fin) {
41384
+ data2 = new FastBuffer(data2.buffer, data2.byteOffset, data2.length - 4);
41385
+ }
40332
41386
  this._deflate[kCallback] = null;
40333
41387
  this._deflate[kTotalLength] = 0;
40334
41388
  this._deflate[kBuffers] = [];
@@ -40358,6 +41412,10 @@ var require_permessage_deflate = __commonJS({
40358
41412
  }
40359
41413
  function inflateOnError(err) {
40360
41414
  this[kPerMessageDeflate]._inflate = null;
41415
+ if (this[kError]) {
41416
+ this[kCallback](this[kError]);
41417
+ return;
41418
+ }
40361
41419
  err[kStatusCode] = 1007;
40362
41420
  this[kCallback](err);
40363
41421
  }
@@ -40368,6 +41426,146 @@ var require_permessage_deflate = __commonJS({
40368
41426
  var require_validation = __commonJS({
40369
41427
  "../../node_modules/ws/lib/validation.js"(exports2, module2) {
40370
41428
  "use strict";
41429
+ var { isUtf8 } = require("buffer");
41430
+ var { hasBlob } = require_constants();
41431
+ var tokenChars = [
41432
+ 0,
41433
+ 0,
41434
+ 0,
41435
+ 0,
41436
+ 0,
41437
+ 0,
41438
+ 0,
41439
+ 0,
41440
+ 0,
41441
+ 0,
41442
+ 0,
41443
+ 0,
41444
+ 0,
41445
+ 0,
41446
+ 0,
41447
+ 0,
41448
+ // 0 - 15
41449
+ 0,
41450
+ 0,
41451
+ 0,
41452
+ 0,
41453
+ 0,
41454
+ 0,
41455
+ 0,
41456
+ 0,
41457
+ 0,
41458
+ 0,
41459
+ 0,
41460
+ 0,
41461
+ 0,
41462
+ 0,
41463
+ 0,
41464
+ 0,
41465
+ // 16 - 31
41466
+ 0,
41467
+ 1,
41468
+ 0,
41469
+ 1,
41470
+ 1,
41471
+ 1,
41472
+ 1,
41473
+ 1,
41474
+ 0,
41475
+ 0,
41476
+ 1,
41477
+ 1,
41478
+ 0,
41479
+ 1,
41480
+ 1,
41481
+ 0,
41482
+ // 32 - 47
41483
+ 1,
41484
+ 1,
41485
+ 1,
41486
+ 1,
41487
+ 1,
41488
+ 1,
41489
+ 1,
41490
+ 1,
41491
+ 1,
41492
+ 1,
41493
+ 0,
41494
+ 0,
41495
+ 0,
41496
+ 0,
41497
+ 0,
41498
+ 0,
41499
+ // 48 - 63
41500
+ 0,
41501
+ 1,
41502
+ 1,
41503
+ 1,
41504
+ 1,
41505
+ 1,
41506
+ 1,
41507
+ 1,
41508
+ 1,
41509
+ 1,
41510
+ 1,
41511
+ 1,
41512
+ 1,
41513
+ 1,
41514
+ 1,
41515
+ 1,
41516
+ // 64 - 79
41517
+ 1,
41518
+ 1,
41519
+ 1,
41520
+ 1,
41521
+ 1,
41522
+ 1,
41523
+ 1,
41524
+ 1,
41525
+ 1,
41526
+ 1,
41527
+ 1,
41528
+ 0,
41529
+ 0,
41530
+ 0,
41531
+ 1,
41532
+ 1,
41533
+ // 80 - 95
41534
+ 1,
41535
+ 1,
41536
+ 1,
41537
+ 1,
41538
+ 1,
41539
+ 1,
41540
+ 1,
41541
+ 1,
41542
+ 1,
41543
+ 1,
41544
+ 1,
41545
+ 1,
41546
+ 1,
41547
+ 1,
41548
+ 1,
41549
+ 1,
41550
+ // 96 - 111
41551
+ 1,
41552
+ 1,
41553
+ 1,
41554
+ 1,
41555
+ 1,
41556
+ 1,
41557
+ 1,
41558
+ 1,
41559
+ 1,
41560
+ 1,
41561
+ 1,
41562
+ 0,
41563
+ 1,
41564
+ 0,
41565
+ 1,
41566
+ 0
41567
+ // 112 - 127
41568
+ ];
40371
41569
  function isValidStatusCode(code) {
40372
41570
  return code >= 1e3 && code <= 1014 && code !== 1004 && code !== 1005 && code !== 1006 || code >= 3e3 && code <= 4999;
40373
41571
  }
@@ -40400,22 +41598,27 @@ var require_validation = __commonJS({
40400
41598
  }
40401
41599
  return true;
40402
41600
  }
40403
- try {
40404
- let isValidUTF8 = require("utf-8-validate");
40405
- if (typeof isValidUTF8 === "object") {
40406
- isValidUTF8 = isValidUTF8.Validation.isValidUTF8;
40407
- }
40408
- module2.exports = {
40409
- isValidStatusCode,
40410
- isValidUTF8(buf) {
40411
- return buf.length < 150 ? _isValidUTF8(buf) : isValidUTF8(buf);
40412
- }
40413
- };
40414
- } catch (e) {
40415
- module2.exports = {
40416
- isValidStatusCode,
40417
- isValidUTF8: _isValidUTF8
41601
+ function isBlob(value) {
41602
+ return hasBlob && typeof value === "object" && typeof value.arrayBuffer === "function" && typeof value.type === "string" && typeof value.stream === "function" && (value[Symbol.toStringTag] === "Blob" || value[Symbol.toStringTag] === "File");
41603
+ }
41604
+ module2.exports = {
41605
+ isBlob,
41606
+ isValidStatusCode,
41607
+ isValidUTF8: _isValidUTF8,
41608
+ tokenChars
41609
+ };
41610
+ if (isUtf8) {
41611
+ module2.exports.isValidUTF8 = function(buf) {
41612
+ return buf.length < 24 ? _isValidUTF8(buf) : isUtf8(buf);
40418
41613
  };
41614
+ } else if (!process.env.WS_NO_UTF_8_VALIDATE) {
41615
+ try {
41616
+ const isValidUTF8 = require("utf-8-validate");
41617
+ module2.exports.isValidUTF8 = function(buf) {
41618
+ return buf.length < 32 ? _isValidUTF8(buf) : isValidUTF8(buf);
41619
+ };
41620
+ } catch (e) {
41621
+ }
40419
41622
  }
40420
41623
  }
40421
41624
  });
@@ -40434,29 +41637,40 @@ var require_receiver = __commonJS({
40434
41637
  } = require_constants();
40435
41638
  var { concat: concat2, toArrayBuffer, unmask } = require_buffer_util();
40436
41639
  var { isValidStatusCode, isValidUTF8 } = require_validation();
41640
+ var FastBuffer = Buffer[Symbol.species];
40437
41641
  var GET_INFO = 0;
40438
41642
  var GET_PAYLOAD_LENGTH_16 = 1;
40439
41643
  var GET_PAYLOAD_LENGTH_64 = 2;
40440
41644
  var GET_MASK = 3;
40441
41645
  var GET_DATA = 4;
40442
41646
  var INFLATING = 5;
41647
+ var DEFER_EVENT = 6;
40443
41648
  var Receiver = class extends Writable {
40444
41649
  /**
40445
41650
  * Creates a Receiver instance.
40446
41651
  *
40447
- * @param {String} [binaryType=nodebuffer] The type for binary data
40448
- * @param {Object} [extensions] An object containing the negotiated extensions
40449
- * @param {Boolean} [isServer=false] Specifies whether to operate in client or
40450
- * server mode
40451
- * @param {Number} [maxPayload=0] The maximum allowed message length
41652
+ * @param {Object} [options] Options object
41653
+ * @param {Boolean} [options.allowSynchronousEvents=true] Specifies whether
41654
+ * any of the `'message'`, `'ping'`, and `'pong'` events can be emitted
41655
+ * multiple times in the same tick
41656
+ * @param {String} [options.binaryType=nodebuffer] The type for binary data
41657
+ * @param {Object} [options.extensions] An object containing the negotiated
41658
+ * extensions
41659
+ * @param {Boolean} [options.isServer=false] Specifies whether to operate in
41660
+ * client or server mode
41661
+ * @param {Number} [options.maxPayload=0] The maximum allowed message length
41662
+ * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
41663
+ * not to skip UTF-8 validation for text and close messages
40452
41664
  */
40453
- constructor(binaryType, extensions, isServer, maxPayload) {
41665
+ constructor(options2 = {}) {
40454
41666
  super();
40455
- this._binaryType = binaryType || BINARY_TYPES[0];
41667
+ this._allowSynchronousEvents = options2.allowSynchronousEvents !== void 0 ? options2.allowSynchronousEvents : true;
41668
+ this._binaryType = options2.binaryType || BINARY_TYPES[0];
41669
+ this._extensions = options2.extensions || {};
41670
+ this._isServer = !!options2.isServer;
41671
+ this._maxPayload = options2.maxPayload | 0;
41672
+ this._skipUTF8Validation = !!options2.skipUTF8Validation;
40456
41673
  this[kWebSocket] = void 0;
40457
- this._extensions = extensions || {};
40458
- this._isServer = !!isServer;
40459
- this._maxPayload = maxPayload | 0;
40460
41674
  this._bufferedBytes = 0;
40461
41675
  this._buffers = [];
40462
41676
  this._compressed = false;
@@ -40469,8 +41683,9 @@ var require_receiver = __commonJS({
40469
41683
  this._totalPayloadLength = 0;
40470
41684
  this._messageLength = 0;
40471
41685
  this._fragments = [];
40472
- this._state = GET_INFO;
41686
+ this._errored = false;
40473
41687
  this._loop = false;
41688
+ this._state = GET_INFO;
40474
41689
  }
40475
41690
  /**
40476
41691
  * Implements `Writable.prototype._write()`.
@@ -40498,8 +41713,12 @@ var require_receiver = __commonJS({
40498
41713
  if (n === this._buffers[0].length) return this._buffers.shift();
40499
41714
  if (n < this._buffers[0].length) {
40500
41715
  const buf = this._buffers[0];
40501
- this._buffers[0] = buf.slice(n);
40502
- return buf.slice(0, n);
41716
+ this._buffers[0] = new FastBuffer(
41717
+ buf.buffer,
41718
+ buf.byteOffset + n,
41719
+ buf.length - n
41720
+ );
41721
+ return new FastBuffer(buf.buffer, buf.byteOffset, n);
40503
41722
  }
40504
41723
  const dst = Buffer.allocUnsafe(n);
40505
41724
  do {
@@ -40509,7 +41728,11 @@ var require_receiver = __commonJS({
40509
41728
  dst.set(this._buffers.shift(), offset);
40510
41729
  } else {
40511
41730
  dst.set(new Uint8Array(buf.buffer, buf.byteOffset, n), offset);
40512
- this._buffers[0] = buf.slice(n);
41731
+ this._buffers[0] = new FastBuffer(
41732
+ buf.buffer,
41733
+ buf.byteOffset + n,
41734
+ buf.length - n
41735
+ );
40513
41736
  }
40514
41737
  n -= buf.length;
40515
41738
  } while (n > 0);
@@ -40522,191 +41745,202 @@ var require_receiver = __commonJS({
40522
41745
  * @private
40523
41746
  */
40524
41747
  startLoop(cb) {
40525
- let err;
40526
41748
  this._loop = true;
40527
41749
  do {
40528
41750
  switch (this._state) {
40529
41751
  case GET_INFO:
40530
- err = this.getInfo();
41752
+ this.getInfo(cb);
40531
41753
  break;
40532
41754
  case GET_PAYLOAD_LENGTH_16:
40533
- err = this.getPayloadLength16();
41755
+ this.getPayloadLength16(cb);
40534
41756
  break;
40535
41757
  case GET_PAYLOAD_LENGTH_64:
40536
- err = this.getPayloadLength64();
41758
+ this.getPayloadLength64(cb);
40537
41759
  break;
40538
41760
  case GET_MASK:
40539
41761
  this.getMask();
40540
41762
  break;
40541
41763
  case GET_DATA:
40542
- err = this.getData(cb);
41764
+ this.getData(cb);
40543
41765
  break;
40544
- default:
41766
+ case INFLATING:
41767
+ case DEFER_EVENT:
40545
41768
  this._loop = false;
40546
41769
  return;
40547
41770
  }
40548
41771
  } while (this._loop);
40549
- cb(err);
41772
+ if (!this._errored) cb();
40550
41773
  }
40551
41774
  /**
40552
41775
  * Reads the first two bytes of a frame.
40553
41776
  *
40554
- * @return {(RangeError|undefined)} A possible error
41777
+ * @param {Function} cb Callback
40555
41778
  * @private
40556
41779
  */
40557
- getInfo() {
41780
+ getInfo(cb) {
40558
41781
  if (this._bufferedBytes < 2) {
40559
41782
  this._loop = false;
40560
41783
  return;
40561
41784
  }
40562
41785
  const buf = this.consume(2);
40563
41786
  if ((buf[0] & 48) !== 0) {
40564
- this._loop = false;
40565
- return error(
41787
+ const error = this.createError(
40566
41788
  RangeError,
40567
41789
  "RSV2 and RSV3 must be clear",
40568
41790
  true,
40569
41791
  1002,
40570
41792
  "WS_ERR_UNEXPECTED_RSV_2_3"
40571
41793
  );
41794
+ cb(error);
41795
+ return;
40572
41796
  }
40573
41797
  const compressed = (buf[0] & 64) === 64;
40574
41798
  if (compressed && !this._extensions[PerMessageDeflate.extensionName]) {
40575
- this._loop = false;
40576
- return error(
41799
+ const error = this.createError(
40577
41800
  RangeError,
40578
41801
  "RSV1 must be clear",
40579
41802
  true,
40580
41803
  1002,
40581
41804
  "WS_ERR_UNEXPECTED_RSV_1"
40582
41805
  );
41806
+ cb(error);
41807
+ return;
40583
41808
  }
40584
41809
  this._fin = (buf[0] & 128) === 128;
40585
41810
  this._opcode = buf[0] & 15;
40586
41811
  this._payloadLength = buf[1] & 127;
40587
41812
  if (this._opcode === 0) {
40588
41813
  if (compressed) {
40589
- this._loop = false;
40590
- return error(
41814
+ const error = this.createError(
40591
41815
  RangeError,
40592
41816
  "RSV1 must be clear",
40593
41817
  true,
40594
41818
  1002,
40595
41819
  "WS_ERR_UNEXPECTED_RSV_1"
40596
41820
  );
41821
+ cb(error);
41822
+ return;
40597
41823
  }
40598
41824
  if (!this._fragmented) {
40599
- this._loop = false;
40600
- return error(
41825
+ const error = this.createError(
40601
41826
  RangeError,
40602
41827
  "invalid opcode 0",
40603
41828
  true,
40604
41829
  1002,
40605
41830
  "WS_ERR_INVALID_OPCODE"
40606
41831
  );
41832
+ cb(error);
41833
+ return;
40607
41834
  }
40608
41835
  this._opcode = this._fragmented;
40609
41836
  } else if (this._opcode === 1 || this._opcode === 2) {
40610
41837
  if (this._fragmented) {
40611
- this._loop = false;
40612
- return error(
41838
+ const error = this.createError(
40613
41839
  RangeError,
40614
41840
  `invalid opcode ${this._opcode}`,
40615
41841
  true,
40616
41842
  1002,
40617
41843
  "WS_ERR_INVALID_OPCODE"
40618
41844
  );
41845
+ cb(error);
41846
+ return;
40619
41847
  }
40620
41848
  this._compressed = compressed;
40621
41849
  } else if (this._opcode > 7 && this._opcode < 11) {
40622
41850
  if (!this._fin) {
40623
- this._loop = false;
40624
- return error(
41851
+ const error = this.createError(
40625
41852
  RangeError,
40626
41853
  "FIN must be set",
40627
41854
  true,
40628
41855
  1002,
40629
41856
  "WS_ERR_EXPECTED_FIN"
40630
41857
  );
41858
+ cb(error);
41859
+ return;
40631
41860
  }
40632
41861
  if (compressed) {
40633
- this._loop = false;
40634
- return error(
41862
+ const error = this.createError(
40635
41863
  RangeError,
40636
41864
  "RSV1 must be clear",
40637
41865
  true,
40638
41866
  1002,
40639
41867
  "WS_ERR_UNEXPECTED_RSV_1"
40640
41868
  );
41869
+ cb(error);
41870
+ return;
40641
41871
  }
40642
- if (this._payloadLength > 125) {
40643
- this._loop = false;
40644
- return error(
41872
+ if (this._payloadLength > 125 || this._opcode === 8 && this._payloadLength === 1) {
41873
+ const error = this.createError(
40645
41874
  RangeError,
40646
41875
  `invalid payload length ${this._payloadLength}`,
40647
41876
  true,
40648
41877
  1002,
40649
41878
  "WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH"
40650
41879
  );
41880
+ cb(error);
41881
+ return;
40651
41882
  }
40652
41883
  } else {
40653
- this._loop = false;
40654
- return error(
41884
+ const error = this.createError(
40655
41885
  RangeError,
40656
41886
  `invalid opcode ${this._opcode}`,
40657
41887
  true,
40658
41888
  1002,
40659
41889
  "WS_ERR_INVALID_OPCODE"
40660
41890
  );
41891
+ cb(error);
41892
+ return;
40661
41893
  }
40662
41894
  if (!this._fin && !this._fragmented) this._fragmented = this._opcode;
40663
41895
  this._masked = (buf[1] & 128) === 128;
40664
41896
  if (this._isServer) {
40665
41897
  if (!this._masked) {
40666
- this._loop = false;
40667
- return error(
41898
+ const error = this.createError(
40668
41899
  RangeError,
40669
41900
  "MASK must be set",
40670
41901
  true,
40671
41902
  1002,
40672
41903
  "WS_ERR_EXPECTED_MASK"
40673
41904
  );
41905
+ cb(error);
41906
+ return;
40674
41907
  }
40675
41908
  } else if (this._masked) {
40676
- this._loop = false;
40677
- return error(
41909
+ const error = this.createError(
40678
41910
  RangeError,
40679
41911
  "MASK must be clear",
40680
41912
  true,
40681
41913
  1002,
40682
41914
  "WS_ERR_UNEXPECTED_MASK"
40683
41915
  );
41916
+ cb(error);
41917
+ return;
40684
41918
  }
40685
41919
  if (this._payloadLength === 126) this._state = GET_PAYLOAD_LENGTH_16;
40686
41920
  else if (this._payloadLength === 127) this._state = GET_PAYLOAD_LENGTH_64;
40687
- else return this.haveLength();
41921
+ else this.haveLength(cb);
40688
41922
  }
40689
41923
  /**
40690
41924
  * Gets extended payload length (7+16).
40691
41925
  *
40692
- * @return {(RangeError|undefined)} A possible error
41926
+ * @param {Function} cb Callback
40693
41927
  * @private
40694
41928
  */
40695
- getPayloadLength16() {
41929
+ getPayloadLength16(cb) {
40696
41930
  if (this._bufferedBytes < 2) {
40697
41931
  this._loop = false;
40698
41932
  return;
40699
41933
  }
40700
41934
  this._payloadLength = this.consume(2).readUInt16BE(0);
40701
- return this.haveLength();
41935
+ this.haveLength(cb);
40702
41936
  }
40703
41937
  /**
40704
41938
  * Gets extended payload length (7+64).
40705
41939
  *
40706
- * @return {(RangeError|undefined)} A possible error
41940
+ * @param {Function} cb Callback
40707
41941
  * @private
40708
41942
  */
40709
- getPayloadLength64() {
41943
+ getPayloadLength64(cb) {
40710
41944
  if (this._bufferedBytes < 8) {
40711
41945
  this._loop = false;
40712
41946
  return;
@@ -40714,36 +41948,38 @@ var require_receiver = __commonJS({
40714
41948
  const buf = this.consume(8);
40715
41949
  const num = buf.readUInt32BE(0);
40716
41950
  if (num > Math.pow(2, 53 - 32) - 1) {
40717
- this._loop = false;
40718
- return error(
41951
+ const error = this.createError(
40719
41952
  RangeError,
40720
41953
  "Unsupported WebSocket frame: payload length > 2^53 - 1",
40721
41954
  false,
40722
41955
  1009,
40723
41956
  "WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH"
40724
41957
  );
41958
+ cb(error);
41959
+ return;
40725
41960
  }
40726
41961
  this._payloadLength = num * Math.pow(2, 32) + buf.readUInt32BE(4);
40727
- return this.haveLength();
41962
+ this.haveLength(cb);
40728
41963
  }
40729
41964
  /**
40730
41965
  * Payload length has been read.
40731
41966
  *
40732
- * @return {(RangeError|undefined)} A possible error
41967
+ * @param {Function} cb Callback
40733
41968
  * @private
40734
41969
  */
40735
- haveLength() {
41970
+ haveLength(cb) {
40736
41971
  if (this._payloadLength && this._opcode < 8) {
40737
41972
  this._totalPayloadLength += this._payloadLength;
40738
41973
  if (this._totalPayloadLength > this._maxPayload && this._maxPayload > 0) {
40739
- this._loop = false;
40740
- return error(
41974
+ const error = this.createError(
40741
41975
  RangeError,
40742
41976
  "Max payload size exceeded",
40743
41977
  false,
40744
41978
  1009,
40745
41979
  "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"
40746
41980
  );
41981
+ cb(error);
41982
+ return;
40747
41983
  }
40748
41984
  }
40749
41985
  if (this._masked) this._state = GET_MASK;
@@ -40766,7 +42002,6 @@ var require_receiver = __commonJS({
40766
42002
  * Reads data bytes.
40767
42003
  *
40768
42004
  * @param {Function} cb Callback
40769
- * @return {(Error|RangeError|undefined)} A possible error
40770
42005
  * @private
40771
42006
  */
40772
42007
  getData(cb) {
@@ -40777,9 +42012,14 @@ var require_receiver = __commonJS({
40777
42012
  return;
40778
42013
  }
40779
42014
  data = this.consume(this._payloadLength);
40780
- if (this._masked) unmask(data, this._mask);
42015
+ if (this._masked && (this._mask[0] | this._mask[1] | this._mask[2] | this._mask[3]) !== 0) {
42016
+ unmask(data, this._mask);
42017
+ }
42018
+ }
42019
+ if (this._opcode > 7) {
42020
+ this.controlMessage(data, cb);
42021
+ return;
40781
42022
  }
40782
- if (this._opcode > 7) return this.controlMessage(data);
40783
42023
  if (this._compressed) {
40784
42024
  this._state = INFLATING;
40785
42025
  this.decompress(data, cb);
@@ -40789,7 +42029,7 @@ var require_receiver = __commonJS({
40789
42029
  this._messageLength = this._totalPayloadLength;
40790
42030
  this._fragments.push(data);
40791
42031
  }
40792
- return this.dataMessage();
42032
+ this.dataMessage(cb);
40793
42033
  }
40794
42034
  /**
40795
42035
  * Decompresses data.
@@ -40805,63 +42045,86 @@ var require_receiver = __commonJS({
40805
42045
  if (buf.length) {
40806
42046
  this._messageLength += buf.length;
40807
42047
  if (this._messageLength > this._maxPayload && this._maxPayload > 0) {
40808
- return cb(
40809
- error(
40810
- RangeError,
40811
- "Max payload size exceeded",
40812
- false,
40813
- 1009,
40814
- "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"
40815
- )
42048
+ const error = this.createError(
42049
+ RangeError,
42050
+ "Max payload size exceeded",
42051
+ false,
42052
+ 1009,
42053
+ "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"
40816
42054
  );
42055
+ cb(error);
42056
+ return;
40817
42057
  }
40818
42058
  this._fragments.push(buf);
40819
42059
  }
40820
- const er = this.dataMessage();
40821
- if (er) return cb(er);
40822
- this.startLoop(cb);
42060
+ this.dataMessage(cb);
42061
+ if (this._state === GET_INFO) this.startLoop(cb);
40823
42062
  });
40824
42063
  }
40825
42064
  /**
40826
42065
  * Handles a data message.
40827
42066
  *
40828
- * @return {(Error|undefined)} A possible error
42067
+ * @param {Function} cb Callback
40829
42068
  * @private
40830
42069
  */
40831
- dataMessage() {
40832
- if (this._fin) {
40833
- const messageLength = this._messageLength;
40834
- const fragments = this._fragments;
40835
- this._totalPayloadLength = 0;
40836
- this._messageLength = 0;
40837
- this._fragmented = 0;
40838
- this._fragments = [];
40839
- if (this._opcode === 2) {
40840
- let data;
40841
- if (this._binaryType === "nodebuffer") {
40842
- data = concat2(fragments, messageLength);
40843
- } else if (this._binaryType === "arraybuffer") {
40844
- data = toArrayBuffer(concat2(fragments, messageLength));
40845
- } else {
40846
- data = fragments;
40847
- }
40848
- this.emit("message", data);
42070
+ dataMessage(cb) {
42071
+ if (!this._fin) {
42072
+ this._state = GET_INFO;
42073
+ return;
42074
+ }
42075
+ const messageLength = this._messageLength;
42076
+ const fragments = this._fragments;
42077
+ this._totalPayloadLength = 0;
42078
+ this._messageLength = 0;
42079
+ this._fragmented = 0;
42080
+ this._fragments = [];
42081
+ if (this._opcode === 2) {
42082
+ let data;
42083
+ if (this._binaryType === "nodebuffer") {
42084
+ data = concat2(fragments, messageLength);
42085
+ } else if (this._binaryType === "arraybuffer") {
42086
+ data = toArrayBuffer(concat2(fragments, messageLength));
42087
+ } else if (this._binaryType === "blob") {
42088
+ data = new Blob(fragments);
40849
42089
  } else {
40850
- const buf = concat2(fragments, messageLength);
40851
- if (!isValidUTF8(buf)) {
40852
- this._loop = false;
40853
- return error(
40854
- Error,
40855
- "invalid UTF-8 sequence",
40856
- true,
40857
- 1007,
40858
- "WS_ERR_INVALID_UTF8"
40859
- );
40860
- }
40861
- this.emit("message", buf.toString());
42090
+ data = fragments;
42091
+ }
42092
+ if (this._allowSynchronousEvents) {
42093
+ this.emit("message", data, true);
42094
+ this._state = GET_INFO;
42095
+ } else {
42096
+ this._state = DEFER_EVENT;
42097
+ setImmediate(() => {
42098
+ this.emit("message", data, true);
42099
+ this._state = GET_INFO;
42100
+ this.startLoop(cb);
42101
+ });
42102
+ }
42103
+ } else {
42104
+ const buf = concat2(fragments, messageLength);
42105
+ if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
42106
+ const error = this.createError(
42107
+ Error,
42108
+ "invalid UTF-8 sequence",
42109
+ true,
42110
+ 1007,
42111
+ "WS_ERR_INVALID_UTF8"
42112
+ );
42113
+ cb(error);
42114
+ return;
42115
+ }
42116
+ if (this._state === INFLATING || this._allowSynchronousEvents) {
42117
+ this.emit("message", buf, false);
42118
+ this._state = GET_INFO;
42119
+ } else {
42120
+ this._state = DEFER_EVENT;
42121
+ setImmediate(() => {
42122
+ this.emit("message", buf, false);
42123
+ this._state = GET_INFO;
42124
+ this.startLoop(cb);
42125
+ });
40862
42126
  }
40863
42127
  }
40864
- this._state = GET_INFO;
40865
42128
  }
40866
42129
  /**
40867
42130
  * Handles a control message.
@@ -40870,62 +42133,85 @@ var require_receiver = __commonJS({
40870
42133
  * @return {(Error|RangeError|undefined)} A possible error
40871
42134
  * @private
40872
42135
  */
40873
- controlMessage(data) {
42136
+ controlMessage(data, cb) {
40874
42137
  if (this._opcode === 8) {
40875
- this._loop = false;
40876
42138
  if (data.length === 0) {
40877
- this.emit("conclude", 1005, "");
42139
+ this._loop = false;
42140
+ this.emit("conclude", 1005, EMPTY_BUFFER);
40878
42141
  this.end();
40879
- } else if (data.length === 1) {
40880
- return error(
40881
- RangeError,
40882
- "invalid payload length 1",
40883
- true,
40884
- 1002,
40885
- "WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH"
40886
- );
40887
42142
  } else {
40888
42143
  const code = data.readUInt16BE(0);
40889
42144
  if (!isValidStatusCode(code)) {
40890
- return error(
42145
+ const error = this.createError(
40891
42146
  RangeError,
40892
42147
  `invalid status code ${code}`,
40893
42148
  true,
40894
42149
  1002,
40895
42150
  "WS_ERR_INVALID_CLOSE_CODE"
40896
42151
  );
42152
+ cb(error);
42153
+ return;
40897
42154
  }
40898
- const buf = data.slice(2);
40899
- if (!isValidUTF8(buf)) {
40900
- return error(
42155
+ const buf = new FastBuffer(
42156
+ data.buffer,
42157
+ data.byteOffset + 2,
42158
+ data.length - 2
42159
+ );
42160
+ if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
42161
+ const error = this.createError(
40901
42162
  Error,
40902
42163
  "invalid UTF-8 sequence",
40903
42164
  true,
40904
42165
  1007,
40905
42166
  "WS_ERR_INVALID_UTF8"
40906
42167
  );
42168
+ cb(error);
42169
+ return;
40907
42170
  }
40908
- this.emit("conclude", code, buf.toString());
42171
+ this._loop = false;
42172
+ this.emit("conclude", code, buf);
40909
42173
  this.end();
40910
42174
  }
40911
- } else if (this._opcode === 9) {
40912
- this.emit("ping", data);
42175
+ this._state = GET_INFO;
42176
+ return;
42177
+ }
42178
+ if (this._allowSynchronousEvents) {
42179
+ this.emit(this._opcode === 9 ? "ping" : "pong", data);
42180
+ this._state = GET_INFO;
40913
42181
  } else {
40914
- this.emit("pong", data);
42182
+ this._state = DEFER_EVENT;
42183
+ setImmediate(() => {
42184
+ this.emit(this._opcode === 9 ? "ping" : "pong", data);
42185
+ this._state = GET_INFO;
42186
+ this.startLoop(cb);
42187
+ });
40915
42188
  }
40916
- this._state = GET_INFO;
42189
+ }
42190
+ /**
42191
+ * Builds an error object.
42192
+ *
42193
+ * @param {function(new:Error|RangeError)} ErrorCtor The error constructor
42194
+ * @param {String} message The error message
42195
+ * @param {Boolean} prefix Specifies whether or not to add a default prefix to
42196
+ * `message`
42197
+ * @param {Number} statusCode The status code
42198
+ * @param {String} errorCode The exposed error code
42199
+ * @return {(Error|RangeError)} The error
42200
+ * @private
42201
+ */
42202
+ createError(ErrorCtor, message, prefix, statusCode, errorCode) {
42203
+ this._loop = false;
42204
+ this._errored = true;
42205
+ const err = new ErrorCtor(
42206
+ prefix ? `Invalid WebSocket frame: ${message}` : message
42207
+ );
42208
+ Error.captureStackTrace(err, this.createError);
42209
+ err.code = errorCode;
42210
+ err[kStatusCode] = statusCode;
42211
+ return err;
40917
42212
  }
40918
42213
  };
40919
42214
  module2.exports = Receiver;
40920
- function error(ErrorCtor, message, prefix, statusCode, errorCode) {
40921
- const err = new ErrorCtor(
40922
- prefix ? `Invalid WebSocket frame: ${message}` : message
40923
- );
40924
- Error.captureStackTrace(err, error);
40925
- err.code = errorCode;
40926
- err[kStatusCode] = statusCode;
40927
- return err;
40928
- }
40929
42215
  }
40930
42216
  });
40931
42217
 
@@ -40933,98 +42219,150 @@ var require_receiver = __commonJS({
40933
42219
  var require_sender = __commonJS({
40934
42220
  "../../node_modules/ws/lib/sender.js"(exports2, module2) {
40935
42221
  "use strict";
40936
- var net = require("net");
40937
- var tls = require("tls");
42222
+ var { Duplex } = require("stream");
40938
42223
  var { randomFillSync } = require("crypto");
40939
42224
  var PerMessageDeflate = require_permessage_deflate();
40940
- var { EMPTY_BUFFER } = require_constants();
40941
- var { isValidStatusCode } = require_validation();
42225
+ var { EMPTY_BUFFER, kWebSocket, NOOP } = require_constants();
42226
+ var { isBlob, isValidStatusCode } = require_validation();
40942
42227
  var { mask: applyMask, toBuffer } = require_buffer_util();
40943
- var mask = Buffer.alloc(4);
42228
+ var kByteLength = Symbol("kByteLength");
42229
+ var maskBuffer = Buffer.alloc(4);
42230
+ var RANDOM_POOL_SIZE = 8 * 1024;
42231
+ var randomPool;
42232
+ var randomPoolPointer = RANDOM_POOL_SIZE;
42233
+ var DEFAULT = 0;
42234
+ var DEFLATING = 1;
42235
+ var GET_BLOB_DATA = 2;
40944
42236
  var Sender = class _Sender {
40945
42237
  /**
40946
42238
  * Creates a Sender instance.
40947
42239
  *
40948
- * @param {(net.Socket|tls.Socket)} socket The connection socket
42240
+ * @param {Duplex} socket The connection socket
40949
42241
  * @param {Object} [extensions] An object containing the negotiated extensions
42242
+ * @param {Function} [generateMask] The function used to generate the masking
42243
+ * key
40950
42244
  */
40951
- constructor(socket, extensions) {
42245
+ constructor(socket, extensions, generateMask) {
40952
42246
  this._extensions = extensions || {};
42247
+ if (generateMask) {
42248
+ this._generateMask = generateMask;
42249
+ this._maskBuffer = Buffer.alloc(4);
42250
+ }
40953
42251
  this._socket = socket;
40954
42252
  this._firstFragment = true;
40955
42253
  this._compress = false;
40956
42254
  this._bufferedBytes = 0;
40957
- this._deflating = false;
40958
42255
  this._queue = [];
42256
+ this._state = DEFAULT;
42257
+ this.onerror = NOOP;
42258
+ this[kWebSocket] = void 0;
40959
42259
  }
40960
42260
  /**
40961
42261
  * Frames a piece of data according to the HyBi WebSocket protocol.
40962
42262
  *
40963
- * @param {Buffer} data The data to frame
42263
+ * @param {(Buffer|String)} data The data to frame
40964
42264
  * @param {Object} options Options object
40965
- * @param {Number} options.opcode The opcode
40966
- * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be
40967
- * modified
40968
42265
  * @param {Boolean} [options.fin=false] Specifies whether or not to set the
40969
42266
  * FIN bit
42267
+ * @param {Function} [options.generateMask] The function used to generate the
42268
+ * masking key
40970
42269
  * @param {Boolean} [options.mask=false] Specifies whether or not to mask
40971
42270
  * `data`
42271
+ * @param {Buffer} [options.maskBuffer] The buffer used to store the masking
42272
+ * key
42273
+ * @param {Number} options.opcode The opcode
42274
+ * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be
42275
+ * modified
40972
42276
  * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the
40973
42277
  * RSV1 bit
40974
- * @return {Buffer[]} The framed data as a list of `Buffer` instances
42278
+ * @return {(Buffer|String)[]} The framed data
40975
42279
  * @public
40976
42280
  */
40977
42281
  static frame(data, options2) {
40978
- const merge = options2.mask && options2.readOnly;
40979
- let offset = options2.mask ? 6 : 2;
40980
- let payloadLength = data.length;
40981
- if (data.length >= 65536) {
42282
+ let mask;
42283
+ let merge = false;
42284
+ let offset = 2;
42285
+ let skipMasking = false;
42286
+ if (options2.mask) {
42287
+ mask = options2.maskBuffer || maskBuffer;
42288
+ if (options2.generateMask) {
42289
+ options2.generateMask(mask);
42290
+ } else {
42291
+ if (randomPoolPointer === RANDOM_POOL_SIZE) {
42292
+ if (randomPool === void 0) {
42293
+ randomPool = Buffer.alloc(RANDOM_POOL_SIZE);
42294
+ }
42295
+ randomFillSync(randomPool, 0, RANDOM_POOL_SIZE);
42296
+ randomPoolPointer = 0;
42297
+ }
42298
+ mask[0] = randomPool[randomPoolPointer++];
42299
+ mask[1] = randomPool[randomPoolPointer++];
42300
+ mask[2] = randomPool[randomPoolPointer++];
42301
+ mask[3] = randomPool[randomPoolPointer++];
42302
+ }
42303
+ skipMasking = (mask[0] | mask[1] | mask[2] | mask[3]) === 0;
42304
+ offset = 6;
42305
+ }
42306
+ let dataLength;
42307
+ if (typeof data === "string") {
42308
+ if ((!options2.mask || skipMasking) && options2[kByteLength] !== void 0) {
42309
+ dataLength = options2[kByteLength];
42310
+ } else {
42311
+ data = Buffer.from(data);
42312
+ dataLength = data.length;
42313
+ }
42314
+ } else {
42315
+ dataLength = data.length;
42316
+ merge = options2.mask && options2.readOnly && !skipMasking;
42317
+ }
42318
+ let payloadLength = dataLength;
42319
+ if (dataLength >= 65536) {
40982
42320
  offset += 8;
40983
42321
  payloadLength = 127;
40984
- } else if (data.length > 125) {
42322
+ } else if (dataLength > 125) {
40985
42323
  offset += 2;
40986
42324
  payloadLength = 126;
40987
42325
  }
40988
- const target = Buffer.allocUnsafe(merge ? data.length + offset : offset);
42326
+ const target = Buffer.allocUnsafe(merge ? dataLength + offset : offset);
40989
42327
  target[0] = options2.fin ? options2.opcode | 128 : options2.opcode;
40990
42328
  if (options2.rsv1) target[0] |= 64;
40991
42329
  target[1] = payloadLength;
40992
42330
  if (payloadLength === 126) {
40993
- target.writeUInt16BE(data.length, 2);
42331
+ target.writeUInt16BE(dataLength, 2);
40994
42332
  } else if (payloadLength === 127) {
40995
- target.writeUInt32BE(0, 2);
40996
- target.writeUInt32BE(data.length, 6);
42333
+ target[2] = target[3] = 0;
42334
+ target.writeUIntBE(dataLength, 4, 6);
40997
42335
  }
40998
42336
  if (!options2.mask) return [target, data];
40999
- randomFillSync(mask, 0, 4);
41000
42337
  target[1] |= 128;
41001
42338
  target[offset - 4] = mask[0];
41002
42339
  target[offset - 3] = mask[1];
41003
42340
  target[offset - 2] = mask[2];
41004
42341
  target[offset - 1] = mask[3];
42342
+ if (skipMasking) return [target, data];
41005
42343
  if (merge) {
41006
- applyMask(data, mask, target, offset, data.length);
42344
+ applyMask(data, mask, target, offset, dataLength);
41007
42345
  return [target];
41008
42346
  }
41009
- applyMask(data, mask, data, 0, data.length);
42347
+ applyMask(data, mask, data, 0, dataLength);
41010
42348
  return [target, data];
41011
42349
  }
41012
42350
  /**
41013
42351
  * Sends a close message to the other peer.
41014
42352
  *
41015
42353
  * @param {Number} [code] The status code component of the body
41016
- * @param {String} [data] The message component of the body
42354
+ * @param {(String|Buffer)} [data] The message component of the body
41017
42355
  * @param {Boolean} [mask=false] Specifies whether or not to mask the message
41018
42356
  * @param {Function} [cb] Callback
41019
42357
  * @public
41020
42358
  */
41021
- close(code, data, mask2, cb) {
42359
+ close(code, data, mask, cb) {
41022
42360
  let buf;
41023
42361
  if (code === void 0) {
41024
42362
  buf = EMPTY_BUFFER;
41025
42363
  } else if (typeof code !== "number" || !isValidStatusCode(code)) {
41026
42364
  throw new TypeError("First argument must be a valid error code number");
41027
- } else if (data === void 0 || data === "") {
42365
+ } else if (data === void 0 || !data.length) {
41028
42366
  buf = Buffer.allocUnsafe(2);
41029
42367
  buf.writeUInt16BE(code, 0);
41030
42368
  } else {
@@ -41034,34 +42372,28 @@ var require_sender = __commonJS({
41034
42372
  }
41035
42373
  buf = Buffer.allocUnsafe(2 + length);
41036
42374
  buf.writeUInt16BE(code, 0);
41037
- buf.write(data, 2);
42375
+ if (typeof data === "string") {
42376
+ buf.write(data, 2);
42377
+ } else {
42378
+ buf.set(data, 2);
42379
+ }
41038
42380
  }
41039
- if (this._deflating) {
41040
- this.enqueue([this.doClose, buf, mask2, cb]);
42381
+ const options2 = {
42382
+ [kByteLength]: buf.length,
42383
+ fin: true,
42384
+ generateMask: this._generateMask,
42385
+ mask,
42386
+ maskBuffer: this._maskBuffer,
42387
+ opcode: 8,
42388
+ readOnly: false,
42389
+ rsv1: false
42390
+ };
42391
+ if (this._state !== DEFAULT) {
42392
+ this.enqueue([this.dispatch, buf, false, options2, cb]);
41041
42393
  } else {
41042
- this.doClose(buf, mask2, cb);
42394
+ this.sendFrame(_Sender.frame(buf, options2), cb);
41043
42395
  }
41044
42396
  }
41045
- /**
41046
- * Frames and sends a close message.
41047
- *
41048
- * @param {Buffer} data The message to send
41049
- * @param {Boolean} [mask=false] Specifies whether or not to mask `data`
41050
- * @param {Function} [cb] Callback
41051
- * @private
41052
- */
41053
- doClose(data, mask2, cb) {
41054
- this.sendFrame(
41055
- _Sender.frame(data, {
41056
- fin: true,
41057
- rsv1: false,
41058
- opcode: 8,
41059
- mask: mask2,
41060
- readOnly: false
41061
- }),
41062
- cb
41063
- );
41064
- }
41065
42397
  /**
41066
42398
  * Sends a ping message to the other peer.
41067
42399
  *
@@ -41070,38 +42402,45 @@ var require_sender = __commonJS({
41070
42402
  * @param {Function} [cb] Callback
41071
42403
  * @public
41072
42404
  */
41073
- ping(data, mask2, cb) {
41074
- const buf = toBuffer(data);
41075
- if (buf.length > 125) {
42405
+ ping(data, mask, cb) {
42406
+ let byteLength;
42407
+ let readOnly;
42408
+ if (typeof data === "string") {
42409
+ byteLength = Buffer.byteLength(data);
42410
+ readOnly = false;
42411
+ } else if (isBlob(data)) {
42412
+ byteLength = data.size;
42413
+ readOnly = false;
42414
+ } else {
42415
+ data = toBuffer(data);
42416
+ byteLength = data.length;
42417
+ readOnly = toBuffer.readOnly;
42418
+ }
42419
+ if (byteLength > 125) {
41076
42420
  throw new RangeError("The data size must not be greater than 125 bytes");
41077
42421
  }
41078
- if (this._deflating) {
41079
- this.enqueue([this.doPing, buf, mask2, toBuffer.readOnly, cb]);
42422
+ const options2 = {
42423
+ [kByteLength]: byteLength,
42424
+ fin: true,
42425
+ generateMask: this._generateMask,
42426
+ mask,
42427
+ maskBuffer: this._maskBuffer,
42428
+ opcode: 9,
42429
+ readOnly,
42430
+ rsv1: false
42431
+ };
42432
+ if (isBlob(data)) {
42433
+ if (this._state !== DEFAULT) {
42434
+ this.enqueue([this.getBlobData, data, false, options2, cb]);
42435
+ } else {
42436
+ this.getBlobData(data, false, options2, cb);
42437
+ }
42438
+ } else if (this._state !== DEFAULT) {
42439
+ this.enqueue([this.dispatch, data, false, options2, cb]);
41080
42440
  } else {
41081
- this.doPing(buf, mask2, toBuffer.readOnly, cb);
42441
+ this.sendFrame(_Sender.frame(data, options2), cb);
41082
42442
  }
41083
42443
  }
41084
- /**
41085
- * Frames and sends a ping message.
41086
- *
41087
- * @param {Buffer} data The message to send
41088
- * @param {Boolean} [mask=false] Specifies whether or not to mask `data`
41089
- * @param {Boolean} [readOnly=false] Specifies whether `data` can be modified
41090
- * @param {Function} [cb] Callback
41091
- * @private
41092
- */
41093
- doPing(data, mask2, readOnly, cb) {
41094
- this.sendFrame(
41095
- _Sender.frame(data, {
41096
- fin: true,
41097
- rsv1: false,
41098
- opcode: 9,
41099
- mask: mask2,
41100
- readOnly
41101
- }),
41102
- cb
41103
- );
41104
- }
41105
42444
  /**
41106
42445
  * Sends a pong message to the other peer.
41107
42446
  *
@@ -41110,47 +42449,54 @@ var require_sender = __commonJS({
41110
42449
  * @param {Function} [cb] Callback
41111
42450
  * @public
41112
42451
  */
41113
- pong(data, mask2, cb) {
41114
- const buf = toBuffer(data);
41115
- if (buf.length > 125) {
42452
+ pong(data, mask, cb) {
42453
+ let byteLength;
42454
+ let readOnly;
42455
+ if (typeof data === "string") {
42456
+ byteLength = Buffer.byteLength(data);
42457
+ readOnly = false;
42458
+ } else if (isBlob(data)) {
42459
+ byteLength = data.size;
42460
+ readOnly = false;
42461
+ } else {
42462
+ data = toBuffer(data);
42463
+ byteLength = data.length;
42464
+ readOnly = toBuffer.readOnly;
42465
+ }
42466
+ if (byteLength > 125) {
41116
42467
  throw new RangeError("The data size must not be greater than 125 bytes");
41117
42468
  }
41118
- if (this._deflating) {
41119
- this.enqueue([this.doPong, buf, mask2, toBuffer.readOnly, cb]);
42469
+ const options2 = {
42470
+ [kByteLength]: byteLength,
42471
+ fin: true,
42472
+ generateMask: this._generateMask,
42473
+ mask,
42474
+ maskBuffer: this._maskBuffer,
42475
+ opcode: 10,
42476
+ readOnly,
42477
+ rsv1: false
42478
+ };
42479
+ if (isBlob(data)) {
42480
+ if (this._state !== DEFAULT) {
42481
+ this.enqueue([this.getBlobData, data, false, options2, cb]);
42482
+ } else {
42483
+ this.getBlobData(data, false, options2, cb);
42484
+ }
42485
+ } else if (this._state !== DEFAULT) {
42486
+ this.enqueue([this.dispatch, data, false, options2, cb]);
41120
42487
  } else {
41121
- this.doPong(buf, mask2, toBuffer.readOnly, cb);
42488
+ this.sendFrame(_Sender.frame(data, options2), cb);
41122
42489
  }
41123
42490
  }
41124
- /**
41125
- * Frames and sends a pong message.
41126
- *
41127
- * @param {Buffer} data The message to send
41128
- * @param {Boolean} [mask=false] Specifies whether or not to mask `data`
41129
- * @param {Boolean} [readOnly=false] Specifies whether `data` can be modified
41130
- * @param {Function} [cb] Callback
41131
- * @private
41132
- */
41133
- doPong(data, mask2, readOnly, cb) {
41134
- this.sendFrame(
41135
- _Sender.frame(data, {
41136
- fin: true,
41137
- rsv1: false,
41138
- opcode: 10,
41139
- mask: mask2,
41140
- readOnly
41141
- }),
41142
- cb
41143
- );
41144
- }
41145
42491
  /**
41146
42492
  * Sends a data message to the other peer.
41147
42493
  *
41148
42494
  * @param {*} data The message to send
41149
42495
  * @param {Object} options Options object
41150
- * @param {Boolean} [options.compress=false] Specifies whether or not to
41151
- * compress `data`
41152
42496
  * @param {Boolean} [options.binary=false] Specifies whether `data` is binary
41153
42497
  * or text
42498
+ * @param {Boolean} [options.compress=false] Specifies whether or not to
42499
+ * compress `data`
41154
42500
  * @param {Boolean} [options.fin=false] Specifies whether the fragment is the
41155
42501
  * last one
41156
42502
  * @param {Boolean} [options.mask=false] Specifies whether or not to mask
@@ -41159,14 +42505,26 @@ var require_sender = __commonJS({
41159
42505
  * @public
41160
42506
  */
41161
42507
  send(data, options2, cb) {
41162
- const buf = toBuffer(data);
41163
42508
  const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName];
41164
42509
  let opcode = options2.binary ? 2 : 1;
41165
42510
  let rsv1 = options2.compress;
42511
+ let byteLength;
42512
+ let readOnly;
42513
+ if (typeof data === "string") {
42514
+ byteLength = Buffer.byteLength(data);
42515
+ readOnly = false;
42516
+ } else if (isBlob(data)) {
42517
+ byteLength = data.size;
42518
+ readOnly = false;
42519
+ } else {
42520
+ data = toBuffer(data);
42521
+ byteLength = data.length;
42522
+ readOnly = toBuffer.readOnly;
42523
+ }
41166
42524
  if (this._firstFragment) {
41167
42525
  this._firstFragment = false;
41168
- if (rsv1 && perMessageDeflate) {
41169
- rsv1 = buf.length >= perMessageDeflate._threshold;
42526
+ if (rsv1 && perMessageDeflate && perMessageDeflate.params[perMessageDeflate._isServer ? "server_no_context_takeover" : "client_no_context_takeover"]) {
42527
+ rsv1 = byteLength >= perMessageDeflate._threshold;
41170
42528
  }
41171
42529
  this._compress = rsv1;
41172
42530
  } else {
@@ -41174,46 +42532,93 @@ var require_sender = __commonJS({
41174
42532
  opcode = 0;
41175
42533
  }
41176
42534
  if (options2.fin) this._firstFragment = true;
41177
- if (perMessageDeflate) {
41178
- const opts = {
41179
- fin: options2.fin,
41180
- rsv1,
41181
- opcode,
41182
- mask: options2.mask,
41183
- readOnly: toBuffer.readOnly
41184
- };
41185
- if (this._deflating) {
41186
- this.enqueue([this.dispatch, buf, this._compress, opts, cb]);
42535
+ const opts = {
42536
+ [kByteLength]: byteLength,
42537
+ fin: options2.fin,
42538
+ generateMask: this._generateMask,
42539
+ mask: options2.mask,
42540
+ maskBuffer: this._maskBuffer,
42541
+ opcode,
42542
+ readOnly,
42543
+ rsv1
42544
+ };
42545
+ if (isBlob(data)) {
42546
+ if (this._state !== DEFAULT) {
42547
+ this.enqueue([this.getBlobData, data, this._compress, opts, cb]);
41187
42548
  } else {
41188
- this.dispatch(buf, this._compress, opts, cb);
42549
+ this.getBlobData(data, this._compress, opts, cb);
41189
42550
  }
42551
+ } else if (this._state !== DEFAULT) {
42552
+ this.enqueue([this.dispatch, data, this._compress, opts, cb]);
41190
42553
  } else {
41191
- this.sendFrame(
41192
- _Sender.frame(buf, {
41193
- fin: options2.fin,
41194
- rsv1: false,
41195
- opcode,
41196
- mask: options2.mask,
41197
- readOnly: toBuffer.readOnly
41198
- }),
41199
- cb
41200
- );
42554
+ this.dispatch(data, this._compress, opts, cb);
41201
42555
  }
41202
42556
  }
41203
42557
  /**
41204
- * Dispatches a data message.
42558
+ * Gets the contents of a blob as binary data.
41205
42559
  *
41206
- * @param {Buffer} data The message to send
42560
+ * @param {Blob} blob The blob
41207
42561
  * @param {Boolean} [compress=false] Specifies whether or not to compress
41208
- * `data`
42562
+ * the data
41209
42563
  * @param {Object} options Options object
42564
+ * @param {Boolean} [options.fin=false] Specifies whether or not to set the
42565
+ * FIN bit
42566
+ * @param {Function} [options.generateMask] The function used to generate the
42567
+ * masking key
42568
+ * @param {Boolean} [options.mask=false] Specifies whether or not to mask
42569
+ * `data`
42570
+ * @param {Buffer} [options.maskBuffer] The buffer used to store the masking
42571
+ * key
41210
42572
  * @param {Number} options.opcode The opcode
41211
42573
  * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be
41212
42574
  * modified
42575
+ * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the
42576
+ * RSV1 bit
42577
+ * @param {Function} [cb] Callback
42578
+ * @private
42579
+ */
42580
+ getBlobData(blob, compress, options2, cb) {
42581
+ this._bufferedBytes += options2[kByteLength];
42582
+ this._state = GET_BLOB_DATA;
42583
+ blob.arrayBuffer().then((arrayBuffer) => {
42584
+ if (this._socket.destroyed) {
42585
+ const err = new Error(
42586
+ "The socket was closed while the blob was being read"
42587
+ );
42588
+ process.nextTick(callCallbacks, this, err, cb);
42589
+ return;
42590
+ }
42591
+ this._bufferedBytes -= options2[kByteLength];
42592
+ const data = toBuffer(arrayBuffer);
42593
+ if (!compress) {
42594
+ this._state = DEFAULT;
42595
+ this.sendFrame(_Sender.frame(data, options2), cb);
42596
+ this.dequeue();
42597
+ } else {
42598
+ this.dispatch(data, compress, options2, cb);
42599
+ }
42600
+ }).catch((err) => {
42601
+ process.nextTick(onError, this, err, cb);
42602
+ });
42603
+ }
42604
+ /**
42605
+ * Dispatches a message.
42606
+ *
42607
+ * @param {(Buffer|String)} data The message to send
42608
+ * @param {Boolean} [compress=false] Specifies whether or not to compress
42609
+ * `data`
42610
+ * @param {Object} options Options object
41213
42611
  * @param {Boolean} [options.fin=false] Specifies whether or not to set the
41214
42612
  * FIN bit
42613
+ * @param {Function} [options.generateMask] The function used to generate the
42614
+ * masking key
41215
42615
  * @param {Boolean} [options.mask=false] Specifies whether or not to mask
41216
42616
  * `data`
42617
+ * @param {Buffer} [options.maskBuffer] The buffer used to store the masking
42618
+ * key
42619
+ * @param {Number} options.opcode The opcode
42620
+ * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be
42621
+ * modified
41217
42622
  * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the
41218
42623
  * RSV1 bit
41219
42624
  * @param {Function} [cb] Callback
@@ -41225,22 +42630,18 @@ var require_sender = __commonJS({
41225
42630
  return;
41226
42631
  }
41227
42632
  const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName];
41228
- this._bufferedBytes += data.length;
41229
- this._deflating = true;
42633
+ this._bufferedBytes += options2[kByteLength];
42634
+ this._state = DEFLATING;
41230
42635
  perMessageDeflate.compress(data, options2.fin, (_, buf) => {
41231
42636
  if (this._socket.destroyed) {
41232
42637
  const err = new Error(
41233
42638
  "The socket was closed while data was being compressed"
41234
42639
  );
41235
- if (typeof cb === "function") cb(err);
41236
- for (let i = 0; i < this._queue.length; i++) {
41237
- const callback = this._queue[i][4];
41238
- if (typeof callback === "function") callback(err);
41239
- }
42640
+ callCallbacks(this, err, cb);
41240
42641
  return;
41241
42642
  }
41242
- this._bufferedBytes -= data.length;
41243
- this._deflating = false;
42643
+ this._bufferedBytes -= options2[kByteLength];
42644
+ this._state = DEFAULT;
41244
42645
  options2.readOnly = false;
41245
42646
  this.sendFrame(_Sender.frame(buf, options2), cb);
41246
42647
  this.dequeue();
@@ -41252,9 +42653,9 @@ var require_sender = __commonJS({
41252
42653
  * @private
41253
42654
  */
41254
42655
  dequeue() {
41255
- while (!this._deflating && this._queue.length) {
42656
+ while (this._state === DEFAULT && this._queue.length) {
41256
42657
  const params = this._queue.shift();
41257
- this._bufferedBytes -= params[1].length;
42658
+ this._bufferedBytes -= params[3][kByteLength];
41258
42659
  Reflect.apply(params[0], this, params.slice(1));
41259
42660
  }
41260
42661
  }
@@ -41265,13 +42666,13 @@ var require_sender = __commonJS({
41265
42666
  * @private
41266
42667
  */
41267
42668
  enqueue(params) {
41268
- this._bufferedBytes += params[1].length;
42669
+ this._bufferedBytes += params[3][kByteLength];
41269
42670
  this._queue.push(params);
41270
42671
  }
41271
42672
  /**
41272
42673
  * Sends a frame.
41273
42674
  *
41274
- * @param {Buffer[]} list The frame to send
42675
+ * @param {(Buffer | String)[]} list The frame to send
41275
42676
  * @param {Function} [cb] Callback
41276
42677
  * @private
41277
42678
  */
@@ -41287,6 +42688,18 @@ var require_sender = __commonJS({
41287
42688
  }
41288
42689
  };
41289
42690
  module2.exports = Sender;
42691
+ function callCallbacks(sender, err, cb) {
42692
+ if (typeof cb === "function") cb(err);
42693
+ for (let i = 0; i < sender._queue.length; i++) {
42694
+ const params = sender._queue[i];
42695
+ const callback = params[params.length - 1];
42696
+ if (typeof callback === "function") callback(err);
42697
+ }
42698
+ }
42699
+ function onError(sender, err, cb) {
42700
+ callCallbacks(sender, err, cb);
42701
+ sender.onerror(err);
42702
+ }
41290
42703
  }
41291
42704
  });
41292
42705
 
@@ -41294,136 +42707,228 @@ var require_sender = __commonJS({
41294
42707
  var require_event_target = __commonJS({
41295
42708
  "../../node_modules/ws/lib/event-target.js"(exports2, module2) {
41296
42709
  "use strict";
42710
+ var { kForOnEventAttribute, kListener } = require_constants();
42711
+ var kCode = Symbol("kCode");
42712
+ var kData = Symbol("kData");
42713
+ var kError = Symbol("kError");
42714
+ var kMessage = Symbol("kMessage");
42715
+ var kReason = Symbol("kReason");
42716
+ var kTarget = Symbol("kTarget");
42717
+ var kType = Symbol("kType");
42718
+ var kWasClean = Symbol("kWasClean");
41297
42719
  var Event = class {
41298
42720
  /**
41299
42721
  * Create a new `Event`.
41300
42722
  *
41301
42723
  * @param {String} type The name of the event
41302
- * @param {Object} target A reference to the target to which the event was
41303
- * dispatched
42724
+ * @throws {TypeError} If the `type` argument is not specified
41304
42725
  */
41305
- constructor(type, target) {
41306
- this.target = target;
41307
- this.type = type;
42726
+ constructor(type) {
42727
+ this[kTarget] = null;
42728
+ this[kType] = type;
41308
42729
  }
41309
- };
41310
- var MessageEvent = class extends Event {
41311
42730
  /**
41312
- * Create a new `MessageEvent`.
41313
- *
41314
- * @param {(String|Buffer|ArrayBuffer|Buffer[])} data The received data
41315
- * @param {WebSocket} target A reference to the target to which the event was
41316
- * dispatched
42731
+ * @type {*}
41317
42732
  */
41318
- constructor(data, target) {
41319
- super("message", target);
41320
- this.data = data;
42733
+ get target() {
42734
+ return this[kTarget];
42735
+ }
42736
+ /**
42737
+ * @type {String}
42738
+ */
42739
+ get type() {
42740
+ return this[kType];
41321
42741
  }
41322
42742
  };
42743
+ Object.defineProperty(Event.prototype, "target", { enumerable: true });
42744
+ Object.defineProperty(Event.prototype, "type", { enumerable: true });
41323
42745
  var CloseEvent = class extends Event {
41324
42746
  /**
41325
42747
  * Create a new `CloseEvent`.
41326
42748
  *
41327
- * @param {Number} code The status code explaining why the connection is being
41328
- * closed
41329
- * @param {String} reason A human-readable string explaining why the
41330
- * connection is closing
41331
- * @param {WebSocket} target A reference to the target to which the event was
41332
- * dispatched
42749
+ * @param {String} type The name of the event
42750
+ * @param {Object} [options] A dictionary object that allows for setting
42751
+ * attributes via object members of the same name
42752
+ * @param {Number} [options.code=0] The status code explaining why the
42753
+ * connection was closed
42754
+ * @param {String} [options.reason=''] A human-readable string explaining why
42755
+ * the connection was closed
42756
+ * @param {Boolean} [options.wasClean=false] Indicates whether or not the
42757
+ * connection was cleanly closed
41333
42758
  */
41334
- constructor(code, reason, target) {
41335
- super("close", target);
41336
- this.wasClean = target._closeFrameReceived && target._closeFrameSent;
41337
- this.reason = reason;
41338
- this.code = code;
42759
+ constructor(type, options2 = {}) {
42760
+ super(type);
42761
+ this[kCode] = options2.code === void 0 ? 0 : options2.code;
42762
+ this[kReason] = options2.reason === void 0 ? "" : options2.reason;
42763
+ this[kWasClean] = options2.wasClean === void 0 ? false : options2.wasClean;
41339
42764
  }
41340
- };
41341
- var OpenEvent = class extends Event {
41342
42765
  /**
41343
- * Create a new `OpenEvent`.
41344
- *
41345
- * @param {WebSocket} target A reference to the target to which the event was
41346
- * dispatched
42766
+ * @type {Number}
42767
+ */
42768
+ get code() {
42769
+ return this[kCode];
42770
+ }
42771
+ /**
42772
+ * @type {String}
42773
+ */
42774
+ get reason() {
42775
+ return this[kReason];
42776
+ }
42777
+ /**
42778
+ * @type {Boolean}
41347
42779
  */
41348
- constructor(target) {
41349
- super("open", target);
42780
+ get wasClean() {
42781
+ return this[kWasClean];
41350
42782
  }
41351
42783
  };
42784
+ Object.defineProperty(CloseEvent.prototype, "code", { enumerable: true });
42785
+ Object.defineProperty(CloseEvent.prototype, "reason", { enumerable: true });
42786
+ Object.defineProperty(CloseEvent.prototype, "wasClean", { enumerable: true });
41352
42787
  var ErrorEvent = class extends Event {
41353
42788
  /**
41354
42789
  * Create a new `ErrorEvent`.
41355
42790
  *
41356
- * @param {Object} error The error that generated this event
41357
- * @param {WebSocket} target A reference to the target to which the event was
41358
- * dispatched
42791
+ * @param {String} type The name of the event
42792
+ * @param {Object} [options] A dictionary object that allows for setting
42793
+ * attributes via object members of the same name
42794
+ * @param {*} [options.error=null] The error that generated this event
42795
+ * @param {String} [options.message=''] The error message
42796
+ */
42797
+ constructor(type, options2 = {}) {
42798
+ super(type);
42799
+ this[kError] = options2.error === void 0 ? null : options2.error;
42800
+ this[kMessage] = options2.message === void 0 ? "" : options2.message;
42801
+ }
42802
+ /**
42803
+ * @type {*}
42804
+ */
42805
+ get error() {
42806
+ return this[kError];
42807
+ }
42808
+ /**
42809
+ * @type {String}
42810
+ */
42811
+ get message() {
42812
+ return this[kMessage];
42813
+ }
42814
+ };
42815
+ Object.defineProperty(ErrorEvent.prototype, "error", { enumerable: true });
42816
+ Object.defineProperty(ErrorEvent.prototype, "message", { enumerable: true });
42817
+ var MessageEvent = class extends Event {
42818
+ /**
42819
+ * Create a new `MessageEvent`.
42820
+ *
42821
+ * @param {String} type The name of the event
42822
+ * @param {Object} [options] A dictionary object that allows for setting
42823
+ * attributes via object members of the same name
42824
+ * @param {*} [options.data=null] The message content
41359
42825
  */
41360
- constructor(error, target) {
41361
- super("error", target);
41362
- this.message = error.message;
41363
- this.error = error;
42826
+ constructor(type, options2 = {}) {
42827
+ super(type);
42828
+ this[kData] = options2.data === void 0 ? null : options2.data;
42829
+ }
42830
+ /**
42831
+ * @type {*}
42832
+ */
42833
+ get data() {
42834
+ return this[kData];
41364
42835
  }
41365
42836
  };
42837
+ Object.defineProperty(MessageEvent.prototype, "data", { enumerable: true });
41366
42838
  var EventTarget = {
41367
42839
  /**
41368
42840
  * Register an event listener.
41369
42841
  *
41370
42842
  * @param {String} type A string representing the event type to listen for
41371
- * @param {Function} listener The listener to add
42843
+ * @param {(Function|Object)} handler The listener to add
41372
42844
  * @param {Object} [options] An options object specifies characteristics about
41373
42845
  * the event listener
41374
- * @param {Boolean} [options.once=false] A `Boolean`` indicating that the
42846
+ * @param {Boolean} [options.once=false] A `Boolean` indicating that the
41375
42847
  * listener should be invoked at most once after being added. If `true`,
41376
42848
  * the listener would be automatically removed when invoked.
41377
42849
  * @public
41378
42850
  */
41379
- addEventListener(type, listener, options2) {
41380
- if (typeof listener !== "function") return;
41381
- function onMessage(data) {
41382
- listener.call(this, new MessageEvent(data, this));
41383
- }
41384
- function onClose(code, message) {
41385
- listener.call(this, new CloseEvent(code, message, this));
41386
- }
41387
- function onError(error) {
41388
- listener.call(this, new ErrorEvent(error, this));
41389
- }
41390
- function onOpen() {
41391
- listener.call(this, new OpenEvent(this));
42851
+ addEventListener(type, handler, options2 = {}) {
42852
+ for (const listener of this.listeners(type)) {
42853
+ if (!options2[kForOnEventAttribute] && listener[kListener] === handler && !listener[kForOnEventAttribute]) {
42854
+ return;
42855
+ }
41392
42856
  }
41393
- const method = options2 && options2.once ? "once" : "on";
42857
+ let wrapper;
41394
42858
  if (type === "message") {
41395
- onMessage._listener = listener;
41396
- this[method](type, onMessage);
42859
+ wrapper = function onMessage(data, isBinary) {
42860
+ const event = new MessageEvent("message", {
42861
+ data: isBinary ? data : data.toString()
42862
+ });
42863
+ event[kTarget] = this;
42864
+ callListener(handler, this, event);
42865
+ };
41397
42866
  } else if (type === "close") {
41398
- onClose._listener = listener;
41399
- this[method](type, onClose);
42867
+ wrapper = function onClose(code, message) {
42868
+ const event = new CloseEvent("close", {
42869
+ code,
42870
+ reason: message.toString(),
42871
+ wasClean: this._closeFrameReceived && this._closeFrameSent
42872
+ });
42873
+ event[kTarget] = this;
42874
+ callListener(handler, this, event);
42875
+ };
41400
42876
  } else if (type === "error") {
41401
- onError._listener = listener;
41402
- this[method](type, onError);
42877
+ wrapper = function onError(error) {
42878
+ const event = new ErrorEvent("error", {
42879
+ error,
42880
+ message: error.message
42881
+ });
42882
+ event[kTarget] = this;
42883
+ callListener(handler, this, event);
42884
+ };
41403
42885
  } else if (type === "open") {
41404
- onOpen._listener = listener;
41405
- this[method](type, onOpen);
42886
+ wrapper = function onOpen() {
42887
+ const event = new Event("open");
42888
+ event[kTarget] = this;
42889
+ callListener(handler, this, event);
42890
+ };
41406
42891
  } else {
41407
- this[method](type, listener);
42892
+ return;
42893
+ }
42894
+ wrapper[kForOnEventAttribute] = !!options2[kForOnEventAttribute];
42895
+ wrapper[kListener] = handler;
42896
+ if (options2.once) {
42897
+ this.once(type, wrapper);
42898
+ } else {
42899
+ this.on(type, wrapper);
41408
42900
  }
41409
42901
  },
41410
42902
  /**
41411
42903
  * Remove an event listener.
41412
42904
  *
41413
42905
  * @param {String} type A string representing the event type to remove
41414
- * @param {Function} listener The listener to remove
42906
+ * @param {(Function|Object)} handler The listener to remove
41415
42907
  * @public
41416
42908
  */
41417
- removeEventListener(type, listener) {
41418
- const listeners = this.listeners(type);
41419
- for (let i = 0; i < listeners.length; i++) {
41420
- if (listeners[i] === listener || listeners[i]._listener === listener) {
41421
- this.removeListener(type, listeners[i]);
42909
+ removeEventListener(type, handler) {
42910
+ for (const listener of this.listeners(type)) {
42911
+ if (listener[kListener] === handler && !listener[kForOnEventAttribute]) {
42912
+ this.removeListener(type, listener);
42913
+ break;
41422
42914
  }
41423
42915
  }
41424
42916
  }
41425
42917
  };
41426
- module2.exports = EventTarget;
42918
+ module2.exports = {
42919
+ CloseEvent,
42920
+ ErrorEvent,
42921
+ Event,
42922
+ EventTarget,
42923
+ MessageEvent
42924
+ };
42925
+ function callListener(listener, thisArg, event) {
42926
+ if (typeof listener === "object" && listener.handleEvent) {
42927
+ listener.handleEvent.call(listener, event);
42928
+ } else {
42929
+ listener.call(thisArg, event);
42930
+ }
42931
+ }
41427
42932
  }
41428
42933
  });
41429
42934
 
@@ -41431,151 +42936,13 @@ var require_event_target = __commonJS({
41431
42936
  var require_extension = __commonJS({
41432
42937
  "../../node_modules/ws/lib/extension.js"(exports2, module2) {
41433
42938
  "use strict";
41434
- var tokenChars = [
41435
- 0,
41436
- 0,
41437
- 0,
41438
- 0,
41439
- 0,
41440
- 0,
41441
- 0,
41442
- 0,
41443
- 0,
41444
- 0,
41445
- 0,
41446
- 0,
41447
- 0,
41448
- 0,
41449
- 0,
41450
- 0,
41451
- // 0 - 15
41452
- 0,
41453
- 0,
41454
- 0,
41455
- 0,
41456
- 0,
41457
- 0,
41458
- 0,
41459
- 0,
41460
- 0,
41461
- 0,
41462
- 0,
41463
- 0,
41464
- 0,
41465
- 0,
41466
- 0,
41467
- 0,
41468
- // 16 - 31
41469
- 0,
41470
- 1,
41471
- 0,
41472
- 1,
41473
- 1,
41474
- 1,
41475
- 1,
41476
- 1,
41477
- 0,
41478
- 0,
41479
- 1,
41480
- 1,
41481
- 0,
41482
- 1,
41483
- 1,
41484
- 0,
41485
- // 32 - 47
41486
- 1,
41487
- 1,
41488
- 1,
41489
- 1,
41490
- 1,
41491
- 1,
41492
- 1,
41493
- 1,
41494
- 1,
41495
- 1,
41496
- 0,
41497
- 0,
41498
- 0,
41499
- 0,
41500
- 0,
41501
- 0,
41502
- // 48 - 63
41503
- 0,
41504
- 1,
41505
- 1,
41506
- 1,
41507
- 1,
41508
- 1,
41509
- 1,
41510
- 1,
41511
- 1,
41512
- 1,
41513
- 1,
41514
- 1,
41515
- 1,
41516
- 1,
41517
- 1,
41518
- 1,
41519
- // 64 - 79
41520
- 1,
41521
- 1,
41522
- 1,
41523
- 1,
41524
- 1,
41525
- 1,
41526
- 1,
41527
- 1,
41528
- 1,
41529
- 1,
41530
- 1,
41531
- 0,
41532
- 0,
41533
- 0,
41534
- 1,
41535
- 1,
41536
- // 80 - 95
41537
- 1,
41538
- 1,
41539
- 1,
41540
- 1,
41541
- 1,
41542
- 1,
41543
- 1,
41544
- 1,
41545
- 1,
41546
- 1,
41547
- 1,
41548
- 1,
41549
- 1,
41550
- 1,
41551
- 1,
41552
- 1,
41553
- // 96 - 111
41554
- 1,
41555
- 1,
41556
- 1,
41557
- 1,
41558
- 1,
41559
- 1,
41560
- 1,
41561
- 1,
41562
- 1,
41563
- 1,
41564
- 1,
41565
- 0,
41566
- 1,
41567
- 0,
41568
- 1,
41569
- 0
41570
- // 112 - 127
41571
- ];
42939
+ var { tokenChars } = require_validation();
41572
42940
  function push(dest, name, elem) {
41573
42941
  if (dest[name] === void 0) dest[name] = [elem];
41574
42942
  else dest[name].push(elem);
41575
42943
  }
41576
42944
  function parse2(header) {
41577
42945
  const offers = /* @__PURE__ */ Object.create(null);
41578
- if (header === void 0 || header === "") return offers;
41579
42946
  let params = /* @__PURE__ */ Object.create(null);
41580
42947
  let mustUnescape = false;
41581
42948
  let isEscaping = false;
@@ -41583,14 +42950,15 @@ var require_extension = __commonJS({
41583
42950
  let extensionName;
41584
42951
  let paramName;
41585
42952
  let start = -1;
42953
+ let code = -1;
41586
42954
  let end = -1;
41587
42955
  let i = 0;
41588
42956
  for (; i < header.length; i++) {
41589
- const code = header.charCodeAt(i);
42957
+ code = header.charCodeAt(i);
41590
42958
  if (extensionName === void 0) {
41591
42959
  if (end === -1 && tokenChars[code] === 1) {
41592
42960
  if (start === -1) start = i;
41593
- } else if (code === 32 || code === 9) {
42961
+ } else if (i !== 0 && (code === 32 || code === 9)) {
41594
42962
  if (end === -1 && start !== -1) end = i;
41595
42963
  } else if (code === 59 || code === 44) {
41596
42964
  if (start === -1) {
@@ -41679,7 +43047,7 @@ var require_extension = __commonJS({
41679
43047
  }
41680
43048
  }
41681
43049
  }
41682
- if (start === -1 || inQuotes) {
43050
+ if (start === -1 || inQuotes || code === 32 || code === 9) {
41683
43051
  throw new SyntaxError("Unexpected end of input");
41684
43052
  }
41685
43053
  if (end === -1) end = i;
@@ -41727,25 +43095,32 @@ var require_websocket = __commonJS({
41727
43095
  var net = require("net");
41728
43096
  var tls = require("tls");
41729
43097
  var { randomBytes, createHash } = require("crypto");
41730
- var { Readable } = require("stream");
43098
+ var { Duplex, Readable } = require("stream");
41731
43099
  var { URL: URL2 } = require("url");
41732
43100
  var PerMessageDeflate = require_permessage_deflate();
41733
43101
  var Receiver = require_receiver();
41734
43102
  var Sender = require_sender();
43103
+ var { isBlob } = require_validation();
41735
43104
  var {
41736
43105
  BINARY_TYPES,
41737
43106
  EMPTY_BUFFER,
41738
43107
  GUID,
43108
+ kForOnEventAttribute,
43109
+ kListener,
41739
43110
  kStatusCode,
41740
43111
  kWebSocket,
41741
43112
  NOOP
41742
43113
  } = require_constants();
41743
- var { addEventListener, removeEventListener } = require_event_target();
43114
+ var {
43115
+ EventTarget: { addEventListener, removeEventListener }
43116
+ } = require_event_target();
41744
43117
  var { format: format2, parse: parse2 } = require_extension();
41745
43118
  var { toBuffer } = require_buffer_util();
41746
- var readyStates = ["CONNECTING", "OPEN", "CLOSING", "CLOSED"];
41747
- var protocolVersions = [8, 13];
41748
43119
  var closeTimeout = 30 * 1e3;
43120
+ var kAborted = Symbol("kAborted");
43121
+ var protocolVersions = [8, 13];
43122
+ var readyStates = ["CONNECTING", "OPEN", "CLOSING", "CLOSED"];
43123
+ var subprotocolRegex = /^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;
41749
43124
  var WebSocket = class _WebSocket extends EventEmitter2 {
41750
43125
  /**
41751
43126
  * Create a new `WebSocket`.
@@ -41760,9 +43135,11 @@ var require_websocket = __commonJS({
41760
43135
  this._closeCode = 1006;
41761
43136
  this._closeFrameReceived = false;
41762
43137
  this._closeFrameSent = false;
41763
- this._closeMessage = "";
43138
+ this._closeMessage = EMPTY_BUFFER;
41764
43139
  this._closeTimer = null;
43140
+ this._errorEmitted = false;
41765
43141
  this._extensions = {};
43142
+ this._paused = false;
41766
43143
  this._protocol = "";
41767
43144
  this._readyState = _WebSocket.CONNECTING;
41768
43145
  this._receiver = null;
@@ -41772,21 +43149,25 @@ var require_websocket = __commonJS({
41772
43149
  this._bufferedAmount = 0;
41773
43150
  this._isServer = false;
41774
43151
  this._redirects = 0;
41775
- if (Array.isArray(protocols)) {
41776
- protocols = protocols.join(", ");
41777
- } else if (typeof protocols === "object" && protocols !== null) {
41778
- options2 = protocols;
41779
- protocols = void 0;
43152
+ if (protocols === void 0) {
43153
+ protocols = [];
43154
+ } else if (!Array.isArray(protocols)) {
43155
+ if (typeof protocols === "object" && protocols !== null) {
43156
+ options2 = protocols;
43157
+ protocols = [];
43158
+ } else {
43159
+ protocols = [protocols];
43160
+ }
41780
43161
  }
41781
43162
  initAsClient(this, address, protocols, options2);
41782
43163
  } else {
43164
+ this._autoPong = options2.autoPong;
41783
43165
  this._isServer = true;
41784
43166
  }
41785
43167
  }
41786
43168
  /**
41787
- * This deviates from the WHATWG interface since ws doesn't support the
41788
- * required default "blob" type (instead we define a custom "nodebuffer"
41789
- * type).
43169
+ * For historical reasons, the custom "nodebuffer" type is used by the default
43170
+ * instead of "blob".
41790
43171
  *
41791
43172
  * @type {String}
41792
43173
  */
@@ -41811,45 +43192,39 @@ var require_websocket = __commonJS({
41811
43192
  get extensions() {
41812
43193
  return Object.keys(this._extensions).join();
41813
43194
  }
43195
+ /**
43196
+ * @type {Boolean}
43197
+ */
43198
+ get isPaused() {
43199
+ return this._paused;
43200
+ }
41814
43201
  /**
41815
43202
  * @type {Function}
41816
43203
  */
41817
43204
  /* istanbul ignore next */
41818
43205
  get onclose() {
41819
- return void 0;
41820
- }
41821
- /* istanbul ignore next */
41822
- set onclose(listener) {
43206
+ return null;
41823
43207
  }
41824
43208
  /**
41825
43209
  * @type {Function}
41826
43210
  */
41827
43211
  /* istanbul ignore next */
41828
43212
  get onerror() {
41829
- return void 0;
41830
- }
41831
- /* istanbul ignore next */
41832
- set onerror(listener) {
43213
+ return null;
41833
43214
  }
41834
43215
  /**
41835
43216
  * @type {Function}
41836
43217
  */
41837
43218
  /* istanbul ignore next */
41838
43219
  get onopen() {
41839
- return void 0;
41840
- }
41841
- /* istanbul ignore next */
41842
- set onopen(listener) {
43220
+ return null;
41843
43221
  }
41844
43222
  /**
41845
43223
  * @type {Function}
41846
43224
  */
41847
43225
  /* istanbul ignore next */
41848
43226
  get onmessage() {
41849
- return void 0;
41850
- }
41851
- /* istanbul ignore next */
41852
- set onmessage(listener) {
43227
+ return null;
41853
43228
  }
41854
43229
  /**
41855
43230
  * @type {String}
@@ -41872,23 +43247,34 @@ var require_websocket = __commonJS({
41872
43247
  /**
41873
43248
  * Set up the socket and the internal resources.
41874
43249
  *
41875
- * @param {(net.Socket|tls.Socket)} socket The network socket between the
41876
- * server and client
43250
+ * @param {Duplex} socket The network socket between the server and client
41877
43251
  * @param {Buffer} head The first packet of the upgraded stream
41878
- * @param {Number} [maxPayload=0] The maximum allowed message size
43252
+ * @param {Object} options Options object
43253
+ * @param {Boolean} [options.allowSynchronousEvents=false] Specifies whether
43254
+ * any of the `'message'`, `'ping'`, and `'pong'` events can be emitted
43255
+ * multiple times in the same tick
43256
+ * @param {Function} [options.generateMask] The function used to generate the
43257
+ * masking key
43258
+ * @param {Number} [options.maxPayload=0] The maximum allowed message size
43259
+ * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
43260
+ * not to skip UTF-8 validation for text and close messages
41879
43261
  * @private
41880
43262
  */
41881
- setSocket(socket, head, maxPayload) {
41882
- const receiver = new Receiver(
41883
- this.binaryType,
41884
- this._extensions,
41885
- this._isServer,
41886
- maxPayload
41887
- );
41888
- this._sender = new Sender(socket, this._extensions);
43263
+ setSocket(socket, head, options2) {
43264
+ const receiver = new Receiver({
43265
+ allowSynchronousEvents: options2.allowSynchronousEvents,
43266
+ binaryType: this.binaryType,
43267
+ extensions: this._extensions,
43268
+ isServer: this._isServer,
43269
+ maxPayload: options2.maxPayload,
43270
+ skipUTF8Validation: options2.skipUTF8Validation
43271
+ });
43272
+ const sender = new Sender(socket, this._extensions, options2.generateMask);
41889
43273
  this._receiver = receiver;
43274
+ this._sender = sender;
41890
43275
  this._socket = socket;
41891
43276
  receiver[kWebSocket] = this;
43277
+ sender[kWebSocket] = this;
41892
43278
  socket[kWebSocket] = this;
41893
43279
  receiver.on("conclude", receiverOnConclude);
41894
43280
  receiver.on("drain", receiverOnDrain);
@@ -41896,8 +43282,9 @@ var require_websocket = __commonJS({
41896
43282
  receiver.on("message", receiverOnMessage);
41897
43283
  receiver.on("ping", receiverOnPing);
41898
43284
  receiver.on("pong", receiverOnPong);
41899
- socket.setTimeout(0);
41900
- socket.setNoDelay();
43285
+ sender.onerror = senderOnError;
43286
+ if (socket.setTimeout) socket.setTimeout(0);
43287
+ if (socket.setNoDelay) socket.setNoDelay();
41901
43288
  if (head.length > 0) socket.unshift(head);
41902
43289
  socket.on("close", socketOnClose);
41903
43290
  socket.on("data", socketOnData);
@@ -41940,14 +43327,16 @@ var require_websocket = __commonJS({
41940
43327
  * +---+
41941
43328
  *
41942
43329
  * @param {Number} [code] Status code explaining why the connection is closing
41943
- * @param {String} [data] A string explaining why the connection is closing
43330
+ * @param {(String|Buffer)} [data] The reason why the connection is
43331
+ * closing
41944
43332
  * @public
41945
43333
  */
41946
43334
  close(code, data) {
41947
43335
  if (this.readyState === _WebSocket.CLOSED) return;
41948
43336
  if (this.readyState === _WebSocket.CONNECTING) {
41949
43337
  const msg = "WebSocket was closed before the connection was established";
41950
- return abortHandshake(this, this._req, msg);
43338
+ abortHandshake(this, this._req, msg);
43339
+ return;
41951
43340
  }
41952
43341
  if (this.readyState === _WebSocket.CLOSING) {
41953
43342
  if (this._closeFrameSent && (this._closeFrameReceived || this._receiver._writableState.errorEmitted)) {
@@ -41963,10 +43352,19 @@ var require_websocket = __commonJS({
41963
43352
  this._socket.end();
41964
43353
  }
41965
43354
  });
41966
- this._closeTimer = setTimeout(
41967
- this._socket.destroy.bind(this._socket),
41968
- closeTimeout
41969
- );
43355
+ setCloseTimer(this);
43356
+ }
43357
+ /**
43358
+ * Pause the socket.
43359
+ *
43360
+ * @public
43361
+ */
43362
+ pause() {
43363
+ if (this.readyState === _WebSocket.CONNECTING || this.readyState === _WebSocket.CLOSED) {
43364
+ return;
43365
+ }
43366
+ this._paused = true;
43367
+ this._socket.pause();
41970
43368
  }
41971
43369
  /**
41972
43370
  * Send a ping.
@@ -42022,15 +43420,27 @@ var require_websocket = __commonJS({
42022
43420
  if (mask === void 0) mask = !this._isServer;
42023
43421
  this._sender.pong(data || EMPTY_BUFFER, mask, cb);
42024
43422
  }
43423
+ /**
43424
+ * Resume the socket.
43425
+ *
43426
+ * @public
43427
+ */
43428
+ resume() {
43429
+ if (this.readyState === _WebSocket.CONNECTING || this.readyState === _WebSocket.CLOSED) {
43430
+ return;
43431
+ }
43432
+ this._paused = false;
43433
+ if (!this._receiver._writableState.needDrain) this._socket.resume();
43434
+ }
42025
43435
  /**
42026
43436
  * Send a data message.
42027
43437
  *
42028
43438
  * @param {*} data The message to send
42029
43439
  * @param {Object} [options] Options object
42030
- * @param {Boolean} [options.compress] Specifies whether or not to compress
42031
- * `data`
42032
43440
  * @param {Boolean} [options.binary] Specifies whether `data` is binary or
42033
43441
  * text
43442
+ * @param {Boolean} [options.compress] Specifies whether or not to compress
43443
+ * `data`
42034
43444
  * @param {Boolean} [options.fin=true] Specifies whether the fragment is the
42035
43445
  * last one
42036
43446
  * @param {Boolean} [options.mask] Specifies whether or not to mask `data`
@@ -42071,7 +43481,8 @@ var require_websocket = __commonJS({
42071
43481
  if (this.readyState === _WebSocket.CLOSED) return;
42072
43482
  if (this.readyState === _WebSocket.CONNECTING) {
42073
43483
  const msg = "WebSocket was closed before the connection was established";
42074
- return abortHandshake(this, this._req, msg);
43484
+ abortHandshake(this, this._req, msg);
43485
+ return;
42075
43486
  }
42076
43487
  if (this._socket) {
42077
43488
  this._readyState = _WebSocket.CLOSING;
@@ -42115,6 +43526,7 @@ var require_websocket = __commonJS({
42115
43526
  "binaryType",
42116
43527
  "bufferedAmount",
42117
43528
  "extensions",
43529
+ "isPaused",
42118
43530
  "protocol",
42119
43531
  "readyState",
42120
43532
  "url"
@@ -42125,18 +43537,22 @@ var require_websocket = __commonJS({
42125
43537
  Object.defineProperty(WebSocket.prototype, `on${method}`, {
42126
43538
  enumerable: true,
42127
43539
  get() {
42128
- const listeners = this.listeners(method);
42129
- for (let i = 0; i < listeners.length; i++) {
42130
- if (listeners[i]._listener) return listeners[i]._listener;
43540
+ for (const listener of this.listeners(method)) {
43541
+ if (listener[kForOnEventAttribute]) return listener[kListener];
42131
43542
  }
42132
- return void 0;
43543
+ return null;
42133
43544
  },
42134
- set(listener) {
42135
- const listeners = this.listeners(method);
42136
- for (let i = 0; i < listeners.length; i++) {
42137
- if (listeners[i]._listener) this.removeListener(method, listeners[i]);
43545
+ set(handler) {
43546
+ for (const listener of this.listeners(method)) {
43547
+ if (listener[kForOnEventAttribute]) {
43548
+ this.removeListener(method, listener);
43549
+ break;
43550
+ }
42138
43551
  }
42139
- this.addEventListener(method, listener);
43552
+ if (typeof handler !== "function") return;
43553
+ this.addEventListener(method, handler, {
43554
+ [kForOnEventAttribute]: true
43555
+ });
42140
43556
  }
42141
43557
  });
42142
43558
  });
@@ -42145,22 +43561,25 @@ var require_websocket = __commonJS({
42145
43561
  module2.exports = WebSocket;
42146
43562
  function initAsClient(websocket, address, protocols, options2) {
42147
43563
  const opts = {
43564
+ allowSynchronousEvents: true,
43565
+ autoPong: true,
42148
43566
  protocolVersion: protocolVersions[1],
42149
43567
  maxPayload: 100 * 1024 * 1024,
43568
+ skipUTF8Validation: false,
42150
43569
  perMessageDeflate: true,
42151
43570
  followRedirects: false,
42152
43571
  maxRedirects: 10,
42153
43572
  ...options2,
42154
- createConnection: void 0,
42155
43573
  socketPath: void 0,
42156
43574
  hostname: void 0,
42157
43575
  protocol: void 0,
42158
43576
  timeout: void 0,
42159
- method: void 0,
43577
+ method: "GET",
42160
43578
  host: void 0,
42161
43579
  path: void 0,
42162
43580
  port: void 0
42163
43581
  };
43582
+ websocket._autoPong = opts.autoPong;
42164
43583
  if (!protocolVersions.includes(opts.protocolVersion)) {
42165
43584
  throw new RangeError(
42166
43585
  `Unsupported protocol version: ${opts.protocolVersion} (supported versions: ${protocolVersions.join(", ")})`
@@ -42169,14 +43588,31 @@ var require_websocket = __commonJS({
42169
43588
  let parsedUrl;
42170
43589
  if (address instanceof URL2) {
42171
43590
  parsedUrl = address;
42172
- websocket._url = address.href;
42173
43591
  } else {
42174
- parsedUrl = new URL2(address);
42175
- websocket._url = address;
42176
- }
42177
- const isUnixSocket = parsedUrl.protocol === "ws+unix:";
42178
- if (!parsedUrl.host && (!isUnixSocket || !parsedUrl.pathname)) {
42179
- const err = new Error(`Invalid URL: ${websocket.url}`);
43592
+ try {
43593
+ parsedUrl = new URL2(address);
43594
+ } catch (e) {
43595
+ throw new SyntaxError(`Invalid URL: ${address}`);
43596
+ }
43597
+ }
43598
+ if (parsedUrl.protocol === "http:") {
43599
+ parsedUrl.protocol = "ws:";
43600
+ } else if (parsedUrl.protocol === "https:") {
43601
+ parsedUrl.protocol = "wss:";
43602
+ }
43603
+ websocket._url = parsedUrl.href;
43604
+ const isSecure = parsedUrl.protocol === "wss:";
43605
+ const isIpcUrl = parsedUrl.protocol === "ws+unix:";
43606
+ let invalidUrlMessage;
43607
+ if (parsedUrl.protocol !== "ws:" && !isSecure && !isIpcUrl) {
43608
+ invalidUrlMessage = `The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`;
43609
+ } else if (isIpcUrl && !parsedUrl.pathname) {
43610
+ invalidUrlMessage = "The URL's pathname is empty";
43611
+ } else if (parsedUrl.hash) {
43612
+ invalidUrlMessage = "The URL contains a fragment identifier";
43613
+ }
43614
+ if (invalidUrlMessage) {
43615
+ const err = new SyntaxError(invalidUrlMessage);
42180
43616
  if (websocket._redirects === 0) {
42181
43617
  throw err;
42182
43618
  } else {
@@ -42184,21 +43620,21 @@ var require_websocket = __commonJS({
42184
43620
  return;
42185
43621
  }
42186
43622
  }
42187
- const isSecure = parsedUrl.protocol === "wss:" || parsedUrl.protocol === "https:";
42188
43623
  const defaultPort = isSecure ? 443 : 80;
42189
43624
  const key = randomBytes(16).toString("base64");
42190
- const get2 = isSecure ? https.get : http.get;
43625
+ const request = isSecure ? https.request : http.request;
43626
+ const protocolSet = /* @__PURE__ */ new Set();
42191
43627
  let perMessageDeflate;
42192
- opts.createConnection = isSecure ? tlsConnect : netConnect;
43628
+ opts.createConnection = opts.createConnection || (isSecure ? tlsConnect : netConnect);
42193
43629
  opts.defaultPort = opts.defaultPort || defaultPort;
42194
43630
  opts.port = parsedUrl.port || defaultPort;
42195
43631
  opts.host = parsedUrl.hostname.startsWith("[") ? parsedUrl.hostname.slice(1, -1) : parsedUrl.hostname;
42196
43632
  opts.headers = {
43633
+ ...opts.headers,
42197
43634
  "Sec-WebSocket-Version": opts.protocolVersion,
42198
43635
  "Sec-WebSocket-Key": key,
42199
43636
  Connection: "Upgrade",
42200
- Upgrade: "websocket",
42201
- ...opts.headers
43637
+ Upgrade: "websocket"
42202
43638
  };
42203
43639
  opts.path = parsedUrl.pathname + parsedUrl.search;
42204
43640
  opts.timeout = opts.handshakeTimeout;
@@ -42212,8 +43648,16 @@ var require_websocket = __commonJS({
42212
43648
  [PerMessageDeflate.extensionName]: perMessageDeflate.offer()
42213
43649
  });
42214
43650
  }
42215
- if (protocols) {
42216
- opts.headers["Sec-WebSocket-Protocol"] = protocols;
43651
+ if (protocols.length) {
43652
+ for (const protocol of protocols) {
43653
+ if (typeof protocol !== "string" || !subprotocolRegex.test(protocol) || protocolSet.has(protocol)) {
43654
+ throw new SyntaxError(
43655
+ "An invalid or duplicated subprotocol was specified"
43656
+ );
43657
+ }
43658
+ protocolSet.add(protocol);
43659
+ }
43660
+ opts.headers["Sec-WebSocket-Protocol"] = protocols.join(",");
42217
43661
  }
42218
43662
  if (opts.origin) {
42219
43663
  if (opts.protocolVersion < 13) {
@@ -42225,16 +43669,17 @@ var require_websocket = __commonJS({
42225
43669
  if (parsedUrl.username || parsedUrl.password) {
42226
43670
  opts.auth = `${parsedUrl.username}:${parsedUrl.password}`;
42227
43671
  }
42228
- if (isUnixSocket) {
43672
+ if (isIpcUrl) {
42229
43673
  const parts = opts.path.split(":");
42230
43674
  opts.socketPath = parts[0];
42231
43675
  opts.path = parts[1];
42232
43676
  }
43677
+ let req;
42233
43678
  if (opts.followRedirects) {
42234
43679
  if (websocket._redirects === 0) {
42235
- websocket._originalUnixSocket = isUnixSocket;
43680
+ websocket._originalIpc = isIpcUrl;
42236
43681
  websocket._originalSecure = isSecure;
42237
- websocket._originalHostOrSocketPath = isUnixSocket ? opts.socketPath : parsedUrl.host;
43682
+ websocket._originalHostOrSocketPath = isIpcUrl ? opts.socketPath : parsedUrl.host;
42238
43683
  const headers = options2 && options2.headers;
42239
43684
  options2 = { ...options2, headers: {} };
42240
43685
  if (headers) {
@@ -42242,8 +43687,8 @@ var require_websocket = __commonJS({
42242
43687
  options2.headers[key2.toLowerCase()] = value;
42243
43688
  }
42244
43689
  }
42245
- } else {
42246
- const isSameHost = isUnixSocket ? websocket._originalUnixSocket ? opts.socketPath === websocket._originalHostOrSocketPath : false : websocket._originalUnixSocket ? false : parsedUrl.host === websocket._originalHostOrSocketPath;
43690
+ } else if (websocket.listenerCount("redirect") === 0) {
43691
+ const isSameHost = isIpcUrl ? websocket._originalIpc ? opts.socketPath === websocket._originalHostOrSocketPath : false : websocket._originalIpc ? false : parsedUrl.host === websocket._originalHostOrSocketPath;
42247
43692
  if (!isSameHost || websocket._originalSecure && !isSecure) {
42248
43693
  delete opts.headers.authorization;
42249
43694
  delete opts.headers.cookie;
@@ -42254,15 +43699,20 @@ var require_websocket = __commonJS({
42254
43699
  if (opts.auth && !options2.headers.authorization) {
42255
43700
  options2.headers.authorization = "Basic " + Buffer.from(opts.auth).toString("base64");
42256
43701
  }
43702
+ req = websocket._req = request(opts);
43703
+ if (websocket._redirects) {
43704
+ websocket.emit("redirect", websocket.url, req);
43705
+ }
43706
+ } else {
43707
+ req = websocket._req = request(opts);
42257
43708
  }
42258
- let req = websocket._req = get2(opts);
42259
43709
  if (opts.timeout) {
42260
43710
  req.on("timeout", () => {
42261
43711
  abortHandshake(websocket, req, "Opening handshake has timed out");
42262
43712
  });
42263
43713
  }
42264
43714
  req.on("error", (err) => {
42265
- if (req === null || req.aborted) return;
43715
+ if (req === null || req[kAborted]) return;
42266
43716
  req = websocket._req = null;
42267
43717
  emitErrorAndClose(websocket, err);
42268
43718
  });
@@ -42278,7 +43728,8 @@ var require_websocket = __commonJS({
42278
43728
  let addr;
42279
43729
  try {
42280
43730
  addr = new URL2(location, address);
42281
- } catch (err) {
43731
+ } catch (e) {
43732
+ const err = new SyntaxError(`Invalid URL: ${location}`);
42282
43733
  emitErrorAndClose(websocket, err);
42283
43734
  return;
42284
43735
  }
@@ -42306,14 +43757,15 @@ var require_websocket = __commonJS({
42306
43757
  return;
42307
43758
  }
42308
43759
  const serverProt = res.headers["sec-websocket-protocol"];
42309
- const protList = (protocols || "").split(/, */);
42310
43760
  let protError;
42311
- if (!protocols && serverProt) {
42312
- protError = "Server sent a subprotocol but none was requested";
42313
- } else if (protocols && !serverProt) {
43761
+ if (serverProt !== void 0) {
43762
+ if (!protocolSet.size) {
43763
+ protError = "Server sent a subprotocol but none was requested";
43764
+ } else if (!protocolSet.has(serverProt)) {
43765
+ protError = "Server sent an invalid subprotocol";
43766
+ }
43767
+ } else if (protocolSet.size) {
42314
43768
  protError = "Server sent no subprotocol";
42315
- } else if (serverProt && !protList.includes(serverProt)) {
42316
- protError = "Server sent an invalid subprotocol";
42317
43769
  }
42318
43770
  if (protError) {
42319
43771
  abortHandshake(websocket, socket, protError);
@@ -42336,27 +43788,36 @@ var require_websocket = __commonJS({
42336
43788
  return;
42337
43789
  }
42338
43790
  const extensionNames = Object.keys(extensions);
42339
- if (extensionNames.length) {
42340
- if (extensionNames.length !== 1 || extensionNames[0] !== PerMessageDeflate.extensionName) {
42341
- const message = "Server indicated an extension that was not requested";
42342
- abortHandshake(websocket, socket, message);
42343
- return;
42344
- }
42345
- try {
42346
- perMessageDeflate.accept(extensions[PerMessageDeflate.extensionName]);
42347
- } catch (err) {
42348
- const message = "Invalid Sec-WebSocket-Extensions header";
42349
- abortHandshake(websocket, socket, message);
42350
- return;
42351
- }
42352
- websocket._extensions[PerMessageDeflate.extensionName] = perMessageDeflate;
43791
+ if (extensionNames.length !== 1 || extensionNames[0] !== PerMessageDeflate.extensionName) {
43792
+ const message = "Server indicated an extension that was not requested";
43793
+ abortHandshake(websocket, socket, message);
43794
+ return;
43795
+ }
43796
+ try {
43797
+ perMessageDeflate.accept(extensions[PerMessageDeflate.extensionName]);
43798
+ } catch (err) {
43799
+ const message = "Invalid Sec-WebSocket-Extensions header";
43800
+ abortHandshake(websocket, socket, message);
43801
+ return;
42353
43802
  }
43803
+ websocket._extensions[PerMessageDeflate.extensionName] = perMessageDeflate;
42354
43804
  }
42355
- websocket.setSocket(socket, head, opts.maxPayload);
43805
+ websocket.setSocket(socket, head, {
43806
+ allowSynchronousEvents: opts.allowSynchronousEvents,
43807
+ generateMask: opts.generateMask,
43808
+ maxPayload: opts.maxPayload,
43809
+ skipUTF8Validation: opts.skipUTF8Validation
43810
+ });
42356
43811
  });
43812
+ if (opts.finishRequest) {
43813
+ opts.finishRequest(req, websocket);
43814
+ } else {
43815
+ req.end();
43816
+ }
42357
43817
  }
42358
43818
  function emitErrorAndClose(websocket, err) {
42359
43819
  websocket._readyState = WebSocket.CLOSING;
43820
+ websocket._errorEmitted = true;
42360
43821
  websocket.emit("error", err);
42361
43822
  websocket.emitClose();
42362
43823
  }
@@ -42376,12 +43837,12 @@ var require_websocket = __commonJS({
42376
43837
  const err = new Error(message);
42377
43838
  Error.captureStackTrace(err, abortHandshake);
42378
43839
  if (stream.setHeader) {
43840
+ stream[kAborted] = true;
42379
43841
  stream.abort();
42380
43842
  if (stream.socket && !stream.socket.destroyed) {
42381
43843
  stream.socket.destroy();
42382
43844
  }
42383
- stream.once("abort", websocket.emitClose.bind(websocket));
42384
- websocket.emit("error", err);
43845
+ process.nextTick(emitErrorAndClose, websocket, err);
42385
43846
  } else {
42386
43847
  stream.destroy(err);
42387
43848
  stream.once("error", websocket.emit.bind(websocket, "error"));
@@ -42390,7 +43851,7 @@ var require_websocket = __commonJS({
42390
43851
  }
42391
43852
  function sendAfterClose(websocket, data, cb) {
42392
43853
  if (data) {
42393
- const length = toBuffer(data).length;
43854
+ const length = isBlob(data) ? data.size : toBuffer(data).length;
42394
43855
  if (websocket._socket) websocket._sender._bufferedBytes += length;
42395
43856
  else websocket._bufferedAmount += length;
42396
43857
  }
@@ -42398,7 +43859,7 @@ var require_websocket = __commonJS({
42398
43859
  const err = new Error(
42399
43860
  `WebSocket is not open: readyState ${websocket.readyState} (${readyStates[websocket.readyState]})`
42400
43861
  );
42401
- cb(err);
43862
+ process.nextTick(cb, err);
42402
43863
  }
42403
43864
  }
42404
43865
  function receiverOnConclude(code, reason) {
@@ -42413,7 +43874,8 @@ var require_websocket = __commonJS({
42413
43874
  else websocket.close(code, reason);
42414
43875
  }
42415
43876
  function receiverOnDrain() {
42416
- this[kWebSocket]._socket.resume();
43877
+ const websocket = this[kWebSocket];
43878
+ if (!websocket.isPaused) websocket._socket.resume();
42417
43879
  }
42418
43880
  function receiverOnError(err) {
42419
43881
  const websocket = this[kWebSocket];
@@ -42422,17 +43884,20 @@ var require_websocket = __commonJS({
42422
43884
  process.nextTick(resume, websocket._socket);
42423
43885
  websocket.close(err[kStatusCode]);
42424
43886
  }
42425
- websocket.emit("error", err);
43887
+ if (!websocket._errorEmitted) {
43888
+ websocket._errorEmitted = true;
43889
+ websocket.emit("error", err);
43890
+ }
42426
43891
  }
42427
43892
  function receiverOnFinish() {
42428
43893
  this[kWebSocket].emitClose();
42429
43894
  }
42430
- function receiverOnMessage(data) {
42431
- this[kWebSocket].emit("message", data);
43895
+ function receiverOnMessage(data, isBinary) {
43896
+ this[kWebSocket].emit("message", data, isBinary);
42432
43897
  }
42433
43898
  function receiverOnPing(data) {
42434
43899
  const websocket = this[kWebSocket];
42435
- websocket.pong(data, !websocket._isServer, NOOP);
43900
+ if (websocket._autoPong) websocket.pong(data, !this._isServer, NOOP);
42436
43901
  websocket.emit("ping", data);
42437
43902
  }
42438
43903
  function receiverOnPong(data) {
@@ -42441,6 +43906,25 @@ var require_websocket = __commonJS({
42441
43906
  function resume(stream) {
42442
43907
  stream.resume();
42443
43908
  }
43909
+ function senderOnError(err) {
43910
+ const websocket = this[kWebSocket];
43911
+ if (websocket.readyState === WebSocket.CLOSED) return;
43912
+ if (websocket.readyState === WebSocket.OPEN) {
43913
+ websocket._readyState = WebSocket.CLOSING;
43914
+ setCloseTimer(websocket);
43915
+ }
43916
+ this._socket.end();
43917
+ if (!websocket._errorEmitted) {
43918
+ websocket._errorEmitted = true;
43919
+ websocket.emit("error", err);
43920
+ }
43921
+ }
43922
+ function setCloseTimer(websocket) {
43923
+ websocket._closeTimer = setTimeout(
43924
+ websocket._socket.destroy.bind(websocket._socket),
43925
+ closeTimeout
43926
+ );
43927
+ }
42444
43928
  function socketOnClose() {
42445
43929
  const websocket = this[kWebSocket];
42446
43930
  this.removeListener("close", socketOnClose);
@@ -42488,6 +43972,7 @@ var require_websocket = __commonJS({
42488
43972
  var require_stream4 = __commonJS({
42489
43973
  "../../node_modules/ws/lib/stream.js"(exports2, module2) {
42490
43974
  "use strict";
43975
+ var WebSocket = require_websocket();
42491
43976
  var { Duplex } = require("stream");
42492
43977
  function emitClose(stream) {
42493
43978
  stream.emit("close");
@@ -42505,20 +43990,7 @@ var require_stream4 = __commonJS({
42505
43990
  }
42506
43991
  }
42507
43992
  function createWebSocketStream(ws, options2) {
42508
- let resumeOnReceiverDrain = true;
42509
43993
  let terminateOnDestroy = true;
42510
- function receiverOnDrain() {
42511
- if (resumeOnReceiverDrain) ws._socket.resume();
42512
- }
42513
- if (ws.readyState === ws.CONNECTING) {
42514
- ws.once("open", function open() {
42515
- ws._receiver.removeAllListeners("drain");
42516
- ws._receiver.on("drain", receiverOnDrain);
42517
- });
42518
- } else {
42519
- ws._receiver.removeAllListeners("drain");
42520
- ws._receiver.on("drain", receiverOnDrain);
42521
- }
42522
43994
  const duplex = new Duplex({
42523
43995
  ...options2,
42524
43996
  autoDestroy: false,
@@ -42526,11 +43998,9 @@ var require_stream4 = __commonJS({
42526
43998
  objectMode: false,
42527
43999
  writableObjectMode: false
42528
44000
  });
42529
- ws.on("message", function message(msg) {
42530
- if (!duplex.push(msg)) {
42531
- resumeOnReceiverDrain = false;
42532
- ws._socket.pause();
42533
- }
44001
+ ws.on("message", function message(msg, isBinary) {
44002
+ const data = !isBinary && duplex._readableState.objectMode ? msg.toString() : msg;
44003
+ if (!duplex.push(data)) ws.pause();
42534
44004
  });
42535
44005
  ws.once("error", function error(err) {
42536
44006
  if (duplex.destroyed) return;
@@ -42577,10 +44047,7 @@ var require_stream4 = __commonJS({
42577
44047
  }
42578
44048
  };
42579
44049
  duplex._read = function() {
42580
- if ((ws.readyState === ws.OPEN || ws.readyState === ws.CLOSING) && !resumeOnReceiverDrain) {
42581
- resumeOnReceiverDrain = true;
42582
- if (!ws._receiver._writableState.needDrain) ws._socket.resume();
42583
- }
44050
+ if (ws.isPaused) ws.resume();
42584
44051
  };
42585
44052
  duplex._write = function(chunk, encoding, callback) {
42586
44053
  if (ws.readyState === ws.CONNECTING) {
@@ -42599,19 +44066,63 @@ var require_stream4 = __commonJS({
42599
44066
  }
42600
44067
  });
42601
44068
 
44069
+ // ../../node_modules/ws/lib/subprotocol.js
44070
+ var require_subprotocol = __commonJS({
44071
+ "../../node_modules/ws/lib/subprotocol.js"(exports2, module2) {
44072
+ "use strict";
44073
+ var { tokenChars } = require_validation();
44074
+ function parse2(header) {
44075
+ const protocols = /* @__PURE__ */ new Set();
44076
+ let start = -1;
44077
+ let end = -1;
44078
+ let i = 0;
44079
+ for (i; i < header.length; i++) {
44080
+ const code = header.charCodeAt(i);
44081
+ if (end === -1 && tokenChars[code] === 1) {
44082
+ if (start === -1) start = i;
44083
+ } else if (i !== 0 && (code === 32 || code === 9)) {
44084
+ if (end === -1 && start !== -1) end = i;
44085
+ } else if (code === 44) {
44086
+ if (start === -1) {
44087
+ throw new SyntaxError(`Unexpected character at index ${i}`);
44088
+ }
44089
+ if (end === -1) end = i;
44090
+ const protocol2 = header.slice(start, end);
44091
+ if (protocols.has(protocol2)) {
44092
+ throw new SyntaxError(`The "${protocol2}" subprotocol is duplicated`);
44093
+ }
44094
+ protocols.add(protocol2);
44095
+ start = end = -1;
44096
+ } else {
44097
+ throw new SyntaxError(`Unexpected character at index ${i}`);
44098
+ }
44099
+ }
44100
+ if (start === -1 || end !== -1) {
44101
+ throw new SyntaxError("Unexpected end of input");
44102
+ }
44103
+ const protocol = header.slice(start, i);
44104
+ if (protocols.has(protocol)) {
44105
+ throw new SyntaxError(`The "${protocol}" subprotocol is duplicated`);
44106
+ }
44107
+ protocols.add(protocol);
44108
+ return protocols;
44109
+ }
44110
+ module2.exports = { parse: parse2 };
44111
+ }
44112
+ });
44113
+
42602
44114
  // ../../node_modules/ws/lib/websocket-server.js
42603
44115
  var require_websocket_server = __commonJS({
42604
44116
  "../../node_modules/ws/lib/websocket-server.js"(exports2, module2) {
42605
44117
  "use strict";
42606
44118
  var EventEmitter2 = require("events");
42607
44119
  var http = require("http");
42608
- var https = require("https");
42609
- var net = require("net");
42610
- var tls = require("tls");
44120
+ var { Duplex } = require("stream");
42611
44121
  var { createHash } = require("crypto");
44122
+ var extension = require_extension();
42612
44123
  var PerMessageDeflate = require_permessage_deflate();
44124
+ var subprotocol = require_subprotocol();
42613
44125
  var WebSocket = require_websocket();
42614
- var { format: format2, parse: parse2 } = require_extension();
42615
44126
  var { GUID, kWebSocket } = require_constants();
42616
44127
  var keyRegex = /^[+/0-9A-Za-z]{22}==$/;
42617
44128
  var RUNNING = 0;
@@ -42622,6 +44133,11 @@ var require_websocket_server = __commonJS({
42622
44133
  * Create a `WebSocketServer` instance.
42623
44134
  *
42624
44135
  * @param {Object} options Configuration options
44136
+ * @param {Boolean} [options.allowSynchronousEvents=true] Specifies whether
44137
+ * any of the `'message'`, `'ping'`, and `'pong'` events can be emitted
44138
+ * multiple times in the same tick
44139
+ * @param {Boolean} [options.autoPong=true] Specifies whether or not to
44140
+ * automatically send a pong in response to a ping
42625
44141
  * @param {Number} [options.backlog=511] The maximum length of the queue of
42626
44142
  * pending connections
42627
44143
  * @param {Boolean} [options.clientTracking=true] Specifies whether or not to
@@ -42637,13 +44153,20 @@ var require_websocket_server = __commonJS({
42637
44153
  * @param {Number} [options.port] The port where to bind the server
42638
44154
  * @param {(http.Server|https.Server)} [options.server] A pre-created HTTP/S
42639
44155
  * server to use
44156
+ * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
44157
+ * not to skip UTF-8 validation for text and close messages
42640
44158
  * @param {Function} [options.verifyClient] A hook to reject connections
44159
+ * @param {Function} [options.WebSocket=WebSocket] Specifies the `WebSocket`
44160
+ * class to use. It must be the `WebSocket` class or class that extends it
42641
44161
  * @param {Function} [callback] A listener for the `listening` event
42642
44162
  */
42643
44163
  constructor(options2, callback) {
42644
44164
  super();
42645
44165
  options2 = {
44166
+ allowSynchronousEvents: true,
44167
+ autoPong: true,
42646
44168
  maxPayload: 100 * 1024 * 1024,
44169
+ skipUTF8Validation: false,
42647
44170
  perMessageDeflate: false,
42648
44171
  handleProtocols: null,
42649
44172
  clientTracking: true,
@@ -42655,6 +44178,7 @@ var require_websocket_server = __commonJS({
42655
44178
  host: null,
42656
44179
  path: null,
42657
44180
  port: null,
44181
+ WebSocket,
42658
44182
  ...options2
42659
44183
  };
42660
44184
  if (options2.port == null && !options2.server && !options2.noServer || options2.port != null && (options2.server || options2.noServer) || options2.server && options2.noServer) {
@@ -42691,7 +44215,10 @@ var require_websocket_server = __commonJS({
42691
44215
  });
42692
44216
  }
42693
44217
  if (options2.perMessageDeflate === true) options2.perMessageDeflate = {};
42694
- if (options2.clientTracking) this.clients = /* @__PURE__ */ new Set();
44218
+ if (options2.clientTracking) {
44219
+ this.clients = /* @__PURE__ */ new Set();
44220
+ this._shouldEmitClose = false;
44221
+ }
42695
44222
  this.options = options2;
42696
44223
  this._state = RUNNING;
42697
44224
  }
@@ -42712,32 +44239,47 @@ var require_websocket_server = __commonJS({
42712
44239
  return this._server.address();
42713
44240
  }
42714
44241
  /**
42715
- * Close the server.
44242
+ * Stop the server from accepting new connections and emit the `'close'` event
44243
+ * when all existing connections are closed.
42716
44244
  *
42717
- * @param {Function} [cb] Callback
44245
+ * @param {Function} [cb] A one-time listener for the `'close'` event
42718
44246
  * @public
42719
44247
  */
42720
44248
  close(cb) {
42721
- if (cb) this.once("close", cb);
42722
44249
  if (this._state === CLOSED) {
44250
+ if (cb) {
44251
+ this.once("close", () => {
44252
+ cb(new Error("The server is not running"));
44253
+ });
44254
+ }
42723
44255
  process.nextTick(emitClose, this);
42724
44256
  return;
42725
44257
  }
44258
+ if (cb) this.once("close", cb);
42726
44259
  if (this._state === CLOSING) return;
42727
44260
  this._state = CLOSING;
42728
- if (this.clients) {
42729
- for (const client of this.clients) client.terminate();
42730
- }
42731
- const server = this._server;
42732
- if (server) {
44261
+ if (this.options.noServer || this.options.server) {
44262
+ if (this._server) {
44263
+ this._removeListeners();
44264
+ this._removeListeners = this._server = null;
44265
+ }
44266
+ if (this.clients) {
44267
+ if (!this.clients.size) {
44268
+ process.nextTick(emitClose, this);
44269
+ } else {
44270
+ this._shouldEmitClose = true;
44271
+ }
44272
+ } else {
44273
+ process.nextTick(emitClose, this);
44274
+ }
44275
+ } else {
44276
+ const server = this._server;
42733
44277
  this._removeListeners();
42734
44278
  this._removeListeners = this._server = null;
42735
- if (this.options.port != null) {
42736
- server.close(emitClose.bind(void 0, this));
42737
- return;
42738
- }
44279
+ server.close(() => {
44280
+ emitClose(this);
44281
+ });
42739
44282
  }
42740
- process.nextTick(emitClose, this);
42741
44283
  }
42742
44284
  /**
42743
44285
  * See if a given request should be handled by this server instance.
@@ -42758,35 +44300,71 @@ var require_websocket_server = __commonJS({
42758
44300
  * Handle a HTTP Upgrade request.
42759
44301
  *
42760
44302
  * @param {http.IncomingMessage} req The request object
42761
- * @param {(net.Socket|tls.Socket)} socket The network socket between the
42762
- * server and client
44303
+ * @param {Duplex} socket The network socket between the server and client
42763
44304
  * @param {Buffer} head The first packet of the upgraded stream
42764
44305
  * @param {Function} cb Callback
42765
44306
  * @public
42766
44307
  */
42767
44308
  handleUpgrade(req, socket, head, cb) {
42768
44309
  socket.on("error", socketOnError);
42769
- const key = req.headers["sec-websocket-key"] !== void 0 ? req.headers["sec-websocket-key"].trim() : false;
44310
+ const key = req.headers["sec-websocket-key"];
42770
44311
  const upgrade = req.headers.upgrade;
42771
44312
  const version = +req.headers["sec-websocket-version"];
42772
- const extensions = {};
42773
- if (req.method !== "GET" || upgrade === void 0 || upgrade.toLowerCase() !== "websocket" || !key || !keyRegex.test(key) || version !== 8 && version !== 13 || !this.shouldHandle(req)) {
42774
- return abortHandshake(socket, 400);
44313
+ if (req.method !== "GET") {
44314
+ const message = "Invalid HTTP method";
44315
+ abortHandshakeOrEmitwsClientError(this, req, socket, 405, message);
44316
+ return;
44317
+ }
44318
+ if (upgrade === void 0 || upgrade.toLowerCase() !== "websocket") {
44319
+ const message = "Invalid Upgrade header";
44320
+ abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
44321
+ return;
42775
44322
  }
42776
- if (this.options.perMessageDeflate) {
44323
+ if (key === void 0 || !keyRegex.test(key)) {
44324
+ const message = "Missing or invalid Sec-WebSocket-Key header";
44325
+ abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
44326
+ return;
44327
+ }
44328
+ if (version !== 13 && version !== 8) {
44329
+ const message = "Missing or invalid Sec-WebSocket-Version header";
44330
+ abortHandshakeOrEmitwsClientError(this, req, socket, 400, message, {
44331
+ "Sec-WebSocket-Version": "13, 8"
44332
+ });
44333
+ return;
44334
+ }
44335
+ if (!this.shouldHandle(req)) {
44336
+ abortHandshake(socket, 400);
44337
+ return;
44338
+ }
44339
+ const secWebSocketProtocol = req.headers["sec-websocket-protocol"];
44340
+ let protocols = /* @__PURE__ */ new Set();
44341
+ if (secWebSocketProtocol !== void 0) {
44342
+ try {
44343
+ protocols = subprotocol.parse(secWebSocketProtocol);
44344
+ } catch (err) {
44345
+ const message = "Invalid Sec-WebSocket-Protocol header";
44346
+ abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
44347
+ return;
44348
+ }
44349
+ }
44350
+ const secWebSocketExtensions = req.headers["sec-websocket-extensions"];
44351
+ const extensions = {};
44352
+ if (this.options.perMessageDeflate && secWebSocketExtensions !== void 0) {
42777
44353
  const perMessageDeflate = new PerMessageDeflate(
42778
44354
  this.options.perMessageDeflate,
42779
44355
  true,
42780
44356
  this.options.maxPayload
42781
44357
  );
42782
44358
  try {
42783
- const offers = parse2(req.headers["sec-websocket-extensions"]);
44359
+ const offers = extension.parse(secWebSocketExtensions);
42784
44360
  if (offers[PerMessageDeflate.extensionName]) {
42785
44361
  perMessageDeflate.accept(offers[PerMessageDeflate.extensionName]);
42786
44362
  extensions[PerMessageDeflate.extensionName] = perMessageDeflate;
42787
44363
  }
42788
44364
  } catch (err) {
42789
- return abortHandshake(socket, 400);
44365
+ const message = "Invalid or unacceptable Sec-WebSocket-Extensions header";
44366
+ abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
44367
+ return;
42790
44368
  }
42791
44369
  }
42792
44370
  if (this.options.verifyClient) {
@@ -42800,28 +44378,36 @@ var require_websocket_server = __commonJS({
42800
44378
  if (!verified) {
42801
44379
  return abortHandshake(socket, code || 401, message, headers);
42802
44380
  }
42803
- this.completeUpgrade(key, extensions, req, socket, head, cb);
44381
+ this.completeUpgrade(
44382
+ extensions,
44383
+ key,
44384
+ protocols,
44385
+ req,
44386
+ socket,
44387
+ head,
44388
+ cb
44389
+ );
42804
44390
  });
42805
44391
  return;
42806
44392
  }
42807
44393
  if (!this.options.verifyClient(info)) return abortHandshake(socket, 401);
42808
44394
  }
42809
- this.completeUpgrade(key, extensions, req, socket, head, cb);
44395
+ this.completeUpgrade(extensions, key, protocols, req, socket, head, cb);
42810
44396
  }
42811
44397
  /**
42812
44398
  * Upgrade the connection to WebSocket.
42813
44399
  *
42814
- * @param {String} key The value of the `Sec-WebSocket-Key` header
42815
44400
  * @param {Object} extensions The accepted extensions
44401
+ * @param {String} key The value of the `Sec-WebSocket-Key` header
44402
+ * @param {Set} protocols The subprotocols
42816
44403
  * @param {http.IncomingMessage} req The request object
42817
- * @param {(net.Socket|tls.Socket)} socket The network socket between the
42818
- * server and client
44404
+ * @param {Duplex} socket The network socket between the server and client
42819
44405
  * @param {Buffer} head The first packet of the upgraded stream
42820
44406
  * @param {Function} cb Callback
42821
44407
  * @throws {Error} If called more than once with the same socket
42822
44408
  * @private
42823
44409
  */
42824
- completeUpgrade(key, extensions, req, socket, head, cb) {
44410
+ completeUpgrade(extensions, key, protocols, req, socket, head, cb) {
42825
44411
  if (!socket.readable || !socket.writable) return socket.destroy();
42826
44412
  if (socket[kWebSocket]) {
42827
44413
  throw new Error(
@@ -42836,15 +44422,9 @@ var require_websocket_server = __commonJS({
42836
44422
  "Connection: Upgrade",
42837
44423
  `Sec-WebSocket-Accept: ${digest}`
42838
44424
  ];
42839
- const ws = new WebSocket(null);
42840
- let protocol = req.headers["sec-websocket-protocol"];
42841
- if (protocol) {
42842
- protocol = protocol.split(",").map(trim);
42843
- if (this.options.handleProtocols) {
42844
- protocol = this.options.handleProtocols(protocol, req);
42845
- } else {
42846
- protocol = protocol[0];
42847
- }
44425
+ const ws = new this.options.WebSocket(null, void 0, this.options);
44426
+ if (protocols.size) {
44427
+ const protocol = this.options.handleProtocols ? this.options.handleProtocols(protocols, req) : protocols.values().next().value;
42848
44428
  if (protocol) {
42849
44429
  headers.push(`Sec-WebSocket-Protocol: ${protocol}`);
42850
44430
  ws._protocol = protocol;
@@ -42852,7 +44432,7 @@ var require_websocket_server = __commonJS({
42852
44432
  }
42853
44433
  if (extensions[PerMessageDeflate.extensionName]) {
42854
44434
  const params = extensions[PerMessageDeflate.extensionName].params;
42855
- const value = format2({
44435
+ const value = extension.format({
42856
44436
  [PerMessageDeflate.extensionName]: [params]
42857
44437
  });
42858
44438
  headers.push(`Sec-WebSocket-Extensions: ${value}`);
@@ -42861,10 +44441,19 @@ var require_websocket_server = __commonJS({
42861
44441
  this.emit("headers", headers, req);
42862
44442
  socket.write(headers.concat("\r\n").join("\r\n"));
42863
44443
  socket.removeListener("error", socketOnError);
42864
- ws.setSocket(socket, head, this.options.maxPayload);
44444
+ ws.setSocket(socket, head, {
44445
+ allowSynchronousEvents: this.options.allowSynchronousEvents,
44446
+ maxPayload: this.options.maxPayload,
44447
+ skipUTF8Validation: this.options.skipUTF8Validation
44448
+ });
42865
44449
  if (this.clients) {
42866
44450
  this.clients.add(ws);
42867
- ws.on("close", () => this.clients.delete(ws));
44451
+ ws.on("close", () => {
44452
+ this.clients.delete(ws);
44453
+ if (this._shouldEmitClose && !this.clients.size) {
44454
+ process.nextTick(emitClose, this);
44455
+ }
44456
+ });
42868
44457
  }
42869
44458
  cb(ws, req);
42870
44459
  }
@@ -42886,24 +44475,27 @@ var require_websocket_server = __commonJS({
42886
44475
  this.destroy();
42887
44476
  }
42888
44477
  function abortHandshake(socket, code, message, headers) {
42889
- if (socket.writable) {
42890
- message = message || http.STATUS_CODES[code];
42891
- headers = {
42892
- Connection: "close",
42893
- "Content-Type": "text/html",
42894
- "Content-Length": Buffer.byteLength(message),
42895
- ...headers
42896
- };
42897
- socket.write(
42898
- `HTTP/1.1 ${code} ${http.STATUS_CODES[code]}\r
44478
+ message = message || http.STATUS_CODES[code];
44479
+ headers = {
44480
+ Connection: "close",
44481
+ "Content-Type": "text/html",
44482
+ "Content-Length": Buffer.byteLength(message),
44483
+ ...headers
44484
+ };
44485
+ socket.once("finish", socket.destroy);
44486
+ socket.end(
44487
+ `HTTP/1.1 ${code} ${http.STATUS_CODES[code]}\r
42899
44488
  ` + Object.keys(headers).map((h) => `${h}: ${headers[h]}`).join("\r\n") + "\r\n\r\n" + message
42900
- );
42901
- }
42902
- socket.removeListener("error", socketOnError);
42903
- socket.destroy();
44489
+ );
42904
44490
  }
42905
- function trim(str) {
42906
- return str.trim();
44491
+ function abortHandshakeOrEmitwsClientError(server, req, socket, code, message, headers) {
44492
+ if (server.listenerCount("wsClientError")) {
44493
+ const err = new Error(message);
44494
+ Error.captureStackTrace(err, abortHandshakeOrEmitwsClientError);
44495
+ server.emit("wsClientError", err, socket, req);
44496
+ } else {
44497
+ abortHandshake(socket, code, message, headers);
44498
+ }
42907
44499
  }
42908
44500
  }
42909
44501
  });
@@ -42917,6 +44509,8 @@ var require_ws = __commonJS({
42917
44509
  WebSocket.Server = require_websocket_server();
42918
44510
  WebSocket.Receiver = require_receiver();
42919
44511
  WebSocket.Sender = require_sender();
44512
+ WebSocket.WebSocket = WebSocket;
44513
+ WebSocket.WebSocketServer = WebSocket.Server;
42920
44514
  module2.exports = WebSocket;
42921
44515
  }
42922
44516
  });
@@ -57816,7 +59410,7 @@ mime-types/index.js:
57816
59410
  *)
57817
59411
 
57818
59412
  axios/dist/node/axios.cjs:
57819
- (*! Axios v1.8.2 Copyright (c) 2025 Matt Zabriskie and contributors *)
59413
+ (*! Axios v1.11.0 Copyright (c) 2025 Matt Zabriskie and contributors *)
57820
59414
 
57821
59415
  repeat-string/index.js:
57822
59416
  (*!