playlist-data-engine 1.5.5 → 1.5.7

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.
@@ -116,17 +116,17 @@ const yl = {
116
116
  smooth: 40
117
117
  // Cleaner peaks, less noise
118
118
  };
119
- function Ar(s = { mode: "standard" }) {
119
+ function kr(s = { mode: "standard" }) {
120
120
  if (s.mode === "custom") {
121
121
  const e = s.customValue ?? Ga.standard;
122
122
  return Math.max(1, Math.min(50, e));
123
123
  }
124
124
  return Ga[s.mode];
125
125
  }
126
- function Mr(s = { mode: "standard" }) {
126
+ function Ar(s = { mode: "standard" }) {
127
127
  return bl[s.mode];
128
128
  }
129
- function kr(s = { mode: "standard" }) {
129
+ function Mr(s = { mode: "standard" }) {
130
130
  return wl[s.mode];
131
131
  }
132
132
  const ii = {
@@ -164,7 +164,7 @@ const ii = {
164
164
  useInterpolatedBeats: !1,
165
165
  ignoreKeyRequirements: !1
166
166
  }, qv = Cr;
167
- function An(s) {
167
+ function kn(s) {
168
168
  switch (s) {
169
169
  case "easy":
170
170
  return yl;
@@ -212,7 +212,7 @@ function Gv(s) {
212
212
  const Ir = {
213
213
  beatSubdivisions: /* @__PURE__ */ new Map(),
214
214
  defaultSubdivision: "quarter"
215
- }, Ua = 4, Mn = [
215
+ }, Ua = 4, An = [
216
216
  "quarter",
217
217
  "half",
218
218
  "eighth",
@@ -225,8 +225,8 @@ const Ir = {
225
225
  "offbeat8",
226
226
  "rest"
227
227
  ];
228
- function kn(s) {
229
- return typeof s == "string" && Mn.includes(s);
228
+ function Mn(s) {
229
+ return typeof s == "string" && An.includes(s);
230
230
  }
231
231
  function Dr(s) {
232
232
  switch (s) {
@@ -264,14 +264,14 @@ function Er(s) {
264
264
  throw new Error(
265
265
  `Beat index must be non-negative, got ${e}`
266
266
  );
267
- if (!kn(t))
267
+ if (!Mn(t))
268
268
  throw new Error(
269
- `Beat ${e}: Invalid subdivision type "${t}". Valid types: ${Mn.join(", ")}`
269
+ `Beat ${e}: Invalid subdivision type "${t}". Valid types: ${An.join(", ")}`
270
270
  );
271
271
  }
272
- if (!kn(s.defaultSubdivision))
272
+ if (!Mn(s.defaultSubdivision))
273
273
  throw new Error(
274
- `Invalid defaultSubdivision "${s.defaultSubdivision}". Valid types: ${Mn.join(", ")}`
274
+ `Invalid defaultSubdivision "${s.defaultSubdivision}". Valid types: ${An.join(", ")}`
275
275
  );
276
276
  }
277
277
  function Tl(s, e) {
@@ -298,7 +298,7 @@ const Cl = {
298
298
  timingTolerance: 0.01,
299
299
  userOffsetMs: 0,
300
300
  compensateOutputLatency: !0
301
- }, Al = "1.0.0", Ml = "ellis-dp-v1", _t = [
301
+ }, kl = "1.0.0", Al = "ellis-dp-v1", _t = [
302
302
  { tier: "D", minHotness: 0, maxHotness: 33, windowMs: 31 },
303
303
  { tier: "C", minHotness: 33, maxHotness: 66, windowMs: 25 },
304
304
  { tier: "B", minHotness: 66, maxHotness: 100, windowMs: 20 },
@@ -313,7 +313,7 @@ function en(s) {
313
313
  return e.tier;
314
314
  return "Platinum";
315
315
  }
316
- function kl(s) {
316
+ function Ml(s) {
317
317
  const e = _t.findIndex(
318
318
  (c) => s >= c.minHotness && s < c.maxHotness
319
319
  );
@@ -1816,7 +1816,7 @@ class ye {
1816
1816
  else if (u) {
1817
1817
  o = this.calculateSaveDC(e, u);
1818
1818
  for (const g of i) {
1819
- const y = u.toLowerCase() === "dexterity" && g.statusEffects.some((S) => S.mechanicalEffects?.disadvantageOnDexSaves);
1819
+ const y = u.toLowerCase() === "dexterity" && g.statusEffects.some((_) => _.mechanicalEffects?.disadvantageOnDexSaves);
1820
1820
  this.makeSavingThrow(g, u, o, y) || (r = this.diceRoller ? this.diceRoller.calculateDamage(c, 0, !1) : ue.calculateDamage(c, 0, !1), g.currentHP -= r.total, g.currentHP < 0 && (g.currentHP = 0, g.isDefeated = !0));
1821
1821
  }
1822
1822
  }
@@ -2067,16 +2067,16 @@ class Gl {
2067
2067
  assessThreat(e, t) {
2068
2068
  const i = e.character.hp.max, n = i > 0 ? e.currentHP / i : 0, a = this.getAllies(e, t), r = this.getEnemies(e, t), o = a.reduce((y, v) => {
2069
2069
  if (v.id === e.id) return y;
2070
- const S = v.character.hp.max, T = S > 0 ? v.currentHP / S : 0;
2070
+ const _ = v.character.hp.max, T = _ > 0 ? v.currentHP / _ : 0;
2071
2071
  return Math.min(y, T);
2072
2072
  }, 1), c = r.reduce(
2073
2073
  (y, v) => Math.min(y, v.currentHP),
2074
2074
  r.length > 0 ? 1 / 0 : 0
2075
2075
  ), l = r.reduce((y, v) => {
2076
- const S = v.character.equipment?.weapons.filter((_) => _.equipped) || [];
2076
+ const _ = v.character.equipment?.weapons.filter((S) => S.equipped) || [];
2077
2077
  let T = 5;
2078
- for (const _ of S) {
2079
- const I = Vt[_.name], D = _.damage_dice || (typeof _.damage != "string" ? _.damage?.dice : void 0) || I?.damage?.dice || "1d6", R = this.averageDamageFromFormula(D);
2078
+ for (const S of _) {
2079
+ const I = Vt[S.name], D = S.damage_dice || (typeof S.damage != "string" ? S.damage?.dice : void 0) || I?.damage?.dice || "1d6", R = this.averageDamageFromFormula(D);
2080
2080
  R > T && (T = R);
2081
2081
  }
2082
2082
  return Math.max(y, T);
@@ -3257,11 +3257,11 @@ function Br(s) {
3257
3257
  function eb(s, e = 1) {
3258
3258
  return Math.round(s * e);
3259
3259
  }
3260
- function ki(s) {
3260
+ function Mi(s) {
3261
3261
  return s <= 0 ? 1 : s >= 15 ? Za[15] : Za[s] || 1;
3262
3262
  }
3263
3263
  function tb(s, e) {
3264
- const t = s.reduce((n, a) => n + Pr(a), 0), i = e !== void 0 ? e : ki(s.length);
3264
+ const t = s.reduce((n, a) => n + Pr(a), 0), i = e !== void 0 ? e : Mi(s.length);
3265
3265
  return Math.round(t * i);
3266
3266
  }
3267
3267
  function Xl(s) {
@@ -7300,7 +7300,7 @@ class xn {
7300
7300
  static validateFeatureReference(e, t) {
7301
7301
  const i = [];
7302
7302
  if (typeof e == "string") {
7303
- const n = ke.getInstance(), a = n.getClassFeatureById(e), r = a ? void 0 : n.getRacialTraitById(e);
7303
+ const n = Me.getInstance(), a = n.getClassFeatureById(e), r = a ? void 0 : n.getRacialTraitById(e);
7304
7304
  !a && !r && i.push(
7305
7305
  `grantsFeatures[${t}]: Feature "${e}" not found in FeatureQuery`
7306
7306
  );
@@ -7333,7 +7333,7 @@ class xn {
7333
7333
  * @returns True if feature exists in registry
7334
7334
  */
7335
7335
  static validateEquipmentFeatureReference(e) {
7336
- const t = ke.getInstance(), i = t.getClassFeatureById(e), n = i ? void 0 : t.getRacialTraitById(e);
7336
+ const t = Me.getInstance(), i = t.getClassFeatureById(e), n = i ? void 0 : t.getRacialTraitById(e);
7337
7337
  return !!(i || n);
7338
7338
  }
7339
7339
  /**
@@ -8602,7 +8602,7 @@ class it {
8602
8602
  };
8603
8603
  }
8604
8604
  }
8605
- function Ab() {
8605
+ function kb() {
8606
8606
  return it.getInstance();
8607
8607
  }
8608
8608
  class Y {
@@ -8952,7 +8952,7 @@ ${d.errors?.join(`
8952
8952
  * Reset all categories to defaults
8953
8953
  */
8954
8954
  resetAll() {
8955
- this.extensions.clear(), this.customWeights.clear(), it.getInstance().invalidateCache(), Ne.getInstance().invalidateCache(), ke.getInstance().invalidateCache();
8955
+ this.extensions.clear(), this.customWeights.clear(), it.getInstance().invalidateCache(), Ne.getInstance().invalidateCache(), Me.getInstance().invalidateCache();
8956
8956
  }
8957
8957
  /**
8958
8958
  * Get the registry type for a given category
@@ -8977,7 +8977,7 @@ ${d.errors?.join(`
8977
8977
  */
8978
8978
  invalidateRegistryCache(e) {
8979
8979
  const t = this.getRegistryForCategory(e);
8980
- t === "spell" ? it.getInstance().invalidateCache() : t === "skill" ? Ne.getInstance().invalidateCache() : t === "feature" && ke.getInstance().invalidateCache();
8980
+ t === "spell" ? it.getInstance().invalidateCache() : t === "skill" ? Ne.getInstance().invalidateCache() : t === "feature" && Me.getInstance().invalidateCache();
8981
8981
  }
8982
8982
  /**
8983
8983
  * Get information about registered extensions
@@ -9465,12 +9465,12 @@ const _u = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9465
9465
  traits: ["Darkvision", "Hellish Resistance", "Infernal Legacy"],
9466
9466
  description: "Tieflings are humanoids with infernal blood, often bearing horns, tails, and other fiendish features. Their ancestry grants them resistance to fire and innate magical abilities. Though often feared and distrusted due to their appearance, tieflings are as varied in morality and ambition as any other race, with many becoming powerful warlocks, sorcerers, or charismatic leaders."
9467
9467
  }
9468
- }, Mb = qr, Tu = Object.entries(qr).map(([s, e]) => ({
9468
+ }, Ab = qr, Tu = Object.entries(qr).map(([s, e]) => ({
9469
9469
  race: s,
9470
9470
  ...e
9471
9471
  }));
9472
9472
  let rn = null, on = null;
9473
- async function kb(s) {
9473
+ async function Mb(s) {
9474
9474
  try {
9475
9475
  rn || (on || (on = Promise.resolve().then(() => _u)), rn = (await on).ExtensionManager);
9476
9476
  const t = rn.getInstance().get("races.data");
@@ -9493,7 +9493,7 @@ function Xn(s) {
9493
9493
  } catch {
9494
9494
  }
9495
9495
  }
9496
- class ke {
9496
+ class Me {
9497
9497
  constructor() {
9498
9498
  this.allClassFeaturesCache = null, this.classFeaturesIndex = null, this.allRacialTraitsCache = null, this.racialTraitsIndex = null, this.manager = Y.getInstance();
9499
9499
  }
@@ -9501,7 +9501,7 @@ class ke {
9501
9501
  * Get the singleton instance
9502
9502
  */
9503
9503
  static getInstance() {
9504
- return ke.instance || (ke.instance = new ke()), ke.instance;
9504
+ return Me.instance || (Me.instance = new Me()), Me.instance;
9505
9505
  }
9506
9506
  /**
9507
9507
  * Invalidate all caches
@@ -9920,7 +9920,7 @@ class ke {
9920
9920
  */
9921
9921
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
9922
9922
  static getEquipmentFeatures(e) {
9923
- const t = ke.getInstance(), i = [], n = t.getAllClassFeaturesArray();
9923
+ const t = Me.getInstance(), i = [], n = t.getAllClassFeaturesArray();
9924
9924
  for (const a of n)
9925
9925
  (a.tags?.includes("equipment") || a.tags?.includes("item") || a.source === "custom") && i.push(a);
9926
9926
  return i;
@@ -9936,7 +9936,7 @@ class ke {
9936
9936
  * @returns True if the feature exists and can be granted by equipment
9937
9937
  */
9938
9938
  static isValidEquipmentFeature(e) {
9939
- return !!ke.getInstance().getClassFeatureById(e);
9939
+ return !!Me.getInstance().getClassFeatureById(e);
9940
9940
  }
9941
9941
  /**
9942
9942
  * Get all racial traits as a plain object (for debugging/serialization)
@@ -9956,7 +9956,7 @@ class ke {
9956
9956
  }
9957
9957
  }
9958
9958
  function Ib() {
9959
- return ke.getInstance();
9959
+ return Me.getInstance();
9960
9960
  }
9961
9961
  const Cu = {
9962
9962
  // === WEAPONS ===
@@ -10139,12 +10139,12 @@ function Jn(s, e) {
10139
10139
  (t) => t.archetypes.includes(s) && t.rarities.includes(e)
10140
10140
  );
10141
10141
  }
10142
- function Au(s, e) {
10142
+ function ku(s, e) {
10143
10143
  return Jn(s, e).filter(
10144
10144
  (t) => t.type === "weapon"
10145
10145
  );
10146
10146
  }
10147
- function Mu(s, e) {
10147
+ function Au(s, e) {
10148
10148
  return Jn(s, e).filter(
10149
10149
  (t) => t.type === "armor"
10150
10150
  );
@@ -10193,7 +10193,7 @@ const $e = class $e {
10193
10193
  * @returns Selected weapon template
10194
10194
  */
10195
10195
  static selectWeapon(e, t, i) {
10196
- const n = Au(e, t);
10196
+ const n = ku(e, t);
10197
10197
  if (n.length === 0)
10198
10198
  return St.find((o) => o.id === "dagger");
10199
10199
  const a = $e.WEAPON_PRIORITY[e][t], r = n.filter((o) => a.includes(o.id));
@@ -10210,7 +10210,7 @@ const $e = class $e {
10210
10210
  * @returns Selected armor template
10211
10211
  */
10212
10212
  static selectArmor(e, t, i) {
10213
- const n = Mu(e, t);
10213
+ const n = Au(e, t);
10214
10214
  if (n.length === 0)
10215
10215
  return St.find((o) => o.id === "leather-armor");
10216
10216
  const a = $e.ARMOR_PRIORITY[e][t], r = n.filter((o) => a.includes(o.id));
@@ -10876,10 +10876,10 @@ class Ze {
10876
10876
  const v = li[n]?.[p];
10877
10877
  if (!v || v === 0)
10878
10878
  continue;
10879
- const S = [...y];
10880
- for (let T = 0; T < v && S.length > 0; T++) {
10881
- const _ = r.randomInt(0, S.length), I = S[_];
10882
- h.push(I), S.splice(_, 1);
10879
+ const _ = [...y];
10880
+ for (let T = 0; T < v && _.length > 0; T++) {
10881
+ const S = r.randomInt(0, _.length), I = _[S];
10882
+ h.push(I), _.splice(S, 1);
10883
10883
  }
10884
10884
  }
10885
10885
  const f = c.spells - h.length;
@@ -10887,13 +10887,13 @@ class Ze {
10887
10887
  const p = [];
10888
10888
  for (const v of m) {
10889
10889
  if (v > l) break;
10890
- const S = o[`level${v}`];
10891
- S && p.push(...S);
10890
+ const _ = o[`level${v}`];
10891
+ _ && p.push(..._);
10892
10892
  }
10893
10893
  const y = [...p];
10894
10894
  for (let v = 0; v < f && y.length > 0; v++) {
10895
- const S = r.randomInt(0, y.length), T = y[S];
10896
- h.some((_) => _.id === T.id) || h.push(T), y.splice(S, 1);
10895
+ const _ = r.randomInt(0, y.length), T = y[_];
10896
+ h.some((S) => S.id === T.id) || h.push(T), y.splice(_, 1);
10897
10897
  }
10898
10898
  }
10899
10899
  const g = Ze.getSpellSlotsForCR(n);
@@ -10940,9 +10940,9 @@ class Ze {
10940
10940
  if (!y || y === 0)
10941
10941
  continue;
10942
10942
  const v = [...p];
10943
- for (let S = 0; S < y && v.length > 0; S++) {
10944
- const T = a.randomInt(0, v.length), _ = v[T];
10945
- d.push(_), v.splice(T, 1);
10943
+ for (let _ = 0; _ < y && v.length > 0; _++) {
10944
+ const T = a.randomInt(0, v.length), S = v[T];
10945
+ d.push(S), v.splice(T, 1);
10946
10946
  }
10947
10947
  }
10948
10948
  const m = o.spells - d.length;
@@ -10955,8 +10955,8 @@ class Ze {
10955
10955
  }
10956
10956
  const p = [...g];
10957
10957
  for (let y = 0; y < m && p.length > 0; y++) {
10958
- const v = a.randomInt(0, p.length), S = p[v];
10959
- d.some((T) => T.id === S.id) || d.push(S), p.splice(v, 1);
10958
+ const v = a.randomInt(0, p.length), _ = p[v];
10959
+ d.some((T) => T.id === _.id) || d.push(_), p.splice(v, 1);
10960
10960
  }
10961
10961
  }
10962
10962
  const f = Ze.getSpellSlotsForCR(n);
@@ -11338,7 +11338,7 @@ const di = {
11338
11338
  20: 5,
11339
11339
  // CR 21+: 6 per day (ancient dragons, demon lords, etc.)
11340
11340
  21: 6
11341
- }, ku = 3;
11341
+ }, Mu = 3;
11342
11342
  class Ke {
11343
11343
  /**
11344
11344
  * Generate legendary configuration for a boss enemy
@@ -11417,7 +11417,7 @@ class Ke {
11417
11417
  n.push(u), a.add(u.id);
11418
11418
  }
11419
11419
  }
11420
- const r = ku - n.length, o = e.filter((l) => !a.has(l.id)), c = t.shuffle(o);
11420
+ const r = Mu - n.length, o = e.filter((l) => !a.has(l.id)), c = t.shuffle(o);
11421
11421
  for (let l = 0; l < r && l < c.length; l++)
11422
11422
  n.push(c[l]);
11423
11423
  return n;
@@ -12068,7 +12068,7 @@ const U = class U {
12068
12068
  * @returns Array of selected feature objects
12069
12069
  */
12070
12070
  static selectExtraAbilities(e, t, i) {
12071
- const n = U.ARCHETYPE_TAGS[e], r = ke.getInstance().getAllClassFeatures(), o = [];
12071
+ const n = U.ARCHETYPE_TAGS[e], r = Me.getInstance().getAllClassFeatures(), o = [];
12072
12072
  for (const d of r.values())
12073
12073
  o.push(...d);
12074
12074
  const c = o.filter((d) => !d.tags || d.tags.length === 0 ? !1 : d.tags.some(
@@ -12179,11 +12179,11 @@ const U = class U {
12179
12179
  u?.hpLevel !== void 0 ? y = bs(h.baseHP, u.hpLevel, r) : y = bs(h.baseHP, f, r), o !== 1 && (y = Math.round(y * o));
12180
12180
  const v = Math.ceil(1 + (f - 1) / 4);
12181
12181
  Ze.shouldHaveSpellcasting(h.archetype, r);
12182
- const { abilities: S, spellConfig: T } = U.generateAbilities(h, r, d, m, g, f, u);
12183
- let _ = S;
12182
+ const { abilities: _, spellConfig: T } = U.generateAbilities(h, r, d, m, g, f, u);
12183
+ let S = _;
12184
12184
  if (r === "boss") {
12185
- const j = _[0];
12186
- _ = U.generateBossFeatures(
12185
+ const j = S[0];
12186
+ S = U.generateBossFeatures(
12187
12187
  h,
12188
12188
  j,
12189
12189
  d
@@ -12211,7 +12211,7 @@ const U = class U {
12211
12211
  legendary_effect: X.effect,
12212
12212
  legendary_damage: X.damage,
12213
12213
  legendary_damage_type: X.damageType
12214
- })), _.push(...I);
12214
+ })), S.push(...I);
12215
12215
  }
12216
12216
  const R = Ct.generate({
12217
12217
  archetype: h.archetype,
@@ -12308,7 +12308,7 @@ const U = class U {
12308
12308
  racial_traits: [],
12309
12309
  // Enemies don't have racial traits
12310
12310
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
12311
- class_features: _.map((j) => j.id || j.name || `${j}`),
12311
+ class_features: S.map((j) => j.id || j.name || `${j}`),
12312
12312
  // Equipment - enemies now use generated equipment
12313
12313
  equipment: {
12314
12314
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -12534,8 +12534,8 @@ const U = class U {
12534
12534
  throw new Error(
12535
12535
  `Boss encounters must have count=1. Requested count=${n} with baseRarity='boss'. Boss enemies are designed for solo encounters against a party. Use a lower rarity (common/uncommon/elite) for multi-enemy encounters, or set count=1 for a boss encounter.`
12536
12536
  );
12537
- const y = e.map((Z) => Z.level), v = Zn(y, a), S = Math.round(v * c), T = ki(n), _ = Math.round(S / T / n);
12538
- let I = Br(_);
12537
+ const y = e.map((Z) => Z.level), v = Zn(y, a), _ = Math.round(v * c), T = Mi(n), S = Math.round(_ / T / n);
12538
+ let I = Br(S);
12539
12539
  const D = U.getSeededRNG(i), R = D.random();
12540
12540
  R < 0.25 ? I = Math.min(I * 1.5, 30) : R > 0.75 && (I = Math.max(I * 0.67, 0.125));
12541
12541
  const q = o ? U.getRarityDistribution(n, I) : Array(n).fill(r), O = U.selectTemplatesForMix(
@@ -12627,10 +12627,10 @@ const U = class U {
12627
12627
  throw new Error(
12628
12628
  `Boss encounters must have count=1. Requested count=${i} with baseRarity='boss'. Boss enemies are designed for solo encounters against a party. Use a lower rarity (common/uncommon/elite) for multi-enemy encounters, or set count=1 for a boss encounter.`
12629
12629
  );
12630
- const y = ki(i);
12630
+ const y = Mi(i);
12631
12631
  let v = n;
12632
12632
  y > 1 && i > 1 && (v = Math.max(n / Math.sqrt(y), 0.125));
12633
- const S = r ? U.getRarityDistribution(i, n) : Array(i).fill(a), T = U.getSeededRNG(t), _ = U.selectTemplatesForMix(
12633
+ const _ = r ? U.getRarityDistribution(i, n) : Array(i).fill(a), T = U.getSeededRNG(t), S = U.selectTemplatesForMix(
12634
12634
  i,
12635
12635
  T,
12636
12636
  d,
@@ -12640,7 +12640,7 @@ const U = class U {
12640
12640
  m
12641
12641
  ), I = [];
12642
12642
  for (let D = 0; D < i; D++) {
12643
- const R = _[D];
12643
+ const R = S[D];
12644
12644
  if (!R)
12645
12645
  throw new Error(`No template available for enemy at index ${D}`);
12646
12646
  const q = U.generate({
@@ -12648,7 +12648,7 @@ const U = class U {
12648
12648
  templateId: R.id,
12649
12649
  cr: v,
12650
12650
  // Pass CR for proper level scaling (Task 1.4)
12651
- rarity: S[D],
12651
+ rarity: _[D],
12652
12652
  // Use distributed rarity (Task 2.3)
12653
12653
  difficultyMultiplier: o,
12654
12654
  audioProfile: m,
@@ -13790,7 +13790,7 @@ class xb {
13790
13790
  return Math.round(e * 1e4) / 1e4;
13791
13791
  }
13792
13792
  }
13793
- const Ae = class Ae {
13793
+ const ke = class ke {
13794
13794
  /**
13795
13795
  * Suggest an enemy CR for the given party and target difficulty.
13796
13796
  *
@@ -13805,15 +13805,15 @@ const Ae = class Ae {
13805
13805
  aiConfig: a,
13806
13806
  combatConfig: r,
13807
13807
  baseSeed: o = "difficulty-calc",
13808
- simulationsPerProbe: c = Ae.DEFAULT_SIMULATIONS_PER_PROBE,
13809
- maxIterations: l = Ae.DEFAULT_MAX_ITERATIONS,
13808
+ simulationsPerProbe: c = ke.DEFAULT_SIMULATIONS_PER_PROBE,
13809
+ maxIterations: l = ke.DEFAULT_MAX_ITERATIONS,
13810
13810
  enemyCount: u = 1,
13811
13811
  abortSignal: d,
13812
13812
  onProgress: h
13813
13813
  } = n, m = [];
13814
13814
  let f = 0;
13815
- const g = e.map((oe) => oe.level), p = Zn(g, i), y = ki(u), v = p / y, S = Br(v);
13816
- let T = Ae.CR_FLOOR, _ = Ae.CR_CEILING, I = Math.max(T, Math.min(_, S));
13815
+ const g = e.map((oe) => oe.level), p = Zn(g, i), y = Mi(u), v = p / y, _ = Br(v);
13816
+ let T = ke.CR_FLOOR, S = ke.CR_CEILING, I = Math.max(T, Math.min(S, _));
13817
13817
  const D = jr[i];
13818
13818
  let R = !1, q = null, O = !1;
13819
13819
  for (let oe = 0; oe < l; oe++) {
@@ -13847,10 +13847,10 @@ const Ae = class Ae {
13847
13847
  R = !0;
13848
13848
  break;
13849
13849
  }
13850
- X.winRate > D.max ? T = I : _ = I;
13851
- const ge = (T + _) / 2;
13852
- if (Math.abs(ge - I) < Ae.CR_STEP_MIN) {
13853
- if (X.winRate > D.max ? I = Math.min(Ae.CR_CEILING, I + Ae.CR_STEP_MIN) : I = Math.max(Ae.CR_FLOOR, I - Ae.CR_STEP_MIN), I === m[m.length - 1].cr)
13850
+ X.winRate > D.max ? T = I : S = I;
13851
+ const ge = (T + S) / 2;
13852
+ if (Math.abs(ge - I) < ke.CR_STEP_MIN) {
13853
+ if (X.winRate > D.max ? I = Math.min(ke.CR_CEILING, I + ke.CR_STEP_MIN) : I = Math.max(ke.CR_FLOOR, I - ke.CR_STEP_MIN), I === m[m.length - 1].cr)
13854
13854
  break;
13855
13855
  } else
13856
13856
  I = ge;
@@ -13870,7 +13870,7 @@ const Ae = class Ae {
13870
13870
  totalSimulationsRun: f,
13871
13871
  iterationsUsed: m.length,
13872
13872
  probes: m,
13873
- initialCREstimate: this.roundCR(S),
13873
+ initialCREstimate: this.roundCR(_),
13874
13874
  suggestedEnemy: Z,
13875
13875
  wasCancelled: O
13876
13876
  };
@@ -13960,8 +13960,8 @@ const Ae = class Ae {
13960
13960
  return e <= 0 ? 0 : e < 0.25 ? 0.125 : e < 0.375 ? 0.25 : e < 0.75 ? 0.5 : Math.round(e);
13961
13961
  }
13962
13962
  };
13963
- Ae.DEFAULT_SIMULATIONS_PER_PROBE = 200, Ae.DEFAULT_MAX_ITERATIONS = 10, Ae.CR_STEP_MIN = 0.25, Ae.CR_FLOOR = 0.125, Ae.CR_CEILING = 30;
13964
- let _s = Ae;
13963
+ ke.DEFAULT_SIMULATIONS_PER_PROBE = 200, ke.DEFAULT_MAX_ITERATIONS = 10, ke.CR_STEP_MIN = 0.25, ke.CR_FLOOR = 0.125, ke.CR_CEILING = 30;
13964
+ let _s = ke;
13965
13965
  const Ou = (s) => s * 5, nt = {
13966
13966
  baseXP: {
13967
13967
  perfect: 10,
@@ -14068,7 +14068,7 @@ function E(s, e, t) {
14068
14068
  value: (o) => t?.Parent && o instanceof t.Parent ? !0 : o?._zod?.traits?.has(s)
14069
14069
  }), Object.defineProperty(r, "name", { value: s }), r;
14070
14070
  }
14071
- class kt extends Error {
14071
+ class Mt extends Error {
14072
14072
  constructor() {
14073
14073
  super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
14074
14074
  }
@@ -14344,7 +14344,7 @@ function Qu(s, e, t) {
14344
14344
  });
14345
14345
  return ut(e, i);
14346
14346
  }
14347
- function At(s, e = 0) {
14347
+ function kt(s, e = 0) {
14348
14348
  if (s.aborted === !0)
14349
14349
  return !0;
14350
14350
  for (let t = e; t < s.issues.length; t++)
@@ -14352,7 +14352,7 @@ function At(s, e = 0) {
14352
14352
  return !0;
14353
14353
  return !1;
14354
14354
  }
14355
- function Mt(s, e) {
14355
+ function At(s, e) {
14356
14356
  return e.map((t) => {
14357
14357
  var i;
14358
14358
  return (i = t).path ?? (i.path = []), t.path.unshift(s), t;
@@ -14423,7 +14423,7 @@ function td(s, e = (t) => t.message) {
14423
14423
  const na = (s) => (e, t, i, n) => {
14424
14424
  const a = i ? Object.assign(i, { async: !1 }) : { async: !1 }, r = e._zod.run({ value: t, issues: [] }, a);
14425
14425
  if (r instanceof Promise)
14426
- throw new kt();
14426
+ throw new Mt();
14427
14427
  if (r.issues.length) {
14428
14428
  const o = new (n?.Err ?? s)(r.issues.map((c) => ct(c, a, ot())));
14429
14429
  throw Xr(o, n?.callee), o;
@@ -14440,7 +14440,7 @@ const na = (s) => (e, t, i, n) => {
14440
14440
  }, Li = (s) => (e, t, i) => {
14441
14441
  const n = i ? { ...i, async: !1 } : { async: !1 }, a = e._zod.run({ value: t, issues: [] }, n);
14442
14442
  if (a instanceof Promise)
14443
- throw new kt();
14443
+ throw new Mt();
14444
14444
  return a.issues.length ? {
14445
14445
  success: !1,
14446
14446
  error: new (s ?? eo)(a.issues.map((r) => ct(r, n, ot())))
@@ -14464,11 +14464,11 @@ const na = (s) => (e, t, i, n) => {
14464
14464
  }, ld = (s) => (e, t, i) => Li(s)(e, t, i), ud = (s) => async (e, t, i) => {
14465
14465
  const n = i ? Object.assign(i, { direction: "backward" }) : { direction: "backward" };
14466
14466
  return zi(s)(e, t, n);
14467
- }, dd = (s) => async (e, t, i) => zi(s)(e, t, i), hd = /^[cC][^\s-]{8,}$/, md = /^[0-9a-z]+$/, fd = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/, gd = /^[0-9a-vA-V]{20}$/, pd = /^[A-Za-z0-9]{27}$/, yd = /^[a-zA-Z0-9_-]{21}$/, vd = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/, bd = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/, As = (s) => s ? new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${s}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`) : /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/, wd = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/, Sd = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
14467
+ }, dd = (s) => async (e, t, i) => zi(s)(e, t, i), hd = /^[cC][^\s-]{8,}$/, md = /^[0-9a-z]+$/, fd = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/, gd = /^[0-9a-vA-V]{20}$/, pd = /^[A-Za-z0-9]{27}$/, yd = /^[a-zA-Z0-9_-]{21}$/, vd = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/, bd = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/, ks = (s) => s ? new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${s}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`) : /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/, wd = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/, Sd = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
14468
14468
  function _d() {
14469
14469
  return new RegExp(Sd, "u");
14470
14470
  }
14471
- const Td = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, Cd = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/, Ad = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/, Md = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, kd = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/, io = /^[A-Za-z0-9_-]*$/, Id = /^\+[1-9]\d{6,14}$/, no = "(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))", Dd = /* @__PURE__ */ new RegExp(`^${no}$`);
14471
+ const Td = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, Cd = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/, kd = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/, Ad = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Md = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/, io = /^[A-Za-z0-9_-]*$/, Id = /^\+[1-9]\d{6,14}$/, no = "(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))", Dd = /* @__PURE__ */ new RegExp(`^${no}$`);
14472
14472
  function ao(s) {
14473
14473
  const e = "(?:[01]\\d|2[0-3]):[0-5]\\d";
14474
14474
  return typeof s.precision == "number" ? s.precision === -1 ? `${e}` : s.precision === 0 ? `${e}:[0-5]\\d` : `${e}:[0-5]\\d\\.\\d{${s.precision}}` : `${e}(?::[0-5]\\d(?:\\.\\d+)?)?`;
@@ -14802,7 +14802,7 @@ const Zd = {
14802
14802
  });
14803
14803
  else {
14804
14804
  const n = (r, o, c) => {
14805
- let l = At(r), u;
14805
+ let l = kt(r), u;
14806
14806
  for (const d of o) {
14807
14807
  if (d._zod.def.when) {
14808
14808
  if (!d._zod.def.when(r))
@@ -14811,25 +14811,25 @@ const Zd = {
14811
14811
  continue;
14812
14812
  const h = r.issues.length, m = d._zod.check(r);
14813
14813
  if (m instanceof Promise && c?.async === !1)
14814
- throw new kt();
14814
+ throw new Mt();
14815
14815
  if (u || m instanceof Promise)
14816
14816
  u = (u ?? Promise.resolve()).then(async () => {
14817
- await m, r.issues.length !== h && (l || (l = At(r, h)));
14817
+ await m, r.issues.length !== h && (l || (l = kt(r, h)));
14818
14818
  });
14819
14819
  else {
14820
14820
  if (r.issues.length === h)
14821
14821
  continue;
14822
- l || (l = At(r, h));
14822
+ l || (l = kt(r, h));
14823
14823
  }
14824
14824
  }
14825
14825
  return u ? u.then(() => r) : r;
14826
14826
  }, a = (r, o, c) => {
14827
- if (At(r))
14827
+ if (kt(r))
14828
14828
  return r.aborted = !0, r;
14829
14829
  const l = n(o, i, c);
14830
14830
  if (l instanceof Promise) {
14831
14831
  if (c.async === !1)
14832
- throw new kt();
14832
+ throw new Mt();
14833
14833
  return l.then((u) => s._zod.parse(u, c));
14834
14834
  }
14835
14835
  return s._zod.parse(l, c);
@@ -14844,7 +14844,7 @@ const Zd = {
14844
14844
  const c = s._zod.parse(r, o);
14845
14845
  if (c instanceof Promise) {
14846
14846
  if (o.async === !1)
14847
- throw new kt();
14847
+ throw new Mt();
14848
14848
  return c.then((l) => n(l, i, o));
14849
14849
  }
14850
14850
  return n(c, i, o);
@@ -14894,9 +14894,9 @@ const Zd = {
14894
14894
  }[e.version];
14895
14895
  if (i === void 0)
14896
14896
  throw new Error(`Invalid UUID version: "${e.version}"`);
14897
- e.pattern ?? (e.pattern = As(i));
14897
+ e.pattern ?? (e.pattern = ks(i));
14898
14898
  } else
14899
- e.pattern ?? (e.pattern = As());
14899
+ e.pattern ?? (e.pattern = ks());
14900
14900
  ce.init(s, e);
14901
14901
  }), Qd = /* @__PURE__ */ E("$ZodEmail", (s, e) => {
14902
14902
  e.pattern ?? (e.pattern = wd), ce.init(s, e);
@@ -14971,9 +14971,9 @@ const Zd = {
14971
14971
  }
14972
14972
  };
14973
14973
  }), fh = /* @__PURE__ */ E("$ZodCIDRv4", (s, e) => {
14974
- e.pattern ?? (e.pattern = Ad), ce.init(s, e);
14974
+ e.pattern ?? (e.pattern = kd), ce.init(s, e);
14975
14975
  }), gh = /* @__PURE__ */ E("$ZodCIDRv6", (s, e) => {
14976
- e.pattern ?? (e.pattern = Md), ce.init(s, e), s._zod.check = (t) => {
14976
+ e.pattern ?? (e.pattern = Ad), ce.init(s, e), s._zod.check = (t) => {
14977
14977
  const i = t.value.split("/");
14978
14978
  try {
14979
14979
  if (i.length !== 2)
@@ -15010,7 +15010,7 @@ function lo(s) {
15010
15010
  }
15011
15011
  }
15012
15012
  const ph = /* @__PURE__ */ E("$ZodBase64", (s, e) => {
15013
- e.pattern ?? (e.pattern = kd), ce.init(s, e), s._zod.bag.contentEncoding = "base64", s._zod.check = (t) => {
15013
+ e.pattern ?? (e.pattern = Md), ce.init(s, e), s._zod.bag.contentEncoding = "base64", s._zod.check = (t) => {
15014
15014
  lo(t.value) || t.issues.push({
15015
15015
  code: "invalid_format",
15016
15016
  format: "base64",
@@ -15101,7 +15101,7 @@ const Sh = /* @__PURE__ */ E("$ZodJWT", (s, e) => {
15101
15101
  };
15102
15102
  }), Ch = /* @__PURE__ */ E("$ZodUnknown", (s, e) => {
15103
15103
  he.init(s, e), s._zod.parse = (t) => t;
15104
- }), Ah = /* @__PURE__ */ E("$ZodNever", (s, e) => {
15104
+ }), kh = /* @__PURE__ */ E("$ZodNever", (s, e) => {
15105
15105
  he.init(s, e), s._zod.parse = (t, i) => (t.issues.push({
15106
15106
  expected: "never",
15107
15107
  code: "invalid_type",
@@ -15109,10 +15109,10 @@ const Sh = /* @__PURE__ */ E("$ZodJWT", (s, e) => {
15109
15109
  inst: s
15110
15110
  }), t);
15111
15111
  });
15112
- function Ms(s, e, t) {
15113
- s.issues.length && e.issues.push(...Mt(t, s.issues)), e.value[t] = s.value;
15112
+ function As(s, e, t) {
15113
+ s.issues.length && e.issues.push(...At(t, s.issues)), e.value[t] = s.value;
15114
15114
  }
15115
- const Mh = /* @__PURE__ */ E("$ZodArray", (s, e) => {
15115
+ const Ah = /* @__PURE__ */ E("$ZodArray", (s, e) => {
15116
15116
  he.init(s, e), s._zod.parse = (t, i) => {
15117
15117
  const n = t.value;
15118
15118
  if (!Array.isArray(n))
@@ -15129,7 +15129,7 @@ const Mh = /* @__PURE__ */ E("$ZodArray", (s, e) => {
15129
15129
  value: o,
15130
15130
  issues: []
15131
15131
  }, i);
15132
- c instanceof Promise ? a.push(c.then((l) => Ms(l, t, r))) : Ms(c, t, r);
15132
+ c instanceof Promise ? a.push(c.then((l) => As(l, t, r))) : As(c, t, r);
15133
15133
  }
15134
15134
  return a.length ? Promise.all(a).then(() => t) : t;
15135
15135
  };
@@ -15138,7 +15138,7 @@ function Ei(s, e, t, i, n) {
15138
15138
  if (s.issues.length) {
15139
15139
  if (n && !(t in i))
15140
15140
  return;
15141
- e.issues.push(...Mt(t, s.issues));
15141
+ e.issues.push(...At(t, s.issues));
15142
15142
  }
15143
15143
  s.value === void 0 ? t in i && (e.value[t] = void 0) : e.value[t] = s.value;
15144
15144
  }
@@ -15175,7 +15175,7 @@ function mo(s, e, t, i, n, a) {
15175
15175
  inst: a
15176
15176
  }), s.length ? Promise.all(s).then(() => t) : t;
15177
15177
  }
15178
- const kh = /* @__PURE__ */ E("$ZodObject", (s, e) => {
15178
+ const Mh = /* @__PURE__ */ E("$ZodObject", (s, e) => {
15179
15179
  if (he.init(s, e), !Object.getOwnPropertyDescriptor(e, "shape")?.get) {
15180
15180
  const o = e.shape;
15181
15181
  Object.defineProperty(e, "shape", {
@@ -15221,59 +15221,59 @@ const kh = /* @__PURE__ */ E("$ZodObject", (s, e) => {
15221
15221
  return a ? mo(u, l, o, c, i.value, s) : u.length ? Promise.all(u).then(() => o) : o;
15222
15222
  };
15223
15223
  }), Ih = /* @__PURE__ */ E("$ZodObjectJIT", (s, e) => {
15224
- kh.init(s, e);
15224
+ Mh.init(s, e);
15225
15225
  const t = s._zod.parse, i = Qn(() => ho(e)), n = (h) => {
15226
- const m = new Yd(["shape", "payload", "ctx"]), f = i.value, g = (S) => {
15227
- const T = Cs(S);
15226
+ const m = new Yd(["shape", "payload", "ctx"]), f = i.value, g = (_) => {
15227
+ const T = Cs(_);
15228
15228
  return `shape[${T}]._zod.run({ value: input[${T}], issues: [] }, ctx)`;
15229
15229
  };
15230
15230
  m.write("const input = payload.value;");
15231
15231
  const p = /* @__PURE__ */ Object.create(null);
15232
15232
  let y = 0;
15233
- for (const S of f.keys)
15234
- p[S] = `key_${y++}`;
15233
+ for (const _ of f.keys)
15234
+ p[_] = `key_${y++}`;
15235
15235
  m.write("const newResult = {};");
15236
- for (const S of f.keys) {
15237
- const T = p[S], _ = Cs(S), D = h[S]?._zod?.optout === "optional";
15238
- m.write(`const ${T} = ${g(S)};`), D ? m.write(`
15236
+ for (const _ of f.keys) {
15237
+ const T = p[_], S = Cs(_), D = h[_]?._zod?.optout === "optional";
15238
+ m.write(`const ${T} = ${g(_)};`), D ? m.write(`
15239
15239
  if (${T}.issues.length) {
15240
- if (${_} in input) {
15240
+ if (${S} in input) {
15241
15241
  payload.issues = payload.issues.concat(${T}.issues.map(iss => ({
15242
15242
  ...iss,
15243
- path: iss.path ? [${_}, ...iss.path] : [${_}]
15243
+ path: iss.path ? [${S}, ...iss.path] : [${S}]
15244
15244
  })));
15245
15245
  }
15246
15246
  }
15247
15247
 
15248
15248
  if (${T}.value === undefined) {
15249
- if (${_} in input) {
15250
- newResult[${_}] = undefined;
15249
+ if (${S} in input) {
15250
+ newResult[${S}] = undefined;
15251
15251
  }
15252
15252
  } else {
15253
- newResult[${_}] = ${T}.value;
15253
+ newResult[${S}] = ${T}.value;
15254
15254
  }
15255
15255
 
15256
15256
  `) : m.write(`
15257
15257
  if (${T}.issues.length) {
15258
15258
  payload.issues = payload.issues.concat(${T}.issues.map(iss => ({
15259
15259
  ...iss,
15260
- path: iss.path ? [${_}, ...iss.path] : [${_}]
15260
+ path: iss.path ? [${S}, ...iss.path] : [${S}]
15261
15261
  })));
15262
15262
  }
15263
15263
 
15264
15264
  if (${T}.value === undefined) {
15265
- if (${_} in input) {
15266
- newResult[${_}] = undefined;
15265
+ if (${S} in input) {
15266
+ newResult[${S}] = undefined;
15267
15267
  }
15268
15268
  } else {
15269
- newResult[${_}] = ${T}.value;
15269
+ newResult[${S}] = ${T}.value;
15270
15270
  }
15271
15271
 
15272
15272
  `);
15273
15273
  }
15274
15274
  m.write("payload.value = newResult;"), m.write("return payload;");
15275
15275
  const v = m.compile();
15276
- return (S, T) => v(h, S, T);
15276
+ return (_, T) => v(h, _, T);
15277
15277
  };
15278
15278
  let a;
15279
15279
  const r = Di, o = !Yr.jitless, l = o && qu.value, u = e.catchall;
@@ -15289,11 +15289,11 @@ const kh = /* @__PURE__ */ E("$ZodObject", (s, e) => {
15289
15289
  }), h);
15290
15290
  };
15291
15291
  });
15292
- function ks(s, e, t, i) {
15292
+ function Ms(s, e, t, i) {
15293
15293
  for (const a of s)
15294
15294
  if (a.issues.length === 0)
15295
15295
  return e.value = a.value, e;
15296
- const n = s.filter((a) => !At(a));
15296
+ const n = s.filter((a) => !kt(a));
15297
15297
  return n.length === 1 ? (e.value = n[0].value, n[0]) : (e.issues.push({
15298
15298
  code: "invalid_union",
15299
15299
  input: e.value,
@@ -15330,7 +15330,7 @@ const Dh = /* @__PURE__ */ E("$ZodUnion", (s, e) => {
15330
15330
  o.push(l);
15331
15331
  }
15332
15332
  }
15333
- return r ? Promise.all(o).then((c) => ks(c, n, s, a)) : ks(o, n, s, a);
15333
+ return r ? Promise.all(o).then((c) => Ms(c, n, s, a)) : Ms(o, n, s, a);
15334
15334
  };
15335
15335
  }), Eh = /* @__PURE__ */ E("$ZodIntersection", (s, e) => {
15336
15336
  he.init(s, e), s._zod.parse = (t, i) => {
@@ -15390,7 +15390,7 @@ function Is(s, e, t) {
15390
15390
  else
15391
15391
  s.issues.push(o);
15392
15392
  const a = [...i].filter(([, o]) => o.l && o.r).map(([o]) => o);
15393
- if (a.length && n && s.issues.push({ ...n, keys: a }), At(s))
15393
+ if (a.length && n && s.issues.push({ ...n, keys: a }), kt(s))
15394
15394
  return s;
15395
15395
  const r = Nn(e.value, t.value);
15396
15396
  if (!r.valid)
@@ -15416,8 +15416,8 @@ const xh = /* @__PURE__ */ E("$ZodRecord", (s, e) => {
15416
15416
  o.add(typeof l == "number" ? l.toString() : l);
15417
15417
  const u = e.valueType._zod.run({ value: n[l], issues: [] }, i);
15418
15418
  u instanceof Promise ? a.push(u.then((d) => {
15419
- d.issues.length && t.issues.push(...Mt(l, d.issues)), t.value[l] = d.value;
15420
- })) : (u.issues.length && t.issues.push(...Mt(l, u.issues)), t.value[l] = u.value);
15419
+ d.issues.length && t.issues.push(...At(l, d.issues)), t.value[l] = d.value;
15420
+ })) : (u.issues.length && t.issues.push(...At(l, u.issues)), t.value[l] = u.value);
15421
15421
  }
15422
15422
  let c;
15423
15423
  for (const l in n)
@@ -15455,8 +15455,8 @@ const xh = /* @__PURE__ */ E("$ZodRecord", (s, e) => {
15455
15455
  }
15456
15456
  const u = e.valueType._zod.run({ value: n[o], issues: [] }, i);
15457
15457
  u instanceof Promise ? a.push(u.then((d) => {
15458
- d.issues.length && t.issues.push(...Mt(o, d.issues)), t.value[c.value] = d.value;
15459
- })) : (u.issues.length && t.issues.push(...Mt(o, u.issues)), t.value[c.value] = u.value);
15458
+ d.issues.length && t.issues.push(...At(o, d.issues)), t.value[c.value] = d.value;
15459
+ })) : (u.issues.length && t.issues.push(...At(o, u.issues)), t.value[c.value] = u.value);
15460
15460
  }
15461
15461
  }
15462
15462
  return a.length ? Promise.all(a).then(() => t) : t;
@@ -15481,7 +15481,7 @@ const xh = /* @__PURE__ */ E("$ZodRecord", (s, e) => {
15481
15481
  if (i.async)
15482
15482
  return (n instanceof Promise ? n : Promise.resolve(n)).then((r) => (t.value = r, t));
15483
15483
  if (n instanceof Promise)
15484
- throw new kt();
15484
+ throw new Mt();
15485
15485
  return t.value = n, t;
15486
15486
  };
15487
15487
  });
@@ -16041,7 +16041,7 @@ function Cm(s) {
16041
16041
  });
16042
16042
  }
16043
16043
  // @__NO_SIDE_EFFECTS__
16044
- function Am(s, e) {
16044
+ function km(s, e) {
16045
16045
  return new Ud({
16046
16046
  check: "string_format",
16047
16047
  format: "includes",
@@ -16050,7 +16050,7 @@ function Am(s, e) {
16050
16050
  });
16051
16051
  }
16052
16052
  // @__NO_SIDE_EFFECTS__
16053
- function Mm(s, e) {
16053
+ function Am(s, e) {
16054
16054
  return new Vd({
16055
16055
  check: "string_format",
16056
16056
  format: "starts_with",
@@ -16059,7 +16059,7 @@ function Mm(s, e) {
16059
16059
  });
16060
16060
  }
16061
16061
  // @__NO_SIDE_EFFECTS__
16062
- function km(s, e) {
16062
+ function Mm(s, e) {
16063
16063
  return new jd({
16064
16064
  check: "string_format",
16065
16065
  format: "ends_with",
@@ -16567,7 +16567,7 @@ const ff = (s, e) => {
16567
16567
  });
16568
16568
  }, Oe = E("ZodError", ff, {
16569
16569
  Parent: Error
16570
- }), gf = /* @__PURE__ */ na(Oe), pf = /* @__PURE__ */ aa(Oe), yf = /* @__PURE__ */ Li(Oe), vf = /* @__PURE__ */ zi(Oe), bf = /* @__PURE__ */ ad(Oe), wf = /* @__PURE__ */ sd(Oe), Sf = /* @__PURE__ */ rd(Oe), _f = /* @__PURE__ */ od(Oe), Tf = /* @__PURE__ */ cd(Oe), Cf = /* @__PURE__ */ ld(Oe), Af = /* @__PURE__ */ ud(Oe), Mf = /* @__PURE__ */ dd(Oe), me = /* @__PURE__ */ E("ZodType", (s, e) => (he.init(s, e), Object.assign(s["~standard"], {
16570
+ }), gf = /* @__PURE__ */ na(Oe), pf = /* @__PURE__ */ aa(Oe), yf = /* @__PURE__ */ Li(Oe), vf = /* @__PURE__ */ zi(Oe), bf = /* @__PURE__ */ ad(Oe), wf = /* @__PURE__ */ sd(Oe), Sf = /* @__PURE__ */ rd(Oe), _f = /* @__PURE__ */ od(Oe), Tf = /* @__PURE__ */ cd(Oe), Cf = /* @__PURE__ */ ld(Oe), kf = /* @__PURE__ */ ud(Oe), Af = /* @__PURE__ */ dd(Oe), me = /* @__PURE__ */ E("ZodType", (s, e) => (he.init(s, e), Object.assign(s["~standard"], {
16571
16571
  jsonSchema: {
16572
16572
  input: Ri(s, "input"),
16573
16573
  output: Ri(s, "output")
@@ -16579,7 +16579,7 @@ const ff = (s, e) => {
16579
16579
  ]
16580
16580
  }), {
16581
16581
  parent: !0
16582
- }), s.with = s.check, s.clone = (t, i) => ut(s, t, i), s.brand = () => s, s.register = ((t, i) => (t.add(s, i), s)), s.parse = (t, i) => gf(s, t, i, { callee: s.parse }), s.safeParse = (t, i) => yf(s, t, i), s.parseAsync = async (t, i) => pf(s, t, i, { callee: s.parseAsync }), s.safeParseAsync = async (t, i) => vf(s, t, i), s.spa = s.safeParseAsync, s.encode = (t, i) => bf(s, t, i), s.decode = (t, i) => wf(s, t, i), s.encodeAsync = async (t, i) => Sf(s, t, i), s.decodeAsync = async (t, i) => _f(s, t, i), s.safeEncode = (t, i) => Tf(s, t, i), s.safeDecode = (t, i) => Cf(s, t, i), s.safeEncodeAsync = async (t, i) => Af(s, t, i), s.safeDecodeAsync = async (t, i) => Mf(s, t, i), s.refine = (t, i) => s.check(vg(t, i)), s.superRefine = (t) => s.check(bg(t)), s.overwrite = (t) => s.check(/* @__PURE__ */ Et(t)), s.optional = () => Hs(s), s.exactOptional = () => sg(s), s.nullable = () => qs(s), s.nullish = () => Hs(qs(s)), s.nonoptional = (t) => dg(s, t), s.array = () => Te(s), s.or = (t) => ra([s, t]), s.and = (t) => eg(s, t), s.transform = (t) => Gs(s, ng(t)), s.default = (t) => cg(s, t), s.prefault = (t) => ug(s, t), s.catch = (t) => mg(s, t), s.pipe = (t) => Gs(s, t), s.readonly = () => pg(s), s.describe = (t) => {
16582
+ }), s.with = s.check, s.clone = (t, i) => ut(s, t, i), s.brand = () => s, s.register = ((t, i) => (t.add(s, i), s)), s.parse = (t, i) => gf(s, t, i, { callee: s.parse }), s.safeParse = (t, i) => yf(s, t, i), s.parseAsync = async (t, i) => pf(s, t, i, { callee: s.parseAsync }), s.safeParseAsync = async (t, i) => vf(s, t, i), s.spa = s.safeParseAsync, s.encode = (t, i) => bf(s, t, i), s.decode = (t, i) => wf(s, t, i), s.encodeAsync = async (t, i) => Sf(s, t, i), s.decodeAsync = async (t, i) => _f(s, t, i), s.safeEncode = (t, i) => Tf(s, t, i), s.safeDecode = (t, i) => Cf(s, t, i), s.safeEncodeAsync = async (t, i) => kf(s, t, i), s.safeDecodeAsync = async (t, i) => Af(s, t, i), s.refine = (t, i) => s.check(vg(t, i)), s.superRefine = (t) => s.check(bg(t)), s.overwrite = (t) => s.check(/* @__PURE__ */ Et(t)), s.optional = () => Hs(s), s.exactOptional = () => sg(s), s.nullable = () => qs(s), s.nullish = () => Hs(qs(s)), s.nonoptional = (t) => dg(s, t), s.array = () => Te(s), s.or = (t) => ra([s, t]), s.and = (t) => eg(s, t), s.transform = (t) => Gs(s, ng(t)), s.default = (t) => cg(s, t), s.prefault = (t) => ug(s, t), s.catch = (t) => mg(s, t), s.pipe = (t) => Gs(s, t), s.readonly = () => pg(s), s.describe = (t) => {
16583
16583
  const i = s.clone();
16584
16584
  return zt.add(i, { description: t }), i;
16585
16585
  }, Object.defineProperty(s, "description", {
@@ -16595,12 +16595,12 @@ const ff = (s, e) => {
16595
16595
  }, s.isOptional = () => s.safeParse(void 0).success, s.isNullable = () => s.safeParse(null).success, s.apply = (t) => t(s), s)), So = /* @__PURE__ */ E("_ZodString", (s, e) => {
16596
16596
  sa.init(s, e), me.init(s, e), s._zod.processJSONSchema = (i, n, a) => Lm(s, i, n);
16597
16597
  const t = s._zod.bag;
16598
- s.format = t.format ?? null, s.minLength = t.minimum ?? null, s.maxLength = t.maximum ?? null, s.regex = (...i) => s.check(/* @__PURE__ */ _m(...i)), s.includes = (...i) => s.check(/* @__PURE__ */ Am(...i)), s.startsWith = (...i) => s.check(/* @__PURE__ */ Mm(...i)), s.endsWith = (...i) => s.check(/* @__PURE__ */ km(...i)), s.min = (...i) => s.check(/* @__PURE__ */ xi(...i)), s.max = (...i) => s.check(/* @__PURE__ */ go(...i)), s.length = (...i) => s.check(/* @__PURE__ */ po(...i)), s.nonempty = (...i) => s.check(/* @__PURE__ */ xi(1, ...i)), s.lowercase = (i) => s.check(/* @__PURE__ */ Tm(i)), s.uppercase = (i) => s.check(/* @__PURE__ */ Cm(i)), s.trim = () => s.check(/* @__PURE__ */ Dm()), s.normalize = (...i) => s.check(/* @__PURE__ */ Im(...i)), s.toLowerCase = () => s.check(/* @__PURE__ */ Em()), s.toUpperCase = () => s.check(/* @__PURE__ */ xm()), s.slugify = () => s.check(/* @__PURE__ */ Rm());
16599
- }), kf = /* @__PURE__ */ E("ZodString", (s, e) => {
16598
+ s.format = t.format ?? null, s.minLength = t.minimum ?? null, s.maxLength = t.maximum ?? null, s.regex = (...i) => s.check(/* @__PURE__ */ _m(...i)), s.includes = (...i) => s.check(/* @__PURE__ */ km(...i)), s.startsWith = (...i) => s.check(/* @__PURE__ */ Am(...i)), s.endsWith = (...i) => s.check(/* @__PURE__ */ Mm(...i)), s.min = (...i) => s.check(/* @__PURE__ */ xi(...i)), s.max = (...i) => s.check(/* @__PURE__ */ go(...i)), s.length = (...i) => s.check(/* @__PURE__ */ po(...i)), s.nonempty = (...i) => s.check(/* @__PURE__ */ xi(1, ...i)), s.lowercase = (i) => s.check(/* @__PURE__ */ Tm(i)), s.uppercase = (i) => s.check(/* @__PURE__ */ Cm(i)), s.trim = () => s.check(/* @__PURE__ */ Dm()), s.normalize = (...i) => s.check(/* @__PURE__ */ Im(...i)), s.toLowerCase = () => s.check(/* @__PURE__ */ Em()), s.toUpperCase = () => s.check(/* @__PURE__ */ xm()), s.slugify = () => s.check(/* @__PURE__ */ Rm());
16599
+ }), Mf = /* @__PURE__ */ E("ZodString", (s, e) => {
16600
16600
  sa.init(s, e), So.init(s, e), s.email = (t) => s.check(/* @__PURE__ */ Vh(If, t)), s.url = (t) => s.check(/* @__PURE__ */ Xh(Df, t)), s.jwt = (t) => s.check(/* @__PURE__ */ hm(Gf, t)), s.emoji = (t) => s.check(/* @__PURE__ */ Jh(Ef, t)), s.guid = (t) => s.check(/* @__PURE__ */ Ns(Ls, t)), s.uuid = (t) => s.check(/* @__PURE__ */ jh(pi, t)), s.uuidv4 = (t) => s.check(/* @__PURE__ */ Kh(pi, t)), s.uuidv6 = (t) => s.check(/* @__PURE__ */ Yh(pi, t)), s.uuidv7 = (t) => s.check(/* @__PURE__ */ Zh(pi, t)), s.nanoid = (t) => s.check(/* @__PURE__ */ Qh(xf, t)), s.guid = (t) => s.check(/* @__PURE__ */ Ns(Ls, t)), s.cuid = (t) => s.check(/* @__PURE__ */ em(Rf, t)), s.cuid2 = (t) => s.check(/* @__PURE__ */ tm(Pf, t)), s.ulid = (t) => s.check(/* @__PURE__ */ im(Bf, t)), s.base64 = (t) => s.check(/* @__PURE__ */ lm(Wf, t)), s.base64url = (t) => s.check(/* @__PURE__ */ um(Hf, t)), s.xid = (t) => s.check(/* @__PURE__ */ nm(Nf, t)), s.ksuid = (t) => s.check(/* @__PURE__ */ am(Ff, t)), s.ipv4 = (t) => s.check(/* @__PURE__ */ sm($f, t)), s.ipv6 = (t) => s.check(/* @__PURE__ */ rm(Of, t)), s.cidrv4 = (t) => s.check(/* @__PURE__ */ om(Lf, t)), s.cidrv6 = (t) => s.check(/* @__PURE__ */ cm(zf, t)), s.e164 = (t) => s.check(/* @__PURE__ */ dm(qf, t)), s.datetime = (t) => s.check(of(t)), s.date = (t) => s.check(lf(t)), s.time = (t) => s.check(df(t)), s.duration = (t) => s.check(mf(t));
16601
16601
  });
16602
16602
  function G(s) {
16603
- return /* @__PURE__ */ Uh(kf, s);
16603
+ return /* @__PURE__ */ Uh(Mf, s);
16604
16604
  }
16605
16605
  const de = /* @__PURE__ */ E("ZodStringFormat", (s, e) => {
16606
16606
  ce.init(s, e), So.init(s, e);
@@ -16669,19 +16669,19 @@ function Ws() {
16669
16669
  return /* @__PURE__ */ wm(jf);
16670
16670
  }
16671
16671
  const Kf = /* @__PURE__ */ E("ZodNever", (s, e) => {
16672
- Ah.init(s, e), me.init(s, e), s._zod.processJSONSchema = (t, i, n) => Hm(s, t, i);
16672
+ kh.init(s, e), me.init(s, e), s._zod.processJSONSchema = (t, i, n) => Hm(s, t, i);
16673
16673
  });
16674
16674
  function Yf(s) {
16675
16675
  return /* @__PURE__ */ Sm(Kf, s);
16676
16676
  }
16677
16677
  const Zf = /* @__PURE__ */ E("ZodArray", (s, e) => {
16678
- Mh.init(s, e), me.init(s, e), s._zod.processJSONSchema = (t, i, n) => jm(s, t, i, n), s.element = e.element, s.min = (t, i) => s.check(/* @__PURE__ */ xi(t, i)), s.nonempty = (t) => s.check(/* @__PURE__ */ xi(1, t)), s.max = (t, i) => s.check(/* @__PURE__ */ go(t, i)), s.length = (t, i) => s.check(/* @__PURE__ */ po(t, i)), s.unwrap = () => s.element;
16678
+ Ah.init(s, e), me.init(s, e), s._zod.processJSONSchema = (t, i, n) => jm(s, t, i, n), s.element = e.element, s.min = (t, i) => s.check(/* @__PURE__ */ xi(t, i)), s.nonempty = (t) => s.check(/* @__PURE__ */ xi(1, t)), s.max = (t, i) => s.check(/* @__PURE__ */ go(t, i)), s.length = (t, i) => s.check(/* @__PURE__ */ po(t, i)), s.unwrap = () => s.element;
16679
16679
  });
16680
16680
  function Te(s, e) {
16681
16681
  return /* @__PURE__ */ Pm(Zf, s, e);
16682
16682
  }
16683
16683
  const Xf = /* @__PURE__ */ E("ZodObject", (s, e) => {
16684
- Ih.init(s, e), me.init(s, e), s._zod.processJSONSchema = (t, i, n) => Km(s, t, i, n), ae(s, "shape", () => e.shape), s.keyof = () => Ai(Object.keys(s._zod.def.shape)), s.catchall = (t) => s.clone({ ...s._zod.def, catchall: t }), s.passthrough = () => s.clone({ ...s._zod.def, catchall: Ws() }), s.loose = () => s.clone({ ...s._zod.def, catchall: Ws() }), s.strict = () => s.clone({ ...s._zod.def, catchall: Yf() }), s.strip = () => s.clone({ ...s._zod.def, catchall: void 0 }), s.extend = (t) => Yu(s, t), s.safeExtend = (t) => Zu(s, t), s.merge = (t) => Xu(s, t), s.pick = (t) => ju(s, t), s.omit = (t) => Ku(s, t), s.partial = (...t) => Ju(To, s, t[0]), s.required = (...t) => Qu(Co, s, t[0]);
16684
+ Ih.init(s, e), me.init(s, e), s._zod.processJSONSchema = (t, i, n) => Km(s, t, i, n), ae(s, "shape", () => e.shape), s.keyof = () => ki(Object.keys(s._zod.def.shape)), s.catchall = (t) => s.clone({ ...s._zod.def, catchall: t }), s.passthrough = () => s.clone({ ...s._zod.def, catchall: Ws() }), s.loose = () => s.clone({ ...s._zod.def, catchall: Ws() }), s.strict = () => s.clone({ ...s._zod.def, catchall: Yf() }), s.strip = () => s.clone({ ...s._zod.def, catchall: void 0 }), s.extend = (t) => Yu(s, t), s.safeExtend = (t) => Zu(s, t), s.merge = (t) => Xu(s, t), s.pick = (t) => ju(s, t), s.omit = (t) => Ku(s, t), s.partial = (...t) => Ju(To, s, t[0]), s.required = (...t) => Qu(Co, s, t[0]);
16685
16685
  });
16686
16686
  function re(s, e) {
16687
16687
  const t = {
@@ -16753,7 +16753,7 @@ const $n = /* @__PURE__ */ E("ZodEnum", (s, e) => {
16753
16753
  });
16754
16754
  };
16755
16755
  });
16756
- function Ai(s, e) {
16756
+ function ki(s, e) {
16757
16757
  const t = Array.isArray(s) ? Object.fromEntries(s.map((i) => [i, i])) : s;
16758
16758
  return new $n({
16759
16759
  type: "enum",
@@ -16952,8 +16952,8 @@ const wg = et.map((s) => s), Sg = re({
16952
16952
  CHA: z().min(1).max(20)
16953
16953
  }), Nb = re({
16954
16954
  name: G(),
16955
- race: Ai(["Human", "Elf", "Dwarf", "Halfling", "Dragonborn", "Gnome", "Half-Elf", "Half-Orc", "Tiefling"]),
16956
- class: Ai(wg),
16955
+ race: ki(["Human", "Elf", "Dwarf", "Halfling", "Dragonborn", "Gnome", "Half-Elf", "Half-Orc", "Tiefling"]),
16956
+ class: ki(wg),
16957
16957
  level: z().min(1).max(20),
16958
16958
  ability_scores: Us,
16959
16959
  ability_modifiers: Us,
@@ -16966,7 +16966,7 @@ const wg = et.map((s) => s), Sg = re({
16966
16966
  armor_class: z().positive(),
16967
16967
  initiative: z(),
16968
16968
  speed: z().positive(),
16969
- skills: Ci(G(), Ai(["none", "proficient", "expertise"])),
16969
+ skills: Ci(G(), ki(["none", "proficient", "expertise"])),
16970
16970
  saving_throws: Ci(G(), Fn()),
16971
16971
  racial_traits: Te(G()),
16972
16972
  class_features: Te(G()),
@@ -17398,7 +17398,7 @@ function ca(s) {
17398
17398
  }
17399
17399
  return null;
17400
17400
  }
17401
- function Ao(s) {
17401
+ function ko(s) {
17402
17402
  if ("image_thumb_url" in s && typeof s.image_thumb_url == "string")
17403
17403
  return s.image_thumb_url;
17404
17404
  if ("metadata" in s) {
@@ -17408,7 +17408,7 @@ function Ao(s) {
17408
17408
  }
17409
17409
  return null;
17410
17410
  }
17411
- function Mo(s) {
17411
+ function Ao(s) {
17412
17412
  if ("audio_url" in s)
17413
17413
  return null;
17414
17414
  if ("metadata" in s) {
@@ -17519,7 +17519,7 @@ function Gb(s) {
17519
17519
  function Ub(s) {
17520
17520
  const e = [];
17521
17521
  for (const t of s.tracks) {
17522
- const i = oa(t), n = ca(t), a = Ao(t);
17522
+ const i = oa(t), n = ca(t), a = ko(t);
17523
17523
  let r = "", o = "";
17524
17524
  if ("title" in t)
17525
17525
  r = t.title || "", o = t.artist || "";
@@ -17583,7 +17583,7 @@ function Vb(s) {
17583
17583
  function jb(s) {
17584
17584
  const e = [];
17585
17585
  for (const t of s.tracks) {
17586
- const i = Mo(t);
17586
+ const i = Ao(t);
17587
17587
  i && e.push(i);
17588
17588
  }
17589
17589
  return e;
@@ -17591,9 +17591,9 @@ function jb(s) {
17591
17591
  function Kb(s) {
17592
17592
  const e = [];
17593
17593
  for (const t of s.tracks) {
17594
- const i = Mo(t);
17594
+ const i = Ao(t);
17595
17595
  if (!i) continue;
17596
- const n = oa(t), a = ca(t), r = Ao(t);
17596
+ const n = oa(t), a = ca(t), r = ko(t);
17597
17597
  let o = "", c = "";
17598
17598
  if ("title" in t)
17599
17599
  o = t.title || "", c = t.artist || "";
@@ -17612,7 +17612,7 @@ function Kb(s) {
17612
17612
  }
17613
17613
  return e;
17614
17614
  }
17615
- const ko = [
17615
+ const Mo = [
17616
17616
  { host: "arweave.net", protocol: "https", priority: 3 },
17617
17617
  { host: "ardrive.net", protocol: "https", priority: 2 },
17618
17618
  { host: "turbo-gateway.com", protocol: "https", priority: 1 }
@@ -17675,31 +17675,31 @@ function Nt(s) {
17675
17675
  function qe(s, e, t = "") {
17676
17676
  return `${e.protocol || "https"}://${e.host}/${s}${t}`;
17677
17677
  }
17678
- function Yb(s, e = ko, t = "") {
17678
+ function Yb(s, e = Mo, t = "") {
17679
17679
  return e.sort((i, n) => i.priority - n.priority).map((i) => qe(s, i, t));
17680
17680
  }
17681
- async function Ag() {
17681
+ async function kg() {
17682
17682
  try {
17683
17683
  return await import("@ar.io/wayfinder-core");
17684
17684
  } catch {
17685
17685
  return null;
17686
17686
  }
17687
17687
  }
17688
- async function Mg() {
17688
+ async function Ag() {
17689
17689
  try {
17690
17690
  return await import("@ar.io/sdk");
17691
17691
  } catch {
17692
17692
  return null;
17693
17693
  }
17694
17694
  }
17695
- const kg = "https://solana-rpc.publicnode.com", Ig = 5e3, Dg = 864e5, hn = "arweave_active_gateway", mn = "arweave_ranked_gateways";
17695
+ const Mg = "https://solana-rpc.publicnode.com", Ig = 5e3, Dg = 864e5, hn = "arweave_active_gateway", mn = "arweave_ranked_gateways";
17696
17696
  class Eg {
17697
17697
  constructor(e) {
17698
- this.cache = /* @__PURE__ */ new Map(), this.logger = Se.for("ArweaveGateway"), this.hitCount = 0, this.missCount = 0, this.healthData = /* @__PURE__ */ new Map(), this.originalPriorities = /* @__PURE__ */ new Map(), this.MAX_HEALTH_RECORDS = 50, this.inflightResolves = /* @__PURE__ */ new Map(), this.inflightControllers = /* @__PURE__ */ new Map(), this.wayfinder = null, this.wayfinderGatewaysProvider = null, this.rankedGatewaysCache = null, this.rankedGatewaysCacheTimestamp = 0, this.RANKED_GATEWAYS_TTL_MS = 7200 * 1e3, this.activeGateway = null, this.lastFetchTiming = 0, this.consecutiveSlowResponses = 0, this.gateways = (e?.gateways ?? ko).map((i) => ({ ...i })), this.timeout = e?.timeout ?? Ig, this.cacheTTL = e?.cacheTTL ?? Dg, this.slowResponseThreshold = e?.slowResponseThreshold ?? 8e3, this.maxSlowResponses = e?.maxSlowResponses ?? 3, this.solanaRpcUrl = e?.solanaRpcUrl ?? kg, this.hasCustomSolanaRpc = typeof e?.solanaRpcUrl == "string" && e.solanaRpcUrl.length > 0, this.wayfinderSortBy = e?.wayfinderSortBy ?? "weights.compositeWeight", this.wayfinderPrimaryLimit = e?.wayfinderPrimaryLimit ?? 50, this.wayfinderFallbackLimit = e?.wayfinderFallbackLimit ?? 100, this.wayfinderStrategy = e?.wayfinderStrategy ?? "composite-ping-random", this.gateways.sort((i, n) => i.priority - n.priority), this.gateways.forEach((i) => {
17698
+ this.cache = /* @__PURE__ */ new Map(), this.logger = Se.for("ArweaveGateway"), this.hitCount = 0, this.missCount = 0, this.healthData = /* @__PURE__ */ new Map(), this.originalPriorities = /* @__PURE__ */ new Map(), this.MAX_HEALTH_RECORDS = 50, this.inflightResolves = /* @__PURE__ */ new Map(), this.inflightControllers = /* @__PURE__ */ new Map(), this.wayfinder = null, this.wayfinderGatewaysProvider = null, this.rankedGatewaysCache = null, this.rankedGatewaysCacheTimestamp = 0, this.RANKED_GATEWAYS_TTL_MS = 1440 * 60 * 1e3, this.activeGateway = null, this.lastFetchTiming = 0, this.consecutiveSlowResponses = 0, this.gateways = (e?.gateways ?? Mo).map((i) => ({ ...i })), this.timeout = e?.timeout ?? Ig, this.cacheTTL = e?.cacheTTL ?? Dg, this.slowResponseThreshold = e?.slowResponseThreshold ?? 8e3, this.maxSlowResponses = e?.maxSlowResponses ?? 3, this.solanaRpcUrl = e?.solanaRpcUrl ?? Mg, this.hasCustomSolanaRpc = typeof e?.solanaRpcUrl == "string" && e.solanaRpcUrl.length > 0, this.wayfinderSortBy = e?.wayfinderSortBy ?? "weights.compositeWeight", this.wayfinderPrimaryLimit = e?.wayfinderPrimaryLimit ?? 50, this.wayfinderFallbackLimit = e?.wayfinderFallbackLimit ?? 100, this.wayfinderStrategy = e?.wayfinderStrategy ?? "composite-ping-random", this.gateways.sort((i, n) => i.priority - n.priority), this.gateways.forEach((i) => {
17699
17699
  this.originalPriorities.set(i.host, i.priority);
17700
17700
  }), this.activeGateway = this.loadPersistedGateway();
17701
17701
  const t = this.loadPersistedRankedGateways();
17702
- t && (this.rankedGatewaysCache = t), Promise.all([Ag(), Mg(), import("./index.browser-CVv08iVS.js")]).then(([i, n, a]) => {
17702
+ t && (this.rankedGatewaysCache = t), Promise.all([kg(), Ag(), import("./index.browser-CVv08iVS.js")]).then(([i, n, a]) => {
17703
17703
  if (i && n)
17704
17704
  try {
17705
17705
  const {
@@ -17708,15 +17708,19 @@ class Eg {
17708
17708
  CompositeRoutingStrategy: c,
17709
17709
  RoundRobinRoutingStrategy: l,
17710
17710
  NetworkGatewaysProvider: u
17711
- } = i, d = n.ARIO, h = a.createSolanaRpc(this.solanaRpcUrl), m = d.init({ rpc: h }), f = new u({
17712
- ario: m,
17713
- sortBy: this.wayfinderSortBy,
17714
- limit: this.wayfinderPrimaryLimit
17715
- }), g = new u({
17716
- ario: m,
17717
- sortBy: this.wayfinderSortBy,
17718
- limit: this.wayfinderFallbackLimit
17719
- });
17711
+ } = i, d = n.ARIO, h = a.createSolanaRpc(this.solanaRpcUrl), m = d.init({ rpc: h }), f = this.wrapProviderWithCache(
17712
+ new u({
17713
+ ario: m,
17714
+ sortBy: this.wayfinderSortBy,
17715
+ limit: this.wayfinderPrimaryLimit
17716
+ })
17717
+ ), g = this.wrapProviderWithCache(
17718
+ new u({
17719
+ ario: m,
17720
+ sortBy: this.wayfinderSortBy,
17721
+ limit: this.wayfinderFallbackLimit
17722
+ })
17723
+ );
17720
17724
  this.wayfinderGatewaysProvider = f;
17721
17725
  const p = (() => {
17722
17726
  switch (this.wayfinderStrategy) {
@@ -17771,6 +17775,40 @@ class Eg {
17771
17775
  );
17772
17776
  });
17773
17777
  }
17778
+ /**
17779
+ * Wrap a raw upstream gateways provider (NetworkGatewaysProvider) in a
17780
+ * long-TTL cache. This is the single lever that keeps us off the Solana
17781
+ * RPC (Helius): every Wayfinder routing strategy and the ranked walk in
17782
+ * tryWayfinder() read through this wrapper, so the upstream is queried at
17783
+ * most once per RANKED_GATEWAYS_TTL_MS regardless of how many resolves fail.
17784
+ *
17785
+ * Behaviour:
17786
+ * - Fresh cache → return immediately, no network.
17787
+ * - Cache miss → one upstream fetch; concurrent callers share the in-flight
17788
+ * promise (dedupe) so we never fire two fetches for the same refresh.
17789
+ * - Fetch fails → serve the stale in-memory list if present (better than
17790
+ * empty); otherwise let the upstream's [] fall through. This keeps a
17791
+ * Helius rate-limit blip from restarting the hammering.
17792
+ * - On success → write to both in-memory cache and localStorage so the
17793
+ * list survives reloads.
17794
+ */
17795
+ wrapProviderWithCache(e) {
17796
+ let t = null, i = 0, n = null;
17797
+ const a = () => t !== null && t.length > 0 && Date.now() < i, o = this.loadPersistedRankedGateways();
17798
+ return o && o.length > 0 && (t = o, i = (this.rankedGatewaysCacheTimestamp || Date.now()) + this.RANKED_GATEWAYS_TTL_MS), {
17799
+ getGateways: async () => a() ? t : n || (n = (async () => {
17800
+ try {
17801
+ const c = await e.getGateways();
17802
+ return c && c.length > 0 && (t = c, i = Date.now() + this.RANKED_GATEWAYS_TTL_MS, this.rankedGatewaysCacheTimestamp = Date.now(), this.rankedGatewaysCache = c, this.persistRankedGateways(c, this.rankedGatewaysCacheTimestamp)), c;
17803
+ } catch (c) {
17804
+ if (this.logger.warn("Ranked gateway fetch failed, serving stale list", { error: c }), t && t.length > 0) return t;
17805
+ throw c;
17806
+ } finally {
17807
+ n = null;
17808
+ }
17809
+ })(), n)
17810
+ };
17811
+ }
17774
17812
  /**
17775
17813
  * Resolve an Arweave URL to a gateway URL using the active gateway, with no network checks.
17776
17814
  *
@@ -17887,49 +17925,60 @@ class Eg {
17887
17925
  */
17888
17926
  async resolveGatewayChain(e, t, i, n, a) {
17889
17927
  const r = Date.now(), o = a?.bypassArweaveNet ?? !1;
17890
- let c = null;
17928
+ let c = null, l = null;
17891
17929
  if (e.startsWith("https://") || e.startsWith("http://"))
17892
17930
  try {
17893
- const f = new URL(e), g = {
17894
- host: f.host,
17931
+ const g = new URL(e), p = {
17932
+ host: g.host,
17895
17933
  // includes port if present
17896
- protocol: f.protocol.replace(":", ""),
17934
+ protocol: g.protocol.replace(":", ""),
17897
17935
  priority: 0
17898
- }, p = Date.now(), y = await this.checkAndSetGateway(e, t, i, g, n), v = Date.now() - p;
17899
- if (y)
17900
- return this.logger.info("[gateway] Step 0 (original): success", { host: g.host, ms: v, totalMs: Date.now() - r }), y;
17901
- this.logger.info("[gateway] Step 0 (original): failed", { host: g.host, ms: v }), c = g.host;
17936
+ }, y = Date.now(), v = await this.checkAndSetGateway(e, t, i, p, n), _ = Date.now() - y;
17937
+ if (v) {
17938
+ if (this.logger.info(`[gateway] Step 0 (original): ${v.kind}`, { host: p.host, ms: _, totalMs: Date.now() - r }), v.kind === "verified") return v.url;
17939
+ l ??= v.url;
17940
+ } else
17941
+ this.logger.info("[gateway] Step 0 (original): failed", { host: p.host, ms: _ });
17942
+ c = p.host;
17902
17943
  } catch {
17903
17944
  }
17904
17945
  if (this.activeGateway && this.activeGateway.host !== c) {
17905
- const f = Date.now(), g = await this.checkAndSetGateway(e, t, i, this.activeGateway, n), p = Date.now() - f;
17906
- if (g)
17907
- return this.logger.info("[gateway] Step 1 (persisted): success", { host: this.activeGateway.host, ms: p, totalMs: Date.now() - r }), g;
17908
- this.logger.info("[gateway] Step 1 (persisted): failed, clearing", { ms: p }), this.activeGateway = null, this.clearPersistedGateway();
17946
+ const g = Date.now(), p = await this.checkAndSetGateway(e, t, i, this.activeGateway, n), y = Date.now() - g;
17947
+ if (p) {
17948
+ if (this.logger.info(`[gateway] Step 1 (persisted): ${p.kind}`, { host: this.activeGateway.host, ms: y, totalMs: Date.now() - r }), p.kind === "verified") return p.url;
17949
+ l ??= p.url;
17950
+ } else
17951
+ this.logger.info("[gateway] Step 1 (persisted): failed, clearing", { ms: y }), this.activeGateway = null, this.clearPersistedGateway();
17909
17952
  }
17910
17953
  if (!o && c !== "arweave.net") {
17911
- const f = this.gateways.find((g) => g.host === "arweave.net");
17912
- if (f) {
17913
- const g = Date.now(), p = await this.checkAndSetGateway(e, t, i, f, n), y = Date.now() - g;
17914
- if (p)
17915
- return this.logger.info("[gateway] Step 2 (arweave.net): success", { ms: y, totalMs: Date.now() - r }), p;
17916
- this.logger.info("[gateway] Step 2 (arweave.net): failed", { ms: y });
17917
- }
17918
- }
17919
- const l = Date.now(), u = await this.tryFallbackGateways(e, t, i, n, c), d = Date.now() - l;
17920
- if (u)
17921
- return this.logger.info("[gateway] Step 3 (fallbacks): success", { ms: d, totalMs: Date.now() - r }), u;
17922
- this.logger.info("[gateway] Step 3 (fallbacks): failed", { ms: d });
17923
- const h = !this.hasCustomSolanaRpc, m = a?.bypassWayfinder ?? h;
17924
- if (this.wayfinder && !m) {
17925
- const f = Date.now();
17954
+ const g = this.gateways.find((p) => p.host === "arweave.net");
17955
+ if (g) {
17956
+ const p = Date.now(), y = await this.checkAndSetGateway(e, t, i, g, n), v = Date.now() - p;
17957
+ if (y) {
17958
+ if (this.logger.info(`[gateway] Step 2 (arweave.net): ${y.kind}`, { ms: v, totalMs: Date.now() - r }), y.kind === "verified") return y.url;
17959
+ l ??= y.url;
17960
+ } else
17961
+ this.logger.info("[gateway] Step 2 (arweave.net): failed", { ms: v });
17962
+ }
17963
+ }
17964
+ const u = Date.now(), d = await this.tryFallbackGateways(e, t, i, n, c), h = Date.now() - u;
17965
+ if (d) {
17966
+ if (this.logger.info(`[gateway] Step 3 (fallbacks): ${d.kind}`, { ms: h, totalMs: Date.now() - r }), d.kind === "verified") return d.url;
17967
+ l ??= d.url;
17968
+ } else
17969
+ this.logger.info("[gateway] Step 3 (fallbacks): failed", { ms: h });
17970
+ const m = !this.hasCustomSolanaRpc, f = a?.bypassWayfinder ?? m;
17971
+ if (this.wayfinder && !f) {
17972
+ const g = Date.now();
17926
17973
  this.logger.info("[gateway] Step 4 (wayfinder): trying");
17927
- const g = await this.tryWayfinder(t, i, n, c), p = Date.now() - f;
17928
- if (g)
17929
- return this.logger.info("[gateway] Step 4 (wayfinder): success", { ms: p, totalMs: Date.now() - r }), g;
17930
- this.logger.info("[gateway] Step 4 (wayfinder): failed", { ms: p });
17974
+ const p = await this.tryWayfinder(t, i, n, c), y = Date.now() - g;
17975
+ if (p) {
17976
+ if (this.logger.info(`[gateway] Step 4 (wayfinder): ${p.kind}`, { ms: y, totalMs: Date.now() - r }), p.kind === "verified") return p.url;
17977
+ l ??= p.url;
17978
+ } else
17979
+ this.logger.info("[gateway] Step 4 (wayfinder): failed", { ms: y });
17931
17980
  }
17932
- return this.logger.warn("All gateways (arweave.net + Wayfinder + fallbacks) failed, returning original URL", { txId: t, pathSuffix: i, originalUrl: e }), e;
17981
+ return l ? (this.logger.warn("No gateway verified, returning best maybe-result", { txId: t, pathSuffix: i, maybeUrl: l }), l) : (this.logger.warn("All gateways (arweave.net + Wayfinder + fallbacks) failed, returning original URL", { txId: t, pathSuffix: i, originalUrl: e }), e);
17933
17982
  }
17934
17983
  /**
17935
17984
  * Report that the active gateway failed a real fetch.
@@ -17964,16 +18013,16 @@ class Eg {
17964
18013
  const u = this.gateways.find((m) => m.host === "arweave.net" && m.host !== l);
17965
18014
  if (u) {
17966
18015
  const m = await this.checkAndSetGateway(e, o, c, u, i);
17967
- if (m) return m;
18016
+ if (m) return m.url;
17968
18017
  }
17969
18018
  if (this.wayfinder) {
17970
18019
  const m = await this.tryWayfinder(o, c, i);
17971
- if (m) return m;
18020
+ if (m) return m.url;
17972
18021
  }
17973
18022
  const d = this.gateways;
17974
18023
  l && (this.gateways = this.gateways.filter((m) => m.host !== l));
17975
18024
  const h = await this.tryFallbackGateways(e, o, c, i);
17976
- return this.gateways = d, h || e;
18025
+ return this.gateways = d, h ? h.url : e;
17977
18026
  }
17978
18027
  /**
17979
18028
  * Report that a fetch succeeded with timing data.
@@ -17998,7 +18047,22 @@ class Eg {
17998
18047
  }
17999
18048
  /**
18000
18049
  * Check a single gateway and set it as active if it works.
18001
- * Returns the working URL, or null if the check failed.
18050
+ *
18051
+ * Returns one of:
18052
+ * - `{ kind: 'verified', url }` — HEAD returned 2xx/3xx, gateway is confirmed working
18053
+ * - `{ kind: 'maybe', url }` — HEAD failed (likely CORS), no-cors GET didn't throw.
18054
+ * Server responded but we can't verify status. Caller
18055
+ * should keep looking for a 'verified' result and use
18056
+ * 'maybe' only as a last resort.
18057
+ * - `null` — gateway definitively failed
18058
+ *
18059
+ * Previously this returned `string | null` for both 'verified' and 'maybe', which forced
18060
+ * `resolveGatewayChain` to bail on the first 'maybe' — even when other gateways might
18061
+ * have a verified 2xx response. For manifest-path Arweave URLs (where the txid root
18062
+ * serves a manifest and individual paths may 404), this meant the chain stopped at the
18063
+ * first gateway that responded at all (even with 404s hidden behind no-cors opacity)
18064
+ * and never tried alternates. Surfacing the distinction lets the chain prefer verified
18065
+ * results and use 'maybe' only as a fallback.
18002
18066
  */
18003
18067
  async checkAndSetGateway(e, t, i, n, a) {
18004
18068
  if (a?.aborted) return null;
@@ -18011,7 +18075,7 @@ class Eg {
18011
18075
  gateway: n.host,
18012
18076
  pathSuffix: i,
18013
18077
  workingUrl: o
18014
- }), o;
18078
+ }), { kind: "verified", url: o };
18015
18079
  }
18016
18080
  if (r === "maybe") {
18017
18081
  const o = qe(t, n, i);
@@ -18020,7 +18084,7 @@ class Eg {
18020
18084
  gateway: n.host,
18021
18085
  pathSuffix: i,
18022
18086
  workingUrl: o
18023
- }), o;
18087
+ }), { kind: "maybe", url: o };
18024
18088
  }
18025
18089
  return null;
18026
18090
  }
@@ -18030,160 +18094,162 @@ class Eg {
18030
18094
  */
18031
18095
  async tryFallbackGateways(e, t, i, n, a) {
18032
18096
  this.missCount++;
18033
- const r = 0.7, o = 3, c = this.gateways.filter((m) => m.host !== "arweave.net" && m.host !== a), l = c.filter((m) => {
18034
- const { rate: f, totalChecks: g } = this.getFailureRate(m.host);
18035
- return !(g >= o && f > r);
18097
+ const r = 0.7, o = 3, c = this.gateways.filter((f) => f.host !== "arweave.net" && f.host !== a), l = c.filter((f) => {
18098
+ const { rate: g, totalChecks: p } = this.getFailureRate(f.host);
18099
+ return !(p >= o && g > r);
18036
18100
  }), u = l.length > 0 ? l : c;
18037
18101
  if (n?.aborted || u.length === 0) return null;
18038
- const d = async (m) => {
18039
- if (n?.aborted || m.length === 0) return null;
18040
- const f = new AbortController(), g = () => f.abort();
18041
- n?.addEventListener("abort", g, { once: !0 });
18042
- let p = !1;
18102
+ const d = async (f) => {
18103
+ if (n?.aborted || f.length === 0) return null;
18104
+ const g = new AbortController(), p = () => g.abort();
18105
+ n?.addEventListener("abort", p, { once: !0 });
18106
+ let y = null, v = null, _ = !1;
18043
18107
  try {
18044
- return await Promise.any(
18045
- m.map(async (v) => {
18046
- const S = await this.checkGateway(t, v, i, f.signal);
18047
- if (S) {
18048
- const T = qe(t, v, i);
18049
- return p || (p = !0, S === !0 ? (this.setActiveGateway(v, t), this.logger.info("Gateway resolved via fallback", {
18050
- txId: t,
18051
- gateway: v.host,
18052
- pathSuffix: i,
18053
- workingUrl: T
18054
- })) : this.logger.info("Gateway maybe resolved via fallback (no-cors)", {
18055
- txId: t,
18056
- gateway: v.host,
18057
- pathSuffix: i,
18058
- workingUrl: T
18059
- })), T;
18060
- }
18061
- throw new Error(`Gateway ${v.host} failed check`);
18108
+ const T = await Promise.allSettled(
18109
+ f.map(async (S) => {
18110
+ const I = await this.checkGateway(t, S, i, g.signal);
18111
+ if (!I) throw new Error(`Gateway ${S.host} failed check`);
18112
+ const D = qe(t, S, i), R = I === !0 ? "verified" : "maybe";
18113
+ return _ || (_ = !0, R === "verified" ? (this.setActiveGateway(S, t), this.logger.info("Gateway resolved via fallback", {
18114
+ txId: t,
18115
+ gateway: S.host,
18116
+ pathSuffix: i,
18117
+ workingUrl: D
18118
+ })) : this.logger.info("Gateway maybe resolved via fallback (no-cors)", {
18119
+ txId: t,
18120
+ gateway: S.host,
18121
+ pathSuffix: i,
18122
+ workingUrl: D
18123
+ })), { kind: R, url: D };
18062
18124
  })
18063
18125
  );
18064
- } catch {
18065
- return null;
18126
+ for (const S of T) {
18127
+ if (S.status !== "fulfilled") continue;
18128
+ const I = S.value;
18129
+ if (I.kind === "verified" && !y ? y = { kind: "verified", url: I.url } : I.kind === "maybe" && !v && (v = { kind: "maybe", url: I.url }), y) break;
18130
+ }
18131
+ return y ?? v;
18066
18132
  } finally {
18067
- n?.removeEventListener("abort", g);
18133
+ n?.removeEventListener("abort", p);
18068
18134
  }
18069
18135
  }, h = await d(u);
18070
- if (h) return h;
18136
+ if (h && h.kind === "verified") return h;
18137
+ let m = h;
18071
18138
  if (l.length < c.length && !n?.aborted) {
18072
- const m = c.filter((g) => !l.some((p) => p.host === g.host)).map((g) => g.host);
18073
- this.logger.debug("Healthy gateways exhausted, retrying with previously unhealthy", { excludedHosts: m });
18074
- const f = await d(c);
18075
- if (f) return f;
18139
+ const f = c.filter((p) => !l.some((y) => y.host === p.host)).map((p) => p.host);
18140
+ this.logger.debug("Healthy gateways exhausted, retrying with previously unhealthy", { excludedHosts: f });
18141
+ const g = await d(c);
18142
+ if (g && (g.kind === "verified" || !m))
18143
+ return g;
18076
18144
  }
18077
- return null;
18145
+ return m;
18078
18146
  }
18079
18147
  /**
18080
- * Try Wayfinder as a last resort when all static gateways fail.
18081
- * Returns the URL of a working Wayfinder-selected gateway, or null if it fails.
18082
- */
18083
- /**
18084
- * Return the ranked gateway list from the primary `NetworkGatewaysProvider`,
18085
- * using an in-memory cache to avoid hitting Solana on every walk. Returns null
18086
- * if the provider is unavailable or the fetch fails.
18148
+ * Return the ranked gateway list. The provider itself is already wrapped in
18149
+ * the 24h cache (see wrapProviderWithCache), so this is now a thin reader —
18150
+ * no separate fetch, TTL, or stale logic here. Kept as an indirection point
18151
+ * so tryWayfinder's Step B reads through a named method. Returns null if the
18152
+ * provider is unavailable or both fetch and stale fallback fail.
18087
18153
  */
18088
18154
  async getRankedGatewaysCached(e) {
18089
18155
  if (!this.wayfinderGatewaysProvider) return null;
18090
- const t = Date.now(), i = t - this.rankedGatewaysCacheTimestamp;
18091
- if (this.rankedGatewaysCache && i < this.RANKED_GATEWAYS_TTL_MS)
18092
- return this.logger.debug("Reusing cached ranked gateway list", {
18093
- size: this.rankedGatewaysCache.length,
18094
- ageMs: i
18095
- }), this.rankedGatewaysCache;
18096
18156
  try {
18097
- const n = await this.withTimeout(
18157
+ const t = await this.withTimeout(
18098
18158
  this.wayfinderGatewaysProvider.getGateways(),
18099
18159
  this.timeout + 2e3,
18100
18160
  "Wayfinder provider getGateways timed out"
18101
18161
  );
18102
- return e?.aborted ? null : (this.rankedGatewaysCache = n, this.rankedGatewaysCacheTimestamp = t, this.persistRankedGateways(n, t), this.logger.info("Refreshed ranked gateway list cache", { size: n.length }), n);
18103
- } catch (n) {
18104
- return this.logger.debug("Failed to fetch ranked gateway list from provider", { error: n }), this.rankedGatewaysCache ? (this.logger.debug("Falling back to stale ranked gateway cache", {
18105
- size: this.rankedGatewaysCache.length,
18106
- ageMs: i
18107
- }), this.rankedGatewaysCache) : null;
18162
+ return e?.aborted ? null : t && t.length > 0 ? t : null;
18163
+ } catch (t) {
18164
+ return this.logger.debug("Ranked gateway list unavailable", { error: t }), null;
18108
18165
  }
18109
18166
  }
18110
18167
  async tryWayfinder(e, t, i, n) {
18111
18168
  if (!this.wayfinder) return null;
18112
- const a = 10, r = /* @__PURE__ */ new Set();
18113
- n && r.add(n);
18114
- const o = `https://arweave.net/${e}${t}`;
18169
+ let a = null;
18170
+ const r = 10, o = /* @__PURE__ */ new Set();
18171
+ n && o.add(n);
18172
+ const c = `https://arweave.net/${e}${t}`;
18115
18173
  try {
18116
- this.logger.debug("Resolving via Wayfinder (first pick)", { txId: e, normalizedUrl: o });
18117
- const u = await this.withTimeout(
18118
- this.wayfinder.resolveUrl({ originalUrl: o }),
18174
+ this.logger.debug("Resolving via Wayfinder (first pick)", { txId: e, normalizedUrl: c });
18175
+ const d = await this.withTimeout(
18176
+ this.wayfinder.resolveUrl({ originalUrl: c }),
18119
18177
  this.timeout + 2e3,
18120
18178
  "Wayfinder resolution timed out"
18121
18179
  );
18122
18180
  if (i?.aborted) return null;
18123
- const d = u.hostname;
18124
- if (r.has(d))
18125
- this.logger.debug("Wayfinder first pick was already excluded, skipping to walk", { host: d });
18181
+ const h = d.hostname;
18182
+ if (o.has(h))
18183
+ this.logger.debug("Wayfinder first pick was already excluded, skipping to walk", { host: h });
18126
18184
  else {
18127
- const h = u.protocol.replace(":", ""), m = {
18128
- host: d,
18129
- protocol: h,
18185
+ const m = d.protocol.replace(":", ""), f = {
18186
+ host: h,
18187
+ protocol: m,
18130
18188
  priority: 0
18131
- }, f = await this.checkGateway(e, m, t, i);
18132
- if (f) {
18133
- const g = qe(e, m, t);
18134
- return f === !0 ? (this.setActiveGateway(m, e), this.logger.info("Gateway resolved via Wayfinder (first pick)", {
18189
+ }, g = await this.checkGateway(e, f, t, i);
18190
+ if (g) {
18191
+ const p = qe(e, f, t), y = g === !0 ? "verified" : "maybe";
18192
+ if (y === "verified" ? (this.setActiveGateway(f, e), this.logger.info("Gateway resolved via Wayfinder (first pick)", {
18135
18193
  txId: e,
18136
- gateway: d,
18194
+ gateway: h,
18137
18195
  pathSuffix: t,
18138
- workingUrl: g
18196
+ workingUrl: p
18139
18197
  })) : this.logger.info("Gateway maybe resolved via Wayfinder (first pick, no-cors)", {
18140
18198
  txId: e,
18141
- gateway: d,
18199
+ gateway: h,
18142
18200
  pathSuffix: t,
18143
- workingUrl: g
18144
- }), g;
18145
- }
18146
- this.logger.debug("Wayfinder first pick failed verify, will walk ranked list", { host: d }), r.add(d);
18201
+ workingUrl: p
18202
+ }), y === "verified") return { kind: y, url: p };
18203
+ a ??= { kind: y, url: p };
18204
+ } else
18205
+ this.logger.debug("Wayfinder first pick failed verify, will walk ranked list", { host: h });
18206
+ o.add(h);
18147
18207
  }
18148
- } catch (u) {
18149
- this.logger.debug("Wayfinder first pick threw, will walk ranked list", { error: u });
18208
+ } catch (d) {
18209
+ this.logger.debug("Wayfinder first pick threw, will walk ranked list", { error: d });
18150
18210
  }
18151
- if (i?.aborted) return null;
18152
- const c = await this.getRankedGatewaysCached(i);
18153
- if (!c || c.length === 0 || i?.aborted) return null;
18154
- const l = c.filter((u) => !r.has(u.hostname)).slice(0, a);
18211
+ if (i?.aborted) return a;
18212
+ const l = await this.getRankedGatewaysCached(i);
18213
+ if (!l || l.length === 0 || i?.aborted) return a;
18214
+ const u = l.filter((d) => !o.has(d.hostname)).slice(0, r);
18155
18215
  this.logger.debug("Walking Wayfinder ranked list", {
18156
18216
  txId: e,
18157
- poolSize: c.length,
18158
- walkSize: l.length
18217
+ poolSize: l.length,
18218
+ walkSize: u.length
18159
18219
  });
18160
- for (const u of l) {
18161
- if (i?.aborted) return null;
18162
- const d = {
18163
- host: u.hostname,
18164
- protocol: u.protocol.replace(":", ""),
18220
+ for (const d of u) {
18221
+ if (i?.aborted) return a;
18222
+ const h = {
18223
+ host: d.hostname,
18224
+ protocol: d.protocol.replace(":", ""),
18165
18225
  priority: 0
18166
- }, h = await this.checkGateway(e, d, t, i);
18167
- if (h) {
18168
- const m = qe(e, d, t);
18169
- return h === !0 ? (this.setActiveGateway(d, e), this.logger.info("Gateway resolved via Wayfinder ranked walk", {
18170
- txId: e,
18171
- gateway: d.host,
18172
- pathSuffix: t,
18173
- workingUrl: m
18174
- })) : this.logger.info("Gateway maybe resolved via Wayfinder ranked walk (no-cors)", {
18226
+ }, m = await this.checkGateway(e, h, t, i);
18227
+ if (m) {
18228
+ const f = qe(e, h, t), g = m === !0 ? "verified" : "maybe";
18229
+ if (g === "verified")
18230
+ return this.setActiveGateway(h, e), this.logger.info("Gateway resolved via Wayfinder ranked walk", {
18231
+ txId: e,
18232
+ gateway: h.host,
18233
+ pathSuffix: t,
18234
+ workingUrl: f
18235
+ }), { kind: g, url: f };
18236
+ this.logger.info("Gateway maybe resolved via Wayfinder ranked walk (no-cors)", {
18175
18237
  txId: e,
18176
- gateway: d.host,
18238
+ gateway: h.host,
18177
18239
  pathSuffix: t,
18178
- workingUrl: m
18179
- }), m;
18240
+ workingUrl: f
18241
+ }), a ??= { kind: g, url: f };
18180
18242
  }
18181
- r.add(d.host);
18243
+ o.add(h.host);
18182
18244
  }
18183
- return this.logger.debug("Wayfinder ranked walk exhausted with no match", {
18245
+ return a ? this.logger.debug("Wayfinder returning best maybe-result (no verified match)", {
18184
18246
  txId: e,
18185
- checkedHosts: Array.from(r)
18186
- }), null;
18247
+ checkedHosts: Array.from(o),
18248
+ maybeUrl: a.url
18249
+ }) : this.logger.debug("Wayfinder ranked walk exhausted with no match", {
18250
+ txId: e,
18251
+ checkedHosts: Array.from(o)
18252
+ }), a;
18187
18253
  }
18188
18254
  /**
18189
18255
  * Set the active gateway, cache it for the txId, and persist to localStorage.
@@ -18692,12 +18758,12 @@ class Eg {
18692
18758
  const g = Date.now();
18693
18759
  let p = !1, y = this.timeout;
18694
18760
  try {
18695
- const v = qe(i, f), S = new AbortController(), T = setTimeout(() => S.abort(), this.timeout), _ = await fetch(v, {
18761
+ const v = qe(i, f), _ = new AbortController(), T = setTimeout(() => _.abort(), this.timeout), S = await fetch(v, {
18696
18762
  method: "HEAD",
18697
18763
  mode: "cors",
18698
- signal: S.signal
18764
+ signal: _.signal
18699
18765
  });
18700
- clearTimeout(T), y = Date.now() - g, p = _.ok || _.status >= 200 && _.status < 400;
18766
+ clearTimeout(T), y = Date.now() - g, p = S.ok || S.status >= 200 && S.status < 400;
18701
18767
  } catch {
18702
18768
  y = Date.now() - g, p = !1;
18703
18769
  }
@@ -18753,7 +18819,7 @@ class Eg {
18753
18819
  this.healthData.clear(), this.logger.info("Health data cleared");
18754
18820
  }
18755
18821
  }
18756
- const Me = new Eg(), la = [
18822
+ const Ae = new Eg(), la = [
18757
18823
  "ipfs.io",
18758
18824
  "cloudflare-ipfs.com",
18759
18825
  "dweb.link",
@@ -18896,80 +18962,80 @@ function Bg() {
18896
18962
  }
18897
18963
  var o = {}, c = ["REJECTED"], l = ["FULFILLED"], u = ["PENDING"];
18898
18964
  i.exports = d;
18899
- function d(_) {
18900
- if (typeof _ != "function")
18965
+ function d(S) {
18966
+ if (typeof S != "function")
18901
18967
  throw new TypeError("resolver must be a function");
18902
- this.state = u, this.queue = [], this.outcome = void 0, _ !== r && g(this, _);
18968
+ this.state = u, this.queue = [], this.outcome = void 0, S !== r && g(this, S);
18903
18969
  }
18904
- d.prototype.catch = function(_) {
18905
- return this.then(null, _);
18906
- }, d.prototype.then = function(_, I) {
18907
- if (typeof _ != "function" && this.state === l || typeof I != "function" && this.state === c)
18970
+ d.prototype.catch = function(S) {
18971
+ return this.then(null, S);
18972
+ }, d.prototype.then = function(S, I) {
18973
+ if (typeof S != "function" && this.state === l || typeof I != "function" && this.state === c)
18908
18974
  return this;
18909
18975
  var D = new this.constructor(r);
18910
18976
  if (this.state !== u) {
18911
- var R = this.state === l ? _ : I;
18977
+ var R = this.state === l ? S : I;
18912
18978
  m(D, R, this.outcome);
18913
18979
  } else
18914
- this.queue.push(new h(D, _, I));
18980
+ this.queue.push(new h(D, S, I));
18915
18981
  return D;
18916
18982
  };
18917
- function h(_, I, D) {
18918
- this.promise = _, typeof I == "function" && (this.onFulfilled = I, this.callFulfilled = this.otherCallFulfilled), typeof D == "function" && (this.onRejected = D, this.callRejected = this.otherCallRejected);
18983
+ function h(S, I, D) {
18984
+ this.promise = S, typeof I == "function" && (this.onFulfilled = I, this.callFulfilled = this.otherCallFulfilled), typeof D == "function" && (this.onRejected = D, this.callRejected = this.otherCallRejected);
18919
18985
  }
18920
- h.prototype.callFulfilled = function(_) {
18921
- o.resolve(this.promise, _);
18922
- }, h.prototype.otherCallFulfilled = function(_) {
18923
- m(this.promise, this.onFulfilled, _);
18924
- }, h.prototype.callRejected = function(_) {
18925
- o.reject(this.promise, _);
18926
- }, h.prototype.otherCallRejected = function(_) {
18927
- m(this.promise, this.onRejected, _);
18986
+ h.prototype.callFulfilled = function(S) {
18987
+ o.resolve(this.promise, S);
18988
+ }, h.prototype.otherCallFulfilled = function(S) {
18989
+ m(this.promise, this.onFulfilled, S);
18990
+ }, h.prototype.callRejected = function(S) {
18991
+ o.reject(this.promise, S);
18992
+ }, h.prototype.otherCallRejected = function(S) {
18993
+ m(this.promise, this.onRejected, S);
18928
18994
  };
18929
- function m(_, I, D) {
18995
+ function m(S, I, D) {
18930
18996
  a(function() {
18931
18997
  var R;
18932
18998
  try {
18933
18999
  R = I(D);
18934
19000
  } catch (q) {
18935
- return o.reject(_, q);
19001
+ return o.reject(S, q);
18936
19002
  }
18937
- R === _ ? o.reject(_, new TypeError("Cannot resolve promise with itself")) : o.resolve(_, R);
19003
+ R === S ? o.reject(S, new TypeError("Cannot resolve promise with itself")) : o.resolve(S, R);
18938
19004
  });
18939
19005
  }
18940
- o.resolve = function(_, I) {
19006
+ o.resolve = function(S, I) {
18941
19007
  var D = p(f, I);
18942
19008
  if (D.status === "error")
18943
- return o.reject(_, D.value);
19009
+ return o.reject(S, D.value);
18944
19010
  var R = D.value;
18945
19011
  if (R)
18946
- g(_, R);
19012
+ g(S, R);
18947
19013
  else {
18948
- _.state = l, _.outcome = I;
18949
- for (var q = -1, O = _.queue.length; ++q < O; )
18950
- _.queue[q].callFulfilled(I);
19014
+ S.state = l, S.outcome = I;
19015
+ for (var q = -1, O = S.queue.length; ++q < O; )
19016
+ S.queue[q].callFulfilled(I);
18951
19017
  }
18952
- return _;
18953
- }, o.reject = function(_, I) {
18954
- _.state = c, _.outcome = I;
18955
- for (var D = -1, R = _.queue.length; ++D < R; )
18956
- _.queue[D].callRejected(I);
18957
- return _;
19018
+ return S;
19019
+ }, o.reject = function(S, I) {
19020
+ S.state = c, S.outcome = I;
19021
+ for (var D = -1, R = S.queue.length; ++D < R; )
19022
+ S.queue[D].callRejected(I);
19023
+ return S;
18958
19024
  };
18959
- function f(_) {
18960
- var I = _ && _.then;
18961
- if (_ && (typeof _ == "object" || typeof _ == "function") && typeof I == "function")
19025
+ function f(S) {
19026
+ var I = S && S.then;
19027
+ if (S && (typeof S == "object" || typeof S == "function") && typeof I == "function")
18962
19028
  return function() {
18963
- I.apply(_, arguments);
19029
+ I.apply(S, arguments);
18964
19030
  };
18965
19031
  }
18966
- function g(_, I) {
19032
+ function g(S, I) {
18967
19033
  var D = !1;
18968
19034
  function R(Z) {
18969
- D || (D = !0, o.reject(_, Z));
19035
+ D || (D = !0, o.reject(S, Z));
18970
19036
  }
18971
19037
  function q(Z) {
18972
- D || (D = !0, o.resolve(_, Z));
19038
+ D || (D = !0, o.resolve(S, Z));
18973
19039
  }
18974
19040
  function O() {
18975
19041
  I(q, R);
@@ -18977,34 +19043,34 @@ function Bg() {
18977
19043
  var W = p(O);
18978
19044
  W.status === "error" && R(W.value);
18979
19045
  }
18980
- function p(_, I) {
19046
+ function p(S, I) {
18981
19047
  var D = {};
18982
19048
  try {
18983
- D.value = _(I), D.status = "success";
19049
+ D.value = S(I), D.status = "success";
18984
19050
  } catch (R) {
18985
19051
  D.status = "error", D.value = R;
18986
19052
  }
18987
19053
  return D;
18988
19054
  }
18989
19055
  d.resolve = y;
18990
- function y(_) {
18991
- return _ instanceof this ? _ : o.resolve(new this(r), _);
19056
+ function y(S) {
19057
+ return S instanceof this ? S : o.resolve(new this(r), S);
18992
19058
  }
18993
19059
  d.reject = v;
18994
- function v(_) {
19060
+ function v(S) {
18995
19061
  var I = new this(r);
18996
- return o.reject(I, _);
19062
+ return o.reject(I, S);
18997
19063
  }
18998
- d.all = S;
18999
- function S(_) {
19064
+ d.all = _;
19065
+ function _(S) {
19000
19066
  var I = this;
19001
- if (Object.prototype.toString.call(_) !== "[object Array]")
19067
+ if (Object.prototype.toString.call(S) !== "[object Array]")
19002
19068
  return this.reject(new TypeError("must be an array"));
19003
- var D = _.length, R = !1;
19069
+ var D = S.length, R = !1;
19004
19070
  if (!D)
19005
19071
  return this.resolve([]);
19006
19072
  for (var q = new Array(D), O = 0, W = -1, Z = new this(r); ++W < D; )
19007
- Q(_[W], W);
19073
+ Q(S[W], W);
19008
19074
  return Z;
19009
19075
  function Q(se, oe) {
19010
19076
  I.resolve(se).then(j, function(X) {
@@ -19016,15 +19082,15 @@ function Bg() {
19016
19082
  }
19017
19083
  }
19018
19084
  d.race = T;
19019
- function T(_) {
19085
+ function T(S) {
19020
19086
  var I = this;
19021
- if (Object.prototype.toString.call(_) !== "[object Array]")
19087
+ if (Object.prototype.toString.call(S) !== "[object Array]")
19022
19088
  return this.reject(new TypeError("must be an array"));
19023
- var D = _.length, R = !1;
19089
+ var D = S.length, R = !1;
19024
19090
  if (!D)
19025
19091
  return this.resolve([]);
19026
19092
  for (var q = -1, O = new this(r); ++q < D; )
19027
- W(_[q]);
19093
+ W(S[q]);
19028
19094
  return O;
19029
19095
  function W(Z) {
19030
19096
  I.resolve(Z).then(function(Q) {
@@ -19083,12 +19149,12 @@ function Bg() {
19083
19149
  b = b || [], C = C || {};
19084
19150
  try {
19085
19151
  return new Blob(b, C);
19086
- } catch (A) {
19087
- if (A.name !== "TypeError")
19088
- throw A;
19089
- for (var w = typeof BlobBuilder < "u" ? BlobBuilder : typeof MSBlobBuilder < "u" ? MSBlobBuilder : typeof MozBlobBuilder < "u" ? MozBlobBuilder : WebKitBlobBuilder, M = new w(), k = 0; k < b.length; k += 1)
19090
- M.append(b[k]);
19091
- return M.getBlob(C.type);
19152
+ } catch (k) {
19153
+ if (k.name !== "TypeError")
19154
+ throw k;
19155
+ for (var w = typeof BlobBuilder < "u" ? BlobBuilder : typeof MSBlobBuilder < "u" ? MSBlobBuilder : typeof MozBlobBuilder < "u" ? MozBlobBuilder : WebKitBlobBuilder, A = new w(), M = 0; M < b.length; M += 1)
19156
+ A.append(b[M]);
19157
+ return A.getBlob(C.type);
19092
19158
  }
19093
19159
  }
19094
19160
  typeof Promise > "u" && t(3);
@@ -19110,20 +19176,20 @@ function Bg() {
19110
19176
  if (arguments.length && typeof arguments[arguments.length - 1] == "function")
19111
19177
  return arguments[arguments.length - 1];
19112
19178
  }
19113
- var p = "local-forage-detect-blob-support", y = void 0, v = {}, S = Object.prototype.toString, T = "readonly", _ = "readwrite";
19179
+ var p = "local-forage-detect-blob-support", y = void 0, v = {}, _ = Object.prototype.toString, T = "readonly", S = "readwrite";
19114
19180
  function I(b) {
19115
- for (var C = b.length, w = new ArrayBuffer(C), M = new Uint8Array(w), k = 0; k < C; k++)
19116
- M[k] = b.charCodeAt(k);
19181
+ for (var C = b.length, w = new ArrayBuffer(C), A = new Uint8Array(w), M = 0; M < C; M++)
19182
+ A[M] = b.charCodeAt(M);
19117
19183
  return w;
19118
19184
  }
19119
19185
  function D(b) {
19120
19186
  return new d(function(C) {
19121
- var w = b.transaction(p, _), M = u([""]);
19122
- w.objectStore(p).put(M, "key"), w.onabort = function(k) {
19123
- k.preventDefault(), k.stopPropagation(), C(!1);
19187
+ var w = b.transaction(p, S), A = u([""]);
19188
+ w.objectStore(p).put(A, "key"), w.onabort = function(M) {
19189
+ M.preventDefault(), M.stopPropagation(), C(!1);
19124
19190
  }, w.oncomplete = function() {
19125
- var k = navigator.userAgent.match(/Chrome\/(\d+)/), A = navigator.userAgent.match(/Edge\//);
19126
- C(A || !k || parseInt(k[1], 10) >= 43);
19191
+ var M = navigator.userAgent.match(/Chrome\/(\d+)/), k = navigator.userAgent.match(/Edge\//);
19192
+ C(k || !M || parseInt(M[1], 10) >= 43);
19127
19193
  };
19128
19194
  }).catch(function() {
19129
19195
  return !1;
@@ -19136,8 +19202,8 @@ function Bg() {
19136
19202
  }
19137
19203
  function q(b) {
19138
19204
  var C = v[b.name], w = {};
19139
- w.promise = new d(function(M, k) {
19140
- w.resolve = M, w.reject = k;
19205
+ w.promise = new d(function(A, M) {
19206
+ w.resolve = A, w.reject = M;
19141
19207
  }), C.deferredOperations.push(w), C.dbReady ? C.dbReady = C.dbReady.then(function() {
19142
19208
  return w.promise;
19143
19209
  }) : C.dbReady = w.promise;
@@ -19148,22 +19214,22 @@ function Bg() {
19148
19214
  return w.resolve(), w.promise;
19149
19215
  }
19150
19216
  function W(b, C) {
19151
- var w = v[b.name], M = w.deferredOperations.pop();
19152
- if (M)
19153
- return M.reject(C), M.promise;
19217
+ var w = v[b.name], A = w.deferredOperations.pop();
19218
+ if (A)
19219
+ return A.reject(C), A.promise;
19154
19220
  }
19155
19221
  function Z(b, C) {
19156
- return new d(function(w, M) {
19222
+ return new d(function(w, A) {
19157
19223
  if (v[b.name] = v[b.name] || le(), b.db)
19158
19224
  if (C)
19159
19225
  q(b), b.db.close();
19160
19226
  else
19161
19227
  return w(b.db);
19162
- var k = [b.name];
19163
- C && k.push(b.version);
19164
- var A = c.open.apply(c, k);
19165
- C && (A.onupgradeneeded = function(x) {
19166
- var P = A.result;
19228
+ var M = [b.name];
19229
+ C && M.push(b.version);
19230
+ var k = c.open.apply(c, M);
19231
+ C && (k.onupgradeneeded = function(x) {
19232
+ var P = k.result;
19167
19233
  try {
19168
19234
  P.createObjectStore(b.storeName), x.oldVersion <= 1 && P.createObjectStore(p);
19169
19235
  } catch (B) {
@@ -19172,10 +19238,10 @@ function Bg() {
19172
19238
  else
19173
19239
  throw B;
19174
19240
  }
19175
- }), A.onerror = function(x) {
19176
- x.preventDefault(), M(A.error);
19177
- }, A.onsuccess = function() {
19178
- var x = A.result;
19241
+ }), k.onerror = function(x) {
19242
+ x.preventDefault(), A(k.error);
19243
+ }, k.onsuccess = function() {
19244
+ var x = k.result;
19179
19245
  x.onversionchange = function(P) {
19180
19246
  P.target.close();
19181
19247
  }, w(x), O(b);
@@ -19191,11 +19257,11 @@ function Bg() {
19191
19257
  function oe(b, C) {
19192
19258
  if (!b.db)
19193
19259
  return !0;
19194
- var w = !b.db.objectStoreNames.contains(b.storeName), M = b.version < b.db.version, k = b.version > b.db.version;
19195
- if (M && (b.version !== C && console.warn('The database "' + b.name + `" can't be downgraded from version ` + b.db.version + " to version " + b.version + "."), b.version = b.db.version), k || w) {
19260
+ var w = !b.db.objectStoreNames.contains(b.storeName), A = b.version < b.db.version, M = b.version > b.db.version;
19261
+ if (A && (b.version !== C && console.warn('The database "' + b.name + `" can't be downgraded from version ` + b.db.version + " to version " + b.version + "."), b.version = b.db.version), M || w) {
19196
19262
  if (w) {
19197
- var A = b.db.version + 1;
19198
- A > b.version && (b.version = A);
19263
+ var k = b.db.version + 1;
19264
+ k > b.version && (b.version = k);
19199
19265
  }
19200
19266
  return !0;
19201
19267
  }
@@ -19203,15 +19269,15 @@ function Bg() {
19203
19269
  }
19204
19270
  function j(b) {
19205
19271
  return new d(function(C, w) {
19206
- var M = new FileReader();
19207
- M.onerror = w, M.onloadend = function(k) {
19208
- var A = btoa(k.target.result || "");
19272
+ var A = new FileReader();
19273
+ A.onerror = w, A.onloadend = function(M) {
19274
+ var k = btoa(M.target.result || "");
19209
19275
  C({
19210
19276
  __local_forage_encoded_blob: !0,
19211
- data: A,
19277
+ data: k,
19212
19278
  type: b.type
19213
19279
  });
19214
- }, M.readAsBinaryString(b);
19280
+ }, A.readAsBinaryString(b);
19215
19281
  });
19216
19282
  }
19217
19283
  function X(b) {
@@ -19223,44 +19289,44 @@ function Bg() {
19223
19289
  }
19224
19290
  function ge(b) {
19225
19291
  var C = this, w = C._initReady().then(function() {
19226
- var M = v[C._dbInfo.name];
19227
- if (M && M.dbReady)
19228
- return M.dbReady;
19292
+ var A = v[C._dbInfo.name];
19293
+ if (A && A.dbReady)
19294
+ return A.dbReady;
19229
19295
  });
19230
19296
  return m(w, b, b), w;
19231
19297
  }
19232
19298
  function Qt(b) {
19233
19299
  q(b);
19234
- for (var C = v[b.name], w = C.forages, M = 0; M < w.length; M++) {
19235
- var k = w[M];
19236
- k._dbInfo.db && (k._dbInfo.db.close(), k._dbInfo.db = null);
19300
+ for (var C = v[b.name], w = C.forages, A = 0; A < w.length; A++) {
19301
+ var M = w[A];
19302
+ M._dbInfo.db && (M._dbInfo.db.close(), M._dbInfo.db = null);
19237
19303
  }
19238
- return b.db = null, Q(b).then(function(A) {
19239
- return b.db = A, oe(b) ? se(b) : A;
19240
- }).then(function(A) {
19241
- b.db = C.db = A;
19304
+ return b.db = null, Q(b).then(function(k) {
19305
+ return b.db = k, oe(b) ? se(b) : k;
19306
+ }).then(function(k) {
19307
+ b.db = C.db = k;
19242
19308
  for (var x = 0; x < w.length; x++)
19243
- w[x]._dbInfo.db = A;
19244
- }).catch(function(A) {
19245
- throw W(b, A), A;
19309
+ w[x]._dbInfo.db = k;
19310
+ }).catch(function(k) {
19311
+ throw W(b, k), k;
19246
19312
  });
19247
19313
  }
19248
- function J(b, C, w, M) {
19249
- M === void 0 && (M = 1);
19314
+ function J(b, C, w, A) {
19315
+ A === void 0 && (A = 1);
19250
19316
  try {
19251
- var k = b.db.transaction(b.storeName, C);
19252
- w(null, k);
19253
- } catch (A) {
19254
- if (M > 0 && (!b.db || A.name === "InvalidStateError" || A.name === "NotFoundError"))
19317
+ var M = b.db.transaction(b.storeName, C);
19318
+ w(null, M);
19319
+ } catch (k) {
19320
+ if (A > 0 && (!b.db || k.name === "InvalidStateError" || k.name === "NotFoundError"))
19255
19321
  return d.resolve().then(function() {
19256
- if (!b.db || A.name === "NotFoundError" && !b.db.objectStoreNames.contains(b.storeName) && b.version <= b.db.version)
19322
+ if (!b.db || k.name === "NotFoundError" && !b.db.objectStoreNames.contains(b.storeName) && b.version <= b.db.version)
19257
19323
  return b.db && (b.version = b.db.version + 1), se(b);
19258
19324
  }).then(function() {
19259
19325
  return Qt(b).then(function() {
19260
- J(b, C, w, M - 1);
19326
+ J(b, C, w, A - 1);
19261
19327
  });
19262
19328
  }).catch(w);
19263
- w(A);
19329
+ w(k);
19264
19330
  }
19265
19331
  }
19266
19332
  function le() {
@@ -19280,25 +19346,25 @@ function Bg() {
19280
19346
  db: null
19281
19347
  };
19282
19348
  if (b)
19283
- for (var M in b)
19284
- w[M] = b[M];
19285
- var k = v[w.name];
19286
- k || (k = le(), v[w.name] = k), k.forages.push(C), C._initReady || (C._initReady = C.ready, C.ready = ge);
19287
- var A = [];
19349
+ for (var A in b)
19350
+ w[A] = b[A];
19351
+ var M = v[w.name];
19352
+ M || (M = le(), v[w.name] = M), M.forages.push(C), C._initReady || (C._initReady = C.ready, C.ready = ge);
19353
+ var k = [];
19288
19354
  function x() {
19289
19355
  return d.resolve();
19290
19356
  }
19291
- for (var P = 0; P < k.forages.length; P++) {
19292
- var B = k.forages[P];
19293
- B !== C && A.push(B._initReady().catch(x));
19357
+ for (var P = 0; P < M.forages.length; P++) {
19358
+ var B = M.forages[P];
19359
+ B !== C && k.push(B._initReady().catch(x));
19294
19360
  }
19295
- var N = k.forages.slice(0);
19296
- return d.all(A).then(function() {
19297
- return w.db = k.db, Q(w);
19361
+ var N = M.forages.slice(0);
19362
+ return d.all(k).then(function() {
19363
+ return w.db = M.db, Q(w);
19298
19364
  }).then(function($) {
19299
19365
  return w.db = $, oe(w, C._defaultConfig.version) ? se(w) : $;
19300
19366
  }).then(function($) {
19301
- w.db = k.db = $, C._dbInfo = w;
19367
+ w.db = M.db = $, C._dbInfo = w;
19302
19368
  for (var V = 0; V < N.length; V++) {
19303
19369
  var te = N[V];
19304
19370
  te !== C && (te._dbInfo.db = w.db, te._dbInfo.version = w.version);
@@ -19308,33 +19374,33 @@ function Bg() {
19308
19374
  function Gi(b, C) {
19309
19375
  var w = this;
19310
19376
  b = f(b);
19311
- var M = new d(function(k, A) {
19377
+ var A = new d(function(M, k) {
19312
19378
  w.ready().then(function() {
19313
19379
  J(w._dbInfo, T, function(x, P) {
19314
19380
  if (x)
19315
- return A(x);
19381
+ return k(x);
19316
19382
  try {
19317
19383
  var B = P.objectStore(w._dbInfo.storeName), N = B.get(b);
19318
19384
  N.onsuccess = function() {
19319
19385
  var $ = N.result;
19320
- $ === void 0 && ($ = null), fe($) && ($ = X($)), k($);
19386
+ $ === void 0 && ($ = null), fe($) && ($ = X($)), M($);
19321
19387
  }, N.onerror = function() {
19322
- A(N.error);
19388
+ k(N.error);
19323
19389
  };
19324
19390
  } catch ($) {
19325
- A($);
19391
+ k($);
19326
19392
  }
19327
19393
  });
19328
- }).catch(A);
19394
+ }).catch(k);
19329
19395
  });
19330
- return h(M, C), M;
19396
+ return h(A, C), A;
19331
19397
  }
19332
19398
  function _a(b, C) {
19333
- var w = this, M = new d(function(k, A) {
19399
+ var w = this, A = new d(function(M, k) {
19334
19400
  w.ready().then(function() {
19335
19401
  J(w._dbInfo, T, function(x, P) {
19336
19402
  if (x)
19337
- return A(x);
19403
+ return k(x);
19338
19404
  try {
19339
19405
  var B = P.objectStore(w._dbInfo.storeName), N = B.openCursor(), $ = 1;
19340
19406
  N.onsuccess = function() {
@@ -19343,39 +19409,39 @@ function Bg() {
19343
19409
  var te = V.value;
19344
19410
  fe(te) && (te = X(te));
19345
19411
  var ie = b(te, V.key, $++);
19346
- ie !== void 0 ? k(ie) : V.continue();
19412
+ ie !== void 0 ? M(ie) : V.continue();
19347
19413
  } else
19348
- k();
19414
+ M();
19349
19415
  }, N.onerror = function() {
19350
- A(N.error);
19416
+ k(N.error);
19351
19417
  };
19352
19418
  } catch (V) {
19353
- A(V);
19419
+ k(V);
19354
19420
  }
19355
19421
  });
19356
- }).catch(A);
19422
+ }).catch(k);
19357
19423
  });
19358
- return h(M, C), M;
19424
+ return h(A, C), A;
19359
19425
  }
19360
19426
  function wc(b, C, w) {
19361
- var M = this;
19427
+ var A = this;
19362
19428
  b = f(b);
19363
- var k = new d(function(A, x) {
19429
+ var M = new d(function(k, x) {
19364
19430
  var P;
19365
- M.ready().then(function() {
19366
- return P = M._dbInfo, S.call(C) === "[object Blob]" ? R(P.db).then(function(B) {
19431
+ A.ready().then(function() {
19432
+ return P = A._dbInfo, _.call(C) === "[object Blob]" ? R(P.db).then(function(B) {
19367
19433
  return B ? C : j(C);
19368
19434
  }) : C;
19369
19435
  }).then(function(B) {
19370
- J(M._dbInfo, _, function(N, $) {
19436
+ J(A._dbInfo, S, function(N, $) {
19371
19437
  if (N)
19372
19438
  return x(N);
19373
19439
  try {
19374
- var V = $.objectStore(M._dbInfo.storeName);
19440
+ var V = $.objectStore(A._dbInfo.storeName);
19375
19441
  B === null && (B = void 0);
19376
19442
  var te = V.put(B, b);
19377
19443
  $.oncomplete = function() {
19378
- B === void 0 && (B = null), A(B);
19444
+ B === void 0 && (B = null), k(B);
19379
19445
  }, $.onabort = $.onerror = function() {
19380
19446
  var ie = te.error ? te.error : te.transaction.error;
19381
19447
  x(ie);
@@ -19386,149 +19452,149 @@ function Bg() {
19386
19452
  });
19387
19453
  }).catch(x);
19388
19454
  });
19389
- return h(k, w), k;
19455
+ return h(M, w), M;
19390
19456
  }
19391
19457
  function Sc(b, C) {
19392
19458
  var w = this;
19393
19459
  b = f(b);
19394
- var M = new d(function(k, A) {
19460
+ var A = new d(function(M, k) {
19395
19461
  w.ready().then(function() {
19396
- J(w._dbInfo, _, function(x, P) {
19462
+ J(w._dbInfo, S, function(x, P) {
19397
19463
  if (x)
19398
- return A(x);
19464
+ return k(x);
19399
19465
  try {
19400
19466
  var B = P.objectStore(w._dbInfo.storeName), N = B.delete(b);
19401
19467
  P.oncomplete = function() {
19402
- k();
19468
+ M();
19403
19469
  }, P.onerror = function() {
19404
- A(N.error);
19470
+ k(N.error);
19405
19471
  }, P.onabort = function() {
19406
19472
  var $ = N.error ? N.error : N.transaction.error;
19407
- A($);
19473
+ k($);
19408
19474
  };
19409
19475
  } catch ($) {
19410
- A($);
19476
+ k($);
19411
19477
  }
19412
19478
  });
19413
- }).catch(A);
19479
+ }).catch(k);
19414
19480
  });
19415
- return h(M, C), M;
19481
+ return h(A, C), A;
19416
19482
  }
19417
19483
  function _c(b) {
19418
- var C = this, w = new d(function(M, k) {
19484
+ var C = this, w = new d(function(A, M) {
19419
19485
  C.ready().then(function() {
19420
- J(C._dbInfo, _, function(A, x) {
19421
- if (A)
19422
- return k(A);
19486
+ J(C._dbInfo, S, function(k, x) {
19487
+ if (k)
19488
+ return M(k);
19423
19489
  try {
19424
19490
  var P = x.objectStore(C._dbInfo.storeName), B = P.clear();
19425
19491
  x.oncomplete = function() {
19426
- M();
19492
+ A();
19427
19493
  }, x.onabort = x.onerror = function() {
19428
19494
  var N = B.error ? B.error : B.transaction.error;
19429
- k(N);
19495
+ M(N);
19430
19496
  };
19431
19497
  } catch (N) {
19432
- k(N);
19498
+ M(N);
19433
19499
  }
19434
19500
  });
19435
- }).catch(k);
19501
+ }).catch(M);
19436
19502
  });
19437
19503
  return h(w, b), w;
19438
19504
  }
19439
19505
  function Tc(b) {
19440
- var C = this, w = new d(function(M, k) {
19506
+ var C = this, w = new d(function(A, M) {
19441
19507
  C.ready().then(function() {
19442
- J(C._dbInfo, T, function(A, x) {
19443
- if (A)
19444
- return k(A);
19508
+ J(C._dbInfo, T, function(k, x) {
19509
+ if (k)
19510
+ return M(k);
19445
19511
  try {
19446
19512
  var P = x.objectStore(C._dbInfo.storeName), B = P.count();
19447
19513
  B.onsuccess = function() {
19448
- M(B.result);
19514
+ A(B.result);
19449
19515
  }, B.onerror = function() {
19450
- k(B.error);
19516
+ M(B.error);
19451
19517
  };
19452
19518
  } catch (N) {
19453
- k(N);
19519
+ M(N);
19454
19520
  }
19455
19521
  });
19456
- }).catch(k);
19522
+ }).catch(M);
19457
19523
  });
19458
19524
  return h(w, b), w;
19459
19525
  }
19460
19526
  function Cc(b, C) {
19461
- var w = this, M = new d(function(k, A) {
19527
+ var w = this, A = new d(function(M, k) {
19462
19528
  if (b < 0) {
19463
- k(null);
19529
+ M(null);
19464
19530
  return;
19465
19531
  }
19466
19532
  w.ready().then(function() {
19467
19533
  J(w._dbInfo, T, function(x, P) {
19468
19534
  if (x)
19469
- return A(x);
19535
+ return k(x);
19470
19536
  try {
19471
19537
  var B = P.objectStore(w._dbInfo.storeName), N = !1, $ = B.openKeyCursor();
19472
19538
  $.onsuccess = function() {
19473
19539
  var V = $.result;
19474
19540
  if (!V) {
19475
- k(null);
19541
+ M(null);
19476
19542
  return;
19477
19543
  }
19478
- b === 0 || N ? k(V.key) : (N = !0, V.advance(b));
19544
+ b === 0 || N ? M(V.key) : (N = !0, V.advance(b));
19479
19545
  }, $.onerror = function() {
19480
- A($.error);
19546
+ k($.error);
19481
19547
  };
19482
19548
  } catch (V) {
19483
- A(V);
19549
+ k(V);
19484
19550
  }
19485
19551
  });
19486
- }).catch(A);
19552
+ }).catch(k);
19487
19553
  });
19488
- return h(M, C), M;
19554
+ return h(A, C), A;
19489
19555
  }
19490
- function Ac(b) {
19491
- var C = this, w = new d(function(M, k) {
19556
+ function kc(b) {
19557
+ var C = this, w = new d(function(A, M) {
19492
19558
  C.ready().then(function() {
19493
- J(C._dbInfo, T, function(A, x) {
19494
- if (A)
19495
- return k(A);
19559
+ J(C._dbInfo, T, function(k, x) {
19560
+ if (k)
19561
+ return M(k);
19496
19562
  try {
19497
19563
  var P = x.objectStore(C._dbInfo.storeName), B = P.openKeyCursor(), N = [];
19498
19564
  B.onsuccess = function() {
19499
19565
  var $ = B.result;
19500
19566
  if (!$) {
19501
- M(N);
19567
+ A(N);
19502
19568
  return;
19503
19569
  }
19504
19570
  N.push($.key), $.continue();
19505
19571
  }, B.onerror = function() {
19506
- k(B.error);
19572
+ M(B.error);
19507
19573
  };
19508
19574
  } catch ($) {
19509
- k($);
19575
+ M($);
19510
19576
  }
19511
19577
  });
19512
- }).catch(k);
19578
+ }).catch(M);
19513
19579
  });
19514
19580
  return h(w, b), w;
19515
19581
  }
19516
- function Mc(b, C) {
19582
+ function Ac(b, C) {
19517
19583
  C = g.apply(this, arguments);
19518
19584
  var w = this.config();
19519
19585
  b = typeof b != "function" && b || {}, b.name || (b.name = b.name || w.name, b.storeName = b.storeName || w.storeName);
19520
- var M = this, k;
19586
+ var A = this, M;
19521
19587
  if (!b.name)
19522
- k = d.reject("Invalid arguments");
19588
+ M = d.reject("Invalid arguments");
19523
19589
  else {
19524
- var A = b.name === w.name && M._dbInfo.db, x = A ? d.resolve(M._dbInfo.db) : Q(b).then(function(P) {
19590
+ var k = b.name === w.name && A._dbInfo.db, x = k ? d.resolve(A._dbInfo.db) : Q(b).then(function(P) {
19525
19591
  var B = v[b.name], N = B.forages;
19526
19592
  B.db = P;
19527
19593
  for (var $ = 0; $ < N.length; $++)
19528
19594
  N[$]._dbInfo.db = P;
19529
19595
  return P;
19530
19596
  });
19531
- b.storeName ? k = x.then(function(P) {
19597
+ b.storeName ? M = x.then(function(P) {
19532
19598
  if (P.objectStoreNames.contains(b.storeName)) {
19533
19599
  var B = P.version + 1;
19534
19600
  q(b);
@@ -19562,7 +19628,7 @@ function Bg() {
19562
19628
  }), ne;
19563
19629
  });
19564
19630
  }
19565
- }) : k = x.then(function(P) {
19631
+ }) : M = x.then(function(P) {
19566
19632
  q(b);
19567
19633
  var B = v[b.name], N = B.forages;
19568
19634
  P.close();
@@ -19594,9 +19660,9 @@ function Bg() {
19594
19660
  });
19595
19661
  });
19596
19662
  }
19597
- return h(k, C), k;
19663
+ return h(M, C), M;
19598
19664
  }
19599
- var kc = {
19665
+ var Mc = {
19600
19666
  _driver: "asyncStorage",
19601
19667
  _initStorage: dt,
19602
19668
  _support: l(),
@@ -19607,38 +19673,38 @@ function Bg() {
19607
19673
  clear: _c,
19608
19674
  length: Tc,
19609
19675
  key: Cc,
19610
- keys: Ac,
19611
- dropInstance: Mc
19676
+ keys: kc,
19677
+ dropInstance: Ac
19612
19678
  };
19613
19679
  function Ic() {
19614
19680
  return typeof openDatabase == "function";
19615
19681
  }
19616
- var Xe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Dc = "~~local_forage_type~", Ta = /^~~local_forage_type~([^~]+)~/, ei = "__lfsc__:", Ui = ei.length, Vi = "arbf", ji = "blob", Ca = "si08", Aa = "ui08", Ma = "uic8", ka = "si16", Ia = "si32", Da = "ur16", Ea = "ui32", xa = "fl32", Ra = "fl64", Pa = Ui + Vi.length, Ba = Object.prototype.toString;
19682
+ var Xe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Dc = "~~local_forage_type~", Ta = /^~~local_forage_type~([^~]+)~/, ei = "__lfsc__:", Ui = ei.length, Vi = "arbf", ji = "blob", Ca = "si08", ka = "ui08", Aa = "uic8", Ma = "si16", Ia = "si32", Da = "ur16", Ea = "ui32", xa = "fl32", Ra = "fl64", Pa = Ui + Vi.length, Ba = Object.prototype.toString;
19617
19683
  function Na(b) {
19618
- var C = b.length * 0.75, w = b.length, M, k = 0, A, x, P, B;
19684
+ var C = b.length * 0.75, w = b.length, A, M = 0, k, x, P, B;
19619
19685
  b[b.length - 1] === "=" && (C--, b[b.length - 2] === "=" && C--);
19620
19686
  var N = new ArrayBuffer(C), $ = new Uint8Array(N);
19621
- for (M = 0; M < w; M += 4)
19622
- A = Xe.indexOf(b[M]), x = Xe.indexOf(b[M + 1]), P = Xe.indexOf(b[M + 2]), B = Xe.indexOf(b[M + 3]), $[k++] = A << 2 | x >> 4, $[k++] = (x & 15) << 4 | P >> 2, $[k++] = (P & 3) << 6 | B & 63;
19687
+ for (A = 0; A < w; A += 4)
19688
+ k = Xe.indexOf(b[A]), x = Xe.indexOf(b[A + 1]), P = Xe.indexOf(b[A + 2]), B = Xe.indexOf(b[A + 3]), $[M++] = k << 2 | x >> 4, $[M++] = (x & 15) << 4 | P >> 2, $[M++] = (P & 3) << 6 | B & 63;
19623
19689
  return N;
19624
19690
  }
19625
19691
  function Ki(b) {
19626
- var C = new Uint8Array(b), w = "", M;
19627
- for (M = 0; M < C.length; M += 3)
19628
- w += Xe[C[M] >> 2], w += Xe[(C[M] & 3) << 4 | C[M + 1] >> 4], w += Xe[(C[M + 1] & 15) << 2 | C[M + 2] >> 6], w += Xe[C[M + 2] & 63];
19692
+ var C = new Uint8Array(b), w = "", A;
19693
+ for (A = 0; A < C.length; A += 3)
19694
+ w += Xe[C[A] >> 2], w += Xe[(C[A] & 3) << 4 | C[A + 1] >> 4], w += Xe[(C[A + 1] & 15) << 2 | C[A + 2] >> 6], w += Xe[C[A + 2] & 63];
19629
19695
  return C.length % 3 === 2 ? w = w.substring(0, w.length - 1) + "=" : C.length % 3 === 1 && (w = w.substring(0, w.length - 2) + "=="), w;
19630
19696
  }
19631
19697
  function Ec(b, C) {
19632
19698
  var w = "";
19633
19699
  if (b && (w = Ba.call(b)), b && (w === "[object ArrayBuffer]" || b.buffer && Ba.call(b.buffer) === "[object ArrayBuffer]")) {
19634
- var M, k = ei;
19635
- b instanceof ArrayBuffer ? (M = b, k += Vi) : (M = b.buffer, w === "[object Int8Array]" ? k += Ca : w === "[object Uint8Array]" ? k += Aa : w === "[object Uint8ClampedArray]" ? k += Ma : w === "[object Int16Array]" ? k += ka : w === "[object Uint16Array]" ? k += Da : w === "[object Int32Array]" ? k += Ia : w === "[object Uint32Array]" ? k += Ea : w === "[object Float32Array]" ? k += xa : w === "[object Float64Array]" ? k += Ra : C(new Error("Failed to get type for BinaryArray"))), C(k + Ki(M));
19700
+ var A, M = ei;
19701
+ b instanceof ArrayBuffer ? (A = b, M += Vi) : (A = b.buffer, w === "[object Int8Array]" ? M += Ca : w === "[object Uint8Array]" ? M += ka : w === "[object Uint8ClampedArray]" ? M += Aa : w === "[object Int16Array]" ? M += Ma : w === "[object Uint16Array]" ? M += Da : w === "[object Int32Array]" ? M += Ia : w === "[object Uint32Array]" ? M += Ea : w === "[object Float32Array]" ? M += xa : w === "[object Float64Array]" ? M += Ra : C(new Error("Failed to get type for BinaryArray"))), C(M + Ki(A));
19636
19702
  } else if (w === "[object Blob]") {
19637
- var A = new FileReader();
19638
- A.onload = function() {
19703
+ var k = new FileReader();
19704
+ k.onload = function() {
19639
19705
  var x = Dc + b.type + "~" + Ki(this.result);
19640
19706
  C(ei + ji + x);
19641
- }, A.readAsArrayBuffer(b);
19707
+ }, k.readAsArrayBuffer(b);
19642
19708
  } else
19643
19709
  try {
19644
19710
  C(JSON.stringify(b));
@@ -19649,35 +19715,35 @@ function Bg() {
19649
19715
  function xc(b) {
19650
19716
  if (b.substring(0, Ui) !== ei)
19651
19717
  return JSON.parse(b);
19652
- var C = b.substring(Pa), w = b.substring(Ui, Pa), M;
19718
+ var C = b.substring(Pa), w = b.substring(Ui, Pa), A;
19653
19719
  if (w === ji && Ta.test(C)) {
19654
- var k = C.match(Ta);
19655
- M = k[1], C = C.substring(k[0].length);
19720
+ var M = C.match(Ta);
19721
+ A = M[1], C = C.substring(M[0].length);
19656
19722
  }
19657
- var A = Na(C);
19723
+ var k = Na(C);
19658
19724
  switch (w) {
19659
19725
  case Vi:
19660
- return A;
19726
+ return k;
19661
19727
  case ji:
19662
- return u([A], { type: M });
19728
+ return u([k], { type: A });
19663
19729
  case Ca:
19664
- return new Int8Array(A);
19730
+ return new Int8Array(k);
19731
+ case ka:
19732
+ return new Uint8Array(k);
19665
19733
  case Aa:
19666
- return new Uint8Array(A);
19734
+ return new Uint8ClampedArray(k);
19667
19735
  case Ma:
19668
- return new Uint8ClampedArray(A);
19669
- case ka:
19670
- return new Int16Array(A);
19736
+ return new Int16Array(k);
19671
19737
  case Da:
19672
- return new Uint16Array(A);
19738
+ return new Uint16Array(k);
19673
19739
  case Ia:
19674
- return new Int32Array(A);
19740
+ return new Int32Array(k);
19675
19741
  case Ea:
19676
- return new Uint32Array(A);
19742
+ return new Uint32Array(k);
19677
19743
  case xa:
19678
- return new Float32Array(A);
19744
+ return new Float32Array(k);
19679
19745
  case Ra:
19680
- return new Float64Array(A);
19746
+ return new Float64Array(k);
19681
19747
  default:
19682
19748
  throw new Error("Unkown type: " + w);
19683
19749
  }
@@ -19688,17 +19754,17 @@ function Bg() {
19688
19754
  stringToBuffer: Na,
19689
19755
  bufferToString: Ki
19690
19756
  };
19691
- function Fa(b, C, w, M) {
19692
- b.executeSql("CREATE TABLE IF NOT EXISTS " + C.storeName + " (id INTEGER PRIMARY KEY, key unique, value)", [], w, M);
19757
+ function Fa(b, C, w, A) {
19758
+ b.executeSql("CREATE TABLE IF NOT EXISTS " + C.storeName + " (id INTEGER PRIMARY KEY, key unique, value)", [], w, A);
19693
19759
  }
19694
19760
  function Rc(b) {
19695
19761
  var C = this, w = {
19696
19762
  db: null
19697
19763
  };
19698
19764
  if (b)
19699
- for (var M in b)
19700
- w[M] = typeof b[M] != "string" ? b[M].toString() : b[M];
19701
- var k = new d(function(A, x) {
19765
+ for (var A in b)
19766
+ w[A] = typeof b[A] != "string" ? b[A].toString() : b[A];
19767
+ var M = new d(function(k, x) {
19702
19768
  try {
19703
19769
  w.db = openDatabase(w.name, String(w.version), w.description, w.size);
19704
19770
  } catch (P) {
@@ -19706,43 +19772,43 @@ function Bg() {
19706
19772
  }
19707
19773
  w.db.transaction(function(P) {
19708
19774
  Fa(P, w, function() {
19709
- C._dbInfo = w, A();
19775
+ C._dbInfo = w, k();
19710
19776
  }, function(B, N) {
19711
19777
  x(N);
19712
19778
  });
19713
19779
  }, x);
19714
19780
  });
19715
- return w.serializer = Yi, k;
19781
+ return w.serializer = Yi, M;
19716
19782
  }
19717
- function Je(b, C, w, M, k, A) {
19718
- b.executeSql(w, M, k, function(x, P) {
19783
+ function Je(b, C, w, A, M, k) {
19784
+ b.executeSql(w, A, M, function(x, P) {
19719
19785
  P.code === P.SYNTAX_ERR ? x.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?", [C.storeName], function(B, N) {
19720
- N.rows.length ? A(B, P) : Fa(B, C, function() {
19721
- B.executeSql(w, M, k, A);
19722
- }, A);
19723
- }, A) : A(x, P);
19724
- }, A);
19786
+ N.rows.length ? k(B, P) : Fa(B, C, function() {
19787
+ B.executeSql(w, A, M, k);
19788
+ }, k);
19789
+ }, k) : k(x, P);
19790
+ }, k);
19725
19791
  }
19726
19792
  function Pc(b, C) {
19727
19793
  var w = this;
19728
19794
  b = f(b);
19729
- var M = new d(function(k, A) {
19795
+ var A = new d(function(M, k) {
19730
19796
  w.ready().then(function() {
19731
19797
  var x = w._dbInfo;
19732
19798
  x.db.transaction(function(P) {
19733
19799
  Je(P, x, "SELECT * FROM " + x.storeName + " WHERE key = ? LIMIT 1", [b], function(B, N) {
19734
19800
  var $ = N.rows.length ? N.rows.item(0).value : null;
19735
- $ && ($ = x.serializer.deserialize($)), k($);
19801
+ $ && ($ = x.serializer.deserialize($)), M($);
19736
19802
  }, function(B, N) {
19737
- A(N);
19803
+ k(N);
19738
19804
  });
19739
19805
  });
19740
- }).catch(A);
19806
+ }).catch(k);
19741
19807
  });
19742
- return h(M, C), M;
19808
+ return h(A, C), A;
19743
19809
  }
19744
19810
  function Bc(b, C) {
19745
- var w = this, M = new d(function(k, A) {
19811
+ var w = this, A = new d(function(M, k) {
19746
19812
  w.ready().then(function() {
19747
19813
  var x = w._dbInfo;
19748
19814
  x.db.transaction(function(P) {
@@ -19750,26 +19816,26 @@ function Bg() {
19750
19816
  for (var $ = N.rows, V = $.length, te = 0; te < V; te++) {
19751
19817
  var ie = $.item(te), ne = ie.value;
19752
19818
  if (ne && (ne = x.serializer.deserialize(ne)), ne = b(ne, ie.key, te + 1), ne !== void 0) {
19753
- k(ne);
19819
+ M(ne);
19754
19820
  return;
19755
19821
  }
19756
19822
  }
19757
- k();
19823
+ M();
19758
19824
  }, function(B, N) {
19759
- A(N);
19825
+ k(N);
19760
19826
  });
19761
19827
  });
19762
- }).catch(A);
19828
+ }).catch(k);
19763
19829
  });
19764
- return h(M, C), M;
19830
+ return h(A, C), A;
19765
19831
  }
19766
- function $a(b, C, w, M) {
19767
- var k = this;
19832
+ function $a(b, C, w, A) {
19833
+ var M = this;
19768
19834
  b = f(b);
19769
- var A = new d(function(x, P) {
19770
- k.ready().then(function() {
19835
+ var k = new d(function(x, P) {
19836
+ M.ready().then(function() {
19771
19837
  C === void 0 && (C = null);
19772
- var B = C, N = k._dbInfo;
19838
+ var B = C, N = M._dbInfo;
19773
19839
  N.serializer.serialize(C, function($, V) {
19774
19840
  V ? P(V) : N.db.transaction(function(te) {
19775
19841
  Je(te, N, "INSERT OR REPLACE INTO " + N.storeName + " (key, value) VALUES (?, ?)", [b, $], function() {
@@ -19779,8 +19845,8 @@ function Bg() {
19779
19845
  });
19780
19846
  }, function(te) {
19781
19847
  if (te.code === te.QUOTA_ERR) {
19782
- if (M > 0) {
19783
- x($a.apply(k, [b, B, w, M - 1]));
19848
+ if (A > 0) {
19849
+ x($a.apply(M, [b, B, w, A - 1]));
19784
19850
  return;
19785
19851
  }
19786
19852
  P(te);
@@ -19789,7 +19855,7 @@ function Bg() {
19789
19855
  });
19790
19856
  }).catch(P);
19791
19857
  });
19792
- return h(A, w), A;
19858
+ return h(k, w), k;
19793
19859
  }
19794
19860
  function Nc(b, C, w) {
19795
19861
  return $a.apply(this, [b, C, w, 1]);
@@ -19797,99 +19863,99 @@ function Bg() {
19797
19863
  function Fc(b, C) {
19798
19864
  var w = this;
19799
19865
  b = f(b);
19800
- var M = new d(function(k, A) {
19866
+ var A = new d(function(M, k) {
19801
19867
  w.ready().then(function() {
19802
19868
  var x = w._dbInfo;
19803
19869
  x.db.transaction(function(P) {
19804
19870
  Je(P, x, "DELETE FROM " + x.storeName + " WHERE key = ?", [b], function() {
19805
- k();
19871
+ M();
19806
19872
  }, function(B, N) {
19807
- A(N);
19873
+ k(N);
19808
19874
  });
19809
19875
  });
19810
- }).catch(A);
19876
+ }).catch(k);
19811
19877
  });
19812
- return h(M, C), M;
19878
+ return h(A, C), A;
19813
19879
  }
19814
19880
  function $c(b) {
19815
- var C = this, w = new d(function(M, k) {
19881
+ var C = this, w = new d(function(A, M) {
19816
19882
  C.ready().then(function() {
19817
- var A = C._dbInfo;
19818
- A.db.transaction(function(x) {
19819
- Je(x, A, "DELETE FROM " + A.storeName, [], function() {
19820
- M();
19883
+ var k = C._dbInfo;
19884
+ k.db.transaction(function(x) {
19885
+ Je(x, k, "DELETE FROM " + k.storeName, [], function() {
19886
+ A();
19821
19887
  }, function(P, B) {
19822
- k(B);
19888
+ M(B);
19823
19889
  });
19824
19890
  });
19825
- }).catch(k);
19891
+ }).catch(M);
19826
19892
  });
19827
19893
  return h(w, b), w;
19828
19894
  }
19829
19895
  function Oc(b) {
19830
- var C = this, w = new d(function(M, k) {
19896
+ var C = this, w = new d(function(A, M) {
19831
19897
  C.ready().then(function() {
19832
- var A = C._dbInfo;
19833
- A.db.transaction(function(x) {
19834
- Je(x, A, "SELECT COUNT(key) as c FROM " + A.storeName, [], function(P, B) {
19898
+ var k = C._dbInfo;
19899
+ k.db.transaction(function(x) {
19900
+ Je(x, k, "SELECT COUNT(key) as c FROM " + k.storeName, [], function(P, B) {
19835
19901
  var N = B.rows.item(0).c;
19836
- M(N);
19902
+ A(N);
19837
19903
  }, function(P, B) {
19838
- k(B);
19904
+ M(B);
19839
19905
  });
19840
19906
  });
19841
- }).catch(k);
19907
+ }).catch(M);
19842
19908
  });
19843
19909
  return h(w, b), w;
19844
19910
  }
19845
19911
  function Lc(b, C) {
19846
- var w = this, M = new d(function(k, A) {
19912
+ var w = this, A = new d(function(M, k) {
19847
19913
  w.ready().then(function() {
19848
19914
  var x = w._dbInfo;
19849
19915
  x.db.transaction(function(P) {
19850
19916
  Je(P, x, "SELECT key FROM " + x.storeName + " WHERE id = ? LIMIT 1", [b + 1], function(B, N) {
19851
19917
  var $ = N.rows.length ? N.rows.item(0).key : null;
19852
- k($);
19918
+ M($);
19853
19919
  }, function(B, N) {
19854
- A(N);
19920
+ k(N);
19855
19921
  });
19856
19922
  });
19857
- }).catch(A);
19923
+ }).catch(k);
19858
19924
  });
19859
- return h(M, C), M;
19925
+ return h(A, C), A;
19860
19926
  }
19861
19927
  function zc(b) {
19862
- var C = this, w = new d(function(M, k) {
19928
+ var C = this, w = new d(function(A, M) {
19863
19929
  C.ready().then(function() {
19864
- var A = C._dbInfo;
19865
- A.db.transaction(function(x) {
19866
- Je(x, A, "SELECT key FROM " + A.storeName, [], function(P, B) {
19930
+ var k = C._dbInfo;
19931
+ k.db.transaction(function(x) {
19932
+ Je(x, k, "SELECT key FROM " + k.storeName, [], function(P, B) {
19867
19933
  for (var N = [], $ = 0; $ < B.rows.length; $++)
19868
19934
  N.push(B.rows.item($).key);
19869
- M(N);
19935
+ A(N);
19870
19936
  }, function(P, B) {
19871
- k(B);
19937
+ M(B);
19872
19938
  });
19873
19939
  });
19874
- }).catch(k);
19940
+ }).catch(M);
19875
19941
  });
19876
19942
  return h(w, b), w;
19877
19943
  }
19878
19944
  function Wc(b) {
19879
19945
  return new d(function(C, w) {
19880
- b.transaction(function(M) {
19881
- M.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'", [], function(k, A) {
19882
- for (var x = [], P = 0; P < A.rows.length; P++)
19883
- x.push(A.rows.item(P).name);
19946
+ b.transaction(function(A) {
19947
+ A.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'", [], function(M, k) {
19948
+ for (var x = [], P = 0; P < k.rows.length; P++)
19949
+ x.push(k.rows.item(P).name);
19884
19950
  C({
19885
19951
  db: b,
19886
19952
  storeNames: x
19887
19953
  });
19888
- }, function(k, A) {
19889
- w(A);
19954
+ }, function(M, k) {
19955
+ w(k);
19890
19956
  });
19891
- }, function(M) {
19892
- w(M);
19957
+ }, function(A) {
19958
+ w(A);
19893
19959
  });
19894
19960
  });
19895
19961
  }
@@ -19897,16 +19963,16 @@ function Bg() {
19897
19963
  C = g.apply(this, arguments);
19898
19964
  var w = this.config();
19899
19965
  b = typeof b != "function" && b || {}, b.name || (b.name = b.name || w.name, b.storeName = b.storeName || w.storeName);
19900
- var M = this, k;
19901
- return b.name ? k = new d(function(A) {
19966
+ var A = this, M;
19967
+ return b.name ? M = new d(function(k) {
19902
19968
  var x;
19903
- b.name === w.name ? x = M._dbInfo.db : x = openDatabase(b.name, "", "", 0), b.storeName ? A({
19969
+ b.name === w.name ? x = A._dbInfo.db : x = openDatabase(b.name, "", "", 0), b.storeName ? k({
19904
19970
  db: x,
19905
19971
  storeNames: [b.storeName]
19906
- }) : A(Wc(x));
19907
- }).then(function(A) {
19972
+ }) : k(Wc(x));
19973
+ }).then(function(k) {
19908
19974
  return new d(function(x, P) {
19909
- A.db.transaction(function(B) {
19975
+ k.db.transaction(function(B) {
19910
19976
  function N(ie) {
19911
19977
  return new d(function(ne, ve) {
19912
19978
  B.executeSql("DROP TABLE IF EXISTS " + ie, [], function() {
@@ -19916,8 +19982,8 @@ function Bg() {
19916
19982
  });
19917
19983
  });
19918
19984
  }
19919
- for (var $ = [], V = 0, te = A.storeNames.length; V < te; V++)
19920
- $.push(N(A.storeNames[V]));
19985
+ for (var $ = [], V = 0, te = k.storeNames.length; V < te; V++)
19986
+ $.push(N(k.storeNames[V]));
19921
19987
  d.all($).then(function() {
19922
19988
  x();
19923
19989
  }).catch(function(ie) {
@@ -19927,7 +19993,7 @@ function Bg() {
19927
19993
  P(B);
19928
19994
  });
19929
19995
  });
19930
- }) : k = d.reject("Invalid arguments"), h(k, C), k;
19996
+ }) : M = d.reject("Invalid arguments"), h(M, C), M;
19931
19997
  }
19932
19998
  var qc = {
19933
19999
  _driver: "webSQLStorage",
@@ -19969,15 +20035,15 @@ function Bg() {
19969
20035
  function jc(b) {
19970
20036
  var C = this, w = {};
19971
20037
  if (b)
19972
- for (var M in b)
19973
- w[M] = b[M];
20038
+ for (var A in b)
20039
+ w[A] = b[A];
19974
20040
  return w.keyPrefix = Oa(b, C._defaultConfig), Vc() ? (C._dbInfo = w, w.serializer = Yi, d.resolve()) : d.reject();
19975
20041
  }
19976
20042
  function Kc(b) {
19977
20043
  var C = this, w = C.ready().then(function() {
19978
- for (var M = C._dbInfo.keyPrefix, k = localStorage.length - 1; k >= 0; k--) {
19979
- var A = localStorage.key(k);
19980
- A.indexOf(M) === 0 && localStorage.removeItem(A);
20044
+ for (var A = C._dbInfo.keyPrefix, M = localStorage.length - 1; M >= 0; M--) {
20045
+ var k = localStorage.key(M);
20046
+ k.indexOf(A) === 0 && localStorage.removeItem(k);
19981
20047
  }
19982
20048
  });
19983
20049
  return h(w, b), w;
@@ -19985,98 +20051,98 @@ function Bg() {
19985
20051
  function Yc(b, C) {
19986
20052
  var w = this;
19987
20053
  b = f(b);
19988
- var M = w.ready().then(function() {
19989
- var k = w._dbInfo, A = localStorage.getItem(k.keyPrefix + b);
19990
- return A && (A = k.serializer.deserialize(A)), A;
20054
+ var A = w.ready().then(function() {
20055
+ var M = w._dbInfo, k = localStorage.getItem(M.keyPrefix + b);
20056
+ return k && (k = M.serializer.deserialize(k)), k;
19991
20057
  });
19992
- return h(M, C), M;
20058
+ return h(A, C), A;
19993
20059
  }
19994
20060
  function Zc(b, C) {
19995
- var w = this, M = w.ready().then(function() {
19996
- for (var k = w._dbInfo, A = k.keyPrefix, x = A.length, P = localStorage.length, B = 1, N = 0; N < P; N++) {
20061
+ var w = this, A = w.ready().then(function() {
20062
+ for (var M = w._dbInfo, k = M.keyPrefix, x = k.length, P = localStorage.length, B = 1, N = 0; N < P; N++) {
19997
20063
  var $ = localStorage.key(N);
19998
- if ($.indexOf(A) === 0) {
20064
+ if ($.indexOf(k) === 0) {
19999
20065
  var V = localStorage.getItem($);
20000
- if (V && (V = k.serializer.deserialize(V)), V = b(V, $.substring(x), B++), V !== void 0)
20066
+ if (V && (V = M.serializer.deserialize(V)), V = b(V, $.substring(x), B++), V !== void 0)
20001
20067
  return V;
20002
20068
  }
20003
20069
  }
20004
20070
  });
20005
- return h(M, C), M;
20071
+ return h(A, C), A;
20006
20072
  }
20007
20073
  function Xc(b, C) {
20008
- var w = this, M = w.ready().then(function() {
20009
- var k = w._dbInfo, A;
20074
+ var w = this, A = w.ready().then(function() {
20075
+ var M = w._dbInfo, k;
20010
20076
  try {
20011
- A = localStorage.key(b);
20077
+ k = localStorage.key(b);
20012
20078
  } catch {
20013
- A = null;
20079
+ k = null;
20014
20080
  }
20015
- return A && (A = A.substring(k.keyPrefix.length)), A;
20081
+ return k && (k = k.substring(M.keyPrefix.length)), k;
20016
20082
  });
20017
- return h(M, C), M;
20083
+ return h(A, C), A;
20018
20084
  }
20019
20085
  function Jc(b) {
20020
20086
  var C = this, w = C.ready().then(function() {
20021
- for (var M = C._dbInfo, k = localStorage.length, A = [], x = 0; x < k; x++) {
20087
+ for (var A = C._dbInfo, M = localStorage.length, k = [], x = 0; x < M; x++) {
20022
20088
  var P = localStorage.key(x);
20023
- P.indexOf(M.keyPrefix) === 0 && A.push(P.substring(M.keyPrefix.length));
20089
+ P.indexOf(A.keyPrefix) === 0 && k.push(P.substring(A.keyPrefix.length));
20024
20090
  }
20025
- return A;
20091
+ return k;
20026
20092
  });
20027
20093
  return h(w, b), w;
20028
20094
  }
20029
20095
  function Qc(b) {
20030
- var C = this, w = C.keys().then(function(M) {
20031
- return M.length;
20096
+ var C = this, w = C.keys().then(function(A) {
20097
+ return A.length;
20032
20098
  });
20033
20099
  return h(w, b), w;
20034
20100
  }
20035
20101
  function el(b, C) {
20036
20102
  var w = this;
20037
20103
  b = f(b);
20038
- var M = w.ready().then(function() {
20039
- var k = w._dbInfo;
20040
- localStorage.removeItem(k.keyPrefix + b);
20104
+ var A = w.ready().then(function() {
20105
+ var M = w._dbInfo;
20106
+ localStorage.removeItem(M.keyPrefix + b);
20041
20107
  });
20042
- return h(M, C), M;
20108
+ return h(A, C), A;
20043
20109
  }
20044
20110
  function tl(b, C, w) {
20045
- var M = this;
20111
+ var A = this;
20046
20112
  b = f(b);
20047
- var k = M.ready().then(function() {
20113
+ var M = A.ready().then(function() {
20048
20114
  C === void 0 && (C = null);
20049
- var A = C;
20115
+ var k = C;
20050
20116
  return new d(function(x, P) {
20051
- var B = M._dbInfo;
20117
+ var B = A._dbInfo;
20052
20118
  B.serializer.serialize(C, function(N, $) {
20053
20119
  if ($)
20054
20120
  P($);
20055
20121
  else
20056
20122
  try {
20057
- localStorage.setItem(B.keyPrefix + b, N), x(A);
20123
+ localStorage.setItem(B.keyPrefix + b, N), x(k);
20058
20124
  } catch (V) {
20059
20125
  (V.name === "QuotaExceededError" || V.name === "NS_ERROR_DOM_QUOTA_REACHED") && P(V), P(V);
20060
20126
  }
20061
20127
  });
20062
20128
  });
20063
20129
  });
20064
- return h(k, w), k;
20130
+ return h(M, w), M;
20065
20131
  }
20066
20132
  function il(b, C) {
20067
20133
  if (C = g.apply(this, arguments), b = typeof b != "function" && b || {}, !b.name) {
20068
20134
  var w = this.config();
20069
20135
  b.name = b.name || w.name, b.storeName = b.storeName || w.storeName;
20070
20136
  }
20071
- var M = this, k;
20072
- return b.name ? k = new d(function(A) {
20073
- b.storeName ? A(Oa(b, M._defaultConfig)) : A(b.name + "/");
20074
- }).then(function(A) {
20137
+ var A = this, M;
20138
+ return b.name ? M = new d(function(k) {
20139
+ b.storeName ? k(Oa(b, A._defaultConfig)) : k(b.name + "/");
20140
+ }).then(function(k) {
20075
20141
  for (var x = localStorage.length - 1; x >= 0; x--) {
20076
20142
  var P = localStorage.key(x);
20077
- P.indexOf(A) === 0 && localStorage.removeItem(P);
20143
+ P.indexOf(k) === 0 && localStorage.removeItem(P);
20078
20144
  }
20079
- }) : k = d.reject("Invalid arguments"), h(k, C), k;
20145
+ }) : M = d.reject("Invalid arguments"), h(M, C), M;
20080
20146
  }
20081
20147
  var nl = {
20082
20148
  _driver: "localStorageWrapper",
@@ -20094,16 +20160,16 @@ function Bg() {
20094
20160
  }, al = function(C, w) {
20095
20161
  return C === w || typeof C == "number" && typeof w == "number" && isNaN(C) && isNaN(w);
20096
20162
  }, sl = function(C, w) {
20097
- for (var M = C.length, k = 0; k < M; ) {
20098
- if (al(C[k], w))
20163
+ for (var A = C.length, M = 0; M < A; ) {
20164
+ if (al(C[M], w))
20099
20165
  return !0;
20100
- k++;
20166
+ M++;
20101
20167
  }
20102
20168
  return !1;
20103
20169
  }, La = Array.isArray || function(b) {
20104
20170
  return Object.prototype.toString.call(b) === "[object Array]";
20105
20171
  }, xt = {}, za = {}, yt = {
20106
- INDEXEDDB: kc,
20172
+ INDEXEDDB: Mc,
20107
20173
  WEBSQL: qc,
20108
20174
  LOCALSTORAGE: nl
20109
20175
  }, rl = [yt.INDEXEDDB._driver, yt.WEBSQL._driver, yt.LOCALSTORAGE._driver], ti = ["dropInstance"], Zi = ["clear", "getItem", "iterate", "key", "keys", "length", "removeItem", "setItem"].concat(ti), ol = {
@@ -20138,8 +20204,8 @@ function Bg() {
20138
20204
  r(this, b);
20139
20205
  for (var w in yt)
20140
20206
  if (yt.hasOwnProperty(w)) {
20141
- var M = yt[w], k = M._driver;
20142
- this[w] = k, xt[k] || this.defineDriver(M);
20207
+ var A = yt[w], M = A._driver;
20208
+ this[w] = M, xt[M] || this.defineDriver(A);
20143
20209
  }
20144
20210
  this._defaultConfig = Xi({}, ol), this._config = Xi({}, this._defaultConfig, C), this._driverSet = null, this._initDriver = null, this._ready = !1, this._dbInfo = null, this._wrapLibraryMethodsWithReady(), this.setDriver(this._config.driver).catch(function() {
20145
20211
  });
@@ -20148,15 +20214,15 @@ function Bg() {
20148
20214
  if ((typeof w > "u" ? "undefined" : a(w)) === "object") {
20149
20215
  if (this._ready)
20150
20216
  return new Error("Can't call config() after localforage has been used.");
20151
- for (var M in w) {
20152
- if (M === "storeName" && (w[M] = w[M].replace(/\W/g, "_")), M === "version" && typeof w[M] != "number")
20217
+ for (var A in w) {
20218
+ if (A === "storeName" && (w[A] = w[A].replace(/\W/g, "_")), A === "version" && typeof w[A] != "number")
20153
20219
  return new Error("Database version must be a number.");
20154
- this._config[M] = w[M];
20220
+ this._config[A] = w[A];
20155
20221
  }
20156
20222
  return "driver" in w && w.driver ? this.setDriver(this._config.driver) : !0;
20157
20223
  } else return typeof w == "string" ? this._config[w] : this._config;
20158
- }, b.prototype.defineDriver = function(w, M, k) {
20159
- var A = new d(function(x, P) {
20224
+ }, b.prototype.defineDriver = function(w, A, M) {
20225
+ var k = new d(function(x, P) {
20160
20226
  try {
20161
20227
  var B = w._driver, N = new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");
20162
20228
  if (!w._driver) {
@@ -20190,29 +20256,29 @@ function Bg() {
20190
20256
  P(Fe);
20191
20257
  }
20192
20258
  });
20193
- return m(A, M, k), A;
20259
+ return m(k, A, M), k;
20194
20260
  }, b.prototype.driver = function() {
20195
20261
  return this._driver || null;
20196
- }, b.prototype.getDriver = function(w, M, k) {
20197
- var A = xt[w] ? d.resolve(xt[w]) : d.reject(new Error("Driver not found."));
20198
- return m(A, M, k), A;
20262
+ }, b.prototype.getDriver = function(w, A, M) {
20263
+ var k = xt[w] ? d.resolve(xt[w]) : d.reject(new Error("Driver not found."));
20264
+ return m(k, A, M), k;
20199
20265
  }, b.prototype.getSerializer = function(w) {
20200
- var M = d.resolve(Yi);
20201
- return m(M, w), M;
20266
+ var A = d.resolve(Yi);
20267
+ return m(A, w), A;
20202
20268
  }, b.prototype.ready = function(w) {
20203
- var M = this, k = M._driverSet.then(function() {
20204
- return M._ready === null && (M._ready = M._initDriver()), M._ready;
20269
+ var A = this, M = A._driverSet.then(function() {
20270
+ return A._ready === null && (A._ready = A._initDriver()), A._ready;
20205
20271
  });
20206
- return m(k, w, w), k;
20207
- }, b.prototype.setDriver = function(w, M, k) {
20208
- var A = this;
20272
+ return m(M, w, w), M;
20273
+ }, b.prototype.setDriver = function(w, A, M) {
20274
+ var k = this;
20209
20275
  La(w) || (w = [w]);
20210
20276
  var x = this._getSupportedDrivers(w);
20211
20277
  function P() {
20212
- A._config.driver = A.driver();
20278
+ k._config.driver = k.driver();
20213
20279
  }
20214
20280
  function B(V) {
20215
- return A._extend(V), P(), A._ready = A._initStorage(A._config), A._ready;
20281
+ return k._extend(V), P(), k._ready = k._initStorage(k._config), k._ready;
20216
20282
  }
20217
20283
  function N(V) {
20218
20284
  return function() {
@@ -20220,11 +20286,11 @@ function Bg() {
20220
20286
  function ie() {
20221
20287
  for (; te < V.length; ) {
20222
20288
  var ne = V[te];
20223
- return te++, A._dbInfo = null, A._ready = null, A.getDriver(ne).then(B).catch(ie);
20289
+ return te++, k._dbInfo = null, k._ready = null, k.getDriver(ne).then(B).catch(ie);
20224
20290
  }
20225
20291
  P();
20226
20292
  var ve = new Error("No available storage method found.");
20227
- return A._driverSet = d.reject(ve), A._driverSet;
20293
+ return k._driverSet = d.reject(ve), k._driverSet;
20228
20294
  }
20229
20295
  return ie();
20230
20296
  };
@@ -20234,26 +20300,26 @@ function Bg() {
20234
20300
  }) : d.resolve();
20235
20301
  return this._driverSet = $.then(function() {
20236
20302
  var V = x[0];
20237
- return A._dbInfo = null, A._ready = null, A.getDriver(V).then(function(te) {
20238
- A._driver = te._driver, P(), A._wrapLibraryMethodsWithReady(), A._initDriver = N(x);
20303
+ return k._dbInfo = null, k._ready = null, k.getDriver(V).then(function(te) {
20304
+ k._driver = te._driver, P(), k._wrapLibraryMethodsWithReady(), k._initDriver = N(x);
20239
20305
  });
20240
20306
  }).catch(function() {
20241
20307
  P();
20242
20308
  var V = new Error("No available storage method found.");
20243
- return A._driverSet = d.reject(V), A._driverSet;
20244
- }), m(this._driverSet, M, k), this._driverSet;
20309
+ return k._driverSet = d.reject(V), k._driverSet;
20310
+ }), m(this._driverSet, A, M), this._driverSet;
20245
20311
  }, b.prototype.supports = function(w) {
20246
20312
  return !!za[w];
20247
20313
  }, b.prototype._extend = function(w) {
20248
20314
  Xi(this, w);
20249
20315
  }, b.prototype._getSupportedDrivers = function(w) {
20250
- for (var M = [], k = 0, A = w.length; k < A; k++) {
20251
- var x = w[k];
20252
- this.supports(x) && M.push(x);
20316
+ for (var A = [], M = 0, k = w.length; M < k; M++) {
20317
+ var x = w[M];
20318
+ this.supports(x) && A.push(x);
20253
20319
  }
20254
- return M;
20320
+ return A;
20255
20321
  }, b.prototype._wrapLibraryMethodsWithReady = function() {
20256
- for (var w = 0, M = Zi.length; w < M; w++)
20322
+ for (var w = 0, A = Zi.length; w < A; w++)
20257
20323
  cl(this, Zi[w]);
20258
20324
  }, b.prototype.createInstance = function(w) {
20259
20325
  return new b(w);
@@ -23319,8 +23385,8 @@ class pn {
23319
23385
  g = a;
23320
23386
  break;
23321
23387
  }
23322
- const p = f ? this.getSpicedValue(u, g, e) : g, y = f ? g : this.getSpicedValue(u, g, e), v = t.random(), S = t.random();
23323
- o[h] = Math.floor(8 + v * l + p * c), o[m] = Math.floor(8 + S * l + y * c);
23388
+ const p = f ? this.getSpicedValue(u, g, e) : g, y = f ? g : this.getSpicedValue(u, g, e), v = t.random(), _ = t.random();
23389
+ o[h] = Math.floor(8 + v * l + p * c), o[m] = Math.floor(8 + _ * l + y * c);
23324
23390
  }
23325
23391
  return o;
23326
23392
  }
@@ -23554,8 +23620,8 @@ class pp {
23554
23620
  */
23555
23621
  static generate(e, t, i) {
23556
23622
  xo();
23557
- const n = new Ve(e), a = Y.getInstance(), r = a.get("appearance.bodyTypes"), o = a.getWeights("appearance.bodyTypes"), c = a.getMode("appearance.bodyTypes") || "default", l = a.get("appearance.skinTones"), u = a.getWeights("appearance.skinTones"), d = a.getMode("appearance.skinTones") || "default", h = a.get("appearance.hairStyles"), m = a.getWeights("appearance.hairStyles"), f = a.getMode("appearance.hairStyles") || "default", g = a.get("appearance.hairColors"), p = a.getWeights("appearance.hairColors"), y = a.getMode("appearance.hairColors") || "default", v = a.get("appearance.eyeColors"), S = a.getWeights("appearance.eyeColors"), T = a.getMode("appearance.eyeColors") || "default", _ = a.get("appearance.facialFeatures"), I = a.getWeights("appearance.facialFeatures"), D = a.getMode("appearance.facialFeatures") || "default", R = Le.select(r, o, n, c), q = Le.select(l, u, n, d), O = Le.select(h, m, n, f), W = Le.select(g, p, n, y), Z = Le.select(v, S, n, T), Q = n.randomInt(1, 4), se = Le.selectMultiple(
23558
- _,
23623
+ const n = new Ve(e), a = Y.getInstance(), r = a.get("appearance.bodyTypes"), o = a.getWeights("appearance.bodyTypes"), c = a.getMode("appearance.bodyTypes") || "default", l = a.get("appearance.skinTones"), u = a.getWeights("appearance.skinTones"), d = a.getMode("appearance.skinTones") || "default", h = a.get("appearance.hairStyles"), m = a.getWeights("appearance.hairStyles"), f = a.getMode("appearance.hairStyles") || "default", g = a.get("appearance.hairColors"), p = a.getWeights("appearance.hairColors"), y = a.getMode("appearance.hairColors") || "default", v = a.get("appearance.eyeColors"), _ = a.getWeights("appearance.eyeColors"), T = a.getMode("appearance.eyeColors") || "default", S = a.get("appearance.facialFeatures"), I = a.getWeights("appearance.facialFeatures"), D = a.getMode("appearance.facialFeatures") || "default", R = Le.select(r, o, n, c), q = Le.select(l, u, n, d), O = Le.select(h, m, n, f), W = Le.select(g, p, n, y), Z = Le.select(v, _, n, T), Q = n.randomInt(1, 4), se = Le.selectMultiple(
23624
+ S,
23559
23625
  I,
23560
23626
  n,
23561
23627
  Q,
@@ -24211,7 +24277,7 @@ class xe {
24211
24277
  if (t.grantsFeatures)
24212
24278
  for (const a of t.grantsFeatures)
24213
24279
  if (typeof a == "string") {
24214
- const r = ke.getInstance(), o = r.getClassFeatureById(a), c = o ? void 0 : r.getRacialTraitById(a);
24280
+ const r = Me.getInstance(), o = r.getClassFeatureById(a), c = o ? void 0 : r.getRacialTraitById(a);
24215
24281
  if (o || c) {
24216
24282
  const u = {
24217
24283
  featureId: a,
@@ -25060,7 +25126,7 @@ class ua {
25060
25126
  static generate(e, t, i, n = {}) {
25061
25127
  const a = new Ve(e), r = n.level || 1, o = n.gameMode || "standard";
25062
25128
  Wo();
25063
- const c = ke.getInstance();
25129
+ const c = Me.getInstance();
25064
25130
  n.extensions && ua.registerExtensions(n.extensions);
25065
25131
  let l;
25066
25132
  const u = n.subrace;
@@ -25098,7 +25164,7 @@ class ua {
25098
25164
  ), g = pn.calculateBaseScores(t, a), p = pn.applyRacialBonuses(g, h), y = pn.calculateModifiers(p), v = zr(m);
25099
25165
  if (!v)
25100
25166
  throw new Error(`Unknown class: ${m}. Cannot generate character.`);
25101
- const T = Xn(h)?.speed ?? 30, _ = v.hit_die + y.CON, I = 10 + y.DEX, D = y.DEX, R = Wr[r], q = fp.assignSkills(m, a), O = {
25167
+ const T = Xn(h)?.speed ?? 30, S = v.hit_die + y.CON, I = 10 + y.DEX, D = y.DEX, R = Wr[r], q = fp.assignSkills(m, a), O = {
25102
25168
  STR: v.saving_throws.includes("STR"),
25103
25169
  DEX: v.saving_throws.includes("DEX"),
25104
25170
  CON: v.saving_throws.includes("CON"),
@@ -25115,7 +25181,7 @@ class ua {
25115
25181
  ability_scores: p,
25116
25182
  ability_modifiers: y,
25117
25183
  proficiency_bonus: R,
25118
- hp: { current: _, max: _, temp: 0 },
25184
+ hp: { current: S, max: S, temp: 0 },
25119
25185
  armor_class: I,
25120
25186
  initiative: D,
25121
25187
  speed: T,
@@ -25158,8 +25224,8 @@ class ua {
25158
25224
  ability_modifiers: y,
25159
25225
  proficiency_bonus: R,
25160
25226
  hp: {
25161
- current: _,
25162
- max: _,
25227
+ current: S,
25228
+ max: S,
25163
25229
  temp: 0
25164
25230
  },
25165
25231
  armor_class: I,
@@ -25310,8 +25376,8 @@ function _p(s) {
25310
25376
  for (let f = 0; f < r / 2; f++) {
25311
25377
  const g = d + f, p = d + f + r / 2, y = i[p] * h - n[p] * m, v = i[p] * m + n[p] * h;
25312
25378
  i[p] = i[g] - y, n[p] = n[g] - v, i[g] += y, n[g] += v;
25313
- const S = h * l - m * u;
25314
- m = h * u + m * l, h = S;
25379
+ const _ = h * l - m * u;
25380
+ m = h * u + m * l, h = _;
25315
25381
  }
25316
25382
  }
25317
25383
  r *= 2;
@@ -25362,7 +25428,7 @@ function ar(s, e) {
25362
25428
  o[c] = t * s[c] + i * s[c - 1] + n * s[c - 2] - a * o[c - 1] - r * o[c - 2];
25363
25429
  return o;
25364
25430
  }
25365
- function Ap(s, e, t, i, n) {
25431
+ function kp(s, e, t, i, n) {
25366
25432
  if (s.length === 0)
25367
25433
  return new Float32Array(0);
25368
25434
  const a = 8;
@@ -25382,13 +25448,13 @@ function Ap(s, e, t, i, n) {
25382
25448
  }
25383
25449
  return o;
25384
25450
  }
25385
- function Mp(s, e, t, i) {
25451
+ function Ap(s, e, t, i) {
25386
25452
  const n = Uo.find((a) => a.name === e);
25387
25453
  if (!n)
25388
25454
  throw new Error(`Unknown frequency band: ${e}. Valid bands are: low, mid, high`);
25389
- return Ap(s, n.lowHz, n.highHz, t);
25455
+ return kp(s, n.lowHz, n.highHz, t);
25390
25456
  }
25391
- const kp = {
25457
+ const Mp = {
25392
25458
  targetSampleRate: 44100,
25393
25459
  fftWindowSizeMs: 23,
25394
25460
  hopSizeMs: 10,
@@ -25404,7 +25470,7 @@ class Ip {
25404
25470
  */
25405
25471
  constructor(e = {}) {
25406
25472
  if (this.config = {
25407
- ...kp,
25473
+ ...Mp,
25408
25474
  ...e
25409
25475
  }, this.config.peakThreshold < 0 || this.config.peakThreshold > 1)
25410
25476
  throw new Error(`peakThreshold must be between 0 and 1, got: ${this.config.peakThreshold}`);
@@ -25459,13 +25525,13 @@ class Ip {
25459
25525
  * Analyze a single frequency band
25460
25526
  */
25461
25527
  analyzeBand(e, t, i, n, a, r, o) {
25462
- const c = Mp(e, t.name, i), l = Go(c, n, a, i), u = l.numFrames, d = new Float32Array(u);
25528
+ const c = Ap(e, t.name, i), l = Go(c, n, a, i), u = l.numFrames, d = new Float32Array(u);
25463
25529
  for (let T = 0; T < u; T++) {
25464
- const _ = l.frames[T];
25530
+ const S = l.frames[T];
25465
25531
  let I = 0;
25466
- for (let D = 0; D < _.length; D++)
25467
- I += _[D] * _[D];
25468
- d[T] = Math.sqrt(I / _.length);
25532
+ for (let D = 0; D < S.length; D++)
25533
+ I += S[D] * S[D];
25534
+ d[T] = Math.sqrt(I / S.length);
25469
25535
  }
25470
25536
  const h = Math.max(...d);
25471
25537
  if (h > 0)
@@ -25475,7 +25541,7 @@ class Ip {
25475
25541
  if (p > 0)
25476
25542
  for (let T = 0; T < g.length; T++)
25477
25543
  y[T] = g[T] / p;
25478
- const v = this.findPeaks(y, this.config.peakThreshold), S = v.map((T) => T * r);
25544
+ const v = this.findPeaks(y, this.config.peakThreshold), _ = v.map((T) => T * r);
25479
25545
  return {
25480
25546
  name: t.name,
25481
25547
  frequencyRange: {
@@ -25484,7 +25550,7 @@ class Ip {
25484
25550
  },
25485
25551
  envelope: y,
25486
25552
  peaks: v,
25487
- peakTimes: S,
25553
+ peakTimes: _,
25488
25554
  energy: m,
25489
25555
  energyOverTime: d
25490
25556
  };
@@ -26651,8 +26717,8 @@ class Fp {
26651
26717
  analyzeBand(e, t, i, n) {
26652
26718
  const a = e.beats, o = (a.length > 0 ? Math.max(...a.map((v) => v.beatIndex)) : 0) + 1, c = /* @__PURE__ */ new Map();
26653
26719
  for (const v of a) {
26654
- const S = c.get(v.beatIndex);
26655
- S ? (S.count++, S.intensities.push(v.intensity)) : c.set(v.beatIndex, {
26720
+ const _ = c.get(v.beatIndex);
26721
+ _ ? (_.count++, _.intensities.push(v.intensity)) : c.set(v.beatIndex, {
26656
26722
  count: 1,
26657
26723
  intensities: [v.intensity]
26658
26724
  });
@@ -26660,12 +26726,12 @@ class Fp {
26660
26726
  const l = [];
26661
26727
  let u = 0;
26662
26728
  for (let v = 0; v < o; v++) {
26663
- const S = c.get(v), T = S?.count ?? 0, _ = S ? S.intensities.reduce((I, D) => I + D, 0) / S.intensities.length : 0;
26729
+ const _ = c.get(v), T = _?.count ?? 0, S = _ ? _.intensities.reduce((I, D) => I + D, 0) / _.intensities.length : 0;
26664
26730
  l.push({
26665
26731
  beatIndex: v,
26666
26732
  transientCount: T,
26667
26733
  bands: T > 0 ? [t] : [],
26668
- averageIntensity: _
26734
+ averageIntensity: S
26669
26735
  }), u += T;
26670
26736
  }
26671
26737
  const d = l.map((v) => v.transientCount);
@@ -26759,7 +26825,7 @@ class Fp {
26759
26825
  calculateSectionMetrics(e, t, i) {
26760
26826
  const n = [], a = this.config.beatsPerSection, r = e.length;
26761
26827
  for (let o = 0; o < r; o += a) {
26762
- const c = Math.min(o + a - 1, r - 1), l = e.slice(o, c + 1), u = l.reduce((v, S) => v + S.transientCount, 0), d = l.length, h = d > 0 ? u / d * t : 0, m = l.map((v) => v.transientCount), f = m.length > 0 ? Math.min(...m) * t : 0, g = m.length > 0 ? Math.max(...m) * t : 0, p = this.categorizeDensity(h), y = this.determineNaturalDifficulty(p);
26828
+ const c = Math.min(o + a - 1, r - 1), l = e.slice(o, c + 1), u = l.reduce((v, _) => v + _.transientCount, 0), d = l.length, h = d > 0 ? u / d * t : 0, m = l.map((v) => v.transientCount), f = m.length > 0 ? Math.min(...m) * t : 0, g = m.length > 0 ? Math.max(...m) * t : 0, p = this.categorizeDensity(h), y = this.determineNaturalDifficulty(p);
26763
26829
  n.push({
26764
26830
  startBeat: o,
26765
26831
  endBeat: c,
@@ -27086,15 +27152,15 @@ class qp {
27086
27152
  generate(e, t, i, n) {
27087
27153
  const a = t.sectionWinners, r = { low: 0, mid: 0, high: 0 }, o = { low: 0, mid: 0, high: 0 }, l = a.filter((y) => {
27088
27154
  const v = ["low", "mid", "high"];
27089
- let S = !1;
27155
+ let _ = !1;
27090
27156
  for (const T of v)
27091
27157
  if (e.streams[T].beats.filter(
27092
27158
  (D) => D.beatIndex >= y.beatRange.start && D.beatIndex <= y.beatRange.end
27093
27159
  ).length > 0) {
27094
- S = !0;
27160
+ _ = !0;
27095
27161
  break;
27096
27162
  }
27097
- return S;
27163
+ return _;
27098
27164
  }).map((y) => ({
27099
27165
  beatRange: y.beatRange,
27100
27166
  sourceBand: y.winner,
@@ -27105,12 +27171,12 @@ class qp {
27105
27171
  o[y.sourceBand]++;
27106
27172
  const u = [];
27107
27173
  for (const y of l) {
27108
- const v = e.streams[y.sourceBand], S = this.extractSectionBeats(
27174
+ const v = e.streams[y.sourceBand], _ = this.extractSectionBeats(
27109
27175
  v,
27110
27176
  y.beatRange,
27111
27177
  y.sourceBand
27112
27178
  );
27113
- u.push(...S), r[y.sourceBand] += S.length;
27179
+ u.push(..._), r[y.sourceBand] += _.length;
27114
27180
  }
27115
27181
  u.sort((y, v) => y.timestamp - v.timestamp);
27116
27182
  const d = this.deduplicateBeats(u), h = e.streams.low.quarterNoteInterval, m = 60 / h, f = this.determineNaturalDifficulty(
@@ -27843,10 +27909,10 @@ class Un {
27843
27909
  m,
27844
27910
  c,
27845
27911
  u
27846
- ), S = this.enforceSingleGridPerBeat(v.beats), T = v.metadata.patternsInserted > 0 ? "pattern_inserted" : "interpolated";
27912
+ ), _ = this.enforceSingleGridPerBeat(v.beats), T = v.metadata.patternsInserted > 0 ? "pattern_inserted" : "interpolated";
27847
27913
  return {
27848
27914
  difficulty: "custom",
27849
- beats: S,
27915
+ beats: _,
27850
27916
  isUnedited: !1,
27851
27917
  editType: T,
27852
27918
  editAmount: v.metadata.totalBeatsBefore > 0 ? (v.metadata.totalBeatsAfter - v.metadata.totalBeatsBefore) / v.metadata.totalBeatsBefore : 0,
@@ -27858,7 +27924,7 @@ class Un {
27858
27924
  this.config.logConversions && console.log(
27859
27925
  `[DifficultyVariantGenerator] Density approximately equal (${f.toFixed(2)} ≈ ${u.toFixed(2)}), but grid restrictions needed`
27860
27926
  );
27861
- const S = this.simplifyBeats(
27927
+ const _ = this.simplifyBeats(
27862
27928
  h,
27863
27929
  "custom",
27864
27930
  e.quarterNoteInterval,
@@ -27872,11 +27938,11 @@ class Un {
27872
27938
  );
27873
27939
  return {
27874
27940
  difficulty: "custom",
27875
- beats: this.enforceSingleGridPerBeat(S.beats),
27876
- isUnedited: S.metadata.beatsRemoved === 0 && !d,
27877
- editType: S.metadata.beatsRemoved > 0 ? "simplified" : "none",
27878
- editAmount: S.metadata.totalBeatsBefore > 0 ? (S.metadata.totalBeatsBefore - S.metadata.totalBeatsAfter) / S.metadata.totalBeatsBefore : 0,
27879
- conversionMetadata: S.metadata,
27941
+ beats: this.enforceSingleGridPerBeat(_.beats),
27942
+ isUnedited: _.metadata.beatsRemoved === 0 && !d,
27943
+ editType: _.metadata.beatsRemoved > 0 ? "simplified" : "none",
27944
+ editAmount: _.metadata.totalBeatsBefore > 0 ? (_.metadata.totalBeatsBefore - _.metadata.totalBeatsAfter) / _.metadata.totalBeatsBefore : 0,
27945
+ conversionMetadata: _.metadata,
27880
27946
  densityClamped: d
27881
27947
  };
27882
27948
  }
@@ -28055,12 +28121,12 @@ class Un {
28055
28121
  r,
28056
28122
  e.quarterNoteInterval,
28057
28123
  h
28058
- ), S = v.metadata.patternsInserted > 0 ? "pattern_inserted" : "interpolated";
28124
+ ), _ = v.metadata.patternsInserted > 0 ? "pattern_inserted" : "interpolated";
28059
28125
  return {
28060
28126
  difficulty: t,
28061
28127
  beats: v.beats,
28062
28128
  isUnedited: !1,
28063
- editType: S,
28129
+ editType: _,
28064
28130
  editAmount: v.metadata.totalBeatsBefore > 0 ? (v.metadata.totalBeatsAfter - v.metadata.totalBeatsBefore) / v.metadata.totalBeatsBefore : 0,
28065
28131
  enhancementMetadata: v.metadata
28066
28132
  };
@@ -28118,12 +28184,12 @@ class Un {
28118
28184
  r,
28119
28185
  e.quarterNoteInterval,
28120
28186
  h
28121
- ), S = v.metadata.patternsInserted > 0 ? "pattern_inserted" : "interpolated";
28187
+ ), _ = v.metadata.patternsInserted > 0 ? "pattern_inserted" : "interpolated";
28122
28188
  return {
28123
28189
  difficulty: t,
28124
28190
  beats: v.beats,
28125
28191
  isUnedited: !1,
28126
- editType: S,
28192
+ editType: _,
28127
28193
  editAmount: 1,
28128
28194
  conversionMetadata: p.metadata,
28129
28195
  enhancementMetadata: v.metadata
@@ -28150,16 +28216,16 @@ class Un {
28150
28216
  h
28151
28217
  );
28152
28218
  let p = g.beats;
28153
- if (p.some((S) => !u.includes(S.gridType))) {
28154
- const S = [];
28219
+ if (p.some((_) => !u.includes(_.gridType))) {
28220
+ const _ = [];
28155
28221
  for (const T of p)
28156
28222
  if (u.includes(T.gridType))
28157
- S.push(T);
28223
+ _.push(T);
28158
28224
  else {
28159
- const _ = this.convertBeatGridType(T, t, e.quarterNoteInterval, c);
28160
- _ && S.push(_);
28225
+ const S = this.convertBeatGridType(T, t, e.quarterNoteInterval, c);
28226
+ S && _.push(S);
28161
28227
  }
28162
- p = this.deduplicateConvertedBeats(S);
28228
+ p = this.deduplicateConvertedBeats(_);
28163
28229
  }
28164
28230
  const v = g.metadata.patternsInserted > 0 ? "pattern_inserted" : "interpolated";
28165
28231
  return {
@@ -28254,10 +28320,10 @@ class Un {
28254
28320
  }
28255
28321
  const v = this.deduplicateConvertedBeats(y);
28256
28322
  d.beatsRemoved += y.length - v.length;
28257
- const S = y.length - v.length, T = this.calculateDensity(v, c), _ = u !== void 0 ? Math.round(u * c) : this.calculateBeatCountTarget(v.length, c, t).targetCount, I = u ?? this.calculateBeatCountTarget(v.length, c, t).targetDensity;
28258
- if (v.length <= _)
28323
+ const _ = y.length - v.length, T = this.calculateDensity(v, c), S = u !== void 0 ? Math.round(u * c) : this.calculateBeatCountTarget(v.length, c, t).targetCount, I = u ?? this.calculateBeatCountTarget(v.length, c, t).targetDensity;
28324
+ if (v.length <= S)
28259
28325
  return this.config.logConversions && console.log(
28260
- `[DifficultyVariantGenerator] Grid conversion achieved target density: ${T.toFixed(2)} notes/sec (target midpoint ${I.toFixed(2)} nps, ${_} beats) for ${t}` + (S > 0 ? ` (${S} beats collapsed)` : "")
28326
+ `[DifficultyVariantGenerator] Grid conversion achieved target density: ${T.toFixed(2)} notes/sec (target midpoint ${I.toFixed(2)} nps, ${S} beats) for ${t}` + (_ > 0 ? ` (${_} beats collapsed)` : "")
28261
28327
  ), d.totalBeatsAfter = v.length, { beats: v, metadata: d };
28262
28328
  const D = this.reduceDensityToTarget(
28263
28329
  v,
@@ -28265,7 +28331,7 @@ class Un {
28265
28331
  d,
28266
28332
  h,
28267
28333
  r,
28268
- _,
28334
+ S,
28269
28335
  c
28270
28336
  );
28271
28337
  return d.totalBeatsAfter = D.length, { beats: D, metadata: d };
@@ -28524,8 +28590,8 @@ class Un {
28524
28590
  }
28525
28591
  }
28526
28592
  d.sort((m, f) => {
28527
- const g = o.get(m) ?? 0, p = o.get(f) ?? 0, y = l(m), v = l(f), S = y - g, _ = v - p - S;
28528
- if (_ !== 0) return _;
28593
+ const g = o.get(m) ?? 0, p = o.get(f) ?? 0, y = l(m), v = l(f), _ = y - g, S = v - p - _;
28594
+ if (S !== 0) return S;
28529
28595
  const I = ht(Tt(a, `partial:${m}`)), D = ht(Tt(a, `partial:${f}`));
28530
28596
  return I - D;
28531
28597
  });
@@ -28606,14 +28672,14 @@ class Un {
28606
28672
  beat: T,
28607
28673
  priority: this.calculateRemovalPriority(T, n, u)
28608
28674
  }));
28609
- d.sort((T, _) => T.priority - _.priority);
28675
+ d.sort((T, S) => T.priority - S.priority);
28610
28676
  const h = /* @__PURE__ */ new Set();
28611
28677
  let m = e.length;
28612
28678
  const f = this.config.maxReductionPasses;
28613
28679
  let g = 0;
28614
28680
  for (let T = 1; T <= f; T++) {
28615
28681
  g = T;
28616
- let _ = 0;
28682
+ let S = 0;
28617
28683
  const I = T === f;
28618
28684
  let D, R, q = !1;
28619
28685
  T === 1 ? (D = 1 - this.config.densityReductionMinIntensity, R = this.config.moderateSimplificationIntensityThreshold) : T === 2 ? (D = 1 - this.config.densityReductionMinIntensity - 0.15, R = this.config.moderateSimplificationIntensityThreshold - 0.1) : (q = !0, D = 0, R = 0);
@@ -28629,12 +28695,12 @@ class Un {
28629
28695
  continue;
28630
28696
  } else if (W >= D || O.intensity >= R)
28631
28697
  continue;
28632
- h.add(O), m--, _++, this.config.logConversions && console.log(
28698
+ h.add(O), m--, S++, this.config.logConversions && console.log(
28633
28699
  `[DifficultyVariantGenerator] Pass ${T}: Removed beat at index ${O.beatIndex} position ${O.gridPosition} (priority: ${W.toFixed(2)}, intensity: ${O.intensity.toFixed(2)})`
28634
28700
  );
28635
28701
  }
28636
28702
  if (this.config.logConversions && console.log(
28637
- `[DifficultyVariantGenerator] Pass ${T}${I ? " (final)" : ""}: Removed ${_} beats, density now: ${(m / o).toFixed(2)} notes/sec`
28703
+ `[DifficultyVariantGenerator] Pass ${T}${I ? " (final)" : ""}: Removed ${S} beats, density now: ${(m / o).toFixed(2)} notes/sec`
28638
28704
  ), r !== void 0) {
28639
28705
  if (m <= r)
28640
28706
  break;
@@ -28650,12 +28716,12 @@ class Un {
28650
28716
  }
28651
28717
  const v = e.filter((T) => !h.has(T));
28652
28718
  i.reductionPasses = g, i.beatsRemoved += h.size;
28653
- const S = Math.ceil(c.min * o);
28654
- if (v.length < S && e.length > 0) {
28655
- const T = d.filter(({ beat: _ }) => h.has(_)).sort((_, I) => I.priority - _.priority);
28656
- for (const { beat: _ } of T) {
28657
- if (v.length >= S) break;
28658
- v.push(_), i.beatsRemoved--;
28719
+ const _ = Math.ceil(c.min * o);
28720
+ if (v.length < _ && e.length > 0) {
28721
+ const T = d.filter(({ beat: S }) => h.has(S)).sort((S, I) => I.priority - S.priority);
28722
+ for (const { beat: S } of T) {
28723
+ if (v.length >= _) break;
28724
+ v.push(S), i.beatsRemoved--;
28659
28725
  }
28660
28726
  }
28661
28727
  return v;
@@ -28909,7 +28975,7 @@ class Un {
28909
28975
  i,
28910
28976
  t
28911
28977
  ).beatsToAdd;
28912
- const v = this.config.seed ?? `enhance:${p}:${f.length}`, S = this.distributeBeatsAcrossIndices(
28978
+ const v = this.config.seed ?? `enhance:${p}:${f.length}`, _ = this.distributeBeatsAcrossIndices(
28913
28979
  y,
28914
28980
  g,
28915
28981
  c ?? /* @__PURE__ */ new Map(),
@@ -28917,13 +28983,13 @@ class Un {
28917
28983
  v,
28918
28984
  l
28919
28985
  // Pass through for max beats per index calculation
28920
- ), T = [], _ = /* @__PURE__ */ new Map(), I = (O, W) => `${O}:${W}`;
28986
+ ), T = [], S = /* @__PURE__ */ new Map(), I = (O, W) => `${O}:${W}`;
28921
28987
  for (const O of f) {
28922
28988
  const W = I(O.beatIndex, O.gridPosition);
28923
- _.has(W) || _.set(W, O.gridType);
28989
+ S.has(W) || S.set(W, O.gridType);
28924
28990
  }
28925
28991
  for (let O = 0; O <= p; O++) {
28926
- const W = g.get(O) ?? [], Z = S.get(O) ?? 0;
28992
+ const W = g.get(O) ?? [], Z = _.get(O) ?? 0;
28927
28993
  if (W.length >= Z) {
28928
28994
  T.push(...W);
28929
28995
  continue;
@@ -28937,12 +29003,12 @@ class Un {
28937
29003
  r,
28938
29004
  o,
28939
29005
  g,
28940
- _,
29006
+ S,
28941
29007
  fe
28942
29008
  ), Qt = fe ?? this.getGridForBeatIndex(O, ge, r);
28943
29009
  for (const J of ge) {
28944
29010
  const le = I(J.beatIndex, J.gridPosition);
28945
- !_.has(le) && J.gridType === Qt && (_.set(le, J.gridType), T.push(J), h.interpolatedBeats++);
29011
+ !S.has(le) && J.gridType === Qt && (S.set(le, J.gridType), T.push(J), h.interpolatedBeats++);
28946
29012
  }
28947
29013
  continue;
28948
29014
  }
@@ -28954,7 +29020,7 @@ class Un {
28954
29020
  O,
28955
29021
  Q,
28956
29022
  a,
28957
- _,
29023
+ S,
28958
29024
  oe
28959
29025
  );
28960
29026
  j = X.beatsAdded, X.patternId && (h.patternsInserted++, h.insertedPatternIds.push(X.patternId));
@@ -28965,13 +29031,13 @@ class Un {
28965
29031
  O,
28966
29032
  Q - j,
28967
29033
  o,
28968
- _,
29034
+ S,
28969
29035
  oe,
28970
29036
  n
28971
29037
  );
28972
29038
  for (const fe of X) {
28973
29039
  const ge = I(fe.beatIndex, fe.gridPosition);
28974
- _.has(ge) || (_.set(ge, fe.gridType), T.push(fe), h.interpolatedBeats++);
29040
+ S.has(ge) || (S.set(ge, fe.gridType), T.push(fe), h.interpolatedBeats++);
28975
29041
  }
28976
29042
  }
28977
29043
  T.push(...W);
@@ -29031,12 +29097,12 @@ class Un {
29031
29097
  if (c.length === 0)
29032
29098
  return { beatsAdded: 0 };
29033
29099
  const l = c.filter(
29034
- (v) => v.pattern.some((S) => S.gridType === r)
29100
+ (v) => v.pattern.some((_) => _.gridType === r)
29035
29101
  );
29036
29102
  if (l.length === 0)
29037
29103
  return { beatsAdded: 0 };
29038
- l.sort((v, S) => S.significance - v.significance);
29039
- const u = l[0], d = u.pattern.filter((v) => v.beatIndex === 0), h = new Set(e.map((v) => v.gridPosition)), m = (v, S) => `${v}:${S}`, f = d.filter((v) => !(v.gridType !== r || h.has(v.gridPosition) || a.has(m(t, v.gridPosition))));
29104
+ l.sort((v, _) => _.significance - v.significance);
29105
+ const u = l[0], d = u.pattern.filter((v) => v.beatIndex === 0), h = new Set(e.map((v) => v.gridPosition)), m = (v, _) => `${v}:${_}`, f = d.filter((v) => !(v.gridType !== r || h.has(v.gridPosition) || a.has(m(t, v.gridPosition))));
29040
29106
  if (f.length === 0)
29041
29107
  return { beatsAdded: 0 };
29042
29108
  const g = f.slice(0, i), p = u.sourceBand, y = g.map((v) => ({
@@ -29078,17 +29144,17 @@ class Un {
29078
29144
  }
29079
29145
  if (!c && !n?.has(e) && r)
29080
29146
  for (const T of [1, -1, 2, -2, 3, -3]) {
29081
- const _ = r.get(e + T);
29082
- if (_ && _.length > 0) {
29083
- l = _[0].gridType, u = _[0].band, d = _[0].sourceBand;
29147
+ const S = r.get(e + T);
29148
+ if (S && S.length > 0) {
29149
+ l = S[0].gridType, u = S[0].band, d = S[0].sourceBand;
29084
29150
  break;
29085
29151
  }
29086
29152
  }
29087
29153
  const h = /* @__PURE__ */ new Set();
29088
29154
  if (o) {
29089
- const T = (_, I) => `${_}:${I}`;
29090
- for (let _ = 0; _ < 4; _++)
29091
- o.has(T(e, _)) && h.add(_);
29155
+ const T = (S, I) => `${S}:${I}`;
29156
+ for (let S = 0; S < 4; S++)
29157
+ o.has(T(e, S)) && h.add(S);
29092
29158
  }
29093
29159
  const f = {
29094
29160
  straight_16th: 4,
@@ -29099,11 +29165,11 @@ class Un {
29099
29165
  }[l], g = [];
29100
29166
  for (let T = 0; T < f; T++)
29101
29167
  h.has(T) || g.push(T);
29102
- g.sort((T, _) => {
29168
+ g.sort((T, S) => {
29103
29169
  const I = (D) => D === 0 ? 0 : D === f - 1 ? 2 : 1;
29104
- return I(T) - I(_);
29170
+ return I(T) - I(S);
29105
29171
  });
29106
- const p = g.slice(0, t), y = i?.beats[e]?.timestamp ?? e * a, S = {
29172
+ const p = g.slice(0, t), y = i?.beats[e]?.timestamp ?? e * a, _ = {
29107
29173
  straight_16th: a / 4,
29108
29174
  straight_8th: a / 2,
29109
29175
  triplet_8th: a / 3,
@@ -29111,7 +29177,7 @@ class Un {
29111
29177
  quarter_triplet: a
29112
29178
  }[l];
29113
29179
  return p.map((T) => ({
29114
- timestamp: y + T * S,
29180
+ timestamp: y + T * _,
29115
29181
  beatIndex: e,
29116
29182
  gridPosition: T,
29117
29183
  gridType: l,
@@ -29140,14 +29206,14 @@ class Un {
29140
29206
  interpolateBeats(e, t, i, n = 0.5, a, r, o) {
29141
29207
  if (i <= 0 || e.length === 0)
29142
29208
  return [];
29143
- const c = r ?? e[0].gridType, u = ((T) => T === "straight_16th" ? 4 : T === "straight_8th" ? 2 : T === "straight_4th" || T === "quarter_triplet" ? 1 : 3)(c), d = (T, _) => `${T}:${_}`, h = new Set(e.map((T) => T.gridPosition));
29209
+ const c = r ?? e[0].gridType, u = ((T) => T === "straight_16th" ? 4 : T === "straight_8th" ? 2 : T === "straight_4th" || T === "quarter_triplet" ? 1 : 3)(c), d = (T, S) => `${T}:${S}`, h = new Set(e.map((T) => T.gridPosition));
29144
29210
  if (a)
29145
29211
  for (let T = 0; T < u; T++)
29146
29212
  a.has(d(t, T)) && h.add(T);
29147
29213
  const m = [];
29148
29214
  for (let T = 0; T < u; T++)
29149
29215
  h.has(T) || m.push(T);
29150
- m.sort((T, _) => (T === 0 || T === 3 ? 2 : 1) - (_ === 0 || _ === 3 ? 2 : 1));
29216
+ m.sort((T, S) => (T === 0 || T === 3 ? 2 : 1) - (S === 0 || S === 3 ? 2 : 1));
29151
29217
  const f = m.slice(0, i), g = e[0], p = o?.beats[t]?.timestamp ?? t * n, v = {
29152
29218
  straight_16th: n / 4,
29153
29219
  straight_8th: n / 2,
@@ -29527,8 +29593,8 @@ class mt {
29527
29593
  * @throws {DOMException} If the operation is cancelled via signal
29528
29594
  */
29529
29595
  async generate(e, t, i, n) {
29530
- const a = (_, I, D) => {
29531
- this.options.verbose && console.log(`[RhythmGenerator] [${_}] ${Math.round(I * 100)}%: ${D}`), n?.(_, I, D);
29596
+ const a = (S, I, D) => {
29597
+ this.options.verbose && console.log(`[RhythmGenerator] [${S}] ${Math.round(I * 100)}%: ${D}`), n?.(S, I, D);
29532
29598
  };
29533
29599
  i?.throwIfAborted();
29534
29600
  const r = this.generateCacheKey(
@@ -29558,7 +29624,7 @@ class mt {
29558
29624
  a("Phase 3", 0.6, `Balanced composite: ${p.beats.length} beats (${y.beatsAdded} added, ${y.beatsShifted} shifted for rhythmic structure)`);
29559
29625
  const v = this.options.skipDifficultyVariants ? null : this.generateDifficultyVariants(p, d, u, t);
29560
29626
  a("Phase 3", 0.8, this.options.skipDifficultyVariants ? "Skipped preset difficulty variants (density-based mode)" : "Generated easy/medium/hard difficulty variants"), a("Phase 3", 1, "Phase 3 complete"), i?.throwIfAborted();
29561
- const S = {
29627
+ const _ = {
29562
29628
  difficulty: this.options.difficulty,
29563
29629
  bandsAnalyzed: ["low", "mid", "high"],
29564
29630
  transientsDetected: l.metadata.totalTransients,
@@ -29582,7 +29648,7 @@ class mt {
29582
29648
  densityAnalysis: h,
29583
29649
  scoringResult: m
29584
29650
  },
29585
- metadata: S
29651
+ metadata: _
29586
29652
  };
29587
29653
  return this.setCache(r, T), T;
29588
29654
  }
@@ -30386,9 +30452,9 @@ class Xo {
30386
30452
  midiNote: g.frequency > 0 ? g.midiNote : null,
30387
30453
  noteName: g.frequency > 0 ? this.midiToNoteName(g.midiNote) : null
30388
30454
  };
30389
- y.length > 1 && (v.alternativeHypotheses = y.slice(0, 5).map((S) => ({
30390
- frequency: S.frequency,
30391
- probability: S.probability
30455
+ y.length > 1 && (v.alternativeHypotheses = y.slice(0, 5).map((_) => ({
30456
+ frequency: _.frequency,
30457
+ probability: _.probability
30392
30458
  }))), h.push(v);
30393
30459
  }
30394
30460
  return h;
@@ -30452,18 +30518,18 @@ class Xo {
30452
30518
  l++;
30453
30519
  const v = g[0].probability;
30454
30520
  if (v < 0.1 ? d.below01++ : v < 0.2 ? d.b01_02++ : v < 0.3 ? d.b02_03++ : v < 0.4 ? d.b03_04++ : v < 0.5 ? d.b04_05++ : d.above05++, v >= a) {
30455
- const S = g[0], T = Math.round(this.frequencyToMidi(S.frequency)), _ = {
30521
+ const _ = g[0], T = Math.round(this.frequencyToMidi(_.frequency)), S = {
30456
30522
  timestamp: y,
30457
- frequency: S.frequency,
30458
- probability: S.probability,
30523
+ frequency: _.frequency,
30524
+ probability: _.probability,
30459
30525
  isVoiced: !0,
30460
30526
  midiNote: T,
30461
30527
  noteName: this.midiToNoteName(T)
30462
30528
  };
30463
- p.length > 1 && (_.alternativeHypotheses = p.slice(0, 5).map((I) => ({
30529
+ p.length > 1 && (S.alternativeHypotheses = p.slice(0, 5).map((I) => ({
30464
30530
  frequency: I.frequency,
30465
30531
  probability: I.probability
30466
- }))), c.push(_);
30532
+ }))), c.push(S);
30467
30533
  } else
30468
30534
  c.push({
30469
30535
  timestamp: y,
@@ -30557,8 +30623,8 @@ class Xo {
30557
30623
  let g = !1;
30558
30624
  for (const p of d) {
30559
30625
  if (p.frequency <= f.frequency || p.probability < m * 0.9) continue;
30560
- const y = p.frequency / f.frequency, v = Math.round(y), S = Math.abs(y - v);
30561
- if (v >= 2 && v <= 5 && S < 0.1) {
30626
+ const y = p.frequency / f.frequency, v = Math.round(y), _ = Math.abs(y - v);
30627
+ if (v >= 2 && v <= 5 && _ < 0.1) {
30562
30628
  g = !0;
30563
30629
  break;
30564
30630
  }
@@ -30744,7 +30810,7 @@ class qi {
30744
30810
  */
30745
30811
  static async create(e = {}) {
30746
30812
  const t = { ...or, ...e };
30747
- t.resolveUrl || (t.resolveUrl = Me.resolveUrl.bind(Me));
30813
+ t.resolveUrl || (t.resolveUrl = Ae.resolveUrl.bind(Ae));
30748
30814
  const i = new qi(t);
30749
30815
  return await i.initializeEssentia(), t.algorithm === "pitch_crepe" && await i.loadCrepeModel(t.crepeModelUrl), i;
30750
30816
  }
@@ -30771,7 +30837,7 @@ class qi {
30771
30837
  if (this.config.enableModelCache !== !1)
30772
30838
  this.crepeModel = await Ht.getOrFetchGraphModel(Ee, e, {
30773
30839
  resolveUrl: this.config.resolveUrl,
30774
- invalidateUrlCache: (i) => Me.invalidateCacheForUrl(i),
30840
+ invalidateUrlCache: (i) => Ae.invalidateCacheForUrl(i),
30775
30841
  maxRetries: 3,
30776
30842
  baseDelayMs: 1e3
30777
30843
  });
@@ -31085,16 +31151,16 @@ class qi {
31085
31151
  let g;
31086
31152
  try {
31087
31153
  const y = Ee.tidy(() => {
31088
- const _ = Ee.tensor(m, [1, n]);
31089
- return this.crepeModel.execute(_).dataSync().slice();
31154
+ const S = Ee.tensor(m, [1, n]);
31155
+ return this.crepeModel.execute(S).dataSync().slice();
31090
31156
  });
31091
- let v = 0, S = 0, T = 0;
31092
- for (let _ = 0; _ < 360; _++) {
31093
- const I = y[_];
31094
- v += _ * 10 * I, S += I, I > T && (T = I);
31157
+ let v = 0, _ = 0, T = 0;
31158
+ for (let S = 0; S < 360; S++) {
31159
+ const I = y[S];
31160
+ v += S * 10 * I, _ += I, I > T && (T = I);
31095
31161
  }
31096
- if (S > 0 && T > 0.3) {
31097
- const _ = v / S, I = l * Math.pow(2, _ / 1200), D = Math.round(this.frequencyToMidi(I));
31162
+ if (_ > 0 && T > 0.3) {
31163
+ const S = v / _, I = l * Math.pow(2, S / 1200), D = Math.round(this.frequencyToMidi(I));
31098
31164
  g = {
31099
31165
  timestamp: f,
31100
31166
  frequency: I,
@@ -31656,7 +31722,7 @@ const yy = {
31656
31722
  sampleRate: 44100,
31657
31723
  hopSize: 1024,
31658
31724
  crepeModelUrl: ha,
31659
- resolveUrl: Me.resolveUrl.bind(Me),
31725
+ resolveUrl: Ae.resolveUrl.bind(Ae),
31660
31726
  includeContour: !0,
31661
31727
  onProgress: void 0
31662
31728
  }, vy = 69, by = 440, wy = ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"];
@@ -31788,7 +31854,7 @@ class d0 {
31788
31854
  * Compute summary statistics from pitch results
31789
31855
  */
31790
31856
  computeSummary(e) {
31791
- const t = e.length, i = e.filter((S) => S.isVoiced && S.frequency > 0), n = i.length;
31857
+ const t = e.length, i = e.filter((_) => _.isVoiced && _.frequency > 0), n = i.length;
31792
31858
  if (n === 0)
31793
31859
  return {
31794
31860
  voicingRatio: 0,
@@ -31803,14 +31869,14 @@ class d0 {
31803
31869
  totalFrames: t,
31804
31870
  voicedFrames: 0
31805
31871
  };
31806
- const a = i.map((S) => S.frequency), r = [...a].sort((S, T) => S - T), o = a.reduce((S, T) => S + T, 0) / a.length, c = Math.floor(r.length / 2), l = r.length % 2 !== 0 ? r[c] : (r[c - 1] + r[c]) / 2, u = r[0], d = r[r.length - 1], h = this.frequencyToMidi(u), m = this.frequencyToMidi(d), f = Math.abs(m - h), g = this.midiToNoteName(Math.round(h)), p = this.midiToNoteName(Math.round(m)), y = /* @__PURE__ */ new Map();
31807
- for (const S of i)
31808
- S.noteName && y.set(S.noteName, (y.get(S.noteName) ?? 0) + 1);
31809
- const v = Array.from(y.entries()).map(([S, T]) => ({
31810
- note: S,
31872
+ const a = i.map((_) => _.frequency), r = [...a].sort((_, T) => _ - T), o = a.reduce((_, T) => _ + T, 0) / a.length, c = Math.floor(r.length / 2), l = r.length % 2 !== 0 ? r[c] : (r[c - 1] + r[c]) / 2, u = r[0], d = r[r.length - 1], h = this.frequencyToMidi(u), m = this.frequencyToMidi(d), f = Math.abs(m - h), g = this.midiToNoteName(Math.round(h)), p = this.midiToNoteName(Math.round(m)), y = /* @__PURE__ */ new Map();
31873
+ for (const _ of i)
31874
+ _.noteName && y.set(_.noteName, (y.get(_.noteName) ?? 0) + 1);
31875
+ const v = Array.from(y.entries()).map(([_, T]) => ({
31876
+ note: _,
31811
31877
  count: T,
31812
31878
  percentage: T / n * 100
31813
- })).sort((S, T) => T.count - S.count);
31879
+ })).sort((_, T) => T.count - _.count);
31814
31880
  return {
31815
31881
  voicingRatio: n / t,
31816
31882
  averageFrequency: o,
@@ -31855,11 +31921,11 @@ class d0 {
31855
31921
  h = v;
31856
31922
  continue;
31857
31923
  }
31858
- let S;
31924
+ let _;
31859
31925
  const T = Math.abs(v - h);
31860
- v > h ? (S = "up", c.up++) : v < h ? (S = "down", c.down++) : (S = "stable", c.stable++);
31861
- const _ = Jo(T);
31862
- l[_]++, !d || d.direction !== S ? (d && u.push({
31926
+ v > h ? (_ = "up", c.up++) : v < h ? (_ = "down", c.down++) : (_ = "stable", c.stable++);
31927
+ const S = Jo(T);
31928
+ l[S]++, !d || d.direction !== _ ? (d && u.push({
31863
31929
  startTime: d.startTime,
31864
31930
  endTime: d.endTime,
31865
31931
  startNote: d.startNote,
@@ -31871,7 +31937,7 @@ class d0 {
31871
31937
  endTime: y.timestamp,
31872
31938
  startNote: this.midiToNoteName(h),
31873
31939
  endNote: this.midiToNoteName(v),
31874
- direction: S,
31940
+ direction: _,
31875
31941
  startMidi: h,
31876
31942
  endMidi: v
31877
31943
  }) : (d.endTime = y.timestamp, d.endNote = this.midiToNoteName(v), d.endMidi = v), h = v;
@@ -32407,7 +32473,7 @@ const Sy = [
32407
32473
  category: "jump",
32408
32474
  difficulty: 6
32409
32475
  }
32410
- ], Ay = [
32476
+ ], ky = [
32411
32477
  // Build-up transitions
32412
32478
  {
32413
32479
  id: "ddr_transition_build_up",
@@ -32450,7 +32516,7 @@ const Sy = [
32450
32516
  category: "transition",
32451
32517
  difficulty: 4
32452
32518
  }
32453
- ], My = [
32519
+ ], Ay = [
32454
32520
  // Single fret patterns
32455
32521
  {
32456
32522
  id: "gh_basic_single_1",
@@ -32625,7 +32691,7 @@ const Sy = [
32625
32691
  category: "basic",
32626
32692
  difficulty: 2
32627
32693
  }
32628
- ], ky = [
32694
+ ], My = [
32629
32695
  // Two-fret alternations
32630
32696
  {
32631
32697
  id: "gh_alternating_1_3",
@@ -33007,10 +33073,10 @@ const Sy = [
33007
33073
  ..._y,
33008
33074
  ...Ty,
33009
33075
  ...Cy,
33010
- ...Ay
33076
+ ...ky
33011
33077
  ], Ry = [
33078
+ ...Ay,
33012
33079
  ...My,
33013
- ...ky,
33014
33080
  ...Iy,
33015
33081
  ...Dy,
33016
33082
  ...Ey
@@ -33503,8 +33569,8 @@ class bn {
33503
33569
  mapButtons(e, t, i) {
33504
33570
  const n = e.beats;
33505
33571
  if (this.config.controllerMode === "tap")
33506
- return n.map((v, S) => ({
33507
- beatIndex: S,
33572
+ return n.map((v, _) => ({
33573
+ beatIndex: _,
33508
33574
  timestamp: v.timestamp,
33509
33575
  key: "tap",
33510
33576
  source: "pattern",
@@ -33523,17 +33589,17 @@ class bn {
33523
33589
  l,
33524
33590
  this.config.pitchInfluenceWeight
33525
33591
  ), d = c.map(
33526
- (v, S) => v !== null && u[S] ? v : null
33527
- ), h = this.config.controllerMode === "ddr" ? ec.patterns : tc.patterns, m = Oy(d), f = /* @__PURE__ */ new Set(), g = m.map((v, S) => {
33592
+ (v, _) => v !== null && u[_] ? v : null
33593
+ ), h = this.config.controllerMode === "ddr" ? ec.patterns : tc.patterns, m = Oy(d), f = /* @__PURE__ */ new Set(), g = m.map((v, _) => {
33528
33594
  const T = Ly(
33529
33595
  v,
33530
33596
  h,
33531
33597
  r,
33532
33598
  f,
33533
- () => this.seededRandom(`run:${S}:pick:${o++}`)
33599
+ () => this.seededRandom(`run:${_}:pick:${o++}`)
33534
33600
  );
33535
- for (const _ of T)
33536
- _.pattern.id !== "__interpolated__" && f.add(_.pattern.id);
33601
+ for (const S of T)
33602
+ S.pattern.id !== "__interpolated__" && f.add(S.pattern.id);
33537
33603
  return T;
33538
33604
  }), { keys: p, patternIds: y } = zy(
33539
33605
  d,
@@ -33541,13 +33607,13 @@ class bn {
33541
33607
  g
33542
33608
  );
33543
33609
  for (let v = 0; v < n.length; v++) {
33544
- const S = d[v] !== null;
33610
+ const _ = d[v] !== null;
33545
33611
  a.push({
33546
33612
  beatIndex: v,
33547
33613
  timestamp: n[v].timestamp,
33548
33614
  key: p[v],
33549
- source: S ? "pitch" : "pattern",
33550
- patternId: S ? void 0 : y[v],
33615
+ source: _ ? "pitch" : "pattern",
33616
+ patternId: _ ? void 0 : y[v],
33551
33617
  probability: l[v]
33552
33618
  });
33553
33619
  }
@@ -34261,8 +34327,8 @@ class fa {
34261
34327
  * ```
34262
34328
  */
34263
34329
  async generateAtDensity(e, t, i, n, a) {
34264
- const r = (y, v, S) => {
34265
- n?.({ stage: y, progress: v, message: S });
34330
+ const r = (y, v, _) => {
34331
+ n?.({ stage: y, progress: v, message: _ });
34266
34332
  };
34267
34333
  a?.throwIfAborted();
34268
34334
  const o = t.audioId;
@@ -34279,8 +34345,8 @@ class fa {
34279
34345
  c = this.getFromCache(y), c ? r("rhythm", 1, "Rhythm loaded from cache") : (c = await this.generateRhythm(
34280
34346
  e,
34281
34347
  t,
34282
- (v, S, T) => {
34283
- r("rhythm", S, `[${v}] ${T}`);
34348
+ (v, _, T) => {
34349
+ r("rhythm", _, `[${v}] ${T}`);
34284
34350
  },
34285
34351
  a,
34286
34352
  !0
@@ -34305,8 +34371,8 @@ class fa {
34305
34371
  "pitch",
34306
34372
  this.createConfigFingerprint("pitch")
34307
34373
  );
34308
- h = this.getFromCache(y), h ? r("pitch", 0.5, "Pitch analysis loaded from cache") : (r("pitch", 0, "Starting pitch analysis..."), h = await this.analyzePitch(e, c, (v, S) => {
34309
- r("pitch", v, S);
34374
+ h = this.getFromCache(y), h ? r("pitch", 0.5, "Pitch analysis loaded from cache") : (r("pitch", 0, "Starting pitch analysis..."), h = await this.analyzePitch(e, c, (v, _) => {
34375
+ r("pitch", v, _);
34310
34376
  }), this.setCache(y, h), r("pitch", 1, "Pitch analysis complete"));
34311
34377
  } else
34312
34378
  r("pitch", 1, "Pitch analysis skipped");
@@ -34440,8 +34506,8 @@ class fa {
34440
34506
  g,
34441
34507
  c.metadata,
34442
34508
  l?.pitchByBeat
34443
- ), v = this.convertToChart(y, t), S = this.buildLevel(v, y, c, l, "custom");
34444
- r.set(m, S);
34509
+ ), v = this.convertToChart(y, t), _ = this.buildLevel(v, y, c, l, "custom");
34510
+ r.set(m, _);
34445
34511
  }
34446
34512
  return n?.({
34447
34513
  stage: "finalizing",
@@ -35524,7 +35590,7 @@ function T0(s) {
35524
35590
  function C0(s) {
35525
35591
  return typeof s == "string" && ["easy", "medium", "hard", "deadly"].includes(s);
35526
35592
  }
35527
- class A0 {
35593
+ class k0 {
35528
35594
  /**
35529
35595
  * Calculate average party level
35530
35596
  *
@@ -35772,7 +35838,7 @@ function jy(s, e, t) {
35772
35838
  function Ky(s, e, t) {
35773
35839
  return ur.randomUUID && !s ? ur.randomUUID() : jy(s);
35774
35840
  }
35775
- class M0 {
35841
+ class A0 {
35776
35842
  constructor(e = {}) {
35777
35843
  this.options = {
35778
35844
  validateAudioUrls: !1,
@@ -35789,7 +35855,7 @@ class M0 {
35789
35855
  async parse(e) {
35790
35856
  const t = e.name, i = e.image, n = e.creator, a = e.description, r = e.genre, o = e.tags;
35791
35857
  let c = i;
35792
- i && this.options.resolveImageUrls && (c = await Me.resolveUrl(i));
35858
+ i && this.options.resolveImageUrls && (c = await Ae.resolveUrl(i));
35793
35859
  const l = e.tracks || [], u = [];
35794
35860
  for (let d = 0; d < l.length; d++)
35795
35861
  try {
@@ -35826,7 +35892,7 @@ class M0 {
35826
35892
  if (!this.options.resolveImageUrls)
35827
35893
  return e;
35828
35894
  const t = { ...e };
35829
- return t.image_url && (t.image_url = await Me.resolveUrl(t.image_url)), t.image_thumb_url && (t.image_thumb_url = await Me.resolveUrl(t.image_thumb_url)), t;
35895
+ return t.image_url && (t.image_url = await Ae.resolveUrl(t.image_url)), t.image_thumb_url && (t.image_thumb_url = await Ae.resolveUrl(t.image_thumb_url)), t;
35830
35896
  }
35831
35897
  /**
35832
35898
  * Parse a single track following the flattening process
@@ -35852,7 +35918,7 @@ class M0 {
35852
35918
  throw new Error(`Missing required fields for track: ${JSON.stringify({ title: d, artist: h, imageUrl: f })}`);
35853
35919
  return null;
35854
35920
  }
35855
- const S = typeof i?.description == "string" ? i.description : void 0, T = typeof i?.album == "string" ? i.album : void 0, _ = i?.duration ? Number(i.duration) : 0, I = ee.extractGenre(i || {}), D = i?.tags || [], R = i?.bpm ? Number(i.bpm) : void 0, q = typeof i?.key == "string" ? i.key : void 0, O = ee.convertAttributes(i?.attributes), W = Wg(i || {}), Z = {
35921
+ const _ = typeof i?.description == "string" ? i.description : void 0, T = typeof i?.album == "string" ? i.album : void 0, S = i?.duration ? Number(i.duration) : 0, I = ee.extractGenre(i || {}), D = i?.tags || [], R = i?.bpm ? Number(i.bpm) : void 0, q = typeof i?.key == "string" ? i.key : void 0, O = ee.convertAttributes(i?.attributes), W = Wg(i || {}), Z = {
35856
35922
  id: l,
35857
35923
  uuid: u,
35858
35924
  playlist_index: t,
@@ -35860,12 +35926,12 @@ class M0 {
35860
35926
  platform: c,
35861
35927
  title: d,
35862
35928
  artist: h,
35863
- description: S,
35929
+ description: _,
35864
35930
  album: T,
35865
35931
  image_url: f,
35866
35932
  audio_url: y,
35867
35933
  audio_url_lossless: v && v !== y ? v : void 0,
35868
- duration: _,
35934
+ duration: S,
35869
35935
  genre: I,
35870
35936
  tags: Array.isArray(D) ? D.map((Q) => String(Q).toLowerCase()) : [],
35871
35937
  bpm: R,
@@ -35992,7 +36058,7 @@ class Yy {
35992
36058
  * ```
35993
36059
  */
35994
36060
  constructor(e = {}) {
35995
- const t = e.hopSizeMode ? Ar(e.hopSizeMode) : e.hopSizeMs ?? _i.hopSizeMs, i = e.melBandsMode ? Mr(e.melBandsMode) : e.melBands ?? _i.melBands, n = e.gaussianSmoothMode ? kr(e.gaussianSmoothMode) : e.gaussianSmoothMs ?? _i.gaussianSmoothMs;
36061
+ const t = e.hopSizeMode ? kr(e.hopSizeMode) : e.hopSizeMs ?? _i.hopSizeMs, i = e.melBandsMode ? Ar(e.melBandsMode) : e.melBands ?? _i.melBands, n = e.gaussianSmoothMode ? Mr(e.gaussianSmoothMode) : e.gaussianSmoothMs ?? _i.gaussianSmoothMs;
35996
36062
  this.config = {
35997
36063
  ..._i,
35998
36064
  ...e,
@@ -36022,26 +36088,26 @@ class Yy {
36022
36088
  r,
36023
36089
  i
36024
36090
  ), d = l.numFrames, h = [];
36025
- for (let S = 0; S < d; S++) {
36026
- const T = l.frames[S], _ = new Float32Array(this.config.melBands);
36091
+ for (let _ = 0; _ < d; _++) {
36092
+ const T = l.frames[_], S = new Float32Array(this.config.melBands);
36027
36093
  for (let I = 0; I < this.config.melBands; I++) {
36028
36094
  const D = u[I];
36029
36095
  let R = 0;
36030
36096
  for (let q = 0; q < D.length && q < T.length; q++)
36031
36097
  R += T[q] * D[q];
36032
- _[I] = 20 * Math.log10(R + 1e-10);
36098
+ S[I] = 20 * Math.log10(R + 1e-10);
36033
36099
  }
36034
- h.push(_);
36100
+ h.push(S);
36035
36101
  }
36036
36102
  const m = new Float32Array(d);
36037
36103
  m[0] = 0;
36038
- for (let S = 1; S < d; S++) {
36104
+ for (let _ = 1; _ < d; _++) {
36039
36105
  let T = 0;
36040
- for (let _ = 0; _ < this.config.melBands; _++) {
36041
- const I = h[S][_] - h[S - 1][_];
36106
+ for (let S = 0; S < this.config.melBands; S++) {
36107
+ const I = h[_][S] - h[_ - 1][S];
36042
36108
  I > 0 && (T += I);
36043
36109
  }
36044
- m[S] = T;
36110
+ m[_] = T;
36045
36111
  }
36046
36112
  const f = 1 / c, g = wp(
36047
36113
  m,
@@ -36053,11 +36119,11 @@ class Yy {
36053
36119
  f
36054
36120
  ), y = Sp(p), v = new Float32Array(p.length);
36055
36121
  if (y > 1e-10)
36056
- for (let S = 0; S < p.length; S++)
36057
- v[S] = p[S] / y;
36122
+ for (let _ = 0; _ < p.length; _++)
36123
+ v[_] = p[_] / y;
36058
36124
  else
36059
- for (let S = 0; S < p.length; S++)
36060
- v[S] = p[S];
36125
+ for (let _ = 0; _ < p.length; _++)
36126
+ v[_] = p[_];
36061
36127
  return {
36062
36128
  envelope: v,
36063
36129
  numFrames: d,
@@ -36189,23 +36255,23 @@ class Xy {
36189
36255
  );
36190
36256
  let l = this.findPeak(c, 0, c.length);
36191
36257
  if (this.config.useOctaveResolution) {
36192
- const T = this.calculateTPS2(o.values, l), _ = Math.floor(l / 2);
36193
- _ >= 1 && _ < c.length && this.calculateTPS2(o.values, _) > T && (l = _);
36258
+ const T = this.calculateTPS2(o.values, l), S = Math.floor(l / 2);
36259
+ S >= 1 && S < c.length && this.calculateTPS2(o.values, S) > T && (l = S);
36194
36260
  }
36195
36261
  if (this.config.useTripleMeter) {
36196
- const T = this.calculateTPS3(o.values, l), _ = Math.floor(l / 3);
36197
- _ >= 1 && _ < c.length && this.calculateTPS3(o.values, _) > T && (l = _);
36262
+ const T = this.calculateTPS3(o.values, l), S = Math.floor(l / 3);
36263
+ S >= 1 && S < c.length && this.calculateTPS3(o.values, S) > T && (l = S);
36198
36264
  }
36199
36265
  const u = this.lagToBpm(l + o.minLag, t), d = u / 2, h = c[l] || 0, m = Math.min(l * 2, c.length - 1), f = c[m] || 0, g = Math.max(Math.floor(l / 2), 0), p = c[g] || 0, y = 1, v = Math.min(Math.max(
36200
36266
  Math.max(f, p) / (h + 1e-3),
36201
36267
  0
36202
- ), 1), S = 60 / u;
36268
+ ), 1), _ = 60 / u;
36203
36269
  return {
36204
36270
  primaryBpm: u,
36205
36271
  secondaryBpm: d,
36206
36272
  primaryWeight: y,
36207
36273
  secondaryWeight: v,
36208
- targetIntervalSeconds: S
36274
+ targetIntervalSeconds: _
36209
36275
  };
36210
36276
  }
36211
36277
  /**
@@ -36441,31 +36507,31 @@ class Qy {
36441
36507
  effectiveDpAlpha: c
36442
36508
  });
36443
36509
  const l = Math.max(1, Math.round(a * this.config.minPredecessorRatio)), u = Math.round(a * this.config.maxPredecessorRatio), d = new Float32Array(u - l + 1);
36444
- for (let S = 0; S < d.length; S++) {
36445
- const T = l + S, _ = Math.log(T / a);
36446
- d[S] = -c * _ * _;
36510
+ for (let _ = 0; _ < d.length; _++) {
36511
+ const T = l + _, S = Math.log(T / a);
36512
+ d[_] = -c * S * S;
36447
36513
  }
36448
36514
  const h = new Int32Array(n);
36449
36515
  h.fill(-1);
36450
36516
  const m = new Float32Array(e);
36451
- for (let S = u + 1; S < n; S++) {
36452
- let T = -1 / 0, _ = -1;
36517
+ for (let _ = u + 1; _ < n; _++) {
36518
+ let T = -1 / 0, S = -1;
36453
36519
  for (let I = 0; I < d.length; I++) {
36454
- const D = S - (l + I);
36520
+ const D = _ - (l + I);
36455
36521
  if (D >= 0 && D < n) {
36456
36522
  const R = d[I] + m[D];
36457
- R > T && (T = R, _ = D);
36523
+ R > T && (T = R, S = D);
36458
36524
  }
36459
36525
  }
36460
- m[S] = T + e[S], h[S] = _;
36526
+ m[_] = T + e[_], h[_] = S;
36461
36527
  }
36462
36528
  Ti.debug("BeatTracker: Starting backward pass", {
36463
36529
  maxCumulativeScore: Math.max(...m),
36464
36530
  envelopeLength: n
36465
36531
  });
36466
36532
  let f = 0, g = m[0];
36467
- for (let S = 1; S < n; S++)
36468
- m[S] > g && (g = m[S], f = S);
36533
+ for (let _ = 1; _ < n; _++)
36534
+ m[_] > g && (g = m[_], f = _);
36469
36535
  const p = [];
36470
36536
  let y = f;
36471
36537
  for (; y >= 0 && h[y] >= 0; )
@@ -36632,7 +36698,7 @@ class Ye {
36632
36698
  */
36633
36699
  constructor(e = {}) {
36634
36700
  this.state = null;
36635
- const t = { ...ii, ...e }, i = e.hopSizeMode, n = e.melBandsMode, a = e.gaussianSmoothMode, r = i ? Ar(i) : e.hopSizeMs ?? ii.hopSizeMs, o = n ? Mr(n) : e.melBands ?? ii.melBands, c = a ? kr(a) : e.gaussianSmoothMs ?? ii.gaussianSmoothMs;
36701
+ const t = { ...ii, ...e }, i = e.hopSizeMode, n = e.melBandsMode, a = e.gaussianSmoothMode, r = i ? kr(i) : e.hopSizeMs ?? ii.hopSizeMs, o = n ? Ar(n) : e.melBands ?? ii.melBands, c = a ? Mr(a) : e.gaussianSmoothMs ?? ii.gaussianSmoothMs;
36636
36702
  this.options = {
36637
36703
  ...t,
36638
36704
  hopSizeMs: r,
@@ -36755,8 +36821,8 @@ class Ye {
36755
36821
  noiseFloorThreshold: this.options.noiseFloorThreshold
36756
36822
  });
36757
36823
  const y = {
36758
- version: Al,
36759
- algorithm: Ml,
36824
+ version: kl,
36825
+ algorithm: Al,
36760
36826
  minBpm: this.options.minBpm,
36761
36827
  maxBpm: this.options.maxBpm,
36762
36828
  sensitivity: this.options.sensitivity,
@@ -37380,9 +37446,9 @@ class iv {
37380
37446
  */
37381
37447
  resolveThresholds() {
37382
37448
  return this.options.customThresholds && Object.keys(this.options.customThresholds).length > 0 ? {
37383
- ...An(this.options.difficultyPreset || "medium"),
37449
+ ...kn(this.options.difficultyPreset || "medium"),
37384
37450
  ...this.options.customThresholds
37385
- } : An(this.options.difficultyPreset || "medium");
37451
+ } : kn(this.options.difficultyPreset || "medium");
37386
37452
  }
37387
37453
  /**
37388
37454
  * Check the accuracy of a button press
@@ -37559,24 +37625,24 @@ class Ni {
37559
37625
  const u = this.generateGrid(e, c, l);
37560
37626
  let d = this.mergeBeats(t, u, o);
37561
37627
  const h = d.filter((I) => I.source === "interpolated").length, m = h > 0 ? d.filter((I) => I.source === "interpolated").reduce((I, D) => I + D.confidence, 0) / h : 0, f = this.calculateTempoDriftRatio(d), g = this.identifyTempoClusters(t), p = g.map((I) => Math.round(I.bpm)), y = this.filterOctaveMultiples(p), v = y.length > 1;
37562
- let S, T;
37628
+ let _, T;
37563
37629
  if (this.options.enableMultiTempo && v) {
37564
37630
  const I = this.runMultiTempoAnalysis(
37565
37631
  t,
37566
37632
  g,
37567
37633
  n
37568
37634
  );
37569
- I && (S = I.tempoSections, T = !0, S.length > 1 && (d = this.reinterpolateBoundaryRegions(
37635
+ I && (_ = I.tempoSections, T = !0, _.length > 1 && (d = this.reinterpolateBoundaryRegions(
37570
37636
  d,
37571
- S,
37637
+ _,
37572
37638
  t,
37573
37639
  o
37574
37640
  )), Ie.debug("Multi-tempo analysis complete", {
37575
- sectionCount: S.length,
37576
- tempos: S.map((D) => D.bpm)
37641
+ sectionCount: _.length,
37642
+ tempos: _.map((D) => D.bpm)
37577
37643
  }));
37578
37644
  }
37579
- const _ = {
37645
+ const S = {
37580
37646
  quarterNoteDetection: c,
37581
37647
  gapAnalysis: l,
37582
37648
  detectedBeatCount: t.length,
@@ -37588,14 +37654,14 @@ class Ni {
37588
37654
  // Multi-tempo fields
37589
37655
  detectedClusterTempos: y.length > 0 ? y : void 0,
37590
37656
  hasMultipleTempos: v,
37591
- tempoSections: S,
37657
+ tempoSections: _,
37592
37658
  hasMultiTempoApplied: T
37593
37659
  };
37594
37660
  return Ie.debug("Interpolation complete", {
37595
37661
  detectedBeats: t.length,
37596
37662
  interpolatedBeats: h,
37597
37663
  totalBeats: d.length,
37598
- interpolationRatio: _.interpolationRatio.toFixed(2),
37664
+ interpolationRatio: S.interpolationRatio.toFixed(2),
37599
37665
  hasMultipleTempos: v,
37600
37666
  hasMultiTempoApplied: T
37601
37667
  }), {
@@ -37608,7 +37674,7 @@ class Ni {
37608
37674
  quarterNoteBpm: c.bpm,
37609
37675
  quarterNoteConfidence: c.confidence,
37610
37676
  originalMetadata: a,
37611
- interpolationMetadata: _,
37677
+ interpolationMetadata: S,
37612
37678
  downbeatConfig: o
37613
37679
  };
37614
37680
  }
@@ -38232,8 +38298,8 @@ class Ni {
38232
38298
  if (y > 0) {
38233
38299
  const v = c + y * o, T = (g.timestamp - v) / y * n;
38234
38300
  o = o + T;
38235
- for (let _ = 1; _ < y; _++) {
38236
- const I = u + _ * o;
38301
+ for (let S = 1; S < y; S++) {
38302
+ const I = u + S * o;
38237
38303
  if (a !== void 0 && I > a) break;
38238
38304
  r.push(I);
38239
38305
  }
@@ -38272,8 +38338,8 @@ class Ni {
38272
38338
  if (y > 0) {
38273
38339
  const v = c - y * o, T = (g.timestamp - v) / y * n;
38274
38340
  o = o + T;
38275
- for (let _ = 1; _ < y; _++) {
38276
- const I = u - _ * o;
38341
+ for (let S = 1; S < y; S++) {
38342
+ const I = u - S * o;
38277
38343
  if (a !== void 0 && I < a) break;
38278
38344
  r.unshift(I);
38279
38345
  }
@@ -38313,13 +38379,13 @@ class Ni {
38313
38379
  for (let f = 0; f < i.length; f++) {
38314
38380
  const g = i[f];
38315
38381
  if (c.push(this.createDetectedBeat(g)), f < i.length - 1) {
38316
- const p = i[f + 1], y = p.timestamp - g.timestamp, v = Math.round(y / m), S = h + v * m, T = p.timestamp - S;
38382
+ const p = i[f + 1], y = p.timestamp - g.timestamp, v = Math.round(y / m), _ = h + v * m, T = p.timestamp - _;
38317
38383
  if (v > 0) {
38318
- const _ = T / v * o;
38319
- m = m + _;
38384
+ const S = T / v * o;
38385
+ m = m + S;
38320
38386
  }
38321
- for (let _ = 1; _ < v; _++) {
38322
- const I = g.timestamp + _ * m;
38387
+ for (let S = 1; S < v; S++) {
38388
+ const I = g.timestamp + S * m;
38323
38389
  if (I >= p.timestamp - r) break;
38324
38390
  const D = this.calculateConfidence(
38325
38391
  l,
@@ -38928,7 +38994,7 @@ const Ut = class Ut {
38928
38994
  const d = Math.floor(c * a), h = Math.floor((c + u) * a), m = this.extractAudioSegment(i, d, h), f = this.performFFT(m, this.options.fftSize), g = new Uint8Array(f.length);
38929
38995
  for (let R = 0; R < f.length; R++)
38930
38996
  g[R] = Math.min(255, Math.round(f[R]));
38931
- const p = Qe.separateFrequencyBands(g, a), y = Qe.calculateDominance(p.bass) * this.options.bassBoost, v = Qe.calculateDominance(p.mid) * this.options.midBoost, S = Qe.calculateDominance(p.treble) * this.options.trebleBoost, T = y + v + S || 1, _ = this.calculateRMS(i, d, h), I = this.calculatePeak(i, d, h), D = [
38997
+ const p = Qe.separateFrequencyBands(g, a), y = Qe.calculateDominance(p.bass) * this.options.bassBoost, v = Qe.calculateDominance(p.mid) * this.options.midBoost, _ = Qe.calculateDominance(p.treble) * this.options.trebleBoost, T = y + v + _ || 1, S = this.calculateRMS(i, d, h), I = this.calculatePeak(i, d, h), D = [
38932
38998
  ...p.bass,
38933
38999
  ...p.mid,
38934
39000
  ...p.treble
@@ -38938,11 +39004,11 @@ const Ut = class Ut {
38938
39004
  duration: u,
38939
39005
  bass: y / T,
38940
39006
  mid: v / T,
38941
- treble: S / T,
38942
- amplitude: _,
38943
- rms_energy: _,
39007
+ treble: _ / T,
39008
+ amplitude: S,
39009
+ rms_energy: S,
38944
39010
  peak: I,
38945
- dynamic_range: I - _,
39011
+ dynamic_range: I - S,
38946
39012
  spectral_centroid: this.calculateSpectralCentroid(D),
38947
39013
  spectral_rolloff: this.calculateSpectralRolloff(D),
38948
39014
  zero_crossing_rate: this.calculateZeroCrossingRate(i, d, h)
@@ -40286,7 +40352,7 @@ const nv = [
40286
40352
  "video",
40287
40353
  "war"
40288
40354
  ], cv = ["danceable", "non-danceable"], lv = ["voice", "instrumental"], uv = ["acoustic", "electronic"];
40289
- function Mi(s) {
40355
+ function Ai(s) {
40290
40356
  return typeof s == "object" && s !== null && "embedding" in s && "classifier" in s;
40291
40357
  }
40292
40358
  function fr(s) {
@@ -40317,7 +40383,7 @@ function hv(s) {
40317
40383
  }
40318
40384
  }
40319
40385
  function Ot(s) {
40320
- return Mi(s) ? `${s.embedding} -> ${s.classifier}` : s.modelUrl;
40386
+ return Ai(s) ? `${s.embedding} -> ${s.classifier}` : s.modelUrl;
40321
40387
  }
40322
40388
  function mv(s) {
40323
40389
  if (!s || s.length === 0)
@@ -40387,7 +40453,7 @@ const _n = {
40387
40453
  modelUrl: "https://arweave.net/nX9KX1OVhEaT1dStNcsRiZKCQTWuHjAMl4MWprIFyZU/model.json",
40388
40454
  modelType: "musicnn"
40389
40455
  }
40390
- }, k0 = {
40456
+ }, M0 = {
40391
40457
  genre: Object.keys(rc),
40392
40458
  mood: Object.keys(oc),
40393
40459
  danceability: Object.keys(cc)
@@ -40414,7 +40480,7 @@ class I0 {
40414
40480
  cacheEmbeddings: !0,
40415
40481
  enableModelCache: !0,
40416
40482
  ...e
40417
- }, this.options.resolveUrl || (this.options.resolveUrl = Me.resolveUrl.bind(Me)), delete this.options.preset;
40483
+ }, this.options.resolveUrl || (this.options.resolveUrl = Ae.resolveUrl.bind(Ae)), delete this.options.preset;
40418
40484
  }
40419
40485
  /**
40420
40486
  * Initialize essentia.js modules for browser environment.
@@ -40483,7 +40549,7 @@ class I0 {
40483
40549
  if (this.options.enableModelCache)
40484
40550
  return Ht.getOrFetchGraphModel(Ee, e, {
40485
40551
  resolveUrl: this.options.resolveUrl,
40486
- invalidateUrlCache: (r) => Me.invalidateCacheForUrl(r),
40552
+ invalidateUrlCache: (r) => Ae.invalidateCacheForUrl(r),
40487
40553
  maxRetries: t,
40488
40554
  baseDelayMs: i
40489
40555
  });
@@ -40531,7 +40597,7 @@ class I0 {
40531
40597
  const u = String(l).toLowerCase();
40532
40598
  if (!(u.includes("fetch") || u.includes("network") || u.includes("timeout") || u.includes("failed to fetch") || u.includes("networkerror") || u.includes("404")) || a === i - 1)
40533
40599
  throw l;
40534
- Me.invalidateCacheForUrl(e);
40600
+ Ae.invalidateCacheForUrl(e);
40535
40601
  const h = n * Math.pow(2, a);
40536
40602
  console.warn(
40537
40603
  `[MusicClassifier] Essentia model init failed (attempt ${a + 1}/${i}), re-resolving and retrying in ${h}ms...`,
@@ -40565,7 +40631,7 @@ class I0 {
40565
40631
  if (this.options.enableModelCache) {
40566
40632
  const a = await Ht.getOrFetchEssentiaUrl(e, {
40567
40633
  resolveUrl: this.options.resolveUrl,
40568
- invalidateUrlCache: (r) => Me.invalidateCacheForUrl(r)
40634
+ invalidateUrlCache: (r) => Ae.invalidateCacheForUrl(r)
40569
40635
  });
40570
40636
  n = new this.essentiaModel.TensorflowVGGish(Ee, a), await n.initialize();
40571
40637
  } else
@@ -40576,7 +40642,7 @@ class I0 {
40576
40642
  if (this.options.enableModelCache) {
40577
40643
  const a = await Ht.getOrFetchEssentiaUrl(e, {
40578
40644
  resolveUrl: this.options.resolveUrl,
40579
- invalidateUrlCache: (r) => Me.invalidateCacheForUrl(r)
40645
+ invalidateUrlCache: (r) => Ae.invalidateCacheForUrl(r)
40580
40646
  });
40581
40647
  n = new this.essentiaModel.TensorflowMusiCNN(Ee, a), await n.initialize();
40582
40648
  } else
@@ -40747,9 +40813,9 @@ class I0 {
40747
40813
  vibe_metrics: {}
40748
40814
  };
40749
40815
  if (this.options.models?.genre) {
40750
- const d = this.options.models.genre, h = Mi(d) ? d.classifier : d.modelUrl;
40816
+ const d = this.options.models.genre, h = Ai(d) ? d.classifier : d.modelUrl;
40751
40817
  let m;
40752
- Mi(d) && d.classifierType ? m = d.classifierType : fr(d) && d.genreType ? m = d.genreType : m = dv(h);
40818
+ Ai(d) && d.classifierType ? m = d.classifierType : fr(d) && d.genreType ? m = d.genreType : m = dv(h);
40753
40819
  const f = hv(m);
40754
40820
  u.genres = await this.runModelPrediction(
40755
40821
  d,
@@ -40942,29 +41008,29 @@ class I0 {
40942
41008
  if (m.length === 0)
40943
41009
  throw new Error("Could not discover model input names");
40944
41010
  const f = {};
40945
- for (const S of m)
40946
- S.includes("melspectrogram") || S.includes("mel") || S.includes("spectrogram") ? f[S] = h : S.includes("saver") || S.includes("filename") ? f[S] = Ee.scalar("") : f[S] = h;
41011
+ for (const _ of m)
41012
+ _.includes("melspectrogram") || _.includes("mel") || _.includes("spectrogram") ? f[_] = h : _.includes("saver") || _.includes("filename") ? f[_] = Ee.scalar("") : f[_] = h;
40947
41013
  const g = e.execute(f);
40948
41014
  let p;
40949
41015
  if (Array.isArray(g) ? p = g[0] : g && typeof g == "object" && !("data" in g) ? p = Object.values(g)[0] : p = g, !p || typeof p.data != "function")
40950
41016
  throw new Error("Model execution did not return a valid tensor");
40951
41017
  const y = await p.data(), v = p.shape;
40952
41018
  if (v.length === 2) {
40953
- const S = v[1], T = [];
40954
- for (let D = 0; D < S; D++) {
41019
+ const _ = v[1], T = [];
41020
+ for (let D = 0; D < _; D++) {
40955
41021
  let R = 0;
40956
41022
  for (let q = 0; q < a; q++)
40957
- R += y[q * S + D];
41023
+ R += y[q * _ + D];
40958
41024
  T.push(R / a);
40959
41025
  }
40960
- const _ = Math.sqrt(T.reduce((D, R) => D + R * R, 0)), I = _ > 0 ? T.map((D) => D / _) : T;
41026
+ const S = Math.sqrt(T.reduce((D, R) => D + R * R, 0)), I = S > 0 ? T.map((D) => D / S) : T;
40961
41027
  c.push(I);
40962
41028
  } else {
40963
- const S = Array.from(y.slice(0, v[v.length - 1])), T = Math.sqrt(S.reduce((I, D) => I + D * D, 0)), _ = T > 0 ? S.map((I) => I / T) : S;
40964
- c.push(_);
41029
+ const _ = Array.from(y.slice(0, v[v.length - 1])), T = Math.sqrt(_.reduce((I, D) => I + D * D, 0)), S = T > 0 ? _.map((I) => I / T) : _;
41030
+ c.push(S);
40965
41031
  }
40966
41032
  p.dispose();
40967
- for (const [S, T] of Object.entries(f))
41033
+ for (const [_, T] of Object.entries(f))
40968
41034
  T !== h && T.dispose();
40969
41035
  } finally {
40970
41036
  h.dispose();
@@ -41016,7 +41082,7 @@ class I0 {
41016
41082
  */
41017
41083
  async runModelPrediction(e, t, i) {
41018
41084
  let n;
41019
- if (Mi(e))
41085
+ if (Ai(e))
41020
41086
  n = await this.predictWithTwoStepModel(e, t);
41021
41087
  else {
41022
41088
  const a = Sn(e.modelUrl, e.modelType), r = this.getFeaturesForArchitecture(t, a);
@@ -41034,7 +41100,7 @@ class I0 {
41034
41100
  if (this.options.enableModelCache) {
41035
41101
  const o = await Ht.getOrFetchEssentiaUrl(e, {
41036
41102
  resolveUrl: this.options.resolveUrl,
41037
- invalidateUrlCache: (c) => Me.invalidateCacheForUrl(c)
41103
+ invalidateUrlCache: (c) => Ae.invalidateCacheForUrl(c)
41038
41104
  });
41039
41105
  i = new this.essentiaModel.TensorflowMusiCNN(Ee, o), await i.initialize();
41040
41106
  } else
@@ -41089,7 +41155,7 @@ class D0 {
41089
41155
  try {
41090
41156
  if (!this.context || !this.canvas)
41091
41157
  throw new Error("Canvas not supported in this environment");
41092
- const t = await Me.resolveUrl(e), i = await this.loadImage(t);
41158
+ const t = await Ae.resolveUrl(e), i = await this.loadImage(t);
41093
41159
  this.context.drawImage(i, 0, 0, 100, 100);
41094
41160
  const n = this.context.getImageData(0, 0, 100, 100), a = this.getPixels(n);
41095
41161
  if (a.length === 0)
@@ -41319,19 +41385,19 @@ class Xt {
41319
41385
  t.beatSubdivisions.has(g) && r++, i.add(p);
41320
41386
  const y = Dr(p);
41321
41387
  n = Math.max(n, y);
41322
- const v = e.beats[g], S = g < e.beats.length - 1 ? e.beats[g + 1] : null, T = e.detectedBeatIndices.includes(g);
41388
+ const v = e.beats[g], _ = g < e.beats.length - 1 ? e.beats[g + 1] : null, T = e.detectedBeatIndices.includes(g);
41323
41389
  if (p === "rest" || p === "half" && v.beatInMeasure % 2 !== 0)
41324
41390
  continue;
41325
- const _ = p === "dotted4" && v.beatInMeasure % 2 !== 0;
41326
- if (p === "offbeat8" || p === "triplet4" && o(g) === 1 || _ || c.push({
41391
+ const S = p === "dotted4" && v.beatInMeasure % 2 !== 0;
41392
+ if (p === "offbeat8" || p === "triplet4" && o(g) === 1 || S || c.push({
41327
41393
  ...v,
41328
41394
  isDetected: T,
41329
41395
  originalBeatIndex: g,
41330
41396
  subdivisionType: p
41331
- }), S) {
41397
+ }), _) {
41332
41398
  const D = this.createInterpolatedBeatsForSubdivision(
41333
41399
  v,
41334
- S,
41400
+ _,
41335
41401
  g,
41336
41402
  p,
41337
41403
  e,
@@ -41982,7 +42048,7 @@ class E0 {
41982
42048
  * @returns Pocket window size in seconds
41983
42049
  */
41984
42050
  calculatePocketWindow(e) {
41985
- const i = kl(this.hotness) / 1e3, n = 120 / e;
42051
+ const i = Ml(this.hotness) / 1e3, n = 120 / e;
41986
42052
  return i * n;
41987
42053
  }
41988
42054
  /**
@@ -42158,7 +42224,7 @@ class L0 {
42158
42224
  pendingMeasureNumber: null,
42159
42225
  transitionTimestamp: null,
42160
42226
  scheduledBeats: /* @__PURE__ */ new Map(),
42161
- thresholds: An("medium")
42227
+ thresholds: kn("medium")
42162
42228
  }, this.subscribers = /* @__PURE__ */ new Set(), this.regenerateBeats(), we.debug("SubdivisionPlaybackController initialized", {
42163
42229
  audioId: e.audioId,
42164
42230
  duration: e.duration,
@@ -42231,7 +42297,7 @@ class L0 {
42231
42297
  * ```
42232
42298
  */
42233
42299
  setSubdivision(e) {
42234
- if (!kn(e))
42300
+ if (!Mn(e))
42235
42301
  throw new Error(`Invalid subdivision type: ${e}`);
42236
42302
  if (this.state.currentSubdivision === e)
42237
42303
  return;
@@ -43300,7 +43366,7 @@ class je {
43300
43366
  * @returns Array of ClassFeature objects gained at this level
43301
43367
  */
43302
43368
  static getClassFeaturesForLevel(e, t, i) {
43303
- const n = ke.getInstance(), a = n.getFeaturesForLevel(t, i), r = { ...e, level: i }, o = [];
43369
+ const n = Me.getInstance(), a = n.getFeaturesForLevel(t, i), r = { ...e, level: i }, o = [];
43304
43370
  for (const c of a) {
43305
43371
  const l = n.validatePrerequisites(c, r);
43306
43372
  l.valid ? o.push(c) : (console.warn(
@@ -43758,7 +43824,7 @@ const yr = [4, 8, 12, 16, 19], vr = {
43758
43824
  strategy: "dnD5e",
43759
43825
  autoApply: !0
43760
43826
  };
43761
- class Av {
43827
+ class kv {
43762
43828
  constructor(e) {
43763
43829
  this.config = this.mergeWithDefaults(e), this.strategy = pr(this.config.strategy);
43764
43830
  }
@@ -44304,7 +44370,7 @@ class W0 {
44304
44370
  };
44305
44371
  if (n.xp.current += t, !this.statManager) {
44306
44372
  const d = (n.gameMode || "standard") === "standard" ? "dnD5e" : "dnD5e_smart";
44307
- this.statManager = new Av({ strategy: d }), je.setStatManager(this.statManager);
44373
+ this.statManager = new kv({ strategy: d }), je.setStatManager(this.statManager);
44308
44374
  }
44309
44375
  let a = !1, r;
44310
44376
  const o = [], c = n.gameMode === "uncapped", l = je.calculateLevel(n.xp.current, c);
@@ -45523,7 +45589,7 @@ const jn = {
45523
45589
  tags: ["magic", "enhanced", "+2", "armor"]
45524
45590
  }
45525
45591
  };
45526
- class Mv {
45592
+ class Av {
45527
45593
  /**
45528
45594
  * Open a box and generate its contents
45529
45595
  *
@@ -46110,7 +46176,7 @@ class G0 {
46110
46176
  const o = Y.getInstance().get("equipment").find((d) => d.name === t);
46111
46177
  if (!o || o.type !== "box")
46112
46178
  return null;
46113
- const c = e.equipment.items, l = Mv.openBox(o, i, c);
46179
+ const c = e.equipment.items, l = Av.openBox(o, i, c);
46114
46180
  if (!l.success)
46115
46181
  return { character: e, result: l };
46116
46182
  if (l.consumedItems && l.consumedItems.length > 0)
@@ -46482,7 +46548,7 @@ class br {
46482
46548
  return e >= 7 && e <= 18 && t >= 275 && t <= 290 || e >= 33 && e <= 43 && t >= 124 && t <= 132 || e >= 36 && e <= 47 && t >= 8 && t <= 19 || e >= 36 && e <= 44 && t >= 358 && t <= 360 || e >= 36 && e <= 44 && t >= 0 && t <= 10 || e >= 55 && e <= 71 && t >= 4 && t <= 32 || e >= 24 && e <= 31 && t >= 268 && t <= 272 || e >= 55 && e <= 62 && t >= 210 && t <= 220 || e >= 50 && e <= 62 && t >= 156 && t <= 163;
46483
46549
  }
46484
46550
  }
46485
- class kv {
46551
+ class Mv {
46486
46552
  constructor() {
46487
46553
  this.logger = Se.for("MotionDetector"), this.isListening = !1, this.lastMotion = null, this.motionCallback = null, this.lastProcessedTime = 0, this.minSampleIntervalMs = 83, this.deltaBuffer = [], this.bufferSize = 24, this.confirmedActivity = "unknown", this.candidateActivity = null, this.candidateStartTime = 0, this.confirmationMs = 1500, this.handleMotion = (e) => {
46488
46554
  if (!this.isListening || !this.motionCallback) return;
@@ -47034,8 +47100,8 @@ class Rv {
47034
47100
  const l = this.calculateJulianDate(c), u = this.calculateJulianCentury(l), d = this.calculateSolarDeclination(u), h = this.calculateHourAngle(e, d, o);
47035
47101
  if (isNaN(h))
47036
47102
  return /* @__PURE__ */ new Date(NaN);
47037
- const m = this.calculateEquationOfTime(u), f = (a ? -h : h) / 15, p = 12 - t / 15 - m / 60 + f, y = Math.floor(p), v = Math.floor((p - y) * 60), S = Math.floor(((p - y) * 60 - v) * 60), T = new Date(i);
47038
- return T.setUTCHours(y, v, S, 0), T;
47103
+ const m = this.calculateEquationOfTime(u), f = (a ? -h : h) / 15, p = 12 - t / 15 - m / 60 + f, y = Math.floor(p), v = Math.floor((p - y) * 60), _ = Math.floor(((p - y) * 60 - v) * 60), T = new Date(i);
47104
+ return T.setUTCHours(y, v, _, 0), T;
47039
47105
  }
47040
47106
  /**
47041
47107
  * Calculate current sun position (altitude and azimuth)
@@ -47622,7 +47688,7 @@ class U0 {
47622
47688
  const a = e;
47623
47689
  i = a.weather?.apiKey ?? "", n = a.geolocation, a.retry && (this.retryConfig = { ...this.retryConfig, ...a.retry }), a.xpModifier && (this.xpConfig = { ...this.xpConfig, ...a.xpModifier });
47624
47690
  }
47625
- this.geolocation = n ? new br(n) : new br(), this.motion = new kv(), this.weather = new Rv(i), this.initializeSensorStatuses();
47691
+ this.geolocation = n ? new br(n) : new br(), this.motion = new Mv(), this.weather = new Rv(i), this.initializeSensorStatuses();
47626
47692
  }
47627
47693
  /**
47628
47694
  * Initialize sensor statuses to 'unknown' state
@@ -51297,7 +51363,7 @@ export {
51297
51363
  s0 as ALL_GRID_TYPES,
51298
51364
  wu as ALL_RACES,
51299
51365
  Z0 as ARMOR_ENCHANTMENTS,
51300
- k0 as AVAILABLE_PRESETS,
51366
+ M0 as AVAILABLE_PRESETS,
51301
51367
  pn as AbilityScoreCalculator,
51302
51368
  Us as AbilityScoresSchema,
51303
51369
  pp as AppearanceGenerator,
@@ -51308,8 +51374,8 @@ export {
51308
51374
  zl as BASE_PLAYS_THRESHOLD,
51309
51375
  Wl as BASE_XP_THRESHOLD,
51310
51376
  qv as BEAT_ACCURACY_THRESHOLDS,
51311
- Ml as BEAT_DETECTION_ALGORITHM,
51312
- Al as BEAT_DETECTION_VERSION,
51377
+ Al as BEAT_DETECTION_ALGORITHM,
51378
+ kl as BEAT_DETECTION_VERSION,
51313
51379
  Db as BalanceValidator,
51314
51380
  wv as BalancedStrategy,
51315
51381
  ma as BeatConverter,
@@ -51318,7 +51384,7 @@ export {
51318
51384
  iv as BeatStream,
51319
51385
  Xt as BeatSubdivider,
51320
51386
  Qy as BeatTracker,
51321
- Mv as BoxOpener,
51387
+ Av as BoxOpener,
51322
51388
  bn as ButtonMapper,
51323
51389
  bu as CLASS_AUDIO_PREFERENCES,
51324
51390
  tt as CLASS_DATA,
@@ -51351,7 +51417,7 @@ export {
51351
51417
  Yn as DEFAULT_DOWNBEAT_CONFIG,
51352
51418
  jt as DEFAULT_ENEMY_TEMPLATES,
51353
51419
  Vt as DEFAULT_EQUIPMENT,
51354
- ko as DEFAULT_GATEWAYS,
51420
+ Mo as DEFAULT_GATEWAYS,
51355
51421
  Il as DEFAULT_GROOVE_OPTIONS,
51356
51422
  xg as DEFAULT_IPFS_GATEWAY,
51357
51423
  Lt as DEFAULT_PROGRESSION_CONFIG,
@@ -51390,7 +51456,7 @@ export {
51390
51456
  qi as EssentiaPitchDetector,
51391
51457
  Y as ExtensionManager,
51392
51458
  Bi as FeatureEffectApplier,
51393
- ke as FeatureQuery,
51459
+ Me as FeatureQuery,
51394
51460
  It as FeatureValidator,
51395
51461
  wl as GAUSSIAN_SMOOTH_PRESETS,
51396
51462
  rc as GENRE_PRESETS,
@@ -51436,16 +51502,16 @@ export {
51436
51502
  ja as PRESTIGE_SCALING_FACTOR,
51437
51503
  Wr as PROFICIENCY_BONUS,
51438
51504
  Eb as ParameterSweep,
51439
- A0 as PartyAnalyzer,
51505
+ k0 as PartyAnalyzer,
51440
51506
  Bp as PhraseAnalyzer,
51441
51507
  d0 as PitchAnalyzer,
51442
51508
  dy as PitchBeatLinker,
51443
51509
  Xo as PitchDetector,
51444
- M0 as PlaylistParser,
51510
+ A0 as PlaylistParser,
51445
51511
  Sg as PlaylistTrackSchema,
51446
51512
  Ce as PrestigeSystem,
51447
51513
  Sv as PrimaryOnlyStrategy,
51448
- Mb as RACE_DATA,
51514
+ Ab as RACE_DATA,
51449
51515
  Nr as RARITY_CONFIGS,
51450
51516
  X0 as RESISTANCE_ENCHANTMENTS,
51451
51517
  Zo as RHYTHM_PRESETS,
@@ -51473,14 +51539,14 @@ export {
51473
51539
  tr as SpellManager,
51474
51540
  it as SpellQuery,
51475
51541
  rt as SpellValidator,
51476
- Av as StatManager,
51542
+ kv as StatManager,
51477
51543
  Lp as StreamScorer,
51478
51544
  L0 as SubdivisionPlaybackController,
51479
51545
  Qv as TUNING_FACTORS,
51480
51546
  Rp as TempoAwareQuantizer,
51481
51547
  Xy as TempoDetector,
51482
51548
  Ep as TransientDetector,
51483
- Mn as VALID_SUBDIVISION_TYPES,
51549
+ An as VALID_SUBDIVISION_TYPES,
51484
51550
  Y0 as WEAPON_ENCHANTMENTS,
51485
51551
  Le as WeightedSelector,
51486
51552
  lc as XPCalculator,
@@ -51496,7 +51562,7 @@ export {
51496
51562
  rp as areRaceDefaultsInitialized,
51497
51563
  dp as areSkillDefaultsInitialized,
51498
51564
  np as areSpellDefaultsInitialized,
51499
- Me as arweaveGatewayManager,
51565
+ Ae as arweaveGatewayManager,
51500
51566
  fu as asClass,
51501
51567
  R0 as assignKeyToBeat,
51502
51568
  P0 as assignKeysToBeats,
@@ -51542,7 +51608,7 @@ export {
51542
51608
  Ot as formatModelForMetadata,
51543
51609
  qo as gaussianSmooth,
51544
51610
  Xv as generateSeed,
51545
- An as getAccuracyThresholdsForPreset,
51611
+ kn as getAccuracyThresholdsForPreset,
51546
51612
  nw as getAllCurses,
51547
51613
  iw as getAllEnchantments,
51548
51614
  Yb as getAllGatewayUrls,
@@ -51562,24 +51628,24 @@ export {
51562
51628
  fw as getCursedItems,
51563
51629
  ew as getEnchantment,
51564
51630
  aw as getEnchantmentsByType,
51565
- ki as getEncounterMultiplier,
51631
+ Mi as getEncounterMultiplier,
51566
51632
  Ib as getFeatureQuery,
51567
51633
  Vb as getFullTracks,
51568
- kr as getGaussianSmoothMs,
51634
+ Mr as getGaussianSmoothMs,
51569
51635
  hv as getGenreLabels,
51570
51636
  Wb as getGenres,
51571
51637
  Rl as getGroovePenaltiesForPreset,
51572
51638
  en as getGrooveTier,
51573
- kl as getGrooveWindowMs,
51639
+ Ml as getGrooveWindowMs,
51574
51640
  ob as getHigherRarity,
51575
- Ar as getHopSizeMs,
51641
+ kr as getHopSizeMs,
51576
51642
  Ob as getImageUrls,
51577
51643
  gw as getItemsWithProperty,
51578
51644
  $0 as getKeyCount,
51579
51645
  dw as getMagicItem,
51580
51646
  mw as getMagicItemsByRarity,
51581
51647
  hw as getMagicItemsByType,
51582
- Mr as getMelBands,
51648
+ Ar as getMelBands,
51583
51649
  Up as getMetricGroupSize,
51584
51650
  Vv as getMinHotnessForTier,
51585
51651
  v0 as getPatternById,
@@ -51590,14 +51656,14 @@ export {
51590
51656
  p0 as getPatternsByKeyCount,
51591
51657
  g0 as getPatternsByTags,
51592
51658
  Xn as getRaceData,
51593
- kb as getRaceDataAsync,
51659
+ Mb as getRaceDataAsync,
51594
51660
  y0 as getRandomPattern,
51595
51661
  wt as getRarityConfig,
51596
51662
  l0 as getRhythmPreset,
51597
51663
  u0 as getRhythmPresetNames,
51598
51664
  rb as getSignatureDie,
51599
51665
  _b as getSkillQuery,
51600
- Ab as getSpellQuery,
51666
+ kb as getSpellQuery,
51601
51667
  Hr as getSpellSlotsForClass,
51602
51668
  Dr as getSubdivisionDensity,
51603
51669
  Hb as getTags,
@@ -51641,7 +51707,7 @@ export {
51641
51707
  Yv as isPrestigeLevel,
51642
51708
  fr as isSingleStepModel,
51643
51709
  Yp as isStrongBeatForEmphasis,
51644
- Mi as isTwoStepModel,
51710
+ Ai as isTwoStepModel,
51645
51711
  Zv as isValidAIPlayStyle,
51646
51712
  Xa as isValidClass,
51647
51713
  C0 as isValidEncounterDifficulty,
@@ -51649,7 +51715,7 @@ export {
51649
51715
  T0 as isValidEnemyArchetype,
51650
51716
  S0 as isValidEnemyCategory,
51651
51717
  _0 as isValidEnemyRarity,
51652
- kn as isValidSubdivisionType,
51718
+ Mn as isValidSubdivisionType,
51653
51719
  Lv as loadConfigFromEnv,
51654
51720
  Nl as mapGridToSubdivision,
51655
51721
  vp as melToHz,