@atproto/api 0.4.4 → 0.5.1

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 (64) hide show
  1. package/README.md +81 -0
  2. package/definitions/labels.json +212 -0
  3. package/definitions/locale/en/label-groups.json +38 -0
  4. package/definitions/locale/en/labels.json +366 -0
  5. package/definitions/locale/en/proposed-label-groups.json +38 -0
  6. package/definitions/locale/en/proposed-labels.json +632 -0
  7. package/definitions/moderation-behaviors.d.ts +48 -0
  8. package/definitions/post-moderation-behaviors.json +879 -0
  9. package/definitions/profile-moderation-behaviors.json +447 -0
  10. package/definitions/proposed-labels.json +326 -0
  11. package/dist/client/index.d.ts +3 -0
  12. package/dist/client/lexicons.d.ts +27 -1
  13. package/dist/client/types/app/bsky/unspecced/applyLabels.d.ts +18 -0
  14. package/dist/index.d.ts +4 -0
  15. package/dist/index.js +1401 -12
  16. package/dist/index.js.map +4 -4
  17. package/dist/moderation/accumulator.d.ts +14 -0
  18. package/dist/moderation/const/label-groups.d.ts +2 -0
  19. package/dist/moderation/const/labels.d.ts +2 -0
  20. package/dist/moderation/index.d.ts +44 -0
  21. package/dist/moderation/subjects/account.d.ts +3 -0
  22. package/dist/moderation/subjects/feed-generator.d.ts +2 -0
  23. package/dist/moderation/subjects/post.d.ts +2 -0
  24. package/dist/moderation/subjects/profile.d.ts +3 -0
  25. package/dist/moderation/subjects/quoted-post.d.ts +6 -0
  26. package/dist/moderation/subjects/user-list.d.ts +2 -0
  27. package/dist/moderation/types.d.ts +97 -0
  28. package/dist/moderation/util.d.ts +12 -0
  29. package/docs/labels.md +522 -0
  30. package/docs/moderation-behaviors/posts.md +1919 -0
  31. package/docs/moderation-behaviors/profiles.md +907 -0
  32. package/docs/moderation.md +144 -0
  33. package/package.json +5 -3
  34. package/scripts/code/label-groups.mjs +68 -0
  35. package/scripts/code/labels.mjs +68 -0
  36. package/scripts/docs/labels.mjs +164 -0
  37. package/scripts/docs/post-moderation-behaviors.mjs +122 -0
  38. package/scripts/docs/profile-moderation-behaviors.mjs +122 -0
  39. package/scripts/generate-code.mjs +4 -0
  40. package/scripts/generate-docs.mjs +5 -0
  41. package/src/client/index.ts +13 -0
  42. package/src/client/lexicons.ts +29 -3
  43. package/src/client/types/app/bsky/unspecced/applyLabels.ts +33 -0
  44. package/src/client/types/com/atproto/admin/enableAccountInvites.ts +1 -1
  45. package/src/client/types/com/atproto/moderation/defs.ts +1 -1
  46. package/src/index.ts +4 -0
  47. package/src/moderation/accumulator.ts +181 -0
  48. package/src/moderation/const/label-groups.ts +143 -0
  49. package/src/moderation/const/labels.ts +798 -0
  50. package/src/moderation/index.ts +343 -0
  51. package/src/moderation/subjects/account.ts +40 -0
  52. package/src/moderation/subjects/feed-generator.ts +13 -0
  53. package/src/moderation/subjects/post.ts +23 -0
  54. package/src/moderation/subjects/profile.ts +31 -0
  55. package/src/moderation/subjects/quoted-post.ts +62 -0
  56. package/src/moderation/subjects/user-list.ts +13 -0
  57. package/src/moderation/types.ts +141 -0
  58. package/src/moderation/util.ts +98 -0
  59. package/tests/post-moderation.test.ts +46 -0
  60. package/tests/profile-moderation.test.ts +46 -0
  61. package/tests/util/index.ts +176 -0
  62. package/tests/util/moderation-behavior.ts +180 -0
  63. package/tsconfig.build.tsbuildinfo +1 -1
  64. package/tests/_util.ts +0 -26
