itd-api 0.12.1 → 0.13.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 (90) hide show
  1. package/dist/events/index.cjs +4 -4
  2. package/dist/events/index.d.cts +7 -2
  3. package/dist/events/index.d.ts +7 -2
  4. package/dist/events/index.js +4 -4
  5. package/dist/index.cjs +672 -90
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +497 -46
  8. package/dist/index.d.ts +497 -46
  9. package/dist/index.js +664 -91
  10. package/dist/index.js.map +1 -1
  11. package/dist/node/index.cjs +6 -7
  12. package/dist/node/index.cjs.map +1 -1
  13. package/dist/node/index.d.cts +24 -7
  14. package/dist/node/index.d.ts +24 -7
  15. package/dist/node/index.js +6 -7
  16. package/dist/node/index.js.map +1 -1
  17. package/dist/rest/index.cjs +19 -7
  18. package/dist/rest/index.cjs.map +1 -1
  19. package/dist/rest/index.d.cts +28 -7
  20. package/dist/rest/index.d.ts +28 -7
  21. package/dist/rest/index.js +17 -8
  22. package/dist/rest/index.js.map +1 -1
  23. package/dist/shared/{contracts-BoT7msmq.d.ts → contracts-DEbkC0cB.d.cts} +1 -4
  24. package/dist/shared/{contracts-BoT7msmq.d.cts → contracts-pxnDIsQP.d.ts} +1 -4
  25. package/dist/shared/{events-FaXfdle0.d.cts → events-B6uqXOSs.d.cts} +42 -63
  26. package/dist/shared/{events-_iYo8EP5.js → events-C_MgYlXR.js} +30 -40
  27. package/dist/shared/events-C_MgYlXR.js.map +1 -0
  28. package/dist/shared/{events-BKyxZQNw.cjs → events-DV1i1t6J.cjs} +30 -40
  29. package/dist/shared/events-DV1i1t6J.cjs.map +1 -0
  30. package/dist/shared/{events-9215JDDd.d.ts → events-D_aMNrPd.d.ts} +2 -23
  31. package/dist/shared/{key-value-store-DYSPsqwq.cjs → key-value-store-6DHm_iNW.cjs} +3 -4
  32. package/dist/shared/{key-value-store-DYSPsqwq.cjs.map → key-value-store-6DHm_iNW.cjs.map} +1 -1
  33. package/dist/shared/{key-value-store-COZaNHZS.d.ts → key-value-store-BGoSgLze.d.cts} +1 -4
  34. package/dist/shared/{key-value-store-w1Dn5Pjb.js → key-value-store-PnZE_DFC.js} +3 -4
  35. package/dist/shared/{key-value-store-w1Dn5Pjb.js.map → key-value-store-PnZE_DFC.js.map} +1 -1
  36. package/dist/shared/{key-value-store-COZaNHZS.d.cts → key-value-store-WUQBeTAr.d.ts} +1 -4
  37. package/dist/shared/{multi-storage-DiBSx64p.js → multi-storage-DM0skcSO.js} +6 -7
  38. package/dist/shared/{multi-storage-DiBSx64p.js.map → multi-storage-DM0skcSO.js.map} +1 -1
  39. package/dist/shared/{multi-storage-LkljOSzA.d.ts → multi-storage-DQiERirK.d.ts} +3 -6
  40. package/dist/shared/{multi-storage-7Y3KCseI.cjs → multi-storage-DnonVBfO.cjs} +6 -7
  41. package/dist/shared/multi-storage-DnonVBfO.cjs.map +1 -0
  42. package/dist/shared/{multi-storage-BEL7tcKn.d.cts → multi-storage-OGWNMK3x.d.cts} +3 -6
  43. package/dist/shared/{options-D5ttspWk.cjs → options-SvAWOaqT.cjs} +8 -12
  44. package/dist/shared/{options-D5ttspWk.cjs.map → options-SvAWOaqT.cjs.map} +1 -1
  45. package/dist/shared/{options-DLlaETn_.js → options-bS27r_gR.js} +8 -12
  46. package/dist/shared/{options-DLlaETn_.js.map → options-bS27r_gR.js.map} +1 -1
  47. package/dist/shared/{redact-DSfdmeY7.js → redact-C4b2NzdB.js} +16 -16
  48. package/dist/shared/redact-C4b2NzdB.js.map +1 -0
  49. package/dist/shared/{redact-BbhtA9o-.cjs → redact-DDGkv8KF.cjs} +16 -16
  50. package/dist/shared/redact-DDGkv8KF.cjs.map +1 -0
  51. package/dist/shared/{render-BQvC5UxF.cjs → render-0-JJPOwb.cjs} +204 -109
  52. package/dist/shared/render-0-JJPOwb.cjs.map +1 -0
  53. package/dist/shared/{render-CFoF2WaH.js → render-CF49aBO8.js} +181 -110
  54. package/dist/shared/render-CF49aBO8.js.map +1 -0
  55. package/dist/shared/{render-X2JCo1JS.d.cts → render-CYVOc_IW.d.cts} +152 -251
  56. package/dist/shared/{render-BS09ygcy.d.ts → render-eOxYgdoA.d.ts} +152 -102
  57. package/dist/shared/{storage-86wiHeXD.js → storage-B6OkSi38.js} +4 -5
  58. package/dist/shared/{storage-86wiHeXD.js.map → storage-B6OkSi38.js.map} +1 -1
  59. package/dist/shared/{storage-CTRGT5wF.d.ts → storage-C_ZujAZt.d.ts} +2 -5
  60. package/dist/shared/{storage-CIjejZDt.cjs → storage-CezF2Mvz.cjs} +4 -5
  61. package/dist/shared/{storage-CIjejZDt.cjs.map → storage-CezF2Mvz.cjs.map} +1 -1
  62. package/dist/shared/{storage-BQrtKon9.d.cts → storage-FtS4NIC7.d.cts} +2 -5
  63. package/dist/shared/{url-CdT4lMxQ.js → url-CPKhcxf1.js} +250 -91
  64. package/dist/shared/url-CPKhcxf1.js.map +1 -0
  65. package/dist/shared/{url-_R0oJ7gE.d.ts → url-DCqxoxGX.d.cts} +1903 -1623
  66. package/dist/shared/{url-_R0oJ7gE.d.cts → url-DL5Mip4L.d.ts} +209 -78
  67. package/dist/shared/{url-ioIaywDi.cjs → url-DOfjru6L.cjs} +250 -91
  68. package/dist/shared/url-DOfjru6L.cjs.map +1 -0
  69. package/dist/shared/{validate-D7_kq3g5.js → validate-B5l_vLKD.js} +5 -7
  70. package/dist/shared/validate-B5l_vLKD.js.map +1 -0
  71. package/dist/shared/{validate-CFx2dISs.cjs → validate-CfxCK1BC.cjs} +5 -7
  72. package/dist/shared/validate-CfxCK1BC.cjs.map +1 -0
  73. package/dist/web/index.cjs +4 -5
  74. package/dist/web/index.cjs.map +1 -1
  75. package/dist/web/index.d.cts +22 -5
  76. package/dist/web/index.d.ts +22 -5
  77. package/dist/web/index.js +4 -5
  78. package/dist/web/index.js.map +1 -1
  79. package/package.json +6 -6
  80. package/dist/shared/events-BKyxZQNw.cjs.map +0 -1
  81. package/dist/shared/events-_iYo8EP5.js.map +0 -1
  82. package/dist/shared/multi-storage-7Y3KCseI.cjs.map +0 -1
  83. package/dist/shared/redact-BbhtA9o-.cjs.map +0 -1
  84. package/dist/shared/redact-DSfdmeY7.js.map +0 -1
  85. package/dist/shared/render-BQvC5UxF.cjs.map +0 -1
  86. package/dist/shared/render-CFoF2WaH.js.map +0 -1
  87. package/dist/shared/url-CdT4lMxQ.js.map +0 -1
  88. package/dist/shared/url-ioIaywDi.cjs.map +0 -1
  89. package/dist/shared/validate-CFx2dISs.cjs.map +0 -1
  90. package/dist/shared/validate-D7_kq3g5.js.map +0 -1
