amule-ec-client 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/README.md +10 -2
  2. package/dist/{AddLinkRequest-DwUbSMXD.mjs → AddLinkRequest-DEKGy-R2.js} +2 -5
  3. package/dist/{ClientQueueRequest-D9FaX5K9.mjs → ClientQueueRequest-DrLXSxtp.js} +2 -5
  4. package/dist/{ClientQueueResponse-FVQBR_8b.mjs → ClientQueueResponse-CXxY_9wU.js} +6 -6
  5. package/dist/{CreateCategoryRequest-Br6yfDhZ.mjs → CreateCategoryRequest-COulF12x.js} +2 -5
  6. package/dist/{DeleteCategoryRequest-C2-p6sx0.mjs → DeleteCategoryRequest-D-mljaNV.js} +2 -5
  7. package/dist/{DownloadCommandRequest-CaULjfNi.mjs → DownloadCommandRequest-Bf1Ez8Da.js} +3 -6
  8. package/dist/{DownloadFileRequest-CcNqsBo7.mjs → DownloadFileRequest-WfOIV07R.js} +2 -5
  9. package/dist/{DownloadQueueRequest-bd7lFiMj.mjs → DownloadQueueRequest-Br-pgrRt.js} +2 -5
  10. package/dist/DownloadQueueResponse-C-5d4teB.js +241 -0
  11. package/dist/{GetPreferencesRequest-C94Su9IH.mjs → GetPreferencesRequest-BE3RbRRn.js} +2 -5
  12. package/dist/{PreferencesDetailsResponse-BjMxbvVY.mjs → PreferencesDetailsResponse-D8lBd8Ot.js} +1 -4
  13. package/dist/{PreferencesResponse-Dth-n2sA.mjs → PreferencesResponse-BmGTQM30.js} +1 -4
  14. package/dist/{ReloadSharedFilesRequest-CPwAEJYG.mjs → ReloadSharedFilesRequest-BbDUeGcq.js} +2 -4
  15. package/dist/{Request-C0UUuQIX.mjs → Request-BvScDpeu.js} +3 -11
  16. package/dist/{SearchProgressResponse-Bputc9Ww.mjs → SearchProgressResponse-BQPliUup.js} +1 -4
  17. package/dist/{SearchRequest-CNqz-K1Z.mjs → SearchRequest-DOakj8fA.js} +3 -6
  18. package/dist/{SearchResultsRequest-DKG508KF.mjs → SearchResultsRequest-oZBs5KKm.js} +2 -4
  19. package/dist/{SearchResultsResponse-ChNrKJ6_.mjs → SearchResultsResponse-C9I9x035.js} +1 -4
  20. package/dist/{SearchStatusRequest-Bv6iaC9Y.mjs → SearchStatusRequest-B1ZzSQlE.js} +2 -4
  21. package/dist/{SearchStopRequest-rET-2Nsz.mjs → SearchStopRequest-FfXf_DCn.js} +2 -4
  22. package/dist/{ServerConnectRequest-CcO2-Eqd.mjs → ServerConnectRequest-Cdiw-KWu.js} +2 -5
  23. package/dist/{ServerDisconnectRequest-DEORM3SF.mjs → ServerDisconnectRequest-BVXSumxX.js} +2 -4
  24. package/dist/{ServerListRequest-FwFQBp12.mjs → ServerListRequest-3yMrgZID.js} +2 -4
  25. package/dist/{ServerListResponse-ZAKSSCPZ.mjs → ServerListResponse-Do3iRai0.js} +5 -6
  26. package/dist/{ServerUpdateFromUrlRequest-D4xBqJDJ.mjs → ServerUpdateFromUrlRequest-DpxBII5W.js} +2 -5
  27. package/dist/{SetFileCategoryRequest-BwEPJVeR.mjs → SetFileCategoryRequest-CFgkJB-H.js} +2 -5
  28. package/dist/{SetPreferencesRequest-D2fVIH3P.mjs → SetPreferencesRequest-BdZ40Ao_.js} +2 -5
  29. package/dist/{SharedFilePriorityRequest-j6ImgagV.mjs → SharedFilePriorityRequest-BMNmaL06.js} +2 -5
  30. package/dist/{SharedFilesRequest-D2M3K0eB.mjs → SharedFilesRequest-BZKz0oyn.js} +2 -5
  31. package/dist/SharedFilesResponse-DE0cd1DT.js +45 -0
  32. package/dist/{StatsRequest-B8v9LLHG.mjs → StatsRequest-DVwx5wk1.js} +2 -5
  33. package/dist/{StatsResponse-BVUxNPbz.mjs → StatsResponse-CP2F2zt0.js} +25 -4
  34. package/dist/{Codes-CjiW7Pdl.mjs → Tag-B5gWV2XF.js} +268 -3
  35. package/dist/{UpdateCategoryRequest-CgzH7SxP.mjs → UpdateCategoryRequest-Bu22YjOm.js} +2 -5
  36. package/dist/{UpdateRequest-Bunl73Ga.mjs → UpdateRequest-CaQ867p8.js} +2 -5
  37. package/dist/UpdateState-Dn-SuAsj.js +173 -0
  38. package/dist/{download-details-OM0FJUhZ.mjs → download-details-OM0FJUhZ.js} +0 -2
  39. package/dist/{index.d.mts → index.d.ts} +358 -337
  40. package/dist/{index.mjs → index.js} +94 -54
  41. package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
  42. package/dist/{utils-DBnUQnZ-.mjs → utils-CNoUroOI.js} +11 -3
  43. package/package.json +1 -1
  44. package/dist/AddLinkRequest-DwUbSMXD.mjs.map +0 -1
  45. package/dist/ClientQueueRequest-D9FaX5K9.mjs.map +0 -1
  46. package/dist/ClientQueueResponse-FVQBR_8b.mjs.map +0 -1
  47. package/dist/Codes-CjiW7Pdl.mjs.map +0 -1
  48. package/dist/CreateCategoryRequest-Br6yfDhZ.mjs.map +0 -1
  49. package/dist/DeleteCategoryRequest-C2-p6sx0.mjs.map +0 -1
  50. package/dist/DownloadCommandRequest-CaULjfNi.mjs.map +0 -1
  51. package/dist/DownloadFileRequest-CcNqsBo7.mjs.map +0 -1
  52. package/dist/DownloadQueueRequest-bd7lFiMj.mjs.map +0 -1
  53. package/dist/DownloadQueueResponse-DyP1rLTV.mjs +0 -261
  54. package/dist/DownloadQueueResponse-DyP1rLTV.mjs.map +0 -1
  55. package/dist/GetPreferencesRequest-C94Su9IH.mjs.map +0 -1
  56. package/dist/PreferencesDetailsResponse-BjMxbvVY.mjs.map +0 -1
  57. package/dist/PreferencesResponse-Dth-n2sA.mjs.map +0 -1
  58. package/dist/ReloadSharedFilesRequest-CPwAEJYG.mjs.map +0 -1
  59. package/dist/Request-C0UUuQIX.mjs.map +0 -1
  60. package/dist/SearchProgressResponse-Bputc9Ww.mjs.map +0 -1
  61. package/dist/SearchRequest-CNqz-K1Z.mjs.map +0 -1
  62. package/dist/SearchResultsRequest-DKG508KF.mjs.map +0 -1
  63. package/dist/SearchResultsResponse-ChNrKJ6_.mjs.map +0 -1
  64. package/dist/SearchStatusRequest-Bv6iaC9Y.mjs.map +0 -1
  65. package/dist/SearchStopRequest-rET-2Nsz.mjs.map +0 -1
  66. package/dist/ServerConnectRequest-CcO2-Eqd.mjs.map +0 -1
  67. package/dist/ServerDisconnectRequest-DEORM3SF.mjs.map +0 -1
  68. package/dist/ServerListRequest-FwFQBp12.mjs.map +0 -1
  69. package/dist/ServerListResponse-ZAKSSCPZ.mjs.map +0 -1
  70. package/dist/ServerUpdateFromUrlRequest-D4xBqJDJ.mjs.map +0 -1
  71. package/dist/SetFileCategoryRequest-BwEPJVeR.mjs.map +0 -1
  72. package/dist/SetPreferencesRequest-D2fVIH3P.mjs.map +0 -1
  73. package/dist/SharedFilePriorityRequest-j6ImgagV.mjs.map +0 -1
  74. package/dist/SharedFilesRequest-D2M3K0eB.mjs.map +0 -1
  75. package/dist/SharedFilesResponse-BiXT_oCx.mjs +0 -41
  76. package/dist/SharedFilesResponse-BiXT_oCx.mjs.map +0 -1
  77. package/dist/StatsRequest-B8v9LLHG.mjs.map +0 -1
  78. package/dist/StatsResponse-BVUxNPbz.mjs.map +0 -1
  79. package/dist/Tag-CZF6BRMY.mjs +0 -262
  80. package/dist/Tag-CZF6BRMY.mjs.map +0 -1
  81. package/dist/UpdateCategoryRequest-CgzH7SxP.mjs.map +0 -1
  82. package/dist/UpdateRequest-Bunl73Ga.mjs.map +0 -1
  83. package/dist/UpdateResponse-1LhyH9Zf.mjs +0 -47
  84. package/dist/UpdateResponse-1LhyH9Zf.mjs.map +0 -1
  85. package/dist/download-details-OM0FJUhZ.mjs.map +0 -1
  86. package/dist/index.mjs.map +0 -1
  87. package/dist/utils-DBnUQnZ-.mjs.map +0 -1