package/dist/index.js CHANGED
@@ -8925,6 +8925,7 @@ __export(src_exports4, {
8925
8925
  AppBskyNotificationListNotifications: () => listNotifications_exports,
8926
8926
  AppBskyNotificationUpdateSeen: () => updateSeen_exports,
8927
8927
  AppBskyRichtextFacet: () => facet_exports,
8928
+ AppBskyUnspeccedApplyLabels: () => applyLabels_exports,
8928
8929
  AppBskyUnspeccedGetPopular: () => getPopular_exports,
8929
8930
  AppBskyUnspeccedGetPopularFeedGenerators: () => getPopularFeedGenerators_exports,
8930
8931
  AppBskyUnspeccedGetTimelineSkeleton: () => getTimelineSkeleton_exports,
@@ -9012,10 +9013,13 @@ __export(src_exports4, {
9012
9013
  GeneratorRecord: () => GeneratorRecord,
9013
9014
  GraphNS: () => GraphNS,
9014
9015
  IdentityNS: () => IdentityNS,
9016
+ LABELS: () => LABELS,
9017
+ LABEL_GROUPS: () => LABEL_GROUPS,
9015
9018
  LabelNS: () => LabelNS,
9016
9019
  LikeRecord: () => LikeRecord,
9017
9020
  ListRecord: () => ListRecord,
9018
9021
  ListitemRecord: () => ListitemRecord,
9022
+ ModerationDecision: () => ModerationDecision,
9019
9023
  ModerationNS: () => ModerationNS,
9020
9024
  NotificationNS: () => NotificationNS,
9021
9025
  PostRecord: () => PostRecord,
@@ -9033,6 +9037,10 @@ __export(src_exports4, {
9033
9037
  jsonStringToLex: () => jsonStringToLex,
9034
9038
  jsonToLex: () => jsonToLex,
9035
9039
  lexToJson: () => lexToJson,
9040
+ moderateFeedGenerator: () => moderateFeedGenerator,
9041
+ moderatePost: () => moderatePost,
9042
+ moderateProfile: () => moderateProfile,
9043
+ moderateUserList: () => moderateUserList,
9036
9044
  parseLanguage: () => parseLanguage,
9037
9045
  sanitizeRichText: () => sanitizeRichText,
9038
9046
  stringifyLex: () => stringifyLex
@@ -16230,7 +16238,6 @@ var schemaDict = {
16230
16238
  },
16231
16239
  moderation: {
16232
16240
  type: "object",
16233
- required: [],
16234
16241
  properties: {
16235
16242
  currentAction: {
16236
16243
  type: "ref",
@@ -16398,7 +16405,7 @@ var schemaDict = {
16398
16405
  },
16399
16406
  note: {
16400
16407
  type: "string",
16401
- description: "Additionally add a note describing why the invites were disabled"
16408
+ description: "Additionally add a note describing why the invites were enabled"
16402
16409
  }
16403
16410
  }
16404
16411
  }
@@ -17350,7 +17357,7 @@ var schemaDict = {
17350
17357
  },
17351
17358
  reasonSexual: {
17352
17359
  type: "token",
17353
- description: "Unwanted or mis-labeled sexual content"
17360
+ description: "Unwanted or mislabeled sexual content"
17354
17361
  },
17355
17362
  reasonRude: {
17356
17363
  type: "token",
@@ -21944,6 +21951,32 @@ var schemaDict = {
21944
21951
  }
21945
21952
  }
21946
21953
  },
21954
+ AppBskyUnspeccedApplyLabels: {
21955
+ lexicon: 1,
21956
+ id: "app.bsky.unspecced.applyLabels",
21957
+ defs: {
21958
+ main: {
21959
+ type: "procedure",
21960
+ description: "Allow a labeler to apply labels directly.",
21961
+ input: {
21962
+ encoding: "application/json",
21963
+ schema: {
21964
+ type: "object",
21965
+ required: ["labels"],
21966
+ properties: {
21967
+ labels: {
21968
+ type: "array",
21969
+ items: {
21970
+ type: "ref",
21971
+ ref: "lex:com.atproto.label.defs#label"
21972
+ }
21973
+ }
21974
+ }
21975
+ }
21976
+ }
21977
+ }
21978
+ }
21979
+ },
21947
21980
  AppBskyUnspeccedGetPopular: {
21948
21981
  lexicon: 1,
21949
21982
  id: "app.bsky.unspecced.getPopular",
@@ -23477,12 +23510,23 @@ function toKnownErr91(e) {
23477
23510
  return e;
23478
23511
  }
23479
23512
 
23513
+ // src/client/types/app/bsky/unspecced/applyLabels.ts
23514
+ var applyLabels_exports = {};
23515
+ __export(applyLabels_exports, {
23516
+ toKnownErr: () => toKnownErr92
23517
+ });
23518
+ function toKnownErr92(e) {
23519
+ if (e instanceof XRPCError) {
23520
+ }
23521
+ return e;
23522
+ }
23523
+
23480
23524
  // src/client/types/app/bsky/unspecced/getPopular.ts
23481
23525
  var getPopular_exports = {};
23482
23526
  __export(getPopular_exports, {
23483
- toKnownErr: () => toKnownErr92
23527
+ toKnownErr: () => toKnownErr93
23484
23528
  });
23485
- function toKnownErr92(e) {
23529
+ function toKnownErr93(e) {
23486
23530
  if (e instanceof XRPCError) {
23487
23531
  }
23488
23532
  return e;
@@ -23491,9 +23535,9 @@ function toKnownErr92(e) {
23491
23535
  // src/client/types/app/bsky/unspecced/getPopularFeedGenerators.ts
23492
23536
  var getPopularFeedGenerators_exports = {};
23493
23537
  __export(getPopularFeedGenerators_exports, {
23494
- toKnownErr: () => toKnownErr93
23538
+ toKnownErr: () => toKnownErr94
23495
23539
  });
23496
- function toKnownErr93(e) {
23540
+ function toKnownErr94(e) {
23497
23541
  if (e instanceof XRPCError) {
23498
23542
  }
23499
23543
  return e;
@@ -23503,14 +23547,14 @@ function toKnownErr93(e) {
23503
23547
  var getTimelineSkeleton_exports = {};
23504
23548
  __export(getTimelineSkeleton_exports, {
23505
23549
  UnknownFeedError: () => UnknownFeedError3,
23506
- toKnownErr: () => toKnownErr94
23550
+ toKnownErr: () => toKnownErr95
23507
23551
  });
23508
23552
  var UnknownFeedError3 = class extends XRPCError {
23509
23553
  constructor(src2) {
23510
23554
  super(src2.status, src2.error, src2.message);
23511
23555
  }
23512
23556
  };
23513
- function toKnownErr94(e) {
23557
+ function toKnownErr95(e) {
23514
23558
  if (e instanceof XRPCError) {
23515
23559
  if (e.error === "UnknownFeed")
23516
23560
  return new UnknownFeedError3(e);
@@ -25272,9 +25316,14 @@ var UnspeccedNS = class {
25272
25316
  constructor(service) {
25273
25317
  this._service = service;
25274
25318
  }
25319
+ applyLabels(data, opts) {
25320
+ return this._service.xrpc.call("app.bsky.unspecced.applyLabels", opts?.qp, data, opts).catch((e) => {
25321
+ throw toKnownErr92(e);
25322
+ });
25323
+ }
25275
25324
  getPopular(params2, opts) {
25276
25325
  return this._service.xrpc.call("app.bsky.unspecced.getPopular", params2, void 0, opts).catch((e) => {
25277
- throw toKnownErr92(e);
25326
+ throw toKnownErr93(e);
25278
25327
  });
25279
25328
  }
25280
25329
  getPopularFeedGenerators(params2, opts) {
@@ -25284,12 +25333,12 @@ var UnspeccedNS = class {
25284
25333
  void 0,
25285
25334
  opts
25286
25335
  ).catch((e) => {
25287
- throw toKnownErr93(e);
25336
+ throw toKnownErr94(e);
25288
25337
  });
25289
25338
  }
25290
25339
  getTimelineSkeleton(params2, opts) {
25291
25340
  return this._service.xrpc.call("app.bsky.unspecced.getTimelineSkeleton", params2, void 0, opts).catch((e) => {
25292
- throw toKnownErr94(e);
25341
+ throw toKnownErr95(e);
25293
25342
  });
25294
25343
  }
25295
25344
  };
@@ -27306,6 +27355,1346 @@ function cloneDeep(v) {
27306
27355
  return JSON.parse(JSON.stringify(v));
27307
27356
  }
27308
27357
 
27358
+ // src/moderation/types.ts
27359
+ var ModerationDecision = class {
27360
+ constructor(cause = void 0, alert = false, blur = false, blurMedia = false, filter = false, noOverride = false, additionalCauses = [], did2 = "") {
27361
+ this.cause = cause;
27362
+ this.alert = alert;
27363
+ this.blur = blur;
27364
+ this.blurMedia = blurMedia;
27365
+ this.filter = filter;
27366
+ this.noOverride = noOverride;
27367
+ this.additionalCauses = additionalCauses;
27368
+ this.did = did2;
27369
+ }
27370
+ static noop() {
27371
+ return new ModerationDecision();
27372
+ }
27373
+ };
27374
+
27375
+ // src/moderation/const/labels.ts
27376
+ var LABELS = {
27377
+ "!hide": {
27378
+ id: "!hide",
27379
+ preferences: ["hide"],
27380
+ flags: ["no-override"],
27381
+ onwarn: "blur",
27382
+ groupId: "system",
27383
+ configurable: false,
27384
+ strings: {
27385
+ settings: {
27386
+ en: {
27387
+ name: "Moderator Hide",
27388
+ description: "Moderator has chosen to hide the content."
27389
+ }
27390
+ },
27391
+ account: {
27392
+ en: {
27393
+ name: "Content Blocked",
27394
+ description: "This account has been hidden by the moderators."
27395
+ }
27396
+ },
27397
+ content: {
27398
+ en: {
27399
+ name: "Content Blocked",
27400
+ description: "This content has been hidden by the moderators."
27401
+ }
27402
+ }
27403
+ }
27404
+ },
27405
+ "!no-promote": {
27406
+ id: "!no-promote",
27407
+ preferences: ["hide"],
27408
+ flags: [],
27409
+ onwarn: null,
27410
+ groupId: "system",
27411
+ configurable: false,
27412
+ strings: {
27413
+ settings: {
27414
+ en: {
27415
+ name: "Moderator Filter",
27416
+ description: "Moderator has chosen to filter the content from feeds."
27417
+ }
27418
+ },
27419
+ account: {
27420
+ en: {
27421
+ name: "N/A",
27422
+ description: "N/A"
27423
+ }
27424
+ },
27425
+ content: {
27426
+ en: {
27427
+ name: "N/A",
27428
+ description: "N/A"
27429
+ }
27430
+ }
27431
+ }
27432
+ },
27433
+ "!warn": {
27434
+ id: "!warn",
27435
+ preferences: ["warn"],
27436
+ flags: [],
27437
+ onwarn: "blur",
27438
+ groupId: "system",
27439
+ configurable: false,
27440
+ strings: {
27441
+ settings: {
27442
+ en: {
27443
+ name: "Moderator Warn",
27444
+ description: "Moderator has chosen to set a general warning on the content."
27445
+ }
27446
+ },
27447
+ account: {
27448
+ en: {
27449
+ name: "Content Warning",
27450
+ description: "This account has received a general warning from moderators."
27451
+ }
27452
+ },
27453
+ content: {
27454
+ en: {
27455
+ name: "Content Warning",
27456
+ description: "This content has received a general warning from moderators."
27457
+ }
27458
+ }
27459
+ }
27460
+ },
27461
+ "dmca-violation": {
27462
+ id: "dmca-violation",
27463
+ preferences: ["hide"],
27464
+ flags: ["no-override"],
27465
+ onwarn: "blur",
27466
+ groupId: "legal",
27467
+ configurable: false,
27468
+ strings: {
27469
+ settings: {
27470
+ en: {
27471
+ name: "Copyright Violation",
27472
+ description: "The content has received a DMCA takedown request."
27473
+ }
27474
+ },
27475
+ account: {
27476
+ en: {
27477
+ name: "Copyright Violation",
27478
+ description: "This account has received a DMCA takedown request. It will be restored if the concerns can be resolved."
27479
+ }
27480
+ },
27481
+ content: {
27482
+ en: {
27483
+ name: "Copyright Violation",
27484
+ description: "This content has received a DMCA takedown request. It will be restored if the concerns can be resolved."
27485
+ }
27486
+ }
27487
+ }
27488
+ },
27489
+ doxxing: {
27490
+ id: "doxxing",
27491
+ preferences: ["hide"],
27492
+ flags: ["no-override"],
27493
+ onwarn: "blur",
27494
+ groupId: "legal",
27495
+ configurable: false,
27496
+ strings: {
27497
+ settings: {
27498
+ en: {
27499
+ name: "Doxxing",
27500
+ description: "Information that reveals private information about someone which has been shared without the consent of the subject."
27501
+ }
27502
+ },
27503
+ account: {
27504
+ en: {
27505
+ name: "Doxxing",
27506
+ description: "This account has been reported to publish private information about someone without their consent. This report is currently under review."
27507
+ }
27508
+ },
27509
+ content: {
27510
+ en: {
27511
+ name: "Doxxing",
27512
+ description: "This content has been reported to include private information about someone without their consent."
27513
+ }
27514
+ }
27515
+ }
27516
+ },
27517
+ porn: {
27518
+ id: "porn",
27519
+ preferences: ["ignore", "warn", "hide"],
27520
+ flags: ["adult"],
27521
+ onwarn: "blur-media",
27522
+ groupId: "sexual",
27523
+ configurable: true,
27524
+ strings: {
27525
+ settings: {
27526
+ en: {
27527
+ name: "Pornography",
27528
+ description: "Images of full-frontal nudity (genitalia) in any sexualized context, or explicit sexual activity (meaning contact with genitalia or breasts) even if partially covered. Includes graphic sexual cartoons (often jokes/memes)."
27529
+ }
27530
+ },
27531
+ account: {
27532
+ en: {
27533
+ name: "Pornography",
27534
+ description: "This account contains imagery of full-frontal nudity or explicit sexual activity."
27535
+ }
27536
+ },
27537
+ content: {
27538
+ en: {
27539
+ name: "Pornography",
27540
+ description: "This content contains imagery of full-frontal nudity or explicit sexual activity."
27541
+ }
27542
+ }
27543
+ }
27544
+ },
27545
+ sexual: {
27546
+ id: "sexual",
27547
+ preferences: ["ignore", "warn", "hide"],
27548
+ flags: ["adult"],
27549
+ onwarn: "blur-media",
27550
+ groupId: "sexual",
27551
+ configurable: true,
27552
+ strings: {
27553
+ settings: {
27554
+ en: {
27555
+ name: "Sexually Suggestive",
27556
+ description: 'Content that does not meet the level of "pornography", but is still sexual. Some common examples have been selfies and "hornyposting" with underwear on, or partially naked (naked but covered, eg with hands or from side perspective). Sheer/see-through nipples may end up in this category.'
27557
+ }
27558
+ },
27559
+ account: {
27560
+ en: {
27561
+ name: "Sexually Suggestive",
27562
+ description: "This account contains imagery which is sexually suggestive. Common examples include selfies in underwear or in partial undress."
27563
+ }
27564
+ },
27565
+ content: {
27566
+ en: {
27567
+ name: "Sexually Suggestive",
27568
+ description: "This content contains imagery which is sexually suggestive. Common examples include selfies in underwear or in partial undress."
27569
+ }
27570
+ }
27571
+ }
27572
+ },
27573
+ nudity: {
27574
+ id: "nudity",
27575
+ preferences: ["ignore", "warn", "hide"],
27576
+ flags: ["adult"],
27577
+ onwarn: "blur-media",
27578
+ groupId: "sexual",
27579
+ configurable: true,
27580
+ strings: {
27581
+ settings: {
27582
+ en: {
27583
+ name: "Nudity",
27584
+ description: 'Nudity which is not sexual, or that is primarily "artistic" in nature. For example: breastfeeding; classic art paintings and sculptures; newspaper images with some nudity; fashion modeling. "Erotic photography" is likely to end up in sexual or porn.'
27585
+ }
27586
+ },
27587
+ account: {
27588
+ en: {
27589
+ name: "Nudity",
27590
+ description: "This account contains imagery which portrays nudity in a non-sexual or artistic setting."
27591
+ }
27592
+ },
27593
+ content: {
27594
+ en: {
27595
+ name: "Nudity",
27596
+ description: "This content contains imagery which portrays nudity in a non-sexual or artistic setting."
27597
+ }
27598
+ }
27599
+ }
27600
+ },
27601
+ nsfl: {
27602
+ id: "nsfl",
27603
+ preferences: ["ignore", "warn", "hide"],
27604
+ flags: ["adult"],
27605
+ onwarn: "blur-media",
27606
+ groupId: "violence",
27607
+ configurable: true,
27608
+ strings: {
27609
+ settings: {
27610
+ en: {
27611
+ name: "NSFL",
27612
+ description: `"Not Suitable For Life." This includes graphic images like the infamous "goatse" (don't look it up).`
27613
+ }
27614
+ },
27615
+ account: {
27616
+ en: {
27617
+ name: "Graphic Imagery (NSFL)",
27618
+ description: 'This account contains graphic images which are often referred to as "Not Suitable For Life."'
27619
+ }
27620
+ },
27621
+ content: {
27622
+ en: {
27623
+ name: "Graphic Imagery (NSFL)",
27624
+ description: 'This content contains graphic images which are often referred to as "Not Suitable For Life."'
27625
+ }
27626
+ }
27627
+ }
27628
+ },
27629
+ corpse: {
27630
+ id: "corpse",
27631
+ preferences: ["ignore", "warn", "hide"],
27632
+ flags: ["adult"],
27633
+ onwarn: "blur-media",
27634
+ groupId: "violence",
27635
+ configurable: true,
27636
+ strings: {
27637
+ settings: {
27638
+ en: {
27639
+ name: "Corpse",
27640
+ description: "Visual image of a dead human body in any context. Includes war images, hanging, funeral caskets. Does not include all figurative cases (cartoons), but can include realistic figurative images or renderings."
27641
+ }
27642
+ },
27643
+ account: {
27644
+ en: {
27645
+ name: "Graphic Imagery (Corpse)",
27646
+ description: "This account contains images of a dead human body in any context. Includes war images, hanging, funeral caskets."
27647
+ }
27648
+ },
27649
+ content: {
27650
+ en: {
27651
+ name: "Graphic Imagery (Corpse)",
27652
+ description: "This content contains images of a dead human body in any context. Includes war images, hanging, funeral caskets."
27653
+ }
27654
+ }
27655
+ }
27656
+ },
27657
+ gore: {
27658
+ id: "gore",
27659
+ preferences: ["ignore", "warn", "hide"],
27660
+ flags: ["adult"],
27661
+ onwarn: "blur-media",
27662
+ groupId: "violence",
27663
+ configurable: true,
27664
+ strings: {
27665
+ settings: {
27666
+ en: {
27667
+ name: "Gore",
27668
+ description: "Intended for shocking images, typically involving blood or visible wounds."
27669
+ }
27670
+ },
27671
+ account: {
27672
+ en: {
27673
+ name: "Graphic Imagery (Gore)",
27674
+ description: "This account contains shocking images involving blood or visible wounds."
27675
+ }
27676
+ },
27677
+ content: {
27678
+ en: {
27679
+ name: "Graphic Imagery (Gore)",
27680
+ description: "This content contains shocking images involving blood or visible wounds."
27681
+ }
27682
+ }
27683
+ }
27684
+ },
27685
+ torture: {
27686
+ id: "torture",
27687
+ preferences: ["ignore", "warn", "hide"],
27688
+ flags: ["adult"],
27689
+ onwarn: "blur",
27690
+ groupId: "violence",
27691
+ configurable: true,
27692
+ strings: {
27693
+ settings: {
27694
+ en: {
27695
+ name: "Torture",
27696
+ description: "Depictions of torture of a human or animal (animal cruelty)."
27697
+ }
27698
+ },
27699
+ account: {
27700
+ en: {
27701
+ name: "Graphic Imagery (Torture)",
27702
+ description: "This account contains depictions of torture of a human or animal."
27703
+ }
27704
+ },
27705
+ content: {
27706
+ en: {
27707
+ name: "Graphic Imagery (Torture)",
27708
+ description: "This content contains depictions of torture of a human or animal."
27709
+ }
27710
+ }
27711
+ }
27712
+ },
27713
+ "self-harm": {
27714
+ id: "self-harm",
27715
+ preferences: ["ignore", "warn", "hide"],
27716
+ flags: ["adult"],
27717
+ onwarn: "blur-media",
27718
+ groupId: "violence",
27719
+ configurable: true,
27720
+ strings: {
27721
+ settings: {
27722
+ en: {
27723
+ name: "Self-Harm",
27724
+ description: "A visual depiction (photo or figurative) of cutting, suicide, or similar."
27725
+ }
27726
+ },
27727
+ account: {
27728
+ en: {
27729
+ name: "Graphic Imagery (Self-Harm)",
27730
+ description: "This account includes depictions of cutting, suicide, or other forms of self-harm."
27731
+ }
27732
+ },
27733
+ content: {
27734
+ en: {
27735
+ name: "Graphic Imagery (Self-Harm)",
27736
+ description: "This content includes depictions of cutting, suicide, or other forms of self-harm."
27737
+ }
27738
+ }
27739
+ }
27740
+ },
27741
+ "intolerant-race": {
27742
+ id: "intolerant-race",
27743
+ preferences: ["ignore", "warn", "hide"],
27744
+ flags: [],
27745
+ onwarn: "blur",
27746
+ groupId: "intolerance",
27747
+ configurable: true,
27748
+ strings: {
27749
+ settings: {
27750
+ en: {
27751
+ name: "Racial Intolerance",
27752
+ description: "Hateful or intolerant content related to race."
27753
+ }
27754
+ },
27755
+ account: {
27756
+ en: {
27757
+ name: "Intolerance (Racial)",
27758
+ description: "This account includes hateful or intolerant content related to race."
27759
+ }
27760
+ },
27761
+ content: {
27762
+ en: {
27763
+ name: "Intolerance (Racial)",
27764
+ description: "This content includes hateful or intolerant views related to race."
27765
+ }
27766
+ }
27767
+ }
27768
+ },
27769
+ "intolerant-gender": {
27770
+ id: "intolerant-gender",
27771
+ preferences: ["ignore", "warn", "hide"],
27772
+ flags: [],
27773
+ onwarn: "blur",
27774
+ groupId: "intolerance",
27775
+ configurable: true,
27776
+ strings: {
27777
+ settings: {
27778
+ en: {
27779
+ name: "Gender Intolerance",
27780
+ description: "Hateful or intolerant content related to gender or gender identity."
27781
+ }
27782
+ },
27783
+ account: {
27784
+ en: {
27785
+ name: "Intolerance (Gender)",
27786
+ description: "This account includes hateful or intolerant content related to gender or gender identity."
27787
+ }
27788
+ },
27789
+ content: {
27790
+ en: {
27791
+ name: "Intolerance (Gender)",
27792
+ description: "This content includes hateful or intolerant views related to gender or gender identity."
27793
+ }
27794
+ }
27795
+ }
27796
+ },
27797
+ "intolerant-sexual-orientation": {
27798
+ id: "intolerant-sexual-orientation",
27799
+ preferences: ["ignore", "warn", "hide"],
27800
+ flags: [],
27801
+ onwarn: "blur",
27802
+ groupId: "intolerance",
27803
+ configurable: true,
27804
+ strings: {
27805
+ settings: {
27806
+ en: {
27807
+ name: "Sexual Orientation Intolerance",
27808
+ description: "Hateful or intolerant content related to sexual preferences."
27809
+ }
27810
+ },
27811
+ account: {
27812
+ en: {
27813
+ name: "Intolerance (Orientation)",
27814
+ description: "This account includes hateful or intolerant content related to sexual preferences."
27815
+ }
27816
+ },
27817
+ content: {
27818
+ en: {
27819
+ name: "Intolerance (Orientation)",
27820
+ description: "This content includes hateful or intolerant views related to sexual preferences."
27821
+ }
27822
+ }
27823
+ }
27824
+ },
27825
+ "intolerant-religion": {
27826
+ id: "intolerant-religion",
27827
+ preferences: ["ignore", "warn", "hide"],
27828
+ flags: [],
27829
+ onwarn: "blur",
27830
+ groupId: "intolerance",
27831
+ configurable: true,
27832
+ strings: {
27833
+ settings: {
27834
+ en: {
27835
+ name: "Religious Intolerance",
27836
+ description: "Hateful or intolerant content related to religious views or practices."
27837
+ }
27838
+ },
27839
+ account: {
27840
+ en: {
27841
+ name: "Intolerance (Religious)",
27842
+ description: "This account includes hateful or intolerant content related to religious views or practices."
27843
+ }
27844
+ },
27845
+ content: {
27846
+ en: {
27847
+ name: "Intolerance (Religious)",
27848
+ description: "This content includes hateful or intolerant views related to religious views or practices."
27849
+ }
27850
+ }
27851
+ }
27852
+ },
27853
+ intolerant: {
27854
+ id: "intolerant",
27855
+ preferences: ["ignore", "warn", "hide"],
27856
+ flags: [],
27857
+ onwarn: "blur",
27858
+ groupId: "intolerance",
27859
+ configurable: true,
27860
+ strings: {
27861
+ settings: {
27862
+ en: {
27863
+ name: "Intolerance",
27864
+ description: "A catchall for hateful or intolerant content which is not covered elsewhere."
27865
+ }
27866
+ },
27867
+ account: {
27868
+ en: {
27869
+ name: "Intolerance",
27870
+ description: "This account includes hateful or intolerant content."
27871
+ }
27872
+ },
27873
+ content: {
27874
+ en: {
27875
+ name: "Intolerance",
27876
+ description: "This content includes hateful or intolerant views."
27877
+ }
27878
+ }
27879
+ }
27880
+ },
27881
+ "icon-intolerant": {
27882
+ id: "icon-intolerant",
27883
+ preferences: ["ignore", "warn", "hide"],
27884
+ flags: [],
27885
+ onwarn: "blur-media",
27886
+ groupId: "intolerance",
27887
+ configurable: true,
27888
+ strings: {
27889
+ settings: {
27890
+ en: {
27891
+ name: "Intolerant Iconography",
27892
+ description: "Visual imagery associated with a hate group, such as the KKK or Nazi, in any context (supportive, critical, documentary, etc)."
27893
+ }
27894
+ },
27895
+ account: {
27896
+ en: {
27897
+ name: "Intolerant Iconography",
27898
+ description: "This account includes imagery associated with a hate group such as the KKK or Nazis. This warning may apply to content any context, including critical or documentary purposes."
27899
+ }
27900
+ },
27901
+ content: {
27902
+ en: {
27903
+ name: "Intolerant Iconography",
27904
+ description: "This content includes imagery associated with a hate group such as the KKK or Nazis. This warning may apply to content any context, including critical or documentary purposes."
27905
+ }
27906
+ }
27907
+ }
27908
+ },
27909
+ threat: {
27910
+ id: "threat",
27911
+ preferences: ["ignore", "warn", "hide"],
27912
+ flags: [],
27913
+ onwarn: "blur",
27914
+ groupId: "rude",
27915
+ configurable: true,
27916
+ strings: {
27917
+ settings: {
27918
+ en: {
27919
+ name: "Threats",
27920
+ description: "Statements or imagery published with the intent to threaten, intimidate, or harm."
27921
+ }
27922
+ },
27923
+ account: {
27924
+ en: {
27925
+ name: "Threats",
27926
+ description: "The moderators believe this account has published statements or imagery with the intent to threaten, intimidate, or harm others."
27927
+ }
27928
+ },
27929
+ content: {
27930
+ en: {
27931
+ name: "Threats",
27932
+ description: "The moderators believe this content was published with the intent to threaten, intimidate, or harm others."
27933
+ }
27934
+ }
27935
+ }
27936
+ },
27937
+ spoiler: {
27938
+ id: "spoiler",
27939
+ preferences: ["ignore", "warn", "hide"],
27940
+ flags: [],
27941
+ onwarn: "blur",
27942
+ groupId: "curation",
27943
+ configurable: true,
27944
+ strings: {
27945
+ settings: {
27946
+ en: {
27947
+ name: "Spoiler",
27948
+ description: "Discussion about film, TV, etc which gives away plot points."
27949
+ }
27950
+ },
27951
+ account: {
27952
+ en: {
27953
+ name: "Spoiler Warning",
27954
+ description: "This account contains discussion about film, TV, etc which gives away plot points."
27955
+ }
27956
+ },
27957
+ content: {
27958
+ en: {
27959
+ name: "Spoiler Warning",
27960
+ description: "This content contains discussion about film, TV, etc which gives away plot points."
27961
+ }
27962
+ }
27963
+ }
27964
+ },
27965
+ spam: {
27966
+ id: "spam",
27967
+ preferences: ["ignore", "warn", "hide"],
27968
+ flags: [],
27969
+ onwarn: "blur",
27970
+ groupId: "spam",
27971
+ configurable: true,
27972
+ strings: {
27973
+ settings: {
27974
+ en: {
27975
+ name: "Spam",
27976
+ description: "Repeat, low-quality messages which are clearly not designed to add to a conversation or space."
27977
+ }
27978
+ },
27979
+ account: {
27980
+ en: {
27981
+ name: "Spam",
27982
+ description: "This account publishes repeat, low-quality messages which are clearly not designed to add to a conversation or space."
27983
+ }
27984
+ },
27985
+ content: {
27986
+ en: {
27987
+ name: "Spam",
27988
+ description: "This content is a part of repeat, low-quality messages which are clearly not designed to add to a conversation or space."
27989
+ }
27990
+ }
27991
+ }
27992
+ },
27993
+ "account-security": {
27994
+ id: "account-security",
27995
+ preferences: ["ignore", "warn", "hide"],
27996
+ flags: [],
27997
+ onwarn: "blur",
27998
+ groupId: "misinfo",
27999
+ configurable: true,
28000
+ strings: {
28001
+ settings: {
28002
+ en: {
28003
+ name: "Security Concerns",
28004
+ description: "Content designed to hijack user accounts such as a phishing attack."
28005
+ }
28006
+ },
28007
+ account: {
28008
+ en: {
28009
+ name: "Security Warning",
28010
+ description: "This account has published content designed to hijack user accounts such as a phishing attack."
28011
+ }
28012
+ },
28013
+ content: {
28014
+ en: {
28015
+ name: "Security Warning",
28016
+ description: "This content is designed to hijack user accounts such as a phishing attack."
28017
+ }
28018
+ }
28019
+ }
28020
+ },
28021
+ "net-abuse": {
28022
+ id: "net-abuse",
28023
+ preferences: ["ignore", "warn", "hide"],
28024
+ flags: [],
28025
+ onwarn: "blur",
28026
+ groupId: "misinfo",
28027
+ configurable: true,
28028
+ strings: {
28029
+ settings: {
28030
+ en: {
28031
+ name: "Network Attacks",
28032
+ description: "Content designed to attack network systems such as denial-of-service attacks."
28033
+ }
28034
+ },
28035
+ account: {
28036
+ en: {
28037
+ name: "Network Attack Warning",
28038
+ description: "This account has published content designed to attack network systems such as denial-of-service attacks."
28039
+ }
28040
+ },
28041
+ content: {
28042
+ en: {
28043
+ name: "Network Attack Warning",
28044
+ description: "This content is designed to attack network systems such as denial-of-service attacks."
28045
+ }
28046
+ }
28047
+ }
28048
+ },
28049
+ impersonation: {
28050
+ id: "impersonation",
28051
+ preferences: ["ignore", "warn", "hide"],
28052
+ flags: [],
28053
+ onwarn: "alert",
28054
+ groupId: "misinfo",
28055
+ configurable: true,
28056
+ strings: {
28057
+ settings: {
28058
+ en: {
28059
+ name: "Impersonation",
28060
+ description: "Accounts which falsely assert some identity."
28061
+ }
28062
+ },
28063
+ account: {
28064
+ en: {
28065
+ name: "Impersonation Warning",
28066
+ description: "The moderators believe this account is lying about their identity."
28067
+ }
28068
+ },
28069
+ content: {
28070
+ en: {
28071
+ name: "Impersonation Warning",
28072
+ description: "The moderators believe this account is lying about their identity."
28073
+ }
28074
+ }
28075
+ }
28076
+ },
28077
+ scam: {
28078
+ id: "scam",
28079
+ preferences: ["ignore", "warn", "hide"],
28080
+ flags: [],
28081
+ onwarn: "alert",
28082
+ groupId: "misinfo",
28083
+ configurable: true,
28084
+ strings: {
28085
+ settings: {
28086
+ en: {
28087
+ name: "Scam",
28088
+ description: "Fraudulent content."
28089
+ }
28090
+ },
28091
+ account: {
28092
+ en: {
28093
+ name: "Scam Warning",
28094
+ description: "The moderators believe this account publishes fraudulent content."
28095
+ }
28096
+ },
28097
+ content: {
28098
+ en: {
28099
+ name: "Scam Warning",
28100
+ description: "The moderators believe this is fraudulent content."
28101
+ }
28102
+ }
28103
+ }
28104
+ }
28105
+ };
28106
+
28107
+ // src/moderation/accumulator.ts
28108
+ var ModerationCauseAccumulator = class {
28109
+ constructor() {
28110
+ this.did = "";
28111
+ this.causes = [];
28112
+ }
28113
+ setDid(did2) {
28114
+ this.did = did2;
28115
+ }
28116
+ addBlocking(blocking) {
28117
+ if (blocking) {
28118
+ this.causes.push({
28119
+ type: "blocking",
28120
+ source: { type: "user" },
28121
+ priority: 3
28122
+ });
28123
+ }
28124
+ }
28125
+ addBlockedBy(blockedBy) {
28126
+ if (blockedBy) {
28127
+ this.causes.push({
28128
+ type: "blocked-by",
28129
+ source: { type: "user" },
28130
+ priority: 4
28131
+ });
28132
+ }
28133
+ }
28134
+ addLabel(label, opts) {
28135
+ const labelDef = LABELS[label.val];
28136
+ if (!labelDef) {
28137
+ return;
28138
+ }
28139
+ const labelerSettings = opts.labelerSettings[0];
28140
+ if (!labelerSettings) {
28141
+ return;
28142
+ }
28143
+ let labelPref = "ignore";
28144
+ if (!labelDef.configurable) {
28145
+ labelPref = labelDef.preferences[0];
28146
+ } else if (labelDef.flags.includes("adult") && !opts.adultContentEnabled) {
28147
+ labelPref = "hide";
28148
+ } else if (labelerSettings.settings[label.val]) {
28149
+ labelPref = labelerSettings.settings[label.val];
28150
+ }
28151
+ if (labelPref === "ignore") {
28152
+ return;
28153
+ }
28154
+ let priority;
28155
+ if (labelDef.flags.includes("no-override")) {
28156
+ priority = 1;
28157
+ } else if (labelPref === "hide") {
28158
+ priority = 2;
28159
+ } else if (labelDef.onwarn === "blur") {
28160
+ priority = 5;
28161
+ } else if (labelDef.onwarn === "blur-media") {
28162
+ priority = 7;
28163
+ } else {
28164
+ priority = 8;
28165
+ }
28166
+ this.causes.push({
28167
+ type: "label",
28168
+ label,
28169
+ labelDef,
28170
+ labeler: labelerSettings.labeler,
28171
+ setting: labelPref,
28172
+ priority
28173
+ });
28174
+ }
28175
+ addMuted(muted) {
28176
+ if (muted) {
28177
+ this.causes.push({
28178
+ type: "muted",
28179
+ source: { type: "user" },
28180
+ priority: 6
28181
+ });
28182
+ }
28183
+ }
28184
+ addMutedByList(mutedByList) {
28185
+ if (mutedByList) {
28186
+ this.causes.push({
28187
+ type: "muted",
28188
+ source: { type: "list", list: mutedByList },
28189
+ priority: 6
28190
+ });
28191
+ }
28192
+ }
28193
+ finalizeDecision(opts) {
28194
+ const mod = new ModerationDecision();
28195
+ mod.did = this.did;
28196
+ if (!this.causes.length) {
28197
+ return mod;
28198
+ }
28199
+ this.causes.sort((a, b) => a.priority - b.priority);
28200
+ mod.cause = this.causes[0];
28201
+ mod.additionalCauses = this.causes.slice(1);
28202
+ if (mod.cause.type === "blocking" || mod.cause.type === "blocked-by") {
28203
+ mod.filter = true;
28204
+ mod.blur = true;
28205
+ mod.noOverride = true;
28206
+ } else if (mod.cause.type === "muted") {
28207
+ mod.filter = true;
28208
+ mod.blur = true;
28209
+ } else if (mod.cause.type === "label") {
28210
+ if (mod.cause.setting === "hide") {
28211
+ mod.filter = true;
28212
+ }
28213
+ switch (mod.cause.labelDef.onwarn) {
28214
+ case "alert":
28215
+ mod.alert = true;
28216
+ break;
28217
+ case "blur":
28218
+ mod.blur = true;
28219
+ break;
28220
+ case "blur-media":
28221
+ mod.blurMedia = true;
28222
+ break;
28223
+ case null:
28224
+ break;
28225
+ }
28226
+ if (mod.cause.labelDef.flags.includes("no-override")) {
28227
+ mod.noOverride = true;
28228
+ } else if (mod.cause.labelDef.flags.includes("adult") && !opts.adultContentEnabled) {
28229
+ mod.noOverride = true;
28230
+ }
28231
+ }
28232
+ return mod;
28233
+ }
28234
+ };
28235
+
28236
+ // src/moderation/subjects/account.ts
28237
+ function decideAccount(subject, opts) {
28238
+ const acc = new ModerationCauseAccumulator();
28239
+ acc.setDid(subject.did);
28240
+ if (subject.viewer?.muted) {
28241
+ if (subject.viewer?.mutedByList) {
28242
+ acc.addMutedByList(subject.viewer?.mutedByList);
28243
+ } else {
28244
+ acc.addMuted(subject.viewer?.muted);
28245
+ }
28246
+ }
28247
+ acc.addBlocking(subject.viewer?.blocking);
28248
+ acc.addBlockedBy(subject.viewer?.blockedBy);
28249
+ for (const label of filterAccountLabels(subject.labels)) {
28250
+ acc.addLabel(label, opts);
28251
+ }
28252
+ return acc.finalizeDecision(opts);
28253
+ }
28254
+ function filterAccountLabels(labels) {
28255
+ if (!labels) {
28256
+ return [];
28257
+ }
28258
+ return labels.filter(
28259
+ (label) => !label.uri.endsWith("/app.bsky.actor.profile/self")
28260
+ );
28261
+ }
28262
+
28263
+ // src/moderation/subjects/profile.ts
28264
+ function decideProfile(subject, opts) {
28265
+ const acc = new ModerationCauseAccumulator();
28266
+ acc.setDid(subject.did);
28267
+ for (const label of filterProfileLabels(subject.labels)) {
28268
+ acc.addLabel(label, opts);
28269
+ }
28270
+ return acc.finalizeDecision(opts);
28271
+ }
28272
+ function filterProfileLabels(labels) {
28273
+ if (!labels) {
28274
+ return [];
28275
+ }
28276
+ return labels.filter(
28277
+ (label) => label.uri.endsWith("/app.bsky.actor.profile/self")
28278
+ );
28279
+ }
28280
+
28281
+ // src/moderation/subjects/post.ts
28282
+ function decidePost(subject, opts) {
28283
+ const acc = new ModerationCauseAccumulator();
28284
+ acc.setDid(subject.author.did);
28285
+ if (subject.labels?.length) {
28286
+ for (const label of subject.labels) {
28287
+ acc.addLabel(label, opts);
28288
+ }
28289
+ }
28290
+ return acc.finalizeDecision(opts);
28291
+ }
28292
+
28293
+ // src/moderation/subjects/quoted-post.ts
28294
+ function decideQuotedPost(subject, opts) {
28295
+ const acc = new ModerationCauseAccumulator();
28296
+ if (record_exports.isViewRecord(subject.record)) {
28297
+ acc.setDid(subject.record.author.did);
28298
+ if (subject.record.labels?.length) {
28299
+ for (const label of subject.record.labels) {
28300
+ acc.addLabel(label, opts);
28301
+ }
28302
+ }
28303
+ }
28304
+ return acc.finalizeDecision(opts);
28305
+ }
28306
+ function decideQuotedPostAccount(subject, opts) {
28307
+ if (record_exports.isViewRecord(subject.record)) {
28308
+ return decideAccount(subject.record.author, opts);
28309
+ }
28310
+ return ModerationDecision.noop();
28311
+ }
28312
+ function decideQuotedPostWithMedia(subject, opts) {
28313
+ const acc = new ModerationCauseAccumulator();
28314
+ if (record_exports.isViewRecord(subject.record.record)) {
28315
+ acc.setDid(subject.record.record.author.did);
28316
+ if (subject.record.record.labels?.length) {
28317
+ for (const label of subject.record.record.labels) {
28318
+ acc.addLabel(label, opts);
28319
+ }
28320
+ }
28321
+ }
28322
+ return acc.finalizeDecision(opts);
28323
+ }
28324
+ function decideQuotedPostWithMediaAccount(subject, opts) {
28325
+ if (record_exports.isViewRecord(subject.record.record)) {
28326
+ return decideAccount(subject.record.record.author, opts);
28327
+ }
28328
+ return ModerationDecision.noop();
28329
+ }
28330
+
28331
+ // src/moderation/subjects/feed-generator.ts
28332
+ function decideFeedGenerator(subject, opts) {
28333
+ return ModerationDecision.noop();
28334
+ }
28335
+
28336
+ // src/moderation/subjects/user-list.ts
28337
+ function decideUserList(subject, opts) {
28338
+ return ModerationDecision.noop();
28339
+ }
28340
+
28341
+ // src/moderation/util.ts
28342
+ function takeHighestPriorityDecision(...decisions) {
28343
+ const filtered = decisions.filter((d) => !!d);
28344
+ if (filtered.length === 0) {
28345
+ return ModerationDecision.noop();
28346
+ }
28347
+ filtered.sort((a, b) => {
28348
+ if (a.cause && b.cause) {
28349
+ return a.cause.priority - b.cause.priority;
28350
+ }
28351
+ if (a.cause) {
28352
+ return -1;
28353
+ }
28354
+ if (b.cause) {
28355
+ return 1;
28356
+ }
28357
+ return 0;
28358
+ });
28359
+ return filtered[0];
28360
+ }
28361
+ function downgradeDecision(decision, { alert }) {
28362
+ decision.blur = false;
28363
+ decision.blurMedia = false;
28364
+ decision.filter = false;
28365
+ decision.noOverride = false;
28366
+ decision.alert = alert;
28367
+ if (!alert) {
28368
+ delete decision.cause;
28369
+ }
28370
+ }
28371
+ function isModerationDecisionNoop(decision, { ignoreFilter } = { ignoreFilter: false }) {
28372
+ if (!decision) {
28373
+ return true;
28374
+ }
28375
+ if (decision.alert) {
28376
+ return false;
28377
+ }
28378
+ if (decision.blur) {
28379
+ return false;
28380
+ }
28381
+ if (decision.filter && !ignoreFilter) {
28382
+ return false;
28383
+ }
28384
+ return true;
28385
+ }
28386
+ function isQuotedPost(embed) {
28387
+ return Boolean(
28388
+ embed && record_exports.isView(embed) && record_exports.isViewRecord(embed.record) && post_exports.isRecord(embed.record.value) && post_exports.validateRecord(embed.record.value).success
28389
+ );
28390
+ }
28391
+ function isQuotedPostWithMedia(embed) {
28392
+ return Boolean(
28393
+ embed && recordWithMedia_exports.isView(embed) && record_exports.isViewRecord(embed.record.record) && post_exports.isRecord(embed.record.record.value) && post_exports.validateRecord(embed.record.record.value).success
28394
+ );
28395
+ }
28396
+ function toModerationUI(decision) {
28397
+ return {
28398
+ cause: decision.cause,
28399
+ filter: decision.filter,
28400
+ blur: decision.blur,
28401
+ alert: decision.alert,
28402
+ noOverride: decision.noOverride
28403
+ };
28404
+ }
28405
+
28406
+ // src/moderation/index.ts
28407
+ function moderateProfile(subject, opts) {
28408
+ const account = decideAccount(subject, opts);
28409
+ const profile = decideProfile(subject, opts);
28410
+ if (account.blurMedia) {
28411
+ account.blur = true;
28412
+ }
28413
+ profile.filter = false;
28414
+ if (!isModerationDecisionNoop(account) && account.did === opts.userDid) {
28415
+ downgradeDecision(account, { alert: true });
28416
+ }
28417
+ if (!isModerationDecisionNoop(profile) && profile.did === opts.userDid) {
28418
+ downgradeDecision(profile, { alert: true });
28419
+ }
28420
+ let avatarBlur = false;
28421
+ let avatarNoOverride = false;
28422
+ if ((account.blur || account.blurMedia) && account.cause?.type !== "muted") {
28423
+ avatarBlur = true;
28424
+ avatarNoOverride = account.noOverride || profile.noOverride;
28425
+ } else if (profile.blur || profile.blurMedia) {
28426
+ avatarBlur = true;
28427
+ avatarNoOverride = account.noOverride || profile.noOverride;
28428
+ }
28429
+ if (account.cause?.type === "blocking" || account.cause?.type === "blocked-by" || account.cause?.type === "muted") {
28430
+ account.blur = false;
28431
+ account.noOverride = false;
28432
+ }
28433
+ return {
28434
+ decisions: { account, profile },
28435
+ account: account.filter || account.blur || account.alert ? toModerationUI(account) : {},
28436
+ profile: profile.filter || profile.blur || profile.alert ? toModerationUI(profile) : {},
28437
+ avatar: {
28438
+ blur: avatarBlur,
28439
+ alert: account.alert || profile.alert,
28440
+ noOverride: avatarNoOverride
28441
+ }
28442
+ };
28443
+ }
28444
+ function moderatePost(subject, opts) {
28445
+ const post = decidePost(subject, opts);
28446
+ const account = decideAccount(subject.author, opts);
28447
+ const profile = decideProfile(subject.author, opts);
28448
+ let quote;
28449
+ let quotedAccount;
28450
+ if (isQuotedPost(subject.embed)) {
28451
+ quote = decideQuotedPost(subject.embed, opts);
28452
+ quotedAccount = decideQuotedPostAccount(subject.embed, opts);
28453
+ } else if (isQuotedPostWithMedia(subject.embed)) {
28454
+ quote = decideQuotedPostWithMedia(subject.embed, opts);
28455
+ quotedAccount = decideQuotedPostWithMediaAccount(subject.embed, opts);
28456
+ }
28457
+ if (!isModerationDecisionNoop(post) && post.did === opts.userDid) {
28458
+ downgradeDecision(post, { alert: true });
28459
+ }
28460
+ if (!isModerationDecisionNoop(account) && account.did === opts.userDid) {
28461
+ downgradeDecision(account, { alert: false });
28462
+ }
28463
+ if (!isModerationDecisionNoop(profile) && profile.did === opts.userDid) {
28464
+ downgradeDecision(profile, { alert: false });
28465
+ }
28466
+ if (quote && !isModerationDecisionNoop(quote) && quote.did === opts.userDid) {
28467
+ downgradeDecision(quote, { alert: true });
28468
+ }
28469
+ if (quotedAccount && !isModerationDecisionNoop(quotedAccount) && quotedAccount.did === opts.userDid) {
28470
+ downgradeDecision(quotedAccount, { alert: false });
28471
+ }
28472
+ const mergedForFeed = takeHighestPriorityDecision(
28473
+ post,
28474
+ account,
28475
+ quote,
28476
+ quotedAccount
28477
+ );
28478
+ const mergedForView = takeHighestPriorityDecision(post, account);
28479
+ const mergedQuote = takeHighestPriorityDecision(quote, quotedAccount);
28480
+ let blurAvatar = false;
28481
+ if ((account.blur || account.blurMedia) && account.cause?.type !== "muted") {
28482
+ blurAvatar = true;
28483
+ } else if ((profile.blur || profile.blurMedia) && profile.cause?.type !== "muted") {
28484
+ blurAvatar = true;
28485
+ }
28486
+ return {
28487
+ decisions: { post, account, profile, quote, quotedAccount },
28488
+ content: {
28489
+ cause: !isModerationDecisionNoop(mergedForView) ? mergedForView.cause : mergedForFeed.filter ? mergedForFeed.cause : void 0,
28490
+ filter: mergedForFeed.filter,
28491
+ blur: mergedForView.blur,
28492
+ alert: mergedForView.alert,
28493
+ noOverride: mergedForView.noOverride
28494
+ },
28495
+ avatar: {
28496
+ blur: blurAvatar,
28497
+ alert: account.alert || profile.alert,
28498
+ noOverride: account.noOverride || profile.noOverride
28499
+ },
28500
+ embed: !isModerationDecisionNoop(mergedQuote, { ignoreFilter: true }) ? {
28501
+ cause: mergedQuote.cause,
28502
+ blur: mergedQuote.blur,
28503
+ alert: mergedQuote.alert,
28504
+ noOverride: mergedQuote.noOverride
28505
+ } : account.blurMedia ? {
28506
+ cause: account.cause,
28507
+ blur: true,
28508
+ noOverride: account.noOverride
28509
+ } : post.blurMedia ? {
28510
+ cause: post.cause,
28511
+ blur: true,
28512
+ noOverride: post.noOverride
28513
+ } : {}
28514
+ };
28515
+ }
28516
+ function moderateFeedGenerator(subject, opts) {
28517
+ const feedGenerator = decideFeedGenerator(subject, opts);
28518
+ const account = decideAccount(subject.creator, opts);
28519
+ const profile = decideProfile(subject.creator, opts);
28520
+ const merged = takeHighestPriorityDecision(feedGenerator, account);
28521
+ return {
28522
+ decisions: { feedGenerator, account, profile },
28523
+ content: {
28524
+ cause: isModerationDecisionNoop(merged) ? void 0 : merged.cause,
28525
+ filter: merged.filter,
28526
+ blur: merged.blur,
28527
+ alert: merged.alert,
28528
+ noOverride: merged.noOverride
28529
+ },
28530
+ avatar: {
28531
+ blur: account.blurMedia || profile.blurMedia,
28532
+ alert: account.alert,
28533
+ noOverride: account.noOverride || profile.noOverride
28534
+ }
28535
+ };
28536
+ }
28537
+ function moderateUserList(subject, opts) {
28538
+ const userList = decideUserList(subject, opts);
28539
+ const account = defs_exports5.isProfileViewBasic(subject.creator) ? decideAccount(subject.creator, opts) : ModerationDecision.noop();
28540
+ const profile = defs_exports5.isProfileViewBasic(subject.creator) ? decideProfile(subject.creator, opts) : ModerationDecision.noop();
28541
+ const merged = takeHighestPriorityDecision(userList, account);
28542
+ return {
28543
+ decisions: { userList, account, profile },
28544
+ content: {
28545
+ cause: isModerationDecisionNoop(merged) ? void 0 : merged.cause,
28546
+ filter: merged.filter,
28547
+ blur: merged.blur,
28548
+ alert: merged.alert,
28549
+ noOverride: merged.noOverride
28550
+ },
28551
+ avatar: {
28552
+ blur: account.blurMedia || profile.blurMedia,
28553
+ alert: account.alert,
28554
+ noOverride: account.noOverride || profile.noOverride
28555
+ }
28556
+ };
28557
+ }
28558
+
28559
+ // src/moderation/const/label-groups.ts
28560
+ var LABEL_GROUPS = {
28561
+ system: {
28562
+ id: "system",
28563
+ configurable: false,
28564
+ labels: [LABELS["!hide"], LABELS["!no-promote"], LABELS["!warn"]],
28565
+ strings: {
28566
+ settings: {
28567
+ en: {
28568
+ name: "System",
28569
+ description: "Moderator overrides for special cases."
28570
+ }
28571
+ }
28572
+ }
28573
+ },
28574
+ legal: {
28575
+ id: "legal",
28576
+ configurable: false,
28577
+ labels: [LABELS["dmca-violation"], LABELS["doxxing"]],
28578
+ strings: {
28579
+ settings: {
28580
+ en: {
28581
+ name: "Legal",
28582
+ description: "Content removed for legal reasons."
28583
+ }
28584
+ }
28585
+ }
28586
+ },
28587
+ sexual: {
28588
+ id: "sexual",
28589
+ configurable: true,
28590
+ labels: [LABELS["porn"], LABELS["sexual"], LABELS["nudity"]],
28591
+ strings: {
28592
+ settings: {
28593
+ en: {
28594
+ name: "Adult Content",
28595
+ description: "Content which is sexual in nature."
28596
+ }
28597
+ }
28598
+ }
28599
+ },
28600
+ violence: {
28601
+ id: "violence",
28602
+ configurable: true,
28603
+ labels: [
28604
+ LABELS["nsfl"],
28605
+ LABELS["corpse"],
28606
+ LABELS["gore"],
28607
+ LABELS["torture"],
28608
+ LABELS["self-harm"]
28609
+ ],
28610
+ strings: {
28611
+ settings: {
28612
+ en: {
28613
+ name: "Violence",
28614
+ description: "Content which is violent or deeply disturbing."
28615
+ }
28616
+ }
28617
+ }
28618
+ },
28619
+ intolerance: {
28620
+ id: "intolerance",
28621
+ configurable: true,
28622
+ labels: [
28623
+ LABELS["intolerant-race"],
28624
+ LABELS["intolerant-gender"],
28625
+ LABELS["intolerant-sexual-orientation"],
28626
+ LABELS["intolerant-religion"],
28627
+ LABELS["intolerant"],
28628
+ LABELS["icon-intolerant"]
28629
+ ],
28630
+ strings: {
28631
+ settings: {
28632
+ en: {
28633
+ name: "Intolerance",
28634
+ description: "Content or behavior which is hateful or intolerant toward a group of people."
28635
+ }
28636
+ }
28637
+ }
28638
+ },
28639
+ rude: {
28640
+ id: "rude",
28641
+ configurable: true,
28642
+ labels: [LABELS["threat"]],
28643
+ strings: {
28644
+ settings: {
28645
+ en: {
28646
+ name: "Rude",
28647
+ description: "Behavior which is rude toward other users."
28648
+ }
28649
+ }
28650
+ }
28651
+ },
28652
+ curation: {
28653
+ id: "curation",
28654
+ configurable: true,
28655
+ labels: [LABELS["spoiler"]],
28656
+ strings: {
28657
+ settings: {
28658
+ en: {
28659
+ name: "Curational",
28660
+ description: "Subjective moderation geared towards curating a more positive environment."
28661
+ }
28662
+ }
28663
+ }
28664
+ },
28665
+ spam: {
28666
+ id: "spam",
28667
+ configurable: true,
28668
+ labels: [LABELS["spam"]],
28669
+ strings: {
28670
+ settings: {
28671
+ en: {
28672
+ name: "Spam",
28673
+ description: "Content which doesn't add to the conversation."
28674
+ }
28675
+ }
28676
+ }
28677
+ },
28678
+ misinfo: {
28679
+ id: "misinfo",
28680
+ configurable: true,
28681
+ labels: [
28682
+ LABELS["account-security"],
28683
+ LABELS["net-abuse"],
28684
+ LABELS["impersonation"],
28685
+ LABELS["scam"]
28686
+ ],
28687
+ strings: {
28688
+ settings: {
28689
+ en: {
28690
+ name: "Misinformation",
28691
+ description: "Content which misleads or defrauds users."
28692
+ }
28693
+ }
28694
+ }
28695
+ }
28696
+ };
28697
+
27309
28698
  // src/bsky-agent.ts
27310
28699
  var BskyAgent = class extends AtpAgent {
27311
28700
  constructor() {