@@ -1,9 +1,9 @@
1
- import { $ as OperationMethod, A as ReportTargetType, J as pickArray, M as SpanType, Q as pickString, S as InteractionType, X as pickNumber, Y as pickBoolean, Z as pickObject, c as normalizeNotification, dt as DEFAULT_STATUS_BASE_URL, et as RetrySafety, ft as STATUS_SERVICE, gt as createDeadline, k as ReportReason, nt as identityResult, o as passthroughOperation, ot as mergeService, rt as voidResult, s as voidOperation, tt as defineOperation, z as defineBuiltInOperation } from "./url-CdT4lMxQ.js";
2
- import { T as isItdApiError, a as ItdAbortError, d as ItdError, l as ItdConfigError, m as ItdFileErrorReason, n as isRecord, p as ItdFileError, x as ItdStateError } from "./validate-D7_kq3g5.js";
3
- import { a as redactUrl, b as isBlob, f as encodePathSegment, r as redactErrorCause, x as isFile, y as createDeviceId } from "./redact-DSfdmeY7.js";
4
- import { a as fileTooLarge, c as FileTransferMode, i as isReadableByteStream, n as boundedFileStream, o as optionalBytes, r as isBoundedFileStream, s as DEFAULT_URL_FILE_MAX_BYTES, t as resolveFileStreamOptions } from "./options-DLlaETn_.js";
5
- import { r as createKeyValueStore } from "./key-value-store-w1Dn5Pjb.js";
6
- //#region src/core/feature-catalog.ts
1
+ import { $ as OperationMethod, A as ReportTargetType, J as pickArray, M as SpanType, Q as pickString, S as InteractionType, X as pickNumber, Y as pickBoolean, Z as pickObject, c as normalizeNotification, dt as DEFAULT_STATUS_BASE_URL, et as RetrySafety, ft as STATUS_SERVICE, gt as createDeadline, k as ReportReason, nt as identityResult, o as passthroughOperation, ot as mergeService, rt as voidResult, s as voidOperation, tt as defineOperation, z as defineBuiltInOperation } from "./url-CPKhcxf1.js";
2
+ import { T as isItdApiError, a as ItdAbortError, d as ItdError, l as ItdConfigError, m as ItdFileErrorReason, n as isRecord, p as ItdFileError, x as ItdStateError } from "./validate-B5l_vLKD.js";
3
+ import { a as redactUrl, b as isBlob, f as encodePathSegment, r as redactErrorCause, x as isFile, y as createDeviceId } from "./redact-C4b2NzdB.js";
4
+ import { a as fileTooLarge, c as FileTransferMode, i as isReadableByteStream, n as boundedFileStream, o as optionalBytes, r as isBoundedFileStream, s as DEFAULT_URL_FILE_MAX_BYTES, t as resolveFileStreamOptions } from "./options-bS27r_gR.js";
5
+ import { r as createKeyValueStore } from "./key-value-store-PnZE_DFC.js";
6
+ // src/core/feature-catalog.ts
7
7
  /**
8
8
  * Изменяемый слой над каталогом конкретного API.
9
9
  *
@@ -73,8 +73,7 @@ var ExtensibleOperationCatalog = class {
73
73
  };
74
74
  }
75
75
  };
76
- //#endregion
77
- //#region src/core/attachments/url-source.ts
76
+ // src/core/attachments/url-source.ts
78
77
  /** Убирает параметры MIME и приводит его к форме для сравнения. */
