audible-api-ts 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,12 +1,1700 @@
1
1
  var __defProp = Object.defineProperty;
2
+ var __returnValue = (v) => v;
3
+ function __exportSetter(name, newValue) {
4
+ this[name] = __returnValue.bind(null, newValue);
5
+ }
2
6
  var __export = (target, all) => {
3
7
  for (var name in all)
4
8
  __defProp(target, name, {
5
9
  get: all[name],
6
10
  enumerable: true,
7
11
  configurable: true,
8
- set: (newValue) => all[name] = () => newValue
12
+ set: __exportSetter.bind(all, name)
13
+ });
14
+ };
15
+ // node_modules/lodash-es/_arrayMap.js
16
+ function arrayMap(array, iteratee) {
17
+ var index = -1, length = array == null ? 0 : array.length, result = Array(length);
18
+ while (++index < length) {
19
+ result[index] = iteratee(array[index], index, array);
20
+ }
21
+ return result;
22
+ }
23
+ var _arrayMap_default = arrayMap;
24
+
25
+ // node_modules/lodash-es/isArray.js
26
+ var isArray = Array.isArray;
27
+ var isArray_default = isArray;
28
+
29
+ // node_modules/lodash-es/_freeGlobal.js
30
+ var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
31
+ var _freeGlobal_default = freeGlobal;
32
+
33
+ // node_modules/lodash-es/_root.js
34
+ var freeSelf = typeof self == "object" && self && self.Object === Object && self;
35
+ var root = _freeGlobal_default || freeSelf || Function("return this")();
36
+ var _root_default = root;
37
+
38
+ // node_modules/lodash-es/_Symbol.js
39
+ var Symbol2 = _root_default.Symbol;
40
+ var _Symbol_default = Symbol2;
41
+
42
+ // node_modules/lodash-es/_getRawTag.js
43
+ var objectProto = Object.prototype;
44
+ var hasOwnProperty = objectProto.hasOwnProperty;
45
+ var nativeObjectToString = objectProto.toString;
46
+ var symToStringTag = _Symbol_default ? _Symbol_default.toStringTag : undefined;
47
+ function getRawTag(value) {
48
+ var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
49
+ try {
50
+ value[symToStringTag] = undefined;
51
+ var unmasked = true;
52
+ } catch (e) {}
53
+ var result = nativeObjectToString.call(value);
54
+ if (unmasked) {
55
+ if (isOwn) {
56
+ value[symToStringTag] = tag;
57
+ } else {
58
+ delete value[symToStringTag];
59
+ }
60
+ }
61
+ return result;
62
+ }
63
+ var _getRawTag_default = getRawTag;
64
+
65
+ // node_modules/lodash-es/_objectToString.js
66
+ var objectProto2 = Object.prototype;
67
+ var nativeObjectToString2 = objectProto2.toString;
68
+ function objectToString(value) {
69
+ return nativeObjectToString2.call(value);
70
+ }
71
+ var _objectToString_default = objectToString;
72
+
73
+ // node_modules/lodash-es/_baseGetTag.js
74
+ var nullTag = "[object Null]";
75
+ var undefinedTag = "[object Undefined]";
76
+ var symToStringTag2 = _Symbol_default ? _Symbol_default.toStringTag : undefined;
77
+ function baseGetTag(value) {
78
+ if (value == null) {
79
+ return value === undefined ? undefinedTag : nullTag;
80
+ }
81
+ return symToStringTag2 && symToStringTag2 in Object(value) ? _getRawTag_default(value) : _objectToString_default(value);
82
+ }
83
+ var _baseGetTag_default = baseGetTag;
84
+
85
+ // node_modules/lodash-es/isObjectLike.js
86
+ function isObjectLike(value) {
87
+ return value != null && typeof value == "object";
88
+ }
89
+ var isObjectLike_default = isObjectLike;
90
+
91
+ // node_modules/lodash-es/isSymbol.js
92
+ var symbolTag = "[object Symbol]";
93
+ function isSymbol(value) {
94
+ return typeof value == "symbol" || isObjectLike_default(value) && _baseGetTag_default(value) == symbolTag;
95
+ }
96
+ var isSymbol_default = isSymbol;
97
+
98
+ // node_modules/lodash-es/_isKey.js
99
+ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
100
+ var reIsPlainProp = /^\w*$/;
101
+ function isKey(value, object) {
102
+ if (isArray_default(value)) {
103
+ return false;
104
+ }
105
+ var type = typeof value;
106
+ if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol_default(value)) {
107
+ return true;
108
+ }
109
+ return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
110
+ }
111
+ var _isKey_default = isKey;
112
+
113
+ // node_modules/lodash-es/isObject.js
114
+ function isObject(value) {
115
+ var type = typeof value;
116
+ return value != null && (type == "object" || type == "function");
117
+ }
118
+ var isObject_default = isObject;
119
+
120
+ // node_modules/lodash-es/isFunction.js
121
+ var asyncTag = "[object AsyncFunction]";
122
+ var funcTag = "[object Function]";
123
+ var genTag = "[object GeneratorFunction]";
124
+ var proxyTag = "[object Proxy]";
125
+ function isFunction(value) {
126
+ if (!isObject_default(value)) {
127
+ return false;
128
+ }
129
+ var tag = _baseGetTag_default(value);
130
+ return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
131
+ }
132
+ var isFunction_default = isFunction;
133
+
134
+ // node_modules/lodash-es/_coreJsData.js
135
+ var coreJsData = _root_default["__core-js_shared__"];
136
+ var _coreJsData_default = coreJsData;
137
+
138
+ // node_modules/lodash-es/_isMasked.js
139
+ var maskSrcKey = function() {
140
+ var uid = /[^.]+$/.exec(_coreJsData_default && _coreJsData_default.keys && _coreJsData_default.keys.IE_PROTO || "");
141
+ return uid ? "Symbol(src)_1." + uid : "";
142
+ }();
143
+ function isMasked(func) {
144
+ return !!maskSrcKey && maskSrcKey in func;
145
+ }
146
+ var _isMasked_default = isMasked;
147
+
148
+ // node_modules/lodash-es/_toSource.js
149
+ var funcProto = Function.prototype;
150
+ var funcToString = funcProto.toString;
151
+ function toSource(func) {
152
+ if (func != null) {
153
+ try {
154
+ return funcToString.call(func);
155
+ } catch (e) {}
156
+ try {
157
+ return func + "";
158
+ } catch (e) {}
159
+ }
160
+ return "";
161
+ }
162
+ var _toSource_default = toSource;
163
+
164
+ // node_modules/lodash-es/_baseIsNative.js
165
+ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
166
+ var reIsHostCtor = /^\[object .+?Constructor\]$/;
167
+ var funcProto2 = Function.prototype;
168
+ var objectProto3 = Object.prototype;
169
+ var funcToString2 = funcProto2.toString;
170
+ var hasOwnProperty2 = objectProto3.hasOwnProperty;
171
+ var reIsNative = RegExp("^" + funcToString2.call(hasOwnProperty2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
172
+ function baseIsNative(value) {
173
+ if (!isObject_default(value) || _isMasked_default(value)) {
174
+ return false;
175
+ }
176
+ var pattern = isFunction_default(value) ? reIsNative : reIsHostCtor;
177
+ return pattern.test(_toSource_default(value));
178
+ }
179
+ var _baseIsNative_default = baseIsNative;
180
+
181
+ // node_modules/lodash-es/_getValue.js
182
+ function getValue(object, key) {
183
+ return object == null ? undefined : object[key];
184
+ }
185
+ var _getValue_default = getValue;
186
+
187
+ // node_modules/lodash-es/_getNative.js
188
+ function getNative(object, key) {
189
+ var value = _getValue_default(object, key);
190
+ return _baseIsNative_default(value) ? value : undefined;
191
+ }
192
+ var _getNative_default = getNative;
193
+
194
+ // node_modules/lodash-es/_nativeCreate.js
195
+ var nativeCreate = _getNative_default(Object, "create");
196
+ var _nativeCreate_default = nativeCreate;
197
+
198
+ // node_modules/lodash-es/_hashClear.js
199
+ function hashClear() {
200
+ this.__data__ = _nativeCreate_default ? _nativeCreate_default(null) : {};
201
+ this.size = 0;
202
+ }
203
+ var _hashClear_default = hashClear;
204
+
205
+ // node_modules/lodash-es/_hashDelete.js
206
+ function hashDelete(key) {
207
+ var result = this.has(key) && delete this.__data__[key];
208
+ this.size -= result ? 1 : 0;
209
+ return result;
210
+ }
211
+ var _hashDelete_default = hashDelete;
212
+
213
+ // node_modules/lodash-es/_hashGet.js
214
+ var HASH_UNDEFINED = "__lodash_hash_undefined__";
215
+ var objectProto4 = Object.prototype;
216
+ var hasOwnProperty3 = objectProto4.hasOwnProperty;
217
+ function hashGet(key) {
218
+ var data = this.__data__;
219
+ if (_nativeCreate_default) {
220
+ var result = data[key];
221
+ return result === HASH_UNDEFINED ? undefined : result;
222
+ }
223
+ return hasOwnProperty3.call(data, key) ? data[key] : undefined;
224
+ }
225
+ var _hashGet_default = hashGet;
226
+
227
+ // node_modules/lodash-es/_hashHas.js
228
+ var objectProto5 = Object.prototype;
229
+ var hasOwnProperty4 = objectProto5.hasOwnProperty;
230
+ function hashHas(key) {
231
+ var data = this.__data__;
232
+ return _nativeCreate_default ? data[key] !== undefined : hasOwnProperty4.call(data, key);
233
+ }
234
+ var _hashHas_default = hashHas;
235
+
236
+ // node_modules/lodash-es/_hashSet.js
237
+ var HASH_UNDEFINED2 = "__lodash_hash_undefined__";
238
+ function hashSet(key, value) {
239
+ var data = this.__data__;
240
+ this.size += this.has(key) ? 0 : 1;
241
+ data[key] = _nativeCreate_default && value === undefined ? HASH_UNDEFINED2 : value;
242
+ return this;
243
+ }
244
+ var _hashSet_default = hashSet;
245
+
246
+ // node_modules/lodash-es/_Hash.js
247
+ function Hash(entries) {
248
+ var index = -1, length = entries == null ? 0 : entries.length;
249
+ this.clear();
250
+ while (++index < length) {
251
+ var entry = entries[index];
252
+ this.set(entry[0], entry[1]);
253
+ }
254
+ }
255
+ Hash.prototype.clear = _hashClear_default;
256
+ Hash.prototype["delete"] = _hashDelete_default;
257
+ Hash.prototype.get = _hashGet_default;
258
+ Hash.prototype.has = _hashHas_default;
259
+ Hash.prototype.set = _hashSet_default;
260
+ var _Hash_default = Hash;
261
+
262
+ // node_modules/lodash-es/_listCacheClear.js
263
+ function listCacheClear() {
264
+ this.__data__ = [];
265
+ this.size = 0;
266
+ }
267
+ var _listCacheClear_default = listCacheClear;
268
+
269
+ // node_modules/lodash-es/eq.js
270
+ function eq(value, other) {
271
+ return value === other || value !== value && other !== other;
272
+ }
273
+ var eq_default = eq;
274
+
275
+ // node_modules/lodash-es/_assocIndexOf.js
276
+ function assocIndexOf(array, key) {
277
+ var length = array.length;
278
+ while (length--) {
279
+ if (eq_default(array[length][0], key)) {
280
+ return length;
281
+ }
282
+ }
283
+ return -1;
284
+ }
285
+ var _assocIndexOf_default = assocIndexOf;
286
+
287
+ // node_modules/lodash-es/_listCacheDelete.js
288
+ var arrayProto = Array.prototype;
289
+ var splice = arrayProto.splice;
290
+ function listCacheDelete(key) {
291
+ var data = this.__data__, index = _assocIndexOf_default(data, key);
292
+ if (index < 0) {
293
+ return false;
294
+ }
295
+ var lastIndex = data.length - 1;
296
+ if (index == lastIndex) {
297
+ data.pop();
298
+ } else {
299
+ splice.call(data, index, 1);
300
+ }
301
+ --this.size;
302
+ return true;
303
+ }
304
+ var _listCacheDelete_default = listCacheDelete;
305
+
306
+ // node_modules/lodash-es/_listCacheGet.js
307
+ function listCacheGet(key) {
308
+ var data = this.__data__, index = _assocIndexOf_default(data, key);
309
+ return index < 0 ? undefined : data[index][1];
310
+ }
311
+ var _listCacheGet_default = listCacheGet;
312
+
313
+ // node_modules/lodash-es/_listCacheHas.js
314
+ function listCacheHas(key) {
315
+ return _assocIndexOf_default(this.__data__, key) > -1;
316
+ }
317
+ var _listCacheHas_default = listCacheHas;
318
+
319
+ // node_modules/lodash-es/_listCacheSet.js
320
+ function listCacheSet(key, value) {
321
+ var data = this.__data__, index = _assocIndexOf_default(data, key);
322
+ if (index < 0) {
323
+ ++this.size;
324
+ data.push([key, value]);
325
+ } else {
326
+ data[index][1] = value;
327
+ }
328
+ return this;
329
+ }
330
+ var _listCacheSet_default = listCacheSet;
331
+
332
+ // node_modules/lodash-es/_ListCache.js
333
+ function ListCache(entries) {
334
+ var index = -1, length = entries == null ? 0 : entries.length;
335
+ this.clear();
336
+ while (++index < length) {
337
+ var entry = entries[index];
338
+ this.set(entry[0], entry[1]);
339
+ }
340
+ }
341
+ ListCache.prototype.clear = _listCacheClear_default;
342
+ ListCache.prototype["delete"] = _listCacheDelete_default;
343
+ ListCache.prototype.get = _listCacheGet_default;
344
+ ListCache.prototype.has = _listCacheHas_default;
345
+ ListCache.prototype.set = _listCacheSet_default;
346
+ var _ListCache_default = ListCache;
347
+
348
+ // node_modules/lodash-es/_Map.js
349
+ var Map2 = _getNative_default(_root_default, "Map");
350
+ var _Map_default = Map2;
351
+
352
+ // node_modules/lodash-es/_mapCacheClear.js
353
+ function mapCacheClear() {
354
+ this.size = 0;
355
+ this.__data__ = {
356
+ hash: new _Hash_default,
357
+ map: new (_Map_default || _ListCache_default),
358
+ string: new _Hash_default
359
+ };
360
+ }
361
+ var _mapCacheClear_default = mapCacheClear;
362
+
363
+ // node_modules/lodash-es/_isKeyable.js
364
+ function isKeyable(value) {
365
+ var type = typeof value;
366
+ return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
367
+ }
368
+ var _isKeyable_default = isKeyable;
369
+
370
+ // node_modules/lodash-es/_getMapData.js
371
+ function getMapData(map, key) {
372
+ var data = map.__data__;
373
+ return _isKeyable_default(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
374
+ }
375
+ var _getMapData_default = getMapData;
376
+
377
+ // node_modules/lodash-es/_mapCacheDelete.js
378
+ function mapCacheDelete(key) {
379
+ var result = _getMapData_default(this, key)["delete"](key);
380
+ this.size -= result ? 1 : 0;
381
+ return result;
382
+ }
383
+ var _mapCacheDelete_default = mapCacheDelete;
384
+
385
+ // node_modules/lodash-es/_mapCacheGet.js
386
+ function mapCacheGet(key) {
387
+ return _getMapData_default(this, key).get(key);
388
+ }
389
+ var _mapCacheGet_default = mapCacheGet;
390
+
391
+ // node_modules/lodash-es/_mapCacheHas.js
392
+ function mapCacheHas(key) {
393
+ return _getMapData_default(this, key).has(key);
394
+ }
395
+ var _mapCacheHas_default = mapCacheHas;
396
+
397
+ // node_modules/lodash-es/_mapCacheSet.js
398
+ function mapCacheSet(key, value) {
399
+ var data = _getMapData_default(this, key), size = data.size;
400
+ data.set(key, value);
401
+ this.size += data.size == size ? 0 : 1;
402
+ return this;
403
+ }
404
+ var _mapCacheSet_default = mapCacheSet;
405
+
406
+ // node_modules/lodash-es/_MapCache.js
407
+ function MapCache(entries) {
408
+ var index = -1, length = entries == null ? 0 : entries.length;
409
+ this.clear();
410
+ while (++index < length) {
411
+ var entry = entries[index];
412
+ this.set(entry[0], entry[1]);
413
+ }
414
+ }
415
+ MapCache.prototype.clear = _mapCacheClear_default;
416
+ MapCache.prototype["delete"] = _mapCacheDelete_default;
417
+ MapCache.prototype.get = _mapCacheGet_default;
418
+ MapCache.prototype.has = _mapCacheHas_default;
419
+ MapCache.prototype.set = _mapCacheSet_default;
420
+ var _MapCache_default = MapCache;
421
+
422
+ // node_modules/lodash-es/memoize.js
423
+ var FUNC_ERROR_TEXT = "Expected a function";
424
+ function memoize(func, resolver) {
425
+ if (typeof func != "function" || resolver != null && typeof resolver != "function") {
426
+ throw new TypeError(FUNC_ERROR_TEXT);
427
+ }
428
+ var memoized = function() {
429
+ var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
430
+ if (cache.has(key)) {
431
+ return cache.get(key);
432
+ }
433
+ var result = func.apply(this, args);
434
+ memoized.cache = cache.set(key, result) || cache;
435
+ return result;
436
+ };
437
+ memoized.cache = new (memoize.Cache || _MapCache_default);
438
+ return memoized;
439
+ }
440
+ memoize.Cache = _MapCache_default;
441
+ var memoize_default = memoize;
442
+
443
+ // node_modules/lodash-es/_memoizeCapped.js
444
+ var MAX_MEMOIZE_SIZE = 500;
445
+ function memoizeCapped(func) {
446
+ var result = memoize_default(func, function(key) {
447
+ if (cache.size === MAX_MEMOIZE_SIZE) {
448
+ cache.clear();
449
+ }
450
+ return key;
451
+ });
452
+ var cache = result.cache;
453
+ return result;
454
+ }
455
+ var _memoizeCapped_default = memoizeCapped;
456
+
457
+ // node_modules/lodash-es/_stringToPath.js
458
+ var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
459
+ var reEscapeChar = /\\(\\)?/g;
460
+ var stringToPath = _memoizeCapped_default(function(string) {
461
+ var result = [];
462
+ if (string.charCodeAt(0) === 46) {
463
+ result.push("");
464
+ }
465
+ string.replace(rePropName, function(match, number, quote, subString) {
466
+ result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
467
+ });
468
+ return result;
469
+ });
470
+ var _stringToPath_default = stringToPath;
471
+
472
+ // node_modules/lodash-es/_baseToString.js
473
+ var INFINITY = 1 / 0;
474
+ var symbolProto = _Symbol_default ? _Symbol_default.prototype : undefined;
475
+ var symbolToString = symbolProto ? symbolProto.toString : undefined;
476
+ function baseToString(value) {
477
+ if (typeof value == "string") {
478
+ return value;
479
+ }
480
+ if (isArray_default(value)) {
481
+ return _arrayMap_default(value, baseToString) + "";
482
+ }
483
+ if (isSymbol_default(value)) {
484
+ return symbolToString ? symbolToString.call(value) : "";
485
+ }
486
+ var result = value + "";
487
+ return result == "0" && 1 / value == -INFINITY ? "-0" : result;
488
+ }
489
+ var _baseToString_default = baseToString;
490
+
491
+ // node_modules/lodash-es/toString.js
492
+ function toString(value) {
493
+ return value == null ? "" : _baseToString_default(value);
494
+ }
495
+ var toString_default = toString;
496
+
497
+ // node_modules/lodash-es/_castPath.js
498
+ function castPath(value, object) {
499
+ if (isArray_default(value)) {
500
+ return value;
501
+ }
502
+ return _isKey_default(value, object) ? [value] : _stringToPath_default(toString_default(value));
503
+ }
504
+ var _castPath_default = castPath;
505
+
506
+ // node_modules/lodash-es/_toKey.js
507
+ var INFINITY2 = 1 / 0;
508
+ function toKey(value) {
509
+ if (typeof value == "string" || isSymbol_default(value)) {
510
+ return value;
511
+ }
512
+ var result = value + "";
513
+ return result == "0" && 1 / value == -INFINITY2 ? "-0" : result;
514
+ }
515
+ var _toKey_default = toKey;
516
+
517
+ // node_modules/lodash-es/_baseGet.js
518
+ function baseGet(object, path) {
519
+ path = _castPath_default(path, object);
520
+ var index = 0, length = path.length;
521
+ while (object != null && index < length) {
522
+ object = object[_toKey_default(path[index++])];
523
+ }
524
+ return index && index == length ? object : undefined;
525
+ }
526
+ var _baseGet_default = baseGet;
527
+
528
+ // node_modules/lodash-es/_stackClear.js
529
+ function stackClear() {
530
+ this.__data__ = new _ListCache_default;
531
+ this.size = 0;
532
+ }
533
+ var _stackClear_default = stackClear;
534
+
535
+ // node_modules/lodash-es/_stackDelete.js
536
+ function stackDelete(key) {
537
+ var data = this.__data__, result = data["delete"](key);
538
+ this.size = data.size;
539
+ return result;
540
+ }
541
+ var _stackDelete_default = stackDelete;
542
+
543
+ // node_modules/lodash-es/_stackGet.js
544
+ function stackGet(key) {
545
+ return this.__data__.get(key);
546
+ }
547
+ var _stackGet_default = stackGet;
548
+
549
+ // node_modules/lodash-es/_stackHas.js
550
+ function stackHas(key) {
551
+ return this.__data__.has(key);
552
+ }
553
+ var _stackHas_default = stackHas;
554
+
555
+ // node_modules/lodash-es/_stackSet.js
556
+ var LARGE_ARRAY_SIZE = 200;
557
+ function stackSet(key, value) {
558
+ var data = this.__data__;
559
+ if (data instanceof _ListCache_default) {
560
+ var pairs = data.__data__;
561
+ if (!_Map_default || pairs.length < LARGE_ARRAY_SIZE - 1) {
562
+ pairs.push([key, value]);
563
+ this.size = ++data.size;
564
+ return this;
565
+ }
566
+ data = this.__data__ = new _MapCache_default(pairs);
567
+ }
568
+ data.set(key, value);
569
+ this.size = data.size;
570
+ return this;
571
+ }
572
+ var _stackSet_default = stackSet;
573
+
574
+ // node_modules/lodash-es/_Stack.js
575
+ function Stack(entries) {
576
+ var data = this.__data__ = new _ListCache_default(entries);
577
+ this.size = data.size;
578
+ }
579
+ Stack.prototype.clear = _stackClear_default;
580
+ Stack.prototype["delete"] = _stackDelete_default;
581
+ Stack.prototype.get = _stackGet_default;
582
+ Stack.prototype.has = _stackHas_default;
583
+ Stack.prototype.set = _stackSet_default;
584
+ var _Stack_default = Stack;
585
+
586
+ // node_modules/lodash-es/_setCacheAdd.js
587
+ var HASH_UNDEFINED3 = "__lodash_hash_undefined__";
588
+ function setCacheAdd(value) {
589
+ this.__data__.set(value, HASH_UNDEFINED3);
590
+ return this;
591
+ }
592
+ var _setCacheAdd_default = setCacheAdd;
593
+
594
+ // node_modules/lodash-es/_setCacheHas.js
595
+ function setCacheHas(value) {
596
+ return this.__data__.has(value);
597
+ }
598
+ var _setCacheHas_default = setCacheHas;
599
+
600
+ // node_modules/lodash-es/_SetCache.js
601
+ function SetCache(values) {
602
+ var index = -1, length = values == null ? 0 : values.length;
603
+ this.__data__ = new _MapCache_default;
604
+ while (++index < length) {
605
+ this.add(values[index]);
606
+ }
607
+ }
608
+ SetCache.prototype.add = SetCache.prototype.push = _setCacheAdd_default;
609
+ SetCache.prototype.has = _setCacheHas_default;
610
+ var _SetCache_default = SetCache;
611
+
612
+ // node_modules/lodash-es/_arraySome.js
613
+ function arraySome(array, predicate) {
614
+ var index = -1, length = array == null ? 0 : array.length;
615
+ while (++index < length) {
616
+ if (predicate(array[index], index, array)) {
617
+ return true;
618
+ }
619
+ }
620
+ return false;
621
+ }
622
+ var _arraySome_default = arraySome;
623
+
624
+ // node_modules/lodash-es/_cacheHas.js
625
+ function cacheHas(cache, key) {
626
+ return cache.has(key);
627
+ }
628
+ var _cacheHas_default = cacheHas;
629
+
630
+ // node_modules/lodash-es/_equalArrays.js
631
+ var COMPARE_PARTIAL_FLAG = 1;
632
+ var COMPARE_UNORDERED_FLAG = 2;
633
+ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
634
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array.length, othLength = other.length;
635
+ if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
636
+ return false;
637
+ }
638
+ var arrStacked = stack.get(array);
639
+ var othStacked = stack.get(other);
640
+ if (arrStacked && othStacked) {
641
+ return arrStacked == other && othStacked == array;
642
+ }
643
+ var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new _SetCache_default : undefined;
644
+ stack.set(array, other);
645
+ stack.set(other, array);
646
+ while (++index < arrLength) {
647
+ var arrValue = array[index], othValue = other[index];
648
+ if (customizer) {
649
+ var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
650
+ }
651
+ if (compared !== undefined) {
652
+ if (compared) {
653
+ continue;
654
+ }
655
+ result = false;
656
+ break;
657
+ }
658
+ if (seen) {
659
+ if (!_arraySome_default(other, function(othValue, othIndex) {
660
+ if (!_cacheHas_default(seen, othIndex) && (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
661
+ return seen.push(othIndex);
662
+ }
663
+ })) {
664
+ result = false;
665
+ break;
666
+ }
667
+ } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
668
+ result = false;
669
+ break;
670
+ }
671
+ }
672
+ stack["delete"](array);
673
+ stack["delete"](other);
674
+ return result;
675
+ }
676
+ var _equalArrays_default = equalArrays;
677
+
678
+ // node_modules/lodash-es/_Uint8Array.js
679
+ var Uint8Array = _root_default.Uint8Array;
680
+ var _Uint8Array_default = Uint8Array;
681
+
682
+ // node_modules/lodash-es/_mapToArray.js
683
+ function mapToArray(map) {
684
+ var index = -1, result = Array(map.size);
685
+ map.forEach(function(value, key) {
686
+ result[++index] = [key, value];
687
+ });
688
+ return result;
689
+ }
690
+ var _mapToArray_default = mapToArray;
691
+
692
+ // node_modules/lodash-es/_setToArray.js
693
+ function setToArray(set) {
694
+ var index = -1, result = Array(set.size);
695
+ set.forEach(function(value) {
696
+ result[++index] = value;
697
+ });
698
+ return result;
699
+ }
700
+ var _setToArray_default = setToArray;
701
+
702
+ // node_modules/lodash-es/_equalByTag.js
703
+ var COMPARE_PARTIAL_FLAG2 = 1;
704
+ var COMPARE_UNORDERED_FLAG2 = 2;
705
+ var boolTag = "[object Boolean]";
706
+ var dateTag = "[object Date]";
707
+ var errorTag = "[object Error]";
708
+ var mapTag = "[object Map]";
709
+ var numberTag = "[object Number]";
710
+ var regexpTag = "[object RegExp]";
711
+ var setTag = "[object Set]";
712
+ var stringTag = "[object String]";
713
+ var symbolTag2 = "[object Symbol]";
714
+ var arrayBufferTag = "[object ArrayBuffer]";
715
+ var dataViewTag = "[object DataView]";
716
+ var symbolProto2 = _Symbol_default ? _Symbol_default.prototype : undefined;
717
+ var symbolValueOf = symbolProto2 ? symbolProto2.valueOf : undefined;
718
+ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
719
+ switch (tag) {
720
+ case dataViewTag:
721
+ if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
722
+ return false;
723
+ }
724
+ object = object.buffer;
725
+ other = other.buffer;
726
+ case arrayBufferTag:
727
+ if (object.byteLength != other.byteLength || !equalFunc(new _Uint8Array_default(object), new _Uint8Array_default(other))) {
728
+ return false;
729
+ }
730
+ return true;
731
+ case boolTag:
732
+ case dateTag:
733
+ case numberTag:
734
+ return eq_default(+object, +other);
735
+ case errorTag:
736
+ return object.name == other.name && object.message == other.message;
737
+ case regexpTag:
738
+ case stringTag:
739
+ return object == other + "";
740
+ case mapTag:
741
+ var convert = _mapToArray_default;
742
+ case setTag:
743
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG2;
744
+ convert || (convert = _setToArray_default);
745
+ if (object.size != other.size && !isPartial) {
746
+ return false;
747
+ }
748
+ var stacked = stack.get(object);
749
+ if (stacked) {
750
+ return stacked == other;
751
+ }
752
+ bitmask |= COMPARE_UNORDERED_FLAG2;
753
+ stack.set(object, other);
754
+ var result = _equalArrays_default(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
755
+ stack["delete"](object);
756
+ return result;
757
+ case symbolTag2:
758
+ if (symbolValueOf) {
759
+ return symbolValueOf.call(object) == symbolValueOf.call(other);
760
+ }
761
+ }
762
+ return false;
763
+ }
764
+ var _equalByTag_default = equalByTag;
765
+
766
+ // node_modules/lodash-es/_arrayPush.js
767
+ function arrayPush(array, values) {
768
+ var index = -1, length = values.length, offset = array.length;
769
+ while (++index < length) {
770
+ array[offset + index] = values[index];
771
+ }
772
+ return array;
773
+ }
774
+ var _arrayPush_default = arrayPush;
775
+
776
+ // node_modules/lodash-es/_baseGetAllKeys.js
777
+ function baseGetAllKeys(object, keysFunc, symbolsFunc) {
778
+ var result = keysFunc(object);
779
+ return isArray_default(object) ? result : _arrayPush_default(result, symbolsFunc(object));
780
+ }
781
+ var _baseGetAllKeys_default = baseGetAllKeys;
782
+
783
+ // node_modules/lodash-es/_arrayFilter.js
784
+ function arrayFilter(array, predicate) {
785
+ var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
786
+ while (++index < length) {
787
+ var value = array[index];
788
+ if (predicate(value, index, array)) {
789
+ result[resIndex++] = value;
790
+ }
791
+ }
792
+ return result;
793
+ }
794
+ var _arrayFilter_default = arrayFilter;
795
+
796
+ // node_modules/lodash-es/stubArray.js
797
+ function stubArray() {
798
+ return [];
799
+ }
800
+ var stubArray_default = stubArray;
801
+
802
+ // node_modules/lodash-es/_getSymbols.js
803
+ var objectProto6 = Object.prototype;
804
+ var propertyIsEnumerable = objectProto6.propertyIsEnumerable;
805
+ var nativeGetSymbols = Object.getOwnPropertySymbols;
806
+ var getSymbols = !nativeGetSymbols ? stubArray_default : function(object) {
807
+ if (object == null) {
808
+ return [];
809
+ }
810
+ object = Object(object);
811
+ return _arrayFilter_default(nativeGetSymbols(object), function(symbol) {
812
+ return propertyIsEnumerable.call(object, symbol);
813
+ });
814
+ };
815
+ var _getSymbols_default = getSymbols;
816
+
817
+ // node_modules/lodash-es/_baseTimes.js
818
+ function baseTimes(n, iteratee) {
819
+ var index = -1, result = Array(n);
820
+ while (++index < n) {
821
+ result[index] = iteratee(index);
822
+ }
823
+ return result;
824
+ }
825
+ var _baseTimes_default = baseTimes;
826
+
827
+ // node_modules/lodash-es/_baseIsArguments.js
828
+ var argsTag = "[object Arguments]";
829
+ function baseIsArguments(value) {
830
+ return isObjectLike_default(value) && _baseGetTag_default(value) == argsTag;
831
+ }
832
+ var _baseIsArguments_default = baseIsArguments;
833
+
834
+ // node_modules/lodash-es/isArguments.js
835
+ var objectProto7 = Object.prototype;
836
+ var hasOwnProperty5 = objectProto7.hasOwnProperty;
837
+ var propertyIsEnumerable2 = objectProto7.propertyIsEnumerable;
838
+ var isArguments = _baseIsArguments_default(function() {
839
+ return arguments;
840
+ }()) ? _baseIsArguments_default : function(value) {
841
+ return isObjectLike_default(value) && hasOwnProperty5.call(value, "callee") && !propertyIsEnumerable2.call(value, "callee");
842
+ };
843
+ var isArguments_default = isArguments;
844
+
845
+ // node_modules/lodash-es/isBuffer.js
846
+ var exports_isBuffer = {};
847
+ __export(exports_isBuffer, {
848
+ default: () => isBuffer_default
849
+ });
850
+
851
+ // node_modules/lodash-es/stubFalse.js
852
+ function stubFalse() {
853
+ return false;
854
+ }
855
+ var stubFalse_default = stubFalse;
856
+
857
+ // node_modules/lodash-es/isBuffer.js
858
+ var freeExports = typeof exports_isBuffer == "object" && exports_isBuffer && !exports_isBuffer.nodeType && exports_isBuffer;
859
+ var freeModule = freeExports && typeof module_isBuffer == "object" && module_isBuffer && !module_isBuffer.nodeType && module_isBuffer;
860
+ var moduleExports = freeModule && freeModule.exports === freeExports;
861
+ var Buffer2 = moduleExports ? _root_default.Buffer : undefined;
862
+ var nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : undefined;
863
+ var isBuffer = nativeIsBuffer || stubFalse_default;
864
+ var isBuffer_default = isBuffer;
865
+
866
+ // node_modules/lodash-es/_isIndex.js
867
+ var MAX_SAFE_INTEGER = 9007199254740991;
868
+ var reIsUint = /^(?:0|[1-9]\d*)$/;
869
+ function isIndex(value, length) {
870
+ var type = typeof value;
871
+ length = length == null ? MAX_SAFE_INTEGER : length;
872
+ return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
873
+ }
874
+ var _isIndex_default = isIndex;
875
+
876
+ // node_modules/lodash-es/isLength.js
877
+ var MAX_SAFE_INTEGER2 = 9007199254740991;
878
+ function isLength(value) {
879
+ return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER2;
880
+ }
881
+ var isLength_default = isLength;
882
+
883
+ // node_modules/lodash-es/_baseIsTypedArray.js
884
+ var argsTag2 = "[object Arguments]";
885
+ var arrayTag = "[object Array]";
886
+ var boolTag2 = "[object Boolean]";
887
+ var dateTag2 = "[object Date]";
888
+ var errorTag2 = "[object Error]";
889
+ var funcTag2 = "[object Function]";
890
+ var mapTag2 = "[object Map]";
891
+ var numberTag2 = "[object Number]";
892
+ var objectTag = "[object Object]";
893
+ var regexpTag2 = "[object RegExp]";
894
+ var setTag2 = "[object Set]";
895
+ var stringTag2 = "[object String]";
896
+ var weakMapTag = "[object WeakMap]";
897
+ var arrayBufferTag2 = "[object ArrayBuffer]";
898
+ var dataViewTag2 = "[object DataView]";
899
+ var float32Tag = "[object Float32Array]";
900
+ var float64Tag = "[object Float64Array]";
901
+ var int8Tag = "[object Int8Array]";
902
+ var int16Tag = "[object Int16Array]";
903
+ var int32Tag = "[object Int32Array]";
904
+ var uint8Tag = "[object Uint8Array]";
905
+ var uint8ClampedTag = "[object Uint8ClampedArray]";
906
+ var uint16Tag = "[object Uint16Array]";
907
+ var uint32Tag = "[object Uint32Array]";
908
+ var typedArrayTags = {};
909
+ typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
910
+ typedArrayTags[argsTag2] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag2] = typedArrayTags[boolTag2] = typedArrayTags[dataViewTag2] = typedArrayTags[dateTag2] = typedArrayTags[errorTag2] = typedArrayTags[funcTag2] = typedArrayTags[mapTag2] = typedArrayTags[numberTag2] = typedArrayTags[objectTag] = typedArrayTags[regexpTag2] = typedArrayTags[setTag2] = typedArrayTags[stringTag2] = typedArrayTags[weakMapTag] = false;
911
+ function baseIsTypedArray(value) {
912
+ return isObjectLike_default(value) && isLength_default(value.length) && !!typedArrayTags[_baseGetTag_default(value)];
913
+ }
914
+ var _baseIsTypedArray_default = baseIsTypedArray;
915
+
916
+ // node_modules/lodash-es/_baseUnary.js
917
+ function baseUnary(func) {
918
+ return function(value) {
919
+ return func(value);
920
+ };
921
+ }
922
+ var _baseUnary_default = baseUnary;
923
+
924
+ // node_modules/lodash-es/_nodeUtil.js
925
+ var exports__nodeUtil = {};
926
+ __export(exports__nodeUtil, {
927
+ default: () => _nodeUtil_default
928
+ });
929
+ var freeExports2 = typeof exports__nodeUtil == "object" && exports__nodeUtil && !exports__nodeUtil.nodeType && exports__nodeUtil;
930
+ var freeModule2 = freeExports2 && typeof module__nodeUtil == "object" && module__nodeUtil && !module__nodeUtil.nodeType && module__nodeUtil;
931
+ var moduleExports2 = freeModule2 && freeModule2.exports === freeExports2;
932
+ var freeProcess = moduleExports2 && _freeGlobal_default.process;
933
+ var nodeUtil = function() {
934
+ try {
935
+ var types = freeModule2 && freeModule2.require && freeModule2.require("util").types;
936
+ if (types) {
937
+ return types;
938
+ }
939
+ return freeProcess && freeProcess.binding && freeProcess.binding("util");
940
+ } catch (e) {}
941
+ }();
942
+ var _nodeUtil_default = nodeUtil;
943
+
944
+ // node_modules/lodash-es/isTypedArray.js
945
+ var nodeIsTypedArray = _nodeUtil_default && _nodeUtil_default.isTypedArray;
946
+ var isTypedArray = nodeIsTypedArray ? _baseUnary_default(nodeIsTypedArray) : _baseIsTypedArray_default;
947
+ var isTypedArray_default = isTypedArray;
948
+
949
+ // node_modules/lodash-es/_arrayLikeKeys.js
950
+ var objectProto8 = Object.prototype;
951
+ var hasOwnProperty6 = objectProto8.hasOwnProperty;
952
+ function arrayLikeKeys(value, inherited) {
953
+ var isArr = isArray_default(value), isArg = !isArr && isArguments_default(value), isBuff = !isArr && !isArg && isBuffer_default(value), isType = !isArr && !isArg && !isBuff && isTypedArray_default(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? _baseTimes_default(value.length, String) : [], length = result.length;
954
+ for (var key in value) {
955
+ if ((inherited || hasOwnProperty6.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || _isIndex_default(key, length)))) {
956
+ result.push(key);
957
+ }
958
+ }
959
+ return result;
960
+ }
961
+ var _arrayLikeKeys_default = arrayLikeKeys;
962
+
963
+ // node_modules/lodash-es/_isPrototype.js
964
+ var objectProto9 = Object.prototype;
965
+ function isPrototype(value) {
966
+ var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto9;
967
+ return value === proto;
968
+ }
969
+ var _isPrototype_default = isPrototype;
970
+
971
+ // node_modules/lodash-es/_overArg.js
972
+ function overArg(func, transform) {
973
+ return function(arg) {
974
+ return func(transform(arg));
975
+ };
976
+ }
977
+ var _overArg_default = overArg;
978
+
979
+ // node_modules/lodash-es/_nativeKeys.js
980
+ var nativeKeys = _overArg_default(Object.keys, Object);
981
+ var _nativeKeys_default = nativeKeys;
982
+
983
+ // node_modules/lodash-es/_baseKeys.js
984
+ var objectProto10 = Object.prototype;
985
+ var hasOwnProperty7 = objectProto10.hasOwnProperty;
986
+ function baseKeys(object) {
987
+ if (!_isPrototype_default(object)) {
988
+ return _nativeKeys_default(object);
989
+ }
990
+ var result = [];
991
+ for (var key in Object(object)) {
992
+ if (hasOwnProperty7.call(object, key) && key != "constructor") {
993
+ result.push(key);
994
+ }
995
+ }
996
+ return result;
997
+ }
998
+ var _baseKeys_default = baseKeys;
999
+
1000
+ // node_modules/lodash-es/isArrayLike.js
1001
+ function isArrayLike(value) {
1002
+ return value != null && isLength_default(value.length) && !isFunction_default(value);
1003
+ }
1004
+ var isArrayLike_default = isArrayLike;
1005
+
1006
+ // node_modules/lodash-es/keys.js
1007
+ function keys(object) {
1008
+ return isArrayLike_default(object) ? _arrayLikeKeys_default(object) : _baseKeys_default(object);
1009
+ }
1010
+ var keys_default = keys;
1011
+
1012
+ // node_modules/lodash-es/_getAllKeys.js
1013
+ function getAllKeys(object) {
1014
+ return _baseGetAllKeys_default(object, keys_default, _getSymbols_default);
1015
+ }
1016
+ var _getAllKeys_default = getAllKeys;
1017
+
1018
+ // node_modules/lodash-es/_equalObjects.js
1019
+ var COMPARE_PARTIAL_FLAG3 = 1;
1020
+ var objectProto11 = Object.prototype;
1021
+ var hasOwnProperty8 = objectProto11.hasOwnProperty;
1022
+ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
1023
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG3, objProps = _getAllKeys_default(object), objLength = objProps.length, othProps = _getAllKeys_default(other), othLength = othProps.length;
1024
+ if (objLength != othLength && !isPartial) {
1025
+ return false;
1026
+ }
1027
+ var index = objLength;
1028
+ while (index--) {
1029
+ var key = objProps[index];
1030
+ if (!(isPartial ? key in other : hasOwnProperty8.call(other, key))) {
1031
+ return false;
1032
+ }
1033
+ }
1034
+ var objStacked = stack.get(object);
1035
+ var othStacked = stack.get(other);
1036
+ if (objStacked && othStacked) {
1037
+ return objStacked == other && othStacked == object;
1038
+ }
1039
+ var result = true;
1040
+ stack.set(object, other);
1041
+ stack.set(other, object);
1042
+ var skipCtor = isPartial;
1043
+ while (++index < objLength) {
1044
+ key = objProps[index];
1045
+ var objValue = object[key], othValue = other[key];
1046
+ if (customizer) {
1047
+ var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
1048
+ }
1049
+ if (!(compared === undefined ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
1050
+ result = false;
1051
+ break;
1052
+ }
1053
+ skipCtor || (skipCtor = key == "constructor");
1054
+ }
1055
+ if (result && !skipCtor) {
1056
+ var objCtor = object.constructor, othCtor = other.constructor;
1057
+ if (objCtor != othCtor && (("constructor" in object) && ("constructor" in other)) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
1058
+ result = false;
1059
+ }
1060
+ }
1061
+ stack["delete"](object);
1062
+ stack["delete"](other);
1063
+ return result;
1064
+ }
1065
+ var _equalObjects_default = equalObjects;
1066
+
1067
+ // node_modules/lodash-es/_DataView.js
1068
+ var DataView = _getNative_default(_root_default, "DataView");
1069
+ var _DataView_default = DataView;
1070
+
1071
+ // node_modules/lodash-es/_Promise.js
1072
+ var Promise2 = _getNative_default(_root_default, "Promise");
1073
+ var _Promise_default = Promise2;
1074
+
1075
+ // node_modules/lodash-es/_Set.js
1076
+ var Set2 = _getNative_default(_root_default, "Set");
1077
+ var _Set_default = Set2;
1078
+
1079
+ // node_modules/lodash-es/_WeakMap.js
1080
+ var WeakMap2 = _getNative_default(_root_default, "WeakMap");
1081
+ var _WeakMap_default = WeakMap2;
1082
+
1083
+ // node_modules/lodash-es/_getTag.js
1084
+ var mapTag3 = "[object Map]";
1085
+ var objectTag2 = "[object Object]";
1086
+ var promiseTag = "[object Promise]";
1087
+ var setTag3 = "[object Set]";
1088
+ var weakMapTag2 = "[object WeakMap]";
1089
+ var dataViewTag3 = "[object DataView]";
1090
+ var dataViewCtorString = _toSource_default(_DataView_default);
1091
+ var mapCtorString = _toSource_default(_Map_default);
1092
+ var promiseCtorString = _toSource_default(_Promise_default);
1093
+ var setCtorString = _toSource_default(_Set_default);
1094
+ var weakMapCtorString = _toSource_default(_WeakMap_default);
1095
+ var getTag = _baseGetTag_default;
1096
+ if (_DataView_default && getTag(new _DataView_default(new ArrayBuffer(1))) != dataViewTag3 || _Map_default && getTag(new _Map_default) != mapTag3 || _Promise_default && getTag(_Promise_default.resolve()) != promiseTag || _Set_default && getTag(new _Set_default) != setTag3 || _WeakMap_default && getTag(new _WeakMap_default) != weakMapTag2) {
1097
+ getTag = function(value) {
1098
+ var result = _baseGetTag_default(value), Ctor = result == objectTag2 ? value.constructor : undefined, ctorString = Ctor ? _toSource_default(Ctor) : "";
1099
+ if (ctorString) {
1100
+ switch (ctorString) {
1101
+ case dataViewCtorString:
1102
+ return dataViewTag3;
1103
+ case mapCtorString:
1104
+ return mapTag3;
1105
+ case promiseCtorString:
1106
+ return promiseTag;
1107
+ case setCtorString:
1108
+ return setTag3;
1109
+ case weakMapCtorString:
1110
+ return weakMapTag2;
1111
+ }
1112
+ }
1113
+ return result;
1114
+ };
1115
+ }
1116
+ var _getTag_default = getTag;
1117
+
1118
+ // node_modules/lodash-es/_baseIsEqualDeep.js
1119
+ var COMPARE_PARTIAL_FLAG4 = 1;
1120
+ var argsTag3 = "[object Arguments]";
1121
+ var arrayTag2 = "[object Array]";
1122
+ var objectTag3 = "[object Object]";
1123
+ var objectProto12 = Object.prototype;
1124
+ var hasOwnProperty9 = objectProto12.hasOwnProperty;
1125
+ function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
1126
+ var objIsArr = isArray_default(object), othIsArr = isArray_default(other), objTag = objIsArr ? arrayTag2 : _getTag_default(object), othTag = othIsArr ? arrayTag2 : _getTag_default(other);
1127
+ objTag = objTag == argsTag3 ? objectTag3 : objTag;
1128
+ othTag = othTag == argsTag3 ? objectTag3 : othTag;
1129
+ var objIsObj = objTag == objectTag3, othIsObj = othTag == objectTag3, isSameTag = objTag == othTag;
1130
+ if (isSameTag && isBuffer_default(object)) {
1131
+ if (!isBuffer_default(other)) {
1132
+ return false;
1133
+ }
1134
+ objIsArr = true;
1135
+ objIsObj = false;
1136
+ }
1137
+ if (isSameTag && !objIsObj) {
1138
+ stack || (stack = new _Stack_default);
1139
+ return objIsArr || isTypedArray_default(object) ? _equalArrays_default(object, other, bitmask, customizer, equalFunc, stack) : _equalByTag_default(object, other, objTag, bitmask, customizer, equalFunc, stack);
1140
+ }
1141
+ if (!(bitmask & COMPARE_PARTIAL_FLAG4)) {
1142
+ var objIsWrapped = objIsObj && hasOwnProperty9.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty9.call(other, "__wrapped__");
1143
+ if (objIsWrapped || othIsWrapped) {
1144
+ var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
1145
+ stack || (stack = new _Stack_default);
1146
+ return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
1147
+ }
1148
+ }
1149
+ if (!isSameTag) {
1150
+ return false;
1151
+ }
1152
+ stack || (stack = new _Stack_default);
1153
+ return _equalObjects_default(object, other, bitmask, customizer, equalFunc, stack);
1154
+ }
1155
+ var _baseIsEqualDeep_default = baseIsEqualDeep;
1156
+
1157
+ // node_modules/lodash-es/_baseIsEqual.js
1158
+ function baseIsEqual(value, other, bitmask, customizer, stack) {
1159
+ if (value === other) {
1160
+ return true;
1161
+ }
1162
+ if (value == null || other == null || !isObjectLike_default(value) && !isObjectLike_default(other)) {
1163
+ return value !== value && other !== other;
1164
+ }
1165
+ return _baseIsEqualDeep_default(value, other, bitmask, customizer, baseIsEqual, stack);
1166
+ }
1167
+ var _baseIsEqual_default = baseIsEqual;
1168
+
1169
+ // node_modules/lodash-es/_baseIsMatch.js
1170
+ var COMPARE_PARTIAL_FLAG5 = 1;
1171
+ var COMPARE_UNORDERED_FLAG3 = 2;
1172
+ function baseIsMatch(object, source, matchData, customizer) {
1173
+ var index = matchData.length, length = index, noCustomizer = !customizer;
1174
+ if (object == null) {
1175
+ return !length;
1176
+ }
1177
+ object = Object(object);
1178
+ while (index--) {
1179
+ var data = matchData[index];
1180
+ if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
1181
+ return false;
1182
+ }
1183
+ }
1184
+ while (++index < length) {
1185
+ data = matchData[index];
1186
+ var key = data[0], objValue = object[key], srcValue = data[1];
1187
+ if (noCustomizer && data[2]) {
1188
+ if (objValue === undefined && !(key in object)) {
1189
+ return false;
1190
+ }
1191
+ } else {
1192
+ var stack = new _Stack_default;
1193
+ if (customizer) {
1194
+ var result = customizer(objValue, srcValue, key, object, source, stack);
1195
+ }
1196
+ if (!(result === undefined ? _baseIsEqual_default(srcValue, objValue, COMPARE_PARTIAL_FLAG5 | COMPARE_UNORDERED_FLAG3, customizer, stack) : result)) {
1197
+ return false;
1198
+ }
1199
+ }
1200
+ }
1201
+ return true;
1202
+ }
1203
+ var _baseIsMatch_default = baseIsMatch;
1204
+
1205
+ // node_modules/lodash-es/_isStrictComparable.js
1206
+ function isStrictComparable(value) {
1207
+ return value === value && !isObject_default(value);
1208
+ }
1209
+ var _isStrictComparable_default = isStrictComparable;
1210
+
1211
+ // node_modules/lodash-es/_getMatchData.js
1212
+ function getMatchData(object) {
1213
+ var result = keys_default(object), length = result.length;
1214
+ while (length--) {
1215
+ var key = result[length], value = object[key];
1216
+ result[length] = [key, value, _isStrictComparable_default(value)];
1217
+ }
1218
+ return result;
1219
+ }
1220
+ var _getMatchData_default = getMatchData;
1221
+
1222
+ // node_modules/lodash-es/_matchesStrictComparable.js
1223
+ function matchesStrictComparable(key, srcValue) {
1224
+ return function(object) {
1225
+ if (object == null) {
1226
+ return false;
1227
+ }
1228
+ return object[key] === srcValue && (srcValue !== undefined || (key in Object(object)));
1229
+ };
1230
+ }
1231
+ var _matchesStrictComparable_default = matchesStrictComparable;
1232
+
1233
+ // node_modules/lodash-es/_baseMatches.js
1234
+ function baseMatches(source) {
1235
+ var matchData = _getMatchData_default(source);
1236
+ if (matchData.length == 1 && matchData[0][2]) {
1237
+ return _matchesStrictComparable_default(matchData[0][0], matchData[0][1]);
1238
+ }
1239
+ return function(object) {
1240
+ return object === source || _baseIsMatch_default(object, source, matchData);
1241
+ };
1242
+ }
1243
+ var _baseMatches_default = baseMatches;
1244
+
1245
+ // node_modules/lodash-es/get.js
1246
+ function get(object, path, defaultValue) {
1247
+ var result = object == null ? undefined : _baseGet_default(object, path);
1248
+ return result === undefined ? defaultValue : result;
1249
+ }
1250
+ var get_default = get;
1251
+
1252
+ // node_modules/lodash-es/_baseHasIn.js
1253
+ function baseHasIn(object, key) {
1254
+ return object != null && key in Object(object);
1255
+ }
1256
+ var _baseHasIn_default = baseHasIn;
1257
+
1258
+ // node_modules/lodash-es/_hasPath.js
1259
+ function hasPath(object, path, hasFunc) {
1260
+ path = _castPath_default(path, object);
1261
+ var index = -1, length = path.length, result = false;
1262
+ while (++index < length) {
1263
+ var key = _toKey_default(path[index]);
1264
+ if (!(result = object != null && hasFunc(object, key))) {
1265
+ break;
1266
+ }
1267
+ object = object[key];
1268
+ }
1269
+ if (result || ++index != length) {
1270
+ return result;
1271
+ }
1272
+ length = object == null ? 0 : object.length;
1273
+ return !!length && isLength_default(length) && _isIndex_default(key, length) && (isArray_default(object) || isArguments_default(object));
1274
+ }
1275
+ var _hasPath_default = hasPath;
1276
+
1277
+ // node_modules/lodash-es/hasIn.js
1278
+ function hasIn(object, path) {
1279
+ return object != null && _hasPath_default(object, path, _baseHasIn_default);
1280
+ }
1281
+ var hasIn_default = hasIn;
1282
+
1283
+ // node_modules/lodash-es/_baseMatchesProperty.js
1284
+ var COMPARE_PARTIAL_FLAG6 = 1;
1285
+ var COMPARE_UNORDERED_FLAG4 = 2;
1286
+ function baseMatchesProperty(path, srcValue) {
1287
+ if (_isKey_default(path) && _isStrictComparable_default(srcValue)) {
1288
+ return _matchesStrictComparable_default(_toKey_default(path), srcValue);
1289
+ }
1290
+ return function(object) {
1291
+ var objValue = get_default(object, path);
1292
+ return objValue === undefined && objValue === srcValue ? hasIn_default(object, path) : _baseIsEqual_default(srcValue, objValue, COMPARE_PARTIAL_FLAG6 | COMPARE_UNORDERED_FLAG4);
1293
+ };
1294
+ }
1295
+ var _baseMatchesProperty_default = baseMatchesProperty;
1296
+
1297
+ // node_modules/lodash-es/identity.js
1298
+ function identity(value) {
1299
+ return value;
1300
+ }
1301
+ var identity_default = identity;
1302
+
1303
+ // node_modules/lodash-es/_baseProperty.js
1304
+ function baseProperty(key) {
1305
+ return function(object) {
1306
+ return object == null ? undefined : object[key];
1307
+ };
1308
+ }
1309
+ var _baseProperty_default = baseProperty;
1310
+
1311
+ // node_modules/lodash-es/_basePropertyDeep.js
1312
+ function basePropertyDeep(path) {
1313
+ return function(object) {
1314
+ return _baseGet_default(object, path);
1315
+ };
1316
+ }
1317
+ var _basePropertyDeep_default = basePropertyDeep;
1318
+
1319
+ // node_modules/lodash-es/property.js
1320
+ function property(path) {
1321
+ return _isKey_default(path) ? _baseProperty_default(_toKey_default(path)) : _basePropertyDeep_default(path);
1322
+ }
1323
+ var property_default = property;
1324
+
1325
+ // node_modules/lodash-es/_baseIteratee.js
1326
+ function baseIteratee(value) {
1327
+ if (typeof value == "function") {
1328
+ return value;
1329
+ }
1330
+ if (value == null) {
1331
+ return identity_default;
1332
+ }
1333
+ if (typeof value == "object") {
1334
+ return isArray_default(value) ? _baseMatchesProperty_default(value[0], value[1]) : _baseMatches_default(value);
1335
+ }
1336
+ return property_default(value);
1337
+ }
1338
+ var _baseIteratee_default = baseIteratee;
1339
+
1340
+ // node_modules/lodash-es/_createBaseFor.js
1341
+ function createBaseFor(fromRight) {
1342
+ return function(object, iteratee, keysFunc) {
1343
+ var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length;
1344
+ while (length--) {
1345
+ var key = props[fromRight ? length : ++index];
1346
+ if (iteratee(iterable[key], key, iterable) === false) {
1347
+ break;
1348
+ }
1349
+ }
1350
+ return object;
1351
+ };
1352
+ }
1353
+ var _createBaseFor_default = createBaseFor;
1354
+
1355
+ // node_modules/lodash-es/_baseFor.js
1356
+ var baseFor = _createBaseFor_default();
1357
+ var _baseFor_default = baseFor;
1358
+
1359
+ // node_modules/lodash-es/_baseForOwn.js
1360
+ function baseForOwn(object, iteratee) {
1361
+ return object && _baseFor_default(object, iteratee, keys_default);
1362
+ }
1363
+ var _baseForOwn_default = baseForOwn;
1364
+
1365
+ // node_modules/lodash-es/_createBaseEach.js
1366
+ function createBaseEach(eachFunc, fromRight) {
1367
+ return function(collection, iteratee) {
1368
+ if (collection == null) {
1369
+ return collection;
1370
+ }
1371
+ if (!isArrayLike_default(collection)) {
1372
+ return eachFunc(collection, iteratee);
1373
+ }
1374
+ var length = collection.length, index = fromRight ? length : -1, iterable = Object(collection);
1375
+ while (fromRight ? index-- : ++index < length) {
1376
+ if (iteratee(iterable[index], index, iterable) === false) {
1377
+ break;
1378
+ }
1379
+ }
1380
+ return collection;
1381
+ };
1382
+ }
1383
+ var _createBaseEach_default = createBaseEach;
1384
+
1385
+ // node_modules/lodash-es/_baseEach.js
1386
+ var baseEach = _createBaseEach_default(_baseForOwn_default);
1387
+ var _baseEach_default = baseEach;
1388
+
1389
+ // node_modules/lodash-es/_baseMap.js
1390
+ function baseMap(collection, iteratee) {
1391
+ var index = -1, result = isArrayLike_default(collection) ? Array(collection.length) : [];
1392
+ _baseEach_default(collection, function(value, key, collection) {
1393
+ result[++index] = iteratee(value, key, collection);
1394
+ });
1395
+ return result;
1396
+ }
1397
+ var _baseMap_default = baseMap;
1398
+
1399
+ // node_modules/lodash-es/_baseSortBy.js
1400
+ function baseSortBy(array, comparer) {
1401
+ var length = array.length;
1402
+ array.sort(comparer);
1403
+ while (length--) {
1404
+ array[length] = array[length].value;
1405
+ }
1406
+ return array;
1407
+ }
1408
+ var _baseSortBy_default = baseSortBy;
1409
+
1410
+ // node_modules/lodash-es/_compareAscending.js
1411
+ function compareAscending(value, other) {
1412
+ if (value !== other) {
1413
+ var valIsDefined = value !== undefined, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol_default(value);
1414
+ var othIsDefined = other !== undefined, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol_default(other);
1415
+ if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) {
1416
+ return 1;
1417
+ }
1418
+ if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) {
1419
+ return -1;
1420
+ }
1421
+ }
1422
+ return 0;
1423
+ }
1424
+ var _compareAscending_default = compareAscending;
1425
+
1426
+ // node_modules/lodash-es/_compareMultiple.js
1427
+ function compareMultiple(object, other, orders) {
1428
+ var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length;
1429
+ while (++index < length) {
1430
+ var result = _compareAscending_default(objCriteria[index], othCriteria[index]);
1431
+ if (result) {
1432
+ if (index >= ordersLength) {
1433
+ return result;
1434
+ }
1435
+ var order = orders[index];
1436
+ return result * (order == "desc" ? -1 : 1);
1437
+ }
1438
+ }
1439
+ return object.index - other.index;
1440
+ }
1441
+ var _compareMultiple_default = compareMultiple;
1442
+
1443
+ // node_modules/lodash-es/_baseOrderBy.js
1444
+ function baseOrderBy(collection, iteratees, orders) {
1445
+ if (iteratees.length) {
1446
+ iteratees = _arrayMap_default(iteratees, function(iteratee) {
1447
+ if (isArray_default(iteratee)) {
1448
+ return function(value) {
1449
+ return _baseGet_default(value, iteratee.length === 1 ? iteratee[0] : iteratee);
1450
+ };
1451
+ }
1452
+ return iteratee;
1453
+ });
1454
+ } else {
1455
+ iteratees = [identity_default];
1456
+ }
1457
+ var index = -1;
1458
+ iteratees = _arrayMap_default(iteratees, _baseUnary_default(_baseIteratee_default));
1459
+ var result = _baseMap_default(collection, function(value, key, collection) {
1460
+ var criteria = _arrayMap_default(iteratees, function(iteratee) {
1461
+ return iteratee(value);
9
1462
  });
1463
+ return { criteria, index: ++index, value };
1464
+ });
1465
+ return _baseSortBy_default(result, function(object, other) {
1466
+ return _compareMultiple_default(object, other, orders);
1467
+ });
1468
+ }
1469
+ var _baseOrderBy_default = baseOrderBy;
1470
+
1471
+ // node_modules/lodash-es/orderBy.js
1472
+ function orderBy(collection, iteratees, orders, guard) {
1473
+ if (collection == null) {
1474
+ return [];
1475
+ }
1476
+ if (!isArray_default(iteratees)) {
1477
+ iteratees = iteratees == null ? [] : [iteratees];
1478
+ }
1479
+ orders = guard ? undefined : orders;
1480
+ if (!isArray_default(orders)) {
1481
+ orders = orders == null ? [] : [orders];
1482
+ }
1483
+ return _baseOrderBy_default(collection, iteratees, orders);
1484
+ }
1485
+ var orderBy_default = orderBy;
1486
+ // node_modules/lodash-es/_baseFindIndex.js
1487
+ function baseFindIndex(array, predicate, fromIndex, fromRight) {
1488
+ var length = array.length, index = fromIndex + (fromRight ? 1 : -1);
1489
+ while (fromRight ? index-- : ++index < length) {
1490
+ if (predicate(array[index], index, array)) {
1491
+ return index;
1492
+ }
1493
+ }
1494
+ return -1;
1495
+ }
1496
+ var _baseFindIndex_default = baseFindIndex;
1497
+
1498
+ // node_modules/lodash-es/_baseIsNaN.js
1499
+ function baseIsNaN(value) {
1500
+ return value !== value;
1501
+ }
1502
+ var _baseIsNaN_default = baseIsNaN;
1503
+
1504
+ // node_modules/lodash-es/_strictIndexOf.js
1505
+ function strictIndexOf(array, value, fromIndex) {
1506
+ var index = fromIndex - 1, length = array.length;
1507
+ while (++index < length) {
1508
+ if (array[index] === value) {
1509
+ return index;
1510
+ }
1511
+ }
1512
+ return -1;
1513
+ }
1514
+ var _strictIndexOf_default = strictIndexOf;
1515
+
1516
+ // node_modules/lodash-es/_baseIndexOf.js
1517
+ function baseIndexOf(array, value, fromIndex) {
1518
+ return value === value ? _strictIndexOf_default(array, value, fromIndex) : _baseFindIndex_default(array, _baseIsNaN_default, fromIndex);
1519
+ }
1520
+ var _baseIndexOf_default = baseIndexOf;
1521
+
1522
+ // node_modules/lodash-es/_arrayIncludes.js
1523
+ function arrayIncludes(array, value) {
1524
+ var length = array == null ? 0 : array.length;
1525
+ return !!length && _baseIndexOf_default(array, value, 0) > -1;
1526
+ }
1527
+ var _arrayIncludes_default = arrayIncludes;
1528
+
1529
+ // node_modules/lodash-es/_arrayIncludesWith.js
1530
+ function arrayIncludesWith(array, value, comparator) {
1531
+ var index = -1, length = array == null ? 0 : array.length;
1532
+ while (++index < length) {
1533
+ if (comparator(value, array[index])) {
1534
+ return true;
1535
+ }
1536
+ }
1537
+ return false;
1538
+ }
1539
+ var _arrayIncludesWith_default = arrayIncludesWith;
1540
+
1541
+ // node_modules/lodash-es/noop.js
1542
+ function noop() {}
1543
+ var noop_default = noop;
1544
+
1545
+ // node_modules/lodash-es/_createSet.js
1546
+ var INFINITY3 = 1 / 0;
1547
+ var createSet = !(_Set_default && 1 / _setToArray_default(new _Set_default([, -0]))[1] == INFINITY3) ? noop_default : function(values) {
1548
+ return new _Set_default(values);
1549
+ };
1550
+ var _createSet_default = createSet;
1551
+
1552
+ // node_modules/lodash-es/_baseUniq.js
1553
+ var LARGE_ARRAY_SIZE2 = 200;
1554
+ function baseUniq(array, iteratee, comparator) {
1555
+ var index = -1, includes = _arrayIncludes_default, length = array.length, isCommon = true, result = [], seen = result;
1556
+ if (comparator) {
1557
+ isCommon = false;
1558
+ includes = _arrayIncludesWith_default;
1559
+ } else if (length >= LARGE_ARRAY_SIZE2) {
1560
+ var set = iteratee ? null : _createSet_default(array);
1561
+ if (set) {
1562
+ return _setToArray_default(set);
1563
+ }
1564
+ isCommon = false;
1565
+ includes = _cacheHas_default;
1566
+ seen = new _SetCache_default;
1567
+ } else {
1568
+ seen = iteratee ? [] : result;
1569
+ }
1570
+ outer:
1571
+ while (++index < length) {
1572
+ var value = array[index], computed = iteratee ? iteratee(value) : value;
1573
+ value = comparator || value !== 0 ? value : 0;
1574
+ if (isCommon && computed === computed) {
1575
+ var seenIndex = seen.length;
1576
+ while (seenIndex--) {
1577
+ if (seen[seenIndex] === computed) {
1578
+ continue outer;
1579
+ }
1580
+ }
1581
+ if (iteratee) {
1582
+ seen.push(computed);
1583
+ }
1584
+ result.push(value);
1585
+ } else if (!includes(seen, computed, comparator)) {
1586
+ if (seen !== result) {
1587
+ seen.push(computed);
1588
+ }
1589
+ result.push(value);
1590
+ }
1591
+ }
1592
+ return result;
1593
+ }
1594
+ var _baseUniq_default = baseUniq;
1595
+
1596
+ // node_modules/lodash-es/uniqBy.js
1597
+ function uniqBy(array, iteratee) {
1598
+ return array && array.length ? _baseUniq_default(array, _baseIteratee_default(iteratee, 2)) : [];
1599
+ }
1600
+ var uniqBy_default = uniqBy;
1601
+ // src/categories.ts
1602
+ var GENRE_CATEGORIES = {
1603
+ "science-fiction": { fr: "21229020031", com: "18580628011" },
1604
+ fantasy: { fr: "21229021031", com: "18580607011" },
1605
+ "science-fiction-fantasy": { fr: "21228885031", com: "18580606011" },
1606
+ "mystery-thriller-suspense": { fr: "21228876031", com: "18574597011" },
1607
+ thriller: { fr: "21228906031", com: "18574621011" },
1608
+ mystery: { fr: "21228905031", com: "18574606011" },
1609
+ "crime-fiction": { fr: "21228907031", com: "18574598011" },
1610
+ horror: { fr: "21229011031", com: "18574490011" },
1611
+ romance: { fr: "21228893031", com: "18580518011" },
1612
+ "historical-fiction": { fr: "21229010031", com: "18574482011" },
1613
+ "literary-fiction": { fr: "21228884031", com: "18574426011" },
1614
+ biography: { fr: "21228881031", com: "18571951011" },
1615
+ history: { fr: "21228890031", com: "18573518011" },
1616
+ business: { fr: "21228882031", com: "18572029011" },
1617
+ "self-help": { fr: "21228892031", com: "18574784011" },
1618
+ science: { fr: "21228897031", com: "18580540011" },
1619
+ children: { fr: "21228877031", com: "18572091011" },
1620
+ "young-adult": { fr: "21228895031", com: "18580715011" },
1621
+ comedy: { fr: "34003928031", com: "24427740011" },
1622
+ erotica: { fr: "21228894031", com: "18573351011" },
1623
+ religion: { fr: "21228880031", com: "18574839011" },
1624
+ sports: { fr: "21228879031", com: "18580648011" },
1625
+ travel: { fr: "21228891031", com: "18581095011" },
1626
+ lgbtq: { fr: "21228883031", com: "18573743011" },
1627
+ "science-fiction/adventure": { fr: "21229681031", com: "18580629011" },
1628
+ "science-fiction/adaptations": { fr: "21229683031", com: "18580642011" },
1629
+ "science-fiction/cyberpunk": { fr: "21229684031", com: "18580633011" },
1630
+ "science-fiction/dystopian": { fr: "21229685031", com: "18580635011" },
1631
+ "science-fiction/first-contact": { fr: "21229682031", com: "18580636011" },
1632
+ "science-fiction/galactic-empire": { fr: "21229693031" },
1633
+ "science-fiction/genetic-engineering": { fr: "21229686031", com: "18580638011" },
1634
+ "science-fiction/military": { fr: "21229688031", com: "18580641011" },
1635
+ "science-fiction/post-apocalyptic": { fr: "21229687031", com: "18580643011" },
1636
+ "science-fiction/space-exploration": { fr: "21229689031", com: "18580644011" },
1637
+ "science-fiction/space-opera": { fr: "21229694031", com: "18580645011" },
1638
+ "fantasy/action-adventure": { fr: "21229712031", com: "18580608011" },
1639
+ "fantasy/adaptations": { fr: "21229708031", com: "18580621011" },
1640
+ "fantasy/dragons": { fr: "21229709031", com: "18580613011" },
1641
+ "fantasy/epic": { fr: "21229701031", com: "18580615011" },
1642
+ "fantasy/historical": { fr: "21229700031", com: "18580618011" },
1643
+ "fantasy/sword-sorcery": { fr: "21229713031", com: "18580627011" },
1644
+ "fantasy/urban-paranormal": { fr: "21229711031", com: "18580622011" },
1645
+ "thriller/suspense": { fr: "21229158031", com: "18574639011" },
1646
+ "thriller/psychological": { fr: "21229165031", com: "18574631011" },
1647
+ "thriller/domestic": { fr: "21229163031", com: "18574624011" },
1648
+ "thriller/historical": { fr: "21229168031", com: "18574627011" },
1649
+ "mystery/amateur-sleuth": { fr: "21229145031", com: "18574607011" },
1650
+ "mystery/cozy": { fr: "21229150031", com: "18574609011" },
1651
+ "mystery/detective": { fr: "21229148031", com: "18574618011" },
1652
+ "mystery/hard-boiled": { fr: "21229153031", com: "18574614011" },
1653
+ "mystery/historical": { fr: "21229155031", com: "18574615011" },
1654
+ "mystery/noir": { fr: "21229177031", com: "18574602011" },
1655
+ "mystery/police-procedural": { fr: "21229144031", com: "18574617011" },
1656
+ "mystery/private-investigator": { fr: "21229148031", com: "18574618011" },
1657
+ "mystery/traditional": { fr: "21229152031", com: "18574619011" },
1658
+ "romance/action-adventure": { fr: "21229096031", com: "18580519011" },
1659
+ "romance/comedy": { fr: "21229087031", com: "18580535011" },
1660
+ "romance/contemporary": { fr: "21230152031", com: "18580522011" },
1661
+ "romance/fantasy": { fr: "21229095031", com: "18580523011" },
1662
+ "romance/historical": { fr: "21229093031", com: "18580524011" },
1663
+ "romance/paranormal": { fr: "21229088031", com: "18580534011" },
1664
+ "romance/science-fiction": { fr: "21229085031", com: "18580537011" },
1665
+ "romance/sports": { fr: "21229086031", com: "18580538011" },
1666
+ "romance/suspense": { fr: "21229090031", com: "18580536011" },
1667
+ "literary-fiction/action-adventure": { fr: "21229016031", com: "18574427011" },
1668
+ "literary-fiction/classics": { fr: "21229007031", com: "18574449011" },
1669
+ "literary-fiction/coming-of-age": { fr: "21229655031", com: "18574461011" },
1670
+ "literary-fiction/contemporary": { fr: "21229657031", com: "18574462011" },
1671
+ "literary-fiction/drama": { fr: "21229017031", com: "18574450011" },
1672
+ "literary-fiction/family-life": { fr: "21229670031", com: "18574465011" },
1673
+ "literary-fiction/fiction": { fr: "21229019031", com: "18574456011" },
1674
+ "literary-fiction/historical": { fr: "21229010031", com: "18574482011" },
1675
+ "literary-fiction/sagas": { fr: "21229654031", com: "18574476011" },
1676
+ "literary-fiction/sea-adventures": { fr: "21229673031", com: "18574434011" },
1677
+ "literary-fiction/world-literature": { fr: "21229018031", com: "18574521011" },
1678
+ "biography/entertainment": { fr: "21228985031", com: "18571984011" },
1679
+ "history/europe": { fr: "21229067031", com: "18573582011" },
1680
+ "children/action-adventure": { fr: "21228913031", com: "18572092011" },
1681
+ "children/mystery": { fr: "21228927031", com: "18572548011" },
1682
+ "children/science-fiction-fantasy": { fr: "21228926031", com: "18572586011" },
1683
+ "children/fantasy": { fr: "21229338031", com: "18572587011" },
1684
+ "children/science-fiction": { fr: "21229339031", com: "18572593011" },
1685
+ "young-adult/literary-fiction": { fr: "21229110031", com: "18580894011" },
1686
+ "young-adult/romance": { fr: "21229117031", com: "18581004011" },
1687
+ "young-adult/science-fiction-fantasy": { fr: "21229103031", com: "18581048011" },
1688
+ "young-adult/fantasy": { fr: "21230013031", com: "18581049011" },
1689
+ "young-adult/science-fiction": { fr: "21230014031", com: "18581062011" },
1690
+ "young-adult/thriller": { fr: "21229114031", com: "18580961011" }
1691
+ };
1692
+ var resolveGenreId = (genre, locale) => {
1693
+ const id = GENRE_CATEGORIES[genre]?.[locale];
1694
+ if (!id) {
1695
+ throw new Error(`Genre "${genre}" is not mapped for locale "${locale}". Use categoryId directly or contribute the mapping.`);
1696
+ }
1697
+ return id;
10
1698
  };
