playlist-data-engine 1.7.1 → 1.7.2

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.
@@ -11,10 +11,10 @@ class n {
11
11
  * 7. multimedia_url (Alternative media field)
12
12
  */
13
13
  static extractAudioUrl(t) {
14
- const e = ["mp3_url", "mp3Url", "lossy_audio", "lossyAudio", "audio_url", "audioUrl", "audio", "lossless_audio", "losslessAudio", "animation_url", "animationUrl", "multimedia_url", "multimediaUrl"];
15
- for (const r of e)
16
- if (t[r] && typeof t[r] == "string")
17
- return t[r];
14
+ const r = ["mp3_url", "mp3Url", "lossy_audio", "lossyAudio", "audio_url", "audioUrl", "audio", "lossless_audio", "losslessAudio", "animation_url", "animationUrl", "multimedia_url", "multimediaUrl"];
15
+ for (const e of r)
16
+ if (t[e] && typeof t[e] == "string")
17
+ return t[e];
18
18
  return null;
19
19
  }
20
20
  /**
@@ -23,10 +23,10 @@ class n {
23
23
  * that back rather than null.
24
24
  */
25
25
  static extractAudioUrlLossless(t) {
26
- const e = ["lossless_audio", "losslessAudio", "wav_url", "wavUrl", "flac_url", "flacUrl", "audio_url", "audioUrl"];
27
- for (const r of e)
28
- if (t[r] && typeof t[r] == "string")
29
- return t[r];
26
+ const r = ["lossless_audio", "losslessAudio", "wav_url", "wavUrl", "flac_url", "flacUrl", "audio_url", "audioUrl"];
27
+ for (const e of r)
28
+ if (t[e] && typeof t[e] == "string")
29
+ return t[e];
30
30
  return null;
31
31
  }
32
32
  /**
@@ -47,16 +47,16 @@ class n {
47
47
  * 10. primaryMedia.uri (Primary media field)
48
48
  */
49
49
  static extractImageUrl(t) {
50
- const e = ["image_small", "imageSmall", "image", "image_large", "imageLarge", "image_thumb", "imageThumb", "image_url", "imageUrl", "image_uri", "imageUri", "image_preview", "imagePreview"];
51
- for (const s of e)
50
+ const r = ["image_small", "imageSmall", "image", "image_large", "imageLarge", "image_thumb", "imageThumb", "image_url", "imageUrl", "image_uri", "imageUri", "image_preview", "imagePreview"];
51
+ for (const s of r)
52
52
  if (t[s] && typeof t[s] == "string")
53
53
  return t[s];
54
- const r = [
54
+ const e = [
55
55
  this.extractNestedUri(t, "artwork", "uri"),
56
56
  this.extractNestedUri(t, "project", "artwork", "uri"),
57
57
  this.extractNestedUri(t, "primaryMedia", "uri")
58
58
  ];
59
- for (const s of r)
59
+ for (const s of e)
60
60
  if (s) return s;
61
61
  return null;
62
62
  }
@@ -84,16 +84,16 @@ class n {
84
84
  * 4. OpenSea-style attributes array with trait_type "Artist"
85
85
  */
86
86
  static extractArtist(t) {
87
- const e = ["artist", "artist_name", "artistName", "album_artist", "albumArtist", "created_by", "createdBy", "minter"];
88
- for (const r of e)
89
- if (t[r] && typeof t[r] == "string")
90
- return t[r];
87
+ const r = ["artist", "artist_name", "artistName", "album_artist", "albumArtist", "created_by", "createdBy", "minter"];
88
+ for (const e of r)
89
+ if (t[e] && typeof t[e] == "string")
90
+ return t[e];
91
91
  if (Array.isArray(t.attributes)) {
92
- const r = t.attributes.find(
92
+ const e = t.attributes.find(
93
93
  (s) => s.trait_type?.toLowerCase() === "artist" && s.value !== void 0
94
94
  );
95
- if (r && typeof r.value == "string")
96
- return r.value;
95
+ if (e && typeof e.value == "string")
96
+ return e.value;
97
97
  }
98
98
  return null;
99
99
  }
@@ -108,11 +108,11 @@ class n {
108
108
  return t;
109
109
  if (typeof t == "string")
110
110
  try {
111
- const e = JSON.parse(t);
112
- if (typeof e == "object" && !Array.isArray(e))
113
- return e;
114
- } catch (e) {
115
- return console.warn("Failed to parse metadata:", e), null;
111
+ const r = JSON.parse(t);
112
+ if (typeof r == "object" && !Array.isArray(r))
113
+ return r;
114
+ } catch (r) {
115
+ return console.warn("Failed to parse metadata:", r), null;
116
116
  }
117
117
  return null;
118
118
  }
@@ -131,33 +131,33 @@ class n {
131
131
  if (typeof t.genre == "string")
132
132
  return t.genre;
133
133
  if (Array.isArray(t.genre) && t.genre.length > 0) {
134
- const r = t.genre[0];
135
- return typeof r == "string" ? r : "";
134
+ const e = t.genre[0];
135
+ return typeof e == "string" ? e : "";
136
136
  }
137
137
  if (Array.isArray(t.attributes)) {
138
- const r = t.attributes.find(
138
+ const e = t.attributes.find(
139
139
  (s) => s.trait_type?.toLowerCase() === "genre" && s.value !== void 0
140
140
  );
141
- if (r) {
142
- if (typeof r.value == "string")
143
- return r.value;
144
- if (Array.isArray(r.value) && r.value.length > 0) {
145
- const s = r.value[0];
141
+ if (e) {
142
+ if (typeof e.value == "string")
143
+ return e.value;
144
+ if (Array.isArray(e.value) && e.value.length > 0) {
145
+ const s = e.value[0];
146
146
  return typeof s == "string" ? s : "";
147
147
  }
148
148
  }
149
149
  }
150
150
  if (t.attributes && typeof t.attributes == "object" && !Array.isArray(t.attributes)) {
151
- const r = t.attributes;
152
- for (const s of Object.keys(r))
153
- if (s.toLowerCase() === "genre" && typeof r[s] == "string")
154
- return r[s];
151
+ const e = t.attributes;
152
+ for (const s of Object.keys(e))
153
+ if (s.toLowerCase() === "genre" && typeof e[s] == "string")
154
+ return e[s];
155
155
  }
156
- const e = t["attribute "];
157
- if (e && typeof e == "object" && !Array.isArray(e)) {
158
- const r = e.genre;
159
- if (typeof r == "string")
160
- return r;
156
+ const r = t["attribute "];
157
+ if (r && typeof r == "object" && !Array.isArray(r)) {
158
+ const e = r.genre;
159
+ if (typeof e == "string")
160
+ return e;
161
161
  }
162
162
  return "";
163
163
  }
@@ -171,29 +171,29 @@ class n {
171
171
  * - `attributes` as an object keyed by trait name (e.g. `attributes.Tags`)
172
172
  */
173
173
  static extractTags(t) {
174
- const e = [];
175
- if (Array.isArray(t.tags) ? e.push(...t.tags) : typeof t.tags == "string" && e.push(...t.tags.split(",")), t.properties && typeof t.properties == "object" && !Array.isArray(t.properties)) {
176
- const r = t.properties.tags;
177
- Array.isArray(r) ? e.push(...r) : typeof r == "string" && e.push(...r.split(","));
174
+ const r = [];
175
+ if (Array.isArray(t.tags) ? r.push(...t.tags) : typeof t.tags == "string" && r.push(...t.tags.split(",")), t.properties && typeof t.properties == "object" && !Array.isArray(t.properties)) {
176
+ const e = t.properties.tags;
177
+ Array.isArray(e) ? r.push(...e) : typeof e == "string" && r.push(...e.split(","));
178
178
  }
179
179
  if (Array.isArray(t.attributes))
180
- for (const r of t.attributes) {
181
- if (!r || typeof r != "object") continue;
182
- const s = r.trait_type;
180
+ for (const e of t.attributes) {
181
+ if (!e || typeof e != "object") continue;
182
+ const s = e.trait_type;
183
183
  if (typeof s == "string" && s.toLowerCase().match(/^tags?$/)) {
184
- const o = r.value;
185
- Array.isArray(o) ? e.push(...o) : typeof o == "string" && e.push(...o.split(","));
184
+ const a = e.value;
185
+ Array.isArray(a) ? r.push(...a) : typeof a == "string" && r.push(...a.split(","));
186
186
  }
187
187
  }
188
188
  else if (t.attributes && typeof t.attributes == "object") {
189
- const r = t.attributes;
190
- for (const s of Object.keys(r))
189
+ const e = t.attributes;
190
+ for (const s of Object.keys(e))
191
191
  if (s.toLowerCase().match(/^tags?$/)) {
192
- const o = r[s];
193
- Array.isArray(o) ? e.push(...o) : typeof o == "string" && e.push(...o.split(","));
192
+ const a = e[s];
193
+ Array.isArray(a) ? r.push(...a) : typeof a == "string" && r.push(...a.split(","));
194
194
  }
195
195
  }
196
- return n.normalizeTags(e);
196
+ return n.normalizeTags(r);
197
197
  }
198
198
  /**
199
199
  * Extract track description with priority:
@@ -213,16 +213,16 @@ class n {
213
213
  * descriptions, not the track's.
214
214
  */
215
215
  static extractDescription(t) {
216
- const e = ["description", "track_description", "trackDescription", "description_text", "descriptionText", "desc", "blurb"];
217
- for (const r of e)
218
- if (t[r] && typeof t[r] == "string")
219
- return t[r];
216
+ const r = ["description", "track_description", "trackDescription", "description_text", "descriptionText", "desc", "blurb"];
217
+ for (const e of r)
218
+ if (t[e] && typeof t[e] == "string")
219
+ return t[e];
220
220
  if (Array.isArray(t.attributes)) {
221
- const r = t.attributes.find(
221
+ const e = t.attributes.find(
222
222
  (s) => s.trait_type?.toLowerCase() === "description" && typeof s.value == "string"
223
223
  );
224
- if (r && typeof r.value == "string")
225
- return r.value;
224
+ if (e && typeof e.value == "string")
225
+ return e.value;
226
226
  }
227
227
  return n.deepFindString(t, /description/i);
228
228
  }
@@ -240,12 +240,12 @@ class n {
240
240
  * the track's own description to the album.
241
241
  */
242
242
  static extractAlbumDescription(t) {
243
- const e = ["album_description", "albumDescription"];
244
- for (const s of e)
243
+ const r = ["album_description", "albumDescription"];
244
+ for (const s of r)
245
245
  if (t[s] && typeof t[s] == "string")
246
246
  return t[s];
247
- const r = t.album;
248
- return r && typeof r == "object" && !Array.isArray(r) ? n.deepFindString(r, /description|liner|notes/i) : null;
247
+ const e = t.album;
248
+ return e && typeof e == "object" && !Array.isArray(e) ? n.deepFindString(e, /description|liner|notes/i) : null;
249
249
  }
250
250
  /**
251
251
  * Extract artist description — one of the bonus flavors. Priority:
@@ -262,12 +262,12 @@ class n {
262
262
  * track's own description to the artist.
263
263
  */
264
264
  static extractArtistDescription(t) {
265
- const e = ["artist_description", "artistDescription", "artist_bio", "artistBio"];
266
- for (const s of e)
265
+ const r = ["artist_description", "artistDescription", "artist_bio", "artistBio"];
266
+ for (const s of r)
267
267
  if (t[s] && typeof t[s] == "string")
268
268
  return t[s];
269
- const r = t.artist;
270
- return r && typeof r == "object" && !Array.isArray(r) ? n.deepFindString(r, /description|bio|about/i) : null;
269
+ const e = t.artist;
270
+ return e && typeof e == "object" && !Array.isArray(e) ? n.deepFindString(e, /description|bio|about/i) : null;
271
271
  }
272
272
  /**
273
273
  * Breadth-first search for the shallowest string value whose key matches
@@ -275,19 +275,19 @@ class n {
275
275
  * then key order. Objects are descended (arrays skipped), depth-capped so
276
276
  * pathological metadata blobs stay cheap.
277
277
  */
278
- static deepFindString(t, e, r = 5) {
279
- const s = /* @__PURE__ */ new Set(), o = [{ node: t, depth: 0 }];
280
- for (; o.length > 0; ) {
281
- const { node: u, depth: c } = o.shift();
278
+ static deepFindString(t, r, e = 5) {
279
+ const s = /* @__PURE__ */ new Set(), a = [{ node: t, depth: 0 }];
280
+ for (; a.length > 0; ) {
281
+ const { node: u, depth: c } = a.shift();
282
282
  for (const f of Object.keys(u)) {
283
- const a = u[f];
284
- if (typeof a == "string" && a && e.test(f))
285
- return a;
283
+ const o = u[f];
284
+ if (typeof o == "string" && o && r.test(f))
285
+ return o;
286
286
  }
287
- if (!(c >= r))
287
+ if (!(c >= e))
288
288
  for (const f of Object.keys(u)) {
289
- const a = u[f];
290
- a && typeof a == "object" && !Array.isArray(a) && !s.has(a) && (s.add(a), o.push({ node: a, depth: c + 1 }));
289
+ const o = u[f];
290
+ o && typeof o == "object" && !Array.isArray(o) && !s.has(o) && (s.add(o), a.push({ node: o, depth: c + 1 }));
291
291
  }
292
292
  }
293
293
  return null;
@@ -297,37 +297,37 @@ class n {
297
297
  * trimmed string[] with empties removed.
298
298
  */
299
299
  static normalizeTags(t) {
300
- const e = /* @__PURE__ */ new Set();
301
- for (const r of t) {
302
- if (r == null) continue;
303
- const s = String(r).trim().toLowerCase();
304
- s && e.add(s);
300
+ const r = /* @__PURE__ */ new Set();
301
+ for (const e of t) {
302
+ if (e == null) continue;
303
+ const s = String(e).trim().toLowerCase();
304
+ s && r.add(s);
305
305
  }
306
- return Array.from(e);
306
+ return Array.from(r);
307
307
  }
308
308
  static convertAttributes(t) {
309
309
  if (!Array.isArray(t))
310
310
  return null;
311
- const e = {};
312
- for (const r of t)
313
- r.trait_type && r.value !== void 0 && (e[r.trait_type] = r.value);
314
- return Object.keys(e).length > 0 ? e : null;
311
+ const r = {};
312
+ for (const e of t)
313
+ e.trait_type && e.value !== void 0 && (r[e.trait_type] = e.value);
314
+ return Object.keys(r).length > 0 ? r : null;
315
315
  }
316
316
  /**
317
317
  * Safely extract a URI string from a nested object path.
318
318
  * e.g. extractNestedUri(data, 'project', 'artwork', 'uri') => data.project.artwork.uri
319
319
  */
320
- static extractNestedUri(t, ...e) {
321
- let r = t;
322
- for (const s of e)
323
- if (r && typeof r == "object" && !Array.isArray(r))
324
- r = r[s];
320
+ static extractNestedUri(t, ...r) {
321
+ let e = t;
322
+ for (const s of r)
323
+ if (e && typeof e == "object" && !Array.isArray(e))
324
+ e = e[s];
325
325
  else
326
326
  return null;
327
- return typeof r == "string" ? r : null;
327
+ return typeof e == "string" ? e : null;
328
328
  }
329
329
  }
330
- function g(i) {
330
+ function _(i) {
331
331
  if ("audio_url" in i && typeof i.audio_url == "string")
332
332
  return i.audio_url;
333
333
  if ("metadata" in i) {
@@ -347,7 +347,7 @@ function A(i) {
347
347
  }
348
348
  return null;
349
349
  }
350
- function d(i) {
350
+ function g(i) {
351
351
  if ("image_url" in i && typeof i.image_url == "string")
352
352
  return i.image_url;
353
353
  if ("metadata" in i) {
@@ -359,7 +359,7 @@ function d(i) {
359
359
  }
360
360
  return null;
361
361
  }
362
- function _(i) {
362
+ function y(i) {
363
363
  if ("image_thumb_url" in i && typeof i.image_thumb_url == "string")
364
364
  return i.image_thumb_url;
365
365
  if ("metadata" in i) {
@@ -379,31 +379,31 @@ function h(i) {
379
379
  }
380
380
  function M(i) {
381
381
  const t = [];
382
- for (const e of i.tracks) {
383
- const r = g(e);
384
- r && t.push(r);
382
+ for (const r of i.tracks) {
383
+ const e = _(r);
384
+ e && t.push(e);
385
385
  }
386
386
  return t;
387
387
  }
388
388
  function j(i) {
389
389
  const t = [];
390
- for (const e of i.tracks) {
391
- const r = d(e);
392
- r && t.push(r);
390
+ for (const r of i.tracks) {
391
+ const e = g(r);
392
+ e && t.push(e);
393
393
  }
394
394
  return t;
395
395
  }
396
396
  function F(i) {
397
397
  const t = [];
398
- for (const e of i.tracks) {
399
- if ("title" in e && typeof e.title == "string") {
400
- t.push(e.title);
398
+ for (const r of i.tracks) {
399
+ if ("title" in r && typeof r.title == "string") {
400
+ t.push(r.title);
401
401
  continue;
402
402
  }
403
- if ("metadata" in e) {
404
- const r = n.parseMetadata(e.metadata);
405
- if (r) {
406
- const s = n.extractTitle(r);
403
+ if ("metadata" in r) {
404
+ const e = n.parseMetadata(r.metadata);
405
+ if (e) {
406
+ const s = n.extractTitle(e);
407
407
  s && t.push(s);
408
408
  }
409
409
  }
@@ -412,15 +412,15 @@ function F(i) {
412
412
  }
413
413
  function $(i) {
414
414
  const t = [];
415
- for (const e of i.tracks) {
416
- if ("artist" in e && typeof e.artist == "string") {
417
- t.push(e.artist);
415
+ for (const r of i.tracks) {
416
+ if ("artist" in r && typeof r.artist == "string") {
417
+ t.push(r.artist);
418
418
  continue;
419
419
  }
420
- if ("metadata" in e) {
421
- const r = n.parseMetadata(e.metadata);
422
- if (r) {
423
- const s = n.extractArtist(r);
420
+ if ("metadata" in r) {
421
+ const e = n.parseMetadata(r.metadata);
422
+ if (e) {
423
+ const s = n.extractArtist(e);
424
424
  s && t.push(s);
425
425
  }
426
426
  }
@@ -429,30 +429,30 @@ function $(i) {
429
429
  }
430
430
  function D(i) {
431
431
  const t = /* @__PURE__ */ new Set();
432
- for (const e of i.tracks) {
433
- if ("genre" in e && typeof e.genre == "string" && e.genre) {
434
- t.add(e.genre);
432
+ for (const r of i.tracks) {
433
+ if ("genre" in r && typeof r.genre == "string" && r.genre) {
434
+ t.add(r.genre);
435
435
  continue;
436
436
  }
437
- if ("metadata" in e) {
438
- const r = n.parseMetadata(e.metadata);
439
- r && typeof r.genre == "string" && r.genre && t.add(r.genre);
437
+ if ("metadata" in r) {
438
+ const e = n.parseMetadata(r.metadata);
439
+ e && typeof e.genre == "string" && e.genre && t.add(e.genre);
440
440
  }
441
441
  }
442
442
  return Array.from(t).sort();
443
443
  }
444
444
  function I(i) {
445
445
  const t = /* @__PURE__ */ new Set();
446
- for (const e of i.tracks) {
447
- if ("tags" in e && Array.isArray(e.tags)) {
448
- for (const r of e.tags)
449
- r && t.add(r.toLowerCase());
446
+ for (const r of i.tracks) {
447
+ if ("tags" in r && Array.isArray(r.tags)) {
448
+ for (const e of r.tags)
449
+ e && t.add(e.toLowerCase());
450
450
  continue;
451
451
  }
452
- if ("metadata" in e) {
453
- const r = n.parseMetadata(e.metadata);
454
- if (r && Array.isArray(r.tags))
455
- for (const s of r.tags)
452
+ if ("metadata" in r) {
453
+ const e = n.parseMetadata(r.metadata);
454
+ if (e && Array.isArray(e.tags))
455
+ for (const s of e.tags)
456
456
  s && t.add(String(s).toLowerCase());
457
457
  }
458
458
  }
@@ -460,14 +460,14 @@ function I(i) {
460
460
  }
461
461
  function C(i) {
462
462
  let t = 0;
463
- for (const e of i.tracks) {
464
- if ("duration" in e && typeof e.duration == "number") {
465
- t += e.duration;
463
+ for (const r of i.tracks) {
464
+ if ("duration" in r && typeof r.duration == "number") {
465
+ t += r.duration;
466
466
  continue;
467
467
  }
468
- if ("metadata" in e) {
469
- const r = n.parseMetadata(e.metadata);
470
- r && typeof r.duration == "number" && (t += r.duration);
468
+ if ("metadata" in r) {
469
+ const e = n.parseMetadata(r.metadata);
470
+ e && typeof e.duration == "number" && (t += e.duration);
471
471
  }
472
472
  }
473
473
  return t;
@@ -477,62 +477,66 @@ function H(i) {
477
477
  }
478
478
  function P(i) {
479
479
  const t = [];
480
- for (const e of i.tracks) {
481
- const r = g(e), s = d(e), o = _(e);
480
+ for (const r of i.tracks) {
481
+ const e = _(r), s = g(r), a = y(r);
482
482
  let u = "", c = "", f;
483
- if ("title" in e)
484
- u = e.title || "", c = e.artist || "", f = e.description || void 0;
485
- else if ("metadata" in e) {
486
- const a = n.parseMetadata(e.metadata);
487
- a && (u = n.extractTitle(a) || "", c = n.extractArtist(a) || "", f = n.extractDescription(a) || void 0);
483
+ if ("title" in r)
484
+ u = r.title || "", c = r.artist || "", f = r.description || void 0;
485
+ else if ("metadata" in r) {
486
+ const o = n.parseMetadata(r.metadata);
487
+ o && (u = n.extractTitle(o) || "", c = n.extractArtist(o) || "", f = n.extractDescription(o) || void 0);
488
488
  }
489
- if (r) {
490
- const a = {
489
+ if (e) {
490
+ const o = {
491
491
  title: u,
492
492
  artist: c,
493
- audio_url: r,
493
+ audio_url: e,
494
494
  image_url: s || ""
495
- }, l = A(e);
496
- l && l !== r && (a.audio_url_lossless = l), o && (a.image_thumb_url = o), f && (a.description = f), "audio_ipfs_hash" in e && typeof e.audio_ipfs_hash == "string" && (a.audio_ipfs_hash = e.audio_ipfs_hash), "artwork_ipfs_hash" in e && typeof e.artwork_ipfs_hash == "string" && (a.artwork_ipfs_hash = e.artwork_ipfs_hash), t.push(a);
495
+ }, l = A(r);
496
+ l && l !== e && (o.audio_url_lossless = l), a && (o.image_thumb_url = a), f && (o.description = f), "audio_ipfs_hash" in r && typeof r.audio_ipfs_hash == "string" && (o.audio_ipfs_hash = r.audio_ipfs_hash), "artwork_ipfs_hash" in r && typeof r.artwork_ipfs_hash == "string" && (o.artwork_ipfs_hash = r.artwork_ipfs_hash), "mint_function" in r && typeof r.mint_function == "string" && (o.mint_function = r.mint_function), "mint_price" in r && typeof r.mint_price == "string" && (o.mint_price = r.mint_price), "mint_snapshot_time" in r && typeof r.mint_snapshot_time == "number" && (o.mint_snapshot_time = r.mint_snapshot_time), "mint_token" in r && typeof r.mint_token == "string" && (o.mint_token = r.mint_token), t.push(o);
497
497
  }
498
498
  }
499
499
  return t;
500
500
  }
501
501
  function W(i) {
502
502
  const t = [];
503
- for (const e of i.tracks) {
504
- if ("audio_url" in e) {
505
- t.push({ ...e });
503
+ for (const r of i.tracks) {
504
+ if ("audio_url" in r) {
505
+ t.push({ ...r });
506
506
  continue;
507
507
  }
508
- if ("metadata" in e) {
509
- const r = n.parseMetadata(e.metadata);
510
- if (r) {
511
- const s = n.extractAudioUrlLossless(r), o = n.extractAudioUrl(r);
508
+ if ("metadata" in r) {
509
+ const e = n.parseMetadata(r.metadata);
510
+ if (e) {
511
+ const s = n.extractAudioUrlLossless(e), a = n.extractAudioUrl(e);
512
512
  t.push({
513
- id: e.chain_name === "AR" ? `AR-${e.tx_id}` : `${e.chain_name}-${e.token_address}-${e.token_id}`,
514
- chain_name: e.chain_name,
515
- token_address: e.token_address,
516
- token_id: e.token_id,
517
- tx_id: e.tx_id,
518
- platform: e.platform,
519
- title: n.extractTitle(r),
520
- artist: n.extractArtist(r),
521
- audio_url: o,
522
- image_url: n.extractImageUrl(r),
523
- image_thumb_url: n.extractImageThumbUrl(r),
524
- duration: r.duration,
525
- genre: r.genre,
526
- tags: r.tags,
527
- bpm: r.bpm,
528
- key: r.key,
529
- album: r.album,
530
- description: n.extractDescription(r),
531
- attributes: n.convertAttributes(r.attributes),
532
- ...s && s !== o ? { audio_url_lossless: s } : {},
533
- // v0.4 IPFS hash fields from raw track (mint fields live only in metadata interior)
534
- ...e.audio_ipfs_hash ? { audio_ipfs_hash: e.audio_ipfs_hash } : {},
535
- ...e.artwork_ipfs_hash ? { artwork_ipfs_hash: e.artwork_ipfs_hash } : {}
513
+ id: r.chain_name === "AR" ? `AR-${r.tx_id}` : `${r.chain_name}-${r.token_address}-${r.token_id}`,
514
+ chain_name: r.chain_name,
515
+ token_address: r.token_address,
516
+ token_id: r.token_id,
517
+ tx_id: r.tx_id,
518
+ platform: r.platform,
519
+ title: n.extractTitle(e),
520
+ artist: n.extractArtist(e),
521
+ audio_url: a,
522
+ image_url: n.extractImageUrl(e),
523
+ image_thumb_url: n.extractImageThumbUrl(e),
524
+ duration: e.duration,
525
+ genre: e.genre,
526
+ tags: e.tags,
527
+ bpm: e.bpm,
528
+ key: e.key,
529
+ album: e.album,
530
+ description: n.extractDescription(e),
531
+ attributes: n.convertAttributes(e.attributes),
532
+ ...s && s !== a ? { audio_url_lossless: s } : {},
533
+ // v0.4 IPFS hash + mint fields from the raw track wrapper
534
+ ...r.audio_ipfs_hash ? { audio_ipfs_hash: r.audio_ipfs_hash } : {},
535
+ ...r.artwork_ipfs_hash ? { artwork_ipfs_hash: r.artwork_ipfs_hash } : {},
536
+ ...r.mint_function ? { mint_function: r.mint_function } : {},
537
+ ...r.mint_price ? { mint_price: r.mint_price } : {},
538
+ ...r.mint_snapshot_time ? { mint_snapshot_time: r.mint_snapshot_time } : {},
539
+ ...r.mint_token ? { mint_token: r.mint_token } : {}
536
540
  });
537
541
  }
538
542
  }
@@ -541,37 +545,37 @@ function W(i) {
541
545
  }
542
546
  function E(i) {
543
547
  const t = [];
544
- for (const e of i.tracks) {
545
- const r = h(e);
546
- r && t.push(r);
548
+ for (const r of i.tracks) {
549
+ const e = h(r);
550
+ e && t.push(e);
547
551
  }
548
552
  return t;
549
553
  }
550
554
  function N(i) {
551
555
  const t = [];
552
- for (const e of i.tracks) {
553
- const r = h(e);
554
- if (!r) continue;
555
- const s = g(e), o = d(e), u = _(e);
556
- let c = "", f = "", a;
557
- if ("title" in e)
558
- c = e.title || "", f = e.artist || "", a = e.description || void 0;
559
- else if ("metadata" in e) {
560
- const p = n.parseMetadata(e.metadata);
561
- p && (c = n.extractTitle(p) || "", f = n.extractArtist(p) || "", a = n.extractDescription(p) || void 0);
556
+ for (const r of i.tracks) {
557
+ const e = h(r);
558
+ if (!e) continue;
559
+ const s = _(r), a = g(r), u = y(r);
560
+ let c = "", f = "", o;
561
+ if ("title" in r)
562
+ c = r.title || "", f = r.artist || "", o = r.description || void 0;
563
+ else if ("metadata" in r) {
564
+ const p = n.parseMetadata(r.metadata);
565
+ p && (c = n.extractTitle(p) || "", f = n.extractArtist(p) || "", o = n.extractDescription(p) || void 0);
562
566
  }
563
567
  const l = {
564
568
  title: c,
565
569
  artist: f,
566
570
  audio_url: s || "",
567
- image_url: o || "",
568
- vrm: r
571
+ image_url: a || "",
572
+ vrm: e
569
573
  };
570
- u && (l.image_thumb_url = u), a && (l.description = a), t.push(l);
574
+ u && (l.image_thumb_url = u), o && (l.description = o), t.push(l);
571
575
  }
572
576
  return t;
573
577
  }
574
- const y = [
578
+ const d = [
575
579
  "ipfs.io",
576
580
  "cloudflare-ipfs.com",
577
581
  "dweb.link",
@@ -592,10 +596,10 @@ function v(i) {
592
596
  const T = /^ipfs_[a-z]+$/;
593
597
  function b(i) {
594
598
  const t = i.split("/").filter(Boolean);
595
- for (let e = 0; e < t.length - 1; e++)
596
- if (T.test(t[e]) && v(t[e + 1])) {
597
- const r = t[e + 1], s = t.slice(e + 2);
598
- return s.length > 0 ? `${r}/${s.join("/")}` : r;
599
+ for (let r = 0; r < t.length - 1; r++)
600
+ if (T.test(t[r]) && v(t[r + 1])) {
601
+ const e = t[r + 1], s = t.slice(r + 2);
602
+ return s.length > 0 ? `${e}/${s.join("/")}` : e;
599
603
  }
600
604
  return null;
601
605
  }
@@ -606,14 +610,14 @@ function U(i) {
606
610
  if (i.startsWith("ipfs://"))
607
611
  return i.slice(7);
608
612
  try {
609
- const t = new URL(i), { hostname: e, pathname: r } = t, s = e.match(/^([A-Za-z0-9]+)\.ipfs\.dweb\.link$/);
613
+ const t = new URL(i), { hostname: r, pathname: e } = t, s = r.match(/^([A-Za-z0-9]+)\.ipfs\.dweb\.link$/);
610
614
  if (s)
611
- return `${s[1]}${r}`;
612
- if (y.some(
613
- (c) => e === c || e.endsWith("." + c)
614
- ) && r.startsWith(m))
615
- return r.slice(m.length);
616
- const u = b(r);
615
+ return `${s[1]}${e}`;
616
+ if (d.some(
617
+ (c) => r === c || r.endsWith("." + c)
618
+ ) && e.startsWith(m))
619
+ return e.slice(m.length);
620
+ const u = b(e);
617
621
  if (u) return u;
618
622
  } catch {
619
623
  }
@@ -623,10 +627,10 @@ function R(i) {
623
627
  if (!i || typeof i != "string") return !1;
624
628
  if (i.startsWith("ipfs://")) return !0;
625
629
  try {
626
- const t = new URL(i), { hostname: e, pathname: r } = t;
627
- if (/^[A-Za-z0-9]+\.ipfs\.dweb\.link$/.test(e) || y.some(
628
- (o) => e === o || e.endsWith("." + o)
629
- ) && r.startsWith(m) || b(r)) return !0;
630
+ const t = new URL(i), { hostname: r, pathname: e } = t;
631
+ if (/^[A-Za-z0-9]+\.ipfs\.dweb\.link$/.test(r) || d.some(
632
+ (a) => r === a || r.endsWith("." + a)
633
+ ) && e.startsWith(m) || b(e)) return !0;
630
634
  } catch {
631
635
  }
632
636
  return !1;
@@ -635,8 +639,8 @@ function S(i) {
635
639
  if (!(!i || i.startsWith("ipfs://")))
636
640
  try {
637
641
  const { hostname: t } = new URL(i);
638
- return y.some(
639
- (r) => t === r || t.endsWith("." + r)
642
+ return d.some(
643
+ (e) => t === e || t.endsWith("." + e)
640
644
  ) ? t : void 0;
641
645
  } catch {
642
646
  return;
@@ -644,20 +648,20 @@ function S(i) {
644
648
  }
645
649
  function G(i, t = {}) {
646
650
  if (!i) return i;
647
- const e = typeof t == "string" ? { gatewayHost: t } : t, { gatewayHost: r = k, preserveOriginalGateway: s = !1 } = e, o = U(i);
648
- if (o) {
651
+ const r = typeof t == "string" ? { gatewayHost: t } : t, { gatewayHost: e = k, preserveOriginalGateway: s = !1 } = r, a = U(i);
652
+ if (a) {
649
653
  if (s) {
650
654
  const u = S(i);
651
655
  if (u)
652
- return `https://${u}/ipfs/${o}`;
656
+ return `https://${u}/ipfs/${a}`;
653
657
  }
654
- return `https://${r}/ipfs/${o}`;
658
+ return `https://${e}/ipfs/${a}`;
655
659
  }
656
660
  return i;
657
661
  }
658
662
  export {
659
663
  k as D,
660
- y as K,
664
+ d as K,
661
665
  n as M,
662
666
  M as a,
663
667
  W as b,