79
78
  function normalizeMimeType(contentType) {
80
79
  return contentType?.split(";", 1)[0]?.trim().toLowerCase() || void 0;
@@ -212,8 +211,7 @@ async function openUrlFile(target, options, context) {
212
211
  close: () => stream.cancel().catch(() => {})
213
212
  };
214
213
  }
215
- //#endregion
216
- //#region src/core/attachments/resolver.ts
214
+ // src/core/attachments/resolver.ts
217
215
  /** Возвращает функцию освобождения, которая исполняет действие не более одного раза. */
218
216
  function closeOnce(action) {
219
217
  let closing;
@@ -361,8 +359,7 @@ var DefaultFileResolver = class {
361
359
  function createFileResolver(fetchImplementation) {
362
360
  return new DefaultFileResolver(fetchImplementation);
363
361
  }
364
- //#endregion
365
- //#region src/core/features.ts
362
+ // src/core/features.ts
366
363
  var FeatureInstallationTransaction = class {
367
364
  #cleanup = [];
368
365
  add(cleanup) {
@@ -645,8 +642,7 @@ var FeatureRegistry = class {
645
642
  if (errors.length > 0) throw new AggregateError(errors, "Не удалось освободить feature");
646
643
  }
647
644
  };
648
- //#endregion
649
- //#region src/core/managed-resources.ts
645
+ // src/core/managed-resources.ts
650
646
  /** Реестр активных ресурсов клиента. @internal */
651
647
  var ManagedResourceRegistry = class {
652
648
  #resources = /* @__PURE__ */ new Set();
@@ -681,8 +677,7 @@ var ManagedResourceRegistry = class {
681
677
  this.#resources.clear();
682
678
  }
683
679
  };
684
- //#endregion
685
- //#region src/core/feature-host.ts
680
+ // src/core/feature-host.ts
686
681
  /**
687
682
  * Управляет подключаемыми модулями и их ресурсами.
688
683
  *
@@ -775,8 +770,7 @@ var ClientFeatureHost = class {
775
770
  function createFeatureHost(runtime, options) {
776
771
  return new ClientFeatureHost(runtime, options);
777
772
  }
778
- //#endregion
779
- //#region src/resources/pagination.ts
773
+ // src/resources/pagination.ts
780
774
  /** Схема пагинации эндпоинта. */
781
775
  const PaginationMode = Object.freeze({
782
776
  /** Следующая страница запрашивается непрозрачным курсором. */
@@ -1013,8 +1007,7 @@ var Paginator = class {
1013
1007
  return { offset: page.nextOffset ?? (previous.offset ?? 0) + page.items.length };
1014
1008
  }
1015
1009
  };
1016
- //#endregion
1017
- //#region src/resources/base.ts
1010
+ // src/resources/base.ts
1018
1011
  /** Общая основа всех групп методов клиента. */
1019
1012
  var BaseResource = class {
1020
1013
  /** @internal */
@@ -1090,8 +1083,7 @@ function withPageState(query, state) {
1090
1083
  ...state.offset !== void 0 ? { offset: state.offset } : {}
1091
1084
  };
1092
1085
  }
1093
- //#endregion
1094
- //#region src/resources/notifications.ts
1086
+ // src/resources/notifications.ts
1095
1087
  const NOTIFICATIONS_LIST = pageOperation("notifications.list", (body, request) => {
1096
1088
  const offset = Number(request.query?.offset ?? 0);
1097
1089
  const page = readOffsetPage(body, "notifications", Number.isFinite(offset) ? offset : 0);
@@ -1248,8 +1240,27 @@ var NotificationsResource = class extends BaseResource {
1248
1240
  });
1249
1241
  }
1250
1242
  };
1251
- //#endregion
1252
- //#region src/domain/time.ts
1243
+ // src/resources/account/lifecycle.ts
1244
+ const ACCOUNT_DEACTIVATE = voidOperation("account.deactivate");
1245
+ const ACCOUNT_RESTORE = voidOperation("account.restore");
1246
+ /** Деактивация и восстановление текущего аккаунта. */
1247
+ var AccountLifecycleResource = class extends BaseResource {
1248
+ /** Деактивирует аккаунт. Вернуть его можно через {@link restore}. */
1249
+ deactivate(options = {}) {
1250
+ return this.voidOperation(ACCOUNT_DEACTIVATE, {
1251
+ path: "/api/users/me",
1252
+ ...options
1253
+ });
1254
+ }
1255
+ /** Восстанавливает деактивированный аккаунт. */
1256
+ restore(options = {}) {
1257
+ return this.voidOperation(ACCOUNT_RESTORE, {
1258
+ path: "/api/users/me/restore",
1259
+ ...options
1260
+ });
1261
+ }
1262
+ };
1263
+ // src/domain/time.ts
1253
1264
  /**
1254
1265
  * Отметка времени PostgreSQL: `2026-07-23 23:14:25`, возможно с долями секунды и смещением
1255
1266
  * пояса (`+03`, `+05:30`).
@@ -1302,8 +1313,7 @@ function toDate(value) {
1302
1313
  const date = new Date(value);
1303
1314
  return Number.isFinite(date.getTime()) ? date : null;
1304
1315
  }
1305
- //#endregion
1306
- //#region src/resources/status.ts
1316
+ // src/resources/status.ts
1307
1317
  /** Приводит `last_checked` каждого сервиса к ISO. Остальное остаётся как прислал сервер. */
1308
1318
  function normalizeStatus(body) {
1309
1319
  if (!isRecord(body) || !Array.isArray(body.services)) return body;
@@ -1346,8 +1356,7 @@ function createStatusFeature() {
1346
1356
  setup: (context) => ({ api: new StatusResource(context) })
1347
1357
  };
1348
1358
  }
1349
- //#endregion
1350
- //#region src/builders/base.ts
1359
+ // src/builders/base.ts
1351
1360
  /** Метка билдера. Через `Symbol.for` — чтобы распознавание переживало смешивание ESM и CJS. */
1352
1361
  const BUILDER = Symbol.for("itd.builder");
1353
1362
  /** Является ли значение билдером. */
@@ -1372,8 +1381,7 @@ function resolveInput(input, factory, validate) {
1372
1381
  if (isBuilder(input)) return input.build();
1373
1382
  return validate(input);
1374
1383
  }
1375
- //#endregion
1376
- //#region src/builders/comment.ts
1384
+ // src/builders/comment.ts
1377
1385
  /**
1378
1386
  * Проверяет данные комментария.
1379
1387
  *
@@ -1504,8 +1512,7 @@ function resolveComment(input, allowReplyTo = false) {
1504
1512
  if (!allowReplyTo && resolved.replyToUserId !== void 0) throw new ItdConfigError("replyTo применим только к ответу на комментарий (itd.comments.reply). В комментарии к посту адресат не указывается.");
1505
1513
  return resolved;
1506
1514
  }
1507
- //#endregion
1508
- //#region src/domain/content.ts
1515
+ // src/domain/content.ts
1509
1516
  /** Поле с датой, приведённой к ISO-8601; без строкового значения поле не появляется. */
1510
1517
  function isoField(key, value) {
1511
1518
  return typeof value === "string" ? { [key]: utcStampToIso(value) } : {};
@@ -1552,8 +1559,7 @@ function normalizeCommentUpdate(body) {
1552
1559
  editedAt: utcStampToIso(result.editedAt)
1553
1560
  };
1554
1561
  }
1555
- //#endregion
1556
- //#region src/resources/content-operations.ts
1562
+ // src/resources/content-operations.ts
1557
1563
  /** Операция, которая возвращает один пост. */
1558
1564
  function postOperation(id) {
1559
1565
  return defineBuiltInOperation(id, (body) => normalizePost(body));
@@ -1566,8 +1572,7 @@ function postPageOperation(id) {
1566
1572
  function commentOperation(id) {
1567
1573
  return defineBuiltInOperation(id, (body) => normalizeComment(body));
1568
1574
  }
1569
- //#endregion
1570
- //#region src/resources/comments.ts
1575
+ // src/resources/comments.ts
1571
1576
  const COMMENTS_REPLIES = pageOperation("comments.replies", (body) => mapPage(readPagedPage(body, "replies"), normalizeComment));
1572
1577
  const COMMENTS_REPLY = commentOperation("comments.reply");
1573
1578
  const COMMENTS_UPDATE = defineBuiltInOperation("comments.update", normalizeCommentUpdate);
@@ -1674,8 +1679,7 @@ var CommentsResource = class extends BaseResource {
1674
1679
  });
1675
1680
  }
1676
1681
  };
1677
- //#endregion
1678
- //#region src/core/multipart.ts
1682
+ // src/core/multipart.ts
1679
1683
  const encoder = new TextEncoder();
1680
1684
  /** Убирает возможность внедрить дополнительный multipart-заголовок через имя файла. */
1681
1685
  function quotedFilename(filename) {
@@ -1738,8 +1742,7 @@ function createMultipartFileBody(file) {
1738
1742
  cancel
1739
1743
  };
1740
1744
  }
1741
- //#endregion
1742
- //#region src/domain/mime.ts
1745
+ // src/domain/mime.ts
1743
1746
  /** Изображения, которые принимает `POST /api/files/upload`. */
1744
1747
  const IMAGE_MIME_TYPES = Object.freeze([
1745
1748
  "image/jpeg",
@@ -1811,9 +1814,9 @@ function assertAllowedMime(mimeType, filename) {
1811
1814
  if (!mimeType) throw new ItdConfigError(`Не удалось определить тип файла${filename ? ` «${filename}»` : ""}. Укажите его явно: { file, filename, contentType }.`);
1812
1815
  if (!isAllowedMime(mimeType)) throw new ItdConfigError(`Тип «${mimeType}» не поддерживается загрузкой. Допустимые: ${ALLOWED_MIME_TYPES.join(", ")}.`);
1813
1816
  }
1814
- //#endregion
1815
- //#region src/resources/files.ts
1817
+ // src/resources/files.ts
1816
1818
  const FILES_UPLOAD = passthroughOperation("files.upload");
1819
+ const FILES_UPLOAD_BANNER_DRAWING = passthroughOperation("files.uploadBannerDrawing");
1817
1820
  const FILES_REMOVE = voidOperation("files.remove");
1818
1821
  /** Файлы и медиа. */
1819
1822
  var FilesResource = class extends BaseResource {
@@ -1837,6 +1840,20 @@ var FilesResource = class extends BaseResource {
1837
1840
  timeout: requestOptions.timeout ?? 3e5
1838
1841
  });
1839
1842
  }
1843
+ /**
1844
+ * Отправляет описание рисунка и возвращает созданное сервером изображение.
1845
+ *
1846
+ * Чтобы установить баннер, передайте полученный `id` в
1847
+ * `itd.users.updateMe({ bannerId: id })`.
1848
+ */
1849
+ uploadBannerDrawing(drawing, options = {}) {
1850
+ return this.http.execute(FILES_UPLOAD_BANNER_DRAWING, {
1851
+ path: "/api/files/banner-drawing",
1852
+ body: drawing,
1853
+ ...options,
1854
+ timeout: options.timeout ?? 3e5
1855
+ });
1856
+ }
1840
1857
  /** Загружает несколько файлов последовательно, сохраняя порядок. */
1841
1858
  async uploadMany(files, uploadOptions = {}, requestOptions = {}) {
1842
1859
  const ids = [];
@@ -1914,8 +1931,7 @@ var FilesResource = class extends BaseResource {
1914
1931
  return extension ? `file.${extension}` : "file";
1915
1932
  }
1916
1933
  };
1917
- //#endregion
1918
- //#region src/resources/hashtags.ts
1934
+ // src/resources/hashtags.ts
1919
1935
  const HASHTAG_POSTS = postPageOperation("hashtags.posts");
1920
1936
  const HASHTAGS_TRENDING = defineBuiltInOperation("hashtags.trending", (body) => pickArray(body, "hashtags"));
1921
1937
  /**
@@ -1960,8 +1976,88 @@ var HashtagsResource = class extends BaseResource {
1960
1976
  }, options);
1961
1977
  }
1962
1978
  };
1963
- //#endregion
1964
- //#region src/resources/platform.ts
1979
+ // src/models/legal.ts
1980
+ /** Область действия документа. */
1981
+ const LegalDocumentScope = Object.freeze({ Social: "social" });
1982
+ /** Виды блоков текста документа. */
1983
+ const LegalDocumentBlockType = Object.freeze({
1984
+ Heading: "heading",
1985
+ List: "list",
1986
+ Lines: "lines"
1987
+ });
1988
+ // src/resources/legal.ts
1989
+ const LEGAL_PATH = "/api/legal-documents";
1990
+ /** Путь документа с отдельно закодированными областью и идентификатором. */
1991
+ function documentPath(scope, slug) {
1992
+ return `${LEGAL_PATH}/${encodePathSegment(scope, "scope")}/${encodePathSegment(slug, "slug")}`;
1993
+ }
1994
+ /** Извлекает редакцию из внешнего поля `document`. */
1995
+ function readDocument(body) {
1996
+ const document = pickObject(body, "document");
1997
+ if (!document) throw new ItdConfigError("Сервер не вернул документ");
1998
+ return document;
1999
+ }
2000
+ const LEGAL_LIST = defineBuiltInOperation("legal.list", (body) => pickArray(body, "documents"));
2001
+ const LEGAL_CURRENT = defineBuiltInOperation("legal.current", readDocument);
2002
+ const LEGAL_VERSIONS = defineBuiltInOperation("legal.versions", (body) => pickArray(body, "versions"));
2003
+ const LEGAL_VERSION = defineBuiltInOperation("legal.version", readDocument);
2004
+ /** Публичные документы ИТД и история их редакций. Доступны через `itd.legal`. */
2005
+ var LegalResource = class extends BaseResource {
2006
+ /**
2007
+ * Возвращает список документов выбранной области.
2008
+ *
2009
+ * В списке указаны действующие редакции. Полный текст загружается через {@link current}.
2010
+ */
2011
+ list(scope = LegalDocumentScope.Social, options = {}) {
2012
+ return this.http.execute(LEGAL_LIST, {
2013
+ path: LEGAL_PATH,
2014
+ query: { scope },
2015
+ skipAuth: true,
2016
+ skipAuthRefresh: true,
2017
+ ...options
2018
+ });
2019
+ }
2020
+ /**
2021
+ * Загружает действующую редакцию документа с полным текстом.
2022
+ *
2023
+ * @example
2024
+ * ```ts
2025
+ * const terms = await itd.legal.current(LegalDocumentScope.Social, 'terms');
2026
+ * console.log(terms.version, terms.blocks);
2027
+ * ```
2028
+ */
2029
+ current(scope, slug, options = {}) {
2030
+ return this.http.execute(LEGAL_CURRENT, {
2031
+ path: documentPath(scope, slug),
2032
+ skipAuth: true,
2033
+ skipAuthRefresh: true,
2034
+ ...options
2035
+ });
2036
+ }
2037
+ /** Возвращает историю редакций без текста. Поле `current` отмечает действующую редакцию. */
2038
+ versions(scope, slug, options = {}) {
2039
+ return this.http.execute(LEGAL_VERSIONS, {
2040
+ path: `${documentPath(scope, slug)}/versions`,
2041
+ skipAuth: true,
2042
+ skipAuthRefresh: true,
2043
+ ...options
2044
+ });
2045
+ }
2046
+ /**
2047
+ * Загружает конкретную редакцию документа с полным текстом.
2048
+ *
2049
+ * @param version идентификатор редакции из {@link versions}, например `2026-04-03`
2050
+ */
2051
+ version(scope, slug, version, options = {}) {
2052
+ return this.http.execute(LEGAL_VERSION, {
2053
+ path: `${documentPath(scope, slug)}/versions/${encodePathSegment(version, "version")}`,
2054
+ skipAuth: true,
2055
+ skipAuthRefresh: true,
2056
+ ...options
2057
+ });
2058
+ }
2059
+ };
2060
+ // src/resources/platform.ts
1965
2061
  const PLATFORM_CHANGELOG = defineBuiltInOperation("platform.changelog", (body) => Array.isArray(body) ? body : []);
1966
2062
  const PLATFORM_ANNOUNCEMENTS = defineBuiltInOperation("platform.announcements", (body) => pickArray(body, "announcements"));
1967
2063
  const PLATFORM_VERSION = passthroughOperation("platform.version");
@@ -2037,8 +2133,7 @@ var PlatformResource = class extends BaseResource {
2037
2133
  return this.#status.get(options);
2038
2134
  }
2039
2135
  };
2040
- //#endregion
2041
- //#region src/spans/validate.ts
2136
+ // src/spans/validate.ts
2042
2137
  /**
2043
2138
  * Проверяет, что spans целиком лежат внутри текста.
2044
2139
  *
@@ -2054,8 +2149,7 @@ function validateSpans(content, spans) {
2054
2149
  return { ...candidate };
2055
2150
  });
2056
2151
  }
2057
- //#endregion
2058
- //#region src/spans/parse.ts
2152
+ // src/spans/parse.ts
2059
2153
  const HTML_BLOCK_TAGS = /* @__PURE__ */ new Set([
2060
2154
  "address",
2061
2155
  "article",
@@ -2519,8 +2613,7 @@ function parseHtml(source, options = {}) {
2519
2613
  while (output.content.endsWith("\n")) output.content = output.content.slice(0, -1);
2520
2614
  return finish(output);
2521
2615
  }
2522
- //#endregion
2523
- //#region src/builders/markup.ts
2616
+ // src/builders/markup.ts
2524
2617
  function validateMarkup(value) {
2525
2618
  if (!value || typeof value.content !== "string" || !Array.isArray(value.spans)) throw new ItdConfigError("Разметка должна содержать строку content и массив spans");
2526
2619
  return {
@@ -2753,8 +2846,7 @@ function autoSpans(text, options = {}) {
2753
2846
  }
2754
2847
  return spans.sort((left, right) => left.offset - right.offset || right.length - left.length);
2755
2848
  }
2756
- //#endregion
2757
- //#region src/builders/poll.ts
2849
+ // src/builders/poll.ts
2758
2850
  /** Минимальное число вариантов ответа. */
2759
2851
  const MIN_OPTIONS = 2;
2760
2852
  /** Ограничения опроса — те же, что действуют в интерфейсе итд.com. */
@@ -2873,8 +2965,7 @@ function poll(question = "") {
2873
2965
  function resolvePoll(input) {
2874
2966
  return resolveInput(input, () => poll(), validatePoll);
2875
2967
  }
2876
- //#endregion
2877
- //#region src/builders/post.ts
2968
+ // src/builders/post.ts
2878
2969
  /** UUID любой версии. */
2879
2970
  const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
2880
2971
  const BUILD_UPDATE = Symbol.for("itd.postBuilder.update");
@@ -3128,8 +3219,7 @@ function resolvePostUpdate(input) {
3128
3219
  }
3129
3220
  return isBuilder(input) ? input[BUILD_UPDATE]() : validatePostUpdate(input);
3130
3221
  }
3131
- //#endregion
3132
- //#region src/resources/posts.ts
3222
+ // src/resources/posts.ts
3133
3223
  const POSTS_LIST = postPageOperation("posts.list");
3134
3224
  const POSTS_BY_USER = postPageOperation("posts.byUser");
3135
3225
  const POSTS_LIKED_BY_USER = postPageOperation("posts.likedByUser");
@@ -3473,8 +3563,7 @@ var PostsResource = class extends BaseResource {
3473
3563
  return [...existing, ...uploaded];
3474
3564
  }
3475
3565
  };
3476
- //#endregion
3477
- //#region src/builders/report.ts
3566
+ // src/builders/report.ts
3478
3567
  const REASONS = new Set(Object.values(ReportReason));
3479
3568
  const TARGET_TYPES = new Set(Object.values(ReportTargetType));
3480
3569
  /**
@@ -3555,8 +3644,7 @@ const report = Object.freeze({
3555
3644
  function resolveReport(input) {
3556
3645
  return resolveInput(input, () => new ReportBuilder({}), validateReport);
3557
3646
  }
3558
- //#endregion
3559
- //#region src/resources/reports.ts
3647
+ // src/resources/reports.ts
3560
3648
  const REPORTS_CREATE = passthroughOperation("reports.create");
3561
3649
  /**
3562
3650
  * Жалобы на контент и пользователей.
@@ -3585,8 +3673,7 @@ var ReportsResource = class extends BaseResource {
3585
3673
  });
3586
3674
  }
3587
3675
  };
3588
- //#endregion
3589
- //#region src/resources/search.ts
3676
+ // src/resources/search.ts
3590
3677
  const SEARCH_ALL = defineBuiltInOperation("search.all", (body) => ({
3591
3678
  users: pickArray(body, "users"),
3592
3679
  hashtags: pickArray(body, "hashtags")
@@ -3613,8 +3700,7 @@ var SearchResource = class extends BaseResource {
3613
3700
  });
3614
3701
  }
3615
3702
  };
3616
- //#endregion
3617
- //#region src/resources/shop.ts
3703
+ // src/resources/shop.ts
3618
3704
  const PRODUCTS_LIST = passthroughOperation("shop.products.list");
3619
3705
  const PRODUCTS_GET = passthroughOperation("shop.products.get");
3620
3706
  const DELIVERY_COUNTRIES = passthroughOperation("shop.delivery.countries");
@@ -3802,8 +3888,7 @@ var ShopResource = class {
3802
3888
  this.consents = new ShopConsentsResource(http);
3803
3889
  }
3804
3890
  };
3805
- //#endregion
3806
- //#region src/resources/subscription.ts
3891
+ // src/resources/subscription.ts
3807
3892
  const SUBSCRIPTION_METHODS = defineBuiltInOperation("subscription.methods", (body) => Array.isArray(body) ? body : []);
3808
3893
  const SUBSCRIPTION_STATUS = passthroughOperation("subscription.status");
3809
3894
  const SUBSCRIPTION_PAY = passthroughOperation("subscription.pay");
@@ -3872,8 +3957,7 @@ var SubscriptionResource = class extends BaseResource {
3872
3957
  });
3873
3958
  }
3874
3959
  };
3875
- //#endregion
3876
- //#region src/resources/telemetry.ts
3960
+ // src/resources/telemetry.ts
3877
3961
  const DEFAULT_BATCH_SIZE = 50;
3878
3962
  const SYSTEM_CLOCK = Object.freeze({ now: () => Date.now() });
3879
3963
  function assertNonEmpty(value, name) {
@@ -4194,8 +4278,7 @@ function closeTelemetryForDispose(resource) {
4194
4278
  }
4195
4279
  const TELEMETRY_DWELL = defineBuiltInOperation("telemetry.dwell");
4196
4280
  const TELEMETRY_INTERACTION = defineBuiltInOperation("telemetry.interaction");
4197
- //#endregion
4198
- //#region src/resources/users.ts
4281
+ // src/resources/users.ts
4199
4282
  const userListOperation = (id) => pageOperation(id, (body) => readPagedPage(body, "users", "followers", "following", "blocked"));
4200
4283
  const USER_LIST_OPERATIONS = {
4201
4284
  "users.followers": userListOperation("users.followers"),
@@ -4223,8 +4306,6 @@ const USERS_FOLLOW = passthroughOperation("users.follow");
4223
4306
  const USERS_FOLLOW_STATUS = passthroughOperation("users.followStatus");
4224
4307
  const USERS_GET_PRIVACY = passthroughOperation("users.getPrivacy");
4225
4308
  const USERS_UPDATE_PRIVACY = passthroughOperation("users.updatePrivacy");
4226
- const USERS_DEACTIVATE = voidOperation("users.deactivate");
4227
- const USERS_RESTORE = voidOperation("users.restore");
4228
4309
  const USERS_UNFOLLOW = voidOperation("users.unfollow");
4229
4310
  const USERS_BLOCK = voidOperation("users.block");
4230
4311
  const USERS_UNBLOCK = voidOperation("users.unblock");
@@ -4290,20 +4371,6 @@ var UsersResource = class extends BaseResource {
4290
4371
  removeBanner(options = {}) {
4291
4372
  return this.updateMe({ bannerId: null }, options);
4292
4373
  }
4293
- /** Деактивирует аккаунт. Вернуть его можно через {@link restore}. */
4294
- deactivate(options = {}) {
4295
- return this.voidOperation(USERS_DEACTIVATE, {
4296
- path: "/api/users/me",
4297
- ...options
4298
- });
4299
- }
4300
- /** Восстанавливает деактивированный аккаунт. */
4301
- restore(options = {}) {
4302
- return this.voidOperation(USERS_RESTORE, {
4303
- path: "/api/users/me/restore",
4304
- ...options
4305
- });
4306
- }
4307
4374
  /** Создаёт профиль после регистрации. */
4308
4375
  createProfile(input, options = {}) {
4309
4376
  return this.http.execute(USERS_CREATE_PROFILE, {
@@ -4507,8 +4574,7 @@ var UsersResource = class extends BaseResource {
4507
4574
  }, options);
4508
4575
  }
4509
4576
  };
4510
- //#endregion
4511
- //#region src/resources/verification.ts
4577
+ // src/resources/verification.ts
4512
4578
  const VERIFICATION_STATUS = passthroughOperation("verification.status");
4513
4579
  const VERIFICATION_SUBMIT = passthroughOperation("verification.submit");
4514
4580
  /**
@@ -4533,8 +4599,7 @@ var VerificationResource = class extends BaseResource {
4533
4599
  });
4534
4600
  }
4535
4601
  };
4536
- //#endregion
4537
- //#region src/rest/resources.ts
4602
+ // src/rest/resources.ts
4538
4603
  /**
4539
4604
  * Собирает набор ресурсов, создавая каждый при первом обращении.
4540
4605
  *
@@ -4551,6 +4616,7 @@ function createResources(deps) {
4551
4616
  let files;
4552
4617
  let notifications;
4553
4618
  let hashtags;
4619
+ let legal;
4554
4620
  let search;
4555
4621
  let reports;
4556
4622
  let verification;
@@ -4583,6 +4649,10 @@ function createResources(deps) {
4583
4649
  hashtags ??= new HashtagsResource(deps.http);
4584
4650
  return hashtags;
4585
4651
  },
4652
+ get legal() {
4653
+ legal ??= new LegalResource(deps.http);
4654
+ return legal;
4655
+ },
4586
4656
  get search() {
4587
4657
  search ??= new SearchResource(deps.http);
4588
4658
  return search;
@@ -4618,10 +4688,9 @@ function createResources(deps) {
4618
4688
  const uploadFiles = (input, requestOptions) => bag.files.uploadMany(input, {}, requestOptions ?? {});
4619
4689
  return bag;
4620
4690
  }
4621
- //#endregion
4622
- //#region src/core/attachments/factories.ts
4691
+ // src/core/attachments/factories.ts
4623
4692
  function fromUrl(url, options = {}) {
4624
- if (resolveFileStreamOptions(options, 104857600).mode === FileTransferMode.Stream) return { open: (context) => openUrlFile(url, options, context) };
4693
+ if (resolveFileStreamOptions(options, 0x6400000).mode === FileTransferMode.Stream) return { open: (context) => openUrlFile(url, options, context) };
4625
4694
  return { load: (context) => downloadFile(url, options, context) };
4626
4695
  }
4627
4696
  /**
@@ -4670,8 +4739,16 @@ function fromStream(factory, options = {}) {
4670
4739
  };
4671
4740
  } };
4672
4741
  }
4673
- //#endregion
4674
- //#region src/models/guards.ts
4742
+ // src/models/banner-drawing.ts
4743
+ /** Инструменты редактора баннера в формате версии 1. */
4744
+ const BannerDrawingTool = Object.freeze({
4745
+ Brush: "brush",
4746
+ Eraser: "eraser",
4747
+ Line: "line",
4748
+ Rectangle: "rectangle",
4749
+ Circle: "circle"
4750
+ });
4751
+ // src/models/guards.ts
4675
4752
  /**
4676
4753
  * Свой ли это профиль.
4677
4754
  *
@@ -4683,8 +4760,7 @@ function fromStream(factory, options = {}) {
4683
4760
  function isMyProfile(profile) {
4684
4761
  return "subscription" in profile;
4685
4762
  }
4686
- //#endregion
4687
- //#region src/models/shop.ts
4763
+ // src/models/shop.ts
4688
4764
  /** Категория товара магазина. */
4689
4765
  const ShopProductCategory = Object.freeze({
4690
4766
  Apparel: "apparel",
@@ -4713,8 +4789,7 @@ const ShopOrderStatus = Object.freeze({
4713
4789
  Refunded: "refunded",
4714
4790
  Expired: "expired"
4715
4791
  });
4716
- //#endregion
4717
- //#region src/models/status-helpers.ts
4792
+ // src/models/status-helpers.ts
4718
4793
  const STATUS_WINDOW_DAYS = 90;
4719
4794
  /**
4720
4795
  * Разворачивает историю сервиса в массив на 90 суток.
@@ -4734,8 +4809,7 @@ const STATUS_WINDOW_DAYS = 90;
4734
4809
  function statusDays(service) {
4735
4810
  return Array.from({ length: STATUS_WINDOW_DAYS }, (_, index) => service.days[String(index)] ?? null);
4736
4811
  }
4737
- //#endregion
4738
- //#region src/shop/order-access.ts
4812
+ // src/shop/order-access.ts
4739
4813
  function copySession(session) {
4740
4814
  return { ...session };
4741
4815
  }
@@ -4769,8 +4843,7 @@ function createShopOrderAccessStorage(store, options = {}) {
4769
4843
  clear: () => backend.delete(key)
4770
4844
  };
4771
4845
  }
4772
- //#endregion
4773
- //#region src/shop/feature.ts
4846
+ // src/shop/feature.ts
4774
4847
  const Operation = Object.freeze({
4775
4848
  RequestCode: "request-code",
4776
4849
  VerifyCode: "verify-code",
@@ -4910,8 +4983,7 @@ function createShopFeature(options = {}) {
4910
4983
  }
4911
4984
  };
4912
4985
  }
4913
- //#endregion
4914
- //#region src/spans/render.ts
4986
+ // src/spans/render.ts
4915
4987
  /** Формат результата {@link renderSpans}. */
4916
4988
  const SpanRenderFormat = Object.freeze({
4917
4989
  Html: "html",
@@ -5112,7 +5184,6 @@ function renderSpans(content, spans = [], options = {}) {
5112
5184
  }
5113
5185
  return result;
5114
5186
  }
5115
- //#endregion
5116
- export { utcStampToIso as A, AUDIO_MIME_TYPES as C, isBuilder as D, comment as E, mapPage as F, createFeatureHost as I, ExtensibleOperationCatalog as L, BaseResource as M, PaginationMode as N, createStatusFeature as O, Paginator as P, ALLOWED_MIME_TYPES as S, VIDEO_MIME_TYPES as T, poll as _, createShopOrderAccessStorage as a, parseHtml as b, ShopOrderStatus as c, isMyProfile as d, fromStream as f, post as g, report as h, MemoryShopOrderAccessStorage as i, NotificationsResource as j, toDate as k, ShopProductCategory as l, createResources as m, renderSpans as n, statusDays as o, fromUrl as p, createShopFeature as r, ShopConsentKind as s, SpanRenderFormat as t, ShopProductStatus as u, autoSpans as v, IMAGE_MIME_TYPES as w, parseMarkdown as x, markup as y };
5187
+ export { isBuilder as A, createFeatureHost as B, LegalDocumentBlockType as C, IMAGE_MIME_TYPES as D, AUDIO_MIME_TYPES as E, NotificationsResource as F, BaseResource as I, PaginationMode as L, toDate as M, utcStampToIso as N, VIDEO_MIME_TYPES as O, AccountLifecycleResource as P, Paginator as R, parseMarkdown as S, ALLOWED_MIME_TYPES as T, ExtensibleOperationCatalog as V, post as _, createShopOrderAccessStorage as a, markup as b, ShopOrderStatus as c, isMyProfile as d, BannerDrawingTool as f, report as g, createResources as h, MemoryShopOrderAccessStorage as i, createStatusFeature as j, comment as k, ShopProductCategory as l, fromUrl as m, renderSpans as n, statusDays as o, fromStream as p, createShopFeature as r, ShopConsentKind as s, SpanRenderFormat as t, ShopProductStatus as u, poll as v, LegalDocumentScope as w, parseHtml as x, autoSpans as y, mapPage as z };
5117
5188
 
5118
- //# sourceMappingURL=render-CFoF2WaH.js.map
5189
+ //# sourceMappingURL=render-CF49aBO8.js.map