@uwrl/qc-utils 0.0.20 → 0.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- var F = /* @__PURE__ */ ((e) => (e.SECOND = "s", e.MINUTE = "m", e.HOUR = "h", e.DAY = "D", e.WEEK = "W", e.MONTH = "M", e.YEAR = "Y", e))(F || {}), E = /* @__PURE__ */ ((e) => (e.ADD_POINTS = "ADD_POINTS", e.CHANGE_VALUES = "CHANGE_VALUES", e.ASSIGN_VALUES_BULK = "ASSIGN_VALUES_BULK", e.DELETE_POINTS = "DELETE_POINTS", e.DRIFT_CORRECTION = "DRIFT_CORRECTION", e.INTERPOLATE = "INTERPOLATE", e.SHIFT_DATETIMES = "SHIFT_DATETIMES", e.ASSIGN_DATETIMES_BULK = "ASSIGN_DATETIMES_BULK", e.FILL_GAPS = "FILL_GAPS", e))(E || {}), v = /* @__PURE__ */ ((e) => (e.FIND_GAPS = "FIND_GAPS", e.PERSISTENCE = "PERSISTENCE", e.CHANGE = "CHANGE", e.RATE_OF_CHANGE = "RATE_OF_CHANGE", e.VALUE_THRESHOLD = "VALUE_THRESHOLD", e.DATETIME_RANGE = "DATETIME_RANGE", e.SELECTION = "SELECTION", e))(v || {}), J = /* @__PURE__ */ ((e) => (e.LT = "Less than", e.LTE = "Less than or equal to", e.GT = "Greater than", e.GTE = "Greater than or equal to", e.E = "Equal", e))(J || {}), Bt = /* @__PURE__ */ ((e) => (e.ADD = "ADD", e.SUB = "SUB", e.MULT = "MULT", e.DIV = "DIV", e.ASSIGN = "ASSIGN", e))(Bt || {}), jt = /* @__PURE__ */ ((e) => (e.LT = "Less than", e.LTE = "Less than or equal to", e.GT = "Greater than", e.GTE = "Greater than or equal to", e.E = "Equal", e))(jt || {});
2
- class Wt {
1
+ var W = /* @__PURE__ */ ((e) => (e.SECOND = "s", e.MINUTE = "m", e.HOUR = "h", e.DAY = "D", e.WEEK = "W", e.MONTH = "M", e.YEAR = "Y", e))(W || {}), v = /* @__PURE__ */ ((e) => (e.ADD_POINTS = "ADD_POINTS", e.CHANGE_VALUES = "CHANGE_VALUES", e.ASSIGN_VALUES_BULK = "ASSIGN_VALUES_BULK", e.DELETE_POINTS = "DELETE_POINTS", e.DRIFT_CORRECTION = "DRIFT_CORRECTION", e.INTERPOLATE = "INTERPOLATE", e.SHIFT_DATETIMES = "SHIFT_DATETIMES", e.ASSIGN_DATETIMES_BULK = "ASSIGN_DATETIMES_BULK", e.FILL_GAPS = "FILL_GAPS", e))(v || {}), T = /* @__PURE__ */ ((e) => (e.FIND_GAPS = "FIND_GAPS", e.PERSISTENCE = "PERSISTENCE", e.CHANGE = "CHANGE", e.RATE_OF_CHANGE = "RATE_OF_CHANGE", e.VALUE_THRESHOLD = "VALUE_THRESHOLD", e.DATETIME_RANGE = "DATETIME_RANGE", e.SELECTION = "SELECTION", e))(T || {}), K = /* @__PURE__ */ ((e) => (e.LT = "Less than", e.LTE = "Less than or equal to", e.GT = "Greater than", e.GTE = "Greater than or equal to", e.E = "Equal", e))(K || {}), Gt = /* @__PURE__ */ ((e) => (e.ADD = "ADD", e.SUB = "SUB", e.MULT = "MULT", e.DIV = "DIV", e.ASSIGN = "ASSIGN", e))(Gt || {}), Ht = /* @__PURE__ */ ((e) => (e.LT = "Less than", e.LTE = "Less than or equal to", e.GT = "Greater than", e.GTE = "Greater than or equal to", e.E = "Equal", e))(Ht || {});
2
+ class zt {
3
3
  id;
4
4
  thingId;
5
5
  link;
@@ -11,7 +11,7 @@ class Wt {
11
11
  this.id = "", this.thingId = "", this.link = "", this.frequency = null, this.path = "HydroShare", this.datastreamIds = [], this.publicResource = !1;
12
12
  }
13
13
  }
14
- class Vr extends Wt {
14
+ class ts extends zt {
15
15
  resourceTitle;
16
16
  resourceAbstract;
17
17
  resourceKeywords;
@@ -19,7 +19,7 @@ class Vr extends Wt {
19
19
  super(), this.resourceTitle = void 0, this.resourceAbstract = void 0, this.resourceKeywords = void 0;
20
20
  }
21
21
  }
22
- class Gt {
22
+ class Xt {
23
23
  latitude;
24
24
  longitude;
25
25
  elevation_m;
@@ -31,11 +31,11 @@ class Gt {
31
31
  this.elevationDatum = "WGS84", this.state = "", this.county = "", this.country = "";
32
32
  }
33
33
  }
34
- class qr {
34
+ class rs {
35
35
  id;
36
36
  workspaceId;
37
37
  name;
38
- location = new Gt();
38
+ location = new Xt();
39
39
  tags;
40
40
  hydroShareArchive;
41
41
  siteType;
@@ -48,7 +48,7 @@ class qr {
48
48
  this.id = "", this.workspaceId = "", this.name = "", this.tags = [], this.siteType = "", this.samplingFeatureCode = "", this.isPrivate = !1, this.description = "", this.samplingFeatureType = "Site", this.dataDisclaimer = "";
49
49
  }
50
50
  }
51
- class Jr {
51
+ class ss {
52
52
  id;
53
53
  workspaceId;
54
54
  name;
@@ -78,7 +78,7 @@ class Jr {
78
78
  this.id = "", this.workspaceId = "", this.name = "", this.description = "", this.thingId = t || "", this.observationType = "OM_Measurement", this.resultType = "Time Series Coverage", this.sampledMedium = "", this.noDataValue = -9999, this.aggregationStatistic = "", this.unitId = "", this.observedPropertyId = "", this.sensorId = "", this.processingLevelId = "", this.timeAggregationInterval = null, this.timeAggregationIntervalUnit = "seconds", this.isPrivate = !0, this.isVisible = !0, this.valueCount = 0;
79
79
  }
80
80
  }
81
- class Kr {
81
+ class ns {
82
82
  id;
83
83
  workspaceId;
84
84
  name;
@@ -89,7 +89,7 @@ class Kr {
89
89
  this.id = "", this.workspaceId = "", this.name = "", this.symbol = "", this.definition = "", this.type = "";
90
90
  }
91
91
  }
92
- class Qr {
92
+ class os {
93
93
  id;
94
94
  workspaceId;
95
95
  name;
@@ -105,7 +105,7 @@ class Qr {
105
105
  this.id = "", this.workspaceId = "", this.name = "", this.description = "", this.manufacturer = "", this.model = "", this.methodType = "Instrument Deployment", this.methodCode = "", this.methodLink = "", this.encodingType = "application/json", this.modelLink = "";
106
106
  }
107
107
  }
108
- class Zr {
108
+ class as {
109
109
  id;
110
110
  workspaceId;
111
111
  name;
@@ -117,7 +117,7 @@ class Zr {
117
117
  this.id = "", this.workspaceId = "", this.name = "", this.definition = "", this.description = "", this.type = "Hydrology", this.code = "";
118
118
  }
119
119
  }
120
- class es {
120
+ class is {
121
121
  id;
122
122
  workspaceId;
123
123
  code;
@@ -127,7 +127,7 @@ class es {
127
127
  this.id = "", this.workspaceId = "", this.code = "", this.definition = "", this.explanation = "";
128
128
  }
129
129
  }
130
- class ts {
130
+ class cs {
131
131
  id;
132
132
  workspaceId;
133
133
  code;
@@ -136,7 +136,7 @@ class ts {
136
136
  this.id = "", this.workspaceId = "", this.code = "", this.description = "";
137
137
  }
138
138
  }
139
- class rs {
139
+ class ls {
140
140
  name;
141
141
  code;
142
142
  type;
@@ -145,7 +145,7 @@ class rs {
145
145
  constructor() {
146
146
  }
147
147
  }
148
- class ss {
148
+ class us {
149
149
  id;
150
150
  email;
151
151
  password;
@@ -163,7 +163,7 @@ class ss {
163
163
  this.id = "", this.email = "", this.password = "", this.firstName = "", this.middleName = "", this.lastName = "", this.phone = "", this.address = "", this.type = "", this.link = "", this.accountType = "standard", this.hydroShareConnected = !1;
164
164
  }
165
165
  }
166
- class ns {
166
+ class hs {
167
167
  id;
168
168
  name;
169
169
  iconLink;
@@ -173,8 +173,8 @@ class ns {
173
173
  this.id = "", this.name = "", this.iconLink = "", this.signupEnabled = !0, this.connectEnabled = !0;
174
174
  }
175
175
  }
176
- var Yt = /* @__PURE__ */ ((e) => (e.Global = "*", e.View = "view", e.Create = "create", e.Edit = "edit", e.Delete = "delete", e))(Yt || {}), Ht = /* @__PURE__ */ ((e) => (e.Global = "*", e.Workspace = "Workspace", e.Collaborator = "Collaborator", e.Thing = "Thing", e.Datastream = "Datastream", e.Sensor = "Sensor", e.Unit = "Unit", e.ObservedProperty = "ObservedProperty", e.ProcessingLevel = "ProcessingLevel", e.Observation = "Observation", e))(Ht || {});
177
- class os {
176
+ var Vt = /* @__PURE__ */ ((e) => (e.Global = "*", e.View = "view", e.Create = "create", e.Edit = "edit", e.Delete = "delete", e))(Vt || {}), qt = /* @__PURE__ */ ((e) => (e.Global = "*", e.Workspace = "Workspace", e.Collaborator = "Collaborator", e.Thing = "Thing", e.Datastream = "Datastream", e.Sensor = "Sensor", e.Unit = "Unit", e.ObservedProperty = "ObservedProperty", e.ProcessingLevel = "ProcessingLevel", e.Observation = "Observation", e))(qt || {});
177
+ class fs {
178
178
  id = "";
179
179
  key = "";
180
180
  name = "";
@@ -189,7 +189,7 @@ class os {
189
189
  Object.assign(this, t);
190
190
  }
191
191
  }
192
- class as {
192
+ class ds {
193
193
  id;
194
194
  name;
195
195
  isPrivate;
@@ -200,7 +200,7 @@ class as {
200
200
  this.id = "", this.name = "", this.isPrivate = !1, this.owner = null, this.collaboratorRole = null, this.pendingTransferTo = null;
201
201
  }
202
202
  }
203
- class is {
203
+ class ps {
204
204
  user;
205
205
  role;
206
206
  constructor() {
@@ -223,7 +223,7 @@ class is {
223
223
  };
224
224
  }
225
225
  }
226
- function ht() {
226
+ function yt() {
227
227
  const e = "csrftoken=", r = decodeURIComponent(document.cookie).split(";");
228
228
  for (const s of r) {
229
229
  const n = s.trim();
@@ -232,16 +232,16 @@ function ht() {
232
232
  }
233
233
  return null;
234
234
  }
235
- function ft(e) {
235
+ function gt(e) {
236
236
  let t = e.headers ? { ...e.headers } : {}, r;
237
- return e.body !== void 0 && (r = typeof e.body == "string" || e.body instanceof FormData ? e.body : JSON.stringify(e.body)), t["X-CSRFToken"] = ht() || "", {
237
+ return e.body !== void 0 && (r = typeof e.body == "string" || e.body instanceof FormData ? e.body : JSON.stringify(e.body)), t["X-CSRFToken"] = yt() || "", {
238
238
  ...e,
239
239
  headers: t,
240
240
  body: r,
241
241
  credentials: "omit"
242
242
  };
243
243
  }
244
- function zt(e) {
244
+ function Jt(e) {
245
245
  if (Array.isArray(e?.errors) && e.errors.length && (e = e.errors[0]), typeof e != "object" || e === null)
246
246
  return "An unknown error occurred.";
247
247
  const t = ["message", "detail", "error"];
@@ -249,7 +249,7 @@ function zt(e) {
249
249
  if (e[r]) return e[r];
250
250
  return "An unknown error occurred.";
251
251
  }
252
- async function dt(e) {
252
+ async function mt(e) {
253
253
  if (e.headers.get("Content-Length") === "0" || e.statusText === "No Content")
254
254
  return null;
255
255
  const t = e.headers.get("content-type") || "";
@@ -269,27 +269,27 @@ async function dt(e) {
269
269
  if (e.ok || e.status === 401) return r;
270
270
  const s = {
271
271
  status: e.status,
272
- message: zt(r)
272
+ message: Jt(r)
273
273
  };
274
274
  throw console.error("API response not OK:", s.message), s;
275
275
  }
276
- var ve = function(e, t) {
277
- return ve = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, s) {
276
+ var Te = function(e, t) {
277
+ return Te = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, s) {
278
278
  r.__proto__ = s;
279
279
  } || function(r, s) {
280
280
  for (var n in s) Object.prototype.hasOwnProperty.call(s, n) && (r[n] = s[n]);
281
- }, ve(e, t);
281
+ }, Te(e, t);
282
282
  };
283
- function ue(e, t) {
283
+ function de(e, t) {
284
284
  if (typeof t != "function" && t !== null)
285
285
  throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
286
- ve(e, t);
286
+ Te(e, t);
287
287
  function r() {
288
288
  this.constructor = e;
289
289
  }
290
290
  e.prototype = t === null ? Object.create(t) : (r.prototype = t.prototype, new r());
291
291
  }
292
- function _e(e) {
292
+ function Le(e) {
293
293
  var t = typeof Symbol == "function" && Symbol.iterator, r = t && e[t], s = 0;
294
294
  if (r) return r.call(e);
295
295
  if (e && typeof e.length == "number") return {
@@ -299,7 +299,7 @@ function _e(e) {
299
299
  };
300
300
  throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
301
301
  }
302
- function Ae(e, t) {
302
+ function $e(e, t) {
303
303
  var r = typeof Symbol == "function" && e[Symbol.iterator];
304
304
  if (!r) return e;
305
305
  var s = r.call(e), n, a = [], o;
@@ -316,21 +316,21 @@ function Ae(e, t) {
316
316
  }
317
317
  return a;
318
318
  }
319
- function Te(e, t, r) {
319
+ function Re(e, t, r) {
320
320
  if (r || arguments.length === 2) for (var s = 0, n = t.length, a; s < n; s++)
321
321
  (a || !(s in t)) && (a || (a = Array.prototype.slice.call(t, 0, s)), a[s] = t[s]);
322
322
  return e.concat(a || Array.prototype.slice.call(t));
323
323
  }
324
- function N(e) {
324
+ function G(e) {
325
325
  return typeof e == "function";
326
326
  }
327
- function pt(e) {
327
+ function wt(e) {
328
328
  var t = function(s) {
329
329
  Error.call(s), s.stack = new Error().stack;
330
330
  }, r = e(t);
331
331
  return r.prototype = Object.create(Error.prototype), r.prototype.constructor = r, r;
332
332
  }
333
- var pe = pt(function(e) {
333
+ var we = wt(function(e) {
334
334
  return function(r) {
335
335
  e(this), this.message = r ? r.length + ` errors occurred during unsubscription:
336
336
  ` + r.map(function(s, n) {
@@ -339,13 +339,13 @@ var pe = pt(function(e) {
339
339
  `) : "", this.name = "UnsubscriptionError", this.errors = r;
340
340
  };
341
341
  });
342
- function Le(e, t) {
342
+ function Ie(e, t) {
343
343
  if (e) {
344
344
  var r = e.indexOf(t);
345
345
  0 <= r && e.splice(r, 1);
346
346
  }
347
347
  }
348
- var he = (function() {
348
+ var pe = (function() {
349
349
  function e(t) {
350
350
  this.initialTeardown = t, this.closed = !1, this._parentage = null, this._finalizers = null;
351
351
  }
@@ -357,9 +357,9 @@ var he = (function() {
357
357
  if (o)
358
358
  if (this._parentage = null, Array.isArray(o))
359
359
  try {
360
- for (var i = _e(o), l = i.next(); !l.done; l = i.next()) {
361
- var f = l.value;
362
- f.remove(this);
360
+ for (var i = Le(o), l = i.next(); !l.done; l = i.next()) {
361
+ var d = l.value;
362
+ d.remove(this);
363
363
  }
364
364
  } catch (h) {
365
365
  t = { error: h };
@@ -373,42 +373,42 @@ var he = (function() {
373
373
  else
374
374
  o.remove(this);
375
375
  var u = this.initialTeardown;
376
- if (N(u))
376
+ if (G(u))
377
377
  try {
378
378
  u();
379
379
  } catch (h) {
380
- a = h instanceof pe ? h.errors : [h];
380
+ a = h instanceof we ? h.errors : [h];
381
381
  }
382
- var p = this._finalizers;
383
- if (p) {
382
+ var y = this._finalizers;
383
+ if (y) {
384
384
  this._finalizers = null;
385
385
  try {
386
- for (var g = _e(p), y = g.next(); !y.done; y = g.next()) {
387
- var d = y.value;
386
+ for (var g = Le(y), m = g.next(); !m.done; m = g.next()) {
387
+ var b = m.value;
388
388
  try {
389
- Ne(d);
389
+ Ye(b);
390
390
  } catch (h) {
391
- a = a ?? [], h instanceof pe ? a = Te(Te([], Ae(a)), Ae(h.errors)) : a.push(h);
391
+ a = a ?? [], h instanceof we ? a = Re(Re([], $e(a)), $e(h.errors)) : a.push(h);
392
392
  }
393
393
  }
394
394
  } catch (h) {
395
395
  s = { error: h };
396
396
  } finally {
397
397
  try {
398
- y && !y.done && (n = g.return) && n.call(g);
398
+ m && !m.done && (n = g.return) && n.call(g);
399
399
  } finally {
400
400
  if (s) throw s.error;
401
401
  }
402
402
  }
403
403
  }
404
404
  if (a)
405
- throw new pe(a);
405
+ throw new we(a);
406
406
  }
407
407
  }, e.prototype.add = function(t) {
408
408
  var r;
409
409
  if (t && t !== this)
410
410
  if (this.closed)
411
- Ne(t);
411
+ Ye(t);
412
412
  else {
413
413
  if (t instanceof e) {
414
414
  if (t.closed || t._hasParent(this))
@@ -425,52 +425,52 @@ var he = (function() {
425
425
  this._parentage = Array.isArray(r) ? (r.push(t), r) : r ? [r, t] : t;
426
426
  }, e.prototype._removeParent = function(t) {
427
427
  var r = this._parentage;
428
- r === t ? this._parentage = null : Array.isArray(r) && Le(r, t);
428
+ r === t ? this._parentage = null : Array.isArray(r) && Ie(r, t);
429
429
  }, e.prototype.remove = function(t) {
430
430
  var r = this._finalizers;
431
- r && Le(r, t), t instanceof e && t._removeParent(this);
431
+ r && Ie(r, t), t instanceof e && t._removeParent(this);
432
432
  }, e.EMPTY = (function() {
433
433
  var t = new e();
434
434
  return t.closed = !0, t;
435
435
  })(), e;
436
- })(), yt = he.EMPTY;
437
- function gt(e) {
438
- return e instanceof he || e && "closed" in e && N(e.remove) && N(e.add) && N(e.unsubscribe);
436
+ })(), bt = pe.EMPTY;
437
+ function St(e) {
438
+ return e instanceof pe || e && "closed" in e && G(e.remove) && G(e.add) && G(e.unsubscribe);
439
439
  }
440
- function Ne(e) {
441
- N(e) ? e() : e.unsubscribe();
440
+ function Ye(e) {
441
+ G(e) ? e() : e.unsubscribe();
442
442
  }
443
- var Xt = {
443
+ var Qt = {
444
444
  Promise: void 0
445
- }, Vt = {
445
+ }, Kt = {
446
446
  setTimeout: function(e, t) {
447
447
  for (var r = [], s = 2; s < arguments.length; s++)
448
448
  r[s - 2] = arguments[s];
449
- return setTimeout.apply(void 0, Te([e, t], Ae(r)));
449
+ return setTimeout.apply(void 0, Re([e, t], $e(r)));
450
450
  },
451
451
  clearTimeout: function(e) {
452
452
  return clearTimeout(e);
453
453
  },
454
454
  delegate: void 0
455
455
  };
456
- function qt(e) {
457
- Vt.setTimeout(function() {
456
+ function Zt(e) {
457
+ Kt.setTimeout(function() {
458
458
  throw e;
459
459
  });
460
460
  }
461
- function Be() {
461
+ function Ge() {
462
462
  }
463
- function ae(e) {
463
+ function ce(e) {
464
464
  e();
465
465
  }
466
- var mt = (function(e) {
467
- ue(t, e);
466
+ var Et = (function(e) {
467
+ de(t, e);
468
468
  function t(r) {
469
469
  var s = e.call(this) || this;
470
- return s.isStopped = !1, r ? (s.destination = r, gt(r) && r.add(s)) : s.destination = Qt, s;
470
+ return s.isStopped = !1, r ? (s.destination = r, St(r) && r.add(s)) : s.destination = rr, s;
471
471
  }
472
472
  return t.create = function(r, s, n) {
473
- return new $e(r, s, n);
473
+ return new Oe(r, s, n);
474
474
  }, t.prototype.next = function(r) {
475
475
  this.isStopped || this._next(r);
476
476
  }, t.prototype.error = function(r) {
@@ -494,7 +494,7 @@ var mt = (function(e) {
494
494
  this.unsubscribe();
495
495
  }
496
496
  }, t;
497
- })(he), Jt = (function() {
497
+ })(pe), er = (function() {
498
498
  function e(t) {
499
499
  this.partialObserver = t;
500
500
  }
@@ -504,7 +504,7 @@ var mt = (function(e) {
504
504
  try {
505
505
  r.next(t);
506
506
  } catch (s) {
507
- te(s);
507
+ ne(s);
508
508
  }
509
509
  }, e.prototype.error = function(t) {
510
510
  var r = this.partialObserver;
@@ -512,56 +512,56 @@ var mt = (function(e) {
512
512
  try {
513
513
  r.error(t);
514
514
  } catch (s) {
515
- te(s);
515
+ ne(s);
516
516
  }
517
517
  else
518
- te(t);
518
+ ne(t);
519
519
  }, e.prototype.complete = function() {
520
520
  var t = this.partialObserver;
521
521
  if (t.complete)
522
522
  try {
523
523
  t.complete();
524
524
  } catch (r) {
525
- te(r);
525
+ ne(r);
526
526
  }
527
527
  }, e;
528
- })(), $e = (function(e) {
529
- ue(t, e);
528
+ })(), Oe = (function(e) {
529
+ de(t, e);
530
530
  function t(r, s, n) {
531
531
  var a = e.call(this) || this, o;
532
- return N(r) || !r ? o = {
532
+ return G(r) || !r ? o = {
533
533
  next: r ?? void 0,
534
534
  error: s ?? void 0,
535
535
  complete: n ?? void 0
536
- } : o = r, a.destination = new Jt(o), a;
536
+ } : o = r, a.destination = new er(o), a;
537
537
  }
538
538
  return t;
539
- })(mt);
540
- function te(e) {
541
- qt(e);
539
+ })(Et);
540
+ function ne(e) {
541
+ Zt(e);
542
542
  }
543
- function Kt(e) {
543
+ function tr(e) {
544
544
  throw e;
545
545
  }
546
- var Qt = {
546
+ var rr = {
547
547
  closed: !0,
548
- next: Be,
549
- error: Kt,
550
- complete: Be
551
- }, Zt = (function() {
548
+ next: Ge,
549
+ error: tr,
550
+ complete: Ge
551
+ }, sr = (function() {
552
552
  return typeof Symbol == "function" && Symbol.observable || "@@observable";
553
553
  })();
554
- function er(e) {
554
+ function nr(e) {
555
555
  return e;
556
556
  }
557
- function tr(e) {
558
- return e.length === 0 ? er : e.length === 1 ? e[0] : function(r) {
557
+ function or(e) {
558
+ return e.length === 0 ? nr : e.length === 1 ? e[0] : function(r) {
559
559
  return e.reduce(function(s, n) {
560
560
  return n(s);
561
561
  }, r);
562
562
  };
563
563
  }
564
- var je = (function() {
564
+ var He = (function() {
565
565
  function e(t) {
566
566
  t && (this._subscribe = t);
567
567
  }
@@ -569,8 +569,8 @@ var je = (function() {
569
569
  var r = new e();
570
570
  return r.source = this, r.operator = t, r;
571
571
  }, e.prototype.subscribe = function(t, r, s) {
572
- var n = this, a = sr(t) ? t : new $e(t, r, s);
573
- return ae(function() {
572
+ var n = this, a = ir(t) ? t : new Oe(t, r, s);
573
+ return ce(function() {
574
574
  var o = n, i = o.operator, l = o.source;
575
575
  a.add(i ? i.call(a, l) : l ? n._subscribe(a) : n._trySubscribe(a));
576
576
  }), a;
@@ -582,8 +582,8 @@ var je = (function() {
582
582
  }
583
583
  }, e.prototype.forEach = function(t, r) {
584
584
  var s = this;
585
- return r = We(r), new r(function(n, a) {
586
- var o = new $e({
585
+ return r = ze(r), new r(function(n, a) {
586
+ var o = new Oe({
587
587
  next: function(i) {
588
588
  try {
589
589
  t(i);
@@ -599,15 +599,15 @@ var je = (function() {
599
599
  }, e.prototype._subscribe = function(t) {
600
600
  var r;
601
601
  return (r = this.source) === null || r === void 0 ? void 0 : r.subscribe(t);
602
- }, e.prototype[Zt] = function() {
602
+ }, e.prototype[sr] = function() {
603
603
  return this;
604
604
  }, e.prototype.pipe = function() {
605
605
  for (var t = [], r = 0; r < arguments.length; r++)
606
606
  t[r] = arguments[r];
607
- return tr(t)(this);
607
+ return or(t)(this);
608
608
  }, e.prototype.toPromise = function(t) {
609
609
  var r = this;
610
- return t = We(t), new t(function(s, n) {
610
+ return t = ze(t), new t(function(s, n) {
611
611
  var a;
612
612
  r.subscribe(function(o) {
613
613
  return a = o;
@@ -621,45 +621,45 @@ var je = (function() {
621
621
  return new e(t);
622
622
  }, e;
623
623
  })();
624
- function We(e) {
624
+ function ze(e) {
625
625
  var t;
626
- return (t = e ?? Xt.Promise) !== null && t !== void 0 ? t : Promise;
626
+ return (t = e ?? Qt.Promise) !== null && t !== void 0 ? t : Promise;
627
627
  }
628
- function rr(e) {
629
- return e && N(e.next) && N(e.error) && N(e.complete);
628
+ function ar(e) {
629
+ return e && G(e.next) && G(e.error) && G(e.complete);
630
630
  }
631
- function sr(e) {
632
- return e && e instanceof mt || rr(e) && gt(e);
631
+ function ir(e) {
632
+ return e && e instanceof Et || ar(e) && St(e);
633
633
  }
634
- var nr = pt(function(e) {
634
+ var cr = wt(function(e) {
635
635
  return function() {
636
636
  e(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
637
637
  };
638
- }), wt = (function(e) {
639
- ue(t, e);
638
+ }), vt = (function(e) {
639
+ de(t, e);
640
640
  function t() {
641
641
  var r = e.call(this) || this;
642
642
  return r.closed = !1, r.currentObservers = null, r.observers = [], r.isStopped = !1, r.hasError = !1, r.thrownError = null, r;
643
643
  }
644
644
  return t.prototype.lift = function(r) {
645
- var s = new Ge(this, this);
645
+ var s = new Xe(this, this);
646
646
  return s.operator = r, s;
647
647
  }, t.prototype._throwIfClosed = function() {
648
648
  if (this.closed)
649
- throw new nr();
649
+ throw new cr();
650
650
  }, t.prototype.next = function(r) {
651
651
  var s = this;
652
- ae(function() {
652
+ ce(function() {
653
653
  var n, a;
654
654
  if (s._throwIfClosed(), !s.isStopped) {
655
655
  s.currentObservers || (s.currentObservers = Array.from(s.observers));
656
656
  try {
657
- for (var o = _e(s.currentObservers), i = o.next(); !i.done; i = o.next()) {
657
+ for (var o = Le(s.currentObservers), i = o.next(); !i.done; i = o.next()) {
658
658
  var l = i.value;
659
659
  l.next(r);
660
660
  }
661
- } catch (f) {
662
- n = { error: f };
661
+ } catch (d) {
662
+ n = { error: d };
663
663
  } finally {
664
664
  try {
665
665
  i && !i.done && (a = o.return) && a.call(o);
@@ -671,7 +671,7 @@ var nr = pt(function(e) {
671
671
  });
672
672
  }, t.prototype.error = function(r) {
673
673
  var s = this;
674
- ae(function() {
674
+ ce(function() {
675
675
  if (s._throwIfClosed(), !s.isStopped) {
676
676
  s.hasError = s.isStopped = !0, s.thrownError = r;
677
677
  for (var n = s.observers; n.length; )
@@ -680,7 +680,7 @@ var nr = pt(function(e) {
680
680
  });
681
681
  }, t.prototype.complete = function() {
682
682
  var r = this;
683
- ae(function() {
683
+ ce(function() {
684
684
  if (r._throwIfClosed(), !r.isStopped) {
685
685
  r.isStopped = !0;
686
686
  for (var s = r.observers; s.length; )
@@ -702,20 +702,20 @@ var nr = pt(function(e) {
702
702
  return this._throwIfClosed(), this._checkFinalizedStatuses(r), this._innerSubscribe(r);
703
703
  }, t.prototype._innerSubscribe = function(r) {
704
704
  var s = this, n = this, a = n.hasError, o = n.isStopped, i = n.observers;
705
- return a || o ? yt : (this.currentObservers = null, i.push(r), new he(function() {
706
- s.currentObservers = null, Le(i, r);
705
+ return a || o ? bt : (this.currentObservers = null, i.push(r), new pe(function() {
706
+ s.currentObservers = null, Ie(i, r);
707
707
  }));
708
708
  }, t.prototype._checkFinalizedStatuses = function(r) {
709
709
  var s = this, n = s.hasError, a = s.thrownError, o = s.isStopped;
710
710
  n ? r.error(a) : o && r.complete();
711
711
  }, t.prototype.asObservable = function() {
712
- var r = new je();
712
+ var r = new He();
713
713
  return r.source = this, r;
714
714
  }, t.create = function(r, s) {
715
- return new Ge(r, s);
715
+ return new Xe(r, s);
716
716
  }, t;
717
- })(je), Ge = (function(e) {
718
- ue(t, e);
717
+ })(He), Xe = (function(e) {
718
+ de(t, e);
719
719
  function t(r, s) {
720
720
  var n = e.call(this) || this;
721
721
  return n.destination = r, n.source = s, n;
@@ -731,29 +731,29 @@ var nr = pt(function(e) {
731
731
  (s = (r = this.destination) === null || r === void 0 ? void 0 : r.complete) === null || s === void 0 || s.call(r);
732
732
  }, t.prototype._subscribe = function(r) {
733
733
  var s, n;
734
- return (n = (s = this.source) === null || s === void 0 ? void 0 : s.subscribe(r)) !== null && n !== void 0 ? n : yt;
734
+ return (n = (s = this.source) === null || s === void 0 ? void 0 : s.subscribe(r)) !== null && n !== void 0 ? n : bt;
735
735
  }, t;
736
- })(wt);
737
- const bt = 3e3;
738
- var St = /* @__PURE__ */ ((e) => (e.Warning = "warning", e.Success = "success", e.Error = "error", e.Info = "info", e))(St || {}), Et = /* @__PURE__ */ ((e) => (e.Success = "mdi-checkbox-marked-circle", e.Warning = "mdi-alert", e.Error = "mdi-alert-circle", e.Info = "mdi-information", e.None = "none", e))(Et || {}), kt = /* @__PURE__ */ ((e) => (e.Warning = "Warning", e.Success = "Success", e.Error = "Error", e.Info = "Info", e))(kt || {}), or = /* @__PURE__ */ ((e) => (e.Center = "center", e.Left = "left", e.Right = "right", e.Bottom = "bottom", e.Top = "top", e))(or || {});
739
- class ar {
740
- constructor(t = "", r = "info", s = "none", n = "Info", a = bt, o = "center", i = !1) {
736
+ })(vt);
737
+ const kt = 3e3;
738
+ var _t = /* @__PURE__ */ ((e) => (e.Warning = "warning", e.Success = "success", e.Error = "error", e.Info = "info", e))(_t || {}), At = /* @__PURE__ */ ((e) => (e.Success = "mdi-checkbox-marked-circle", e.Warning = "mdi-alert", e.Error = "mdi-alert-circle", e.Info = "mdi-information", e.None = "none", e))(At || {}), Tt = /* @__PURE__ */ ((e) => (e.Warning = "Warning", e.Success = "Success", e.Error = "Error", e.Info = "Info", e))(Tt || {}), lr = /* @__PURE__ */ ((e) => (e.Center = "center", e.Left = "left", e.Right = "right", e.Bottom = "bottom", e.Top = "top", e))(lr || {});
739
+ class ur {
740
+ constructor(t = "", r = "info", s = "none", n = "Info", a = kt, o = "center", i = !1) {
741
741
  this.message = t, this.color = r, this.icon = s, this.title = n, this.timeout = a, this.position = o, this.visible = i;
742
742
  }
743
743
  }
744
- class ir {
745
- static subject = new wt();
744
+ class hr {
745
+ static subject = new vt();
746
746
  static get snack$() {
747
747
  return this.subject.asObservable();
748
748
  }
749
749
  static createSnackbar(t, r) {
750
750
  this.subject.next(
751
- new ar(
751
+ new ur(
752
752
  t,
753
- St[r],
754
- Et[r],
755
- kt[r],
756
- bt,
753
+ _t[r],
754
+ At[r],
755
+ Tt[r],
756
+ kt,
757
757
  "bottom",
758
758
  !0
759
759
  )
@@ -788,24 +788,24 @@ class ir {
788
788
  );
789
789
  }
790
790
  }
791
- function vt(e, t) {
791
+ function Lt(e, t) {
792
792
  const r = {};
793
793
  for (let s in t)
794
794
  if (Array.isArray(t[s]))
795
795
  JSON.stringify(e[s]) !== JSON.stringify(t[s]) && (r[s] = t[s]);
796
796
  else if (e[s] && typeof e[s] == "object" && t[s] && typeof t[s] == "object") {
797
- const n = vt(e[s], t[s]);
797
+ const n = Lt(e[s], t[s]);
798
798
  Object.keys(n).length > 0 && (r[s] = n);
799
799
  } else JSON.stringify(e[s]) !== JSON.stringify(t[s]) && (r[s] = t[s]);
800
800
  return r;
801
801
  }
802
- function cr(e) {
802
+ function fr(e) {
803
803
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
804
804
  }
805
- var ye, Ye;
806
- function lr() {
807
- if (Ye) return ye;
808
- Ye = 1;
805
+ var be, Ve;
806
+ function dr() {
807
+ if (Ve) return be;
808
+ Ve = 1;
809
809
  class e {
810
810
  /// value;
811
811
  /// next;
@@ -842,33 +842,33 @@ function lr() {
842
842
  yield s.value, s = s.next;
843
843
  }
844
844
  }
845
- return ye = t, ye;
845
+ return be = t, be;
846
846
  }
847
- var ge, He;
848
- function ur() {
849
- if (He) return ge;
850
- He = 1;
851
- const e = lr();
852
- return ge = (r) => {
847
+ var Se, qe;
848
+ function pr() {
849
+ if (qe) return Se;
850
+ qe = 1;
851
+ const e = dr();
852
+ return Se = (r) => {
853
853
  if (!((Number.isInteger(r) || r === 1 / 0) && r > 0))
854
854
  throw new TypeError("Expected `concurrency` to be a number from 1 and up");
855
855
  const s = new e();
856
856
  let n = 0;
857
857
  const a = () => {
858
858
  n--, s.size > 0 && s.dequeue()();
859
- }, o = async (f, u, ...p) => {
859
+ }, o = async (d, u, ...y) => {
860
860
  n++;
861
- const g = (async () => f(...p))();
861
+ const g = (async () => d(...y))();
862
862
  u(g);
863
863
  try {
864
864
  await g;
865
865
  } catch {
866
866
  }
867
867
  a();
868
- }, i = (f, u, ...p) => {
869
- s.enqueue(o.bind(null, f, u, ...p)), (async () => (await Promise.resolve(), n < r && s.size > 0 && s.dequeue()()))();
870
- }, l = (f, ...u) => new Promise((p) => {
871
- i(f, p, ...u);
868
+ }, i = (d, u, ...y) => {
869
+ s.enqueue(o.bind(null, d, u, ...y)), (async () => (await Promise.resolve(), n < r && s.size > 0 && s.dequeue()()))();
870
+ }, l = (d, ...u) => new Promise((y) => {
871
+ i(d, y, ...u);
872
872
  });
873
873
  return Object.defineProperties(l, {
874
874
  activeCount: {
@@ -883,45 +883,45 @@ function ur() {
883
883
  }
884
884
  }
885
885
  }), l;
886
- }, ge;
886
+ }, Se;
887
887
  }
888
- var hr = ur();
889
- const fr = /* @__PURE__ */ cr(hr), Y = fr(10), dr = 1e3;
890
- async function X(e, t) {
891
- const r = ft(t);
888
+ var yr = pr();
889
+ const gr = /* @__PURE__ */ fr(yr), z = gr(10), mr = 1e3;
890
+ async function q(e, t) {
891
+ const r = gt(t);
892
892
  try {
893
893
  const s = await fetch(e, r);
894
- return await dt(s);
894
+ return await mt(s);
895
895
  } catch (s) {
896
- throw s instanceof TypeError && ir.error("Network error. Please check your connection."), s;
896
+ throw s instanceof TypeError && hr.error("Network error. Please check your connection."), s;
897
897
  }
898
898
  }
899
899
  const c = {
900
900
  async fetch(e, t = {}) {
901
- return t.method = "GET", await Y(() => X(e, t));
901
+ return t.method = "GET", await z(() => q(e, t));
902
902
  },
903
903
  async patch(e, t, r = null, s = {}) {
904
- if (s.method = "PATCH", s.body = r ? vt(r, t) : t, Object.keys(s.body).length !== 0)
905
- return await Y(() => X(e, s));
904
+ if (s.method = "PATCH", s.body = r ? Lt(r, t) : t, Object.keys(s.body).length !== 0)
905
+ return await z(() => q(e, s));
906
906
  },
907
907
  async post(e, t = void 0, r = {}) {
908
- return r.method = "POST", r.body = t, await Y(() => X(e, r));
908
+ return r.method = "POST", r.body = t, await z(() => q(e, r));
909
909
  },
910
910
  async put(e, t = void 0, r = {}) {
911
- return r.method = "PUT", r.body = t, await Y(() => X(e, r));
911
+ return r.method = "PUT", r.body = t, await z(() => q(e, r));
912
912
  },
913
913
  async delete(e, t = void 0, r = {}) {
914
- return r.method = "DELETE", r.body = t, await Y(() => X(e, r));
914
+ return r.method = "DELETE", r.body = t, await z(() => q(e, r));
915
915
  },
916
916
  async paginatedFetch(e, t) {
917
- const r = t ?? dr, s = e.includes("?") ? "&" : "?", n = `${e}${s}page_size=${r}&page=1`, a = ft({ method: "GET" }), o = await Y(() => fetch(n, a)), i = Number(o.headers.get("x-total-pages")) || 1, f = [...await dt(o)];
917
+ const r = t ?? mr, s = e.includes("?") ? "&" : "?", n = `${e}${s}page_size=${r}&page=1`, a = gt({ method: "GET" }), o = await z(() => fetch(n, a)), i = Number(o.headers.get("x-total-pages")) || 1, d = [...await mt(o)];
918
918
  for (let u = 2; u <= i; u++) {
919
- const p = `${e}${s}page_size=${r}&page=${u}`, g = await Y(() => X(p, { method: "GET" }));
920
- f.push(...g);
919
+ const y = `${e}${s}page_size=${r}&page=${u}`, g = await z(() => q(y, { method: "GET" }));
920
+ d.push(...g);
921
921
  }
922
- return f;
922
+ return d;
923
923
  }
924
- }, ze = {
924
+ }, Je = {
925
925
  HTTP: {
926
926
  type: "HTTP",
927
927
  sourceUri: "",
@@ -932,7 +932,7 @@ const c = {
932
932
  sourceUri: "",
933
933
  placeholderVariables: []
934
934
  }
935
- }, Xe = {
935
+ }, Qe = {
936
936
  JSON: {
937
937
  type: "JSON",
938
938
  timestamp: {
@@ -955,18 +955,18 @@ const c = {
955
955
  identifierType: "name"
956
956
  /* Name */
957
957
  }
958
- }, Ve = {
958
+ }, Ke = {
959
959
  HydroServer: {
960
960
  type: "HydroServer"
961
961
  }
962
962
  };
963
- class cs {
963
+ class ys {
964
964
  name = "";
965
965
  settings = {
966
966
  type: "SDL",
967
- extractor: JSON.parse(JSON.stringify(ze.local)),
968
- transformer: JSON.parse(JSON.stringify(Xe.CSV)),
969
- loader: JSON.parse(JSON.stringify(Ve.HydroServer)),
967
+ extractor: JSON.parse(JSON.stringify(Je.local)),
968
+ transformer: JSON.parse(JSON.stringify(Qe.CSV)),
969
+ loader: JSON.parse(JSON.stringify(Ke.HydroServer)),
970
970
  payloads: []
971
971
  };
972
972
  id = "";
@@ -988,19 +988,19 @@ class cs {
988
988
  }
989
989
  switchExtractor(t) {
990
990
  this.settings.extractor = JSON.parse(
991
- JSON.stringify(ze[t])
991
+ JSON.stringify(Je[t])
992
992
  );
993
993
  }
994
994
  switchTransformer(t) {
995
995
  this.settings.transformer = JSON.parse(
996
- JSON.stringify(Xe[t])
996
+ JSON.stringify(Qe[t])
997
997
  );
998
998
  }
999
999
  switchLoader(t) {
1000
- this.settings.loader = JSON.parse(JSON.stringify(Ve[t]));
1000
+ this.settings.loader = JSON.parse(JSON.stringify(Ke[t]));
1001
1001
  }
1002
1002
  }
1003
- function qe(e) {
1003
+ function Ze(e) {
1004
1004
  return {
1005
1005
  name: e.name,
1006
1006
  settings: e.settings,
@@ -1010,16 +1010,16 @@ function qe(e) {
1010
1010
  status: e.status
1011
1011
  };
1012
1012
  }
1013
- const D = "https://lro.hydroserver.org/api", Ue = `${D}/auth`, C = `${Ue}/browser/account`, me = `${Ue}/browser/session`, ie = `${Ue}/browser/provider`, $ = `${D}/data/workspaces`, we = `${D}/data/roles`, R = `${D}/data/datastreams`, j = `${D}/data/sensors`, _ = `${D}/data/things`, Je = `${_}/tags`, V = `${D}/data/orchestration-systems`, x = `${D}/data/data-sources`, H = `${D}/data/observed-properties`, q = `${D}/data/processing-levels`, K = `${D}/data/result-qualifiers`, z = `${D}/data/units`, ls = (e, t, r, s, n) => {
1014
- let a = `${R}/${e}/observations?format=column`;
1013
+ const C = "https://lro.hydroserver.org/api", De = `${C}/auth`, N = `${De}/browser/account`, Ee = `${De}/browser/session`, le = `${De}/browser/provider`, R = `${C}/data/workspaces`, ve = `${C}/data/roles`, O = `${C}/data/datastreams`, H = `${C}/data/sensors`, A = `${C}/data/things`, et = `${A}/tags`, J = `${C}/data/orchestration-systems`, Y = `${C}/data/data-sources`, X = `${C}/data/observed-properties`, Q = `${C}/data/processing-levels`, ee = `${C}/data/result-qualifiers`, V = `${C}/data/units`, gs = (e, t, r, s, n) => {
1014
+ let a = `${O}/${e}/observations?format=column`;
1015
1015
  return a += `&order_by=phenomenonTime&page_size=${t}`, a += `&phenomenon_time_min=${encodeURIComponent(r)}`, s && (a += `&phenomenon_time_max=${encodeURIComponent(s)}`), n && (a += `&page=${n}`), a;
1016
- }, pr = (e, t, r) => {
1016
+ }, wr = (e, t, r) => {
1017
1017
  const s = {
1018
1018
  provider: e,
1019
1019
  callback_url: t,
1020
1020
  process: r
1021
- }, n = ht(), a = document.createElement("form");
1022
- if (a.method = "POST", a.action = `${ie}/redirect`, n) {
1021
+ }, n = yt(), a = document.createElement("form");
1022
+ if (a.method = "POST", a.action = `${le}/redirect`, n) {
1023
1023
  const o = document.createElement("input");
1024
1024
  o.type = "hidden", o.name = "csrfmiddlewaretoken", o.value = n, a.appendChild(o);
1025
1025
  }
@@ -1028,59 +1028,59 @@ const D = "https://lro.hydroserver.org/api", Ue = `${D}/auth`, C = `${Ue}/browse
1028
1028
  i.type = "hidden", i.name = o, i.value = s[o] || "", a.appendChild(i);
1029
1029
  }
1030
1030
  document.body.appendChild(a), a.submit();
1031
- }, us = {
1032
- fetchSession: async () => c.fetch(`${me}`),
1033
- login: async (e, t) => c.post(`${me}`, { email: e, password: t }),
1034
- logout: async () => c.delete(`${me}`),
1035
- fetchUser: async () => c.fetch(`${C}`),
1036
- signup: async (e) => c.post(`${C}`, e),
1037
- updateUser: async (e, t) => c.patch(`${C}`, e, t),
1038
- deleteUser: async () => c.delete(`${C}`),
1039
- sendVerificationEmail: async (e) => c.put(`${C}/email/verify`, {
1031
+ }, ms = {
1032
+ fetchSession: async () => c.fetch(`${Ee}`),
1033
+ login: async (e, t) => c.post(`${Ee}`, { email: e, password: t }),
1034
+ logout: async () => c.delete(`${Ee}`),
1035
+ fetchUser: async () => c.fetch(`${N}`),
1036
+ signup: async (e) => c.post(`${N}`, e),
1037
+ updateUser: async (e, t) => c.patch(`${N}`, e, t),
1038
+ deleteUser: async () => c.delete(`${N}`),
1039
+ sendVerificationEmail: async (e) => c.put(`${N}/email/verify`, {
1040
1040
  email: e
1041
1041
  }),
1042
- verifyEmailWithCode: async (e) => c.post(`${C}/email/verify`, { key: e }),
1043
- requestPasswordReset: async (e) => c.post(`${C}/password/request`, {
1042
+ verifyEmailWithCode: async (e) => c.post(`${N}/email/verify`, { key: e }),
1043
+ requestPasswordReset: async (e) => c.post(`${N}/password/request`, {
1044
1044
  email: e
1045
1045
  }),
1046
- resetPassword: async (e, t) => c.post(`${C}/password/reset`, {
1046
+ resetPassword: async (e, t) => c.post(`${N}/password/reset`, {
1047
1047
  key: e,
1048
1048
  password: t
1049
1049
  }),
1050
- fetchWorkspaces: async () => c.paginatedFetch(`${$}`),
1051
- fetchAssociatedWorkspaces: async () => c.paginatedFetch(`${$}?is_associated=true`),
1052
- fetchWorkspace: async (e) => c.fetch(`${$}/${e}`),
1053
- createWorkspace: async (e) => c.post($, e),
1050
+ fetchWorkspaces: async () => c.paginatedFetch(`${R}`),
1051
+ fetchAssociatedWorkspaces: async () => c.paginatedFetch(`${R}?is_associated=true`),
1052
+ fetchWorkspace: async (e) => c.fetch(`${R}/${e}`),
1053
+ createWorkspace: async (e) => c.post(R, e),
1054
1054
  updateWorkspace: async (e, t = null) => c.patch(
1055
- `${$}/${e.id}`,
1055
+ `${R}/${e.id}`,
1056
1056
  e,
1057
1057
  t
1058
1058
  ),
1059
- deleteWorkspace: async (e) => c.delete(`${$}/${e}`),
1060
- transferWorkspace: async (e, t) => c.post(`${$}/${e}/transfer`, { newOwner: t }),
1061
- acceptWorkspaceTransfer: async (e) => c.put(`${$}/${e}/transfer`),
1062
- rejectWorkspaceTransfer: async (e) => c.delete(`${$}/${e}/transfer`),
1063
- getCollaboratorRoles: async (e) => c.paginatedFetch(`${we}?is_user_role=true`),
1064
- getAPIKeyRoles: async (e) => c.paginatedFetch(`${we}?is_apikey_role=true`),
1065
- getRole: async (e) => c.fetch(`${we}/${e}`),
1066
- getCollaborators: async (e) => c.paginatedFetch(`${$}/${e}/collaborators`),
1067
- addCollaborator: async (e, t, r) => c.post(`${$}/${e}/collaborators`, {
1059
+ deleteWorkspace: async (e) => c.delete(`${R}/${e}`),
1060
+ transferWorkspace: async (e, t) => c.post(`${R}/${e}/transfer`, { newOwner: t }),
1061
+ acceptWorkspaceTransfer: async (e) => c.put(`${R}/${e}/transfer`),
1062
+ rejectWorkspaceTransfer: async (e) => c.delete(`${R}/${e}/transfer`),
1063
+ getCollaboratorRoles: async (e) => c.paginatedFetch(`${ve}?is_user_role=true`),
1064
+ getAPIKeyRoles: async (e) => c.paginatedFetch(`${ve}?is_apikey_role=true`),
1065
+ getRole: async (e) => c.fetch(`${ve}/${e}`),
1066
+ getCollaborators: async (e) => c.paginatedFetch(`${R}/${e}/collaborators`),
1067
+ addCollaborator: async (e, t, r) => c.post(`${R}/${e}/collaborators`, {
1068
1068
  email: t,
1069
1069
  roleId: r
1070
1070
  }),
1071
- updateCollaboratorRole: async (e, t, r) => c.put(`${$}/${e}/collaborators`, {
1071
+ updateCollaboratorRole: async (e, t, r) => c.put(`${R}/${e}/collaborators`, {
1072
1072
  email: t,
1073
1073
  roleId: r
1074
1074
  }),
1075
- removeCollaborator: async (e, t) => c.delete(`${$}/${e}/collaborators`, { email: t }),
1075
+ removeCollaborator: async (e, t) => c.delete(`${R}/${e}/collaborators`, { email: t }),
1076
1076
  fetchApiKeys: async (e) => c.paginatedFetch(
1077
- `${$}/${e}/api-keys?expand_related=true`
1077
+ `${R}/${e}/api-keys?expand_related=true`
1078
1078
  ),
1079
1079
  fetchApiKey: async (e, t) => c.fetch(
1080
- `${$}/${e}/api-keys/${t}?expand_related=true`
1080
+ `${R}/${e}/api-keys/${t}?expand_related=true`
1081
1081
  ),
1082
1082
  createApiKey: async (e) => c.post(
1083
- `${$}/${e.workspaceId}/api-keys?expand_related=true`,
1083
+ `${R}/${e.workspaceId}/api-keys?expand_related=true`,
1084
1084
  {
1085
1085
  name: e.name,
1086
1086
  description: e.description,
@@ -1089,7 +1089,7 @@ const D = "https://lro.hydroserver.org/api", Ue = `${D}/auth`, C = `${Ue}/browse
1089
1089
  }
1090
1090
  ),
1091
1091
  updateApiKey: async (e, t) => c.patch(
1092
- `${$}/${e.workspaceId}/api-keys/${e.id}?expand_related=true`,
1092
+ `${R}/${e.workspaceId}/api-keys/${e.id}?expand_related=true`,
1093
1093
  {
1094
1094
  name: e.name,
1095
1095
  description: e.description,
@@ -1104,159 +1104,159 @@ const D = "https://lro.hydroserver.org/api", Ue = `${D}/auth`, C = `${Ue}/browse
1104
1104
  }
1105
1105
  ),
1106
1106
  regenerateApiKey: async (e, t) => c.put(
1107
- `${$}/${e}/api-keys/${t}/regenerate?expand_related=true`
1107
+ `${R}/${e}/api-keys/${t}/regenerate?expand_related=true`
1108
1108
  ),
1109
- deleteApiKey: async (e, t) => c.delete(`${$}/${e}/api-keys/${t}`),
1110
- fetchConnectedProviders: async () => c.fetch(`${ie}/connections`),
1111
- providerRedirect: pr,
1112
- providerSignup: async (e) => c.post(`${ie}/signup`, e),
1113
- deleteProvider: async (e, t) => c.delete(`${ie}/connections`, {
1109
+ deleteApiKey: async (e, t) => c.delete(`${R}/${e}/api-keys/${t}`),
1110
+ fetchConnectedProviders: async () => c.fetch(`${le}/connections`),
1111
+ providerRedirect: wr,
1112
+ providerSignup: async (e) => c.post(`${le}/signup`, e),
1113
+ deleteProvider: async (e, t) => c.delete(`${le}/connections`, {
1114
1114
  provider: e,
1115
1115
  account: t
1116
1116
  }),
1117
- createUnit: async (e) => c.post(z, e),
1118
- fetchUnits: async () => c.paginatedFetch(`${z}`),
1119
- fetchWorkspaceUnits: async (e) => c.paginatedFetch(`${z}?workspace_id=${e}`),
1120
- updateUnit: async (e, t = null) => c.patch(`${z}/${e.id}`, e, t),
1121
- deleteUnit: async (e) => c.delete(`${z}/${e}`),
1122
- getUnit: async (e) => c.fetch(`${z}/${e}`),
1123
- removeThingOwner: async (e, t) => c.patch(`${_}/${e}/ownership`, {
1117
+ createUnit: async (e) => c.post(V, e),
1118
+ fetchUnits: async () => c.paginatedFetch(`${V}`),
1119
+ fetchWorkspaceUnits: async (e) => c.paginatedFetch(`${V}?workspace_id=${e}`),
1120
+ updateUnit: async (e, t = null) => c.patch(`${V}/${e.id}`, e, t),
1121
+ deleteUnit: async (e) => c.delete(`${V}/${e}`),
1122
+ getUnit: async (e) => c.fetch(`${V}/${e}`),
1123
+ removeThingOwner: async (e, t) => c.patch(`${A}/${e}/ownership`, {
1124
1124
  email: t,
1125
1125
  removeOwner: !0
1126
1126
  }),
1127
- addSecondaryOwner: async (e, t) => c.patch(`${_}/${e}/ownership`, {
1127
+ addSecondaryOwner: async (e, t) => c.patch(`${A}/${e}/ownership`, {
1128
1128
  email: t,
1129
1129
  makeOwner: !0
1130
1130
  }),
1131
- transferPrimaryOwnership: async (e, t) => c.patch(`${_}/${e}/ownership`, {
1131
+ transferPrimaryOwnership: async (e, t) => c.patch(`${A}/${e}/ownership`, {
1132
1132
  email: t,
1133
1133
  transferPrimary: !0
1134
1134
  }),
1135
- createThing: async (e) => c.post(_, e),
1136
- fetchThings: async () => c.paginatedFetch(`${_}`),
1137
- fetchThingsForWorkspace: async (e) => c.paginatedFetch(`${_}?workspace_id=${e}`),
1138
- fetchOwnedThings: async () => c.paginatedFetch(`${_}?owned_only=true`),
1139
- fetchThing: async (e) => c.fetch(`${_}/${e}`),
1140
- updateThing: async (e) => c.patch(`${_}/${e.id}`, e),
1141
- updateThingPrivacy: async (e, t) => c.patch(`${_}/${e}`, { isPrivate: t }),
1142
- deleteThing: async (e) => c.delete(`${_}/${e}`),
1135
+ createThing: async (e) => c.post(A, e),
1136
+ fetchThings: async () => c.paginatedFetch(`${A}`),
1137
+ fetchThingsForWorkspace: async (e) => c.paginatedFetch(`${A}?workspace_id=${e}`),
1138
+ fetchOwnedThings: async () => c.paginatedFetch(`${A}?owned_only=true`),
1139
+ fetchThing: async (e) => c.fetch(`${A}/${e}`),
1140
+ updateThing: async (e) => c.patch(`${A}/${e.id}`, e),
1141
+ updateThingPrivacy: async (e, t) => c.patch(`${A}/${e}`, { isPrivate: t }),
1142
+ deleteThing: async (e) => c.delete(`${A}/${e}`),
1143
1143
  fetchMetadataForThingOwner: async (e) => c.paginatedFetch(
1144
- `${_}/${e}/metadata?include_assignable_metadata=true`
1144
+ `${A}/${e}/metadata?include_assignable_metadata=true`
1145
1145
  ),
1146
- fetchMetadataForThing: async (e) => c.fetch(`${_}/${e}/metadata`),
1147
- uploadSitePhotos: async (e, t) => c.post(`${_}/${e}/photos`, t),
1148
- fetchSitePhotos: async (e) => c.paginatedFetch(`${_}/${e}/photos`),
1149
- deleteSitePhoto: async (e, t) => c.delete(`${_}/${e}/photos`, { name: t }),
1150
- createSiteTag: async (e, t) => c.post(`${_}/${e}/tags`, t),
1151
- editSiteTag: async (e, t) => c.put(`${_}/${e}/tags`, t),
1152
- fetchSiteTags: async (e) => c.fetch(`${_}/${e}/tags`),
1153
- fetchUsersSiteTags: async () => c.fetch(`${Je}`),
1154
- deleteSiteTag: async (e, t) => c.delete(`${_}/${e}/tags`, t),
1155
- fetchWorkspaceTags: async (e) => c.fetch(`${Je}/keys?workspace_id=${e}`),
1156
- createHydroShareArchive: async (e) => c.post(`${_}/${e.thingId}/archive`, e),
1146
+ fetchMetadataForThing: async (e) => c.fetch(`${A}/${e}/metadata`),
1147
+ uploadSitePhotos: async (e, t) => c.post(`${A}/${e}/photos`, t),
1148
+ fetchSitePhotos: async (e) => c.paginatedFetch(`${A}/${e}/photos`),
1149
+ deleteSitePhoto: async (e, t) => c.delete(`${A}/${e}/photos`, { name: t }),
1150
+ createSiteTag: async (e, t) => c.post(`${A}/${e}/tags`, t),
1151
+ editSiteTag: async (e, t) => c.put(`${A}/${e}/tags`, t),
1152
+ fetchSiteTags: async (e) => c.fetch(`${A}/${e}/tags`),
1153
+ fetchUsersSiteTags: async () => c.fetch(`${et}`),
1154
+ deleteSiteTag: async (e, t) => c.delete(`${A}/${e}/tags`, t),
1155
+ fetchWorkspaceTags: async (e) => c.fetch(`${et}/keys?workspace_id=${e}`),
1156
+ createHydroShareArchive: async (e) => c.post(`${A}/${e.thingId}/archive`, e),
1157
1157
  updateHydroShareArchive: async (e, t) => c.patch(
1158
- `${_}/${e.thingId}/archive`,
1158
+ `${A}/${e.thingId}/archive`,
1159
1159
  e,
1160
1160
  t
1161
1161
  ),
1162
- fetchHydroShareArchive: async (e) => c.fetch(`${_}/${e}/archive`),
1163
- deleteHydroShareArchive: async (e) => c.delete(`${_}/${e}/archive`),
1164
- archiveToHydroShare: async (e) => c.post(`${_}/${e}/archive/trigger`),
1165
- createDatastream: async (e) => c.post(R, e),
1162
+ fetchHydroShareArchive: async (e) => c.fetch(`${A}/${e}/archive`),
1163
+ deleteHydroShareArchive: async (e) => c.delete(`${A}/${e}/archive`),
1164
+ archiveToHydroShare: async (e) => c.post(`${A}/${e}/archive/trigger`),
1165
+ createDatastream: async (e) => c.post(O, e),
1166
1166
  fetchDatastreams: async (e) => {
1167
1167
  const t = [];
1168
1168
  if (e)
1169
1169
  for (const [s, n] of Object.entries(e))
1170
1170
  t.push(`${encodeURIComponent(s)}=${encodeURIComponent(n)}`);
1171
1171
  const r = t.length ? `?${t.join("&")}` : "";
1172
- return c.paginatedFetch(`${R}${r}`);
1172
+ return c.paginatedFetch(`${O}${r}`);
1173
1173
  },
1174
- fetchDatastreamsForThing: async (e) => c.paginatedFetch(`${R}?thing_id=${e}`),
1174
+ fetchDatastreamsForThing: async (e) => c.paginatedFetch(`${O}?thing_id=${e}`),
1175
1175
  fetchExpandedDatastreamsForThing: async (e) => c.paginatedFetch(
1176
- `${R}?thing_id=${e}&expand_related=true`
1176
+ `${O}?thing_id=${e}&expand_related=true`
1177
1177
  ),
1178
- fetchDatastreamsForDataSource: async (e) => c.paginatedFetch(`${R}?data_source_id=${e}`),
1179
- fetchDatastream: async (e) => c.fetch(`${R}/${e}`),
1180
- fetchDatastreamExpanded: async (e) => c.fetch(`${R}/${e}?expand_related=true`),
1181
- fetchUsersDatastreams: async () => c.paginatedFetch(`${R}?exclude_unowned=true`),
1182
- updateDatastream: async (e, t = null) => c.patch(`${R}/${e.id}`, e, t),
1183
- deleteDatastream: async (e) => c.delete(`${R}/${e}`),
1184
- downloadDatastreamCSV: async (e) => c.fetch(`${R}/${e}/csv`),
1185
- createObservedProperty: async (e) => c.post(H, e),
1186
- fetchObservedProperty: async (e) => c.fetch(`${H}/${e}`),
1187
- fetchObservedProperties: async () => c.paginatedFetch(`${H}`),
1188
- fetchWorkspaceObservedProperties: async (e) => c.paginatedFetch(`${H}?workspace_id=${e}`),
1189
- updateObservedProperty: async (e, t = null) => c.patch(`${H}/${e.id}`, e, t),
1190
- deleteObservedProperty: async (e) => c.delete(`${H}/${e}`),
1191
- createProcessingLevel: async (e) => c.post(q, e),
1192
- fetchProcessingLevels: async () => c.paginatedFetch(`${q}`),
1193
- fetchProcessingLevel: async (e) => c.fetch(`${q}/${e}`),
1194
- fetchWorkspaceProcessingLevels: async (e) => c.paginatedFetch(`${q}?workspace_id=${e}`),
1195
- updateProcessingLevel: async (e, t = null) => c.patch(`${q}/${e.id}`, e, t),
1196
- deleteProcessingLevel: async (e) => c.delete(`${q}/${e}`),
1197
- createSensor: async (e) => c.post(j, e),
1198
- fetchSensors: async () => c.paginatedFetch(`${j}`),
1199
- fetchSensor: async (e) => c.fetch(`${j}/${e}`),
1200
- fetchWorkspaceSensors: async (e) => c.paginatedFetch(`${j}?workspace_id=${e}`),
1201
- updateSensor: async (e, t = null) => c.patch(`${j}/${e.id}`, e, t),
1202
- deleteSensor: async (e) => c.delete(`${j}/${e}`),
1203
- createResultQualifier: async (e) => c.post(K, e),
1204
- fetchResultQualifiers: async () => c.paginatedFetch(`${K}`),
1205
- fetchWorkspaceResultQualifiers: async (e) => c.paginatedFetch(`${K}?workspace_id=${e}`),
1178
+ fetchDatastreamsForDataSource: async (e) => c.paginatedFetch(`${O}?data_source_id=${e}`),
1179
+ fetchDatastream: async (e) => c.fetch(`${O}/${e}`),
1180
+ fetchDatastreamExpanded: async (e) => c.fetch(`${O}/${e}?expand_related=true`),
1181
+ fetchUsersDatastreams: async () => c.paginatedFetch(`${O}?exclude_unowned=true`),
1182
+ updateDatastream: async (e, t = null) => c.patch(`${O}/${e.id}`, e, t),
1183
+ deleteDatastream: async (e) => c.delete(`${O}/${e}`),
1184
+ downloadDatastreamCSV: async (e) => c.fetch(`${O}/${e}/csv`),
1185
+ createObservedProperty: async (e) => c.post(X, e),
1186
+ fetchObservedProperty: async (e) => c.fetch(`${X}/${e}`),
1187
+ fetchObservedProperties: async () => c.paginatedFetch(`${X}`),
1188
+ fetchWorkspaceObservedProperties: async (e) => c.paginatedFetch(`${X}?workspace_id=${e}`),
1189
+ updateObservedProperty: async (e, t = null) => c.patch(`${X}/${e.id}`, e, t),
1190
+ deleteObservedProperty: async (e) => c.delete(`${X}/${e}`),
1191
+ createProcessingLevel: async (e) => c.post(Q, e),
1192
+ fetchProcessingLevels: async () => c.paginatedFetch(`${Q}`),
1193
+ fetchProcessingLevel: async (e) => c.fetch(`${Q}/${e}`),
1194
+ fetchWorkspaceProcessingLevels: async (e) => c.paginatedFetch(`${Q}?workspace_id=${e}`),
1195
+ updateProcessingLevel: async (e, t = null) => c.patch(`${Q}/${e.id}`, e, t),
1196
+ deleteProcessingLevel: async (e) => c.delete(`${Q}/${e}`),
1197
+ createSensor: async (e) => c.post(H, e),
1198
+ fetchSensors: async () => c.paginatedFetch(`${H}`),
1199
+ fetchSensor: async (e) => c.fetch(`${H}/${e}`),
1200
+ fetchWorkspaceSensors: async (e) => c.paginatedFetch(`${H}?workspace_id=${e}`),
1201
+ updateSensor: async (e, t = null) => c.patch(`${H}/${e.id}`, e, t),
1202
+ deleteSensor: async (e) => c.delete(`${H}/${e}`),
1203
+ createResultQualifier: async (e) => c.post(ee, e),
1204
+ fetchResultQualifiers: async () => c.paginatedFetch(`${ee}`),
1205
+ fetchWorkspaceResultQualifiers: async (e) => c.paginatedFetch(`${ee}?workspace_id=${e}`),
1206
1206
  updateResultQualifier: async (e, t = null) => c.patch(
1207
- `${K}/${e.id}`,
1207
+ `${ee}/${e.id}`,
1208
1208
  e,
1209
1209
  t
1210
1210
  ),
1211
- deleteResultQualifier: async (e) => c.delete(`${K}/${e}`),
1212
- createOrchestrationSystem: async (e) => c.post(V, e),
1213
- fetchOrchestrationSystems: async () => c.paginatedFetch(V),
1214
- fetchWorkspaceOrchestrationSystems: async (e) => c.paginatedFetch(`${V}?workspace_id=${e}`),
1215
- fetchOrchestrationSystem: async (e) => c.fetch(`${V}/${e}`),
1216
- updateOrchestrationSystem: async (e, t) => c.patch(`${V}/${e}`, t),
1217
- deleteOrchestrationSystem: async (e) => c.delete(`${V}/${e}`),
1211
+ deleteResultQualifier: async (e) => c.delete(`${ee}/${e}`),
1212
+ createOrchestrationSystem: async (e) => c.post(J, e),
1213
+ fetchOrchestrationSystems: async () => c.paginatedFetch(J),
1214
+ fetchWorkspaceOrchestrationSystems: async (e) => c.paginatedFetch(`${J}?workspace_id=${e}`),
1215
+ fetchOrchestrationSystem: async (e) => c.fetch(`${J}/${e}`),
1216
+ updateOrchestrationSystem: async (e, t) => c.patch(`${J}/${e}`, t),
1217
+ deleteOrchestrationSystem: async (e) => c.delete(`${J}/${e}`),
1218
1218
  createDataSource: async (e) => c.post(
1219
- `${x}?expand_related=true`,
1220
- qe(e)
1219
+ `${Y}?expand_related=true`,
1220
+ Ze(e)
1221
1221
  ),
1222
- fetchDataSources: async () => c.paginatedFetch(`${x}?expand_related=true`),
1222
+ fetchDataSources: async () => c.paginatedFetch(`${Y}?expand_related=true`),
1223
1223
  fetchWorkspaceDataSources: async (e) => c.paginatedFetch(
1224
- `${x}?workspace_id=${e}&expand_related=true`
1224
+ `${Y}?workspace_id=${e}&expand_related=true`
1225
1225
  ),
1226
- fetchDataSource: async (e) => c.fetch(`${x}/${e}?expand_related=true`),
1226
+ fetchDataSource: async (e) => c.fetch(`${Y}/${e}?expand_related=true`),
1227
1227
  updateDataSource: async (e) => c.patch(
1228
- `${x}/${e.id}?expand_related=true`,
1229
- qe(e)
1228
+ `${Y}/${e.id}?expand_related=true`,
1229
+ Ze(e)
1230
1230
  ),
1231
1231
  updateDataSourcePartial: async (e) => c.patch(
1232
- `${x}/${e.id}?expand_related=true`,
1232
+ `${Y}/${e.id}?expand_related=true`,
1233
1233
  e
1234
1234
  ),
1235
- deleteDataSource: async (e) => c.delete(`${x}/${e}`),
1235
+ deleteDataSource: async (e) => c.delete(`${Y}/${e}`),
1236
1236
  linkDatastreamToDataSource: async (e, t) => c.post(
1237
- `${x}/${e}/datastreams/${t}`
1237
+ `${Y}/${e}/datastreams/${t}`
1238
1238
  ),
1239
1239
  unlinkDatastreamFromDataSource: async (e, t) => c.delete(
1240
- `${x}/${e}/datastreams/${t}`
1240
+ `${Y}/${e}/datastreams/${t}`
1241
1241
  ),
1242
1242
  fetchObservations: async (e) => c.fetch(e),
1243
- deleteObservationsForDatastream: async (e) => c.post(`${R}/${e}/observations/bulk-delete`, {
1243
+ deleteObservationsForDatastream: async (e) => c.post(`${O}/${e}/observations/bulk-delete`, {
1244
1244
  phenomenonTimeStart: null,
1245
1245
  phenomenonTimeEnd: null
1246
1246
  }),
1247
- fetchUserTypes: async () => c.fetch(`${C}/user-types`),
1248
- fetchOrganizationTypes: async () => c.fetch(`${C}/organization-types`),
1249
- fetchSiteTypes: async () => c.fetch(`${_}/site-types`),
1250
- fetchSamplingFeatureTypes: async () => c.paginatedFetch(`${_}/sampling-feature-types`),
1251
- fetchSensorEncodingTypes: async () => c.paginatedFetch(`${j}/encoding-types`),
1252
- fetchMethodTypes: async () => c.paginatedFetch(`${j}/method-types`),
1253
- fetchVariableTypes: async () => c.paginatedFetch(`${H}/variable-types`),
1254
- fetchUnitTypes: async () => c.paginatedFetch(`${z}/types`),
1255
- fetchDatastreamStatuses: async () => c.paginatedFetch(`${R}/statuses`),
1256
- fetchDatastreamAggregations: async () => c.paginatedFetch(`${R}/aggregation-statistics`),
1257
- fetchSampledMediums: async () => c.paginatedFetch(`${R}/sampled-mediums`)
1247
+ fetchUserTypes: async () => c.fetch(`${N}/user-types`),
1248
+ fetchOrganizationTypes: async () => c.fetch(`${N}/organization-types`),
1249
+ fetchSiteTypes: async () => c.fetch(`${A}/site-types`),
1250
+ fetchSamplingFeatureTypes: async () => c.paginatedFetch(`${A}/sampling-feature-types`),
1251
+ fetchSensorEncodingTypes: async () => c.paginatedFetch(`${H}/encoding-types`),
1252
+ fetchMethodTypes: async () => c.paginatedFetch(`${H}/method-types`),
1253
+ fetchVariableTypes: async () => c.paginatedFetch(`${X}/variable-types`),
1254
+ fetchUnitTypes: async () => c.paginatedFetch(`${V}/types`),
1255
+ fetchDatastreamStatuses: async () => c.paginatedFetch(`${O}/statuses`),
1256
+ fetchDatastreamAggregations: async () => c.paginatedFetch(`${O}/aggregation-statistics`),
1257
+ fetchSampledMediums: async () => c.paginatedFetch(`${O}/sampled-mediums`)
1258
1258
  };
1259
- class hs {
1259
+ class ws {
1260
1260
  name = "";
1261
1261
  mappings = [];
1262
1262
  extractorVariables = {};
@@ -1264,15 +1264,15 @@ class hs {
1264
1264
  Object.assign(this, t);
1265
1265
  }
1266
1266
  }
1267
- const _t = 1, ce = _t * 60, Oe = ce * 60, De = Oe * 24, yr = De * 7, gr = Oe * 30, mr = De * 365, re = {
1268
- [F.SECOND]: _t,
1269
- [F.MINUTE]: ce,
1270
- [F.HOUR]: Oe,
1271
- [F.DAY]: De,
1272
- [F.WEEK]: yr,
1273
- [F.MONTH]: gr,
1274
- [F.YEAR]: mr
1275
- }, fs = (e) => e.toLocaleString(void 0, {
1267
+ const $t = 1, he = $t * 60, Ce = he * 60, xe = Ce * 24, br = xe * 7, Sr = Ce * 30, Er = xe * 365, oe = {
1268
+ [W.SECOND]: $t,
1269
+ [W.MINUTE]: he,
1270
+ [W.HOUR]: Ce,
1271
+ [W.DAY]: xe,
1272
+ [W.WEEK]: br,
1273
+ [W.MONTH]: Sr,
1274
+ [W.YEAR]: Er
1275
+ }, bs = (e) => e.toLocaleString(void 0, {
1276
1276
  year: "numeric",
1277
1277
  month: "short",
1278
1278
  day: "2-digit",
@@ -1280,42 +1280,40 @@ const _t = 1, ce = _t * 60, Oe = ce * 60, De = Oe * 24, yr = De * 7, gr = Oe * 3
1280
1280
  hour12: !1,
1281
1281
  minute: "2-digit",
1282
1282
  second: "2-digit"
1283
- }), ds = (e) => {
1283
+ }), Ss = (e) => {
1284
1284
  let t, r;
1285
- e >= ce * 1e3 ? (t = e / (ce * 1e3), r = "m") : e >= 1e3 ? (t = e / 1e3, r = "s") : (t = e, r = "ms");
1285
+ e >= he * 1e3 ? (t = e / (he * 1e3), r = "m") : e >= 1e3 ? (t = e / 1e3, r = "s") : (t = e, r = "ms");
1286
1286
  let s;
1287
1287
  return r === "ms" ? s = Math.round(t).toString() : s = t.toFixed(2), `${s} ${r}`;
1288
- }, be = async (e, t) => {
1288
+ }, ke = async (e, t) => {
1289
1289
  t && console.info(t);
1290
- const r = performance.now(), s = await e(), n = performance.now();
1291
- console.info(` Done in ${(n - r).toFixed(2)} ms`);
1292
- const a = +(n - r);
1290
+ const r = performance.now(), s = await e(), a = +(performance.now() - r);
1293
1291
  return { response: s, duration: a };
1294
1292
  };
1295
- function ps(e, t) {
1293
+ function Es(e, t) {
1296
1294
  const r = new Date(e);
1297
1295
  return r.setHours(r.getHours() - t), r.toISOString();
1298
1296
  }
1299
- const se = (e, t) => {
1297
+ const B = (e, t) => {
1300
1298
  let r = 0, s = e.length;
1301
1299
  for (; r < s; ) {
1302
1300
  const n = r + s >> 1;
1303
1301
  e[n] < t ? r = n + 1 : s = n;
1304
1302
  }
1305
1303
  return r;
1306
- }, Se = (e, t) => {
1304
+ }, j = (e, t) => {
1307
1305
  let r = 0, s = e.length;
1308
1306
  for (; r < s; ) {
1309
1307
  const n = r + s >> 1;
1310
1308
  e[n] > t ? s = n : r = n + 1;
1311
1309
  }
1312
1310
  return r - 1;
1313
- }, At = `(function(){"use strict";function c(n,s,a,u,f,l,y,o){let r=0,e=o;for(let t=l;t<=y;t++)r<a.length&&t===a[r]?r++:(u[e]=n[t],f[e]=s[t],e++);return e-o}self.onmessage=n=>{const{bufferX:s,bufferY:a,outputBufferX:u,outputBufferY:f,start:l,end:y,deleteSegment:o,startTarget:r}=n.data,e=new Float64Array(s),t=new Float32Array(a),A=new Float64Array(u),g=new Float32Array(f);c(e,t,o,A,g,l,y,r),self.postMessage("Done")}})();
1314
- `, Ke = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", At], { type: "text/javascript;charset=utf-8" });
1315
- function wr(e) {
1311
+ }, Rt = `(function(){"use strict";function c(n,s,a,u,f,l,y,o){let r=0,e=o;for(let t=l;t<=y;t++)r<a.length&&t===a[r]?r++:(u[e]=n[t],f[e]=s[t],e++);return e-o}self.onmessage=n=>{const{bufferX:s,bufferY:a,outputBufferX:u,outputBufferY:f,start:l,end:y,deleteSegment:o,startTarget:r}=n.data,e=new Float64Array(s),t=new Float32Array(a),A=new Float64Array(u),g=new Float32Array(f);c(e,t,o,A,g,l,y,r),self.postMessage("Done")}})();
1312
+ `, tt = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", Rt], { type: "text/javascript;charset=utf-8" });
1313
+ function vr(e) {
1316
1314
  let t;
1317
1315
  try {
1318
- if (t = Ke && (self.URL || self.webkitURL).createObjectURL(Ke), !t) throw "";
1316
+ if (t = tt && (self.URL || self.webkitURL).createObjectURL(tt), !t) throw "";
1319
1317
  const r = new Worker(t, {
1320
1318
  name: e?.name
1321
1319
  });
@@ -1324,19 +1322,19 @@ function wr(e) {
1324
1322
  }), r;
1325
1323
  } catch {
1326
1324
  return new Worker(
1327
- "data:text/javascript;charset=utf-8," + encodeURIComponent(At),
1325
+ "data:text/javascript;charset=utf-8," + encodeURIComponent(Rt),
1328
1326
  {
1329
1327
  name: e?.name
1330
1328
  }
1331
1329
  );
1332
1330
  }
1333
1331
  }
1334
- const Tt = `(function(){"use strict";function F(n,l,a,o,s,y,g,f,i,w,A){let e=0,t=f;for(let r=y;r<=g;r++)if(o[t]=n[r],s[t]=l[r],t++,e<a.length&&r===a[e][0]){const u=a[e][0],c=a[e][1],d=n[u],h=n[c],m=l[u],D=l[c],x=h-d,P=D-m;let p=d+i;for(;p<h;)o[t]=p,s[t]=w?m+(p-d)*P/x:A,t++,p+=i;e++}return t-f}self.onmessage=n=>{const{bufferX:l,bufferY:a,outputBufferX:o,outputBufferY:s,start:y,end:g,gapsSegment:f,startTarget:i,fillDelta:w,interpolate:A,fillValue:e}=n.data,t=new Float64Array(l),r=new Float32Array(a),u=new Float64Array(o),c=new Float32Array(s);F(t,r,f,u,c,y,g,i,w,A,e),self.postMessage("Done")}})();
1335
- `, Qe = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", Tt], { type: "text/javascript;charset=utf-8" });
1336
- function br(e) {
1332
+ const It = `(function(){"use strict";function F(n,l,a,o,s,y,g,f,i,w,A){let e=0,t=f;for(let r=y;r<=g;r++)if(o[t]=n[r],s[t]=l[r],t++,e<a.length&&r===a[e][0]){const u=a[e][0],c=a[e][1],d=n[u],h=n[c],m=l[u],D=l[c],x=h-d,P=D-m;let p=d+i;for(;p<h;)o[t]=p,s[t]=w?m+(p-d)*P/x:A,t++,p+=i;e++}return t-f}self.onmessage=n=>{const{bufferX:l,bufferY:a,outputBufferX:o,outputBufferY:s,start:y,end:g,gapsSegment:f,startTarget:i,fillDelta:w,interpolate:A,fillValue:e}=n.data,t=new Float64Array(l),r=new Float32Array(a),u=new Float64Array(o),c=new Float32Array(s);F(t,r,f,u,c,y,g,i,w,A,e),self.postMessage("Done")}})();
1333
+ `, rt = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", It], { type: "text/javascript;charset=utf-8" });
1334
+ function kr(e) {
1337
1335
  let t;
1338
1336
  try {
1339
- if (t = Qe && (self.URL || self.webkitURL).createObjectURL(Qe), !t) throw "";
1337
+ if (t = rt && (self.URL || self.webkitURL).createObjectURL(rt), !t) throw "";
1340
1338
  const r = new Worker(t, {
1341
1339
  name: e?.name
1342
1340
  });
@@ -1345,19 +1343,19 @@ function br(e) {
1345
1343
  }), r;
1346
1344
  } catch {
1347
1345
  return new Worker(
1348
- "data:text/javascript;charset=utf-8," + encodeURIComponent(Tt),
1346
+ "data:text/javascript;charset=utf-8," + encodeURIComponent(It),
1349
1347
  {
1350
1348
  name: e?.name
1351
1349
  }
1352
1350
  );
1353
1351
  }
1354
1352
  }
1355
- const Lt = `(function(){"use strict";function g(o,n,c){for(let s=0;s<c.length;s++){const{indexes:t,lowerIdx:l,upperIdx:r}=c[s],i=o[l],f=n[l],a=o[r],d=n[r],p=a-i,w=d-f;if(p===0){for(let e=0;e<t.length;e++)n[t[e]]=f;continue}for(let e=0;e<t.length;e++){const u=t[e];n[u]=f+(o[u]-i)*w/p}}}self.onmessage=o=>{const{bufferX:n,bufferY:c,groups:s}=o.data,t=new Float64Array(n),l=new Float32Array(c);g(t,l,s),self.postMessage("Done")}})();
1356
- `, Ze = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", Lt], { type: "text/javascript;charset=utf-8" });
1357
- function Sr(e) {
1353
+ const Ot = `(function(){"use strict";function g(o,n,c){for(let s=0;s<c.length;s++){const{indexes:t,lowerIdx:l,upperIdx:r}=c[s],i=o[l],f=n[l],a=o[r],d=n[r],p=a-i,w=d-f;if(p===0){for(let e=0;e<t.length;e++)n[t[e]]=f;continue}for(let e=0;e<t.length;e++){const u=t[e];n[u]=f+(o[u]-i)*w/p}}}self.onmessage=o=>{const{bufferX:n,bufferY:c,groups:s}=o.data,t=new Float64Array(n),l=new Float32Array(c);g(t,l,s),self.postMessage("Done")}})();
1354
+ `, st = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", Ot], { type: "text/javascript;charset=utf-8" });
1355
+ function _r(e) {
1358
1356
  let t;
1359
1357
  try {
1360
- if (t = Ze && (self.URL || self.webkitURL).createObjectURL(Ze), !t) throw "";
1358
+ if (t = st && (self.URL || self.webkitURL).createObjectURL(st), !t) throw "";
1361
1359
  const r = new Worker(t, {
1362
1360
  name: e?.name
1363
1361
  });
@@ -1366,19 +1364,19 @@ function Sr(e) {
1366
1364
  }), r;
1367
1365
  } catch {
1368
1366
  return new Worker(
1369
- "data:text/javascript;charset=utf-8," + encodeURIComponent(Lt),
1367
+ "data:text/javascript;charset=utf-8," + encodeURIComponent(Ot),
1370
1368
  {
1371
1369
  name: e?.name
1372
1370
  }
1373
1371
  );
1374
1372
  }
1375
1373
  }
1376
- const $t = `(function(){"use strict";self.onmessage=r=>{const{bufferX:s,bufferY:o,jobs:a}=r.data,f=new Float64Array(s),n=new Float32Array(o);for(let e=0;e<a.length;e++){const{chunkStart:c,chunkEnd:l,startDatetime:u,value:i,extent:y}=a[e];for(let t=c;t<l;t++)n[t]=n[t]+i*((f[t]-u)/y)}self.postMessage("Done")}})();
1377
- `, et = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", $t], { type: "text/javascript;charset=utf-8" });
1378
- function Er(e) {
1374
+ const Mt = `(function(){"use strict";self.onmessage=r=>{const{bufferX:s,bufferY:o,jobs:a}=r.data,f=new Float64Array(s),n=new Float32Array(o);for(let e=0;e<a.length;e++){const{chunkStart:c,chunkEnd:l,startDatetime:u,value:i,extent:y}=a[e];for(let t=c;t<l;t++)n[t]=n[t]+i*((f[t]-u)/y)}self.postMessage("Done")}})();
1375
+ `, nt = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", Mt], { type: "text/javascript;charset=utf-8" });
1376
+ function Ar(e) {
1379
1377
  let t;
1380
1378
  try {
1381
- if (t = et && (self.URL || self.webkitURL).createObjectURL(et), !t) throw "";
1379
+ if (t = nt && (self.URL || self.webkitURL).createObjectURL(nt), !t) throw "";
1382
1380
  const r = new Worker(t, {
1383
1381
  name: e?.name
1384
1382
  });
@@ -1387,19 +1385,19 @@ function Er(e) {
1387
1385
  }), r;
1388
1386
  } catch {
1389
1387
  return new Worker(
1390
- "data:text/javascript;charset=utf-8," + encodeURIComponent($t),
1388
+ "data:text/javascript;charset=utf-8," + encodeURIComponent(Mt),
1391
1389
  {
1392
1390
  name: e?.name
1393
1391
  }
1394
1392
  );
1395
1393
  }
1396
1394
  }
1397
- const Rt = `(function(){"use strict";function u(f,o,a,n,l,c,s,i){let r=c,e=0,t=i;const w=a.length;for(;r<s&&e<w;){const y=a[e][0];f[r]<=y?(n[t]=f[r],l[t]=o[r],r++):(n[t]=y,l[t]=a[e][1],e++),t++}for(;r<s;)n[t]=f[r],l[t]=o[r],r++,t++;for(;e<w;)n[t]=a[e][0],l[t]=a[e][1],e++,t++;return t-i}self.onmessage=f=>{const{bufferX:o,bufferY:a,outputBufferX:n,outputBufferY:l,origStart:c,origEnd:s,insertions:i,outStart:r}=f.data,e=new Float64Array(o),t=new Float32Array(a),w=new Float64Array(n),y=new Float32Array(l);u(e,t,i,w,y,c,s,r),self.postMessage("Done")}})();
1398
- `, tt = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", Rt], { type: "text/javascript;charset=utf-8" });
1399
- function kr(e) {
1395
+ const Ut = `(function(){"use strict";function u(f,o,a,n,l,c,s,i){let r=c,e=0,t=i;const w=a.length;for(;r<s&&e<w;){const y=a[e][0];f[r]<=y?(n[t]=f[r],l[t]=o[r],r++):(n[t]=y,l[t]=a[e][1],e++),t++}for(;r<s;)n[t]=f[r],l[t]=o[r],r++,t++;for(;e<w;)n[t]=a[e][0],l[t]=a[e][1],e++,t++;return t-i}self.onmessage=f=>{const{bufferX:o,bufferY:a,outputBufferX:n,outputBufferY:l,origStart:c,origEnd:s,insertions:i,outStart:r}=f.data,e=new Float64Array(o),t=new Float32Array(a),w=new Float64Array(n),y=new Float32Array(l);u(e,t,i,w,y,c,s,r),self.postMessage("Done")}})();
1396
+ `, ot = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", Ut], { type: "text/javascript;charset=utf-8" });
1397
+ function Tr(e) {
1400
1398
  let t;
1401
1399
  try {
1402
- if (t = tt && (self.URL || self.webkitURL).createObjectURL(tt), !t) throw "";
1400
+ if (t = ot && (self.URL || self.webkitURL).createObjectURL(ot), !t) throw "";
1403
1401
  const r = new Worker(t, {
1404
1402
  name: e?.name
1405
1403
  });
@@ -1408,19 +1406,19 @@ function kr(e) {
1408
1406
  }), r;
1409
1407
  } catch {
1410
1408
  return new Worker(
1411
- "data:text/javascript;charset=utf-8," + encodeURIComponent(Rt),
1409
+ "data:text/javascript;charset=utf-8," + encodeURIComponent(Ut),
1412
1410
  {
1413
1411
  name: e?.name
1414
1412
  }
1415
1413
  );
1416
1414
  }
1417
1415
  }
1418
- const It = `(function(){"use strict";self.onmessage=i=>{const{bufferX:c,bufferY:g,outputBufferX:d,outputBufferY:y,indexes:n,outStart:r,amount:f,isMonth:Y,isYear:h,deltaMs:w}=i.data,s=new Float64Array(c),a=new Float32Array(g),l=new Float64Array(d),u=new Float32Array(y);if(Y)for(let t=0;t<n.length;t++){const e=n[t],o=new Date(s[e]);o.setMonth(o.getMonth()+f),l[r+t]=o.getTime(),u[r+t]=a[e]}else if(h)for(let t=0;t<n.length;t++){const e=n[t],o=new Date(s[e]);o.setFullYear(o.getFullYear()+f),l[r+t]=o.getTime(),u[r+t]=a[e]}else for(let t=0;t<n.length;t++){const e=n[t];l[r+t]=s[e]+w,u[r+t]=a[e]}self.postMessage("Done")}})();
1419
- `, rt = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", It], { type: "text/javascript;charset=utf-8" });
1420
- function vr(e) {
1416
+ const Ft = `(function(){"use strict";self.onmessage=i=>{const{bufferX:c,bufferY:g,outputBufferX:d,outputBufferY:y,indexes:n,outStart:r,amount:f,isMonth:Y,isYear:h,deltaMs:w}=i.data,s=new Float64Array(c),a=new Float32Array(g),l=new Float64Array(d),u=new Float32Array(y);if(Y)for(let t=0;t<n.length;t++){const e=n[t],o=new Date(s[e]);o.setMonth(o.getMonth()+f),l[r+t]=o.getTime(),u[r+t]=a[e]}else if(h)for(let t=0;t<n.length;t++){const e=n[t],o=new Date(s[e]);o.setFullYear(o.getFullYear()+f),l[r+t]=o.getTime(),u[r+t]=a[e]}else for(let t=0;t<n.length;t++){const e=n[t];l[r+t]=s[e]+w,u[r+t]=a[e]}self.postMessage("Done")}})();
1417
+ `, at = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", Ft], { type: "text/javascript;charset=utf-8" });
1418
+ function Lr(e) {
1421
1419
  let t;
1422
1420
  try {
1423
- if (t = rt && (self.URL || self.webkitURL).createObjectURL(rt), !t) throw "";
1421
+ if (t = at && (self.URL || self.webkitURL).createObjectURL(at), !t) throw "";
1424
1422
  const r = new Worker(t, {
1425
1423
  name: e?.name
1426
1424
  });
@@ -1429,19 +1427,19 @@ function vr(e) {
1429
1427
  }), r;
1430
1428
  } catch {
1431
1429
  return new Worker(
1432
- "data:text/javascript;charset=utf-8," + encodeURIComponent(It),
1430
+ "data:text/javascript;charset=utf-8," + encodeURIComponent(Ft),
1433
1431
  {
1434
1432
  name: e?.name
1435
1433
  }
1436
1434
  );
1437
1435
  }
1438
1436
  }
1439
- const Mt = `(function(){"use strict";function a(e,t,o,c){const n=[];let r=e[t];for(let s=t+1;s<=o;s++){const f=e[s];f-r>c&&n.push(s-1,s),r=f}return n}self.onmessage=e=>{const{bufferX:t,start:o,endInclusive:c,threshold:n}=e.data,r=new Float64Array(t);self.postMessage(a(r,o,c,n))}})();
1440
- `, st = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", Mt], { type: "text/javascript;charset=utf-8" });
1441
- function _r(e) {
1437
+ const Dt = `(function(){"use strict";function a(e,t,o,c){const n=[];let r=e[t];for(let s=t+1;s<=o;s++){const f=e[s];f-r>c&&n.push(s-1,s),r=f}return n}self.onmessage=e=>{const{bufferX:t,start:o,endInclusive:c,threshold:n}=e.data,r=new Float64Array(t);self.postMessage(a(r,o,c,n))}})();
1438
+ `, it = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", Dt], { type: "text/javascript;charset=utf-8" });
1439
+ function $r(e) {
1442
1440
  let t;
1443
1441
  try {
1444
- if (t = st && (self.URL || self.webkitURL).createObjectURL(st), !t) throw "";
1442
+ if (t = it && (self.URL || self.webkitURL).createObjectURL(it), !t) throw "";
1445
1443
  const r = new Worker(t, {
1446
1444
  name: e?.name
1447
1445
  });
@@ -1450,19 +1448,19 @@ function _r(e) {
1450
1448
  }), r;
1451
1449
  } catch {
1452
1450
  return new Worker(
1453
- "data:text/javascript;charset=utf-8," + encodeURIComponent(Mt),
1451
+ "data:text/javascript;charset=utf-8," + encodeURIComponent(Dt),
1454
1452
  {
1455
1453
  name: e?.name
1456
1454
  }
1457
1455
  );
1458
1456
  }
1459
1457
  }
1460
- const Ut = `(function(){"use strict";function c(u,s,t){const n=[];if(s>=t)return n;let e=s,o=u[s];for(let r=s+1;r<t;r++){const f=u[r];f!==o&&(n.push(e,r-e,o),e=r,o=f)}return n.push(e,t-e,o),n}self.onmessage=u=>{const{bufferY:s,start:t,end:n}=u.data,e=new Float32Array(s);self.postMessage(c(e,t,n))}})();
1461
- `, nt = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", Ut], { type: "text/javascript;charset=utf-8" });
1462
- function Ar(e) {
1458
+ const Ct = `(function(){"use strict";function c(u,s,t){const n=[];if(s>=t)return n;let e=s,o=u[s];for(let r=s+1;r<t;r++){const f=u[r];f!==o&&(n.push(e,r-e,o),e=r,o=f)}return n.push(e,t-e,o),n}self.onmessage=u=>{const{bufferY:s,start:t,end:n}=u.data,e=new Float32Array(s);self.postMessage(c(e,t,n))}})();
1459
+ `, ct = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", Ct], { type: "text/javascript;charset=utf-8" });
1460
+ function Rr(e) {
1463
1461
  let t;
1464
1462
  try {
1465
- if (t = nt && (self.URL || self.webkitURL).createObjectURL(nt), !t) throw "";
1463
+ if (t = ct && (self.URL || self.webkitURL).createObjectURL(ct), !t) throw "";
1466
1464
  const r = new Worker(t, {
1467
1465
  name: e?.name
1468
1466
  });
@@ -1471,19 +1469,19 @@ function Ar(e) {
1471
1469
  }), r;
1472
1470
  } catch {
1473
1471
  return new Worker(
1474
- "data:text/javascript;charset=utf-8," + encodeURIComponent(Ut),
1472
+ "data:text/javascript;charset=utf-8," + encodeURIComponent(Ct),
1475
1473
  {
1476
1474
  name: e?.name
1477
1475
  }
1478
1476
  );
1479
1477
  }
1480
1478
  }
1481
- const Ot = `(function(){"use strict";function o(s,i,t,n,l){const f=[];if(n==="Less than")for(let e=i;e<t;e++)s[e]-s[e-1]<l&&f.push(e);else if(n==="Less than or equal to")for(let e=i;e<t;e++)s[e]-s[e-1]<=l&&f.push(e);else if(n==="Greater than")for(let e=i;e<t;e++)s[e]-s[e-1]>l&&f.push(e);else if(n==="Greater than or equal to")for(let e=i;e<t;e++)s[e]-s[e-1]>=l&&f.push(e);else if(n==="Equal")for(let e=i;e<t;e++)s[e]-s[e-1]==l&&f.push(e);return f}self.onmessage=s=>{const{bufferY:i,start:t,end:n,comparator:l,value:f}=s.data,e=new Float32Array(i);self.postMessage(o(e,t,n,l,f))}})();
1482
- `, ot = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", Ot], { type: "text/javascript;charset=utf-8" });
1483
- function Tr(e) {
1479
+ const xt = `(function(){"use strict";function o(s,i,t,n,l){const f=[];if(n==="Less than")for(let e=i;e<t;e++)s[e]-s[e-1]<l&&f.push(e);else if(n==="Less than or equal to")for(let e=i;e<t;e++)s[e]-s[e-1]<=l&&f.push(e);else if(n==="Greater than")for(let e=i;e<t;e++)s[e]-s[e-1]>l&&f.push(e);else if(n==="Greater than or equal to")for(let e=i;e<t;e++)s[e]-s[e-1]>=l&&f.push(e);else if(n==="Equal")for(let e=i;e<t;e++)s[e]-s[e-1]==l&&f.push(e);return f}self.onmessage=s=>{const{bufferY:i,start:t,end:n,comparator:l,value:f}=s.data,e=new Float32Array(i);self.postMessage(o(e,t,n,l,f))}})();
1480
+ `, lt = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", xt], { type: "text/javascript;charset=utf-8" });
1481
+ function Ir(e) {
1484
1482
  let t;
1485
1483
  try {
1486
- if (t = ot && (self.URL || self.webkitURL).createObjectURL(ot), !t) throw "";
1484
+ if (t = lt && (self.URL || self.webkitURL).createObjectURL(lt), !t) throw "";
1487
1485
  const r = new Worker(t, {
1488
1486
  name: e?.name
1489
1487
  });
@@ -1492,19 +1490,19 @@ function Tr(e) {
1492
1490
  }), r;
1493
1491
  } catch {
1494
1492
  return new Worker(
1495
- "data:text/javascript;charset=utf-8," + encodeURIComponent(Ot),
1493
+ "data:text/javascript;charset=utf-8," + encodeURIComponent(xt),
1496
1494
  {
1497
1495
  name: e?.name
1498
1496
  }
1499
1497
  );
1500
1498
  }
1501
1499
  }
1502
- const Dt = `(function(){"use strict";function l(t,i,n,o,h){const f=[];if(o==="Less than")for(let e=i;e<n;e++){const s=t[e-1];(t[e]-s)/Math.abs(s)<h&&f.push(e)}else if(o==="Less than or equal to")for(let e=i;e<n;e++){const s=t[e-1];(t[e]-s)/Math.abs(s)<=h&&f.push(e)}else if(o==="Greater than")for(let e=i;e<n;e++){const s=t[e-1];(t[e]-s)/Math.abs(s)>h&&f.push(e)}else if(o==="Greater than or equal to")for(let e=i;e<n;e++){const s=t[e-1];(t[e]-s)/Math.abs(s)>=h&&f.push(e)}else if(o==="Equal")for(let e=i;e<n;e++){const s=t[e-1];(t[e]-s)/Math.abs(s)==h&&f.push(e)}return f}self.onmessage=t=>{const{bufferY:i,start:n,end:o,comparator:h,value:f}=t.data,e=new Float32Array(i);self.postMessage(l(e,n,o,h,f))}})();
1503
- `, at = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", Dt], { type: "text/javascript;charset=utf-8" });
1504
- function Lr(e) {
1500
+ const Pt = `(function(){"use strict";function l(t,i,n,o,h){const f=[];if(o==="Less than")for(let e=i;e<n;e++){const s=t[e-1];(t[e]-s)/Math.abs(s)<h&&f.push(e)}else if(o==="Less than or equal to")for(let e=i;e<n;e++){const s=t[e-1];(t[e]-s)/Math.abs(s)<=h&&f.push(e)}else if(o==="Greater than")for(let e=i;e<n;e++){const s=t[e-1];(t[e]-s)/Math.abs(s)>h&&f.push(e)}else if(o==="Greater than or equal to")for(let e=i;e<n;e++){const s=t[e-1];(t[e]-s)/Math.abs(s)>=h&&f.push(e)}else if(o==="Equal")for(let e=i;e<n;e++){const s=t[e-1];(t[e]-s)/Math.abs(s)==h&&f.push(e)}return f}self.onmessage=t=>{const{bufferY:i,start:n,end:o,comparator:h,value:f}=t.data,e=new Float32Array(i);self.postMessage(l(e,n,o,h,f))}})();
1501
+ `, ut = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", Pt], { type: "text/javascript;charset=utf-8" });
1502
+ function Or(e) {
1505
1503
  let t;
1506
1504
  try {
1507
- if (t = at && (self.URL || self.webkitURL).createObjectURL(at), !t) throw "";
1505
+ if (t = ut && (self.URL || self.webkitURL).createObjectURL(ut), !t) throw "";
1508
1506
  const r = new Worker(t, {
1509
1507
  name: e?.name
1510
1508
  });
@@ -1513,19 +1511,19 @@ function Lr(e) {
1513
1511
  }), r;
1514
1512
  } catch {
1515
1513
  return new Worker(
1516
- "data:text/javascript;charset=utf-8," + encodeURIComponent(Dt),
1514
+ "data:text/javascript;charset=utf-8," + encodeURIComponent(Pt),
1517
1515
  {
1518
1516
  name: e?.name
1519
1517
  }
1520
1518
  );
1521
1519
  }
1522
1520
  }
1523
- const Ct = `(function(){"use strict";function k(i,l,u,r,c){const f=[],b=r.length;for(let a=l;a<u;a++){const t=i[a];let e=!1;for(let n=0;n<b;n++){const o=r[n],s=c[n];if(o===0){if(t<s){e=!0;break}}else if(o===1){if(t<=s){e=!0;break}}else if(o===2){if(t>s){e=!0;break}}else if(o===3){if(t>=s){e=!0;break}}else if(t==s){e=!0;break}}e&&f.push(a)}return f}self.onmessage=i=>{const{bufferY:l,start:u,end:r,ops:c,values:f}=i.data,b=new Float32Array(l);self.postMessage(k(b,u,r,c,f))}})();
1524
- `, it = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", Ct], { type: "text/javascript;charset=utf-8" });
1525
- function Re(e) {
1521
+ const Nt = `(function(){"use strict";function k(i,l,u,r,c){const f=[],b=r.length;for(let a=l;a<u;a++){const t=i[a];let e=!1;for(let n=0;n<b;n++){const o=r[n],s=c[n];if(o===0){if(t<s){e=!0;break}}else if(o===1){if(t<=s){e=!0;break}}else if(o===2){if(t>s){e=!0;break}}else if(o===3){if(t>=s){e=!0;break}}else if(t==s){e=!0;break}}e&&f.push(a)}return f}self.onmessage=i=>{const{bufferY:l,start:u,end:r,ops:c,values:f}=i.data,b=new Float32Array(l);self.postMessage(k(b,u,r,c,f))}})();
1522
+ `, ht = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", Nt], { type: "text/javascript;charset=utf-8" });
1523
+ function Me(e) {
1526
1524
  let t;
1527
1525
  try {
1528
- if (t = it && (self.URL || self.webkitURL).createObjectURL(it), !t) throw "";
1526
+ if (t = ht && (self.URL || self.webkitURL).createObjectURL(ht), !t) throw "";
1529
1527
  const r = new Worker(t, {
1530
1528
  name: e?.name
1531
1529
  });
@@ -1534,19 +1532,19 @@ function Re(e) {
1534
1532
  }), r;
1535
1533
  } catch {
1536
1534
  return new Worker(
1537
- "data:text/javascript;charset=utf-8," + encodeURIComponent(Ct),
1535
+ "data:text/javascript;charset=utf-8," + encodeURIComponent(Nt),
1538
1536
  {
1539
1537
  name: e?.name
1540
1538
  }
1541
1539
  );
1542
1540
  }
1543
1541
  }
1544
- const Ft = `(function(){"use strict";function e(l,t,o,s){const c=t.length;if(o==="ADD")for(let f=0;f<c;f++)l[t[f]]=l[t[f]]+s;else if(o==="SUB")for(let f=0;f<c;f++)l[t[f]]=l[t[f]]-s;else if(o==="MULT")for(let f=0;f<c;f++)l[t[f]]=l[t[f]]*s;else if(o==="DIV")for(let f=0;f<c;f++)l[t[f]]=l[t[f]]/s;else if(o==="ASSIGN")for(let f=0;f<c;f++)l[t[f]]=s}self.onmessage=l=>{const{bufferY:t,indexes:o,operator:s,value:c}=l.data,f=new Float32Array(t);e(f,o,s,c),self.postMessage("Done")}})();
1545
- `, ct = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", Ft], { type: "text/javascript;charset=utf-8" });
1546
- function $r(e) {
1542
+ const Bt = `(function(){"use strict";function e(l,t,o,s){const c=t.length;if(o==="ADD")for(let f=0;f<c;f++)l[t[f]]=l[t[f]]+s;else if(o==="SUB")for(let f=0;f<c;f++)l[t[f]]=l[t[f]]-s;else if(o==="MULT")for(let f=0;f<c;f++)l[t[f]]=l[t[f]]*s;else if(o==="DIV")for(let f=0;f<c;f++)l[t[f]]=l[t[f]]/s;else if(o==="ASSIGN")for(let f=0;f<c;f++)l[t[f]]=s}self.onmessage=l=>{const{bufferY:t,indexes:o,operator:s,value:c}=l.data,f=new Float32Array(t);e(f,o,s,c),self.postMessage("Done")}})();
1543
+ `, ft = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", Bt], { type: "text/javascript;charset=utf-8" });
1544
+ function Mr(e) {
1547
1545
  let t;
1548
1546
  try {
1549
- if (t = ct && (self.URL || self.webkitURL).createObjectURL(ct), !t) throw "";
1547
+ if (t = ft && (self.URL || self.webkitURL).createObjectURL(ft), !t) throw "";
1550
1548
  const r = new Worker(t, {
1551
1549
  name: e?.name
1552
1550
  });
@@ -1555,50 +1553,50 @@ function $r(e) {
1555
1553
  }), r;
1556
1554
  } catch {
1557
1555
  return new Worker(
1558
- "data:text/javascript;charset=utf-8," + encodeURIComponent(Ft),
1556
+ "data:text/javascript;charset=utf-8," + encodeURIComponent(Bt),
1559
1557
  {
1560
1558
  name: e?.name
1561
1559
  }
1562
1560
  );
1563
1561
  }
1564
1562
  }
1565
- function Pt(e, t, r, s, n) {
1563
+ function jt(e, t, r, s, n) {
1566
1564
  const a = [], o = s.length;
1567
1565
  for (let i = t; i < r; i++) {
1568
1566
  const l = e[i];
1569
- let f = !1;
1567
+ let d = !1;
1570
1568
  for (let u = 0; u < o; u++) {
1571
- const p = s[u], g = n[u];
1572
- if (p === 0) {
1569
+ const y = s[u], g = n[u];
1570
+ if (y === 0) {
1573
1571
  if (l < g) {
1574
- f = !0;
1572
+ d = !0;
1575
1573
  break;
1576
1574
  }
1577
- } else if (p === 1) {
1575
+ } else if (y === 1) {
1578
1576
  if (l <= g) {
1579
- f = !0;
1577
+ d = !0;
1580
1578
  break;
1581
1579
  }
1582
- } else if (p === 2) {
1580
+ } else if (y === 2) {
1583
1581
  if (l > g) {
1584
- f = !0;
1582
+ d = !0;
1585
1583
  break;
1586
1584
  }
1587
- } else if (p === 3) {
1585
+ } else if (y === 3) {
1588
1586
  if (l >= g) {
1589
- f = !0;
1587
+ d = !0;
1590
1588
  break;
1591
1589
  }
1592
1590
  } else if (l == g) {
1593
- f = !0;
1591
+ d = !0;
1594
1592
  break;
1595
1593
  }
1596
1594
  }
1597
- f && a.push(i);
1595
+ d && a.push(i);
1598
1596
  }
1599
1597
  return a;
1600
1598
  }
1601
- function Rr(e, t, r, s, n) {
1599
+ function Ur(e, t, r, s, n) {
1602
1600
  const a = [];
1603
1601
  if (s === "Less than")
1604
1602
  for (let o = t; o < r; o++)
@@ -1617,7 +1615,7 @@ function Rr(e, t, r, s, n) {
1617
1615
  e[o] - e[o - 1] == n && a.push(o);
1618
1616
  return a;
1619
1617
  }
1620
- function Ir(e, t, r, s, n) {
1618
+ function Fr(e, t, r, s, n) {
1621
1619
  const a = [];
1622
1620
  if (s === "Less than")
1623
1621
  for (let o = t; o < r; o++) {
@@ -1646,7 +1644,7 @@ function Ir(e, t, r, s, n) {
1646
1644
  }
1647
1645
  return a;
1648
1646
  }
1649
- function Mr(e, t, r, s) {
1647
+ function Dr(e, t, r, s) {
1650
1648
  const n = [];
1651
1649
  let a = e[t];
1652
1650
  for (let o = t + 1; o <= r; o++) {
@@ -1655,7 +1653,7 @@ function Mr(e, t, r, s) {
1655
1653
  }
1656
1654
  return n;
1657
1655
  }
1658
- function Ur(e, t, r) {
1656
+ function Cr(e, t, r) {
1659
1657
  const s = [];
1660
1658
  if (t >= r) return s;
1661
1659
  let n = t, a = e[t];
@@ -1665,38 +1663,38 @@ function Ur(e, t, r) {
1665
1663
  }
1666
1664
  return s.push(n, r - n, a), s;
1667
1665
  }
1668
- function Or(e, t, r, s, n, a, o, i, l, f, u) {
1669
- let p = 0, g = i;
1670
- for (let y = a; y <= o; y++)
1671
- if (s[g] = e[y], n[g] = t[y], g++, p < r.length && y === r[p][0]) {
1672
- const d = r[p][0], h = r[p][1], b = e[d], w = e[h], m = t[d], S = t[h], A = w - b, T = S - m;
1673
- let L = b + l;
1666
+ function xr(e, t, r, s, n, a, o, i, l, d, u) {
1667
+ let y = 0, g = i;
1668
+ for (let m = a; m <= o; m++)
1669
+ if (s[g] = e[m], n[g] = t[m], g++, y < r.length && m === r[y][0]) {
1670
+ const b = r[y][0], h = r[y][1], f = e[b], w = e[h], p = t[b], S = t[h], E = w - f, _ = S - p;
1671
+ let L = f + l;
1674
1672
  for (; L < w; )
1675
- s[g] = L, n[g] = f ? m + (L - b) * T / A : u, g++, L += l;
1676
- p++;
1673
+ s[g] = L, n[g] = d ? p + (L - f) * _ / E : u, g++, L += l;
1674
+ y++;
1677
1675
  }
1678
1676
  return g - i;
1679
1677
  }
1680
- function Dr(e, t, r, s, n, a, o, i) {
1681
- let l = a, f = 0, u = i;
1682
- const p = r.length;
1683
- for (; l < o && f < p; ) {
1684
- const g = r[f][0];
1685
- e[l] <= g ? (s[u] = e[l], n[u] = t[l], l++) : (s[u] = g, n[u] = r[f][1], f++), u++;
1678
+ function Pr(e, t, r, s, n, a, o, i) {
1679
+ let l = a, d = 0, u = i;
1680
+ const y = r.length;
1681
+ for (; l < o && d < y; ) {
1682
+ const g = r[d][0];
1683
+ e[l] <= g ? (s[u] = e[l], n[u] = t[l], l++) : (s[u] = g, n[u] = r[d][1], d++), u++;
1686
1684
  }
1687
1685
  for (; l < o; )
1688
1686
  s[u] = e[l], n[u] = t[l], l++, u++;
1689
- for (; f < p; )
1690
- s[u] = r[f][0], n[u] = r[f][1], f++, u++;
1687
+ for (; d < y; )
1688
+ s[u] = r[d][0], n[u] = r[d][1], d++, u++;
1691
1689
  return u - i;
1692
1690
  }
1693
- function Cr(e, t, r, s, n, a, o, i) {
1694
- let l = 0, f = i;
1691
+ function Nr(e, t, r, s, n, a, o, i) {
1692
+ let l = 0, d = i;
1695
1693
  for (let u = a; u <= o; u++)
1696
- l < r.length && u === r[l] ? l++ : (s[f] = e[u], n[f] = t[u], f++);
1697
- return f - i;
1694
+ l < r.length && u === r[l] ? l++ : (s[d] = e[u], n[d] = t[u], d++);
1695
+ return d - i;
1698
1696
  }
1699
- function Fr(e, t, r, s) {
1697
+ function Br(e, t, r, s) {
1700
1698
  const n = r.length, a = new Array(n);
1701
1699
  if (s.isMonth)
1702
1700
  for (let o = 0; o < n; o++) {
@@ -1715,30 +1713,30 @@ function Fr(e, t, r, s) {
1715
1713
  }
1716
1714
  return a;
1717
1715
  }
1718
- function Pr(e, t, r) {
1716
+ function jr(e, t, r) {
1719
1717
  for (let s = 0; s < r.length; s++) {
1720
- const { indexes: n, lowerIdx: a, upperIdx: o } = r[s], i = e[a], l = t[a], f = e[o], u = t[o], p = f - i, g = u - l;
1721
- if (p === 0) {
1722
- for (let y = 0; y < n.length; y++) t[n[y]] = l;
1718
+ const { indexes: n, lowerIdx: a, upperIdx: o } = r[s], i = e[a], l = t[a], d = e[o], u = t[o], y = d - i, g = u - l;
1719
+ if (y === 0) {
1720
+ for (let m = 0; m < n.length; m++) t[n[m]] = l;
1723
1721
  continue;
1724
1722
  }
1725
- for (let y = 0; y < n.length; y++) {
1726
- const d = n[y];
1727
- t[d] = l + (e[d] - i) * g / p;
1723
+ for (let m = 0; m < n.length; m++) {
1724
+ const b = n[m];
1725
+ t[b] = l + (e[b] - i) * g / y;
1728
1726
  }
1729
1727
  }
1730
1728
  }
1731
- function xr(e, t, r) {
1729
+ function Wr(e, t, r) {
1732
1730
  for (let s = 0; s < r.length; s++) {
1733
1731
  const n = r[s][0], a = r[s][1], o = r[s][2];
1734
1732
  if (a <= n) continue;
1735
1733
  const i = e[n], l = e[a] - i;
1736
1734
  if (l !== 0)
1737
- for (let f = n; f < a; f++)
1738
- t[f] = t[f] + o * ((e[f] - i) / l);
1735
+ for (let d = n; d < a; d++)
1736
+ t[d] = t[d] + o * ((e[d] - i) / l);
1739
1737
  }
1740
1738
  }
1741
- function lt(e, t, r, s) {
1739
+ function dt(e, t, r, s) {
1742
1740
  const n = t.length;
1743
1741
  if (r === "ADD")
1744
1742
  for (let a = 0; a < n; a++) e[t[a]] = e[t[a]] + s;
@@ -1751,7 +1749,7 @@ function lt(e, t, r, s) {
1751
1749
  else if (r === "ASSIGN")
1752
1750
  for (let a = 0; a < n; a++) e[t[a]] = s;
1753
1751
  }
1754
- const Nr = 1, Ce = `qc-utils:calibration:v${Nr}`, Br = 720 * 60 * 60 * 1e3, ne = 5e4, oe = 2e5, le = {
1752
+ const Yr = 1, Pe = `qc-utils:calibration:v${Yr}`, Gr = 720 * 60 * 60 * 1e3, ae = 5e4, ie = 2e5, fe = {
1755
1753
  spawnOverheadMs: 50,
1756
1754
  // worst-case Windows
1757
1755
  inlineThroughput: 5e4,
@@ -1762,93 +1760,93 @@ const Nr = 1, Ce = `qc-utils:calibration:v${Nr}`, Br = 720 * 60 * 60 * 1e3, ne =
1762
1760
  measuredAt: 0,
1763
1761
  userAgent: "default"
1764
1762
  };
1765
- let M = Gr() ?? le, Fe = null, Q = null;
1766
- const Ie = /* @__PURE__ */ new Set(), Me = {
1763
+ let M = Xr() ?? fe, Ne = null, te = null;
1764
+ const Ue = /* @__PURE__ */ new Set(), Fe = {
1767
1765
  // Filter ops — read-only scans, cheap kernels
1768
- [v.VALUE_THRESHOLD]: {
1766
+ [T.VALUE_THRESHOLD]: {
1769
1767
  mode: "calibrated",
1770
1768
  weight: 1,
1771
1769
  rationale: "O(n) single-pass scan; baseline reference"
1772
1770
  },
1773
- [v.CHANGE]: {
1771
+ [T.CHANGE]: {
1774
1772
  mode: "calibrated",
1775
1773
  weight: 1.1,
1776
1774
  rationale: "O(n) with one subtraction per step"
1777
1775
  },
1778
- [v.RATE_OF_CHANGE]: {
1776
+ [T.RATE_OF_CHANGE]: {
1779
1777
  mode: "calibrated",
1780
1778
  weight: 1.4,
1781
1779
  rationale: "O(n) with division + abs per step"
1782
1780
  },
1783
- [v.FIND_GAPS]: {
1781
+ [T.FIND_GAPS]: {
1784
1782
  mode: "calibrated",
1785
1783
  weight: 0.9,
1786
1784
  rationale: "O(n) on X only, mostly empty output"
1787
1785
  },
1788
- [v.PERSISTENCE]: {
1786
+ [T.PERSISTENCE]: {
1789
1787
  mode: "calibrated",
1790
1788
  weight: 1.3,
1791
1789
  rationale: "O(n) + chunk-boundary stitch"
1792
1790
  },
1793
- [v.DATETIME_RANGE]: {
1791
+ [T.DATETIME_RANGE]: {
1794
1792
  mode: "always-inline",
1795
1793
  weight: 0,
1796
1794
  rationale: "O(log n) binary search; never worth the worker hop"
1797
1795
  },
1798
- [v.SELECTION]: {
1796
+ [T.SELECTION]: {
1799
1797
  mode: "always-inline",
1800
1798
  weight: 0,
1801
1799
  rationale: "Pure history bookkeeping"
1802
1800
  },
1803
1801
  // Edit ops — mutate Y in place or rebuild arrays
1804
- [E.CHANGE_VALUES]: {
1802
+ [v.CHANGE_VALUES]: {
1805
1803
  mode: "calibrated",
1806
1804
  weight: 0.7,
1807
1805
  rationale: "O(k) in-place arithmetic on selection"
1808
1806
  },
1809
- [E.ASSIGN_VALUES_BULK]: {
1807
+ [v.ASSIGN_VALUES_BULK]: {
1810
1808
  mode: "always-inline",
1811
1809
  weight: 0,
1812
1810
  rationale: "Single tight loop, already inline"
1813
1811
  },
1814
- [E.ASSIGN_DATETIMES_BULK]: {
1812
+ [v.ASSIGN_DATETIMES_BULK]: {
1815
1813
  mode: "always-inline",
1816
1814
  weight: 0,
1817
1815
  rationale: "Composes delete+add which handle their own dispatch"
1818
1816
  },
1819
- [E.INTERPOLATE]: {
1817
+ [v.INTERPOLATE]: {
1820
1818
  mode: "calibrated",
1821
1819
  weight: 1.5,
1822
1820
  rationale: "Linear interp per consecutive group; in-place writes"
1823
1821
  },
1824
- [E.DRIFT_CORRECTION]: {
1822
+ [v.DRIFT_CORRECTION]: {
1825
1823
  mode: "calibrated",
1826
1824
  weight: 1.2,
1827
1825
  rationale: "O(range total) in-place math; one pass per range"
1828
1826
  },
1829
- [E.SHIFT_DATETIMES]: {
1827
+ [v.SHIFT_DATETIMES]: {
1830
1828
  mode: "calibrated",
1831
1829
  weight: 1.1,
1832
1830
  rationale: "O(k) per-point shift math; inline skips SAB allocation"
1833
1831
  },
1834
- [E.ADD_POINTS]: {
1832
+ [v.ADD_POINTS]: {
1835
1833
  mode: "calibrated",
1836
1834
  weight: 1.8,
1837
1835
  rationale: "Single merge pass over Y/X + insertions; fresh SAB per call"
1838
1836
  },
1839
- [E.DELETE_POINTS]: {
1837
+ [v.DELETE_POINTS]: {
1840
1838
  mode: "calibrated",
1841
1839
  weight: 1.4,
1842
1840
  rationale: "Single skip-on-delete pass over Y/X; fresh SAB per call"
1843
1841
  },
1844
- [E.FILL_GAPS]: {
1842
+ [v.FILL_GAPS]: {
1845
1843
  mode: "calibrated",
1846
1844
  weight: 1.3,
1847
1845
  rationale: "Single copy-with-fills pass; fresh SAB sized to newLength"
1848
1846
  }
1849
1847
  };
1850
- function O(e, t) {
1851
- const r = Me[e];
1848
+ function D(e, t) {
1849
+ const r = Fe[e];
1852
1850
  if (!r)
1853
1851
  return {
1854
1852
  useWorker: !0,
@@ -1877,7 +1875,7 @@ function O(e, t) {
1877
1875
  predictedWorkerMs: 0,
1878
1876
  reason: r.rationale
1879
1877
  };
1880
- const s = jr(e, t);
1878
+ const s = Hr(e, t);
1881
1879
  if (s <= 0)
1882
1880
  return {
1883
1881
  useWorker: !1,
@@ -1899,16 +1897,16 @@ function O(e, t) {
1899
1897
  reason: i ? `worker faster (${o.toFixed(1)} vs ${a.toFixed(1)} ms)` : `inline faster (${a.toFixed(1)} vs ${o.toFixed(1)} ms)`
1900
1898
  };
1901
1899
  }
1902
- function jr(e, t) {
1900
+ function Hr(e, t) {
1903
1901
  switch (e) {
1904
- case E.CHANGE_VALUES:
1905
- case E.INTERPOLATE:
1906
- case E.SHIFT_DATETIMES:
1907
- case E.DRIFT_CORRECTION:
1902
+ case v.CHANGE_VALUES:
1903
+ case v.INTERPOLATE:
1904
+ case v.SHIFT_DATETIMES:
1905
+ case v.DRIFT_CORRECTION:
1908
1906
  return t.selectionSize ?? 0;
1909
- case E.DELETE_POINTS:
1907
+ case v.DELETE_POINTS:
1910
1908
  return (t.selectionSize ?? 0) + t.datasetSize * 0.25;
1911
- case E.ADD_POINTS: {
1909
+ case v.ADD_POINTS: {
1912
1910
  const r = Math.max(1, Math.log2(Math.max(t.datasetSize, 2)));
1913
1911
  return t.datasetSize + (t.selectionSize ?? 0) * r;
1914
1912
  }
@@ -1916,59 +1914,59 @@ function jr(e, t) {
1916
1914
  return t.datasetSize;
1917
1915
  }
1918
1916
  }
1919
- function ys(e) {
1920
- return Ie.add(e), () => Ie.delete(e);
1917
+ function vs(e) {
1918
+ return Ue.add(e), () => Ue.delete(e);
1921
1919
  }
1922
- function gs() {
1920
+ function ks() {
1923
1921
  return M;
1924
1922
  }
1925
- function ms() {
1926
- return Fe;
1923
+ function _s() {
1924
+ return Ne;
1927
1925
  }
1928
- function ws() {
1929
- return Object.keys(Me).map((e) => ({ op: e, ...Me[e] }));
1926
+ function As() {
1927
+ return Object.keys(Fe).map((e) => ({ op: e, ...Fe[e] }));
1930
1928
  }
1931
- function bs() {
1932
- M = le, Fe = null;
1929
+ function Ts() {
1930
+ M = fe, Ne = null;
1933
1931
  try {
1934
- localStorage.removeItem(Ce);
1932
+ localStorage.removeItem(Pe);
1935
1933
  } catch {
1936
1934
  }
1937
1935
  }
1938
- async function Ss(e = {}) {
1939
- if (typeof window > "u" || !(e.force || M.measuredAt === 0 || Date.now() - M.measuredAt > Br)) return M;
1940
- if (Q) await Q;
1936
+ async function Ls(e = {}) {
1937
+ if (typeof window > "u" || !(e.force || M.measuredAt === 0 || Date.now() - M.measuredAt > Gr)) return M;
1938
+ if (te) await te;
1941
1939
  else {
1942
- Q = Wr().finally(() => {
1943
- Q = null;
1940
+ te = zr().finally(() => {
1941
+ te = null;
1944
1942
  });
1945
- const r = await Q;
1946
- M = r, Yr(r), Fe = r;
1947
- for (const s of Ie) s(M);
1943
+ const r = await te;
1944
+ M = r, Vr(r), Ne = r;
1945
+ for (const s of Ue) s(M);
1948
1946
  }
1949
1947
  return M;
1950
1948
  }
1951
- async function Wr() {
1949
+ async function zr() {
1952
1950
  if (!(typeof SharedArrayBuffer < "u"))
1953
1951
  return {
1954
- ...le,
1952
+ ...fe,
1955
1953
  measuredAt: Date.now(),
1956
1954
  userAgent: navigator.userAgent,
1957
- hwConcurrency: navigator.hardwareConcurrency || le.hwConcurrency,
1955
+ hwConcurrency: navigator.hardwareConcurrency || fe.hwConcurrency,
1958
1956
  sharedArrayBufferAvailable: !1,
1959
1957
  samples: { spawnRoundtripMs: [], inlineScanMs: [], workerScanMs: [] }
1960
1958
  };
1961
- const t = navigator.hardwareConcurrency || 4, r = new Float32Array(ne);
1962
- for (let h = 0; h < ne; h++) r[h] = Math.sin(h);
1963
- const s = await Ee(3, () => {
1959
+ const t = navigator.hardwareConcurrency || 4, r = new Float32Array(ae);
1960
+ for (let h = 0; h < ae; h++) r[h] = Math.sin(h);
1961
+ const s = await _e(3, () => {
1964
1962
  const h = performance.now();
1965
- return Pt(r, 0, ne, [2], [0.5]), performance.now() - h;
1966
- }), n = ke(s), a = ne / Math.max(n, 1e-3), o = new SharedArrayBuffer(256 * Float32Array.BYTES_PER_ELEMENT), i = await Ee(3, async () => {
1963
+ return jt(r, 0, ae, [2], [0.5]), performance.now() - h;
1964
+ }), n = Ae(s), a = ae / Math.max(n, 1e-3), o = new SharedArrayBuffer(256 * Float32Array.BYTES_PER_ELEMENT), i = await _e(3, async () => {
1967
1965
  const h = performance.now();
1968
- return await new Promise((b) => {
1969
- const w = new Re();
1966
+ return await new Promise((f) => {
1967
+ const w = new Me();
1970
1968
  w.onmessage = () => {
1971
- w.terminate(), b();
1969
+ w.terminate(), f();
1972
1970
  }, w.postMessage({
1973
1971
  bufferY: o,
1974
1972
  start: 0,
@@ -1977,29 +1975,29 @@ async function Wr() {
1977
1975
  values: [0.5]
1978
1976
  });
1979
1977
  }), performance.now() - h;
1980
- }), l = ke(i), f = new SharedArrayBuffer(
1981
- oe * Float32Array.BYTES_PER_ELEMENT
1982
- ), u = new Float32Array(f);
1983
- for (let h = 0; h < oe; h++) u[h] = Math.sin(h);
1984
- const p = await Ee(3, async () => {
1978
+ }), l = Ae(i), d = new SharedArrayBuffer(
1979
+ ie * Float32Array.BYTES_PER_ELEMENT
1980
+ ), u = new Float32Array(d);
1981
+ for (let h = 0; h < ie; h++) u[h] = Math.sin(h);
1982
+ const y = await _e(3, async () => {
1985
1983
  const h = performance.now();
1986
- return await new Promise((b) => {
1987
- const w = new Re();
1984
+ return await new Promise((f) => {
1985
+ const w = new Me();
1988
1986
  w.onmessage = () => {
1989
- w.terminate(), b();
1987
+ w.terminate(), f();
1990
1988
  }, w.postMessage({
1991
- bufferY: f,
1989
+ bufferY: d,
1992
1990
  start: 0,
1993
- end: oe,
1991
+ end: ie,
1994
1992
  ops: [2],
1995
1993
  values: [0.5]
1996
1994
  });
1997
1995
  }), performance.now() - h;
1998
- }), g = Math.max(ke(p) - l, 0.1), y = oe / g;
1996
+ }), g = Math.max(Ae(y) - l, 0.1), m = ie / g;
1999
1997
  return {
2000
1998
  spawnOverheadMs: l,
2001
1999
  inlineThroughput: a,
2002
- workerThroughput: y,
2000
+ workerThroughput: m,
2003
2001
  hwConcurrency: t,
2004
2002
  measuredAt: Date.now(),
2005
2003
  userAgent: navigator.userAgent,
@@ -2007,25 +2005,25 @@ async function Wr() {
2007
2005
  samples: {
2008
2006
  spawnRoundtripMs: i,
2009
2007
  inlineScanMs: s,
2010
- workerScanMs: p
2008
+ workerScanMs: y
2011
2009
  }
2012
2010
  };
2013
2011
  }
2014
- async function Ee(e, t) {
2012
+ async function _e(e, t) {
2015
2013
  const r = [];
2016
2014
  for (let s = 0; s < e; s++)
2017
2015
  await new Promise((n) => setTimeout(n, 0)), r.push(await t());
2018
2016
  return r;
2019
2017
  }
2020
- function ke(e) {
2018
+ function Ae(e) {
2021
2019
  if (!e.length) return 0;
2022
2020
  const t = [...e].sort((s, n) => s - n), r = Math.floor(t.length / 2);
2023
2021
  return t.length % 2 ? t[r] : (t[r - 1] + t[r]) / 2;
2024
2022
  }
2025
- function Gr() {
2023
+ function Xr() {
2026
2024
  if (typeof localStorage > "u") return null;
2027
2025
  try {
2028
- const e = localStorage.getItem(Ce);
2026
+ const e = localStorage.getItem(Pe);
2029
2027
  if (!e) return null;
2030
2028
  const t = JSON.parse(e);
2031
2029
  return !t || typeof t.spawnOverheadMs != "number" ? null : t;
@@ -2033,7 +2031,7 @@ function Gr() {
2033
2031
  return null;
2034
2032
  }
2035
2033
  }
2036
- function Yr(e) {
2034
+ function Vr(e) {
2037
2035
  if (!(typeof localStorage > "u"))
2038
2036
  try {
2039
2037
  const t = {
@@ -2044,33 +2042,48 @@ function Yr(e) {
2044
2042
  measuredAt: e.measuredAt,
2045
2043
  userAgent: e.userAgent
2046
2044
  };
2047
- localStorage.setItem(Ce, JSON.stringify(t));
2045
+ localStorage.setItem(Pe, JSON.stringify(t));
2048
2046
  } catch {
2049
2047
  }
2050
2048
  }
2051
- const Z = 20 * 1e3, Hr = 1024, zr = ["date", "value", "qualifier"], Xr = typeof SharedArrayBuffer < "u";
2049
+ const re = 20 * 1e3, qr = 1024, Jr = ["date", "value", "qualifier"], Qr = typeof SharedArrayBuffer < "u";
2052
2050
  function U(e, t) {
2053
- return Xr ? t !== void 0 ? new SharedArrayBuffer(e, { maxByteLength: t }) : new SharedArrayBuffer(e) : t !== void 0 ? new ArrayBuffer(e, { maxByteLength: t }) : new ArrayBuffer(e);
2051
+ return Qr ? t !== void 0 ? new SharedArrayBuffer(e, { maxByteLength: t }) : new SharedArrayBuffer(e) : t !== void 0 ? new ArrayBuffer(e, { maxByteLength: t }) : new ArrayBuffer(e);
2054
2052
  }
2055
- function ut(e, t) {
2053
+ function pt(e, t) {
2056
2054
  const r = e;
2057
2055
  typeof r.grow == "function" ? r.grow(t) : typeof r.resize == "function" && r.resize(t);
2058
2056
  }
2059
- class Es {
2057
+ function Kr(e, t) {
2058
+ if (e.length !== t.length) return !1;
2059
+ for (let r = 0; r < e.length; r++)
2060
+ if (e[r] !== t[r]) return !1;
2061
+ return !0;
2062
+ }
2063
+ function Zr(e, t) {
2064
+ switch (e) {
2065
+ case v.ADD_POINTS:
2066
+ case v.FILL_GAPS:
2067
+ return !1;
2068
+ default:
2069
+ return !0;
2070
+ }
2071
+ }
2072
+ class $s {
2060
2073
  /** The generated dataset to be used for plotting */
2061
2074
  dataset = {
2062
- dimensions: zr,
2075
+ dimensions: Jr,
2063
2076
  source: {
2064
2077
  x: new Float64Array(
2065
2078
  U(
2066
- Z * Float64Array.BYTES_PER_ELEMENT,
2067
- Z * Float64Array.BYTES_PER_ELEMENT
2079
+ re * Float64Array.BYTES_PER_ELEMENT,
2080
+ re * Float64Array.BYTES_PER_ELEMENT
2068
2081
  )
2069
2082
  ),
2070
2083
  y: new Float32Array(
2071
2084
  U(
2072
- Z * Float32Array.BYTES_PER_ELEMENT,
2073
- Z * Float32Array.BYTES_PER_ELEMENT
2085
+ re * Float32Array.BYTES_PER_ELEMENT,
2086
+ re * Float32Array.BYTES_PER_ELEMENT
2074
2087
  )
2075
2088
  )
2076
2089
  }
@@ -2110,7 +2123,7 @@ class Es {
2110
2123
  if (!t)
2111
2124
  return;
2112
2125
  this.isLoading = !0;
2113
- const r = await be(() => {
2126
+ const r = await ke(() => {
2114
2127
  this._growBuffer(t.datetimes.length), this._resizeTo(t.datetimes.length), this.dataX.set(t.datetimes), this.dataY.set(t.dataValues);
2115
2128
  });
2116
2129
  this.loadingTime = r.duration, this.history.length = 0, this.isLoading = !1;
@@ -2141,7 +2154,7 @@ class Es {
2141
2154
  const r = t * Float64Array.BYTES_PER_ELEMENT;
2142
2155
  let s = this.dataX.buffer.byteLength;
2143
2156
  for (; r > s; )
2144
- s += Z * Float64Array.BYTES_PER_ELEMENT;
2157
+ s += re * Float64Array.BYTES_PER_ELEMENT;
2145
2158
  if (s * Float64Array.BYTES_PER_ELEMENT > this.dataX.buffer.maxByteLength) {
2146
2159
  const n = U(
2147
2160
  this.dataX.buffer.byteLength,
@@ -2152,7 +2165,7 @@ class Es {
2152
2165
  ), o = new Float64Array(n), i = new Float32Array(a);
2153
2166
  o.set(this.dataX), i.set(this.dataY), this.dataset.source.x = o, this.dataset.source.y = i;
2154
2167
  }
2155
- this.dataX.buffer.byteLength < t * Float64Array.BYTES_PER_ELEMENT && (ut(this.dataX.buffer, t * Float64Array.BYTES_PER_ELEMENT), ut(this.dataY.buffer, t * Float32Array.BYTES_PER_ELEMENT));
2168
+ this.dataX.buffer.byteLength < t * Float64Array.BYTES_PER_ELEMENT && (pt(this.dataX.buffer, t * Float64Array.BYTES_PER_ELEMENT), pt(this.dataY.buffer, t * Float32Array.BYTES_PER_ELEMENT));
2156
2169
  }
2157
2170
  /**
2158
2171
  * Reloads the dataset with the raw data
@@ -2213,55 +2226,52 @@ class Es {
2213
2226
  get endTime() {
2214
2227
  return this.dataset.source.x.length ? new Date(this.dataset.source.x[this.dataset.source.x.length - 1]) : null;
2215
2228
  }
2216
- /** Dispatch an operation and log its signature in hisotry */
2229
+ /**
2230
+ * Dispatch an operation and log its signature in history.
2231
+ *
2232
+ * The selection-consuming entries below (DELETE_POINTS, INTERPOLATE,
2233
+ * SHIFT_DATETIMES, DRIFT_CORRECTION) route to thin
2234
+ * `*FromSelection` wrappers that read the target indices off
2235
+ * `history[length - 2].selected` at dispatch time, mirroring the
2236
+ * pattern CHANGE_VALUES already uses. The internal handlers
2237
+ * (`_deleteDataPoints`, `_shift`, etc.) keep their explicit-
2238
+ * indices signatures so other internal callers (e.g.
2239
+ * `_assignDatetimesBulk` → `_deleteDataPoints` + `_addDataPoints`)
2240
+ * can pass locally-computed indices without going through history.
2241
+ */
2217
2242
  async dispatchAction(t, ...r) {
2218
2243
  const s = {
2219
- [E.ADD_POINTS]: this._addDataPoints,
2220
- [E.CHANGE_VALUES]: this._changeValues,
2221
- [E.ASSIGN_VALUES_BULK]: this._assignValuesBulk,
2222
- [E.DELETE_POINTS]: this._deleteDataPoints,
2223
- [E.DRIFT_CORRECTION]: this._driftCorrection,
2224
- [E.INTERPOLATE]: this._interpolate,
2225
- [E.SHIFT_DATETIMES]: this._shift,
2226
- [E.ASSIGN_DATETIMES_BULK]: this._assignDatetimesBulk,
2227
- [E.FILL_GAPS]: this._fillGaps
2228
- }, n = {
2229
- [E.ADD_POINTS]: "mdi-plus",
2230
- [E.CHANGE_VALUES]: "mdi-pencil",
2231
- [E.ASSIGN_VALUES_BULK]: "mdi-pencil",
2232
- [E.DELETE_POINTS]: "mdi-trash-can",
2233
- [E.DRIFT_CORRECTION]: "mdi-chart-sankey",
2234
- [E.INTERPOLATE]: "mdi-transit-connection-horizontal",
2235
- [E.SHIFT_DATETIMES]: "mdi-calendar",
2236
- [E.ASSIGN_DATETIMES_BULK]: "mdi-calendar",
2237
- [E.FILL_GAPS]: "mdi-keyboard-space"
2244
+ [v.ADD_POINTS]: this._addDataPoints,
2245
+ [v.CHANGE_VALUES]: this._changeValues,
2246
+ [v.ASSIGN_VALUES_BULK]: this._assignValuesBulk,
2247
+ [v.DELETE_POINTS]: this._deleteDataPointsFromSelection,
2248
+ [v.DRIFT_CORRECTION]: this._driftCorrectionFromSelection,
2249
+ [v.INTERPOLATE]: this._interpolateFromSelection,
2250
+ [v.SHIFT_DATETIMES]: this._shiftFromSelection,
2251
+ [v.ASSIGN_DATETIMES_BULK]: this._assignDatetimesBulk,
2252
+ [v.FILL_GAPS]: this._fillGaps
2238
2253
  };
2239
- let a = [];
2254
+ let n = [], a = null;
2240
2255
  try {
2241
- this._isReplaying || (this.redoStack.length = 0);
2242
- const o = {
2256
+ this._isReplaying || (this.redoStack.length = 0), a = {
2243
2257
  method: t,
2244
2258
  args: r,
2245
- icon: n[t],
2246
2259
  isLoading: !0
2247
- };
2248
- this.history.push(o);
2249
- const i = this.history.length - 1;
2250
- this._pendingExecutionMode = "inline";
2251
- const l = await be(async () => await s[t].apply(this, r));
2252
- a = l.response;
2253
- const f = this.history[i];
2254
- f && (f.duration = l.duration, f.executionMode = this._pendingExecutionMode, f.isLoading = !1);
2255
- } catch (o) {
2256
- console.log(
2257
- `Failed to execute operation: ${t} with arguments: `,
2258
- r
2259
- ), console.log(o);
2260
+ }, this.history.push(a), Zr(t, r) || this.history[this.history.length - 2]?.method === T.SELECTION && this.history.splice(this.history.length - 2, 1), this._pendingExecutionMode = "inline";
2261
+ const o = await ke(async () => await s[t].apply(this, r));
2262
+ n = o.response;
2263
+ const i = this.history.indexOf(a), l = i >= 0 ? this.history[i] : void 0;
2264
+ l && (l.duration = o.duration, l.executionMode = this._pendingExecutionMode, l.status = "success", l.isLoading = !1);
2265
+ } catch {
2266
+ if (a) {
2267
+ const i = this.history.indexOf(a), l = i >= 0 ? this.history[i] : void 0;
2268
+ l && (l.status = "failed", l.isLoading = !1);
2269
+ }
2260
2270
  }
2261
- return a;
2271
+ return n;
2262
2272
  }
2263
2273
  async dispatch(t, ...r) {
2264
- const s = async (n, a) => v[n] ? await this.dispatchFilter(n, ...a) : await this.dispatchAction(n, ...a);
2274
+ const s = async (n, a) => T[n] ? await this.dispatchFilter(n, ...a) : await this.dispatchAction(n, ...a);
2265
2275
  if (Array.isArray(t)) {
2266
2276
  let n = [];
2267
2277
  for (let a = 0; a < t.length; a++) {
@@ -2275,44 +2285,39 @@ class Es {
2275
2285
  /** Filter operations do not transform the data and return a selection */
2276
2286
  async dispatchFilter(t, ...r) {
2277
2287
  const s = {
2278
- [v.FIND_GAPS]: this._findGaps,
2279
- [v.VALUE_THRESHOLD]: this._valueThreshold,
2280
- [v.DATETIME_RANGE]: this._datetimeRange,
2281
- [v.PERSISTENCE]: this._persistence,
2282
- [v.CHANGE]: this._change,
2283
- [v.RATE_OF_CHANGE]: this._rateOfChange,
2284
- [v.SELECTION]: this._selection
2285
- }, n = {
2286
- [v.FIND_GAPS]: "mdi-plus",
2287
- [v.PERSISTENCE]: "mdi-plus",
2288
- [v.CHANGE]: "mdi-plus",
2289
- [v.RATE_OF_CHANGE]: "mdi-plus",
2290
- [v.VALUE_THRESHOLD]: "mdi-plus",
2291
- [v.DATETIME_RANGE]: "mdi-plus",
2292
- [v.SELECTION]: "mdi-plus"
2288
+ [T.FIND_GAPS]: this._findGaps,
2289
+ [T.VALUE_THRESHOLD]: this._valueThreshold,
2290
+ [T.DATETIME_RANGE]: this._datetimeRange,
2291
+ [T.PERSISTENCE]: this._persistence,
2292
+ [T.CHANGE]: this._change,
2293
+ [T.RATE_OF_CHANGE]: this._rateOfChange,
2294
+ [T.SELECTION]: this._selection
2293
2295
  };
2294
- let a = [];
2296
+ let n = [], a = null;
2295
2297
  try {
2296
- this._isReplaying || (this.redoStack.length = 0);
2297
- const o = {
2298
+ const o = t === T.SELECTION, i = o && (!r[0] || Array.isArray(r[0]) && r[0].length === 0);
2299
+ !this._isReplaying && !i && (this.redoStack.length = 0), a = {
2298
2300
  method: t,
2299
2301
  args: r,
2300
- icon: n[t],
2301
2302
  isLoading: !0
2302
- }, i = this.history[this.history.length - 1];
2303
- let l;
2304
- v[i?.method] ? (l = this.history.length - 1, this.history[l] = o) : (this.history.push(o), l = this.history.length - 1), this._pendingExecutionMode = "inline";
2305
- const f = await be(async () => await s[t].apply(this, r));
2306
- a = f.response;
2307
- const u = this.history[l];
2308
- u && (u.duration = f.duration, u.executionMode = this._pendingExecutionMode, u.selected = f.response, u.isLoading = !1);
2303
+ };
2304
+ const l = this.history[this.history.length - 1], d = !!T[l?.method], u = l?.method === t || d && !o;
2305
+ let y;
2306
+ u ? (y = this.history.length - 1, this.history[y] = a) : (this.history.push(a), y = this.history.length - 1), this._pendingExecutionMode = "inline";
2307
+ const g = await ke(async () => await s[t].apply(this, r));
2308
+ n = g.response;
2309
+ const m = this.history.indexOf(a), b = m >= 0 ? this.history[m] : void 0;
2310
+ b && (b.duration = g.duration, b.executionMode = this._pendingExecutionMode, b.selected = g.response, b.status = "success", b.isLoading = !1);
2309
2311
  } catch (o) {
2310
- console.log(
2312
+ if (console.log(
2311
2313
  `Failed to execute filter operation: ${t} with arguments: `,
2312
2314
  r
2313
- ), console.log(o);
2315
+ ), console.log(o), a) {
2316
+ const i = this.history.indexOf(a), l = i >= 0 ? this.history[i] : void 0;
2317
+ l && (l.status = "failed", l.isLoading = !1);
2318
+ }
2314
2319
  }
2315
- return a;
2320
+ return n;
2316
2321
  }
2317
2322
  /**
2318
2323
  * @param index An array containing the list of index of values to perform the operations on.
@@ -2330,32 +2335,32 @@ class Es {
2330
2335
  const s = this.history[this.history.length - 2]?.selected;
2331
2336
  if (!s || s.length === 0) return [];
2332
2337
  const n = s.length;
2333
- if (!O(E.CHANGE_VALUES, {
2338
+ if (!D(v.CHANGE_VALUES, {
2334
2339
  datasetSize: this.dataset.source.y.length,
2335
2340
  selectionSize: n
2336
- }).useWorker || n < Hr)
2337
- return lt(this.dataY, s, t, r), [];
2341
+ }).useWorker || n < qr)
2342
+ return dt(this.dataY, s, t, r), [];
2338
2343
  this._pendingExecutionMode = "worker";
2339
- const o = Math.min(navigator.hardwareConcurrency || 1, n), i = Math.ceil(n / o), l = [], f = [];
2344
+ const o = Math.min(navigator.hardwareConcurrency || 1, n), i = Math.ceil(n / o), l = [], d = [];
2340
2345
  for (let u = 0; u < o; u++) {
2341
- const p = u * i, g = Math.min((u + 1) * i, n);
2342
- if (p >= g) break;
2343
- const y = s.slice(p, g);
2344
- f.push(
2345
- new Promise((d) => {
2346
- const h = new $r();
2346
+ const y = u * i, g = Math.min((u + 1) * i, n);
2347
+ if (y >= g) break;
2348
+ const m = s.slice(y, g);
2349
+ d.push(
2350
+ new Promise((b) => {
2351
+ const h = new Mr();
2347
2352
  l.push(h), h.postMessage({
2348
2353
  bufferY: this.dataY.buffer,
2349
- indexes: y,
2354
+ indexes: m,
2350
2355
  operator: t,
2351
2356
  value: r
2352
- }), h.onmessage = (b) => {
2353
- d(b.data);
2357
+ }), h.onmessage = (f) => {
2358
+ b(f.data);
2354
2359
  };
2355
2360
  })
2356
2361
  );
2357
2362
  }
2358
- return await Promise.all(f), l.forEach((u) => u.terminate()), [];
2363
+ return await Promise.all(d), l.forEach((u) => u.terminate()), [];
2359
2364
  }
2360
2365
  /**
2361
2366
  * Apply an arithmetic operator to Y in-place on the main thread. Thin
@@ -2364,7 +2369,7 @@ class Es {
2364
2369
  * CHANGE_VALUES fast path does.
2365
2370
  */
2366
2371
  _applyOperatorInPlace(t, r, s) {
2367
- lt(this.dataY, t, r, s);
2372
+ dt(this.dataY, t, r, s);
2368
2373
  }
2369
2374
  /**
2370
2375
  * One-shot assignment of distinct Y-values at the indices logged by the
@@ -2402,6 +2407,18 @@ class Es {
2402
2407
  n[o] = [t[o], this.dataY[r[o]]], a[o] = r[o];
2403
2408
  return a.sort((o, i) => o - i), await this._deleteDataPoints(a), await this._addDataPoints(n), [];
2404
2409
  }
2410
+ /**
2411
+ * Dispatch wrapper around `_interpolate` — reads target indices
2412
+ * from `history[length - 2].selected` (the SELECTION the caller
2413
+ * dispatched immediately before this op). External callers go
2414
+ * through here; internal callers can keep using `_interpolate`
2415
+ * directly with explicit indices.
2416
+ */
2417
+ async _interpolateFromSelection() {
2418
+ const t = this.history[this.history.length - 2]?.selected;
2419
+ if (!(!t || t.length === 0))
2420
+ return this._interpolate(t);
2421
+ }
2405
2422
  /**
2406
2423
  * Multi-threaded linear interpolation over the selected indexes.
2407
2424
  * 1. Main thread partitions the selected indexes into consecutive groups and computes each group's lower/upper anchors.
@@ -2416,53 +2433,48 @@ class Es {
2416
2433
  lowerIdx: Math.max(0, u[0] - 1),
2417
2434
  upperIdx: Math.min(s - 1, u[u.length - 1] + 1)
2418
2435
  }));
2419
- if (!O(E.INTERPOLATE, {
2436
+ if (!D(v.INTERPOLATE, {
2420
2437
  datasetSize: s,
2421
2438
  selectionSize: t.length
2422
2439
  }).useWorker) {
2423
- Pr(this.dataX, this.dataY, n);
2440
+ jr(this.dataX, this.dataY, n);
2424
2441
  return;
2425
2442
  }
2426
2443
  this._pendingExecutionMode = "worker";
2427
2444
  const o = Math.min(
2428
2445
  navigator.hardwareConcurrency || 1,
2429
2446
  n.length
2430
- ), i = Math.ceil(n.length / o), l = [], f = [];
2447
+ ), i = Math.ceil(n.length / o), l = [], d = [];
2431
2448
  for (let u = 0; u < o; u++) {
2432
- const p = n.slice(
2449
+ const y = n.slice(
2433
2450
  u * i,
2434
2451
  (u + 1) * i
2435
2452
  );
2436
- if (p.length === 0) break;
2437
- f.push(
2453
+ if (y.length === 0) break;
2454
+ d.push(
2438
2455
  new Promise((g) => {
2439
- const y = new Sr();
2440
- l.push(y), y.postMessage({
2456
+ const m = new _r();
2457
+ l.push(m), m.postMessage({
2441
2458
  bufferX: this.dataX.buffer,
2442
2459
  bufferY: this.dataY.buffer,
2443
- groups: p
2444
- }), y.onmessage = (d) => {
2445
- g(d.data);
2460
+ groups: y
2461
+ }), m.onmessage = (b) => {
2462
+ g(b.data);
2446
2463
  };
2447
2464
  })
2448
2465
  );
2449
2466
  }
2450
- await Promise.all(f), l.forEach((u) => u.terminate());
2451
- }
2452
- /** Interpolate existing values in the data source */
2453
- // private _interpolateLinear(
2454
- // datetime: number,
2455
- // lowerDatetime: number,
2456
- // lowerValue: number,
2457
- // upperDatetime: number,
2458
- // upperValue: number,
2459
- // ) {
2460
- // const interpolatedValue =
2461
- // lowerValue +
2462
- // ((datetime - lowerDatetime) * (upperValue - lowerValue)) /
2463
- // (upperDatetime - lowerDatetime);
2464
- // return interpolatedValue;
2465
- // }
2467
+ await Promise.all(d), l.forEach((u) => u.terminate());
2468
+ }
2469
+ /**
2470
+ * Dispatch wrapper around `_shift` — reads target indices from
2471
+ * `history[length - 2].selected`. The `amount` and `unit` args
2472
+ * stay parametric on the public dispatch signature.
2473
+ */
2474
+ async _shiftFromSelection(t, r) {
2475
+ const s = this.history[this.history.length - 2]?.selected;
2476
+ return !s || s.length === 0 ? [] : await this._shift(s, t, r) ?? [];
2477
+ }
2466
2478
  /**
2467
2479
  * Shifts the selected indexes by specified amount of units. Elements are reinserted according to their datetime.
2468
2480
  * @param index The index of the elements to shift
@@ -2471,52 +2483,51 @@ class Es {
2471
2483
  * @returns
2472
2484
  */
2473
2485
  async _shift(t, r, s) {
2474
- if (t.length === 0) return;
2475
- const n = s === F.MONTH, a = s === F.YEAR, o = !n && !a ? r * re[s] * 1e3 : 0, i = t.length;
2476
- if (!O(E.SHIFT_DATETIMES, {
2486
+ if (t.length === 0) return [];
2487
+ const n = s === W.MONTH, a = s === W.YEAR, o = !n && !a ? r * oe[s] * 1e3 : 0, i = t.length;
2488
+ if (!D(v.SHIFT_DATETIMES, {
2477
2489
  datasetSize: this.dataset.source.x.length,
2478
2490
  selectionSize: i
2479
2491
  }).useWorker) {
2480
- const m = Fr(
2492
+ const p = Br(
2481
2493
  this.dataX,
2482
2494
  this.dataY,
2483
2495
  t,
2484
2496
  { amount: r, isMonth: n, isYear: a, deltaMs: o }
2485
2497
  );
2486
- await this._deleteDataPoints(t), await this._addDataPoints(m);
2487
- return;
2498
+ return await this._deleteDataPoints(t), await this._addDataPoints(p) ?? [];
2488
2499
  }
2489
2500
  this._pendingExecutionMode = "worker";
2490
- const f = U(i * Float64Array.BYTES_PER_ELEMENT), u = U(i * Float32Array.BYTES_PER_ELEMENT), p = Math.min(navigator.hardwareConcurrency || 1, i), g = Math.ceil(i / p), y = [], d = [];
2491
- for (let m = 0; m < p; m++) {
2492
- const S = m * g, A = Math.min((m + 1) * g, i);
2493
- if (S >= A) break;
2494
- const T = t.slice(S, A);
2495
- d.push(
2501
+ const d = U(i * Float64Array.BYTES_PER_ELEMENT), u = U(i * Float32Array.BYTES_PER_ELEMENT), y = Math.min(navigator.hardwareConcurrency || 1, i), g = Math.ceil(i / y), m = [], b = [];
2502
+ for (let p = 0; p < y; p++) {
2503
+ const S = p * g, E = Math.min((p + 1) * g, i);
2504
+ if (S >= E) break;
2505
+ const _ = t.slice(S, E);
2506
+ b.push(
2496
2507
  new Promise((L) => {
2497
- const I = new vr();
2498
- y.push(I), I.postMessage({
2508
+ const $ = new Lr();
2509
+ m.push($), $.postMessage({
2499
2510
  bufferX: this.dataX.buffer,
2500
2511
  bufferY: this.dataY.buffer,
2501
- outputBufferX: f,
2512
+ outputBufferX: d,
2502
2513
  outputBufferY: u,
2503
- indexes: T,
2514
+ indexes: _,
2504
2515
  outStart: S,
2505
2516
  amount: r,
2506
2517
  isMonth: n,
2507
2518
  isYear: a,
2508
2519
  deltaMs: o
2509
- }), I.onmessage = (W) => {
2510
- L(W.data);
2520
+ }), $.onmessage = (I) => {
2521
+ L(I.data);
2511
2522
  };
2512
2523
  })
2513
2524
  );
2514
2525
  }
2515
- await Promise.all(d), y.forEach((m) => m.terminate());
2516
- const h = new Float64Array(f), b = new Float32Array(u), w = new Array(i);
2517
- for (let m = 0; m < i; m++)
2518
- w[m] = [h[m], b[m]];
2519
- await this._deleteDataPoints(t), await this._addDataPoints(w);
2526
+ await Promise.all(b), m.forEach((p) => p.terminate());
2527
+ const h = new Float64Array(d), f = new Float32Array(u), w = new Array(i);
2528
+ for (let p = 0; p < i; p++)
2529
+ w[p] = [h[p], f[p]];
2530
+ return await this._deleteDataPoints(t), await this._addDataPoints(w) ?? [];
2520
2531
  }
2521
2532
  /**
2522
2533
  * Multi-threaded version of {@link _fillGaps}.
@@ -2525,84 +2536,110 @@ class Es {
2525
2536
  * 3. Cumulative fill counts before each segment give each worker's output startTarget, ensuring no overlap.
2526
2537
  * 4. Each worker copies its segment to the output buffer and inserts its gap fills inline.
2527
2538
  */
2539
+ /**
2540
+ * @param range Optional `[startTs, endTs]` window in epoch
2541
+ * milliseconds. Both bounds inclusive; snapped to the nearest
2542
+ * enclosed point via binary search. Datetime-addressed (not
2543
+ * index-addressed) so the same call survives data growth and is
2544
+ * portable across datasets for QC script replay.
2545
+ */
2528
2546
  async _fillGaps(t, r, s, n, a) {
2529
2547
  const o = this.dataX.length;
2530
- if (o === 0) return;
2531
- const i = t[0] * re[t[1]] * 1e3, l = r[0] * re[r[1]] * 1e3, f = a?.[0] ?? 0, u = a?.[1] ?? o - 1, p = this.dataX, g = [], y = [];
2532
- let d = 0;
2533
- for (let k = f + 1; k <= u; k++)
2534
- if (p[k] - p[k - 1] > i) {
2535
- let P = 0, G = p[k - 1] + l;
2536
- for (; G < p[k]; )
2537
- P++, G += l;
2538
- P > 0 && (g.push([k - 1, k]), y.push(P), d += P);
2548
+ if (o === 0) return [];
2549
+ const i = t[0] * oe[t[1]] * 1e3, l = r[0] * oe[r[1]] * 1e3, d = this.dataX, u = a?.[0] != null && Number.isFinite(a[0]) ? B(d, a[0]) : 0, y = a?.[1] != null && Number.isFinite(a[1]) ? j(d, a[1]) : o - 1, g = [], m = [];
2550
+ let b = 0;
2551
+ for (let k = u + 1; k <= y; k++)
2552
+ if (d[k] - d[k - 1] > i) {
2553
+ let F = 0, x = d[k - 1] + l;
2554
+ for (; x < d[k]; )
2555
+ F++, x += l;
2556
+ F > 0 && (g.push([k - 1, k]), m.push(F), b += F);
2539
2557
  }
2540
- if (d === 0) return;
2541
- const h = o + d, b = h * Float64Array.BYTES_PER_ELEMENT, w = h * Float32Array.BYTES_PER_ELEMENT, m = U(
2542
- b,
2543
- Math.max(this.dataX.buffer.maxByteLength, b)
2544
- ), S = U(
2545
- w,
2546
- Math.max(this.dataY.buffer.maxByteLength, w)
2558
+ if (b === 0) return [];
2559
+ const h = new Array(b);
2560
+ let f = 0, w = 0;
2561
+ for (let k = 0; k < g.length; k++) {
2562
+ const P = g[k][0], F = m[k];
2563
+ for (let x = 1; x <= F; x++)
2564
+ h[w++] = P + f + x;
2565
+ f += F;
2566
+ }
2567
+ const p = o + b, S = p * Float64Array.BYTES_PER_ELEMENT, E = p * Float32Array.BYTES_PER_ELEMENT, _ = U(
2568
+ S,
2569
+ Math.max(this.dataX.buffer.maxByteLength, S)
2570
+ ), L = U(
2571
+ E,
2572
+ Math.max(this.dataY.buffer.maxByteLength, E)
2547
2573
  );
2548
- if (!O(E.FILL_GAPS, {
2574
+ if (!D(v.FILL_GAPS, {
2549
2575
  datasetSize: o,
2550
- selectionSize: d
2576
+ selectionSize: b
2551
2577
  }).useWorker) {
2552
- const k = new Float64Array(m), B = new Float32Array(S);
2553
- Or(
2578
+ const k = new Float64Array(_), P = new Float32Array(L);
2579
+ return xr(
2554
2580
  this.dataX,
2555
2581
  this.dataY,
2556
2582
  g,
2557
2583
  k,
2558
- B,
2584
+ P,
2559
2585
  0,
2560
2586
  o - 1,
2561
2587
  0,
2562
2588
  l,
2563
2589
  s,
2564
2590
  n
2565
- ), this.dataset.source.x = k, this.dataset.source.y = B, this._resizeTo(h);
2566
- return;
2591
+ ), this.dataset.source.x = k, this.dataset.source.y = P, this._resizeTo(p), h;
2567
2592
  }
2568
2593
  this._pendingExecutionMode = "worker";
2569
- const T = navigator.hardwareConcurrency || 1, L = Math.ceil(o / T), I = [];
2570
- let W = 0;
2571
- for (let k = 0; k < T; k++) {
2572
- const B = k * L, P = Math.min((k + 1) * L - 1, o - 1), G = [];
2573
- let ee = 0;
2574
- for (; W < g.length && g[W][0] <= P; )
2575
- G.push(g[W]), ee += y[W], W++;
2576
- I.push({ start: B, end: P, gapsSegment: G, fillsInSegment: ee });
2577
- }
2578
- const fe = new Array(T).fill(0);
2579
- for (let k = 1; k < T; k++)
2580
- fe[k] = fe[k - 1] + I[k - 1].fillsInSegment;
2581
- const Pe = [], xe = [];
2582
- for (let k = 0; k < T; k++) {
2583
- const { start: B, end: P, gapsSegment: G } = I[k], ee = B + fe[k];
2584
- xe.push(
2585
- new Promise((xt) => {
2586
- const de = new br();
2587
- Pe.push(de), de.postMessage({
2594
+ const I = navigator.hardwareConcurrency || 1, Be = Math.ceil(o / I), ye = [];
2595
+ let Z = 0;
2596
+ for (let k = 0; k < I; k++) {
2597
+ const P = k * Be, F = Math.min((k + 1) * Be - 1, o - 1), x = [];
2598
+ let se = 0;
2599
+ for (; Z < g.length && g[Z][0] <= F; )
2600
+ x.push(g[Z]), se += m[Z], Z++;
2601
+ ye.push({ start: P, end: F, gapsSegment: x, fillsInSegment: se });
2602
+ }
2603
+ const ge = new Array(I).fill(0);
2604
+ for (let k = 1; k < I; k++)
2605
+ ge[k] = ge[k - 1] + ye[k - 1].fillsInSegment;
2606
+ const je = [], We = [];
2607
+ for (let k = 0; k < I; k++) {
2608
+ const { start: P, end: F, gapsSegment: x } = ye[k], se = P + ge[k];
2609
+ We.push(
2610
+ new Promise((Wt) => {
2611
+ const me = new kr();
2612
+ je.push(me), me.postMessage({
2588
2613
  bufferX: this.dataX.buffer,
2589
2614
  bufferY: this.dataY.buffer,
2590
- outputBufferX: m,
2591
- outputBufferY: S,
2592
- start: B,
2593
- end: P,
2594
- gapsSegment: G,
2595
- startTarget: ee,
2615
+ outputBufferX: _,
2616
+ outputBufferY: L,
2617
+ start: P,
2618
+ end: F,
2619
+ gapsSegment: x,
2620
+ startTarget: se,
2596
2621
  fillDelta: l,
2597
2622
  interpolate: s,
2598
2623
  fillValue: n
2599
- }), de.onmessage = (Nt) => {
2600
- xt(Nt.data);
2624
+ }), me.onmessage = (Yt) => {
2625
+ Wt(Yt.data);
2601
2626
  };
2602
2627
  })
2603
2628
  );
2604
2629
  }
2605
- await Promise.all(xe), Pe.forEach((k) => k.terminate()), this.dataset.source.x = new Float64Array(m), this.dataset.source.y = new Float32Array(S), this._resizeTo(h);
2630
+ return await Promise.all(We), je.forEach((k) => k.terminate()), this.dataset.source.x = new Float64Array(_), this.dataset.source.y = new Float32Array(L), this._resizeTo(p), h;
2631
+ }
2632
+ /**
2633
+ * Dispatch wrapper around `_deleteDataPoints` — reads target
2634
+ * indices from `history[length - 2].selected`. Internal callers
2635
+ * (`_shift`, `_assignDatetimesBulk`'s delete + add chain) keep
2636
+ * using `_deleteDataPoints` directly with locally-computed
2637
+ * indices; only the external dispatch path goes through here.
2638
+ */
2639
+ async _deleteDataPointsFromSelection() {
2640
+ const t = this.history[this.history.length - 2]?.selected;
2641
+ if (!(!t || t.length === 0))
2642
+ return this._deleteDataPoints(t);
2606
2643
  }
2607
2644
  /**
2608
2645
  Deletes data points from a large array using worker threads.
@@ -2610,70 +2647,88 @@ class Es {
2610
2647
  2. For each segment, binary search locates the indexes to delete (deleteSegment), ensuring efficient lookups.
2611
2648
  3. The cumulative deletions before each segment help compute the starting index (startTarget) for each worker's output, ensuring no overlap.
2612
2649
  4. Each worker processes its segment linearly, skipping deletions and copying kept elements to their computed positions.
2613
- * @param deleteIndices
2650
+ * @param deleteIndices
2614
2651
  */
2615
2652
  async _deleteDataPoints(t) {
2616
2653
  const r = this.dataX.length, s = r - t.length;
2617
- if (!O(E.DELETE_POINTS, {
2654
+ if (!D(v.DELETE_POINTS, {
2618
2655
  datasetSize: r,
2619
2656
  selectionSize: t.length
2620
2657
  }).useWorker) {
2621
- const y = U(
2658
+ const m = U(
2622
2659
  this.dataX.buffer.byteLength,
2623
2660
  this.dataX.buffer.maxByteLength
2624
- ), d = U(
2661
+ ), b = U(
2625
2662
  this.dataY.buffer.byteLength,
2626
2663
  this.dataY.buffer.maxByteLength
2627
- ), h = new Float64Array(y), b = new Float32Array(d);
2628
- Cr(
2664
+ ), h = new Float64Array(m), f = new Float32Array(b);
2665
+ Nr(
2629
2666
  this.dataX,
2630
2667
  this.dataY,
2631
2668
  t,
2632
2669
  h,
2633
- b,
2670
+ f,
2634
2671
  0,
2635
2672
  r - 1,
2636
2673
  0
2637
- ), this.dataset.source.x = h, this.dataset.source.y = b, this._resizeTo(s);
2674
+ ), this.dataset.source.x = h, this.dataset.source.y = f, this._resizeTo(s);
2638
2675
  return;
2639
2676
  }
2640
2677
  this._pendingExecutionMode = "worker";
2641
2678
  const a = navigator.hardwareConcurrency || 1, o = Math.ceil(this.dataX.length / a), i = [], l = [];
2642
- for (let y = 0; y < a; y++) {
2643
- const d = y * o, h = Math.min((y + 1) * o - 1, this.dataX.length - 1), b = se(t, d), w = Se(t, h), m = t.slice(b, w + 1);
2644
- l.push({ start: d, end: h, deleteSegment: m });
2645
- }
2646
- const f = new Array(a).fill(0);
2647
- for (let y = 1; y < a; y++)
2648
- f[y] = f[y - 1] + l[y - 1].deleteSegment.length;
2649
- const u = [], p = U(
2679
+ for (let m = 0; m < a; m++) {
2680
+ const b = m * o, h = Math.min((m + 1) * o - 1, this.dataX.length - 1), f = B(t, b), w = j(t, h), p = t.slice(f, w + 1);
2681
+ l.push({ start: b, end: h, deleteSegment: p });
2682
+ }
2683
+ const d = new Array(a).fill(0);
2684
+ for (let m = 1; m < a; m++)
2685
+ d[m] = d[m - 1] + l[m - 1].deleteSegment.length;
2686
+ const u = [], y = U(
2650
2687
  this.dataX.buffer.byteLength,
2651
2688
  this.dataX.buffer.maxByteLength
2652
2689
  ), g = U(
2653
2690
  this.dataY.buffer.byteLength,
2654
2691
  this.dataY.buffer.maxByteLength
2655
2692
  );
2656
- for (let y = 0; y < a; y++) {
2657
- const { start: d, end: h, deleteSegment: b } = l[y], w = d - f[y];
2693
+ for (let m = 0; m < a; m++) {
2694
+ const { start: b, end: h, deleteSegment: f } = l[m], w = b - d[m];
2658
2695
  u.push(
2659
- new Promise((m) => {
2660
- const S = new wr();
2696
+ new Promise((p) => {
2697
+ const S = new vr();
2661
2698
  i.push(S), S.postMessage({
2662
2699
  bufferX: this.dataX.buffer,
2663
2700
  bufferY: this.dataY.buffer,
2664
- outputBufferX: p,
2701
+ outputBufferX: y,
2665
2702
  outputBufferY: g,
2666
- start: d,
2703
+ start: b,
2667
2704
  end: h,
2668
- deleteSegment: b,
2705
+ deleteSegment: f,
2669
2706
  startTarget: w
2670
- }), S.onmessage = (A) => {
2671
- m(A.data);
2707
+ }), S.onmessage = (E) => {
2708
+ p(E.data);
2672
2709
  };
2673
2710
  })
2674
2711
  );
2675
2712
  }
2676
- await Promise.all(u), i.forEach((y) => y.terminate()), this.dataset.source.x = new Float64Array(p), this.dataset.source.y = new Float32Array(g), this._resizeTo(s);
2713
+ await Promise.all(u), i.forEach((m) => m.terminate()), this.dataset.source.x = new Float64Array(y), this.dataset.source.y = new Float32Array(g), this._resizeTo(s);
2714
+ }
2715
+ /**
2716
+ * Dispatch wrapper around `_driftCorrection` — reads target
2717
+ * indices from `history[length - 2].selected`, partitions them
2718
+ * into consecutive groups, and applies the same `value` drift to
2719
+ * each group as one logged operation. The internal
2720
+ * `_driftCorrection` retains its per-range `[start, end, value]`
2721
+ * signature so future callers that need distinct per-range values
2722
+ * can still use it directly.
2723
+ */
2724
+ async _driftCorrectionFromSelection(t) {
2725
+ const r = this.history[this.history.length - 2]?.selected;
2726
+ if (!r || r.length === 0) return;
2727
+ const s = this._getConsecutiveGroups(r), n = [];
2728
+ for (const a of s)
2729
+ a.length !== 0 && n.push([a[0], a[a.length - 1], t]);
2730
+ if (n.length !== 0)
2731
+ return this._driftCorrection(n);
2677
2732
  }
2678
2733
  /**
2679
2734
  *
@@ -2692,28 +2747,28 @@ class Es {
2692
2747
  if (!t || t.length === 0) return;
2693
2748
  const r = this.dataset.source.x, s = navigator.hardwareConcurrency || 1;
2694
2749
  let n = 0;
2695
- for (const [p, g] of t)
2696
- g > p && (n += g - p);
2697
- if (!O(E.DRIFT_CORRECTION, {
2750
+ for (const [y, g] of t)
2751
+ g > y && (n += g - y);
2752
+ if (!D(v.DRIFT_CORRECTION, {
2698
2753
  datasetSize: r.length,
2699
2754
  selectionSize: n
2700
2755
  }).useWorker) {
2701
- xr(r, this.dataY, t);
2756
+ Wr(r, this.dataY, t);
2702
2757
  return;
2703
2758
  }
2704
2759
  this._pendingExecutionMode = "worker";
2705
2760
  const o = [];
2706
- for (const [p, g, y] of t) {
2707
- if (g <= p) continue;
2708
- const d = r[p], h = r[g] - d;
2761
+ for (const [y, g, m] of t) {
2762
+ if (g <= y) continue;
2763
+ const b = r[y], h = r[g] - b;
2709
2764
  if (h === 0) continue;
2710
- const b = g - p, w = Math.max(1, Math.ceil(b / s));
2711
- for (let m = p; m < g; m += w)
2765
+ const f = g - y, w = Math.max(1, Math.ceil(f / s));
2766
+ for (let p = y; p < g; p += w)
2712
2767
  o.push({
2713
- chunkStart: m,
2714
- chunkEnd: Math.min(m + w, g),
2715
- startDatetime: d,
2716
- value: y,
2768
+ chunkStart: p,
2769
+ chunkEnd: Math.min(p + w, g),
2770
+ startDatetime: b,
2771
+ value: m,
2717
2772
  extent: h
2718
2773
  });
2719
2774
  }
@@ -2722,22 +2777,22 @@ class Es {
2722
2777
  { length: i },
2723
2778
  () => []
2724
2779
  );
2725
- o.forEach((p, g) => l[g % i].push(p));
2726
- const f = [], u = [];
2727
- for (const p of l)
2728
- p.length !== 0 && u.push(
2780
+ o.forEach((y, g) => l[g % i].push(y));
2781
+ const d = [], u = [];
2782
+ for (const y of l)
2783
+ y.length !== 0 && u.push(
2729
2784
  new Promise((g) => {
2730
- const y = new Er();
2731
- f.push(y), y.postMessage({
2785
+ const m = new Ar();
2786
+ d.push(m), m.postMessage({
2732
2787
  bufferX: this.dataX.buffer,
2733
2788
  bufferY: this.dataY.buffer,
2734
- jobs: p
2735
- }), y.onmessage = (d) => {
2736
- g(d.data);
2789
+ jobs: y
2790
+ }), m.onmessage = (b) => {
2791
+ g(b.data);
2737
2792
  };
2738
2793
  })
2739
2794
  );
2740
- await Promise.all(u), f.forEach((p) => p.terminate());
2795
+ await Promise.all(u), d.forEach((y) => y.terminate());
2741
2796
  }
2742
2797
  /** Traverses the index array and returns groups of consecutive values.
2743
2798
  * i.e.: `[0, 1, 3, 4, 6] => [[0, 1], [3, 4], [6]]`
@@ -2759,61 +2814,65 @@ class Es {
2759
2814
  * 4. Each worker linearly merges its original slice with its insertion slice (both already sorted by datetime) into the output buffer. Originals win on datetime ties, matching the original `findLastLessOrEqual` semantics.
2760
2815
  */
2761
2816
  async _addDataPoints(t) {
2762
- if (t.length === 0) return;
2817
+ if (t.length === 0) return [];
2763
2818
  const r = this.dataX.length, s = r + t.length;
2764
- t.sort((d, h) => d[0] - h[0]);
2765
- const n = s * Float64Array.BYTES_PER_ELEMENT, a = s * Float32Array.BYTES_PER_ELEMENT, o = U(
2766
- n,
2767
- Math.max(this.dataX.buffer.maxByteLength, n)
2768
- ), i = U(
2819
+ t.sort((h, f) => h[0] - f[0]);
2820
+ const n = new Array(t.length);
2821
+ for (let h = 0; h < t.length; h++) {
2822
+ const f = t[h][0], w = j(this.dataX, f) + 1;
2823
+ n[h] = w + h;
2824
+ }
2825
+ const a = s * Float64Array.BYTES_PER_ELEMENT, o = s * Float32Array.BYTES_PER_ELEMENT, i = U(
2769
2826
  a,
2770
- Math.max(this.dataY.buffer.maxByteLength, a)
2827
+ Math.max(this.dataX.buffer.maxByteLength, a)
2828
+ ), l = U(
2829
+ o,
2830
+ Math.max(this.dataY.buffer.maxByteLength, o)
2771
2831
  );
2772
- if (!O(E.ADD_POINTS, {
2832
+ if (!D(v.ADD_POINTS, {
2773
2833
  datasetSize: r,
2774
2834
  selectionSize: t.length
2775
2835
  }).useWorker) {
2776
- const d = new Float64Array(o), h = new Float32Array(i);
2777
- Dr(
2836
+ const h = new Float64Array(i), f = new Float32Array(l);
2837
+ return Pr(
2778
2838
  this.dataX,
2779
2839
  this.dataY,
2780
2840
  t,
2781
- d,
2782
2841
  h,
2842
+ f,
2783
2843
  0,
2784
2844
  r,
2785
2845
  0
2786
- ), this.dataset.source.x = d, this.dataset.source.y = h, this._resizeTo(s);
2787
- return;
2846
+ ), this.dataset.source.x = h, this.dataset.source.y = f, this._resizeTo(s), n;
2788
2847
  }
2789
2848
  this._pendingExecutionMode = "worker";
2790
- const f = t.map(
2791
- (d) => Se(this.dataX, d[0]) + 1
2792
- ), u = Math.max(
2849
+ const u = t.map(
2850
+ (h) => j(this.dataX, h[0]) + 1
2851
+ ), y = Math.max(
2793
2852
  1,
2794
2853
  Math.min(navigator.hardwareConcurrency || 1, Math.max(r, 1))
2795
- ), p = Math.ceil(Math.max(r, 1) / u), g = [], y = [];
2796
- for (let d = 0; d < u; d++) {
2797
- const h = d * p, b = Math.min((d + 1) * p, r), w = se(f, h), m = d === u - 1 ? t.length : se(f, b), S = t.slice(w, m), A = h + w;
2798
- h >= b && S.length === 0 || y.push(
2799
- new Promise((T) => {
2800
- const L = new kr();
2801
- g.push(L), L.postMessage({
2854
+ ), g = Math.ceil(Math.max(r, 1) / y), m = [], b = [];
2855
+ for (let h = 0; h < y; h++) {
2856
+ const f = h * g, w = Math.min((h + 1) * g, r), p = B(u, f), S = h === y - 1 ? t.length : B(u, w), E = t.slice(p, S), _ = f + p;
2857
+ f >= w && E.length === 0 || b.push(
2858
+ new Promise((L) => {
2859
+ const $ = new Tr();
2860
+ m.push($), $.postMessage({
2802
2861
  bufferX: this.dataX.buffer,
2803
2862
  bufferY: this.dataY.buffer,
2804
- outputBufferX: o,
2805
- outputBufferY: i,
2806
- origStart: h,
2807
- origEnd: b,
2808
- insertions: S,
2809
- outStart: A
2810
- }), L.onmessage = (I) => {
2811
- T(I.data);
2863
+ outputBufferX: i,
2864
+ outputBufferY: l,
2865
+ origStart: f,
2866
+ origEnd: w,
2867
+ insertions: E,
2868
+ outStart: _
2869
+ }), $.onmessage = (I) => {
2870
+ L(I.data);
2812
2871
  };
2813
2872
  })
2814
2873
  );
2815
2874
  }
2816
- await Promise.all(y), g.forEach((d) => d.terminate()), this.dataset.source.x = new Float64Array(o), this.dataset.source.y = new Float32Array(i), this._resizeTo(s);
2875
+ return await Promise.all(b), m.forEach((h) => h.terminate()), this.dataset.source.x = new Float64Array(i), this.dataset.source.y = new Float32Array(l), this._resizeTo(s), n;
2817
2876
  }
2818
2877
  // =======================
2819
2878
  // FILTER OPERATIONS
@@ -2831,49 +2890,56 @@ class Es {
2831
2890
  *
2832
2891
  * Opcodes: 0=LT, 1=LTE, 2=GT, 3=GTE, 4=E.
2833
2892
  */
2834
- async _valueThreshold(t) {
2835
- const r = Object.keys(t);
2836
- if (r.length === 0) return [];
2837
- const s = {
2838
- [J.LT]: 0,
2839
- [J.LTE]: 1,
2840
- [J.GT]: 2,
2841
- [J.GTE]: 3,
2842
- [J.E]: 4
2843
- }, n = r.map((h) => s[h] ?? 4), a = r.map((h) => t[h]), o = this.dataset.source.y, i = o.length;
2844
- if (i === 0) return [];
2845
- if (!O(v.VALUE_THRESHOLD, {
2846
- datasetSize: i
2893
+ async _valueThreshold(t, r) {
2894
+ const s = Object.keys(t);
2895
+ if (s.length === 0) return [];
2896
+ const n = {
2897
+ [K.LT]: 0,
2898
+ [K.LTE]: 1,
2899
+ [K.GT]: 2,
2900
+ [K.GTE]: 3,
2901
+ [K.E]: 4
2902
+ }, a = s.map((S) => n[S] ?? 4), o = s.map((S) => t[S]), i = this.dataset.source.y, l = this.dataset.source.x;
2903
+ let d = 0, u = i.length;
2904
+ if (u === 0) return [];
2905
+ if (r != null) {
2906
+ const [S, E] = r;
2907
+ S != null && Number.isFinite(S) && (d = B(l, S)), E != null && Number.isFinite(E) && (u = j(l, E) + 1);
2908
+ }
2909
+ if (u <= d) return [];
2910
+ const y = u - d;
2911
+ if (!D(T.VALUE_THRESHOLD, {
2912
+ datasetSize: y
2847
2913
  }).useWorker)
2848
- return Pt(o, 0, i, n, a);
2914
+ return jt(i, d, u, a, o);
2849
2915
  this._pendingExecutionMode = "worker";
2850
- const f = Math.min(navigator.hardwareConcurrency || 1, i), u = Math.ceil(i / f), p = [], g = [];
2851
- for (let h = 0; h < f; h++) {
2852
- const b = h * u, w = Math.min((h + 1) * u, i);
2853
- if (b >= w) break;
2854
- g.push(
2855
- new Promise((m) => {
2856
- const S = new Re();
2857
- p.push(S), S.postMessage({
2916
+ const m = Math.min(navigator.hardwareConcurrency || 1, y), b = Math.ceil(y / m), h = [], f = [];
2917
+ for (let S = 0; S < m; S++) {
2918
+ const E = d + S * b, _ = Math.min(d + (S + 1) * b, u);
2919
+ if (E >= _) break;
2920
+ f.push(
2921
+ new Promise((L) => {
2922
+ const $ = new Me();
2923
+ h.push($), $.postMessage({
2858
2924
  bufferY: this.dataY.buffer,
2859
- start: b,
2860
- end: w,
2861
- ops: n,
2862
- values: a
2863
- }), S.onmessage = (A) => {
2864
- m(A.data);
2925
+ start: E,
2926
+ end: _,
2927
+ ops: a,
2928
+ values: o
2929
+ }), $.onmessage = (I) => {
2930
+ L(I.data);
2865
2931
  };
2866
2932
  })
2867
2933
  );
2868
2934
  }
2869
- const y = await Promise.all(g);
2870
- p.forEach((h) => h.terminate());
2871
- const d = [];
2872
- for (let h = 0; h < y.length; h++) {
2873
- const b = y[h];
2874
- for (let w = 0; w < b.length; w++) d.push(b[w]);
2935
+ const w = await Promise.all(f);
2936
+ h.forEach((S) => S.terminate());
2937
+ const p = [];
2938
+ for (let S = 0; S < w.length; S++) {
2939
+ const E = w[S];
2940
+ for (let _ = 0; _ < E.length; _++) p.push(E[_]);
2875
2941
  }
2876
- return d;
2942
+ return p;
2877
2943
  }
2878
2944
  /**
2879
2945
  *
@@ -2887,42 +2953,48 @@ class Es {
2887
2953
  * 2. Each worker runs a hoisted branch matching the comparator and returns matching indexes in ascending order.
2888
2954
  * 3. Main thread concatenates results in chunk order, preserving ascending order.
2889
2955
  */
2890
- async _rateOfChange(t, r) {
2891
- const s = this.dataset.source.y;
2892
- if (s.length < 2) return [];
2893
- const n = 1, a = s.length, o = a - n;
2894
- if (!O(v.RATE_OF_CHANGE, {
2895
- datasetSize: s.length
2956
+ async _rateOfChange(t, r, s) {
2957
+ const n = this.dataset.source.y, a = this.dataset.source.x;
2958
+ if (n.length < 2) return [];
2959
+ let o = 1, i = n.length;
2960
+ if (s != null) {
2961
+ const [f, w] = s;
2962
+ f != null && Number.isFinite(f) && (o = Math.max(1, B(a, f))), w != null && Number.isFinite(w) && (i = j(a, w) + 1);
2963
+ }
2964
+ if (i <= o) return [];
2965
+ const l = i - o;
2966
+ if (!D(T.RATE_OF_CHANGE, {
2967
+ datasetSize: n.length
2896
2968
  }).useWorker)
2897
- return Ir(s, n, a, t, r);
2969
+ return Fr(n, o, i, t, r);
2898
2970
  this._pendingExecutionMode = "worker";
2899
- const l = Math.min(navigator.hardwareConcurrency || 1, o), f = Math.ceil(o / l), u = [], p = [];
2900
- for (let d = 0; d < l; d++) {
2901
- const h = n + d * f, b = Math.min(n + (d + 1) * f, a);
2902
- if (h >= b) break;
2903
- p.push(
2904
- new Promise((w) => {
2905
- const m = new Lr();
2906
- u.push(m), m.postMessage({
2971
+ const u = Math.min(navigator.hardwareConcurrency || 1, l), y = Math.ceil(l / u), g = [], m = [];
2972
+ for (let f = 0; f < u; f++) {
2973
+ const w = o + f * y, p = Math.min(o + (f + 1) * y, i);
2974
+ if (w >= p) break;
2975
+ m.push(
2976
+ new Promise((S) => {
2977
+ const E = new Or();
2978
+ g.push(E), E.postMessage({
2907
2979
  bufferY: this.dataY.buffer,
2908
- start: h,
2909
- end: b,
2980
+ start: w,
2981
+ end: p,
2910
2982
  comparator: t,
2911
2983
  value: r
2912
- }), m.onmessage = (S) => {
2913
- w(S.data);
2984
+ }), E.onmessage = (_) => {
2985
+ S(_.data);
2914
2986
  };
2915
2987
  })
2916
2988
  );
2917
2989
  }
2918
- const g = await Promise.all(p);
2919
- u.forEach((d) => d.terminate());
2920
- const y = [];
2921
- for (let d = 0; d < g.length; d++) {
2922
- const h = g[d];
2923
- for (let b = 0; b < h.length; b++) y.push(h[b]);
2990
+ const b = await Promise.all(m);
2991
+ g.forEach((f) => f.terminate());
2992
+ const h = [];
2993
+ for (let f = 0; f < b.length; f++) {
2994
+ const w = b[f];
2995
+ for (let p = 0; p < w.length; p++) h.push(w[p]);
2924
2996
  }
2925
- return y;
2997
+ return h;
2926
2998
  }
2927
2999
  /**
2928
3000
  * Select all points whose datetime falls inside `[from, to]` (inclusive).
@@ -2933,18 +3005,40 @@ class Es {
2933
3005
  async _datetimeRange(t, r) {
2934
3006
  const s = this.dataset.source.x, n = s.length;
2935
3007
  if (n === 0) return [];
2936
- const a = t == null ? 0 : se(s, t), o = r == null ? n - 1 : Se(s, r);
3008
+ const a = t == null ? 0 : B(s, t), o = r == null ? n - 1 : j(s, r);
2937
3009
  if (a > o) return [];
2938
3010
  const i = new Array(o - a + 1);
2939
3011
  for (let l = a; l <= o; l++) i[l - a] = l;
2940
3012
  return i;
2941
3013
  }
2942
3014
  /**
2943
- * @param index
2944
- * @returns
3015
+ * SELECTION filter handler — also acts as the cleanup site for the
3016
+ * SELECTION-vs-preceding-filter interaction. `dispatchFilter` always
3017
+ * pushes (never replaces) a SELECTION when the previous entry is a
3018
+ * non-SELECTION filter; this method then decides what to keep based
3019
+ * on what the SELECTION's indices look like relative to the filter:
3020
+ *
3021
+ * | incoming SELECTION | preceding non-SEL filter | result |
3022
+ * | -------------------------- | -------------------------- | ------------------------------------- |
3023
+ * | empty | had non-empty `selected` | pop both — user cleared the filter |
3024
+ * | empty | had empty `selected` | pop SELECTION — no-op echo on a |
3025
+ * | | | zero-result filter, keep filter |
3026
+ * | empty | none / non-filter prev | pop SELECTION (clear) |
3027
+ * | non-empty matches prev | (any filter) | pop SELECTION — Plotly relayout echo |
3028
+ * | | | of the filter's `selected` |
3029
+ * | non-empty differs from prev| (any filter) | splice prev — user override takes |
3030
+ * | | | ownership; SELECTION stands alone |
3031
+ * | non-empty (other cases) | n/a | keep as-is (already pushed) |
3032
+ *
3033
+ * The "Plotly echo" case exists because consumers commonly chain
3034
+ * `dispatchFilter(SOMETHING)` with `dispatchSelection(result)` for
3035
+ * visual highlighting; Plotly's debounced relayout listener then
3036
+ * fires a SELECTION carrying the same indices. Without this dedup
3037
+ * the script would grow a phantom SELECTION after every real filter.
2945
3038
  */
2946
3039
  async _selection(t) {
2947
- return (!t || !t.length) && this.history.pop(), t;
3040
+ const r = this.history[this.history.length - 2], s = !!r && r.method !== T.SELECTION && !!T[r.method], n = s && Array.isArray(r.selected) ? r.selected : void 0;
3041
+ return !t || !t.length ? (this.history.pop(), n && n.length > 0 && this.history.pop(), t) : (n && Kr(n, t) ? this.history.pop() : s && this.history.splice(this.history.length - 2, 1), t);
2948
3042
  }
2949
3043
  /**
2950
3044
  *
@@ -2958,42 +3052,48 @@ class Es {
2958
3052
  * 2. Each worker runs a hoisted branch matching the comparator and returns matching indexes in ascending order.
2959
3053
  * 3. Main thread concatenates results in chunk order, preserving ascending order.
2960
3054
  */
2961
- async _change(t, r) {
2962
- const s = this.dataset.source.y;
2963
- if (s.length < 2) return [];
2964
- const n = 1, a = s.length, o = a - n;
2965
- if (!O(v.CHANGE, {
2966
- datasetSize: s.length
3055
+ async _change(t, r, s) {
3056
+ const n = this.dataset.source.y, a = this.dataset.source.x;
3057
+ if (n.length < 2) return [];
3058
+ let o = 1, i = n.length;
3059
+ if (s != null) {
3060
+ const [f, w] = s;
3061
+ f != null && Number.isFinite(f) && (o = Math.max(1, B(a, f))), w != null && Number.isFinite(w) && (i = j(a, w) + 1);
3062
+ }
3063
+ if (i <= o) return [];
3064
+ const l = i - o;
3065
+ if (!D(T.CHANGE, {
3066
+ datasetSize: n.length
2967
3067
  }).useWorker)
2968
- return Rr(s, n, a, t, r);
3068
+ return Ur(n, o, i, t, r);
2969
3069
  this._pendingExecutionMode = "worker";
2970
- const l = Math.min(navigator.hardwareConcurrency || 1, o), f = Math.ceil(o / l), u = [], p = [];
2971
- for (let d = 0; d < l; d++) {
2972
- const h = n + d * f, b = Math.min(n + (d + 1) * f, a);
2973
- if (h >= b) break;
2974
- p.push(
2975
- new Promise((w) => {
2976
- const m = new Tr();
2977
- u.push(m), m.postMessage({
3070
+ const u = Math.min(navigator.hardwareConcurrency || 1, l), y = Math.ceil(l / u), g = [], m = [];
3071
+ for (let f = 0; f < u; f++) {
3072
+ const w = o + f * y, p = Math.min(o + (f + 1) * y, i);
3073
+ if (w >= p) break;
3074
+ m.push(
3075
+ new Promise((S) => {
3076
+ const E = new Ir();
3077
+ g.push(E), E.postMessage({
2978
3078
  bufferY: this.dataY.buffer,
2979
- start: h,
2980
- end: b,
3079
+ start: w,
3080
+ end: p,
2981
3081
  comparator: t,
2982
3082
  value: r
2983
- }), m.onmessage = (S) => {
2984
- w(S.data);
3083
+ }), E.onmessage = (_) => {
3084
+ S(_.data);
2985
3085
  };
2986
3086
  })
2987
3087
  );
2988
3088
  }
2989
- const g = await Promise.all(p);
2990
- u.forEach((d) => d.terminate());
2991
- const y = [];
2992
- for (let d = 0; d < g.length; d++) {
2993
- const h = g[d];
2994
- for (let b = 0; b < h.length; b++) y.push(h[b]);
3089
+ const b = await Promise.all(m);
3090
+ g.forEach((f) => f.terminate());
3091
+ const h = [];
3092
+ for (let f = 0; f < b.length; f++) {
3093
+ const w = b[f];
3094
+ for (let p = 0; p < w.length; p++) h.push(w[p]);
2995
3095
  }
2996
- return y;
3096
+ return h;
2997
3097
  }
2998
3098
  /**
2999
3099
  * Find gaps in the data using worker threads.
@@ -3002,45 +3102,54 @@ class Es {
3002
3102
  * 3. Main thread collects all pairs and dedups via Set — identical return shape to the original implementation.
3003
3103
  * @param value The time value
3004
3104
  * @param unit The time unit (TimeUnit)
3005
- * @param range If specified, the gaps will be found only within the range
3105
+ * @param range If specified, gap detection is restricted to this
3106
+ * `[startTs, endTs]` window in epoch milliseconds. Both bounds
3107
+ * are inclusive and snapped to the nearest enclosed point via
3108
+ * binary search. Datetime-addressed (not index-addressed) so the
3109
+ * same call survives data growth and is portable across datasets
3110
+ * for QC script replay.
3006
3111
  */
3007
3112
  async _findGaps(t, r, s) {
3008
3113
  const n = this.dataset.source.x;
3009
3114
  let a = 0, o = n.length;
3010
- if (s?.[0] && s?.[1] && (a = s[0], o = s[1]), o <= a) return [];
3011
- const i = t * re[r] * 1e3;
3012
- if (!O(v.FIND_GAPS, {
3115
+ if (s != null) {
3116
+ const [f, w] = s;
3117
+ f != null && Number.isFinite(f) && (a = B(n, f)), w != null && Number.isFinite(w) && (o = j(n, w) + 1);
3118
+ }
3119
+ if (o <= a) return [];
3120
+ const i = t * oe[r] * 1e3;
3121
+ if (!D(T.FIND_GAPS, {
3013
3122
  datasetSize: o - a
3014
3123
  }).useWorker) {
3015
- const b = Mr(n, a, o - 1, i), w = /* @__PURE__ */ new Set();
3016
- for (let m = 0; m < b.length; m++) w.add(b[m]);
3124
+ const f = Dr(n, a, o - 1, i), w = /* @__PURE__ */ new Set();
3125
+ for (let p = 0; p < f.length; p++) w.add(f[p]);
3017
3126
  return [...w];
3018
3127
  }
3019
3128
  this._pendingExecutionMode = "worker";
3020
- const f = o - a, u = Math.min(navigator.hardwareConcurrency || 1, f), p = Math.ceil(f / u), g = [], y = [];
3021
- for (let b = 0; b < u; b++) {
3022
- const w = a + b * p, m = Math.min(a + (b + 1) * p, o);
3023
- if (w >= m) break;
3024
- y.push(
3129
+ const d = o - a, u = Math.min(navigator.hardwareConcurrency || 1, d), y = Math.ceil(d / u), g = [], m = [];
3130
+ for (let f = 0; f < u; f++) {
3131
+ const w = a + f * y, p = Math.min(a + (f + 1) * y, o);
3132
+ if (w >= p) break;
3133
+ m.push(
3025
3134
  new Promise((S) => {
3026
- const A = new _r();
3027
- g.push(A), A.postMessage({
3135
+ const E = new $r();
3136
+ g.push(E), E.postMessage({
3028
3137
  bufferX: this.dataX.buffer,
3029
3138
  start: w,
3030
- endInclusive: m,
3139
+ endInclusive: p,
3031
3140
  threshold: i
3032
- }), A.onmessage = (T) => {
3033
- S(T.data);
3141
+ }), E.onmessage = (_) => {
3142
+ S(_.data);
3034
3143
  };
3035
3144
  })
3036
3145
  );
3037
3146
  }
3038
- const d = await Promise.all(y);
3039
- g.forEach((b) => b.terminate());
3147
+ const b = await Promise.all(m);
3148
+ g.forEach((f) => f.terminate());
3040
3149
  const h = /* @__PURE__ */ new Set();
3041
- for (let b = 0; b < d.length; b++) {
3042
- const w = d[b];
3043
- for (let m = 0; m < w.length; m++) h.add(w[m]);
3150
+ for (let f = 0; f < b.length; f++) {
3151
+ const w = b[f];
3152
+ for (let p = 0; p < w.length; p++) h.add(w[p]);
3044
3153
  }
3045
3154
  return [...h];
3046
3155
  }
@@ -3052,127 +3161,226 @@ class Es {
3052
3161
  *
3053
3162
  * Matches the Python reference implementation in `edit_service.py::persistence` — every member of a qualifying run is selected (including the run's first index).
3054
3163
  * @param times The minimum run length to qualify
3055
- * @param range If specified, the points will be found only within the range
3164
+ * @param range If specified, persistence detection is restricted
3165
+ * to this `[startTs, endTs]` window in epoch milliseconds. Both
3166
+ * bounds are inclusive and snapped to the nearest enclosed point
3167
+ * via binary search on `dataX`. Datetime-addressed (not index-
3168
+ * addressed) so the same call survives data growth and is
3169
+ * portable across datasets for QC script replay.
3056
3170
  */
3057
3171
  async _persistence(t, r) {
3058
- const s = this.dataset.source.y;
3059
- let n = 0, a = s.length;
3060
- if (r?.[0] && r?.[1] && (n = r[0], a = r[1]), a <= n) return [];
3061
- const o = a - n;
3062
- if (!O(v.PERSISTENCE, {
3063
- datasetSize: o
3172
+ const s = this.dataset.source.x, n = this.dataset.source.y;
3173
+ let a = 0, o = n.length;
3174
+ if (r != null) {
3175
+ const [p, S] = r;
3176
+ p != null && Number.isFinite(p) && (a = B(s, p)), S != null && Number.isFinite(S) && (o = j(s, S) + 1);
3177
+ }
3178
+ if (o <= a) return [];
3179
+ const i = o - a;
3180
+ if (!D(T.PERSISTENCE, {
3181
+ datasetSize: i
3064
3182
  }).useWorker) {
3065
- const w = Ur(s, n, a), m = [];
3066
- for (let S = 0; S < w.length; S += 3) {
3067
- const A = w[S], T = w[S + 1];
3068
- if (T >= t)
3069
- for (let L = 0; L < T; L++) m.push(A + L);
3183
+ const p = Cr(n, a, o), S = [];
3184
+ for (let E = 0; E < p.length; E += 3) {
3185
+ const _ = p[E], L = p[E + 1];
3186
+ if (L >= t)
3187
+ for (let $ = 0; $ < L; $++) S.push(_ + $);
3070
3188
  }
3071
- return m;
3189
+ return S;
3072
3190
  }
3073
3191
  this._pendingExecutionMode = "worker";
3074
- const l = Math.min(navigator.hardwareConcurrency || 1, o), f = Math.ceil(o / l), u = [], p = [];
3075
- for (let w = 0; w < l; w++) {
3076
- const m = n + w * f, S = Math.min(n + (w + 1) * f, a);
3077
- if (m >= S) break;
3078
- p.push(
3079
- new Promise((A) => {
3080
- const T = new Ar();
3081
- u.push(T), T.postMessage({
3192
+ const d = Math.min(navigator.hardwareConcurrency || 1, i), u = Math.ceil(i / d), y = [], g = [];
3193
+ for (let p = 0; p < d; p++) {
3194
+ const S = a + p * u, E = Math.min(a + (p + 1) * u, o);
3195
+ if (S >= E) break;
3196
+ g.push(
3197
+ new Promise((_) => {
3198
+ const L = new Rr();
3199
+ y.push(L), L.postMessage({
3082
3200
  bufferY: this.dataY.buffer,
3083
- start: m,
3084
- end: S
3085
- }), T.onmessage = (L) => {
3086
- A(L.data);
3201
+ start: S,
3202
+ end: E
3203
+ }), L.onmessage = ($) => {
3204
+ _($.data);
3087
3205
  };
3088
3206
  })
3089
3207
  );
3090
3208
  }
3091
- const g = await Promise.all(p);
3092
- u.forEach((w) => w.terminate());
3093
- const y = [], d = [], h = [];
3094
- for (let w = 0; w < g.length; w++) {
3095
- const m = g[w];
3096
- for (let S = 0; S < m.length; S += 3) {
3097
- const A = m[S], T = m[S + 1], L = m[S + 2], I = y.length - 1;
3098
- I >= 0 && h[I] === L && y[I] + d[I] === A ? d[I] += T : (y.push(A), d.push(T), h.push(L));
3209
+ const m = await Promise.all(g);
3210
+ y.forEach((p) => p.terminate());
3211
+ const b = [], h = [], f = [];
3212
+ for (let p = 0; p < m.length; p++) {
3213
+ const S = m[p];
3214
+ for (let E = 0; E < S.length; E += 3) {
3215
+ const _ = S[E], L = S[E + 1], $ = S[E + 2], I = b.length - 1;
3216
+ I >= 0 && f[I] === $ && b[I] + h[I] === _ ? h[I] += L : (b.push(_), h.push(L), f.push($));
3099
3217
  }
3100
3218
  }
3101
- const b = [];
3102
- for (let w = 0; w < y.length; w++) {
3103
- const m = d[w];
3104
- if (m >= t) {
3105
- const S = y[w];
3106
- for (let A = 0; A < m; A++) b.push(S + A);
3219
+ const w = [];
3220
+ for (let p = 0; p < b.length; p++) {
3221
+ const S = h[p];
3222
+ if (S >= t) {
3223
+ const E = b[p];
3224
+ for (let _ = 0; _ < S; _++) w.push(E + _);
3107
3225
  }
3108
3226
  }
3109
- return b;
3227
+ return w;
3110
3228
  }
3111
3229
  }
3230
+ const ue = "1", es = /* @__PURE__ */ new Set([
3231
+ ...Object.values(v),
3232
+ ...Object.values(T)
3233
+ ]);
3234
+ function Rs(e, t) {
3235
+ const r = e.history.map((s) => {
3236
+ const n = {
3237
+ method: s.method,
3238
+ args: s.args ? [...s.args] : []
3239
+ };
3240
+ return s.status === "failed" && (n.status = "failed"), n;
3241
+ });
3242
+ return {
3243
+ version: ue,
3244
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
3245
+ window: {
3246
+ startDate: t.startDate,
3247
+ endDate: t.endDate
3248
+ },
3249
+ operations: r
3250
+ };
3251
+ }
3252
+ function Is(e) {
3253
+ if (!e || typeof e != "object")
3254
+ throw new Error("QC script must be a JSON object.");
3255
+ const t = e;
3256
+ if (t.version !== ue)
3257
+ throw new Error(
3258
+ `Unsupported QC script version: ${String(t.version)}. This loader understands version "${ue}".`
3259
+ );
3260
+ if (typeof t.createdAt != "string")
3261
+ throw new Error("QC script is missing `createdAt` (ISO-8601 string).");
3262
+ const r = t.window;
3263
+ if (!r || typeof r != "object")
3264
+ throw new Error("QC script is missing `window`.");
3265
+ if (typeof r.startDate != "string" || typeof r.endDate != "string")
3266
+ throw new Error("`window.startDate` and `window.endDate` must be ISO-8601 strings.");
3267
+ if (!Array.isArray(t.operations))
3268
+ throw new Error("QC script `operations` must be an array.");
3269
+ const s = t.operations.map((n, a) => {
3270
+ if (!n || typeof n != "object")
3271
+ throw new Error(`Operation ${a} must be an object.`);
3272
+ const o = n;
3273
+ if (typeof o.method != "string")
3274
+ throw new Error(`Operation ${a} missing string \`method\`.`);
3275
+ if (!es.has(o.method))
3276
+ throw new Error(`Operation ${a} has unknown method: "${o.method}".`);
3277
+ if (!Array.isArray(o.args))
3278
+ throw new Error(`Operation ${a} \`args\` must be an array.`);
3279
+ const i = {
3280
+ method: o.method,
3281
+ args: [...o.args]
3282
+ };
3283
+ return o.status === "failed" && (i.status = "failed"), i;
3284
+ });
3285
+ return {
3286
+ version: ue,
3287
+ createdAt: t.createdAt,
3288
+ window: {
3289
+ startDate: r.startDate,
3290
+ endDate: r.endDate
3291
+ },
3292
+ operations: s
3293
+ };
3294
+ }
3295
+ async function Os(e, t) {
3296
+ e.history.length = 0, e.redoStack.length = 0, await e.reload();
3297
+ const r = { applied: 0, failed: [] };
3298
+ for (let s = 0; s < t.operations.length; s++) {
3299
+ const n = t.operations[s];
3300
+ try {
3301
+ await e.dispatch(n.method, ...n.args), e.history[e.history.length - 1]?.status === "failed" ? r.failed.push({
3302
+ index: s,
3303
+ method: n.method,
3304
+ error: "Operation handler reported failure (see console)."
3305
+ }) : r.applied++;
3306
+ } catch (a) {
3307
+ r.failed.push({
3308
+ index: s,
3309
+ method: n.method,
3310
+ error: a instanceof Error ? a.message : String(a)
3311
+ });
3312
+ }
3313
+ }
3314
+ return r;
3315
+ }
3112
3316
  export {
3113
- C as ACCOUNT_BASE,
3114
- Ue as AUTH_BASE,
3115
- os as ApiKey,
3116
- D as BASE_URL,
3117
- is as Collaborator,
3118
- bt as DEFAULT_SNACK_DURATION,
3119
- cs as DataSource,
3120
- Jr as Datastream,
3121
- E as EnumEditOperations,
3122
- v as EnumFilterOperations,
3123
- J as FilterOperation,
3124
- Wt as HydroShareArchive,
3125
- Z as INCREASE_AMOUNT,
3126
- Gt as Location,
3127
- jt as LogicalOperation,
3128
- ns as OAuthProvider,
3129
- Es as ObservationRecord,
3130
- Zr as ObservedProperty,
3131
- Bt as Operator,
3132
- rs as Organization,
3133
- ie as PROVIDER_BASE,
3134
- hs as Payload,
3135
- Yt as PermissionAction,
3136
- Ht as PermissionResource,
3137
- or as Position,
3138
- Vr as PostHydroShareArchive,
3139
- es as ProcessingLevel,
3140
- ts as ResultQualifier,
3141
- me as SESSION_BASE,
3142
- Qr as Sensor,
3143
- ar as Snack,
3144
- St as SnackColor,
3145
- Et as SnackIcon,
3146
- kt as SnackTitle,
3147
- ir as Snackbar,
3148
- Je as TAG_BASE,
3149
- _ as THINGS_BASE,
3150
- qr as Thing,
3151
- F as TimeUnit,
3152
- Kr as Unit,
3153
- ss as User,
3154
- as as Workspace,
3155
- us as api,
3317
+ N as ACCOUNT_BASE,
3318
+ De as AUTH_BASE,
3319
+ fs as ApiKey,
3320
+ C as BASE_URL,
3321
+ ps as Collaborator,
3322
+ kt as DEFAULT_SNACK_DURATION,
3323
+ ys as DataSource,
3324
+ ss as Datastream,
3325
+ v as EnumEditOperations,
3326
+ T as EnumFilterOperations,
3327
+ K as FilterOperation,
3328
+ zt as HydroShareArchive,
3329
+ re as INCREASE_AMOUNT,
3330
+ Xt as Location,
3331
+ Ht as LogicalOperation,
3332
+ hs as OAuthProvider,
3333
+ $s as ObservationRecord,
3334
+ as as ObservedProperty,
3335
+ Gt as Operator,
3336
+ ls as Organization,
3337
+ le as PROVIDER_BASE,
3338
+ ws as Payload,
3339
+ Vt as PermissionAction,
3340
+ qt as PermissionResource,
3341
+ lr as Position,
3342
+ ts as PostHydroShareArchive,
3343
+ is as ProcessingLevel,
3344
+ ue as QC_SCRIPT_VERSION,
3345
+ cs as ResultQualifier,
3346
+ Ee as SESSION_BASE,
3347
+ os as Sensor,
3348
+ ur as Snack,
3349
+ _t as SnackColor,
3350
+ At as SnackIcon,
3351
+ Tt as SnackTitle,
3352
+ hr as Snackbar,
3353
+ et as TAG_BASE,
3354
+ A as THINGS_BASE,
3355
+ rs as Thing,
3356
+ W as TimeUnit,
3357
+ ns as Unit,
3358
+ us as User,
3359
+ ds as Workspace,
3360
+ ms as api,
3156
3361
  c as apiMethods,
3157
- bs as clearCalibration,
3158
- vt as createPatchObject,
3159
- Ss as ensureCalibration,
3160
- zt as extractErrorMessage,
3161
- se as findFirstGreaterOrEqual,
3162
- Se as findLastLessOrEqual,
3163
- fs as formatDate,
3164
- ds as formatDuration,
3165
- ht as getCSRFToken,
3166
- gs as getCalibration,
3167
- ms as getLastBenchmarkDetail,
3168
- ls as getObservationsEndpoint,
3169
- ws as getOperationTable,
3170
- be as measureEllapsedTime,
3171
- ys as onCalibrationChange,
3172
- ft as requestInterceptor,
3173
- dt as responseInterceptor,
3174
- Wr as runBenchmarks,
3175
- O as shouldUseWorker,
3176
- ps as subtractHours,
3177
- re as timeUnitMultipliers
3362
+ Os as applyScript,
3363
+ Ts as clearCalibration,
3364
+ Lt as createPatchObject,
3365
+ Ls as ensureCalibration,
3366
+ Jt as extractErrorMessage,
3367
+ B as findFirstGreaterOrEqual,
3368
+ j as findLastLessOrEqual,
3369
+ bs as formatDate,
3370
+ Ss as formatDuration,
3371
+ yt as getCSRFToken,
3372
+ ks as getCalibration,
3373
+ _s as getLastBenchmarkDetail,
3374
+ gs as getObservationsEndpoint,
3375
+ As as getOperationTable,
3376
+ ke as measureEllapsedTime,
3377
+ vs as onCalibrationChange,
3378
+ Is as parseScript,
3379
+ gt as requestInterceptor,
3380
+ mt as responseInterceptor,
3381
+ zr as runBenchmarks,
3382
+ Rs as serializeHistory,
3383
+ D as shouldUseWorker,
3384
+ Es as subtractHours,
3385
+ oe as timeUnitMultipliers
3178
3386
  };