11
1699
 
12
1700
  // src/client.ts
@@ -27,16 +1715,16 @@ var AUDIBLE_LOCALES = {
27
1715
  };
28
1716
 
29
1717
  // src/utils.ts
30
- import { Buffer as Buffer2 } from "node:buffer";
1718
+ import { Buffer as Buffer3 } from "node:buffer";
31
1719
  var base64url = (buffer) => buffer.toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
32
1720
  var base64nopad = (buffer) => buffer.toString("base64").replace(/=+$/, "");
33
- var toHexString = (input) => Buffer2.from(input, "utf-8").toString("hex");
1721
+ var toHexString = (input) => Buffer3.from(input, "utf-8").toString("hex");
34
1722
 
35
1723
  // src/client.ts
36
1724
  var DEVICE_TYPE = "A2CZJZGLK2JJVM";
37
1725
  var APP_VERSION = "3.56.2";
38
1726
  var SOFTWARE_VERSION = "35602678";
39
- var generateLoginUrl = async (locale) => {
1727
+ var login = async (locale) => {
40
1728
  const config = AUDIBLE_LOCALES[locale];
41
1729
  const codeVerifier = base64url(randomBytes(32));
42
1730
  const codeChallenge = base64url(createHash("sha256").update(codeVerifier).digest());
@@ -92,7 +1780,7 @@ var generateLoginUrl = async (locale) => {
92
1780
  ];
93
1781
  return { loginUrl, session, cookies };
94
1782
  };
95
- var registerDevice = async (authorizationCode, session) => {
1783
+ var register = async (authorizationCode, session) => {
96
1784
  const config = AUDIBLE_LOCALES[session.locale];
97
1785
  const clientId = toHexString(`${session.serial}#${DEVICE_TYPE}`);
98
1786
  const body = {
@@ -139,7 +1827,7 @@ var registerDevice = async (authorizationCode, session) => {
139
1827
  expiresAt: new Date(Date.now() + Number(bearer.expires_in) * 1000)
140
1828
  };
141
1829
  };
142
- var refreshAccessToken = async (credentials) => {
1830
+ var refresh = async (credentials) => {
143
1831
  const config = AUDIBLE_LOCALES[credentials.locale];
144
1832
  const response = await fetch(`https://api.amazon.${config.domain}/auth/token`, {
145
1833
  method: "POST",
@@ -162,149 +1850,38 @@ var refreshAccessToken = async (credentials) => {
162
1850
  expiresAt: new Date(Date.now() + data.expires_in * 1000)
163
1851
  };
164
1852
  };
165
- // node_modules/zod/v3/external.js
166
- var exports_external = {};
167
- __export(exports_external, {
168
- void: () => voidType,
169
- util: () => util,
170
- unknown: () => unknownType,
171
- union: () => unionType,
172
- undefined: () => undefinedType,
173
- tuple: () => tupleType,
174
- transformer: () => effectsType,
175
- symbol: () => symbolType,
176
- string: () => stringType,
177
- strictObject: () => strictObjectType,
178
- setErrorMap: () => setErrorMap,
179
- set: () => setType,
180
- record: () => recordType,
181
- quotelessJson: () => quotelessJson,
182
- promise: () => promiseType,
183
- preprocess: () => preprocessType,
184
- pipeline: () => pipelineType,
185
- ostring: () => ostring,
186
- optional: () => optionalType,
187
- onumber: () => onumber,
188
- oboolean: () => oboolean,
189
- objectUtil: () => objectUtil,
190
- object: () => objectType,
191
- number: () => numberType,
192
- nullable: () => nullableType,
193
- null: () => nullType,
194
- never: () => neverType,
195
- nativeEnum: () => nativeEnumType,
196
- nan: () => nanType,
197
- map: () => mapType,
198
- makeIssue: () => makeIssue,
199
- literal: () => literalType,
200
- lazy: () => lazyType,
201
- late: () => late,
202
- isValid: () => isValid,
203
- isDirty: () => isDirty,
204
- isAsync: () => isAsync,
205
- isAborted: () => isAborted,
206
- intersection: () => intersectionType,
207
- instanceof: () => instanceOfType,
208
- getParsedType: () => getParsedType,
209
- getErrorMap: () => getErrorMap,
210
- function: () => functionType,
211
- enum: () => enumType,
212
- effect: () => effectsType,
213
- discriminatedUnion: () => discriminatedUnionType,
214
- defaultErrorMap: () => en_default,
215
- datetimeRegex: () => datetimeRegex,
216
- date: () => dateType,
217
- custom: () => custom,
218
- coerce: () => coerce,
219
- boolean: () => booleanType,
220
- bigint: () => bigIntType,
221
- array: () => arrayType,
222
- any: () => anyType,
223
- addIssueToContext: () => addIssueToContext,
224
- ZodVoid: () => ZodVoid,
225
- ZodUnknown: () => ZodUnknown,
226
- ZodUnion: () => ZodUnion,
227
- ZodUndefined: () => ZodUndefined,
228
- ZodType: () => ZodType,
229
- ZodTuple: () => ZodTuple,
230
- ZodTransformer: () => ZodEffects,
231
- ZodSymbol: () => ZodSymbol,
232
- ZodString: () => ZodString,
233
- ZodSet: () => ZodSet,
234
- ZodSchema: () => ZodType,
235
- ZodRecord: () => ZodRecord,
236
- ZodReadonly: () => ZodReadonly,
237
- ZodPromise: () => ZodPromise,
238
- ZodPipeline: () => ZodPipeline,
239
- ZodParsedType: () => ZodParsedType,
240
- ZodOptional: () => ZodOptional,
241
- ZodObject: () => ZodObject,
242
- ZodNumber: () => ZodNumber,
243
- ZodNullable: () => ZodNullable,
244
- ZodNull: () => ZodNull,
245
- ZodNever: () => ZodNever,
246
- ZodNativeEnum: () => ZodNativeEnum,
247
- ZodNaN: () => ZodNaN,
248
- ZodMap: () => ZodMap,
249
- ZodLiteral: () => ZodLiteral,
250
- ZodLazy: () => ZodLazy,
251
- ZodIssueCode: () => ZodIssueCode,
252
- ZodIntersection: () => ZodIntersection,
253
- ZodFunction: () => ZodFunction,
254
- ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
255
- ZodError: () => ZodError,
256
- ZodEnum: () => ZodEnum,
257
- ZodEffects: () => ZodEffects,
258
- ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
259
- ZodDefault: () => ZodDefault,
260
- ZodDate: () => ZodDate,
261
- ZodCatch: () => ZodCatch,
262
- ZodBranded: () => ZodBranded,
263
- ZodBoolean: () => ZodBoolean,
264
- ZodBigInt: () => ZodBigInt,
265
- ZodArray: () => ZodArray,
266
- ZodAny: () => ZodAny,
267
- Schema: () => ZodType,
268
- ParseStatus: () => ParseStatus,
269
- OK: () => OK,
270
- NEVER: () => NEVER,
271
- INVALID: () => INVALID,
272
- EMPTY_PATH: () => EMPTY_PATH,
273
- DIRTY: () => DIRTY,
274
- BRAND: () => BRAND
275
- });
276
1853
 
277
1854
  // node_modules/zod/v3/helpers/util.js
278
1855
  var util;
279
- (function(util2) {
280
- util2.assertEqual = (_) => {};
1856
+ (function(util) {
1857
+ util.assertEqual = (_) => {};
281
1858
  function assertIs(_arg) {}
282
- util2.assertIs = assertIs;
1859
+ util.assertIs = assertIs;
283
1860
  function assertNever(_x) {
284
1861
  throw new Error;
285
1862
  }
286
- util2.assertNever = assertNever;
287
- util2.arrayToEnum = (items) => {
1863
+ util.assertNever = assertNever;
1864
+ util.arrayToEnum = (items) => {
288
1865
  const obj = {};
289
1866
  for (const item of items) {
290
1867
  obj[item] = item;
291
1868
  }
292
1869
  return obj;
293
1870
  };
294
- util2.getValidEnumValues = (obj) => {
295
- const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
1871
+ util.getValidEnumValues = (obj) => {
1872
+ const validKeys = util.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
296
1873
  const filtered = {};
297
1874
  for (const k of validKeys) {
298
1875
  filtered[k] = obj[k];
299
1876
  }
300
- return util2.objectValues(filtered);
1877
+ return util.objectValues(filtered);
301
1878
  };
302
- util2.objectValues = (obj) => {
303
- return util2.objectKeys(obj).map(function(e) {
1879
+ util.objectValues = (obj) => {
1880
+ return util.objectKeys(obj).map(function(e) {
304
1881
  return obj[e];
305
1882
  });
306
1883
  };
307
- util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object) => {
1884
+ util.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object) => {
308
1885
  const keys = [];
309
1886
  for (const key in object) {
310
1887
  if (Object.prototype.hasOwnProperty.call(object, key)) {
@@ -313,19 +1890,19 @@ var util;
313
1890
  }
314
1891
  return keys;
315
1892
  };
316
- util2.find = (arr, checker) => {
1893
+ util.find = (arr, checker) => {
317
1894
  for (const item of arr) {
318
1895
  if (checker(item))
319
1896
  return item;
320
1897
  }
321
1898
  return;
322
1899
  };
323
- util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
1900
+ util.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
324
1901
  function joinValues(array, separator = " | ") {
325
1902
  return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
326
1903
  }
327
- util2.joinValues = joinValues;
328
- util2.jsonStringifyReplacer = (_, value) => {
1904
+ util.joinValues = joinValues;
1905
+ util.jsonStringifyReplacer = (_, value) => {
329
1906
  if (typeof value === "bigint") {
330
1907
  return value.toString();
331
1908
  }
@@ -333,8 +1910,8 @@ var util;
333
1910
  };
334
1911
  })(util || (util = {}));
335
1912
  var objectUtil;
336
- (function(objectUtil2) {
337
- objectUtil2.mergeShapes = (first, second) => {
1913
+ (function(objectUtil) {
1914
+ objectUtil.mergeShapes = (first, second) => {
338
1915
  return {
339
1916
  ...first,
340
1917
  ...second
@@ -424,11 +2001,6 @@ var ZodIssueCode = util.arrayToEnum([
424
2001
  "not_multiple_of",
425
2002
  "not_finite"
426
2003
  ]);
427
- var quotelessJson = (obj) => {
428
- const json = JSON.stringify(obj, null, 2);
429
- return json.replace(/"([^"]+)":/g, "$1:");
430
- };
431
-
432
2004
  class ZodError extends Error {
433
2005
  get errors() {
434
2006
  return this.issues;
@@ -629,12 +2201,10 @@ var en_default = errorMap;
629
2201
 
630
2202
  // node_modules/zod/v3/errors.js
631
2203
  var overrideErrorMap = en_default;
632
- function setErrorMap(map) {
633
- overrideErrorMap = map;
634
- }
635
2204
  function getErrorMap() {
636
2205
  return overrideErrorMap;
637
2206
  }
2207
+
638
2208
  // node_modules/zod/v3/helpers/parseUtil.js
639
2209
  var makeIssue = (params) => {
640
2210
  const { data, path, errorMaps, issueData } = params;
@@ -661,7 +2231,6 @@ var makeIssue = (params) => {
661
2231
  message: errorMessage
662
2232
  };
663
2233
  };
664
- var EMPTY_PATH = [];
665
2234
  function addIssueToContext(ctx, issueData) {
666
2235
  const overrideMap = getErrorMap();
667
2236
  const issue = makeIssue({
@@ -741,11 +2310,12 @@ var isAborted = (x) => x.status === "aborted";
741
2310
  var isDirty = (x) => x.status === "dirty";
742
2311
  var isValid = (x) => x.status === "valid";
743
2312
  var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
2313
+
744
2314
  // node_modules/zod/v3/helpers/errorUtil.js
745
2315
  var errorUtil;
746
- (function(errorUtil2) {
747
- errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
748
- errorUtil2.toString = (message) => typeof message === "string" ? message : message?.message;
2316
+ (function(errorUtil) {
2317
+ errorUtil.errToObj = (message) => typeof message === "string" ? { message } : message || {};
2318
+ errorUtil.toString = (message) => typeof message === "string" ? message : message?.message;
749
2319
  })(errorUtil || (errorUtil = {}));
750
2320
 
751
2321
  // node_modules/zod/v3/types.js
@@ -790,12 +2360,12 @@ var handleResult = (ctx, result) => {
790
2360
  function processCreateParams(params) {
791
2361
  if (!params)
792
2362
  return {};
793
- const { errorMap: errorMap2, invalid_type_error, required_error, description } = params;
794
- if (errorMap2 && (invalid_type_error || required_error)) {
2363
+ const { errorMap, invalid_type_error, required_error, description } = params;
2364
+ if (errorMap && (invalid_type_error || required_error)) {
795
2365
  throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
796
2366
  }
797
- if (errorMap2)
798
- return { errorMap: errorMap2, description };
2367
+ if (errorMap)
2368
+ return { errorMap, description };
799
2369
  const customMap = (iss, ctx) => {
800
2370
  const { message } = params;
801
2371
  if (iss.code === "invalid_enum_value") {
@@ -1182,11 +2752,11 @@ class ZodString extends ZodType {
1182
2752
  }
1183
2753
  const parsedType = this._getType(input);
1184
2754
  if (parsedType !== ZodParsedType.string) {
1185
- const ctx2 = this._getOrReturnCtx(input);
1186
- addIssueToContext(ctx2, {
2755
+ const ctx = this._getOrReturnCtx(input);
2756
+ addIssueToContext(ctx, {
1187
2757
  code: ZodIssueCode.invalid_type,
1188
2758
  expected: ZodParsedType.string,
1189
- received: ctx2.parsedType
2759
+ received: ctx.parsedType
1190
2760
  });
1191
2761
  return INVALID;
1192
2762
  }
@@ -1740,11 +3310,11 @@ class ZodNumber extends ZodType {
1740
3310
  }
1741
3311
  const parsedType = this._getType(input);
1742
3312
  if (parsedType !== ZodParsedType.number) {
1743
- const ctx2 = this._getOrReturnCtx(input);
1744
- addIssueToContext(ctx2, {
3313
+ const ctx = this._getOrReturnCtx(input);
3314
+ addIssueToContext(ctx, {
1745
3315
  code: ZodIssueCode.invalid_type,
1746
3316
  expected: ZodParsedType.number,
1747
- received: ctx2.parsedType
3317
+ received: ctx.parsedType
1748
3318
  });
1749
3319
  return INVALID;
1750
3320
  }
@@ -2166,17 +3736,17 @@ class ZodDate extends ZodType {
2166
3736
  }
2167
3737
  const parsedType = this._getType(input);
2168
3738
  if (parsedType !== ZodParsedType.date) {
2169
- const ctx2 = this._getOrReturnCtx(input);
2170
- addIssueToContext(ctx2, {
3739
+ const ctx = this._getOrReturnCtx(input);
3740
+ addIssueToContext(ctx, {
2171
3741
  code: ZodIssueCode.invalid_type,
2172
3742
  expected: ZodParsedType.date,
2173
- received: ctx2.parsedType
3743
+ received: ctx.parsedType
2174
3744
  });
2175
3745
  return INVALID;
2176
3746
  }
2177
3747
  if (Number.isNaN(input.data.getTime())) {
2178
- const ctx2 = this._getOrReturnCtx(input);
2179
- addIssueToContext(ctx2, {
3748
+ const ctx = this._getOrReturnCtx(input);
3749
+ addIssueToContext(ctx, {
2180
3750
  code: ZodIssueCode.invalid_date
2181
3751
  });
2182
3752
  return INVALID;
@@ -2464,8 +4034,8 @@ class ZodArray extends ZodType {
2464
4034
  if (ctx.common.async) {
2465
4035
  return Promise.all([...ctx.data].map((item, i) => {
2466
4036
  return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
2467
- })).then((result2) => {
2468
- return ParseStatus.mergeArray(status, result2);
4037
+ })).then((result) => {
4038
+ return ParseStatus.mergeArray(status, result);
2469
4039
  });
2470
4040
  }
2471
4041
  const result = [...ctx.data].map((item, i) => {
@@ -2553,11 +4123,11 @@ class ZodObject extends ZodType {
2553
4123
  _parse(input) {
2554
4124
  const parsedType = this._getType(input);
2555
4125
  if (parsedType !== ZodParsedType.object) {
2556
- const ctx2 = this._getOrReturnCtx(input);
2557
- addIssueToContext(ctx2, {
4126
+ const ctx = this._getOrReturnCtx(input);
4127
+ addIssueToContext(ctx, {
2558
4128
  code: ZodIssueCode.invalid_type,
2559
4129
  expected: ZodParsedType.object,
2560
- received: ctx2.parsedType
4130
+ received: ctx.parsedType
2561
4131
  });
2562
4132
  return INVALID;
2563
4133
  }
@@ -2861,7 +4431,7 @@ class ZodUnion extends ZodType {
2861
4431
  ctx.common.issues.push(...dirty.ctx.common.issues);
2862
4432
  return dirty.result;
2863
4433
  }
2864
- const unionErrors = issues.map((issues2) => new ZodError(issues2));
4434
+ const unionErrors = issues.map((issues) => new ZodError(issues));
2865
4435
  addIssueToContext(ctx, {
2866
4436
  code: ZodIssueCode.invalid_union,
2867
4437
  unionErrors
@@ -3301,9 +4871,9 @@ class ZodSet extends ZodType {
3301
4871
  }
3302
4872
  }
3303
4873
  const valueType = this._def.valueType;
3304
- function finalizeSet(elements2) {
4874
+ function finalizeSet(elements) {
3305
4875
  const parsedSet = new Set;
3306
- for (const element of elements2) {
4876
+ for (const element of elements) {
3307
4877
  if (element.status === "aborted")
3308
4878
  return INVALID;
3309
4879
  if (element.status === "dirty")
@@ -3314,7 +4884,7 @@ class ZodSet extends ZodType {
3314
4884
  }
3315
4885
  const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));
3316
4886
  if (ctx.common.async) {
3317
- return Promise.all(elements).then((elements2) => finalizeSet(elements2));
4887
+ return Promise.all(elements).then((elements) => finalizeSet(elements));
3318
4888
  } else {
3319
4889
  return finalizeSet(elements);
3320
4890
  }
@@ -3667,11 +5237,11 @@ class ZodEffects extends ZodType {
3667
5237
  if (effect.type === "preprocess") {
3668
5238
  const processed = effect.transform(ctx.data, checkCtx);
3669
5239
  if (ctx.common.async) {
3670
- return Promise.resolve(processed).then(async (processed2) => {
5240
+ return Promise.resolve(processed).then(async (processed) => {
3671
5241
  if (status.value === "aborted")
3672
5242
  return INVALID;
3673
5243
  const result = await this._def.schema._parseAsync({
3674
- data: processed2,
5244
+ data: processed,
3675
5245
  path: ctx.path,
3676
5246
  parent: ctx
3677
5247
  });
@@ -3863,10 +5433,10 @@ class ZodCatch extends ZodType {
3863
5433
  }
3864
5434
  });
3865
5435
  if (isAsync(result)) {
3866
- return result.then((result2) => {
5436
+ return result.then((result) => {
3867
5437
  return {
3868
5438
  status: "valid",
3869
- value: result2.status === "valid" ? result2.value : this._def.catchValue({
5439
+ value: result.status === "valid" ? result.value : this._def.catchValue({
3870
5440
  get error() {
3871
5441
  return new ZodError(newCtx.common.issues);
3872
5442
  },
@@ -4015,78 +5585,48 @@ ZodReadonly.create = (type, params) => {
4015
5585
  ...processCreateParams(params)
4016
5586
  });
4017
5587
  };
4018
- function cleanParams(params, data) {
4019
- const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
4020
- const p2 = typeof p === "string" ? { message: p } : p;
4021
- return p2;
4022
- }
4023
- function custom(check, _params = {}, fatal) {
4024
- if (check)
4025
- return ZodAny.create().superRefine((data, ctx) => {
4026
- const r = check(data);
4027
- if (r instanceof Promise) {
4028
- return r.then((r2) => {
4029
- if (!r2) {
4030
- const params = cleanParams(_params, data);
4031
- const _fatal = params.fatal ?? fatal ?? true;
4032
- ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
4033
- }
4034
- });
4035
- }
4036
- if (!r) {
4037
- const params = cleanParams(_params, data);
4038
- const _fatal = params.fatal ?? fatal ?? true;
4039
- ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
4040
- }
4041
- return;
4042
- });
4043
- return ZodAny.create();
4044
- }
4045
5588
  var late = {
4046
5589
  object: ZodObject.lazycreate
4047
5590
  };
4048
5591
  var ZodFirstPartyTypeKind;
4049
- (function(ZodFirstPartyTypeKind2) {
4050
- ZodFirstPartyTypeKind2["ZodString"] = "ZodString";
4051
- ZodFirstPartyTypeKind2["ZodNumber"] = "ZodNumber";
4052
- ZodFirstPartyTypeKind2["ZodNaN"] = "ZodNaN";
4053
- ZodFirstPartyTypeKind2["ZodBigInt"] = "ZodBigInt";
4054
- ZodFirstPartyTypeKind2["ZodBoolean"] = "ZodBoolean";
4055
- ZodFirstPartyTypeKind2["ZodDate"] = "ZodDate";
4056
- ZodFirstPartyTypeKind2["ZodSymbol"] = "ZodSymbol";
4057
- ZodFirstPartyTypeKind2["ZodUndefined"] = "ZodUndefined";
4058
- ZodFirstPartyTypeKind2["ZodNull"] = "ZodNull";
4059
- ZodFirstPartyTypeKind2["ZodAny"] = "ZodAny";
4060
- ZodFirstPartyTypeKind2["ZodUnknown"] = "ZodUnknown";
4061
- ZodFirstPartyTypeKind2["ZodNever"] = "ZodNever";
4062
- ZodFirstPartyTypeKind2["ZodVoid"] = "ZodVoid";
4063
- ZodFirstPartyTypeKind2["ZodArray"] = "ZodArray";
4064
- ZodFirstPartyTypeKind2["ZodObject"] = "ZodObject";
4065
- ZodFirstPartyTypeKind2["ZodUnion"] = "ZodUnion";
4066
- ZodFirstPartyTypeKind2["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion";
4067
- ZodFirstPartyTypeKind2["ZodIntersection"] = "ZodIntersection";
4068
- ZodFirstPartyTypeKind2["ZodTuple"] = "ZodTuple";
4069
- ZodFirstPartyTypeKind2["ZodRecord"] = "ZodRecord";
4070
- ZodFirstPartyTypeKind2["ZodMap"] = "ZodMap";
4071
- ZodFirstPartyTypeKind2["ZodSet"] = "ZodSet";
4072
- ZodFirstPartyTypeKind2["ZodFunction"] = "ZodFunction";
4073
- ZodFirstPartyTypeKind2["ZodLazy"] = "ZodLazy";
4074
- ZodFirstPartyTypeKind2["ZodLiteral"] = "ZodLiteral";
4075
- ZodFirstPartyTypeKind2["ZodEnum"] = "ZodEnum";
4076
- ZodFirstPartyTypeKind2["ZodEffects"] = "ZodEffects";
4077
- ZodFirstPartyTypeKind2["ZodNativeEnum"] = "ZodNativeEnum";
4078
- ZodFirstPartyTypeKind2["ZodOptional"] = "ZodOptional";
4079
- ZodFirstPartyTypeKind2["ZodNullable"] = "ZodNullable";
4080
- ZodFirstPartyTypeKind2["ZodDefault"] = "ZodDefault";
4081
- ZodFirstPartyTypeKind2["ZodCatch"] = "ZodCatch";
4082
- ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
4083
- ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
4084
- ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
4085
- ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
5592
+ (function(ZodFirstPartyTypeKind) {
5593
+ ZodFirstPartyTypeKind["ZodString"] = "ZodString";
5594
+ ZodFirstPartyTypeKind["ZodNumber"] = "ZodNumber";
5595
+ ZodFirstPartyTypeKind["ZodNaN"] = "ZodNaN";
5596
+ ZodFirstPartyTypeKind["ZodBigInt"] = "ZodBigInt";
5597
+ ZodFirstPartyTypeKind["ZodBoolean"] = "ZodBoolean";
5598
+ ZodFirstPartyTypeKind["ZodDate"] = "ZodDate";
5599
+ ZodFirstPartyTypeKind["ZodSymbol"] = "ZodSymbol";
5600
+ ZodFirstPartyTypeKind["ZodUndefined"] = "ZodUndefined";
5601
+ ZodFirstPartyTypeKind["ZodNull"] = "ZodNull";
5602
+ ZodFirstPartyTypeKind["ZodAny"] = "ZodAny";
5603
+ ZodFirstPartyTypeKind["ZodUnknown"] = "ZodUnknown";
5604
+ ZodFirstPartyTypeKind["ZodNever"] = "ZodNever";
5605
+ ZodFirstPartyTypeKind["ZodVoid"] = "ZodVoid";
5606
+ ZodFirstPartyTypeKind["ZodArray"] = "ZodArray";
5607
+ ZodFirstPartyTypeKind["ZodObject"] = "ZodObject";
5608
+ ZodFirstPartyTypeKind["ZodUnion"] = "ZodUnion";
5609
+ ZodFirstPartyTypeKind["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion";
5610
+ ZodFirstPartyTypeKind["ZodIntersection"] = "ZodIntersection";
5611
+ ZodFirstPartyTypeKind["ZodTuple"] = "ZodTuple";
5612
+ ZodFirstPartyTypeKind["ZodRecord"] = "ZodRecord";
5613
+ ZodFirstPartyTypeKind["ZodMap"] = "ZodMap";
5614
+ ZodFirstPartyTypeKind["ZodSet"] = "ZodSet";
5615
+ ZodFirstPartyTypeKind["ZodFunction"] = "ZodFunction";
5616
+ ZodFirstPartyTypeKind["ZodLazy"] = "ZodLazy";
5617
+ ZodFirstPartyTypeKind["ZodLiteral"] = "ZodLiteral";
5618
+ ZodFirstPartyTypeKind["ZodEnum"] = "ZodEnum";
5619
+ ZodFirstPartyTypeKind["ZodEffects"] = "ZodEffects";
5620
+ ZodFirstPartyTypeKind["ZodNativeEnum"] = "ZodNativeEnum";
5621
+ ZodFirstPartyTypeKind["ZodOptional"] = "ZodOptional";
5622
+ ZodFirstPartyTypeKind["ZodNullable"] = "ZodNullable";
5623
+ ZodFirstPartyTypeKind["ZodDefault"] = "ZodDefault";
5624
+ ZodFirstPartyTypeKind["ZodCatch"] = "ZodCatch";
5625
+ ZodFirstPartyTypeKind["ZodPromise"] = "ZodPromise";
5626
+ ZodFirstPartyTypeKind["ZodBranded"] = "ZodBranded";
5627
+ ZodFirstPartyTypeKind["ZodPipeline"] = "ZodPipeline";
5628
+ ZodFirstPartyTypeKind["ZodReadonly"] = "ZodReadonly";
4086
5629
  })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
4087
- var instanceOfType = (cls, params = {
4088
- message: `Input not instance of ${cls.name}`
4089
- }) => custom((data) => data instanceof cls, params);
4090
5630
  var stringType = ZodString.create;
4091
5631
  var numberType = ZodNumber.create;
4092
5632
  var nanType = ZodNaN.create;
@@ -4121,41 +5661,84 @@ var optionalType = ZodOptional.create;
4121
5661
  var nullableType = ZodNullable.create;
4122
5662
  var preprocessType = ZodEffects.createWithPreprocess;
4123
5663
  var pipelineType = ZodPipeline.create;
4124
- var ostring = () => stringType().optional();
4125
- var onumber = () => numberType().optional();
4126
- var oboolean = () => booleanType().optional();
4127
- var coerce = {
4128
- string: (arg) => ZodString.create({ ...arg, coerce: true }),
4129
- number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
4130
- boolean: (arg) => ZodBoolean.create({
4131
- ...arg,
4132
- coerce: true
4133
- }),
4134
- bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
4135
- date: (arg) => ZodDate.create({ ...arg, coerce: true })
4136
- };
4137
- var NEVER = INVALID;
4138
5664
  // src/schemas.ts
4139
- var audibleRawItemSchema = exports_external.object({
4140
- asin: exports_external.string().min(1),
4141
- title: exports_external.string().min(1),
4142
- authors: exports_external.array(exports_external.object({ name: exports_external.string() })).default([]),
4143
- narrators: exports_external.array(exports_external.object({ name: exports_external.string() })).default([]),
4144
- runtime_length_min: exports_external.number().nonnegative().default(0),
4145
- publisher_name: exports_external.string().nullish().transform((v) => v ?? undefined),
4146
- language: exports_external.string().nullish().transform((v) => v ?? undefined),
4147
- release_date: exports_external.string().nullish().transform((v) => v ?? undefined),
4148
- product_images: exports_external.record(exports_external.string(), exports_external.string()).nullish().transform((v) => v ?? undefined),
4149
- series: exports_external.array(exports_external.object({
4150
- asin: exports_external.string(),
4151
- title: exports_external.string(),
4152
- sequence: exports_external.string().nullish().transform((v) => v ?? undefined)
5665
+ var nullToUndefined = (v) => v ?? undefined;
5666
+ var optionalString = stringType().nullish().transform(nullToUndefined);
5667
+ var ratingDistributionSchema = objectType({
5668
+ average_rating: numberType(),
5669
+ display_average_rating: stringType().default("0"),
5670
+ display_stars: numberType().default(0),
5671
+ num_ratings: numberType(),
5672
+ num_five_star_ratings: numberType().default(0),
5673
+ num_four_star_ratings: numberType().default(0),
5674
+ num_three_star_ratings: numberType().default(0),
5675
+ num_two_star_ratings: numberType().default(0),
5676
+ num_one_star_ratings: numberType().default(0)
5677
+ });
5678
+ var audibleRatingSchema = objectType({
5679
+ num_reviews: numberType().default(0),
5680
+ overall_distribution: ratingDistributionSchema.nullish(),
5681
+ performance_distribution: ratingDistributionSchema.nullish(),
5682
+ story_distribution: ratingDistributionSchema.nullish()
5683
+ }).nullish();
5684
+ var categoryLadderSchema = objectType({
5685
+ root: stringType().default("Genres"),
5686
+ ladder: arrayType(objectType({
5687
+ id: stringType(),
5688
+ name: stringType()
5689
+ })).default([])
5690
+ });
5691
+ var relationshipSchema = objectType({
5692
+ asin: stringType(),
5693
+ relationship_to_product: optionalString,
5694
+ relationship_type: optionalString,
5695
+ title: optionalString,
5696
+ sort: optionalString,
5697
+ url: optionalString
5698
+ });
5699
+ var audibleRawItemSchema = objectType({
5700
+ asin: stringType().min(1),
5701
+ title: stringType().min(1),
5702
+ subtitle: optionalString,
5703
+ isbn: optionalString,
5704
+ sku: optionalString,
5705
+ authors: arrayType(objectType({ name: stringType() })).default([]),
5706
+ narrators: arrayType(objectType({ name: stringType() })).default([]),
5707
+ runtime_length_min: numberType().nonnegative().default(0),
5708
+ publisher_name: optionalString,
5709
+ language: optionalString,
5710
+ release_date: optionalString,
5711
+ publisher_summary: optionalString,
5712
+ extended_product_description: optionalString,
5713
+ merchandising_summary: optionalString,
5714
+ copyright: optionalString,
5715
+ format_type: optionalString,
5716
+ content_type: optionalString,
5717
+ content_delivery_type: optionalString,
5718
+ program_participation: optionalString,
5719
+ product_images: recordType(stringType(), stringType()).nullish().transform((v) => v ?? {}),
5720
+ social_media_images: recordType(stringType(), stringType()).nullish().transform((v) => v ?? {}),
5721
+ series: arrayType(objectType({
5722
+ asin: stringType(),
5723
+ title: stringType(),
5724
+ sequence: optionalString
4153
5725
  })).nullish().transform((v) => v ?? []),
4154
- listening_status: exports_external.object({
4155
- is_finished: exports_external.boolean().optional(),
4156
- percent_complete: exports_external.number().optional(),
4157
- finished_at_timestamp: exports_external.string().nullish()
4158
- }).nullish().transform((v) => v ?? undefined)
5726
+ category_ladders: arrayType(categoryLadderSchema).nullish().transform((v) => v ?? []),
5727
+ platinum_keywords: arrayType(stringType()).nullish().transform((v) => v ?? []),
5728
+ thesaurus_subject_keywords: arrayType(stringType()).nullish().transform((v) => v ?? []),
5729
+ rating: audibleRatingSchema,
5730
+ listening_status: objectType({
5731
+ is_finished: booleanType().optional(),
5732
+ percent_complete: numberType().optional(),
5733
+ finished_at_timestamp: stringType().nullish(),
5734
+ time_remaining_seconds: numberType().optional()
5735
+ }).nullish().transform(nullToUndefined),
5736
+ purchase_date: optionalString,
5737
+ library_status: objectType({
5738
+ date_added: stringType().nullish()
5739
+ }).nullish().transform(nullToUndefined),
5740
+ relationships: arrayType(relationshipSchema).nullish().transform((v) => v ?? []),
5741
+ is_adult_product: booleanType().nullish().transform((v) => v ?? false)
4159
5742
  });
4160
5743
 
4161
5744
  // src/signing.ts
@@ -4177,73 +5760,161 @@ ${credentials.adpToken}`;
4177
5760
  };
4178
5761
  };
4179
5762
 
4180
- // src/library.ts
4181
- var RESPONSE_GROUPS = "product_details,contributors,media,product_attrs,listening_status";
5763
+ // src/fetch.ts
5764
+ var PAGE_SIZE = 50;
5765
+ var REFRESH_BUFFER_MS = 5 * 60 * 1000;
5766
+ var ensureFresh = async (credentials) => credentials.expiresAt.getTime() - Date.now() < REFRESH_BUFFER_MS ? refresh(credentials) : credentials;
4182
5767
  var audibleFetch = async (path, credentials, query) => {
4183
- const config = AUDIBLE_LOCALES[credentials.locale];
5768
+ const fresh = await ensureFresh(credentials);
5769
+ const config = AUDIBLE_LOCALES[fresh.locale];
4184
5770
  const fullPath = `/1.0${path}`;
4185
5771
  const queryString = query ? `?${Object.entries(query).map(([k, v]) => `${k}=${v}`).join("&")}` : "";
4186
5772
  const signPath = `${fullPath}${queryString}`;
4187
- const headers = signRequest("GET", signPath, "", credentials);
4188
- const url = new URL(`https://api.audible.${config.domain}${fullPath}`);
4189
- if (query) {
4190
- for (const [k, v] of Object.entries(query)) {
4191
- url.searchParams.set(k, v);
4192
- }
4193
- }
4194
- const response = await fetch(url.toString(), { headers });
5773
+ const headers = signRequest("GET", signPath, "", fresh);
5774
+ const fetchUrl = `https://api.audible.${config.domain}${fullPath}${queryString}`;
5775
+ const response = await fetch(fetchUrl, { headers });
4195
5776
  if (!response.ok) {
4196
5777
  throw new Error(`Audible API error: ${response.status} ${response.statusText} (${path})`);
4197
5778
  }
4198
- return await response.json();
5779
+ return { data: await response.json(), credentials: fresh };
4199
5780
  };
4200
- var parseItems = (items) => items.map((raw) => {
4201
- const item = audibleRawItemSchema.parse(raw);
4202
- return {
4203
- asin: item.asin,
4204
- title: item.title,
4205
- authors: item.authors.map(({ name }) => name),
4206
- narrators: item.narrators.map(({ name }) => name),
4207
- durationMinutes: item.runtime_length_min,
4208
- publisher: item.publisher_name,
4209
- language: item.language,
4210
- releaseDate: item.release_date ? new Date(item.release_date) : undefined,
4211
- coverUrl: item.product_images?.["500"] ?? item.product_images?.["252"],
4212
- series: item.series[0] ? {
4213
- name: item.series[0].title,
4214
- position: item.series[0].sequence ? Number(item.series[0].sequence) : undefined
4215
- } : undefined,
4216
- finishedAt: item.listening_status?.finished_at_timestamp ? new Date(item.listening_status.finished_at_timestamp) : undefined
4217
- };
5781
+ var extractItems = (response) => Array.isArray(response.items) ? response.items : Array.isArray(response.products) ? response.products : [];
5782
+ var toRatingDistribution = (dist) => ({
5783
+ averageRating: dist.average_rating,
5784
+ displayAverageRating: dist.display_average_rating,
5785
+ displayStars: dist.display_stars,
5786
+ numRatings: dist.num_ratings,
5787
+ numFiveStarRatings: dist.num_five_star_ratings,
5788
+ numFourStarRatings: dist.num_four_star_ratings,
5789
+ numThreeStarRatings: dist.num_three_star_ratings,
5790
+ numTwoStarRatings: dist.num_two_star_ratings,
5791
+ numOneStarRatings: dist.num_one_star_ratings
4218
5792
  });
4219
- var extractItems = (response) => {
4220
- if (Array.isArray(response.items))
4221
- return response.items;
4222
- if (Array.isArray(response.products))
4223
- return response.products;
4224
- return [];
5793
+ var toRating = (raw) => raw ? {
5794
+ numReviews: raw.num_reviews,
5795
+ overallDistribution: raw.overall_distribution ? toRatingDistribution(raw.overall_distribution) : undefined,
5796
+ performanceDistribution: raw.performance_distribution ? toRatingDistribution(raw.performance_distribution) : undefined,
5797
+ storyDistribution: raw.story_distribution ? toRatingDistribution(raw.story_distribution) : undefined
5798
+ } : undefined;
5799
+ var toAudibleItem = (item) => ({
5800
+ asin: item.asin,
5801
+ title: item.title,
5802
+ subtitle: item.subtitle,
5803
+ isbn: item.isbn,
5804
+ sku: item.sku,
5805
+ authors: item.authors.map(({ name }) => name),
5806
+ narrators: item.narrators.map(({ name }) => name),
5807
+ durationMinutes: item.runtime_length_min,
5808
+ publisher: item.publisher_name,
5809
+ language: item.language,
5810
+ releaseDate: item.release_date ? new Date(item.release_date) : undefined,
5811
+ coverUrl: item.product_images["500"] ?? item.product_images["252"],
5812
+ summary: item.publisher_summary,
5813
+ description: item.extended_product_description,
5814
+ merchandisingSummary: item.merchandising_summary,
5815
+ copyright: item.copyright,
5816
+ formatType: item.format_type,
5817
+ contentType: item.content_type,
5818
+ contentDeliveryType: item.content_delivery_type,
5819
+ programParticipation: item.program_participation,
5820
+ series: item.series[0] ? {
5821
+ name: item.series[0].title,
5822
+ position: item.series[0].sequence ? Number(item.series[0].sequence) : undefined
5823
+ } : undefined,
5824
+ categories: item.category_ladders.map((ladder) => ({
5825
+ root: ladder.root,
5826
+ categories: ladder.ladder.map(({ id, name }) => ({ id, name }))
5827
+ })),
5828
+ keywords: [...item.platinum_keywords, ...item.thesaurus_subject_keywords],
5829
+ rating: toRating(item.rating),
5830
+ listeningStatus: item.listening_status ? {
5831
+ finishedAt: item.listening_status.finished_at_timestamp ? new Date(item.listening_status.finished_at_timestamp) : undefined,
5832
+ isFinished: item.listening_status.is_finished,
5833
+ percentComplete: item.listening_status.percent_complete,
5834
+ timeRemainingSeconds: item.listening_status.time_remaining_seconds
5835
+ } : undefined,
5836
+ purchaseDate: item.purchase_date ? new Date(item.purchase_date) : undefined,
5837
+ dateAdded: item.library_status?.date_added ? new Date(item.library_status.date_added) : undefined,
5838
+ relationships: item.relationships.map((rel) => ({
5839
+ asin: rel.asin,
5840
+ relationshipToProduct: rel.relationship_to_product ?? "",
5841
+ relationshipType: rel.relationship_type ?? "",
5842
+ title: rel.title,
5843
+ sort: rel.sort,
5844
+ url: rel.url
5845
+ })),
5846
+ isAdultProduct: item.is_adult_product,
5847
+ productImages: item.product_images,
5848
+ socialMediaImages: item.social_media_images
5849
+ });
5850
+ var parseItems = (items) => items.map((raw) => toAudibleItem(audibleRawItemSchema.parse(raw)));
5851
+ var fetchAllPages = async (path, credentials, responseGroups, accumulated = [], page = 1) => {
5852
+ const { data: response, credentials: fresh } = await audibleFetch(path, credentials, {
5853
+ response_groups: responseGroups,
5854
+ num_results: String(PAGE_SIZE),
5855
+ page: String(page)
5856
+ });
5857
+ const rawItems = extractItems(response);
5858
+ const items = [...accumulated, ...parseItems(rawItems)];
5859
+ return rawItems.length < PAGE_SIZE ? { items, credentials: fresh } : fetchAllPages(path, fresh, responseGroups, items, page + 1);
4225
5860
  };
4226
- var fetchPaginated = async (path, credentials) => {
4227
- const allItems = [];
4228
- const pageSize = 50;
4229
- let page = 1;
4230
- while (true) {
4231
- const response = await audibleFetch(path, credentials, {
4232
- response_groups: RESPONSE_GROUPS,
4233
- num_results: String(pageSize),
4234
- page: String(page)
4235
- });
4236
- const rawItems = extractItems(response);
4237
- allItems.push(...parseItems(rawItems));
4238
- if (rawItems.length < pageSize)
4239
- break;
4240
- page += 1;
5861
+
5862
+ // src/catalog.ts
5863
+ var CATALOG_RESPONSE_GROUPS = "product_details,contributors,media,product_attrs,rating,category_ladders,series,product_desc,product_extended_attrs,relationships";
5864
+ var PAGE_SIZE2 = 50;
5865
+ var extractItems2 = (response) => Array.isArray(response.products) ? response.products : Array.isArray(response.items) ? response.items : [];
5866
+ var parseResponse = (response) => extractItems2(response).map((raw) => toAudibleItem(audibleRawItemSchema.parse(raw)));
5867
+ var fetchCatalogPages = async (credentials, categoryId, options, maxPages, accumulated = [], page = 1) => {
5868
+ const { data: response, credentials: fresh } = await audibleFetch("/catalog/products", credentials, {
5869
+ category_id: categoryId,
5870
+ products_sort_by: "Relevance",
5871
+ num_results: String(PAGE_SIZE2),
5872
+ page: String(page),
5873
+ response_groups: CATALOG_RESPONSE_GROUPS,
5874
+ ...options.keywords ? { keywords: options.keywords } : {},
5875
+ ...options.author ? { author: options.author } : {},
5876
+ ...options.narrator ? { narrator: options.narrator } : {}
5877
+ });
5878
+ const rawItems = extractItems2(response);
5879
+ const items = [...accumulated, ...parseResponse(response)];
5880
+ return rawItems.length < PAGE_SIZE2 || page >= maxPages ? { items, credentials: fresh } : fetchCatalogPages(fresh, categoryId, options, maxPages, items, page + 1);
5881
+ };
5882
+ var catalog = async (credentials, options) => {
5883
+ const categoryId = options.category ? resolveGenreId(options.category, credentials.locale) : options.categoryId;
5884
+ if (!categoryId) {
5885
+ throw new Error('Either "category" or "categoryId" must be provided');
5886
+ }
5887
+ const sortBy = options.sortBy ?? "Relevance";
5888
+ const limit = options.limit ?? 50;
5889
+ if (sortBy === "MostVoted") {
5890
+ const MAX_PAGES = 20;
5891
+ const { items: allItems, credentials: fresh } = await fetchCatalogPages(credentials, categoryId, options, MAX_PAGES);
5892
+ const sorted = orderBy_default(uniqBy_default(allItems, ({ asin }) => asin), [
5893
+ ({ rating }) => rating?.overallDistribution?.numRatings ?? 0,
5894
+ ({ rating }) => rating?.overallDistribution?.averageRating ?? 0
5895
+ ], ["desc", "desc"]);
5896
+ return {
5897
+ items: limit === "all" ? sorted : sorted.slice(0, limit),
5898
+ credentials: fresh
5899
+ };
4241
5900
  }
4242
- return { items: allItems, credentials };
5901
+ const { data: response, credentials: fresh } = await audibleFetch("/catalog/products", credentials, {
5902
+ category_id: categoryId,
5903
+ products_sort_by: sortBy,
5904
+ num_results: String(limit === "all" ? PAGE_SIZE2 : Math.min(limit, PAGE_SIZE2)),
5905
+ page: "1",
5906
+ response_groups: CATALOG_RESPONSE_GROUPS,
5907
+ ...options.keywords ? { keywords: options.keywords } : {},
5908
+ ...options.author ? { author: options.author } : {},
5909
+ ...options.narrator ? { narrator: options.narrator } : {}
5910
+ });
5911
+ return { items: parseResponse(response), credentials: fresh };
4243
5912
  };
4244
- var fetchLibrary = async (credentials) => fetchPaginated("/library", credentials);
4245
- var fetchWishlist = async (credentials) => fetchPaginated("/wishlist", credentials);
4246
- var verifyConnection = async (credentials) => {
5913
+ // src/library.ts
5914
+ var RESPONSE_GROUPS = "product_details,contributors,media,product_attrs,listening_status,series,rating,category_ladders,product_desc,product_extended_attrs,relationships";
5915
+ var library = async (credentials) => fetchAllPages("/library", credentials, RESPONSE_GROUPS);
5916
+ var wishlist = async (credentials) => fetchAllPages("/wishlist", credentials, RESPONSE_GROUPS);
5917
+ var verify = async (credentials) => {
4247
5918
  await audibleFetch("/library", credentials, {
4248
5919
  num_results: "1",
4249
5920
  page: "1",
@@ -4251,11 +5922,14 @@ var verifyConnection = async (credentials) => {
4251
5922
  });
4252
5923
  };
4253
5924
  export {
4254
- verifyConnection,
4255
- registerDevice,
4256
- refreshAccessToken,
4257
- generateLoginUrl,
4258
- fetchWishlist,
4259
- fetchLibrary,
4260
- AUDIBLE_LOCALES
5925
+ AUDIBLE_LOCALES,
5926
+ GENRE_CATEGORIES,
5927
+ catalog,
5928
+ library,
5929
+ login,
5930
+ refresh,
5931
+ register,
5932
+ resolveGenreId,
5933
+ verify,
5934
+ wishlist
4261
5935
  };