@@ -1,7 +1,8 @@
1
- import "./Codes-CjiW7Pdl.mjs";
2
- import { f as findNumericTag, p as findTag } from "./Tag-CZF6BRMY.mjs";
3
- import { n as toOptionalBool, t as formatIp } from "./utils-DBnUQnZ-.mjs";
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
+ import { f as findNumericTag, p as findTag } from "./Tag-B5gWV2XF.js";
3
+ import { r as toOptionalBool, t as formatIp } from "./utils-CNoUroOI.js";
4
4
  //#region src/response/ServerListResponse.ts
5
+ var ServerListResponse_exports = /* @__PURE__ */ __exportAll({ ServerListResponseParser: () => ServerListResponseParser });
5
6
  var ServerListResponseParser = class {
6
7
  static fromPacket(packet) {
7
8
  return this.fromTags(packet.tags);
@@ -47,6 +48,4 @@ var ServerListResponseParser = class {
47
48
  }
48
49
  };
49
50
  //#endregion
50
- export { ServerListResponseParser };
51
-
52
- //# sourceMappingURL=ServerListResponse-ZAKSSCPZ.mjs.map
51
+ export { ServerListResponse_exports as n, ServerListResponseParser as t };
@@ -1,6 +1,5 @@
1
- import { t as Request } from "./Request-C0UUuQIX.mjs";
2
- import "./Codes-CjiW7Pdl.mjs";
3
- import { a as StringTag } from "./Tag-CZF6BRMY.mjs";
1
+ import { t as Request } from "./Request-BvScDpeu.js";
2
+ import { a as StringTag } from "./Tag-B5gWV2XF.js";
4
3
  //#region src/request/ServerUpdateFromUrlRequest.ts
5
4
  var ServerUpdateFromUrlRequest = class extends Request {
6
5
  constructor(url) {
@@ -10,5 +9,3 @@ var ServerUpdateFromUrlRequest = class extends Request {
10
9
  };
11
10
  //#endregion
12
11
  export { ServerUpdateFromUrlRequest };
13
-
14
- //# sourceMappingURL=ServerUpdateFromUrlRequest-D4xBqJDJ.mjs.map
@@ -1,6 +1,5 @@
1
- import { t as Request } from "./Request-C0UUuQIX.mjs";
2
- import "./Codes-CjiW7Pdl.mjs";
3
- import { r as Hash16Tag, s as UByteTag } from "./Tag-CZF6BRMY.mjs";
1
+ import { t as Request } from "./Request-BvScDpeu.js";
2
+ import { r as Hash16Tag, s as UByteTag } from "./Tag-B5gWV2XF.js";
4
3
  //#region src/request/SetFileCategoryRequest.ts
5
4
  /**
6
5
  * Set File Category Request - Change category of a file
@@ -13,5 +12,3 @@ var SetFileCategoryRequest = class extends Request {
13
12
  };
14
13
  //#endregion
15
14
  export { SetFileCategoryRequest };
16
-
17
- //# sourceMappingURL=SetFileCategoryRequest-BwEPJVeR.mjs.map
@@ -1,6 +1,5 @@
1
- import { t as Request } from "./Request-C0UUuQIX.mjs";
2
- import "./Codes-CjiW7Pdl.mjs";
3
- import { a as StringTag, d as UShortTag, l as UIntTag, s as UByteTag } from "./Tag-CZF6BRMY.mjs";
1
+ import { t as Request } from "./Request-BvScDpeu.js";
2
+ import { a as StringTag, d as UShortTag, l as UIntTag, s as UByteTag } from "./Tag-B5gWV2XF.js";
4
3
  //#region src/request/SetPreferencesRequest.ts
5
4
  var SetPreferencesRequest = class SetPreferencesRequest extends Request {
6
5
  constructor(prefs) {
@@ -62,5 +61,3 @@ var SetPreferencesRequest = class SetPreferencesRequest extends Request {
62
61
  };
63
62
  //#endregion
64
63
  export { SetPreferencesRequest };
65
-
66
- //# sourceMappingURL=SetPreferencesRequest-D2fVIH3P.mjs.map
@@ -1,6 +1,5 @@
1
- import { t as Request } from "./Request-C0UUuQIX.mjs";
2
- import "./Codes-CjiW7Pdl.mjs";
3
- import { l as UIntTag, r as Hash16Tag } from "./Tag-CZF6BRMY.mjs";
1
+ import { t as Request } from "./Request-BvScDpeu.js";
2
+ import { l as UIntTag, r as Hash16Tag } from "./Tag-B5gWV2XF.js";
4
3
  //#region src/request/SharedFilePriorityRequest.ts
5
4
  var SharedFilePriorityRequest = class extends Request {
6
5
  constructor(hash, priority) {
@@ -11,5 +10,3 @@ var SharedFilePriorityRequest = class extends Request {
11
10
  };
12
11
  //#endregion
13
12
  export { SharedFilePriorityRequest };
14
-
15
- //# sourceMappingURL=SharedFilePriorityRequest-j6ImgagV.mjs.map
@@ -1,6 +1,5 @@
1
- import { t as Request } from "./Request-C0UUuQIX.mjs";
2
- import "./Codes-CjiW7Pdl.mjs";
3
- import { s as UByteTag } from "./Tag-CZF6BRMY.mjs";
1
+ import { t as Request } from "./Request-BvScDpeu.js";
2
+ import { s as UByteTag } from "./Tag-B5gWV2XF.js";
4
3
  //#region src/request/SharedFilesRequest.ts
5
4
  /**
6
5
  * Shared Files Request - Get shared files list
@@ -13,5 +12,3 @@ var SharedFilesRequest = class extends Request {
13
12
  };
14
13
  //#endregion
15
14
  export { SharedFilesRequest };
16
-
17
- //# sourceMappingURL=SharedFilesRequest-D2M3K0eB.mjs.map
@@ -0,0 +1,45 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
+ import { f as findNumericTag, p as findTag } from "./Tag-B5gWV2XF.js";
3
+ import { a as toOptionalNumber, n as tagOwnNumericValue } from "./utils-CNoUroOI.js";
4
+ //#region src/response/SharedFilesResponse.ts
5
+ var SharedFilesResponse_exports = /* @__PURE__ */ __exportAll({
6
+ SharedFilesResponseParser: () => SharedFilesResponseParser,
7
+ parseKnownFileFields: () => parseKnownFileFields
8
+ });
9
+ /**
10
+ * Parse the fields shared by every known-file shaped tag (EC_TAG_KNOWNFILE and
11
+ * EC_TAG_PARTFILE both carry them).
12
+ */
13
+ function parseKnownFileFields(fileTag) {
14
+ const tags = fileTag.nestedTags || [];
15
+ const hashTag = findTag(tags, 798);
16
+ const fileNameTag = findTag(tags, 769);
17
+ return {
18
+ ecid: tagOwnNumericValue(fileTag),
19
+ fileHashHexString: hashTag ? hashTag.getValue().toString("hex") : void 0,
20
+ fileName: fileNameTag ? fileNameTag.getValue() : void 0,
21
+ filePath: findTag(tags, 1032)?.getValue(),
22
+ sizeFull: toOptionalNumber(findNumericTag(tags, 771)?.getLong()),
23
+ fileEd2kLink: findTag(tags, 782)?.getValue(),
24
+ upPrio: findNumericTag(tags, 1035)?.getInt(),
25
+ getRequests: findNumericTag(tags, 1027)?.getShort(),
26
+ getAllRequests: findNumericTag(tags, 1028)?.getInt(),
27
+ getAccepts: findNumericTag(tags, 1029)?.getShort(),
28
+ getAllAccepts: findNumericTag(tags, 1030)?.getInt(),
29
+ getXferred: toOptionalNumber(findNumericTag(tags, 1025)?.getLong()),
30
+ getAllXferred: toOptionalNumber(findNumericTag(tags, 1026)?.getLong()),
31
+ getCompleteSourcesLow: findNumericTag(tags, 1033)?.getShort(),
32
+ getCompleteSourcesHigh: findNumericTag(tags, 1034)?.getShort(),
33
+ getCompleteSources: findNumericTag(tags, 1037)?.getShort(),
34
+ getOnQueue: findNumericTag(tags, 1036)?.getShort(),
35
+ getComment: findTag(tags, 1038)?.getValue(),
36
+ getRating: findNumericTag(tags, 1039)?.getInt()
37
+ };
38
+ }
39
+ var SharedFilesResponseParser = class {
40
+ static fromPacket(packet) {
41
+ return { files: packet.tags.filter((tag) => tag.name === 1024).map(parseKnownFileFields) };
42
+ }
43
+ };
44
+ //#endregion
45
+ export { SharedFilesResponse_exports as n, parseKnownFileFields as r, SharedFilesResponseParser as t };
@@ -1,6 +1,5 @@
1
- import { t as Request } from "./Request-C0UUuQIX.mjs";
2
- import "./Codes-CjiW7Pdl.mjs";
3
- import { s as UByteTag } from "./Tag-CZF6BRMY.mjs";
1
+ import { t as Request } from "./Request-BvScDpeu.js";
2
+ import { s as UByteTag } from "./Tag-B5gWV2XF.js";
4
3
  //#region src/request/StatsRequest.ts
5
4
  /**
6
5
  * Stats Request - Request server statistics
@@ -13,5 +12,3 @@ var StatsRequest = class extends Request {
13
12
  };
14
13
  //#endregion
15
14
  export { StatsRequest };
16
-
17
- //# sourceMappingURL=StatsRequest-B8v9LLHG.mjs.map
@@ -1,6 +1,11 @@
1
- import "./Codes-CjiW7Pdl.mjs";
2
- import { f as findNumericTag, p as findTag } from "./Tag-CZF6BRMY.mjs";
1
+ import { f as findNumericTag, p as findTag } from "./Tag-B5gWV2XF.js";
2
+ import { n as tagOwnNumericValue } from "./utils-CNoUroOI.js";
3
3
  //#region src/response/StatsResponse.ts
4
+ const CONNSTATE_ED2K_CONNECTED = 1;
5
+ const CONNSTATE_ED2K_CONNECTING = 2;
6
+ const CONNSTATE_KAD_CONNECTED = 4;
7
+ const CONNSTATE_KAD_FIREWALLED = 8;
8
+ const CONNSTATE_KAD_RUNNING = 16;
4
9
  var StatsResponseParser = class {
5
10
  static fromPacket(packet) {
6
11
  const uploadOverhead = findNumericTag(packet.tags, 516)?.getValue() || 0;
@@ -25,6 +30,7 @@ var StatsResponseParser = class {
25
30
  let clientId = 0;
26
31
  let kadId;
27
32
  let connectedServer;
33
+ let connectionState;
28
34
  if (connStateTag && connStateTag.nestedTags) {
29
35
  ed2kId = Number(findNumericTag(connStateTag.nestedTags, 6)?.getValue() || 0);
30
36
  clientId = Number(findNumericTag(connStateTag.nestedTags, 10)?.getValue() || 0);
@@ -44,6 +50,22 @@ var StatsResponseParser = class {
44
50
  description: findTag(serverTag.nestedTags || [], 1282)?.getValue()
45
51
  };
46
52
  }
53
+ const stateBits = tagOwnNumericValue(connStateTag) ?? 0;
54
+ connectionState = {
55
+ ed2kConnected: (stateBits & CONNSTATE_ED2K_CONNECTED) !== 0,
56
+ ed2kConnecting: (stateBits & CONNSTATE_ED2K_CONNECTING) !== 0,
57
+ kadConnected: (stateBits & CONNSTATE_KAD_CONNECTED) !== 0,
58
+ kadFirewalled: (stateBits & CONNSTATE_KAD_FIREWALLED) !== 0,
59
+ kadRunning: (stateBits & CONNSTATE_KAD_RUNNING) !== 0,
60
+ ed2kId: ed2kId || void 0,
61
+ clientId: clientId || void 0,
62
+ serverIpv4: connectedServer ? {
63
+ address: connectedServer.ip,
64
+ port: connectedServer.port
65
+ } : void 0,
66
+ serverName: connectedServer?.name,
67
+ serverDescription: connectedServer?.description
68
+ };
47
69
  }
48
70
  const id = clientId || Number(findNumericTag(packet.tags, 10)?.getValue() || 0);
49
71
  return {
@@ -51,6 +73,7 @@ var StatsResponseParser = class {
51
73
  ed2kId,
52
74
  kadId,
53
75
  connectedServer,
76
+ connectionState,
54
77
  uploadOverhead: Number(uploadOverhead),
55
78
  downloadOverhead: Number(downloadOverhead),
56
79
  bannedCount: Number(bannedCount),
@@ -74,5 +97,3 @@ var StatsResponseParser = class {
74
97
  };
75
98
  //#endregion
76
99
  export { StatsResponseParser };
77
-
78
- //# sourceMappingURL=StatsResponse-BVUxNPbz.mjs.map
@@ -389,6 +389,14 @@ let ECSearchType = /* @__PURE__ */ function(ECSearchType) {
389
389
  ECSearchType[ECSearchType["EC_SEARCH_WEB"] = 3] = "EC_SEARCH_WEB";
390
390
  return ECSearchType;
391
391
  }({});
392
+ let ECSearchFileDownloadStatus = /* @__PURE__ */ function(ECSearchFileDownloadStatus) {
393
+ ECSearchFileDownloadStatus[ECSearchFileDownloadStatus["NEW"] = 0] = "NEW";
394
+ ECSearchFileDownloadStatus[ECSearchFileDownloadStatus["DOWNLOADED"] = 1] = "DOWNLOADED";
395
+ ECSearchFileDownloadStatus[ECSearchFileDownloadStatus["QUEUED"] = 2] = "QUEUED";
396
+ ECSearchFileDownloadStatus[ECSearchFileDownloadStatus["CANCELED"] = 3] = "CANCELED";
397
+ ECSearchFileDownloadStatus[ECSearchFileDownloadStatus["QUEUEDCANCELED"] = 4] = "QUEUEDCANCELED";
398
+ return ECSearchFileDownloadStatus;
399
+ }({});
392
400
  let EcPrefs = /* @__PURE__ */ function(EcPrefs) {
393
401
  EcPrefs[EcPrefs["EC_PREFS_CATEGORIES"] = 1] = "EC_PREFS_CATEGORIES";
394
402
  EcPrefs[EcPrefs["EC_PREFS_GENERAL"] = 2] = "EC_PREFS_GENERAL";
@@ -406,6 +414,263 @@ let EcPrefs = /* @__PURE__ */ function(EcPrefs) {
406
414
  return EcPrefs;
407
415
  }({});
408
416
  //#endregion
409
- export { EcPrefs as a, ECTagName as i, ECOpCode as n, ProtocolVersion as o, ECSearchType as r, ECDetailLevel as t };
410
-
411
- //# sourceMappingURL=Codes-CjiW7Pdl.mjs.map
417
+ //#region src/ec/tag/Tag.ts
418
+ var Tag = class {
419
+ name;
420
+ type;
421
+ nameValue;
422
+ value;
423
+ nestedTags;
424
+ constructor(name, type, nestedTags = [], nameValue = name) {
425
+ this.name = name;
426
+ this.type = type;
427
+ this.nameValue = nameValue;
428
+ if (nestedTags.length > 0) this.nestedTags = nestedTags;
429
+ }
430
+ getValue() {
431
+ return this.value;
432
+ }
433
+ setValue(value) {
434
+ this.value = value;
435
+ }
436
+ };
437
+ var CustomTag = class extends Tag {
438
+ constructor(name, value, subtags = [], nameValue = name) {
439
+ super(name, 1, subtags, nameValue);
440
+ if (value !== void 0) this.setValue(value);
441
+ }
442
+ parseValue(value) {
443
+ this.setValue(value);
444
+ }
445
+ encodeValue() {
446
+ return this.getValue();
447
+ }
448
+ };
449
+ var UByteTag = class UByteTag extends Tag {
450
+ constructor(name, value, subtags = [], nameValue = name) {
451
+ super(name, 2, subtags, nameValue);
452
+ if (value !== void 0) this.setValue(value);
453
+ }
454
+ static withValue(name, value, subtags = []) {
455
+ return new UByteTag(name, value, subtags);
456
+ }
457
+ parseValue(value) {
458
+ if (value.length === 0) this.setValue(0);
459
+ else if (value.length === 1) this.setValue(value[0]);
460
+ else throw new Error("UInt8Tag value must be 1 byte long");
461
+ }
462
+ encodeValue() {
463
+ const buf = Buffer.allocUnsafe(1);
464
+ buf.writeUInt8(this.getValue());
465
+ return buf;
466
+ }
467
+ getShort() {
468
+ return this.getValue();
469
+ }
470
+ getInt() {
471
+ return this.getValue();
472
+ }
473
+ getLong() {
474
+ return BigInt(this.getValue());
475
+ }
476
+ };
477
+ var UShortTag = class UShortTag extends Tag {
478
+ constructor(name, value, subtags = [], nameValue = name) {
479
+ super(name, 3, subtags, nameValue);
480
+ if (value !== void 0) this.setValue(value);
481
+ }
482
+ static withValue(name, value, subtags = []) {
483
+ return new UShortTag(name, value, subtags);
484
+ }
485
+ parseValue(value) {
486
+ if (value.length === 0) this.setValue(0);
487
+ else if (value.length === 2) this.setValue(value.readUInt16BE(0));
488
+ else throw new Error("UInt16Tag value must be 2 bytes long");
489
+ }
490
+ encodeValue() {
491
+ const buf = Buffer.allocUnsafe(2);
492
+ buf.writeUInt16BE(this.getValue());
493
+ return buf;
494
+ }
495
+ getShort() {
496
+ return this.getValue();
497
+ }
498
+ getInt() {
499
+ return this.getValue();
500
+ }
501
+ getLong() {
502
+ return BigInt(this.getValue());
503
+ }
504
+ };
505
+ var UIntTag = class UIntTag extends Tag {
506
+ constructor(name, value, subtags = [], nameValue = name) {
507
+ super(name, 4, subtags, nameValue);
508
+ if (value !== void 0) this.setValue(value);
509
+ }
510
+ static withValue(name, value, subtags = []) {
511
+ return new UIntTag(name, value, subtags);
512
+ }
513
+ parseValue(value) {
514
+ if (value.length === 0) this.setValue(0);
515
+ else if (value.length === 4) this.setValue(value.readUInt32BE(0));
516
+ else throw new Error("UInt32Tag value must be 4 bytes long");
517
+ }
518
+ encodeValue() {
519
+ const buf = Buffer.allocUnsafe(4);
520
+ buf.writeUInt32BE(this.getValue());
521
+ return buf;
522
+ }
523
+ getShort() {
524
+ throw new Error("Unsigned Integer cannot be cast to short");
525
+ }
526
+ getInt() {
527
+ return this.getValue();
528
+ }
529
+ getLong() {
530
+ return BigInt(this.getValue());
531
+ }
532
+ };
533
+ var ULongTag = class ULongTag extends Tag {
534
+ constructor(name, value, subtags = [], nameValue = name) {
535
+ super(name, 5, subtags, nameValue);
536
+ if (value !== void 0) this.setValue(value);
537
+ }
538
+ static withValue(name, value, subtags = []) {
539
+ return new ULongTag(name, value, subtags);
540
+ }
541
+ parseValue(value) {
542
+ if (value.length === 0) this.setValue(0n);
543
+ else if (value.length === 8) this.setValue(value.readBigUInt64BE(0));
544
+ else throw new Error("UInt64Tag value must be 8 bytes long");
545
+ }
546
+ encodeValue() {
547
+ const buf = Buffer.allocUnsafe(8);
548
+ buf.writeBigUInt64BE(this.getValue());
549
+ return buf;
550
+ }
551
+ getShort() {
552
+ throw new Error("Unsigned Long cannot be cast to short");
553
+ }
554
+ getInt() {
555
+ throw new Error("Unsigned Long cannot be cast to int");
556
+ }
557
+ getLong() {
558
+ return this.getValue();
559
+ }
560
+ };
561
+ var UInt128Tag = class UInt128Tag extends Tag {
562
+ constructor(name, value, subtags = [], nameValue = name) {
563
+ super(name, 10, subtags, nameValue);
564
+ if (value !== void 0) this.setValue(value);
565
+ }
566
+ static withValue(name, value, subtags = []) {
567
+ return new UInt128Tag(name, value, subtags);
568
+ }
569
+ parseValue(value) {
570
+ if (value.length === 0) this.setValue(0n);
571
+ else {
572
+ let result = 0n;
573
+ for (let i = 0; i < value.length; i++) result = result << 8n | BigInt(value[i]);
574
+ this.setValue(result);
575
+ }
576
+ }
577
+ encodeValue() {
578
+ const val = this.getValue();
579
+ const bytes = [];
580
+ let remaining = val;
581
+ while (remaining > 0n) {
582
+ bytes.unshift(Number(remaining & 255n));
583
+ remaining >>= 8n;
584
+ }
585
+ while (bytes.length < 16) bytes.unshift(0);
586
+ return Buffer.from(bytes);
587
+ }
588
+ };
589
+ var StringTag = class StringTag extends Tag {
590
+ constructor(name, value, subtags = [], nameValue = name) {
591
+ super(name, 6, subtags, nameValue);
592
+ if (value !== void 0) this.setValue(value);
593
+ }
594
+ static withValue(name, value, subtags = []) {
595
+ return new StringTag(name, value, subtags);
596
+ }
597
+ parseValue(value) {
598
+ if (value[value.length - 1] !== 0) throw new Error("StringTag value must be null terminated");
599
+ this.setValue(value.toString("utf8", 0, value.length - 1));
600
+ }
601
+ encodeValue() {
602
+ return Buffer.concat([Buffer.from(this.getValue(), "utf8"), Buffer.from([0])]);
603
+ }
604
+ };
605
+ var DoubleTag = class DoubleTag extends Tag {
606
+ constructor(name, value, subtags = [], nameValue = name) {
607
+ super(name, 7, subtags, nameValue);
608
+ if (value !== void 0) this.setValue(value);
609
+ }
610
+ static withValue(name, value, subtags = []) {
611
+ return new DoubleTag(name, value, subtags);
612
+ }
613
+ parseValue(value) {
614
+ const numValue = value.length >= 8 ? value.readDoubleBE(0) : 0;
615
+ this.setValue(numValue);
616
+ }
617
+ encodeValue() {
618
+ const buf = Buffer.allocUnsafe(8);
619
+ buf.writeDoubleBE(this.getValue());
620
+ return buf;
621
+ }
622
+ };
623
+ var Ipv4Tag = class Ipv4Tag extends Tag {
624
+ constructor(name, value, subtags = [], nameValue = name) {
625
+ super(name, 8, subtags, nameValue);
626
+ if (value !== void 0) this.setValue(value);
627
+ }
628
+ static withValue(name, value, subtags = []) {
629
+ return new Ipv4Tag(name, value, subtags);
630
+ }
631
+ parseValue(value) {
632
+ if (value.length !== 6) throw new Error("Ipv4Tag value must be 6 bytes long");
633
+ const address = `${value[0]}.${value[1]}.${value[2]}.${value[3]}`;
634
+ const port = value.readUInt16BE(4);
635
+ this.setValue({
636
+ address,
637
+ port
638
+ });
639
+ }
640
+ encodeValue() {
641
+ const val = this.getValue();
642
+ const parts = val.address.split(".").map(Number);
643
+ const buf = Buffer.allocUnsafe(6);
644
+ buf[0] = parts[0];
645
+ buf[1] = parts[1];
646
+ buf[2] = parts[2];
647
+ buf[3] = parts[3];
648
+ buf.writeUInt16BE(val.port, 4);
649
+ return buf;
650
+ }
651
+ };
652
+ var Hash16Tag = class Hash16Tag extends Tag {
653
+ constructor(name, value, subtags = [], nameValue = name) {
654
+ super(name, 9, subtags, nameValue);
655
+ if (value !== void 0) this.setValue(value);
656
+ }
657
+ static withValue(name, value, subtags = []) {
658
+ return new Hash16Tag(name, value, subtags);
659
+ }
660
+ parseValue(value) {
661
+ if (value.length === 16) this.setValue(value);
662
+ else throw new Error("Hash16Tag value must be 16 bytes long");
663
+ }
664
+ encodeValue() {
665
+ return this.getValue();
666
+ }
667
+ };
668
+ function findTag(tags, name) {
669
+ return tags.find((tag) => tag.name === name);
670
+ }
671
+ function findNumericTag(tags, name) {
672
+ const tag = tags.find((tag) => tag.name === name);
673
+ if (tag && "getInt" in tag && "getShort" in tag && "getLong" in tag) return tag;
674
+ }
675
+ //#endregion
676
+ export { ECSearchType as _, StringTag as a, ProtocolVersion as b, UInt128Tag as c, UShortTag as d, findNumericTag as f, ECSearchFileDownloadStatus as g, ECOpCode as h, Ipv4Tag as i, UIntTag as l, ECDetailLevel as m, DoubleTag as n, Tag as o, findTag as p, Hash16Tag as r, UByteTag as s, CustomTag as t, ULongTag as u, ECTagName as v, EcPrefs as y };
@@ -1,6 +1,5 @@
1
- import { t as Request } from "./Request-C0UUuQIX.mjs";
2
- import "./Codes-CjiW7Pdl.mjs";
3
- import { a as StringTag, l as UIntTag, s as UByteTag } from "./Tag-CZF6BRMY.mjs";
1
+ import { t as Request } from "./Request-BvScDpeu.js";
2
+ import { a as StringTag, l as UIntTag, s as UByteTag } from "./Tag-B5gWV2XF.js";
4
3
  //#region src/request/UpdateCategoryRequest.ts
5
4
  /**
6
5
  * Update Category Request - Update an existing category
@@ -20,5 +19,3 @@ var UpdateCategoryRequest = class extends Request {
20
19
  };
21
20
  //#endregion
22
21
  export { UpdateCategoryRequest };
23
-
24
- //# sourceMappingURL=UpdateCategoryRequest-CgzH7SxP.mjs.map
@@ -1,6 +1,5 @@
1
- import { t as Request } from "./Request-C0UUuQIX.mjs";
2
- import "./Codes-CjiW7Pdl.mjs";
3
- import { s as UByteTag } from "./Tag-CZF6BRMY.mjs";
1
+ import { t as Request } from "./Request-BvScDpeu.js";
2
+ import { s as UByteTag } from "./Tag-B5gWV2XF.js";
4
3
  //#region src/request/UpdateRequest.ts
5
4
  /**
6
5
  * Update Request - Get incremental updates for files, clients, and servers
@@ -13,5 +12,3 @@ var UpdateRequest = class extends Request {
13
12
  };
14
13
  //#endregion
15
14
  export { UpdateRequest };
16
-
17
- //# sourceMappingURL=UpdateRequest-Bunl73Ga.mjs.map