cafe-utility 33.6.1 → 33.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.d.ts +3 -1
  2. package/index.js +458 -450
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -10,10 +10,10 @@ async function raceFulfilled(n) {
10
10
  async function runInParallelBatches(n, e = 1) {
11
11
  const t = splitByCount(n, e),
12
12
  r = [],
13
- i = t.map(async o => {
14
- for (const u of o) r.push(await u())
13
+ o = t.map(async i => {
14
+ for (const u of i) r.push(await u())
15
15
  })
16
- return await Promise.all(i), r
16
+ return await Promise.all(o), r
17
17
  }
18
18
  async function sleepMillis(n) {
19
19
  return new Promise(e =>
@@ -25,8 +25,8 @@ async function sleepMillis(n) {
25
25
  function shuffle(n, e = Math.random) {
26
26
  for (let t = n.length - 1; t > 0; t--) {
27
27
  const r = Math.floor(e() * (t + 1)),
28
- i = n[t]
29
- ;(n[t] = n[r]), (n[r] = i)
28
+ o = n[t]
29
+ ;(n[t] = n[r]), (n[r] = o)
30
30
  }
31
31
  return n
32
32
  }
@@ -59,15 +59,15 @@ function rotate2DArray(n) {
59
59
  }
60
60
  function initialize2DArray(n, e, t) {
61
61
  const r = []
62
- for (let i = 0; i < n; i++) {
62
+ for (let o = 0; o < n; o++) {
63
63
  r.push([])
64
- for (let o = 0; o < e; o++) r[i].push(t)
64
+ for (let i = 0; i < e; i++) r[o].push(t)
65
65
  }
66
66
  return r
67
67
  }
68
68
  function containsShape(n, e, t, r) {
69
69
  if (t < 0 || r < 0 || r + e[0].length > n[0].length || t + e.length > n.length) return !1
70
- for (let i = 0; i < e.length; i++) for (let o = 0; o < e[i].length; o++) if (e[i][o] !== void 0 && n[t + i][r + o] !== e[i][o]) return !1
70
+ for (let o = 0; o < e.length; o++) for (let i = 0; i < e[o].length; i++) if (e[o][i] !== void 0 && n[t + o][r + i] !== e[o][i]) return !1
71
71
  return !0
72
72
  }
73
73
  function pickRandomIndices(n, e, t = Math.random) {
@@ -97,10 +97,10 @@ function containsPoint(n, e, t) {
97
97
  return e >= n.x && e < n.x + n.width && t >= n.y && t < n.y + n.height
98
98
  }
99
99
  function randomPoint(n, e, t, r = Math.random) {
100
- let i, o
101
- do (i = intBetween(0, n - 1, r)), (o = intBetween(0, e - 1, r))
102
- while (t && containsPoint(t, i, o))
103
- return [i, o]
100
+ let o, i
101
+ do (o = intBetween(0, n - 1, r)), (i = intBetween(0, e - 1, r))
102
+ while (t && containsPoint(t, o, i))
103
+ return [o, i]
104
104
  }
105
105
  function procs(n, e = Math.random) {
106
106
  const t = Math.floor(n),
@@ -115,68 +115,68 @@ function pick(n, e = Math.random) {
115
115
  }
116
116
  function pickMany(n, e, t = Math.random) {
117
117
  if (e > n.length) throw new Error(`Count (${e}) is greater than array length (${n.length})`)
118
- return pickRandomIndices(n, e, t).map(i => n[i])
118
+ return pickRandomIndices(n, e, t).map(o => n[o])
119
119
  }
120
120
  function pickManyUnique(n, e, t, r = Math.random) {
121
121
  if (e > n.length) throw new Error(`Count (${e}) is greater than array length (${n.length})`)
122
- const i = []
123
- for (; i.length < e; ) {
124
- const o = pick(n, r)
125
- i.some(u => t(u, o)) || i.push(o)
122
+ const o = []
123
+ for (; o.length < e; ) {
124
+ const i = pick(n, r)
125
+ o.some(u => t(u, i)) || o.push(i)
126
126
  }
127
- return i
127
+ return o
128
128
  }
129
- function pickGuaranteed(n, e, t, r, i, o = Math.random) {
129
+ function pickGuaranteed(n, e, t, r, o, i = Math.random) {
130
130
  const u = n.filter(c => c !== e && c !== t),
131
131
  s = []
132
132
  for (e !== null && s.push(e); u.length && s.length < r; ) {
133
- const c = exports.Random.intBetween(0, u.length - 1, o)
134
- i(u[c], s) && s.push(u[c]), u.splice(c, 1)
133
+ const c = exports.Random.intBetween(0, u.length - 1, i)
134
+ o(u[c], s) && s.push(u[c]), u.splice(c, 1)
135
135
  }
136
- return shuffle(s, o), { values: s, indexOfGuaranteed: e !== null ? s.indexOf(e) : -1 }
136
+ return shuffle(s, i), { values: s, indexOfGuaranteed: e !== null ? s.indexOf(e) : -1 }
137
137
  }
138
138
  function last(n) {
139
139
  if (!n.length) throw Error('Received empty array')
140
140
  return n[n.length - 1]
141
141
  }
142
142
  function pipe(n, e, t) {
143
- return t(e.reduce((r, i) => i(r), n))
143
+ return t(e.reduce((r, o) => o(r), n))
144
144
  }
145
145
  function makePipe(n, e) {
146
146
  return t => pipe(t, n, e)
147
147
  }
148
148
  function pickWeighted(n, e, t) {
149
149
  if ((t === void 0 && (t = Math.random()), n.length !== e.length)) throw new Error('Array length mismatch')
150
- let r = e.reduce((o, u) => o + u, 0)
151
- const i = t * r
152
- for (let o = 0; o < n.length - 1; o++) if (((r -= e[o]), i >= r)) return n[o]
150
+ let r = e.reduce((i, u) => i + u, 0)
151
+ const o = t * r
152
+ for (let i = 0; i < n.length - 1; i++) if (((r -= e[i]), o >= r)) return n[i]
153
153
  return last(n)
154
154
  }
155
155
  function sortWeighted(n, e, t = Math.random) {
156
- const r = e.map(o => t() * o),
157
- i = []
158
- for (let o = 0; o < n.length; o++) i.push([n[o], r[o]])
159
- return i.sort((o, u) => u[1] - o[1]).map(o => o[0])
156
+ const r = e.map(i => t() * i),
157
+ o = []
158
+ for (let i = 0; i < n.length; i++) o.push([n[i], r[i]])
159
+ return o.sort((i, u) => u[1] - i[1]).map(i => i[0])
160
160
  }
161
161
  function getDeep(n, e) {
162
162
  if (n == null) return null
163
163
  const t = e.split('.')
164
164
  let r = n
165
- for (const i of t) {
166
- if (r[i] === null || r[i] === void 0) return null
167
- r = r[i]
165
+ for (const o of t) {
166
+ if (r[o] === null || r[o] === void 0) return null
167
+ r = r[o]
168
168
  }
169
169
  return r
170
170
  }
171
171
  function setDeep(n, e, t) {
172
172
  const r = e.split(/\.|\[/)
173
- let i = n
174
- for (let o = 0; o < r.length; o++) {
175
- const u = r[o],
176
- s = o < r.length - 1 && r[o + 1].includes(']'),
173
+ let o = n
174
+ for (let i = 0; i < r.length; i++) {
175
+ const u = r[i],
176
+ s = i < r.length - 1 && r[i + 1].includes(']'),
177
177
  f = u.includes(']') ? u.replace(/\[|\]/g, '') : u
178
- if (o === r.length - 1) return (i[f] = t), t
179
- isObject(i[f]) || (s ? (i[f] = []) : (i[f] = {})), (i = i[f])
178
+ if (i === r.length - 1) return (o[f] = t), t
179
+ isObject(o[f]) || (s ? (o[f] = []) : (o[f] = {})), (o = o[f])
180
180
  }
181
181
  return t
182
182
  }
@@ -191,8 +191,8 @@ function deleteDeep(n, e) {
191
191
  const t = beforeLast(e, '.'),
192
192
  r = afterLast(e, '.')
193
193
  if (!t || !r) return
194
- const i = getDeep(n, t)
195
- i && delete i[r]
194
+ const o = getDeep(n, t)
195
+ o && delete o[r]
196
196
  }
197
197
  function replaceDeep(n, e, t) {
198
198
  const r = getDeep(n, e)
@@ -201,8 +201,8 @@ function replaceDeep(n, e, t) {
201
201
  }
202
202
  function getFirstDeep(n, e, t) {
203
203
  for (const r of e) {
204
- const i = getDeep(n, r)
205
- if (i) return i
204
+ const o = getDeep(n, r)
205
+ if (o) return o
206
206
  }
207
207
  if (t) {
208
208
  const r = Object.values(n)
@@ -231,7 +231,7 @@ function whereAmI() {
231
231
  const n = globalThis.process
232
232
  return n ? (n.browser === !0 ? 'browser' : 'node') : 'browser'
233
233
  }
234
- async function withRetries(n, e, t, r, i, o) {
234
+ async function withRetries(n, e, t, r, o, i) {
235
235
  let u = null
236
236
  for (let s = 0; s <= e; s++)
237
237
  try {
@@ -239,7 +239,7 @@ async function withRetries(n, e, t, r, i, o) {
239
239
  } catch (c) {
240
240
  if (((u = c), s === e)) break
241
241
  const f = t + (r - t) * (s / (e - 1))
242
- i && i('Error in withRetries, retrying', { attempt: s + 1, allowedFailures: e, delayMillis: f, error: c }), o && o(), await sleepMillis(f)
242
+ o && o('Error in withRetries, retrying', { attempt: s + 1, allowedFailures: e, delayMillis: f, error: c }), i && i(), await sleepMillis(f)
243
243
  }
244
244
  throw u
245
245
  }
@@ -258,11 +258,11 @@ function rgbToHex(n) {
258
258
  return '#' + n.map(e => e.toString(16).padStart(2, '0')).join('')
259
259
  }
260
260
  function haversineDistanceToMeters(n, e, t, r) {
261
- const o = (n * Math.PI) / 180,
261
+ const i = (n * Math.PI) / 180,
262
262
  u = (t * Math.PI) / 180,
263
263
  s = ((t - n) * Math.PI) / 180,
264
264
  c = ((r - e) * Math.PI) / 180,
265
- f = Math.sin(s / 2) * Math.sin(s / 2) + Math.cos(o) * Math.cos(u) * Math.sin(c / 2) * Math.sin(c / 2)
265
+ f = Math.sin(s / 2) * Math.sin(s / 2) + Math.cos(i) * Math.cos(u) * Math.sin(c / 2) * Math.sin(c / 2)
266
266
  return 6371e3 * (2 * Math.atan2(Math.sqrt(f), Math.sqrt(1 - f)))
267
267
  }
268
268
  function roundToNearest(n, e) {
@@ -281,20 +281,20 @@ function searchFloat(n) {
281
281
  }
282
282
  function binomialSample(n, e, t = Math.random) {
283
283
  const r = n * e,
284
- i = Math.sqrt(n * e * (1 - e)),
284
+ o = Math.sqrt(n * e * (1 - e)),
285
285
  u = (t() + t() + t() + t() + t() + t() - 3) * Math.SQRT2,
286
- s = Math.round(r + i * u)
286
+ s = Math.round(r + o * u)
287
287
  return Math.max(0, Math.min(n, s))
288
288
  }
289
289
  function toSignificantDigits(n, e) {
290
290
  if (!n.includes('.')) return n
291
291
  if (parseFloat(n) === 0) return '0'
292
292
  const [t, r] = n.split('.'),
293
- i = t.replace('-', ''),
294
- o = i.length
295
- if (o >= e) return t
296
- if (!(i === '0')) {
297
- const f = e - o,
293
+ o = t.replace('-', ''),
294
+ i = o.length
295
+ if (i >= e) return t
296
+ if (!(o === '0')) {
297
+ const f = e - i,
298
298
  l = r.slice(0, f)
299
299
  return /[1-9]/.test(l) ? `${t}.${l.replace(/0+$/, '')}` : t
300
300
  }
@@ -380,7 +380,7 @@ function searchHex(n, e) {
380
380
  }
381
381
  function searchSubstring(n, e, t = symbolsArray) {
382
382
  const r = splitAll(n, t)
383
- for (const i of r) if (e(i)) return i
383
+ for (const o of r) if (e(o)) return o
384
384
  return null
385
385
  }
386
386
  function randomHexString(n, e = Math.random) {
@@ -460,9 +460,9 @@ function asTime(n, e) {
460
460
  const t = n.split(':')
461
461
  if (t.length !== 2) throw new TypeError(`Expected time${e?.name ? ` for ${e.name}` : ''}, got: ` + n)
462
462
  const r = parseInt(t[0], 10),
463
- i = parseInt(t[1], 10)
464
- if (!isNumber(r) || !isNumber(i) || r < 0 || r > 23 || i < 0 || i > 59) throw new TypeError(`Expected time, got${e?.name ? ` for ${e.name}` : ''}: ` + n)
465
- return `${String(r).padStart(2, '0')}:${String(i).padStart(2, '0')}`
463
+ o = parseInt(t[1], 10)
464
+ if (!isNumber(r) || !isNumber(o) || r < 0 || r > 23 || o < 0 || o > 59) throw new TypeError(`Expected time, got${e?.name ? ` for ${e.name}` : ''}: ` + n)
465
+ return `${String(r).padStart(2, '0')}:${String(o).padStart(2, '0')}`
466
466
  }
467
467
  function asArray(n, e) {
468
468
  if (!Array.isArray(n)) throw new TypeError(`Expected array${e?.name ? ` for ${e.name}` : ''}, got: ` + n)
@@ -483,8 +483,8 @@ function asStringMap(n, e) {
483
483
  function asNumericDictionary(n, e) {
484
484
  const t = asObject(n),
485
485
  r = Object.keys(t),
486
- i = Object.values(t)
487
- if (!r.every(isString) || !i.every(isNumber)) throw new TypeError(`Expected numeric dictionary${e?.name ? ` for ${e.name}` : ''}, got: ` + n)
486
+ o = Object.values(t)
487
+ if (!r.every(isString) || !o.every(isNumber)) throw new TypeError(`Expected numeric dictionary${e?.name ? ` for ${e.name}` : ''}, got: ` + n)
488
488
  return t
489
489
  }
490
490
  function isUrl(n) {
@@ -531,16 +531,16 @@ function represent(n, e = 'json', t = 0) {
531
531
  if (t > 1) return '[object Object]'
532
532
  if (e === 'json') {
533
533
  if (Array.isArray(n)) {
534
- const i = n.map(o => represent(o, 'json', t + 1))
535
- return t === 0 ? JSON.stringify(i) : i
534
+ const o = n.map(i => represent(i, 'json', t + 1))
535
+ return t === 0 ? JSON.stringify(o) : o
536
536
  }
537
537
  const r = {}
538
538
  n.message && (r.message = represent(n.message, 'json', t + 1))
539
- for (const [i, o] of Object.entries(n)) r[i] = represent(o, 'json', t + 1)
539
+ for (const [o, i] of Object.entries(n)) r[o] = represent(i, 'json', t + 1)
540
540
  return t === 0 ? JSON.stringify(r) : r
541
541
  } else if (e === 'key-value') {
542
542
  const r = Object.keys(n)
543
- return n.message && !r.includes('message') && r.unshift('message'), r.map(i => `${i}=${JSON.stringify(represent(n[i], 'json', t + 1))}`).join(' ')
543
+ return n.message && !r.includes('message') && r.unshift('message'), r.map(o => `${o}=${JSON.stringify(represent(n[o], 'json', t + 1))}`).join(' ')
544
544
  }
545
545
  }
546
546
  return isUndefined(n) && (n = 'undefined'), t === 0 ? JSON.stringify(n) : n
@@ -549,7 +549,7 @@ function expandError(n, e) {
549
549
  if (isString(n)) return n
550
550
  const t = Object.keys(n)
551
551
  n.message && !t.includes('message') && t.push('message')
552
- const r = t.map(i => `${i}: ${n[i]}`).join('; ')
552
+ const r = t.map(o => `${o}: ${n[o]}`).join('; ')
553
553
  return e && n.stack
554
554
  ? r +
555
555
  `
@@ -571,7 +571,7 @@ function deepMerge3(n, e, t) {
571
571
  }
572
572
  function zip(n, e) {
573
573
  const t = {}
574
- for (const r of n) for (const i of Object.keys(r)) t[i] ? (t[i] = e(t[i], r[i])) : (t[i] = r[i])
574
+ for (const r of n) for (const o of Object.keys(r)) t[o] ? (t[o] = e(t[o], r[o])) : (t[o] = r[o])
575
575
  return t
576
576
  }
577
577
  function zipSum(n) {
@@ -630,9 +630,9 @@ function asEither(n, e) {
630
630
  function scheduleMany(n, e) {
631
631
  for (let t = 0; t < n.length; t++) {
632
632
  const r = n[t],
633
- i = e[t],
634
- o = Math.max(0, i.getTime() - Date.now())
635
- setTimeout(r, o)
633
+ o = e[t],
634
+ i = Math.max(0, o.getTime() - Date.now())
635
+ setTimeout(r, i)
636
636
  }
637
637
  }
638
638
  function interpolate(n, e, t) {
@@ -645,7 +645,7 @@ function average(n) {
645
645
  return n.reduce((e, t) => e + t, 0) / n.length
646
646
  }
647
647
  function median(n) {
648
- const e = [...n].sort((r, i) => r - i),
648
+ const e = [...n].sort((r, o) => r - o),
649
649
  t = Math.floor(e.length / 2)
650
650
  return e.length % 2 === 0 ? (e[t] + e[t - 1]) / 2 : e[t]
651
651
  }
@@ -743,7 +743,7 @@ function splitOnce(n, e, t = !1) {
743
743
  }
744
744
  function splitAll(n, e) {
745
745
  let t = [n]
746
- for (const r of e) t = t.flatMap(i => i.split(r))
746
+ for (const r of e) t = t.flatMap(o => o.split(r))
747
747
  return t.filter(r => r)
748
748
  }
749
749
  function getExtension(n) {
@@ -781,11 +781,11 @@ function expand(n) {
781
781
  t = n.match(e)
782
782
  if (!t || !t.index) return [n]
783
783
  const r = t[1].split(','),
784
- i = n.slice(0, t.index),
785
- o = n.slice(t.index + t[0].length)
784
+ o = n.slice(0, t.index),
785
+ i = n.slice(t.index + t[0].length)
786
786
  let u = []
787
787
  for (const s of r) {
788
- const c = expand(i + s + o)
788
+ const c = expand(o + s + i)
789
789
  u = u.concat(c)
790
790
  }
791
791
  return u
@@ -827,34 +827,34 @@ function isWordBreakCharacter(n) {
827
827
  function isValidObjectPathCharacter(n) {
828
828
  return isLetterOrDigit(n) || n === '.' || n === '[' || n === ']' || n === '_'
829
829
  }
830
- function insertString(n, e, t, r, i) {
831
- return n.slice(0, e) + r + n.slice(e, e + t) + i + n.slice(e + t)
830
+ function insertString(n, e, t, r, o) {
831
+ return n.slice(0, e) + r + n.slice(e, e + t) + o + n.slice(e + t)
832
832
  }
833
833
  function indexOfRegex(n, e, t = 0) {
834
834
  const r = e.exec(n.slice(t))
835
835
  return r ? { index: r.index, match: r[0] } : null
836
836
  }
837
837
  function lineMatches(n, e, t = !0) {
838
- if (!t) return e.every(i => (i instanceof RegExp ? i.test(n) : n.indexOf(i, 0) !== -1))
838
+ if (!t) return e.every(o => (o instanceof RegExp ? o.test(n) : n.indexOf(o, 0) !== -1))
839
839
  let r = 0
840
- for (const i of e)
841
- if (i instanceof RegExp) {
842
- const o = indexOfRegex(n, i, r)
843
- if (!o) return !1
844
- r = o.index + o.match.length
840
+ for (const o of e)
841
+ if (o instanceof RegExp) {
842
+ const i = indexOfRegex(n, o, r)
843
+ if (!i) return !1
844
+ r = i.index + i.match.length
845
845
  } else {
846
- const o = n.indexOf(i, r)
847
- if (o === -1) return !1
848
- r = o + i.length
846
+ const i = n.indexOf(o, r)
847
+ if (i === -1) return !1
848
+ r = i + o.length
849
849
  }
850
850
  return !0
851
851
  }
852
852
  function linesMatchInOrder(n, e, t = !0) {
853
853
  let r = 0
854
- for (const i of e) {
855
- let o = !1
856
- for (; !o && r < n.length; ) lineMatches(n[r], i, t) && (o = !0), r++
857
- if (!o) return !1
854
+ for (const o of e) {
855
+ let i = !1
856
+ for (; !i && r < n.length; ) lineMatches(n[r], o, t) && (i = !0), r++
857
+ if (!i) return !1
858
858
  }
859
859
  return !0
860
860
  }
@@ -863,15 +863,15 @@ function csvEscape(n) {
863
863
  }
864
864
  function allIndexOf(n, e, t = 0) {
865
865
  const r = []
866
- let i = n.indexOf(e, t)
867
- for (; i !== -1; ) r.push(i), (i = n.indexOf(e, i + e.length))
866
+ let o = n.indexOf(e, t)
867
+ for (; o !== -1; ) r.push(o), (o = n.indexOf(e, o + e.length))
868
868
  return r
869
869
  }
870
870
  function indexOfEarliest(n, e, t = 0) {
871
871
  let r = -1
872
- for (const i of e) {
873
- const o = n.indexOf(i, t)
874
- o !== -1 && (r === -1 || o < r) && (r = o)
872
+ for (const o of e) {
873
+ const i = n.indexOf(o, t)
874
+ i !== -1 && (r === -1 || i < r) && (r = i)
875
875
  }
876
876
  return r
877
877
  }
@@ -887,11 +887,11 @@ function lastIndexOfBefore(n, e, t = 0) {
887
887
  return n.slice(0, t).lastIndexOf(e)
888
888
  }
889
889
  function findWeightedPair(n, e = 0, t = '{', r = '}') {
890
- let i = 1
891
- for (let o = e; o < n.length; o++)
892
- if (n.slice(o, o + r.length) === r) {
893
- if (--i === 0) return o
894
- } else n.slice(o, o + t.length) === t && i++
890
+ let o = 1
891
+ for (let i = e; i < n.length; i++)
892
+ if (n.slice(i, i + r.length) === r) {
893
+ if (--o === 0) return i
894
+ } else n.slice(i, i + t.length) === t && o++
895
895
  return -1
896
896
  }
897
897
  function extractBlock(n, e) {
@@ -925,9 +925,9 @@ function extractAllBlocks(n, e) {
925
925
  : n.indexOf(e.opening, e.start || 0)
926
926
  for (;;) {
927
927
  if (r === -1) return t
928
- const i = extractBlock(n, { ...e, start: r })
929
- if (!i) return t
930
- t.push(i),
928
+ const o = extractBlock(n, { ...e, start: r })
929
+ if (!o) return t
930
+ t.push(o),
931
931
  (r = e.wordBoundary
932
932
  ? indexOfEarliest(
933
933
  n,
@@ -936,35 +936,35 @@ function extractAllBlocks(n, e) {
936
936
  `${e.opening}
937
937
  `
938
938
  ],
939
- r + i.length
939
+ r + o.length
940
940
  )
941
- : n.indexOf(e.opening, r + i.length))
941
+ : n.indexOf(e.opening, r + o.length))
942
942
  }
943
943
  }
944
944
  function replaceBlocks(n, e, t) {
945
945
  let r = 0
946
946
  for (;;) {
947
- const i = exports.Strings.extractBlock(n, { ...t, start: r })
948
- if (!i) return n
949
- const o = e(i)
950
- ;(r = n.indexOf(i, r) + o.length), (n = n.replace(i, o))
947
+ const o = exports.Strings.extractBlock(n, { ...t, start: r })
948
+ if (!o) return n
949
+ const i = e(o)
950
+ ;(r = n.indexOf(o, r) + i.length), (n = n.replace(o, i))
951
951
  }
952
952
  }
953
953
  function splitFormatting(n, e) {
954
954
  const t = []
955
955
  let r = 0
956
956
  for (; r < n.length; ) {
957
- const i = n.indexOf(e, r)
958
- if (i === -1) {
957
+ const o = n.indexOf(e, r)
958
+ if (o === -1) {
959
959
  t.push({ string: n.slice(r), symbol: null })
960
960
  break
961
961
  }
962
- const o = n.indexOf(e, i + e.length)
963
- if ((i > r && o !== -1 && t.push({ string: n.slice(r, i), symbol: null }), o === -1)) {
962
+ const i = n.indexOf(e, o + e.length)
963
+ if ((o > r && i !== -1 && t.push({ string: n.slice(r, o), symbol: null }), i === -1)) {
964
964
  t.push({ string: n.slice(r), symbol: null })
965
965
  break
966
966
  }
967
- t.push({ string: n.slice(i + e.length, o), symbol: e }), (r = o + e.length)
967
+ t.push({ string: n.slice(o + e.length, i), symbol: e }), (r = i + e.length)
968
968
  }
969
969
  return t
970
970
  }
@@ -977,12 +977,12 @@ function splitHashtags(n) {
977
977
  e.push({ string: n.slice(t), symbol: null })
978
978
  break
979
979
  }
980
- const i = indexOfWordBreak(n, r + 1)
981
- if (i === -1) {
980
+ const o = indexOfWordBreak(n, r + 1)
981
+ if (o === -1) {
982
982
  e.push({ string: n.slice(t, r), symbol: null }), e.push({ string: n.slice(r + 1), symbol: '#' })
983
983
  break
984
984
  }
985
- r > t && e.push({ string: n.slice(t, r), symbol: null }), e.push({ string: n.slice(r + 1, i), symbol: '#' }), (t = i)
985
+ r > t && e.push({ string: n.slice(t, r), symbol: null }), e.push({ string: n.slice(r + 1, o), symbol: '#' }), (t = o)
986
986
  }
987
987
  return e
988
988
  }
@@ -995,7 +995,7 @@ function splitUrls(n) {
995
995
  e.push({ string: n.slice(t), symbol: null })
996
996
  break
997
997
  }
998
- const i = indexOfEarliest(
998
+ const o = indexOfEarliest(
999
999
  n,
1000
1000
  [
1001
1001
  ' ',
@@ -1004,11 +1004,11 @@ function splitUrls(n) {
1004
1004
  ],
1005
1005
  r
1006
1006
  )
1007
- if (i === -1) {
1007
+ if (o === -1) {
1008
1008
  r > t && e.push({ string: n.slice(t, r), symbol: null }), e.push({ string: n.slice(r), symbol: 'http' })
1009
1009
  break
1010
1010
  }
1011
- r > t && e.push({ string: n.slice(t, r), symbol: null }), e.push({ string: n.slice(r, i), symbol: 'http' }), (t = i)
1011
+ r > t && e.push({ string: n.slice(t, r), symbol: null }), e.push({ string: n.slice(r, o), symbol: 'http' }), (t = o)
1012
1012
  }
1013
1013
  return e
1014
1014
  }
@@ -1029,33 +1029,33 @@ function uint8ArrayToBase32(n) {
1029
1029
  function baseToUint8Array(n, e) {
1030
1030
  const t = '=',
1031
1031
  r = e.length
1032
- let i = 0,
1033
- o = 0
1032
+ let o = 0,
1033
+ i = 0
1034
1034
  const u = []
1035
1035
  for (let s = 0; s < n.length; s++) {
1036
1036
  const c = n[s]
1037
1037
  if (c === t) break
1038
1038
  const f = e.indexOf(c)
1039
1039
  if (f === -1) throw new Error(`Invalid character: ${c}`)
1040
- ;(o = (o << Math.log2(r)) | f), (i += Math.log2(r)), i >= 8 && ((i -= 8), u.push((o >> i) & 255))
1040
+ ;(i = (i << Math.log2(r)) | f), (o += Math.log2(r)), o >= 8 && ((o -= 8), u.push((i >> o) & 255))
1041
1041
  }
1042
1042
  return new Uint8Array(u)
1043
1043
  }
1044
1044
  function uint8ArrayToBase(n, e) {
1045
1045
  const t = e.length
1046
1046
  let r = 0,
1047
- i = 0,
1048
- o = ''
1049
- for (let u = 0; u < n.length; u++) for (i = (i << 8) | n[u], r += 8; r >= Math.log2(t); ) (r -= Math.log2(t)), (o += e[(i >> r) & (t - 1)])
1050
- return r > 0 && (o += e[(i << (Math.log2(t) - r)) & (t - 1)]), o.length % 4 !== 0 && (o += '='.repeat(4 - (o.length % 4))), o
1047
+ o = 0,
1048
+ i = ''
1049
+ for (let u = 0; u < n.length; u++) for (o = (o << 8) | n[u], r += 8; r >= Math.log2(t); ) (r -= Math.log2(t)), (i += e[(o >> r) & (t - 1)])
1050
+ return r > 0 && (i += e[(o << (Math.log2(t) - r)) & (t - 1)]), i.length % 4 !== 0 && (i += '='.repeat(4 - (i.length % 4))), i
1051
1051
  }
1052
1052
  function hexToUint8Array(n) {
1053
1053
  ;(n.startsWith('0x') || n.startsWith('0X')) && (n = n.slice(2))
1054
1054
  const e = n.length / 2,
1055
1055
  t = new Uint8Array(e)
1056
1056
  for (let r = 0; r < e; r++) {
1057
- const i = parseInt(n.slice(r * 2, r * 2 + 2), 16)
1058
- t[r] = i
1057
+ const o = parseInt(n.slice(r * 2, r * 2 + 2), 16)
1058
+ t[r] = o
1059
1059
  }
1060
1060
  return t
1061
1061
  }
@@ -1073,30 +1073,30 @@ function binaryToUint8Array(n) {
1073
1073
  const e = Math.ceil(n.length / 8),
1074
1074
  t = new Uint8Array(e)
1075
1075
  for (let r = 0; r < e; r++) {
1076
- const i = parseInt(n.slice(r * 8, r * 8 + 8), 2)
1077
- t[r] = i
1076
+ const o = parseInt(n.slice(r * 8, r * 8 + 8), 2)
1077
+ t[r] = o
1078
1078
  }
1079
1079
  return t
1080
1080
  }
1081
1081
  function route(n, e) {
1082
- const t = n.split('/').filter(o => o),
1083
- r = e.split('/').filter(o => o)
1082
+ const t = n.split('/').filter(i => i),
1083
+ r = e.split('/').filter(i => i)
1084
1084
  if (t.length !== r.length) return null
1085
- const i = {}
1086
- for (let o = 0; o < t.length; o++) {
1087
- const u = t[o]
1088
- if (u.startsWith(':')) i[u.slice(1)] = r[o]
1089
- else if (u !== r[o]) return null
1085
+ const o = {}
1086
+ for (let i = 0; i < t.length; i++) {
1087
+ const u = t[i]
1088
+ if (u.startsWith(':')) o[u.slice(1)] = r[i]
1089
+ else if (u !== r[i]) return null
1090
1090
  }
1091
- return i
1091
+ return o
1092
1092
  }
1093
1093
  function explodeReplace(n, e, t) {
1094
1094
  const r = []
1095
- for (const i of t) i !== e && r.push(n.replace(e, i))
1095
+ for (const o of t) o !== e && r.push(n.replace(e, o))
1096
1096
  return r
1097
1097
  }
1098
1098
  function generateVariants(n, e, t, r = Math.random) {
1099
- const i = exports.Arrays.shuffle(
1099
+ const o = exports.Arrays.shuffle(
1100
1100
  e.map(u => ({
1101
1101
  variants: exports.Arrays.shuffle(
1102
1102
  u.variants.map(s => s),
@@ -1106,22 +1106,22 @@ function generateVariants(n, e, t, r = Math.random) {
1106
1106
  })),
1107
1107
  r
1108
1108
  ),
1109
- o = []
1110
- for (const u of i) {
1109
+ i = []
1110
+ for (const u of o) {
1111
1111
  const s = u.variants.filter(f => f !== u.avoid),
1112
1112
  c = s.find(f => n.includes(f))
1113
- if (c && (pushAll(o, explodeReplace(n, c, s)), o.length >= t)) break
1113
+ if (c && (pushAll(i, explodeReplace(n, c, s)), i.length >= t)) break
1114
1114
  }
1115
- if (o.length < t)
1116
- for (const u of i) {
1115
+ if (i.length < t)
1116
+ for (const u of o) {
1117
1117
  const s = u.variants.find(c => n.includes(c))
1118
- if (s && (pushAll(o, explodeReplace(n, s, u.variants)), o.length >= t)) break
1118
+ if (s && (pushAll(i, explodeReplace(n, s, u.variants)), i.length >= t)) break
1119
1119
  }
1120
- return o.slice(0, t)
1120
+ return i.slice(0, t)
1121
1121
  }
1122
1122
  function replaceWord(n, e, t, r = !1) {
1123
- const i = new RegExp(r ? `(?<=\\s|^)${e}(?=\\s|$)` : `\\b${e}\\b`, 'g')
1124
- return n.replace(i, t)
1123
+ const o = new RegExp(r ? `(?<=\\s|^)${e}(?=\\s|$)` : `\\b${e}\\b`, 'g')
1124
+ return n.replace(o, t)
1125
1125
  }
1126
1126
  function replacePascalCaseWords(n, e) {
1127
1127
  const t = /\b[A-Z][a-zA-Z0-9]*\b/g
@@ -1142,40 +1142,40 @@ function measureTextWidth(n, e = {}) {
1142
1142
  }
1143
1143
  function toLines(n, e, t = {}) {
1144
1144
  const r = []
1145
- let i = '',
1146
- o = 0
1145
+ let o = '',
1146
+ i = 0
1147
1147
  for (let u = 0; u < n.length; u++) {
1148
1148
  const s = n[u],
1149
1149
  c = t[s] || 1
1150
- if (((i += s), (o += c), o > e)) {
1151
- const { line: f, rest: l } = breakLine(i)
1150
+ if (((o += s), (i += c), i > e)) {
1151
+ const { line: f, rest: l } = breakLine(o)
1152
1152
  r.push(f),
1153
- (i = l),
1154
- (o = l
1153
+ (o = l),
1154
+ (i = l
1155
1155
  .split('')
1156
1156
  .map(a => t[a] || 1)
1157
1157
  .reduce((a, h) => a + h, 0))
1158
1158
  }
1159
1159
  }
1160
- return i && r.push(i), r
1160
+ return o && r.push(o), r
1161
1161
  }
1162
1162
  function levenshteinDistance(n, e) {
1163
1163
  const t = []
1164
1164
  for (let r = 0; r <= n.length; r++) t[r] = [r]
1165
1165
  for (let r = 0; r <= e.length; r++) t[0][r] = r
1166
1166
  for (let r = 1; r <= n.length; r++)
1167
- for (let i = 1; i <= e.length; i++) {
1168
- const o = n[r - 1] === e[i - 1] ? 0 : 1
1169
- t[r][i] = Math.min(t[r - 1][i] + 1, t[r][i - 1] + 1, t[r - 1][i - 1] + o)
1167
+ for (let o = 1; o <= e.length; o++) {
1168
+ const i = n[r - 1] === e[o - 1] ? 0 : 1
1169
+ t[r][o] = Math.min(t[r - 1][o] + 1, t[r][o - 1] + 1, t[r - 1][o - 1] + i)
1170
1170
  }
1171
1171
  return t[n.length][e.length]
1172
1172
  }
1173
1173
  function findCommonPrefix(n) {
1174
- const e = n.reduce((r, i) => (r.length < i.length ? r : i))
1174
+ const e = n.reduce((r, o) => (r.length < o.length ? r : o))
1175
1175
  let t = ''
1176
1176
  for (let r = 0; r < e.length; r++) {
1177
- const i = e[r]
1178
- if (n.every(o => o[r] === i)) t += i
1177
+ const o = e[r]
1178
+ if (n.every(i => i[r] === o)) t += o
1179
1179
  else break
1180
1180
  }
1181
1181
  return t
@@ -1196,8 +1196,8 @@ function parseHtmlAttributes(n) {
1196
1196
  t = n.match(/([a-z\-]+)="([^"]+)"/g)
1197
1197
  if (t)
1198
1198
  for (const r of t) {
1199
- const [i, o] = splitOnce(r, '=')
1200
- e[i] = o.slice(1, o.length - 1)
1199
+ const [o, i] = splitOnce(r, '=')
1200
+ e[o] = i.slice(1, i.length - 1)
1201
1201
  }
1202
1202
  return e
1203
1203
  }
@@ -1208,38 +1208,38 @@ function readNextWord(n, e, t = []) {
1208
1208
  }
1209
1209
  function readWordsAfterAll(n, e, t = []) {
1210
1210
  const r = allIndexOf(n, e),
1211
- i = []
1212
- for (const o of r) i.push(readNextWord(n, o + e.length, t))
1213
- return i
1211
+ o = []
1212
+ for (const i of r) o.push(readNextWord(n, i + e.length, t))
1213
+ return o
1214
1214
  }
1215
1215
  function resolveVariables(n, e, t = '$', r = ':') {
1216
- for (const i in e) n = resolveVariableWithDefaultSyntax(n, i, e[i], t, r)
1216
+ for (const o in e) n = resolveVariableWithDefaultSyntax(n, o, e[o], t, r)
1217
1217
  return (n = resolveRemainingVariablesWithDefaults(n)), n
1218
1218
  }
1219
- function resolveVariableWithDefaultSyntax(n, e, t, r = '$', i = ':') {
1219
+ function resolveVariableWithDefaultSyntax(n, e, t, r = '$', o = ':') {
1220
1220
  if (t === '') return n
1221
- let o = n.indexOf(`${r}${e}`)
1222
- for (; o !== -1; ) {
1223
- if (n[o + e.length + 1] === i)
1224
- if (n[o + e.length + 2] === i) n = n.replace(`${r}${e}${i}${i}`, t)
1221
+ let i = n.indexOf(`${r}${e}`)
1222
+ for (; i !== -1; ) {
1223
+ if (n[i + e.length + 1] === o)
1224
+ if (n[i + e.length + 2] === o) n = n.replace(`${r}${e}${o}${o}`, t)
1225
1225
  else {
1226
- const s = readNextWord(n, o + e.length + 2, ['_'])
1227
- n = n.replace(`${r}${e}${i}${s}`, t)
1226
+ const s = readNextWord(n, i + e.length + 2, ['_'])
1227
+ n = n.replace(`${r}${e}${o}${s}`, t)
1228
1228
  }
1229
1229
  else n = n.replace(`${r}${e}`, t)
1230
- o = n.indexOf(`${r}${e}`, o + t.length)
1230
+ i = n.indexOf(`${r}${e}`, i + t.length)
1231
1231
  }
1232
1232
  return n
1233
1233
  }
1234
1234
  function resolveRemainingVariablesWithDefaults(n, e = '$', t = ':') {
1235
1235
  let r = n.indexOf(e)
1236
1236
  for (; r !== -1; ) {
1237
- const i = readNextWord(n, r + 1)
1238
- if (n[r + i.length + 1] === t)
1239
- if (n[r + i.length + 2] === t) n = n.replace(`${e}${i}${t}${t}`, '')
1237
+ const o = readNextWord(n, r + 1)
1238
+ if (n[r + o.length + 1] === t)
1239
+ if (n[r + o.length + 2] === t) n = n.replace(`${e}${o}${t}${t}`, '')
1240
1240
  else {
1241
- const u = readNextWord(n, r + i.length + 2)
1242
- n = n.replace(`${e}${i}${t}${u}`, u)
1241
+ const u = readNextWord(n, r + o.length + 2)
1242
+ n = n.replace(`${e}${o}${t}${u}`, u)
1243
1243
  }
1244
1244
  r = n.indexOf(e, r + 1)
1245
1245
  }
@@ -1249,11 +1249,11 @@ function resolveMarkdownLinks(n, e) {
1249
1249
  let t = n.indexOf('](')
1250
1250
  for (; t !== -1; ) {
1251
1251
  const r = lastIndexOfBefore(n, '[', t),
1252
- i = n.indexOf(')', t)
1253
- if (r !== -1 && i !== -1) {
1254
- const [o, u] = n.slice(r + 1, i).split(']('),
1255
- s = e(o, u)
1256
- n = n.slice(0, r) + s + n.slice(i + 1)
1252
+ o = n.indexOf(')', t)
1253
+ if (r !== -1 && o !== -1) {
1254
+ const [i, u] = n.slice(r + 1, o).split(']('),
1255
+ s = e(i, u)
1256
+ n = n.slice(0, r) + s + n.slice(o + 1)
1257
1257
  }
1258
1258
  t = n.indexOf('](', t + 1)
1259
1259
  }
@@ -1261,8 +1261,8 @@ function resolveMarkdownLinks(n, e) {
1261
1261
  }
1262
1262
  function toQueryString(n, e = !0) {
1263
1263
  const t = Object.entries(n)
1264
- .filter(([r, i]) => i != null)
1265
- .map(([r, i]) => `${r}=${encodeURIComponent(i)}`)
1264
+ .filter(([r, o]) => o != null)
1265
+ .map(([r, o]) => `${r}=${encodeURIComponent(o)}`)
1266
1266
  .join('&')
1267
1267
  return t ? (e ? '?' : '') + t : ''
1268
1268
  }
@@ -1270,8 +1270,8 @@ function parseQueryString(n) {
1270
1270
  const e = {},
1271
1271
  t = n.split('&')
1272
1272
  for (const r of t) {
1273
- const [i, o] = r.split('=')
1274
- i && o && (e[i] = decodeURIComponent(o))
1273
+ const [o, i] = r.split('=')
1274
+ o && i && (e[o] = decodeURIComponent(i))
1275
1275
  }
1276
1276
  return e
1277
1277
  }
@@ -1281,16 +1281,16 @@ function hasKey(n, e) {
1281
1281
  function selectMax(n, e) {
1282
1282
  let t = null,
1283
1283
  r = -1 / 0
1284
- for (const [i, o] of Object.entries(n)) {
1285
- const u = e(o)
1286
- u > r && ((r = u), (t = i))
1284
+ for (const [o, i] of Object.entries(n)) {
1285
+ const u = e(i)
1286
+ u > r && ((r = u), (t = o))
1287
1287
  }
1288
1288
  return t ? [t, n[t]] : null
1289
1289
  }
1290
1290
  function reposition(n, e, t, r) {
1291
- const i = n.find(u => u[e] === t),
1292
- o = n.find(u => u[e] === t + r)
1293
- i && o ? ((i[e] = t + r), (o[e] = t)) : i && (i[e] = t + r), n.sort((u, s) => asNumber(u[e]) - asNumber(s[e])), n.forEach((u, s) => (u[e] = s + 1))
1291
+ const o = n.find(u => u[e] === t),
1292
+ i = n.find(u => u[e] === t + r)
1293
+ o && i ? ((o[e] = t + r), (i[e] = t)) : o && (o[e] = t + r), n.sort((u, s) => asNumber(u[e]) - asNumber(s[e])), n.forEach((u, s) => (u[e] = s + 1))
1294
1294
  }
1295
1295
  function unwrapSingleKey(n) {
1296
1296
  const e = Object.keys(n)
@@ -1315,11 +1315,11 @@ function buildUrl(n, e, t) {
1315
1315
  }
1316
1316
  function parseCsv(n, e = ',', t = '"') {
1317
1317
  const r = []
1318
- let i = '',
1319
- o = !1
1318
+ let o = '',
1319
+ i = !1
1320
1320
  const u = n.split('')
1321
- for (const s of u) s === e && !o ? (r.push(i), (i = '')) : s === t && ((!i && !o) || o) ? (o = !o) : (i += s)
1322
- return r.push(i), r
1321
+ for (const s of u) s === e && !i ? (r.push(o), (o = '')) : s === t && ((!o && !i) || i) ? (i = !i) : (o += s)
1322
+ return r.push(o), r
1323
1323
  }
1324
1324
  function humanizeProgress(n) {
1325
1325
  return `[${Math.floor(n.progress * 100)}%] ${humanizeTime(n.deltaMs)} out of ${humanizeTime(n.totalTimeMs)} (${humanizeTime(n.remainingTimeMs)} left) [${Math.round(n.baseTimeMs)} ms each]`
@@ -1327,7 +1327,7 @@ function humanizeProgress(n) {
1327
1327
  async function waitFor(n, e) {
1328
1328
  let t = e.requiredConsecutivePasses || 1,
1329
1329
  r = 0
1330
- for (let i = 0; i < e.attempts; i++) {
1330
+ for (let o = 0; o < e.attempts; o++) {
1331
1331
  try {
1332
1332
  if (await n()) {
1333
1333
  if ((r++, r >= t)) return
@@ -1335,7 +1335,7 @@ async function waitFor(n, e) {
1335
1335
  } catch {
1336
1336
  r = 0
1337
1337
  }
1338
- i < e.attempts - 1 && (await sleepMillis(e.waitMillis))
1338
+ o < e.attempts - 1 && (await sleepMillis(e.waitMillis))
1339
1339
  }
1340
1340
  throw Error('Timed out waiting for predicate')
1341
1341
  }
@@ -1370,8 +1370,8 @@ function normalizeTime(n) {
1370
1370
  let [e, t] = n.split(':')
1371
1371
  isNumber(parseInt(e, 10)) || (e = '0'), isNumber(parseInt(t, 10)) || (t = '0')
1372
1372
  let r = clamp(asInteger(e), 0, 23),
1373
- i = clamp(asInteger(t), 0, 59)
1374
- return `${createTimeDigits(r)}:${createTimeDigits(i)}`
1373
+ o = clamp(asInteger(t), 0, 59)
1374
+ return `${createTimeDigits(r)}:${createTimeDigits(o)}`
1375
1375
  }
1376
1376
  function humanizeTime(n) {
1377
1377
  const e = Math.floor(n / 36e5)
@@ -1388,28 +1388,28 @@ const DefaultTimestampLabels = { today: (n, e) => createTimeDigits(n) + ':' + cr
1388
1388
  function getTimestamp(n, e) {
1389
1389
  const t = new Date(e?.now || Date.now()),
1390
1390
  r = e?.labels || DefaultTimestampLabels,
1391
- i = isDate(n) ? n : new Date(n)
1392
- if (absoluteDays(t) === absoluteDays(i)) return r.today(i.getUTCHours(), i.getUTCMinutes(), i.getUTCHours() > 12)
1393
- if (absoluteDays(t) - absoluteDays(i) === 1) return r.yesterday()
1394
- const o = getDayInfoFromDate(i)
1395
- return absoluteDays(t) - absoluteDays(i) < 7 ? r[o.day]() : r.weeks(Math.round((t.getTime() - i.getTime()) / 6048e5))
1391
+ o = isDate(n) ? n : new Date(n)
1392
+ if (absoluteDays(t) === absoluteDays(o)) return r.today(o.getUTCHours(), o.getUTCMinutes(), o.getUTCHours() > 12)
1393
+ if (absoluteDays(t) - absoluteDays(o) === 1) return r.yesterday()
1394
+ const i = getDayInfoFromDate(o)
1395
+ return absoluteDays(t) - absoluteDays(o) < 7 ? r[i.day]() : r.weeks(Math.round((t.getTime() - o.getTime()) / 6048e5))
1396
1396
  }
1397
1397
  const DefaultTimeDeltaLabels = { now: () => 'A few seconds', seconds: n => `${n} seconds`, minutes: n => `${n} minutes`, hours: n => `${n} hours`, days: n => `${n} days`, weeks: n => `${n} weeks` }
1398
1398
  function getTimeDelta(n, e) {
1399
1399
  const t = e?.now ?? Date.now(),
1400
1400
  r = e?.labels || DefaultTimeDeltaLabels,
1401
- i = exports.Types.isDate(n) ? n.getTime() : n
1402
- let o = (t - i) / 1e3
1403
- return o < 10 ? r.now() : o < 120 ? r.seconds(Math.floor(o)) : ((o /= 60), o < 120 ? r.minutes(Math.floor(o)) : ((o /= 60), o < 48 ? r.hours(Math.floor(o)) : ((o /= 24), o < 14 ? r.days(Math.floor(o)) : ((o /= 7), r.weeks(Math.floor(o))))))
1401
+ o = exports.Types.isDate(n) ? n.getTime() : n
1402
+ let i = (t - o) / 1e3
1403
+ return i < 10 ? r.now() : i < 120 ? r.seconds(Math.floor(i)) : ((i /= 60), i < 120 ? r.minutes(Math.floor(i)) : ((i /= 60), i < 48 ? r.hours(Math.floor(i)) : ((i /= 24), i < 14 ? r.days(Math.floor(i)) : ((i /= 7), r.weeks(Math.floor(i))))))
1404
1404
  }
1405
1405
  function secondsToHumanTime(n, e = DefaultTimeDeltaLabels) {
1406
1406
  return getTimeDelta(0, { now: n * 1e3, labels: e })
1407
1407
  }
1408
1408
  function countCycles(n, e, t) {
1409
- const i = (t?.now ?? Date.now()) - n,
1410
- o = Math.floor(i / e),
1411
- u = e / (t?.precision ?? 1) - Math.ceil((i % e) / (t?.precision ?? 1))
1412
- return { cycles: o, remaining: u }
1409
+ const o = (t?.now ?? Date.now()) - n,
1410
+ i = Math.floor(o / e),
1411
+ u = e / (t?.precision ?? 1) - Math.ceil((o % e) / (t?.precision ?? 1))
1412
+ return { cycles: i, remaining: u }
1413
1413
  }
1414
1414
  const throttleTimers = {}
1415
1415
  function throttle(n, e) {
@@ -1421,12 +1421,12 @@ function timeSince(n, e, t) {
1421
1421
  }
1422
1422
  function getProgress(n, e, t, r) {
1423
1423
  r || (r = Date.now())
1424
- const i = e / t,
1425
- o = r - n,
1426
- u = o / e,
1424
+ const o = e / t,
1425
+ i = r - n,
1426
+ u = i / e,
1427
1427
  s = u * t,
1428
- c = s - o
1429
- return { deltaMs: o, progress: i, baseTimeMs: u, totalTimeMs: s, remainingTimeMs: c }
1428
+ c = s - i
1429
+ return { deltaMs: i, progress: o, baseTimeMs: u, totalTimeMs: s, remainingTimeMs: c }
1430
1430
  }
1431
1431
  const dayNumberIndex = { 0: 'sunday', 1: 'monday', 2: 'tuesday', 3: 'wednesday', 4: 'thursday', 5: 'friday', 6: 'saturday' }
1432
1432
  function mapDayNumber(n) {
@@ -1470,9 +1470,9 @@ function makeStorage(n, e = 1024) {
1470
1470
  .replace(/^-?[0-9.]+/, '')
1471
1471
  .trim()
1472
1472
  .toLowerCase(),
1473
- i = r === '' ? 0 : storageUnitExponents[r]
1474
- if (i == null) throw Error(`Unknown unit: "${r}"`)
1475
- return Math.ceil(t * e ** i)
1473
+ o = r === '' ? 0 : storageUnitExponents[r]
1474
+ if (o == null) throw Error(`Unknown unit: "${r}"`)
1475
+ return Math.ceil(t * e ** o)
1476
1476
  }
1477
1477
  function getPreLine(n) {
1478
1478
  return n.replace(/ +/g, ' ').replace(/^ /gm, '')
@@ -1480,11 +1480,11 @@ function getPreLine(n) {
1480
1480
  const tinyCache = new Map()
1481
1481
  async function getCached(n, e, t) {
1482
1482
  const r = Date.now(),
1483
- i = tinyCache.get(n)
1484
- if (i && i.validUntil > r) return i.value
1485
- const o = await t(),
1483
+ o = tinyCache.get(n)
1484
+ if (o && o.validUntil > r) return o.value
1485
+ const i = await t(),
1486
1486
  u = r + e
1487
- return tinyCache.set(n, { value: o, validUntil: u }), o
1487
+ return tinyCache.set(n, { value: i, validUntil: u }), i
1488
1488
  }
1489
1489
  function deleteFromCache(n) {
1490
1490
  tinyCache.delete(n)
@@ -1497,32 +1497,32 @@ function cacheSize() {
1497
1497
  return tinyCache.size
1498
1498
  }
1499
1499
  function joinUrl(n, e = !1) {
1500
- ;(n = n.filter(o => o)), e && isString(n[1]) && (n[1] = '../' + n[1])
1500
+ ;(n = n.filter(i => i)), e && isString(n[1]) && (n[1] = '../' + n[1])
1501
1501
  let t = ''
1502
1502
  isString(n[0]) && n[0].includes('://') && ((t = before(n[0], '://') ?? ''), (n[0] = after(n[0], '://') ?? ''))
1503
- const r = n.map(o => String(o)).flatMap(o => o.split('/')),
1504
- i = []
1505
- for (let o = 0; o < r.length; o++) r[o] !== '.' && (r[o] === '..' ? (!t || i.length > 1) && i.pop() : i.push(r[o]))
1506
- return (t ? t + '://' : '') + i.join('/').replaceAll(/\/{2,}/g, '/')
1503
+ const r = n.map(i => String(i)).flatMap(i => i.split('/')),
1504
+ o = []
1505
+ for (let i = 0; i < r.length; i++) r[i] !== '.' && (r[i] === '..' ? (!t || o.length > 1) && o.pop() : o.push(r[i]))
1506
+ return (t ? t + '://' : '') + o.join('/').replaceAll(/\/{2,}/g, '/')
1507
1507
  }
1508
- function replaceBetweenStrings(n, e, t, r, i = !0) {
1509
- const o = n.indexOf(e),
1510
- u = n.indexOf(t, o + e.length)
1511
- if (o === -1 || u === -1) throw Error('Start or end not found')
1512
- return i ? n.substring(0, o + e.length) + r + n.substring(u) : n.substring(0, o) + r + n.substring(u + t.length)
1508
+ function replaceBetweenStrings(n, e, t, r, o = !0) {
1509
+ const i = n.indexOf(e),
1510
+ u = n.indexOf(t, i + e.length)
1511
+ if (i === -1 || u === -1) throw Error('Start or end not found')
1512
+ return o ? n.substring(0, i + e.length) + r + n.substring(u) : n.substring(0, i) + r + n.substring(u + t.length)
1513
1513
  }
1514
1514
  function describeMarkdown(n) {
1515
1515
  let e = 'p'
1516
1516
  n.startsWith('#') ? ((e = 'h1'), (n = n.slice(1).trim())) : n.startsWith('-') && ((e = 'li'), (n = n.slice(1).trim()))
1517
1517
  const t = n[0] === n[0].toUpperCase(),
1518
1518
  r = /[.?!]$/.test(n),
1519
- i = /:$/.test(n)
1520
- return { type: e, isCapitalized: t, hasPunctuation: r, endsWithColon: i }
1519
+ o = /:$/.test(n)
1520
+ return { type: e, isCapitalized: t, hasPunctuation: r, endsWithColon: o }
1521
1521
  }
1522
1522
  function isBalanced(n, e = '(', t = ')') {
1523
1523
  let r = 0,
1524
- i = 0
1525
- for (; i < n.length; ) if ((n.startsWith(e, i) ? (r++, (i += e.length)) : n.startsWith(t, i) ? (r--, (i += t.length)) : i++, r < 0)) return !1
1524
+ o = 0
1525
+ for (; o < n.length; ) if ((n.startsWith(e, o) ? (r++, (o += e.length)) : n.startsWith(t, o) ? (r--, (o += t.length)) : o++, r < 0)) return !1
1526
1526
  return e === t ? r % 2 === 0 : r === 0
1527
1527
  }
1528
1528
  function textToFormat(n) {
@@ -1532,9 +1532,9 @@ function textToFormat(n) {
1532
1532
  return (n = n.replaceAll(/[A-Z][a-zA-Z0-9]*/g, 'A')), (n = n.replaceAll(/[a-z][a-zA-Z0-9]*/g, 'a')), (n = n.replaceAll(/[\u4E00-\u9FA5]+/g, 'Z')), n
1533
1533
  }
1534
1534
  function sortObject(n) {
1535
- const t = Object.keys(n).sort((i, o) => i.localeCompare(o)),
1535
+ const t = Object.keys(n).sort((o, i) => o.localeCompare(i)),
1536
1536
  r = {}
1537
- for (const i of t) r[i] = sortAny(n[i])
1537
+ for (const o of t) r[o] = sortAny(n[o])
1538
1538
  return r
1539
1539
  }
1540
1540
  function sortArray(n) {
@@ -1573,21 +1573,21 @@ function createStatefulToggle(n) {
1573
1573
  return (e = t), r
1574
1574
  }
1575
1575
  }
1576
- function organiseWithLimits(n, e, t, r, i) {
1577
- const o = {}
1578
- for (const u of Object.keys(e)) o[u] = []
1579
- ;(o[r] = []), i && (n = n.sort(i))
1576
+ function organiseWithLimits(n, e, t, r, o) {
1577
+ const i = {}
1578
+ for (const u of Object.keys(e)) i[u] = []
1579
+ ;(i[r] = []), o && (n = n.sort(o))
1580
1580
  for (const u of n) {
1581
1581
  const s = u[t],
1582
1582
  c = e[s] ? s : r
1583
- o[c].length >= e[c] ? o[r].push(u) : o[c].push(u)
1583
+ i[c].length >= e[c] ? i[r].push(u) : i[c].push(u)
1584
1584
  }
1585
- return o
1585
+ return i
1586
1586
  }
1587
1587
  function diffKeys(n, e) {
1588
1588
  const t = Object.keys(n),
1589
1589
  r = Object.keys(e)
1590
- return { uniqueToA: t.filter(i => !r.includes(i)), uniqueToB: r.filter(i => !t.includes(i)) }
1590
+ return { uniqueToA: t.filter(o => !r.includes(o)), uniqueToB: r.filter(o => !t.includes(o)) }
1591
1591
  }
1592
1592
  function pickRandomKey(n) {
1593
1593
  const e = Object.keys(n)
@@ -1611,7 +1611,7 @@ function fromObjectString(n) {
1611
1611
  (n = n.replace(/(,\s+)([a-zA-Z]\w+),/g, "$1$2: '$2',")),
1612
1612
  (n = n.replace(/:(.+)\?(.+):/g, (e, t, r) => `: (${t.trim()} && ${r.trim()}) ||`)),
1613
1613
  (n = n.replace(/([a-zA-Z0-9]+)( ?: ?{)/g, '"$1"$2')),
1614
- (n = n.replace(/([a-zA-Z0-9]+) ?: ?(.+?)(,|\n|})/g, (e, t, r, i) => `"${t}":"${r.trim()}"${i}`)),
1614
+ (n = n.replace(/([a-zA-Z0-9]+) ?: ?(.+?)(,|\n|})/g, (e, t, r, o) => `"${t}":"${r.trim()}"${o}`)),
1615
1615
  (n = n.replace(/("'|'")/g, '"')),
1616
1616
  (n = n.replaceAll('&comma;', ',')),
1617
1617
  JSON.parse(n)
@@ -1623,24 +1623,24 @@ const thresholds = [1e3, 1e6, 1e9, 1e12, 1e15, 1e18, 1e21, 1e24, 1e27, 1e30, 1e9
1623
1623
  function fromDecimals(n, e, t) {
1624
1624
  let r = n.length - e
1625
1625
  if (r <= 0) return '0.' + '0'.repeat(-r) + n + (t ? ' ' + t : '')
1626
- let i = n.substring(0, r),
1627
- o = n.substring(r)
1628
- return i === '' && (i = '0'), i + '.' + o + (t ? ' ' + t : '')
1626
+ let o = n.substring(0, r),
1627
+ i = n.substring(r)
1628
+ return o === '' && (o = '0'), o + '.' + i + (t ? ' ' + t : '')
1629
1629
  }
1630
1630
  function formatNumber(n, e) {
1631
1631
  const t = e?.longForm ?? !1,
1632
1632
  r = e?.unit ? ` ${e.unit}` : '',
1633
- i = t ? longNumberUnits : shortNumberUnits,
1634
- o = e?.precision ?? 1
1633
+ o = t ? longNumberUnits : shortNumberUnits,
1634
+ i = e?.precision ?? 1
1635
1635
  if (n < thresholds[0]) return `${n}${r}`
1636
- for (let u = 0; u < thresholds.length - 1; u++) if (n < thresholds[u + 1]) return `${(n / thresholds[u]).toFixed(o)}${t ? ' ' : ''}${i[u]}${r}`
1637
- return `${(n / thresholds[thresholds.length - 1]).toFixed(o)}${t ? ' ' : ''}${i[thresholds.length - 1]}${r}`
1636
+ for (let u = 0; u < thresholds.length - 1; u++) if (n < thresholds[u + 1]) return `${(n / thresholds[u]).toFixed(i)}${t ? ' ' : ''}${o[u]}${r}`
1637
+ return `${(n / thresholds[thresholds.length - 1]).toFixed(i)}${t ? ' ' : ''}${o[thresholds.length - 1]}${r}`
1638
1638
  }
1639
1639
  function makeNumber(n) {
1640
1640
  const e = parseFloat(n)
1641
1641
  if (isNaN(e)) throw Error('makeNumber got NaN for input')
1642
1642
  const t = n.replace(/^-?[0-9.]+/, '').trim(),
1643
- r = shortNumberUnits.findIndex(i => i.toLowerCase() === t.toLowerCase())
1643
+ r = shortNumberUnits.findIndex(o => o.toLowerCase() === t.toLowerCase())
1644
1644
  return r === -1 ? e : e * thresholds[r]
1645
1645
  }
1646
1646
  function clamp(n, e, t) {
@@ -1677,12 +1677,12 @@ function removeEmptyValues(n) {
1677
1677
  }
1678
1678
  function filterObjectKeys(n, e) {
1679
1679
  const t = {}
1680
- for (const [r, i] of Object.entries(n)) e(r) && (t[r] = i)
1680
+ for (const [r, o] of Object.entries(n)) e(r) && (t[r] = o)
1681
1681
  return t
1682
1682
  }
1683
1683
  function filterObjectValues(n, e) {
1684
1684
  const t = {}
1685
- for (const [r, i] of Object.entries(n)) e(i) && (t[r] = i)
1685
+ for (const [r, o] of Object.entries(n)) e(o) && (t[r] = o)
1686
1686
  return t
1687
1687
  }
1688
1688
  function mapObject(n, e) {
@@ -1693,7 +1693,7 @@ function mapObject(n, e) {
1693
1693
  function mapIterable(n, e) {
1694
1694
  const t = []
1695
1695
  let r = 0
1696
- for (const i of n) t.push(e(i, r++))
1696
+ for (const o of n) t.push(e(o, r++))
1697
1697
  return t
1698
1698
  }
1699
1699
  async function rethrow(n, e) {
@@ -1707,8 +1707,8 @@ function setSomeOnObject(n, e, t) {
1707
1707
  t != null && (n[e] = t)
1708
1708
  }
1709
1709
  function setSomeDeep(n, e, t, r) {
1710
- const i = getDeep(t, r)
1711
- i != null && setDeep(n, e, i)
1710
+ const o = getDeep(t, r)
1711
+ o != null && setDeep(n, e, o)
1712
1712
  }
1713
1713
  function flip(n) {
1714
1714
  const e = {}
@@ -1719,15 +1719,15 @@ function getAllPermutations(n) {
1719
1719
  const e = Object.keys(n),
1720
1720
  t = e.map(s => n[s].length),
1721
1721
  r = t.reduce((s, c) => (s *= c))
1722
- let i = 1
1723
- const o = [1]
1724
- for (let s = 0; s < t.length - 1; s++) (i *= t[s]), o.push(i)
1722
+ let o = 1
1723
+ const i = [1]
1724
+ for (let s = 0; s < t.length - 1; s++) (o *= t[s]), i.push(o)
1725
1725
  const u = []
1726
1726
  for (let s = 0; s < r; s++) {
1727
1727
  const c = {}
1728
1728
  for (let f = 0; f < e.length; f++) {
1729
1729
  const l = n[e[f]],
1730
- a = Math.floor(s / o[f]) % l.length
1730
+ a = Math.floor(s / i[f]) % l.length
1731
1731
  c[e[f]] = l[a]
1732
1732
  }
1733
1733
  u.push(c)
@@ -1740,11 +1740,11 @@ function countTruthyValues(n) {
1740
1740
  function getFlatNotation(n, e, t) {
1741
1741
  return n + (t ? '[' + e + ']' : (n.length ? '.' : '') + e)
1742
1742
  }
1743
- function flattenInner(n, e, t, r, i) {
1743
+ function flattenInner(n, e, t, r, o) {
1744
1744
  if (!isObject(e)) return e
1745
- for (const [o, u] of Object.entries(e)) {
1746
- const s = getFlatNotation(t, o, r)
1747
- Array.isArray(u) ? (i ? flattenInner(n, u, s, !0, i) : (n[s] = u.map(c => flattenInner(Array.isArray(c) ? [] : {}, c, '', !1, i)))) : isObject(u) ? flattenInner(n, u, s, !1, i) : (n[s] = u)
1745
+ for (const [i, u] of Object.entries(e)) {
1746
+ const s = getFlatNotation(t, i, r)
1747
+ Array.isArray(u) ? (o ? flattenInner(n, u, s, !0, o) : (n[s] = u.map(c => flattenInner(Array.isArray(c) ? [] : {}, c, '', !1, o)))) : isObject(u) ? flattenInner(n, u, s, !1, o) : (n[s] = u)
1748
1748
  }
1749
1749
  return n
1750
1750
  }
@@ -1759,7 +1759,7 @@ function unflatten(n) {
1759
1759
  ? setDeep(
1760
1760
  e,
1761
1761
  t,
1762
- r.map(i => unflatten(i))
1762
+ r.map(o => unflatten(o))
1763
1763
  )
1764
1764
  : setDeep(e, t, r)
1765
1765
  return e
@@ -1770,16 +1770,16 @@ function match(n, e, t) {
1770
1770
  function indexArray(n, e) {
1771
1771
  const t = {}
1772
1772
  for (const r of n) {
1773
- const i = e(r)
1774
- t[i] = r
1773
+ const o = e(r)
1774
+ t[o] = r
1775
1775
  }
1776
1776
  return t
1777
1777
  }
1778
1778
  function indexArrayToCollection(n, e) {
1779
1779
  const t = {}
1780
1780
  for (const r of n) {
1781
- const i = e(r)
1782
- t[i] || (t[i] = []), t[i].push(r)
1781
+ const o = e(r)
1782
+ t[o] || (t[o] = []), t[o].push(r)
1783
1783
  }
1784
1784
  return t
1785
1785
  }
@@ -1791,13 +1791,13 @@ function splitBySize(n, e) {
1791
1791
  function splitByCount(n, e) {
1792
1792
  const t = Math.ceil(n.length / e),
1793
1793
  r = []
1794
- for (let i = 0; i < n.length; i += t) r.push(n.slice(i, i + t))
1794
+ for (let o = 0; o < n.length; o += t) r.push(n.slice(o, o + t))
1795
1795
  return r
1796
1796
  }
1797
1797
  function tokenizeByLength(n, e) {
1798
1798
  const t = [],
1799
1799
  r = Math.ceil(n.length / e)
1800
- for (let i = 0; i < r; i++) t.push(n.slice(i * e, i * e + e))
1800
+ for (let o = 0; o < r; o++) t.push(n.slice(o * e, o * e + e))
1801
1801
  return t
1802
1802
  }
1803
1803
  function tokenizeByCount(n, e) {
@@ -1807,11 +1807,11 @@ function tokenizeByCount(n, e) {
1807
1807
  function makeUnique(n, e) {
1808
1808
  return Object.values(indexArray(n, e))
1809
1809
  }
1810
- function countUnique(n, e, t, r, i) {
1811
- const o = e ? n.map(e) : n,
1810
+ function countUnique(n, e, t, r, o) {
1811
+ const i = e ? n.map(e) : n,
1812
1812
  u = {}
1813
- for (const c of o) u[c] = (u[c] || 0) + 1
1814
- const s = r ? sortObjectValues(u, i ? (c, f) => c[1] - f[1] : (c, f) => f[1] - c[1]) : u
1813
+ for (const c of i) u[c] = (u[c] || 0) + 1
1814
+ const s = r ? sortObjectValues(u, o ? (c, f) => c[1] - f[1] : (c, f) => f[1] - c[1]) : u
1815
1815
  return t ? Object.keys(s) : s
1816
1816
  }
1817
1817
  function sortObjectValues(n, e) {
@@ -1821,10 +1821,10 @@ function transformToArray(n) {
1821
1821
  const e = [],
1822
1822
  t = Object.keys(n),
1823
1823
  r = n[t[0]].length
1824
- for (let i = 0; i < r; i++) {
1825
- const o = {}
1826
- for (const u of t) o[u] = n[u][i]
1827
- e.push(o)
1824
+ for (let o = 0; o < r; o++) {
1825
+ const i = {}
1826
+ for (const u of t) i[u] = n[u][o]
1827
+ e.push(i)
1828
1828
  }
1829
1829
  return e
1830
1830
  }
@@ -1838,8 +1838,8 @@ function group(n, e) {
1838
1838
  const t = []
1839
1839
  let r = []
1840
1840
  return (
1841
- n.forEach((i, o) => {
1842
- ;(o === 0 || !e(i, n[o - 1])) && ((r = []), t.push(r)), r.push(i)
1841
+ n.forEach((o, i) => {
1842
+ ;(i === 0 || !e(o, n[i - 1])) && ((r = []), t.push(r)), r.push(o)
1843
1843
  }),
1844
1844
  t
1845
1845
  )
@@ -1852,26 +1852,26 @@ function createTemporalBidirectionalMap() {
1852
1852
  }
1853
1853
  function pushToBidirectionalMap(n, e, t, r = 100) {
1854
1854
  if (n.map.has(e)) {
1855
- const i = n.keys.indexOf(e)
1856
- n.keys.splice(i, 1)
1855
+ const o = n.keys.indexOf(e)
1856
+ n.keys.splice(o, 1)
1857
1857
  }
1858
1858
  if ((n.map.set(e, t), n.keys.push(e), n.keys.length > r)) {
1859
- const i = n.keys.shift()
1860
- i && n.map.delete(i)
1859
+ const o = n.keys.shift()
1860
+ o && n.map.delete(o)
1861
1861
  }
1862
1862
  }
1863
1863
  function unshiftToBidirectionalMap(n, e, t, r = 100) {
1864
1864
  if (n.map.has(e)) {
1865
- const i = n.keys.indexOf(e)
1866
- n.keys.splice(i, 1)
1865
+ const o = n.keys.indexOf(e)
1866
+ n.keys.splice(o, 1)
1867
1867
  }
1868
1868
  if ((n.map.set(e, t), n.keys.unshift(e), n.keys.length > r)) {
1869
- const i = n.keys.shift()
1870
- i && n.map.delete(i)
1869
+ const o = n.keys.shift()
1870
+ o && n.map.delete(o)
1871
1871
  }
1872
1872
  }
1873
- function addToTemporalBidirectionalMap(n, e, t, r, i = 100) {
1874
- pushToBidirectionalMap(n, e, { validUntil: Date.now() + r, data: t }, i)
1873
+ function addToTemporalBidirectionalMap(n, e, t, r, o = 100) {
1874
+ pushToBidirectionalMap(n, e, { validUntil: Date.now() + r, data: t }, o)
1875
1875
  }
1876
1876
  function getFromTemporalBidirectionalMap(n, e) {
1877
1877
  const t = n.map.get(e)
@@ -1951,7 +1951,7 @@ function filterInstances(n, e) {
1951
1951
  function interleave(n, e) {
1952
1952
  const t = [],
1953
1953
  r = Math.max(n.length, e.length)
1954
- for (let i = 0; i < r; i++) n[i] && t.push(n[i]), e[i] && t.push(e[i])
1954
+ for (let o = 0; o < r; o++) n[o] && t.push(n[o]), e[o] && t.push(e[o])
1955
1955
  return t
1956
1956
  }
1957
1957
  function toggle(n, e) {
@@ -1962,19 +1962,19 @@ class Node {
1962
1962
  ;(this.value = e), (this.children = [])
1963
1963
  }
1964
1964
  }
1965
- function createHierarchy(n, e, t, r, i = !1) {
1966
- const o = new Map(),
1965
+ function createHierarchy(n, e, t, r, o = !1) {
1966
+ const i = new Map(),
1967
1967
  u = []
1968
1968
  n.forEach(c => {
1969
1969
  const f = new Node(c)
1970
- o.set(c[e], f)
1970
+ i.set(c[e], f)
1971
1971
  }),
1972
1972
  n.forEach(c => {
1973
- const f = o.get(c[e])
1973
+ const f = i.get(c[e])
1974
1974
  if (!f) return
1975
1975
  const l = c[t]
1976
1976
  if (l) {
1977
- const a = o.get(l)
1977
+ const a = i.get(l)
1978
1978
  a && a.children.push(f)
1979
1979
  } else u.push(f)
1980
1980
  })
@@ -1982,7 +1982,7 @@ function createHierarchy(n, e, t, r, i = !1) {
1982
1982
  c.children.sort((f, l) => {
1983
1983
  const a = f.value[r],
1984
1984
  h = l.value[r]
1985
- return i ? h - a : a - h
1985
+ return o ? h - a : a - h
1986
1986
  }),
1987
1987
  c.children.forEach(s)
1988
1988
  }
@@ -1993,21 +1993,21 @@ function log2Reduce(n, e) {
1993
1993
  let t = [...n]
1994
1994
  for (; t.length > 1; ) {
1995
1995
  const r = []
1996
- for (let i = 0; i < t.length; i += 2) {
1997
- const o = t[i + 1]
1998
- r.push(e(t[i], o))
1996
+ for (let o = 0; o < t.length; o += 2) {
1997
+ const i = t[o + 1]
1998
+ r.push(e(t[o], i))
1999
1999
  }
2000
2000
  t = r
2001
2001
  }
2002
2002
  return t[0]
2003
2003
  }
2004
2004
  function concatBytes(...n) {
2005
- const e = n.reduce((i, o) => i + o.length, 0),
2005
+ const e = n.reduce((o, i) => o + i.length, 0),
2006
2006
  t = new Uint8Array(e)
2007
2007
  let r = 0
2008
2008
  return (
2009
- n.forEach(i => {
2010
- t.set(i, r), (r += i.length)
2009
+ n.forEach(o => {
2010
+ t.set(o, r), (r += o.length)
2011
2011
  }),
2012
2012
  t
2013
2013
  )
@@ -2053,27 +2053,27 @@ function uint64ToNumber(n, e) {
2053
2053
  }
2054
2054
  function numberToUint256(n, e) {
2055
2055
  const r = new Uint8Array(32)
2056
- let i = n
2056
+ let o = n
2057
2057
  if (e === 'LE') {
2058
- for (let o = 0; o < 32; o++) (r[o] = Number(i & 0xffn)), (i >>= 8n)
2058
+ for (let i = 0; i < 32; i++) (r[i] = Number(o & 0xffn)), (o >>= 8n)
2059
2059
  return r
2060
2060
  }
2061
- for (let o = 31; o >= 0; o--) (r[o] = Number(i & 0xffn)), (i >>= 8n)
2061
+ for (let i = 31; i >= 0; i--) (r[i] = Number(o & 0xffn)), (o >>= 8n)
2062
2062
  return r
2063
2063
  }
2064
2064
  function uint256ToNumber(n, e) {
2065
2065
  let r = 0n
2066
2066
  if (e === 'LE') {
2067
- for (let i = 31; i >= 0; i--) r = (r << 8n) | BigInt(n[i])
2067
+ for (let o = 31; o >= 0; o--) r = (r << 8n) | BigInt(n[o])
2068
2068
  return r
2069
2069
  }
2070
- for (let i = 0; i < 32; i++) r = (r << 8n) | BigInt(n[i])
2070
+ for (let o = 0; o < 32; o++) r = (r << 8n) | BigInt(n[o])
2071
2071
  return r
2072
2072
  }
2073
2073
  function sliceBytes(n, e) {
2074
2074
  const t = []
2075
2075
  let r = 0
2076
- for (const i of e) t.push(n.subarray(r, r + i)), (r += i)
2076
+ for (const o of e) t.push(n.subarray(r, r + o)), (r += o)
2077
2077
  return t
2078
2078
  }
2079
2079
  function partition(n, e) {
@@ -2086,16 +2086,16 @@ function keccakPermutate(n) {
2086
2086
  for (let e = 0; e < 24; e++) {
2087
2087
  const t = n[0] ^ n[10] ^ n[20] ^ n[30] ^ n[40],
2088
2088
  r = n[1] ^ n[11] ^ n[21] ^ n[31] ^ n[41],
2089
- i = n[2] ^ n[12] ^ n[22] ^ n[32] ^ n[42],
2090
- o = n[3] ^ n[13] ^ n[23] ^ n[33] ^ n[43],
2089
+ o = n[2] ^ n[12] ^ n[22] ^ n[32] ^ n[42],
2090
+ i = n[3] ^ n[13] ^ n[23] ^ n[33] ^ n[43],
2091
2091
  u = n[4] ^ n[14] ^ n[24] ^ n[34] ^ n[44],
2092
2092
  s = n[5] ^ n[15] ^ n[25] ^ n[35] ^ n[45],
2093
2093
  c = n[6] ^ n[16] ^ n[26] ^ n[36] ^ n[46],
2094
2094
  f = n[7] ^ n[17] ^ n[27] ^ n[37] ^ n[47],
2095
2095
  l = n[8] ^ n[18] ^ n[28] ^ n[38] ^ n[48],
2096
2096
  a = n[9] ^ n[19] ^ n[29] ^ n[39] ^ n[49],
2097
- h = (i << 1) | (o >>> 31),
2098
- bn = (o << 1) | (i >>> 31),
2097
+ h = (o << 1) | (i >>> 31),
2098
+ bn = (i << 1) | (o >>> 31),
2099
2099
  d = l ^ h,
2100
2100
  p = a ^ bn,
2101
2101
  $n = (u << 1) | (s >>> 31),
@@ -2104,8 +2104,8 @@ function keccakPermutate(n) {
2104
2104
  g = r ^ En,
2105
2105
  An = (c << 1) | (f >>> 31),
2106
2106
  Mn = (f << 1) | (c >>> 31),
2107
- w = i ^ An,
2108
- x = o ^ Mn,
2107
+ w = o ^ An,
2108
+ x = i ^ Mn,
2109
2109
  kn = (l << 1) | (a >>> 31),
2110
2110
  Sn = (a << 1) | (l >>> 31),
2111
2111
  y = u ^ kn,
@@ -2175,18 +2175,18 @@ function bytesToNumbers(n) {
2175
2175
  }
2176
2176
  function divideToBlocks(n, e) {
2177
2177
  if (!n.length) {
2178
- const i = new Uint8Array(136)
2179
- return (i[0] = e), (i[135] = 128), [bytesToNumbers(i)]
2178
+ const o = new Uint8Array(136)
2179
+ return (o[0] = e), (o[135] = 128), [bytesToNumbers(o)]
2180
2180
  }
2181
2181
  const t = partition(n, 136),
2182
2182
  r = t[t.length - 1]
2183
2183
  if (r.length < 136) {
2184
- const i = new Uint8Array(136)
2185
- i.set(r), (i[r.length] = e), (i[135] |= 128), (t[t.length - 1] = i)
2184
+ const o = new Uint8Array(136)
2185
+ o.set(r), (o[r.length] = e), (o[135] |= 128), (t[t.length - 1] = o)
2186
2186
  }
2187
2187
  if (r.length === 136) {
2188
- const i = new Uint8Array(136)
2189
- ;(i[0] = e), (i[135] = 128), t.push(i)
2188
+ const o = new Uint8Array(136)
2189
+ ;(o[0] = e), (o[135] = 128), t.push(o)
2190
2190
  }
2191
2191
  return t.map(bytesToNumbers)
2192
2192
  }
@@ -2209,8 +2209,8 @@ function sha3_256(n) {
2209
2209
  function proximity(n, e) {
2210
2210
  const t = Math.min(n.length, e.length)
2211
2211
  for (let r = 0; r < t; r++) {
2212
- const i = n[r] ^ e[r]
2213
- for (let o = 0; o < 8; o++) if ((i >> (7 - o)) & 1) return r * 8 + o
2212
+ const o = n[r] ^ e[r]
2213
+ for (let i = 0; i < 8; i++) if ((o >> (7 - i)) & 1) return r * 8 + i
2214
2214
  }
2215
2215
  return Math.min(n.length, e.length) * 8
2216
2216
  }
@@ -2220,17 +2220,17 @@ function commonPrefix(n, e) {
2220
2220
  return n.subarray(0, t)
2221
2221
  }
2222
2222
  function setBit(n, e, t, r) {
2223
- const i = Math.floor(e / 8),
2224
- o = e % 8
2225
- t === 1 ? (n[i] |= 1 << (r === 'BE' ? 7 - o : o)) : (n[i] &= ~(1 << (r === 'BE' ? 7 - o : o)))
2223
+ const o = Math.floor(e / 8),
2224
+ i = e % 8
2225
+ t === 1 ? (n[o] |= 1 << (r === 'BE' ? 7 - i : i)) : (n[o] &= ~(1 << (r === 'BE' ? 7 - i : i)))
2226
2226
  }
2227
2227
  function getBit(n, e, t) {
2228
2228
  const r = Math.floor(e / 8),
2229
- i = e % 8
2230
- return (n[r] >> (t === 'BE' ? 7 - i : i)) & 1
2229
+ o = e % 8
2230
+ return (n[r] >> (t === 'BE' ? 7 - o : o)) & 1
2231
2231
  }
2232
2232
  function binaryIndexOf(n, e, t = 0) {
2233
- for (let r = t; r < n.length; r++) for (let i = 0; i < e.length && n[r + i] === e[i]; i++) if (i === e.length - 1) return r
2233
+ for (let r = t; r < n.length; r++) for (let o = 0; o < e.length && n[r + o] === e[o]; o++) if (o === e.length - 1) return r
2234
2234
  return -1
2235
2235
  }
2236
2236
  function binaryPadStart(n, e, t = 0) {
@@ -2284,12 +2284,12 @@ function mod(n, e) {
2284
2284
  function modInverse(n, e) {
2285
2285
  n = mod(n, e)
2286
2286
  let [t, r] = [0n, 1n],
2287
- [i, o] = [e, n]
2288
- for (; o !== 0n; ) {
2289
- const u = i / o
2290
- ;([t, r] = [r, t - u * r]), ([i, o] = [o, i - u * o])
2287
+ [o, i] = [e, n]
2288
+ for (; i !== 0n; ) {
2289
+ const u = o / i
2290
+ ;([t, r] = [r, t - u * r]), ([o, i] = [i, o - u * i])
2291
2291
  }
2292
- if (i > 1n) throw new Error('a is not invertible')
2292
+ if (o > 1n) throw new Error('a is not invertible')
2293
2293
  return t < 0n && (t += e), t
2294
2294
  }
2295
2295
  function modPow(n, e, t) {
@@ -2307,18 +2307,18 @@ const SECP256K1_P = 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffeff
2307
2307
  function ellipticDouble(n, e, t) {
2308
2308
  if (e === 0n) return [0n, 0n]
2309
2309
  const r = mod(3n * n * n * modInverse(2n * e, t), t),
2310
- i = mod(r * r - 2n * n, t),
2311
- o = mod(r * (n - i) - e, t)
2312
- return [i, o]
2310
+ o = mod(r * r - 2n * n, t),
2311
+ i = mod(r * (n - o) - e, t)
2312
+ return [o, i]
2313
2313
  }
2314
- function ellipticAdd(n, e, t, r, i) {
2314
+ function ellipticAdd(n, e, t, r, o) {
2315
2315
  if (n === 0n && e === 0n) return [t, r]
2316
2316
  if (t === 0n && r === 0n) return [n, e]
2317
- if (n === t && e === mod(-r, i)) return [0n, 0n]
2318
- if (n === t && e === r) return ellipticDouble(n, e, i)
2319
- const o = mod((r - e) * modInverse(t - n, i), i),
2320
- u = mod(o * o - n - t, i),
2321
- s = mod(o * (n - u) - e, i)
2317
+ if (n === t && e === mod(-r, o)) return [0n, 0n]
2318
+ if (n === t && e === r) return ellipticDouble(n, e, o)
2319
+ const i = mod((r - e) * modInverse(t - n, o), o),
2320
+ u = mod(i * i - n - t, o),
2321
+ s = mod(i * (n - u) - e, o)
2322
2322
  return [u, s]
2323
2323
  }
2324
2324
  function privateKeyToPublicKey(n) {
@@ -2335,8 +2335,8 @@ function publicKeyFromCompressed(n) {
2335
2335
  t = modSqrt(mod(e ** 3n + 7n, SECP256K1_P), SECP256K1_P)
2336
2336
  if (!t) throw Error('Invalid x: does not correspond to a valid curve point')
2337
2337
  const r = mod(-t, SECP256K1_P),
2338
- i = t % 2n === 0n
2339
- return [e, n[0] === 2 ? (i ? t : r) : i ? r : t]
2338
+ o = t % 2n === 0n
2339
+ return [e, n[0] === 2 ? (o ? t : r) : o ? r : t]
2340
2340
  }
2341
2341
  function publicKeyToAddress(n) {
2342
2342
  const e = new Uint8Array(20),
@@ -2345,17 +2345,17 @@ function publicKeyToAddress(n) {
2345
2345
  }
2346
2346
  function checksumEncode(n) {
2347
2347
  const e = exports.Binary.uint8ArrayToHex(n),
2348
- t = exports.Binary.uint8ArrayToHex(exports.Binary.keccak256(new Uint8Array([...e].map(i => i.charCodeAt(0)))))
2348
+ t = exports.Binary.uint8ArrayToHex(exports.Binary.keccak256(new Uint8Array([...e].map(o => o.charCodeAt(0)))))
2349
2349
  let r = '0x'
2350
- for (let i = 0; i < e.length; i++) parseInt(t[i], 16) > 7 ? (r += e[i].toUpperCase()) : (r += e[i])
2350
+ for (let o = 0; o < e.length; o++) parseInt(t[o], 16) > 7 ? (r += e[o].toUpperCase()) : (r += e[o])
2351
2351
  return r
2352
2352
  }
2353
2353
  function doubleAndAdd(n, e, t, r) {
2354
- let i = [0n, 0n],
2355
- o = [n, e]
2354
+ let o = [0n, 0n],
2355
+ i = [n, e]
2356
2356
  const u = t.toString(2)
2357
- for (const s of u) s === '0' ? ((o = ellipticAdd(i[0], i[1], o[0], o[1], r)), (i = ellipticDouble(i[0], i[1], r))) : ((i = ellipticAdd(i[0], i[1], o[0], o[1], r)), (o = ellipticDouble(o[0], o[1], r)))
2358
- return i
2357
+ for (const s of u) s === '0' ? ((i = ellipticAdd(o[0], o[1], i[0], i[1], r)), (o = ellipticDouble(o[0], o[1], r))) : ((o = ellipticAdd(o[0], o[1], i[0], i[1], r)), (i = ellipticDouble(i[0], i[1], r)))
2358
+ return o
2359
2359
  }
2360
2360
  function signMessage(n, e, t) {
2361
2361
  return signHash(uint256ToNumber(keccak256(n), 'BE'), e, t)
@@ -2364,18 +2364,18 @@ function signHash(n, e, t) {
2364
2364
  if (e <= 0n || e >= SECP256K1_N) throw new Error('Invalid private key')
2365
2365
  if ((t || (t = mod(uint256ToNumber(keccak256(concatBytes(keccak256(numberToUint256(e, 'BE')), numberToUint256(n, 'BE'))), 'BE'), SECP256K1_N)), t <= 0n || t >= SECP256K1_N)) throw new Error('Invalid nonce')
2366
2366
  const r = mod(n, SECP256K1_N),
2367
- i = doubleAndAdd(SECP256K1_X, SECP256K1_Y, t, SECP256K1_P),
2368
- o = mod(i[0], SECP256K1_N)
2369
- let u = mod((r + mod(o, SECP256K1_N) * e) * modInverse(t, SECP256K1_N), SECP256K1_N)
2370
- if (o === 0n || u === 0n) throw new Error('Invalid r or s value')
2371
- let s = i[1] % 2n === 0n ? 27n : 28n
2372
- return u > SECP256K1_N / 2n && ((u = SECP256K1_N - u), (s = s === 27n ? 28n : 27n)), [o, u, s]
2367
+ o = doubleAndAdd(SECP256K1_X, SECP256K1_Y, t, SECP256K1_P),
2368
+ i = mod(o[0], SECP256K1_N)
2369
+ let u = mod((r + mod(i, SECP256K1_N) * e) * modInverse(t, SECP256K1_N), SECP256K1_N)
2370
+ if (i === 0n || u === 0n) throw new Error('Invalid r or s value')
2371
+ let s = o[1] % 2n === 0n ? 27n : 28n
2372
+ return u > SECP256K1_N / 2n && ((u = SECP256K1_N - u), (s = s === 27n ? 28n : 27n)), [i, u, s]
2373
2373
  }
2374
2374
  function recoverPublicKey(n, e, t, r) {
2375
- const i = modSqrt(mod(e ** 3n + 7n, SECP256K1_P), SECP256K1_P)
2376
- if (!i) throw new Error('Invalid r: does not correspond to a valid curve point')
2377
- const o = r === 27n ? 0n : 1n,
2378
- u = i % 2n === o ? i : SECP256K1_P - i,
2375
+ const o = modSqrt(mod(e ** 3n + 7n, SECP256K1_P), SECP256K1_P)
2376
+ if (!o) throw new Error('Invalid r: does not correspond to a valid curve point')
2377
+ const i = r === 27n ? 0n : 1n,
2378
+ u = o % 2n === i ? o : SECP256K1_P - o,
2379
2379
  s = mod(uint256ToNumber(keccak256(n), 'BE'), SECP256K1_N),
2380
2380
  c = doubleAndAdd(e, u, t, SECP256K1_P),
2381
2381
  f = doubleAndAdd(SECP256K1_X, SECP256K1_Y, s, SECP256K1_P),
@@ -2383,10 +2383,10 @@ function recoverPublicKey(n, e, t, r) {
2383
2383
  return doubleAndAdd(l[0], l[1], modInverse(e, SECP256K1_N), SECP256K1_P)
2384
2384
  }
2385
2385
  function verifySignature(n, e, t, r) {
2386
- const i = mod(uint256ToNumber(keccak256(n), 'BE'), SECP256K1_N),
2387
- o = modInverse(r, SECP256K1_N),
2388
- u = mod(i * o, SECP256K1_N),
2389
- s = mod(t * o, SECP256K1_N),
2386
+ const o = mod(uint256ToNumber(keccak256(n), 'BE'), SECP256K1_N),
2387
+ i = modInverse(r, SECP256K1_N),
2388
+ u = mod(o * i, SECP256K1_N),
2389
+ s = mod(t * i, SECP256K1_N),
2390
2390
  c = doubleAndAdd(SECP256K1_X, SECP256K1_Y, u, SECP256K1_P),
2391
2391
  f = doubleAndAdd(e[0], e[1], s, SECP256K1_P),
2392
2392
  l = ellipticAdd(c[0], c[1], f[0], f[1], SECP256K1_P)
@@ -2440,11 +2440,11 @@ class MerkleTree {
2440
2440
  return await r.append(e), r.finalize()
2441
2441
  }
2442
2442
  async append(e, t = 0, r = 0n) {
2443
- const i = new Uint8ArrayReader(e)
2444
- for (; i.max() > 0; ) {
2443
+ const o = new Uint8ArrayReader(e)
2444
+ for (; o.max() > 0; ) {
2445
2445
  this.chunks[t].writer.max() === 0 && (await this.elevate(t))
2446
- const o = this.chunks[t].writer.write(i)
2447
- r ? (this.chunks[t].span += r) : (this.chunks[0].span += BigInt(o))
2446
+ const i = this.chunks[t].writer.write(o)
2447
+ r ? (this.chunks[t].span += r) : (this.chunks[0].span += BigInt(i))
2448
2448
  }
2449
2449
  }
2450
2450
  async elevate(e) {
@@ -2469,8 +2469,11 @@ class FixedPointNumber {
2469
2469
  }
2470
2470
  static fromDecimalString(e, t) {
2471
2471
  ;/e\-\d+$/i.test(e) && (e = parseFloat(e).toFixed(t))
2472
- let [r, i] = e.split('.')
2473
- return (i = (i || '').padEnd(t, '0').slice(0, t)), new FixedPointNumber(BigInt(r + i), t)
2472
+ let [r, o] = e.split('.')
2473
+ return (o = (o || '').padEnd(t, '0').slice(0, t)), new FixedPointNumber(BigInt(r + o), t)
2474
+ }
2475
+ static fromFloat(e, t) {
2476
+ return FixedPointNumber.fromDecimalString(e.toString(), t)
2474
2477
  }
2475
2478
  add(e) {
2476
2479
  return this.assertSameScale(e), new FixedPointNumber(this.value + e.value, this.scale)
@@ -2489,12 +2492,12 @@ class FixedPointNumber {
2489
2492
  }
2490
2493
  exchange(e, t, r) {
2491
2494
  if (e === '*') {
2492
- const o = (this.value * t.value) / 10n ** BigInt(this.scale)
2493
- return new FixedPointNumber(o, r)
2495
+ const i = (this.value * t.value) / 10n ** BigInt(this.scale)
2496
+ return new FixedPointNumber(i, r)
2494
2497
  }
2495
2498
  this.assertSameScale(t)
2496
- const i = (this.value * 10n ** BigInt(r)) / t.value
2497
- return new FixedPointNumber(i, r)
2499
+ const o = (this.value * 10n ** BigInt(r)) / t.value
2500
+ return new FixedPointNumber(o, r)
2498
2501
  }
2499
2502
  compare(e) {
2500
2503
  return this.assertSameScale(e), this.value > e.value ? 1 : this.value < e.value ? -1 : 0
@@ -2512,6 +2515,9 @@ class FixedPointNumber {
2512
2515
  toJSON() {
2513
2516
  return this.toString()
2514
2517
  }
2518
+ toFloat() {
2519
+ return parseFloat(this.toDecimalString())
2520
+ }
2515
2521
  assertSameScale(e) {
2516
2522
  if (this.scale !== e.scale) throw new Error(`Scale mismatch: expected ${this.scale}, but got ${e.scale}`)
2517
2523
  }
@@ -2523,44 +2529,44 @@ function tickPlaybook(n) {
2523
2529
  return e.ttlMax ? --e.ttl <= 0 && n.shift() : (e.ttlMax = e.ttl), { progress: (e.ttlMax - e.ttl) / e.ttlMax, data: e.data }
2524
2530
  }
2525
2531
  function getArgument(n, e, t, r) {
2526
- const i = n.findIndex(s => s === `--${e}` || s.startsWith(`--${e}=`)),
2527
- o = n[i]
2528
- if (!o) return (t || {})[r || e || ''] || null
2529
- if (o.includes('=')) return o.split('=')[1]
2530
- const u = n[i + 1]
2532
+ const o = n.findIndex(s => s === `--${e}` || s.startsWith(`--${e}=`)),
2533
+ i = n[o]
2534
+ if (!i) return (t || {})[r || e || ''] || null
2535
+ if (i.includes('=')) return i.split('=')[1]
2536
+ const u = n[o + 1]
2531
2537
  return u && !u.startsWith('-') ? u : (t || {})[r || e || ''] || null
2532
2538
  }
2533
2539
  function getNumberArgument(n, e, t, r) {
2534
- const i = getArgument(n, e, t, r)
2535
- if (!i) return null
2540
+ const o = getArgument(n, e, t, r)
2541
+ if (!o) return null
2536
2542
  try {
2537
- return makeNumber(i)
2543
+ return makeNumber(o)
2538
2544
  } catch {
2539
- throw new Error(`Invalid number argument ${e}: ${i}`)
2545
+ throw new Error(`Invalid number argument ${e}: ${o}`)
2540
2546
  }
2541
2547
  }
2542
2548
  function getBooleanArgument(n, e, t, r) {
2543
- const i = n.some(c => c.endsWith('-' + e)),
2544
- o = getArgument(n, e, t, r)
2545
- if (!o && i) return !0
2546
- if (!o && !i) return null
2549
+ const o = n.some(c => c.endsWith('-' + e)),
2550
+ i = getArgument(n, e, t, r)
2551
+ if (!i && o) return !0
2552
+ if (!i && !o) return null
2547
2553
  const u = ['true', '1', 'yes', 'y', 'on'],
2548
2554
  s = ['false', '0', 'no', 'n', 'off']
2549
- if (u.includes(o.toLowerCase())) return !0
2550
- if (s.includes(o.toLowerCase())) return !1
2551
- throw Error(`Invalid boolean argument ${e}: ${o}`)
2555
+ if (u.includes(i.toLowerCase())) return !0
2556
+ if (s.includes(i.toLowerCase())) return !1
2557
+ throw Error(`Invalid boolean argument ${e}: ${i}`)
2552
2558
  }
2553
2559
  function requireStringArgument(n, e, t, r) {
2554
- const i = getArgument(n, e, t, r)
2555
- if (!i) throw new Error(`Missing argument ${e}`)
2556
- return i
2560
+ const o = getArgument(n, e, t, r)
2561
+ if (!o) throw new Error(`Missing argument ${e}`)
2562
+ return o
2557
2563
  }
2558
2564
  function requireNumberArgument(n, e, t, r) {
2559
- const i = requireStringArgument(n, e, t, r)
2565
+ const o = requireStringArgument(n, e, t, r)
2560
2566
  try {
2561
- return makeNumber(i)
2567
+ return makeNumber(o)
2562
2568
  } catch {
2563
- throw new Error(`Invalid argument ${e}: ${i}`)
2569
+ throw new Error(`Invalid argument ${e}: ${o}`)
2564
2570
  }
2565
2571
  }
2566
2572
  function bringToFrontInPlace(n, e) {
@@ -2592,8 +2598,8 @@ function getDistanceBetweenPoints(n, e) {
2592
2598
  }
2593
2599
  function filterCoordinates(n, e, t = 'row-first') {
2594
2600
  const r = []
2595
- if (t === 'column-first') for (let i = 0; i < n.length; i++) for (let o = 0; o < n[0].length; o++) e(i, o) && r.push({ x: i, y: o })
2596
- else for (let i = 0; i < n[0].length; i++) for (let o = 0; o < n.length; o++) e(o, i) && r.push({ x: o, y: i })
2601
+ if (t === 'column-first') for (let o = 0; o < n.length; o++) for (let i = 0; i < n[0].length; i++) e(o, i) && r.push({ x: o, y: i })
2602
+ else for (let o = 0; o < n[0].length; o++) for (let i = 0; i < n.length; i++) e(i, o) && r.push({ x: i, y: o })
2597
2603
  return r
2598
2604
  }
2599
2605
  function isHorizontalLine(n, e, t) {
@@ -2619,26 +2625,26 @@ function getCorners(n, e, t) {
2619
2625
  return n[e][t] ? (isHorizontalLine(n, e, t) || isVerticalLine(n, e, t) ? [] : (!n[e - 1]?.[t - 1] && isLeftmost(n, e, t) && isTopmost(n, e, t) && r.push({ x: e, y: t }), !n[e + 1]?.[t - 1] && isRightmost(n, e, t) && isTopmost(n, e, t) && r.push({ x: e + 1, y: t }), !n[e - 1]?.[t + 1] && isLeftmost(n, e, t) && isBottommost(n, e, t) && r.push({ x: e, y: t + 1 }), !n[e + 1]?.[t + 1] && isRightmost(n, e, t) && isBottommost(n, e, t) && r.push({ x: e + 1, y: t + 1 }), r)) : (n[e - 1]?.[t] && n[e][t - 1] && r.push({ x: e, y: t }), n[e + 1]?.[t] && n[e][t - 1] && r.push({ x: e + 1, y: t }), n[e - 1]?.[t] && n[e][t + 1] && r.push({ x: e, y: t + 1 }), n[e + 1]?.[t] && n[e][t + 1] && r.push({ x: e + 1, y: t + 1 }), r)
2620
2626
  }
2621
2627
  function findCorners(n, e, t, r) {
2622
- const i = [
2628
+ const o = [
2623
2629
  { x: 0, y: 0 },
2624
2630
  { x: t, y: 0 },
2625
2631
  { x: 0, y: r },
2626
2632
  { x: t, y: r }
2627
2633
  ]
2628
- for (let o = 0; o < n.length; o++)
2634
+ for (let i = 0; i < n.length; i++)
2629
2635
  for (let u = 0; u < n[0].length; u++) {
2630
- const s = getCorners(n, o, u)
2631
- for (const c of s) i.some(f => f.x === c.x && f.y === c.y) || i.push(c)
2636
+ const s = getCorners(n, i, u)
2637
+ for (const c of s) o.some(f => f.x === c.x && f.y === c.y) || o.push(c)
2632
2638
  }
2633
- return i.map(o => ({ x: o.x * e, y: o.y * e }))
2639
+ return o.map(i => ({ x: i.x * e, y: i.y * e }))
2634
2640
  }
2635
2641
  function findLines(n, e) {
2636
2642
  const t = filterCoordinates(n, (c, f) => n[c][f] === 0 && n[c][f + 1] !== 0, 'row-first').map(c => ({ ...c, dx: 1, dy: 0 })),
2637
2643
  r = filterCoordinates(n, (c, f) => n[c][f] === 0 && n[c][f - 1] !== 0, 'row-first').map(c => ({ ...c, dx: 1, dy: 0 })),
2638
- i = filterCoordinates(n, (c, f) => n[c][f] === 0 && n[c - 1]?.[f] !== 0, 'column-first').map(c => ({ ...c, dx: 0, dy: 1 })),
2639
- o = filterCoordinates(n, (c, f) => n[c][f] === 0 && n[c + 1]?.[f] !== 0, 'column-first').map(c => ({ ...c, dx: 0, dy: 1 }))
2640
- t.forEach(c => c.y++), o.forEach(c => c.x++)
2641
- const u = group([...i, ...o], (c, f) => c.x === f.x && c.y - 1 === f.y),
2644
+ o = filterCoordinates(n, (c, f) => n[c][f] === 0 && n[c - 1]?.[f] !== 0, 'column-first').map(c => ({ ...c, dx: 0, dy: 1 })),
2645
+ i = filterCoordinates(n, (c, f) => n[c][f] === 0 && n[c + 1]?.[f] !== 0, 'column-first').map(c => ({ ...c, dx: 0, dy: 1 }))
2646
+ t.forEach(c => c.y++), i.forEach(c => c.x++)
2647
+ const u = group([...o, ...i], (c, f) => c.x === f.x && c.y - 1 === f.y),
2642
2648
  s = group([...r, ...t], (c, f) => c.y === f.y && c.x - 1 === f.x)
2643
2649
  return [...u, ...s].map(c => ({ start: c[0], end: last(c) })).map(c => ({ start: multiplyPoint(c.start, e), end: multiplyPoint(addPoint(c.end, { x: c.start.dx, y: c.start.dy }), e) }))
2644
2650
  }
@@ -2649,38 +2655,38 @@ function getSortedRayAngles(n, e) {
2649
2655
  return e.map(t => getAngleInRadians(n, t)).sort((t, r) => t - r)
2650
2656
  }
2651
2657
  function getLineIntersectionPoint(n, e, t, r) {
2652
- const i = (r.y - t.y) * (e.x - n.x) - (r.x - t.x) * (e.y - n.y)
2653
- if (i === 0) return null
2654
- let o = n.y - t.y,
2658
+ const o = (r.y - t.y) * (e.x - n.x) - (r.x - t.x) * (e.y - n.y)
2659
+ if (o === 0) return null
2660
+ let i = n.y - t.y,
2655
2661
  u = n.x - t.x
2656
- const s = (r.x - t.x) * o - (r.y - t.y) * u,
2657
- c = (e.x - n.x) * o - (e.y - n.y) * u
2658
- return (o = s / i), (u = c / i), o > 0 && o < 1 && u > 0 && u < 1 ? { x: n.x + o * (e.x - n.x), y: n.y + o * (e.y - n.y) } : null
2662
+ const s = (r.x - t.x) * i - (r.y - t.y) * u,
2663
+ c = (e.x - n.x) * i - (e.y - n.y) * u
2664
+ return (i = s / o), (u = c / o), i > 0 && i < 1 && u > 0 && u < 1 ? { x: n.x + i * (e.x - n.x), y: n.y + i * (e.y - n.y) } : null
2659
2665
  }
2660
2666
  function raycast(n, e, t) {
2661
2667
  const r = [],
2662
- i = pushPoint(n, t, 1e4)
2663
- for (const o of e) {
2664
- const u = getLineIntersectionPoint(n, i, o.start, o.end)
2668
+ o = pushPoint(n, t, 1e4)
2669
+ for (const i of e) {
2670
+ const u = getLineIntersectionPoint(n, o, i.start, i.end)
2665
2671
  u && r.push(u)
2666
2672
  }
2667
2673
  return r.length
2668
- ? r.reduce((o, u) => {
2674
+ ? r.reduce((i, u) => {
2669
2675
  const s = getDistanceBetweenPoints(n, u),
2670
- c = getDistanceBetweenPoints(n, o)
2671
- return s < c ? u : o
2676
+ c = getDistanceBetweenPoints(n, i)
2677
+ return s < c ? u : i
2672
2678
  })
2673
2679
  : null
2674
2680
  }
2675
2681
  function raycastCircle(n, e, t) {
2676
- const i = getSortedRayAngles(n, t),
2677
- o = []
2678
- for (const u of i) {
2682
+ const o = getSortedRayAngles(n, t),
2683
+ i = []
2684
+ for (const u of o) {
2679
2685
  const s = raycast(n, e, u - 0.001),
2680
2686
  c = raycast(n, e, u + 0.001)
2681
- s && o.push(s), c && o.push(c)
2687
+ s && i.push(s), c && i.push(c)
2682
2688
  }
2683
- return o
2689
+ return i
2684
2690
  }
2685
2691
  class PubSubChannel {
2686
2692
  constructor() {
@@ -2748,23 +2754,23 @@ class TrieRouter {
2748
2754
  return
2749
2755
  }
2750
2756
  const r = e[0]
2751
- let i = r,
2752
- o
2753
- if ((r.startsWith(':') && ((i = ':'), (o = r.slice(1))), !this.forks.has(i))) {
2757
+ let o = r,
2758
+ i
2759
+ if ((r.startsWith(':') && ((o = ':'), (i = r.slice(1))), !this.forks.has(o))) {
2754
2760
  const u = new TrieRouter()
2755
- o && (u.variableName = o), this.forks.set(i, u)
2761
+ i && (u.variableName = i), this.forks.set(o, u)
2756
2762
  }
2757
- this.forks.get(i).insert(e.slice(1), t)
2763
+ this.forks.get(o).insert(e.slice(1), t)
2758
2764
  }
2759
- async handle(e, t, r, i) {
2760
- if (e.length === 0) return this.handler ? (await this.handler(t, r, i), !0) : !1
2761
- const o = e[0],
2762
- u = this.forks.get(o)
2763
- if (u) return u.handle(e.slice(1), t, r, i)
2765
+ async handle(e, t, r, o) {
2766
+ if (e.length === 0) return this.handler ? (await this.handler(t, r, o), !0) : !1
2767
+ const i = e[0],
2768
+ u = this.forks.get(i)
2769
+ if (u) return u.handle(e.slice(1), t, r, o)
2764
2770
  const s = this.forks.get(':')
2765
- if (s) return s.variableName && i.set(s.variableName, decodeURIComponent(o)), s.handle(e.slice(1), t, r, i)
2771
+ if (s) return s.variableName && o.set(s.variableName, decodeURIComponent(i)), s.handle(e.slice(1), t, r, o)
2766
2772
  const c = this.forks.get('*')
2767
- return c ? (i.set('wildcard', e.join('/')), c.handler ? (await c.handler(t, r, i), !0) : !1) : !1
2773
+ return c ? (o.set('wildcard', e.join('/')), c.handler ? (await c.handler(t, r, o), !0) : !1) : !1
2768
2774
  }
2769
2775
  }
2770
2776
  exports.TrieRouter = TrieRouter
@@ -2804,8 +2810,8 @@ class Solver {
2804
2810
  for (const t of this.steps)
2805
2811
  try {
2806
2812
  if (t.transientSkipStepName) {
2807
- const i = e[t.transientSkipStepName]
2808
- if (i === 'skipped' || i === 'failed') {
2813
+ const o = e[t.transientSkipStepName]
2814
+ if (o === 'skipped' || o === 'failed') {
2809
2815
  ;(e = { ...e, [t.name]: 'skipped' }), await this.onStepChange(e)
2810
2816
  continue
2811
2817
  }
@@ -2814,7 +2820,9 @@ class Solver {
2814
2820
  ;(e = { ...e, [t.name]: 'skipped' }), await this.onStepChange(e)
2815
2821
  continue
2816
2822
  }
2817
- ;(e = { ...e, [t.name]: 'in-progress' }), await this.onStepChange(e), await t.action(this.context), (e = { ...e, [t.name]: 'completed' }), await this.onStepChange(e)
2823
+ ;(e = { ...e, [t.name]: 'in-progress' }), await this.onStepChange(e)
2824
+ for (let o = 0; (await t.action(this.context, o)) === 'retry'; o++);
2825
+ ;(e = { ...e, [t.name]: 'completed' }), await this.onStepChange(e)
2818
2826
  } catch (r) {
2819
2827
  throw ((e = { ...e, [t.name]: 'failed' }), (this.status = 'failed'), await this.onStatusChange(this.status), await this.onStepChange(e), await this.onError(r), r)
2820
2828
  }