@uniformdev/next-app-router 20.61.2-alpha.3 → 20.61.2-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,6 +8,7 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
8
  var __typeError = (msg) => {
9
9
  throw TypeError(msg);
10
10
  };
11
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
12
  var __commonJS = (cb, mod) => function __require() {
12
13
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
13
14
  };
@@ -32,16 +33,25 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
32
33
  mod
33
34
  ));
34
35
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
35
37
  var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
36
38
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
37
39
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
38
40
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
41
+ var __privateWrapper = (obj, member, setter, getter) => ({
42
+ set _(value) {
43
+ __privateSet(obj, member, value, setter);
44
+ },
45
+ get _() {
46
+ return __privateGet(obj, member, getter);
47
+ }
48
+ });
39
49
 
40
50
  // ../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js
41
51
  var require_yocto_queue = __commonJS({
42
52
  "../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js"(exports2, module2) {
43
53
  "use strict";
44
- var Node = class {
54
+ var Node2 = class {
45
55
  /// value;
46
56
  /// next;
47
57
  constructor(value) {
@@ -49,7 +59,7 @@ var require_yocto_queue = __commonJS({
49
59
  this.next = void 0;
50
60
  }
51
61
  };
52
- var Queue = class {
62
+ var Queue2 = class {
53
63
  // TODO: Use private class fields when targeting Node.js 12.
54
64
  // #_head;
55
65
  // #_tail;
@@ -58,7 +68,7 @@ var require_yocto_queue = __commonJS({
58
68
  this.clear();
59
69
  }
60
70
  enqueue(value) {
61
- const node = new Node(value);
71
+ const node = new Node2(value);
62
72
  if (this._head) {
63
73
  this._tail.next = node;
64
74
  this._tail = node;
@@ -93,7 +103,7 @@ var require_yocto_queue = __commonJS({
93
103
  }
94
104
  }
95
105
  };
96
- module2.exports = Queue;
106
+ module2.exports = Queue2;
97
107
  }
98
108
  });
99
109
 
@@ -101,12 +111,12 @@ var require_yocto_queue = __commonJS({
101
111
  var require_p_limit = __commonJS({
102
112
  "../../node_modules/.pnpm/p-limit@3.1.0/node_modules/p-limit/index.js"(exports2, module2) {
103
113
  "use strict";
104
- var Queue = require_yocto_queue();
105
- var pLimit2 = (concurrency) => {
114
+ var Queue2 = require_yocto_queue();
115
+ var pLimit3 = (concurrency) => {
106
116
  if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
107
117
  throw new TypeError("Expected `concurrency` to be a number from 1 and up");
108
118
  }
109
- const queue = new Queue();
119
+ const queue = new Queue2();
110
120
  let activeCount = 0;
111
121
  const next = () => {
112
122
  activeCount--;
@@ -151,7 +161,238 @@ var require_p_limit = __commonJS({
151
161
  });
152
162
  return generator;
153
163
  };
154
- module2.exports = pLimit2;
164
+ module2.exports = pLimit3;
165
+ }
166
+ });
167
+
168
+ // ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js
169
+ var require_retry_operation = __commonJS({
170
+ "../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js"(exports2, module2) {
171
+ "use strict";
172
+ function RetryOperation(timeouts, options) {
173
+ if (typeof options === "boolean") {
174
+ options = { forever: options };
175
+ }
176
+ this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
177
+ this._timeouts = timeouts;
178
+ this._options = options || {};
179
+ this._maxRetryTime = options && options.maxRetryTime || Infinity;
180
+ this._fn = null;
181
+ this._errors = [];
182
+ this._attempts = 1;
183
+ this._operationTimeout = null;
184
+ this._operationTimeoutCb = null;
185
+ this._timeout = null;
186
+ this._operationStart = null;
187
+ this._timer = null;
188
+ if (this._options.forever) {
189
+ this._cachedTimeouts = this._timeouts.slice(0);
190
+ }
191
+ }
192
+ module2.exports = RetryOperation;
193
+ RetryOperation.prototype.reset = function() {
194
+ this._attempts = 1;
195
+ this._timeouts = this._originalTimeouts.slice(0);
196
+ };
197
+ RetryOperation.prototype.stop = function() {
198
+ if (this._timeout) {
199
+ clearTimeout(this._timeout);
200
+ }
201
+ if (this._timer) {
202
+ clearTimeout(this._timer);
203
+ }
204
+ this._timeouts = [];
205
+ this._cachedTimeouts = null;
206
+ };
207
+ RetryOperation.prototype.retry = function(err) {
208
+ if (this._timeout) {
209
+ clearTimeout(this._timeout);
210
+ }
211
+ if (!err) {
212
+ return false;
213
+ }
214
+ var currentTime = (/* @__PURE__ */ new Date()).getTime();
215
+ if (err && currentTime - this._operationStart >= this._maxRetryTime) {
216
+ this._errors.push(err);
217
+ this._errors.unshift(new Error("RetryOperation timeout occurred"));
218
+ return false;
219
+ }
220
+ this._errors.push(err);
221
+ var timeout = this._timeouts.shift();
222
+ if (timeout === void 0) {
223
+ if (this._cachedTimeouts) {
224
+ this._errors.splice(0, this._errors.length - 1);
225
+ timeout = this._cachedTimeouts.slice(-1);
226
+ } else {
227
+ return false;
228
+ }
229
+ }
230
+ var self = this;
231
+ this._timer = setTimeout(function() {
232
+ self._attempts++;
233
+ if (self._operationTimeoutCb) {
234
+ self._timeout = setTimeout(function() {
235
+ self._operationTimeoutCb(self._attempts);
236
+ }, self._operationTimeout);
237
+ if (self._options.unref) {
238
+ self._timeout.unref();
239
+ }
240
+ }
241
+ self._fn(self._attempts);
242
+ }, timeout);
243
+ if (this._options.unref) {
244
+ this._timer.unref();
245
+ }
246
+ return true;
247
+ };
248
+ RetryOperation.prototype.attempt = function(fn, timeoutOps) {
249
+ this._fn = fn;
250
+ if (timeoutOps) {
251
+ if (timeoutOps.timeout) {
252
+ this._operationTimeout = timeoutOps.timeout;
253
+ }
254
+ if (timeoutOps.cb) {
255
+ this._operationTimeoutCb = timeoutOps.cb;
256
+ }
257
+ }
258
+ var self = this;
259
+ if (this._operationTimeoutCb) {
260
+ this._timeout = setTimeout(function() {
261
+ self._operationTimeoutCb();
262
+ }, self._operationTimeout);
263
+ }
264
+ this._operationStart = (/* @__PURE__ */ new Date()).getTime();
265
+ this._fn(this._attempts);
266
+ };
267
+ RetryOperation.prototype.try = function(fn) {
268
+ console.log("Using RetryOperation.try() is deprecated");
269
+ this.attempt(fn);
270
+ };
271
+ RetryOperation.prototype.start = function(fn) {
272
+ console.log("Using RetryOperation.start() is deprecated");
273
+ this.attempt(fn);
274
+ };
275
+ RetryOperation.prototype.start = RetryOperation.prototype.try;
276
+ RetryOperation.prototype.errors = function() {
277
+ return this._errors;
278
+ };
279
+ RetryOperation.prototype.attempts = function() {
280
+ return this._attempts;
281
+ };
282
+ RetryOperation.prototype.mainError = function() {
283
+ if (this._errors.length === 0) {
284
+ return null;
285
+ }
286
+ var counts = {};
287
+ var mainError = null;
288
+ var mainErrorCount = 0;
289
+ for (var i = 0; i < this._errors.length; i++) {
290
+ var error = this._errors[i];
291
+ var message = error.message;
292
+ var count = (counts[message] || 0) + 1;
293
+ counts[message] = count;
294
+ if (count >= mainErrorCount) {
295
+ mainError = error;
296
+ mainErrorCount = count;
297
+ }
298
+ }
299
+ return mainError;
300
+ };
301
+ }
302
+ });
303
+
304
+ // ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js
305
+ var require_retry = __commonJS({
306
+ "../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js"(exports2) {
307
+ "use strict";
308
+ var RetryOperation = require_retry_operation();
309
+ exports2.operation = function(options) {
310
+ var timeouts = exports2.timeouts(options);
311
+ return new RetryOperation(timeouts, {
312
+ forever: options && (options.forever || options.retries === Infinity),
313
+ unref: options && options.unref,
314
+ maxRetryTime: options && options.maxRetryTime
315
+ });
316
+ };
317
+ exports2.timeouts = function(options) {
318
+ if (options instanceof Array) {
319
+ return [].concat(options);
320
+ }
321
+ var opts = {
322
+ retries: 10,
323
+ factor: 2,
324
+ minTimeout: 1 * 1e3,
325
+ maxTimeout: Infinity,
326
+ randomize: false
327
+ };
328
+ for (var key in options) {
329
+ opts[key] = options[key];
330
+ }
331
+ if (opts.minTimeout > opts.maxTimeout) {
332
+ throw new Error("minTimeout is greater than maxTimeout");
333
+ }
334
+ var timeouts = [];
335
+ for (var i = 0; i < opts.retries; i++) {
336
+ timeouts.push(this.createTimeout(i, opts));
337
+ }
338
+ if (options && options.forever && !timeouts.length) {
339
+ timeouts.push(this.createTimeout(i, opts));
340
+ }
341
+ timeouts.sort(function(a, b) {
342
+ return a - b;
343
+ });
344
+ return timeouts;
345
+ };
346
+ exports2.createTimeout = function(attempt, opts) {
347
+ var random = opts.randomize ? Math.random() + 1 : 1;
348
+ var timeout = Math.round(random * Math.max(opts.minTimeout, 1) * Math.pow(opts.factor, attempt));
349
+ timeout = Math.min(timeout, opts.maxTimeout);
350
+ return timeout;
351
+ };
352
+ exports2.wrap = function(obj, options, methods) {
353
+ if (options instanceof Array) {
354
+ methods = options;
355
+ options = null;
356
+ }
357
+ if (!methods) {
358
+ methods = [];
359
+ for (var key in obj) {
360
+ if (typeof obj[key] === "function") {
361
+ methods.push(key);
362
+ }
363
+ }
364
+ }
365
+ for (var i = 0; i < methods.length; i++) {
366
+ var method = methods[i];
367
+ var original = obj[method];
368
+ obj[method] = function retryWrapper(original2) {
369
+ var op = exports2.operation(options);
370
+ var args = Array.prototype.slice.call(arguments, 1);
371
+ var callback = args.pop();
372
+ args.push(function(err) {
373
+ if (op.retry(err)) {
374
+ return;
375
+ }
376
+ if (err) {
377
+ arguments[0] = op.mainError();
378
+ }
379
+ callback.apply(this, arguments);
380
+ });
381
+ op.attempt(function() {
382
+ original2.apply(obj, args);
383
+ });
384
+ }.bind(obj, original);
385
+ obj[method].options = options;
386
+ }
387
+ };
388
+ }
389
+ });
390
+
391
+ // ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js
392
+ var require_retry2 = __commonJS({
393
+ "../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js"(exports2, module2) {
394
+ "use strict";
395
+ module2.exports = require_retry();
155
396
  }
156
397
  });
157
398
 
@@ -359,8 +600,8 @@ var __defProp2 = Object.defineProperty;
359
600
  var __typeError2 = (msg) => {
360
601
  throw TypeError(msg);
361
602
  };
362
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
363
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
603
+ var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
604
+ var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
364
605
  var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
365
606
  var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
366
607
  var __privateAdd2 = (obj, member, value) => member.has(obj) ? __typeError2("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
@@ -382,7 +623,7 @@ var ApiClientError = class _ApiClientError extends Error {
382
623
  };
383
624
  var ApiClient = class _ApiClient {
384
625
  constructor(options) {
385
- __publicField(this, "options");
626
+ __publicField2(this, "options");
386
627
  var _a, _b, _c, _d, _e;
387
628
  if (!options.apiKey && !options.bearerToken) {
388
629
  throw new Error("You must provide an API key or a bearer token");
@@ -688,467 +929,261 @@ var _QuirkClient = class _QuirkClient2 extends ApiClient {
688
929
  });
689
930
  }
690
931
  /** Deletes a Quirk */
691
- async remove(body) {
692
- const fetchUri = this.createUrl(__privateGet2(_QuirkClient2, _url5));
693
- await this.apiClient(fetchUri, {
694
- method: "DELETE",
695
- body: JSON.stringify({ ...body, projectId: this.options.projectId }),
696
- expectNoContent: true
697
- });
698
- }
699
- };
700
- _url5 = /* @__PURE__ */ new WeakMap();
701
- __privateAdd2(_QuirkClient, _url5, "/api/v2/quirk");
702
- var _url6;
703
- var _SignalClient = class _SignalClient2 extends ApiClient {
704
- constructor(options) {
705
- super(options);
706
- }
707
- /** Fetches all Signals for a project */
708
- async get(options) {
709
- const { projectId } = this.options;
710
- const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6), { ...options, projectId });
711
- return await this.apiClient(fetchUri);
712
- }
713
- /** Updates or creates (based on id) a Signal */
714
- async upsert(body) {
715
- const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6));
716
- await this.apiClient(fetchUri, {
717
- method: "PUT",
718
- body: JSON.stringify({ ...body, projectId: this.options.projectId }),
719
- expectNoContent: true
720
- });
721
- }
722
- /** Deletes a Signal */
723
- async remove(body) {
724
- const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6));
725
- await this.apiClient(fetchUri, {
726
- method: "DELETE",
727
- body: JSON.stringify({ ...body, projectId: this.options.projectId }),
728
- expectNoContent: true
729
- });
730
- }
731
- };
732
- _url6 = /* @__PURE__ */ new WeakMap();
733
- __privateAdd2(_SignalClient, _url6, "/api/v2/signal");
734
- var _url7;
735
- var _TestClient = class _TestClient2 extends ApiClient {
736
- constructor(options) {
737
- super(options);
738
- }
739
- /** Fetches all Tests for a project */
740
- async get(options) {
741
- const { projectId } = this.options;
742
- const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7), { ...options, projectId });
743
- return await this.apiClient(fetchUri);
744
- }
745
- /** Updates or creates (based on id) a Test */
746
- async upsert(body) {
747
- const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7));
748
- await this.apiClient(fetchUri, {
749
- method: "PUT",
750
- body: JSON.stringify({ ...body, projectId: this.options.projectId }),
751
- expectNoContent: true
752
- });
753
- }
754
- /** Deletes a Test */
755
- async remove(body) {
756
- const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7));
757
- await this.apiClient(fetchUri, {
758
- method: "DELETE",
759
- body: JSON.stringify({ ...body, projectId: this.options.projectId }),
760
- expectNoContent: true
761
- });
762
- }
763
- };
764
- _url7 = /* @__PURE__ */ new WeakMap();
765
- __privateAdd2(_TestClient, _url7, "/api/v2/test");
766
-
767
- // ../canvas/dist/index.mjs
768
- var __create2 = Object.create;
769
- var __defProp3 = Object.defineProperty;
770
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
771
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
772
- var __getProtoOf2 = Object.getPrototypeOf;
773
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
774
- var __typeError3 = (msg) => {
775
- throw TypeError(msg);
776
- };
777
- var __commonJS2 = (cb, mod) => function __require() {
778
- return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
779
- };
780
- var __copyProps2 = (to, from, except, desc) => {
781
- if (from && typeof from === "object" || typeof from === "function") {
782
- for (let key of __getOwnPropNames2(from))
783
- if (!__hasOwnProp2.call(to, key) && key !== except)
784
- __defProp3(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
785
- }
786
- return to;
787
- };
788
- var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
789
- // If the importer is in node compatibility mode or this is not an ESM
790
- // file that has been converted to a CommonJS file using a Babel-
791
- // compatible transform (i.e. "__esModule" has not been set), then set
792
- // "default" to the CommonJS "module.exports" for node compatibility.
793
- isNodeMode || !mod || !mod.__esModule ? __defProp3(target, "default", { value: mod, enumerable: true }) : target,
794
- mod
795
- ));
796
- var __accessCheck3 = (obj, member, msg) => member.has(obj) || __typeError3("Cannot " + msg);
797
- var __privateGet3 = (obj, member, getter) => (__accessCheck3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
798
- var __privateAdd3 = (obj, member, value) => member.has(obj) ? __typeError3("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
799
- var require_yocto_queue2 = __commonJS2({
800
- "../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js"(exports2, module2) {
801
- "use strict";
802
- var Node = class {
803
- /// value;
804
- /// next;
805
- constructor(value) {
806
- this.value = value;
807
- this.next = void 0;
808
- }
809
- };
810
- var Queue = class {
811
- // TODO: Use private class fields when targeting Node.js 12.
812
- // #_head;
813
- // #_tail;
814
- // #_size;
815
- constructor() {
816
- this.clear();
817
- }
818
- enqueue(value) {
819
- const node = new Node(value);
820
- if (this._head) {
821
- this._tail.next = node;
822
- this._tail = node;
823
- } else {
824
- this._head = node;
825
- this._tail = node;
826
- }
827
- this._size++;
828
- }
829
- dequeue() {
830
- const current = this._head;
831
- if (!current) {
832
- return;
833
- }
834
- this._head = this._head.next;
835
- this._size--;
836
- return current.value;
837
- }
838
- clear() {
839
- this._head = void 0;
840
- this._tail = void 0;
841
- this._size = 0;
842
- }
843
- get size() {
844
- return this._size;
845
- }
846
- *[Symbol.iterator]() {
847
- let current = this._head;
848
- while (current) {
849
- yield current.value;
850
- current = current.next;
851
- }
852
- }
853
- };
854
- module2.exports = Queue;
855
- }
856
- });
857
- var require_p_limit2 = __commonJS2({
858
- "../../node_modules/.pnpm/p-limit@3.1.0/node_modules/p-limit/index.js"(exports2, module2) {
859
- "use strict";
860
- var Queue = require_yocto_queue2();
861
- var pLimit2 = (concurrency) => {
862
- if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
863
- throw new TypeError("Expected `concurrency` to be a number from 1 and up");
864
- }
865
- const queue = new Queue();
866
- let activeCount = 0;
867
- const next = () => {
868
- activeCount--;
869
- if (queue.size > 0) {
870
- queue.dequeue()();
871
- }
872
- };
873
- const run = async (fn, resolve, ...args) => {
874
- activeCount++;
875
- const result = (async () => fn(...args))();
876
- resolve(result);
877
- try {
878
- await result;
879
- } catch (e) {
880
- }
881
- next();
882
- };
883
- const enqueue = (fn, resolve, ...args) => {
884
- queue.enqueue(run.bind(null, fn, resolve, ...args));
885
- (async () => {
886
- await Promise.resolve();
887
- if (activeCount < concurrency && queue.size > 0) {
888
- queue.dequeue()();
889
- }
890
- })();
891
- };
892
- const generator = (fn, ...args) => new Promise((resolve) => {
893
- enqueue(fn, resolve, ...args);
894
- });
895
- Object.defineProperties(generator, {
896
- activeCount: {
897
- get: () => activeCount
898
- },
899
- pendingCount: {
900
- get: () => queue.size
901
- },
902
- clearQueue: {
903
- value: () => {
904
- queue.clear();
905
- }
906
- }
907
- });
908
- return generator;
909
- };
910
- module2.exports = pLimit2;
911
- }
912
- });
913
- var require_retry_operation = __commonJS2({
914
- "../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js"(exports2, module2) {
915
- "use strict";
916
- function RetryOperation(timeouts, options) {
917
- if (typeof options === "boolean") {
918
- options = { forever: options };
919
- }
920
- this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
921
- this._timeouts = timeouts;
922
- this._options = options || {};
923
- this._maxRetryTime = options && options.maxRetryTime || Infinity;
924
- this._fn = null;
925
- this._errors = [];
926
- this._attempts = 1;
927
- this._operationTimeout = null;
928
- this._operationTimeoutCb = null;
929
- this._timeout = null;
930
- this._operationStart = null;
931
- this._timer = null;
932
- if (this._options.forever) {
933
- this._cachedTimeouts = this._timeouts.slice(0);
934
- }
935
- }
936
- module2.exports = RetryOperation;
937
- RetryOperation.prototype.reset = function() {
938
- this._attempts = 1;
939
- this._timeouts = this._originalTimeouts.slice(0);
940
- };
941
- RetryOperation.prototype.stop = function() {
942
- if (this._timeout) {
943
- clearTimeout(this._timeout);
944
- }
945
- if (this._timer) {
946
- clearTimeout(this._timer);
947
- }
948
- this._timeouts = [];
949
- this._cachedTimeouts = null;
950
- };
951
- RetryOperation.prototype.retry = function(err) {
952
- if (this._timeout) {
953
- clearTimeout(this._timeout);
954
- }
955
- if (!err) {
956
- return false;
957
- }
958
- var currentTime = (/* @__PURE__ */ new Date()).getTime();
959
- if (err && currentTime - this._operationStart >= this._maxRetryTime) {
960
- this._errors.push(err);
961
- this._errors.unshift(new Error("RetryOperation timeout occurred"));
962
- return false;
963
- }
964
- this._errors.push(err);
965
- var timeout = this._timeouts.shift();
966
- if (timeout === void 0) {
967
- if (this._cachedTimeouts) {
968
- this._errors.splice(0, this._errors.length - 1);
969
- timeout = this._cachedTimeouts.slice(-1);
970
- } else {
971
- return false;
972
- }
973
- }
974
- var self = this;
975
- this._timer = setTimeout(function() {
976
- self._attempts++;
977
- if (self._operationTimeoutCb) {
978
- self._timeout = setTimeout(function() {
979
- self._operationTimeoutCb(self._attempts);
980
- }, self._operationTimeout);
981
- if (self._options.unref) {
982
- self._timeout.unref();
983
- }
984
- }
985
- self._fn(self._attempts);
986
- }, timeout);
987
- if (this._options.unref) {
988
- this._timer.unref();
989
- }
990
- return true;
991
- };
992
- RetryOperation.prototype.attempt = function(fn, timeoutOps) {
993
- this._fn = fn;
994
- if (timeoutOps) {
995
- if (timeoutOps.timeout) {
996
- this._operationTimeout = timeoutOps.timeout;
997
- }
998
- if (timeoutOps.cb) {
999
- this._operationTimeoutCb = timeoutOps.cb;
1000
- }
1001
- }
1002
- var self = this;
1003
- if (this._operationTimeoutCb) {
1004
- this._timeout = setTimeout(function() {
1005
- self._operationTimeoutCb();
1006
- }, self._operationTimeout);
1007
- }
1008
- this._operationStart = (/* @__PURE__ */ new Date()).getTime();
1009
- this._fn(this._attempts);
1010
- };
1011
- RetryOperation.prototype.try = function(fn) {
1012
- console.log("Using RetryOperation.try() is deprecated");
1013
- this.attempt(fn);
1014
- };
1015
- RetryOperation.prototype.start = function(fn) {
1016
- console.log("Using RetryOperation.start() is deprecated");
1017
- this.attempt(fn);
1018
- };
1019
- RetryOperation.prototype.start = RetryOperation.prototype.try;
1020
- RetryOperation.prototype.errors = function() {
1021
- return this._errors;
1022
- };
1023
- RetryOperation.prototype.attempts = function() {
1024
- return this._attempts;
1025
- };
1026
- RetryOperation.prototype.mainError = function() {
1027
- if (this._errors.length === 0) {
1028
- return null;
1029
- }
1030
- var counts = {};
1031
- var mainError = null;
1032
- var mainErrorCount = 0;
1033
- for (var i = 0; i < this._errors.length; i++) {
1034
- var error = this._errors[i];
1035
- var message = error.message;
1036
- var count = (counts[message] || 0) + 1;
1037
- counts[message] = count;
1038
- if (count >= mainErrorCount) {
1039
- mainError = error;
1040
- mainErrorCount = count;
1041
- }
1042
- }
1043
- return mainError;
1044
- };
932
+ async remove(body) {
933
+ const fetchUri = this.createUrl(__privateGet2(_QuirkClient2, _url5));
934
+ await this.apiClient(fetchUri, {
935
+ method: "DELETE",
936
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
937
+ expectNoContent: true
938
+ });
1045
939
  }
1046
- });
1047
- var require_retry = __commonJS2({
1048
- "../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js"(exports2) {
1049
- "use strict";
1050
- var RetryOperation = require_retry_operation();
1051
- exports2.operation = function(options) {
1052
- var timeouts = exports2.timeouts(options);
1053
- return new RetryOperation(timeouts, {
1054
- forever: options && (options.forever || options.retries === Infinity),
1055
- unref: options && options.unref,
1056
- maxRetryTime: options && options.maxRetryTime
1057
- });
1058
- };
1059
- exports2.timeouts = function(options) {
1060
- if (options instanceof Array) {
1061
- return [].concat(options);
1062
- }
1063
- var opts = {
1064
- retries: 10,
1065
- factor: 2,
1066
- minTimeout: 1 * 1e3,
1067
- maxTimeout: Infinity,
1068
- randomize: false
1069
- };
1070
- for (var key in options) {
1071
- opts[key] = options[key];
1072
- }
1073
- if (opts.minTimeout > opts.maxTimeout) {
1074
- throw new Error("minTimeout is greater than maxTimeout");
1075
- }
1076
- var timeouts = [];
1077
- for (var i = 0; i < opts.retries; i++) {
1078
- timeouts.push(this.createTimeout(i, opts));
1079
- }
1080
- if (options && options.forever && !timeouts.length) {
1081
- timeouts.push(this.createTimeout(i, opts));
940
+ };
941
+ _url5 = /* @__PURE__ */ new WeakMap();
942
+ __privateAdd2(_QuirkClient, _url5, "/api/v2/quirk");
943
+ var _url6;
944
+ var _SignalClient = class _SignalClient2 extends ApiClient {
945
+ constructor(options) {
946
+ super(options);
947
+ }
948
+ /** Fetches all Signals for a project */
949
+ async get(options) {
950
+ const { projectId } = this.options;
951
+ const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6), { ...options, projectId });
952
+ return await this.apiClient(fetchUri);
953
+ }
954
+ /** Updates or creates (based on id) a Signal */
955
+ async upsert(body) {
956
+ const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6));
957
+ await this.apiClient(fetchUri, {
958
+ method: "PUT",
959
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
960
+ expectNoContent: true
961
+ });
962
+ }
963
+ /** Deletes a Signal */
964
+ async remove(body) {
965
+ const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6));
966
+ await this.apiClient(fetchUri, {
967
+ method: "DELETE",
968
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
969
+ expectNoContent: true
970
+ });
971
+ }
972
+ };
973
+ _url6 = /* @__PURE__ */ new WeakMap();
974
+ __privateAdd2(_SignalClient, _url6, "/api/v2/signal");
975
+ var _url7;
976
+ var _TestClient = class _TestClient2 extends ApiClient {
977
+ constructor(options) {
978
+ super(options);
979
+ }
980
+ /** Fetches all Tests for a project */
981
+ async get(options) {
982
+ const { projectId } = this.options;
983
+ const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7), { ...options, projectId });
984
+ return await this.apiClient(fetchUri);
985
+ }
986
+ /** Updates or creates (based on id) a Test */
987
+ async upsert(body) {
988
+ const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7));
989
+ await this.apiClient(fetchUri, {
990
+ method: "PUT",
991
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
992
+ expectNoContent: true
993
+ });
994
+ }
995
+ /** Deletes a Test */
996
+ async remove(body) {
997
+ const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7));
998
+ await this.apiClient(fetchUri, {
999
+ method: "DELETE",
1000
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
1001
+ expectNoContent: true
1002
+ });
1003
+ }
1004
+ };
1005
+ _url7 = /* @__PURE__ */ new WeakMap();
1006
+ __privateAdd2(_TestClient, _url7, "/api/v2/test");
1007
+
1008
+ // ../../node_modules/.pnpm/yocto-queue@1.2.2/node_modules/yocto-queue/index.js
1009
+ var Node = class {
1010
+ constructor(value) {
1011
+ __publicField(this, "value");
1012
+ __publicField(this, "next");
1013
+ this.value = value;
1014
+ }
1015
+ };
1016
+ var _head, _tail, _size;
1017
+ var Queue = class {
1018
+ constructor() {
1019
+ __privateAdd(this, _head);
1020
+ __privateAdd(this, _tail);
1021
+ __privateAdd(this, _size);
1022
+ this.clear();
1023
+ }
1024
+ enqueue(value) {
1025
+ const node = new Node(value);
1026
+ if (__privateGet(this, _head)) {
1027
+ __privateGet(this, _tail).next = node;
1028
+ __privateSet(this, _tail, node);
1029
+ } else {
1030
+ __privateSet(this, _head, node);
1031
+ __privateSet(this, _tail, node);
1032
+ }
1033
+ __privateWrapper(this, _size)._++;
1034
+ }
1035
+ dequeue() {
1036
+ const current = __privateGet(this, _head);
1037
+ if (!current) {
1038
+ return;
1039
+ }
1040
+ __privateSet(this, _head, __privateGet(this, _head).next);
1041
+ __privateWrapper(this, _size)._--;
1042
+ if (!__privateGet(this, _head)) {
1043
+ __privateSet(this, _tail, void 0);
1044
+ }
1045
+ return current.value;
1046
+ }
1047
+ peek() {
1048
+ if (!__privateGet(this, _head)) {
1049
+ return;
1050
+ }
1051
+ return __privateGet(this, _head).value;
1052
+ }
1053
+ clear() {
1054
+ __privateSet(this, _head, void 0);
1055
+ __privateSet(this, _tail, void 0);
1056
+ __privateSet(this, _size, 0);
1057
+ }
1058
+ get size() {
1059
+ return __privateGet(this, _size);
1060
+ }
1061
+ *[Symbol.iterator]() {
1062
+ let current = __privateGet(this, _head);
1063
+ while (current) {
1064
+ yield current.value;
1065
+ current = current.next;
1066
+ }
1067
+ }
1068
+ *drain() {
1069
+ while (__privateGet(this, _head)) {
1070
+ yield this.dequeue();
1071
+ }
1072
+ }
1073
+ };
1074
+ _head = new WeakMap();
1075
+ _tail = new WeakMap();
1076
+ _size = new WeakMap();
1077
+
1078
+ // ../../node_modules/.pnpm/p-limit@6.2.0/node_modules/p-limit/index.js
1079
+ function pLimit2(concurrency) {
1080
+ validateConcurrency(concurrency);
1081
+ const queue = new Queue();
1082
+ let activeCount = 0;
1083
+ const resumeNext = () => {
1084
+ if (activeCount < concurrency && queue.size > 0) {
1085
+ queue.dequeue()();
1086
+ activeCount++;
1087
+ }
1088
+ };
1089
+ const next = () => {
1090
+ activeCount--;
1091
+ resumeNext();
1092
+ };
1093
+ const run = async (function_, resolve, arguments_) => {
1094
+ const result = (async () => function_(...arguments_))();
1095
+ resolve(result);
1096
+ try {
1097
+ await result;
1098
+ } catch (e) {
1099
+ }
1100
+ next();
1101
+ };
1102
+ const enqueue = (function_, resolve, arguments_) => {
1103
+ new Promise((internalResolve) => {
1104
+ queue.enqueue(internalResolve);
1105
+ }).then(
1106
+ run.bind(void 0, function_, resolve, arguments_)
1107
+ );
1108
+ (async () => {
1109
+ await Promise.resolve();
1110
+ if (activeCount < concurrency) {
1111
+ resumeNext();
1082
1112
  }
1083
- timeouts.sort(function(a, b) {
1084
- return a - b;
1085
- });
1086
- return timeouts;
1087
- };
1088
- exports2.createTimeout = function(attempt, opts) {
1089
- var random = opts.randomize ? Math.random() + 1 : 1;
1090
- var timeout = Math.round(random * Math.max(opts.minTimeout, 1) * Math.pow(opts.factor, attempt));
1091
- timeout = Math.min(timeout, opts.maxTimeout);
1092
- return timeout;
1093
- };
1094
- exports2.wrap = function(obj, options, methods) {
1095
- if (options instanceof Array) {
1096
- methods = options;
1097
- options = null;
1113
+ })();
1114
+ };
1115
+ const generator = (function_, ...arguments_) => new Promise((resolve) => {
1116
+ enqueue(function_, resolve, arguments_);
1117
+ });
1118
+ Object.defineProperties(generator, {
1119
+ activeCount: {
1120
+ get: () => activeCount
1121
+ },
1122
+ pendingCount: {
1123
+ get: () => queue.size
1124
+ },
1125
+ clearQueue: {
1126
+ value() {
1127
+ queue.clear();
1098
1128
  }
1099
- if (!methods) {
1100
- methods = [];
1101
- for (var key in obj) {
1102
- if (typeof obj[key] === "function") {
1103
- methods.push(key);
1129
+ },
1130
+ concurrency: {
1131
+ get: () => concurrency,
1132
+ set(newConcurrency) {
1133
+ validateConcurrency(newConcurrency);
1134
+ concurrency = newConcurrency;
1135
+ queueMicrotask(() => {
1136
+ while (activeCount < concurrency && queue.size > 0) {
1137
+ resumeNext();
1104
1138
  }
1105
- }
1106
- }
1107
- for (var i = 0; i < methods.length; i++) {
1108
- var method = methods[i];
1109
- var original = obj[method];
1110
- obj[method] = function retryWrapper(original2) {
1111
- var op = exports2.operation(options);
1112
- var args = Array.prototype.slice.call(arguments, 1);
1113
- var callback = args.pop();
1114
- args.push(function(err) {
1115
- if (op.retry(err)) {
1116
- return;
1117
- }
1118
- if (err) {
1119
- arguments[0] = op.mainError();
1120
- }
1121
- callback.apply(this, arguments);
1122
- });
1123
- op.attempt(function() {
1124
- original2.apply(obj, args);
1125
- });
1126
- }.bind(obj, original);
1127
- obj[method].options = options;
1139
+ });
1128
1140
  }
1129
- };
1130
- }
1131
- });
1132
- var require_retry2 = __commonJS2({
1133
- "../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js"(exports2, module2) {
1134
- "use strict";
1135
- module2.exports = require_retry();
1141
+ }
1142
+ });
1143
+ return generator;
1144
+ }
1145
+ function validateConcurrency(concurrency) {
1146
+ if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
1147
+ throw new TypeError("Expected `concurrency` to be a number from 1 and up");
1136
1148
  }
1137
- });
1138
- var import_p_limit2 = __toESM2(require_p_limit2());
1139
- var import_retry = __toESM2(require_retry2(), 1);
1140
- var networkErrorMsgs = /* @__PURE__ */ new Set([
1149
+ }
1150
+
1151
+ // ../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
1152
+ var import_retry = __toESM(require_retry2(), 1);
1153
+
1154
+ // ../../node_modules/.pnpm/is-network-error@1.1.0/node_modules/is-network-error/index.js
1155
+ var objectToString = Object.prototype.toString;
1156
+ var isError = (value) => objectToString.call(value) === "[object Error]";
1157
+ var errorMessages = /* @__PURE__ */ new Set([
1158
+ "network error",
1159
+ // Chrome
1141
1160
  "Failed to fetch",
1142
1161
  // Chrome
1143
1162
  "NetworkError when attempting to fetch resource.",
1144
1163
  // Firefox
1145
1164
  "The Internet connection appears to be offline.",
1146
- // Safari
1165
+ // Safari 16
1166
+ "Load failed",
1167
+ // Safari 17+
1147
1168
  "Network request failed",
1148
1169
  // `cross-fetch`
1149
- "fetch failed"
1170
+ "fetch failed",
1171
+ // Undici (Node.js)
1172
+ "terminated"
1150
1173
  // Undici (Node.js)
1151
1174
  ]);
1175
+ function isNetworkError(error) {
1176
+ const isValid = error && isError(error) && error.name === "TypeError" && typeof error.message === "string";
1177
+ if (!isValid) {
1178
+ return false;
1179
+ }
1180
+ if (error.message === "Load failed") {
1181
+ return error.stack === void 0;
1182
+ }
1183
+ return errorMessages.has(error.message);
1184
+ }
1185
+
1186
+ // ../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
1152
1187
  var AbortError = class extends Error {
1153
1188
  constructor(message) {
1154
1189
  super();
@@ -1169,63 +1204,68 @@ var decorateErrorWithCounts = (error, attemptNumber, options) => {
1169
1204
  error.retriesLeft = retriesLeft;
1170
1205
  return error;
1171
1206
  };
1172
- var isNetworkError = (errorMessage) => networkErrorMsgs.has(errorMessage);
1173
- var getDOMException = (errorMessage) => globalThis.DOMException === void 0 ? new Error(errorMessage) : new DOMException(errorMessage);
1174
1207
  async function pRetry(input, options) {
1175
1208
  return new Promise((resolve, reject) => {
1176
- options = {
1177
- onFailedAttempt() {
1178
- },
1179
- retries: 10,
1180
- ...options
1209
+ var _a, _b, _c;
1210
+ options = { ...options };
1211
+ (_a = options.onFailedAttempt) != null ? _a : options.onFailedAttempt = () => {
1181
1212
  };
1213
+ (_b = options.shouldRetry) != null ? _b : options.shouldRetry = () => true;
1214
+ (_c = options.retries) != null ? _c : options.retries = 10;
1182
1215
  const operation = import_retry.default.operation(options);
1216
+ const abortHandler = () => {
1217
+ var _a2;
1218
+ operation.stop();
1219
+ reject((_a2 = options.signal) == null ? void 0 : _a2.reason);
1220
+ };
1221
+ if (options.signal && !options.signal.aborted) {
1222
+ options.signal.addEventListener("abort", abortHandler, { once: true });
1223
+ }
1224
+ const cleanUp = () => {
1225
+ var _a2;
1226
+ (_a2 = options.signal) == null ? void 0 : _a2.removeEventListener("abort", abortHandler);
1227
+ operation.stop();
1228
+ };
1183
1229
  operation.attempt(async (attemptNumber) => {
1184
1230
  try {
1185
- resolve(await input(attemptNumber));
1231
+ const result = await input(attemptNumber);
1232
+ cleanUp();
1233
+ resolve(result);
1186
1234
  } catch (error) {
1187
- if (!(error instanceof Error)) {
1188
- reject(new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`));
1189
- return;
1190
- }
1191
- if (error instanceof AbortError) {
1192
- operation.stop();
1193
- reject(error.originalError);
1194
- } else if (error instanceof TypeError && !isNetworkError(error.message)) {
1195
- operation.stop();
1196
- reject(error);
1197
- } else {
1235
+ try {
1236
+ if (!(error instanceof Error)) {
1237
+ throw new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`);
1238
+ }
1239
+ if (error instanceof AbortError) {
1240
+ throw error.originalError;
1241
+ }
1242
+ if (error instanceof TypeError && !isNetworkError(error)) {
1243
+ throw error;
1244
+ }
1198
1245
  decorateErrorWithCounts(error, attemptNumber, options);
1199
- try {
1200
- await options.onFailedAttempt(error);
1201
- } catch (error2) {
1202
- reject(error2);
1203
- return;
1246
+ if (!await options.shouldRetry(error)) {
1247
+ operation.stop();
1248
+ reject(error);
1204
1249
  }
1250
+ await options.onFailedAttempt(error);
1205
1251
  if (!operation.retry(error)) {
1206
- reject(operation.mainError());
1252
+ throw operation.mainError();
1207
1253
  }
1254
+ } catch (finalError) {
1255
+ decorateErrorWithCounts(finalError, attemptNumber, options);
1256
+ cleanUp();
1257
+ reject(finalError);
1208
1258
  }
1209
1259
  }
1210
1260
  });
1211
- if (options.signal && !options.signal.aborted) {
1212
- options.signal.addEventListener("abort", () => {
1213
- operation.stop();
1214
- const reason = options.signal.reason === void 0 ? getDOMException("The operation was aborted.") : options.signal.reason;
1215
- reject(reason instanceof Error ? reason : getDOMException(reason));
1216
- }, {
1217
- once: true
1218
- });
1219
- }
1220
1261
  });
1221
1262
  }
1222
- var AbortError2 = class extends Error {
1223
- constructor() {
1224
- super("Throttled function aborted");
1225
- this.name = "AbortError";
1226
- }
1227
- };
1228
- function pThrottle({ limit, interval, strict }) {
1263
+
1264
+ // ../../node_modules/.pnpm/p-throttle@7.0.0/node_modules/p-throttle/index.js
1265
+ var registry = new FinalizationRegistry(({ signal, aborted }) => {
1266
+ signal == null ? void 0 : signal.removeEventListener("abort", aborted);
1267
+ });
1268
+ function pThrottle({ limit, interval, strict, signal, onDelay }) {
1229
1269
  if (!Number.isFinite(limit)) {
1230
1270
  throw new TypeError("Expected `limit` to be a finite number");
1231
1271
  }
@@ -1253,53 +1293,75 @@ function pThrottle({ limit, interval, strict }) {
1253
1293
  const strictTicks = [];
1254
1294
  function strictDelay() {
1255
1295
  const now = Date.now();
1256
- if (strictTicks.length < limit) {
1257
- strictTicks.push(now);
1258
- return 0;
1296
+ if (strictTicks.length > 0 && now - strictTicks.at(-1) > interval) {
1297
+ strictTicks.length = 0;
1259
1298
  }
1260
- const earliestTime = strictTicks.shift() + interval;
1261
- if (now >= earliestTime) {
1299
+ if (strictTicks.length < limit) {
1262
1300
  strictTicks.push(now);
1263
1301
  return 0;
1264
1302
  }
1265
- strictTicks.push(earliestTime);
1266
- return earliestTime - now;
1303
+ const nextExecutionTime = strictTicks[0] + interval;
1304
+ strictTicks.shift();
1305
+ strictTicks.push(nextExecutionTime);
1306
+ return Math.max(0, nextExecutionTime - now);
1267
1307
  }
1268
1308
  const getDelay = strict ? strictDelay : windowedDelay;
1269
1309
  return (function_) => {
1270
- const throttled = function(...args) {
1310
+ const throttled = function(...arguments_) {
1271
1311
  if (!throttled.isEnabled) {
1272
- return (async () => function_.apply(this, args))();
1312
+ return (async () => function_.apply(this, arguments_))();
1273
1313
  }
1274
- let timeout;
1314
+ let timeoutId;
1275
1315
  return new Promise((resolve, reject) => {
1276
1316
  const execute = () => {
1277
- resolve(function_.apply(this, args));
1278
- queue.delete(timeout);
1317
+ resolve(function_.apply(this, arguments_));
1318
+ queue.delete(timeoutId);
1279
1319
  };
1280
- timeout = setTimeout(execute, getDelay());
1281
- queue.set(timeout, reject);
1320
+ const delay = getDelay();
1321
+ if (delay > 0) {
1322
+ timeoutId = setTimeout(execute, delay);
1323
+ queue.set(timeoutId, reject);
1324
+ onDelay == null ? void 0 : onDelay(...arguments_);
1325
+ } else {
1326
+ execute();
1327
+ }
1282
1328
  });
1283
1329
  };
1284
- throttled.abort = () => {
1330
+ const aborted = () => {
1285
1331
  for (const timeout of queue.keys()) {
1286
1332
  clearTimeout(timeout);
1287
- queue.get(timeout)(new AbortError2());
1333
+ queue.get(timeout)(signal.reason);
1288
1334
  }
1289
1335
  queue.clear();
1290
1336
  strictTicks.splice(0, strictTicks.length);
1291
1337
  };
1338
+ registry.register(throttled, { signal, aborted });
1339
+ signal == null ? void 0 : signal.throwIfAborted();
1340
+ signal == null ? void 0 : signal.addEventListener("abort", aborted, { once: true });
1292
1341
  throttled.isEnabled = true;
1342
+ Object.defineProperty(throttled, "queueSize", {
1343
+ get() {
1344
+ return queue.size;
1345
+ }
1346
+ });
1293
1347
  return throttled;
1294
1348
  };
1295
1349
  }
1350
+
1351
+ // ../canvas/dist/index.mjs
1352
+ var __typeError3 = (msg) => {
1353
+ throw TypeError(msg);
1354
+ };
1355
+ var __accessCheck3 = (obj, member, msg) => member.has(obj) || __typeError3("Cannot " + msg);
1356
+ var __privateGet3 = (obj, member, getter) => (__accessCheck3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
1357
+ var __privateAdd3 = (obj, member, value) => member.has(obj) ? __typeError3("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1296
1358
  function createLimitPolicy({
1297
1359
  throttle = { interval: 1e3, limit: 10 },
1298
- retry: retry2 = { retries: 1, factor: 1.66 },
1360
+ retry: retry3 = { retries: 1, factor: 1.66 },
1299
1361
  limit = 10
1300
1362
  }) {
1301
1363
  const throttler = throttle ? pThrottle(throttle) : null;
1302
- const limiter = limit ? (0, import_p_limit2.default)(limit) : null;
1364
+ const limiter = limit ? pLimit2(limit) : null;
1303
1365
  return function limitPolicy(func) {
1304
1366
  let currentFunc = async () => await func();
1305
1367
  if (throttler) {
@@ -1310,13 +1372,13 @@ function createLimitPolicy({
1310
1372
  const limitFunc = currentFunc;
1311
1373
  currentFunc = () => limiter(limitFunc);
1312
1374
  }
1313
- if (retry2) {
1375
+ if (retry3) {
1314
1376
  const retryFunc = currentFunc;
1315
1377
  currentFunc = () => pRetry(retryFunc, {
1316
- ...retry2,
1378
+ ...retry3,
1317
1379
  onFailedAttempt: async (error) => {
1318
- if (retry2.onFailedAttempt) {
1319
- await retry2.onFailedAttempt(error);
1380
+ if (retry3.onFailedAttempt) {
1381
+ await retry3.onFailedAttempt(error);
1320
1382
  }
1321
1383
  if (error instanceof ApiClientError && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500 && error.statusCode !== 429 && error.statusCode !== 408) {
1322
1384
  throw error;
@@ -2502,7 +2564,7 @@ function createLimiter(concurrency) {
2502
2564
  });
2503
2565
  };
2504
2566
  }
2505
- async function retry(fn, options) {
2567
+ async function retry2(fn, options) {
2506
2568
  let lastError;
2507
2569
  let delay = 1e3;
2508
2570
  for (let attempt = 1; attempt <= options.retries + 1; attempt++) {
@@ -2542,7 +2604,7 @@ function createLimitPolicy2({
2542
2604
  }
2543
2605
  if (retryOptions) {
2544
2606
  const retryFunc = currentFunc;
2545
- currentFunc = () => retry(retryFunc, {
2607
+ currentFunc = () => retry2(retryFunc, {
2546
2608
  ...retryOptions,
2547
2609
  onFailedAttempt: async (error) => {
2548
2610
  if (retryOptions.onFailedAttempt) {
@@ -3280,12 +3342,12 @@ function mitt_default(n) {
3280
3342
  var import_rfdc = __toESM(require_rfdc(), 1);
3281
3343
  var import_rfdc2 = __toESM(require_rfdc(), 1);
3282
3344
  var import_rfdc3 = __toESM(require_rfdc(), 1);
3283
- var __defProp4 = Object.defineProperty;
3345
+ var __defProp3 = Object.defineProperty;
3284
3346
  var __typeError4 = (msg) => {
3285
3347
  throw TypeError(msg);
3286
3348
  };
3287
- var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3288
- var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
3349
+ var __defNormalProp3 = (obj, key, value) => key in obj ? __defProp3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3350
+ var __publicField3 = (obj, key, value) => __defNormalProp3(obj, typeof key !== "symbol" ? key + "" : key, value);
3289
3351
  var __accessCheck4 = (obj, member, msg) => member.has(obj) || __typeError4("Cannot " + msg);
3290
3352
  var __privateGet4 = (obj, member, getter) => (__accessCheck4(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
3291
3353
  var __privateAdd4 = (obj, member, value) => member.has(obj) ? __typeError4("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
@@ -3362,7 +3424,7 @@ var SignalInstance = class {
3362
3424
  constructor(data, evaluator, onLogMessage) {
3363
3425
  __privateAdd4(this, _evaluator);
3364
3426
  __privateAdd4(this, _onLogMessage);
3365
- __publicField2(this, "signal");
3427
+ __publicField3(this, "signal");
3366
3428
  this.signal = data;
3367
3429
  __privateSet2(this, _evaluator, evaluator);
3368
3430
  __privateSet2(this, _onLogMessage, onLogMessage);
@@ -3420,7 +3482,7 @@ var ManifestInstance = class {
3420
3482
  onLogMessage = () => {
3421
3483
  }
3422
3484
  }) {
3423
- __publicField2(this, "data");
3485
+ __publicField3(this, "data");
3424
3486
  __privateAdd4(this, _mf);
3425
3487
  __privateAdd4(this, _signalInstances);
3426
3488
  __privateAdd4(this, _goalEvaluators, []);
@@ -4207,7 +4269,7 @@ var TransitionDataStore = class {
4207
4269
  __privateAdd4(this, _data);
4208
4270
  __privateAdd4(this, _initialData);
4209
4271
  __privateAdd4(this, _mitt, mitt_default());
4210
- __publicField2(this, "events", {
4272
+ __publicField3(this, "events", {
4211
4273
  on: __privateGet4(this, _mitt).on,
4212
4274
  off: __privateGet4(this, _mitt).off
4213
4275
  });
@@ -4572,8 +4634,8 @@ var LocalStorage = class {
4572
4634
  constructor(partitionKey) {
4573
4635
  this.partitionKey = partitionKey;
4574
4636
  __privateAdd4(this, _LocalStorage_instances);
4575
- __publicField2(this, "inMemoryFallback", {});
4576
- __publicField2(this, "hasLocalStorageObject", typeof document !== "undefined" && typeof localStorage !== "undefined");
4637
+ __publicField3(this, "inMemoryFallback", {});
4638
+ __publicField3(this, "hasLocalStorageObject", typeof document !== "undefined" && typeof localStorage !== "undefined");
4577
4639
  }
4578
4640
  get(key) {
4579
4641
  const keyValue = __privateMethod(this, _LocalStorage_instances, key_fn).call(this, key);
@@ -4634,7 +4696,7 @@ var VisitorDataStore = class {
4634
4696
  __privateAdd4(this, _persist);
4635
4697
  __privateAdd4(this, _visitTimeout);
4636
4698
  __privateAdd4(this, _options);
4637
- __publicField2(this, "events", {
4699
+ __publicField3(this, "events", {
4638
4700
  on: __privateGet4(this, _mitt2).on,
4639
4701
  off: __privateGet4(this, _mitt2).off
4640
4702
  });
@@ -4835,7 +4897,7 @@ var calculateScores_fn;
4835
4897
  var Context = class {
4836
4898
  constructor(options) {
4837
4899
  __privateAdd4(this, _Context_instances);
4838
- __publicField2(this, "manifest");
4900
+ __publicField3(this, "manifest");
4839
4901
  __privateAdd4(this, _personalizationSelectionAlgorithms);
4840
4902
  __privateAdd4(this, _serverTransitionState);
4841
4903
  __privateAdd4(this, _scores, {});
@@ -4845,11 +4907,11 @@ var Context = class {
4845
4907
  __privateAdd4(this, _commands);
4846
4908
  __privateAdd4(this, _requireConsentForPersonalization);
4847
4909
  __privateAdd4(this, _mitt3, mitt_default());
4848
- __publicField2(this, "events", {
4910
+ __publicField3(this, "events", {
4849
4911
  on: __privateGet4(this, _mitt3).on,
4850
4912
  off: __privateGet4(this, _mitt3).off
4851
4913
  });
4852
- __publicField2(this, "storage");
4914
+ __publicField3(this, "storage");
4853
4915
  var _a, _b, _c;
4854
4916
  const { manifest, ...storageOptions } = options;
4855
4917
  __privateSet2(this, _state, {});