@fedify/vocab 2.4.0-dev.1962 → 2.4.0-dev.1964

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/mod.cjs CHANGED
@@ -34,7 +34,7 @@ let _fedify_vocab_runtime_temporal = require("@fedify/vocab-runtime/temporal");
34
34
  let es_toolkit = require("es-toolkit");
35
35
  //#region deno.json
36
36
  var name = "@fedify/vocab";
37
- var version = "2.4.0-dev.1962+8aaa5348";
37
+ var version = "2.4.0-dev.1964+1d28dc03";
38
38
  //#endregion
39
39
  //#region src/type.ts
40
40
  function getTypeId(object) {
@@ -3651,6 +3651,29 @@ function isValidLanguageTag(language) {
3651
3651
  throw error;
3652
3652
  }
3653
3653
  }
3654
+ const extraPropertyContexts = {
3655
+ "https://schema.org/translator": "https://w3id.org/fep/22cd",
3656
+ "https://w3id.org/fep/22cd#translations": "https://w3id.org/fep/22cd"
3657
+ };
3658
+ function getExtraContexts(document) {
3659
+ const contexts = /* @__PURE__ */ new Set();
3660
+ const pending = [document];
3661
+ while (pending.length > 0) {
3662
+ const value = pending.pop();
3663
+ if (value == null || typeof value !== "object") continue;
3664
+ if (Array.isArray(value)) {
3665
+ for (const item of value) pending.push(item);
3666
+ continue;
3667
+ }
3668
+ if ("@value" in value) continue;
3669
+ for (const [key, child] of globalThis.Object.entries(value)) {
3670
+ if (key === "@context") continue;
3671
+ if (globalThis.Object.hasOwn(extraPropertyContexts, key)) contexts.add(extraPropertyContexts[key]);
3672
+ pending.push(child);
3673
+ }
3674
+ }
3675
+ return [...contexts];
3676
+ }
3654
3677
  const PORTABLE_IRI_PATTERN = /^ap(?:\+ef61)?:\/\//i;
3655
3678
  const PORTABLE_IRI_KEYS = /* @__PURE__ */ new Set([
3656
3679
  "@id",
@@ -3699,6 +3722,9 @@ const PORTABLE_IRI_KEYS = /* @__PURE__ */ new Set([
3699
3722
  "https://gotosocial.org/ns#manualApproval",
3700
3723
  "https://gotosocial.org/ns#replyAuthorization",
3701
3724
  "https://misskey-hub.net/ns#_misskey_quote",
3725
+ "https://schema.org/isBasedOn",
3726
+ "https://schema.org/translationOfWork",
3727
+ "https://schema.org/translator",
3702
3728
  "https://w3id.org/fep/044f#quote",
3703
3729
  "https://w3id.org/fep/044f#quoteAuthorization",
3704
3730
  "https://w3id.org/fep/5711#followersOf",
@@ -3785,6 +3811,7 @@ const PORTABLE_IRI_KEYS = /* @__PURE__ */ new Set([
3785
3811
  "instrument",
3786
3812
  "interactingObject",
3787
3813
  "interactionTarget",
3814
+ "isBasedOn",
3788
3815
  "items",
3789
3816
  "last",
3790
3817
  "likeAuthorization",
@@ -3833,6 +3860,8 @@ const PORTABLE_IRI_KEYS = /* @__PURE__ */ new Set([
3833
3860
  "tag",
3834
3861
  "target",
3835
3862
  "to",
3863
+ "translationOfWork",
3864
+ "translator",
3836
3865
  "units",
3837
3866
  "uploadMedia",
3838
3867
  "url"
@@ -3950,6 +3979,7 @@ var Object$1 = class Object$1 {
3950
3979
  #_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = /* @__PURE__ */ new Set();
3951
3980
  #_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = [];
3952
3981
  #_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = /* @__PURE__ */ new Set();
3982
+ #_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = [];
3953
3983
  /**
3954
3984
  * Constructs a new instance of Object with the given values.
3955
3985
  * @param values The values to initialize the instance with.
@@ -4188,6 +4218,8 @@ var Object$1 = class Object$1 {
4188
4218
  this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = [values.announceAuthorization];
4189
4219
  this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.add(0);
4190
4220
  } else throw new TypeError("The announceAuthorization must be of type AnnounceAuthorization | URL.");
4221
+ if ("translations" in values && values.translations != null) if (Array.isArray(values.translations) && values.translations.every((v) => v instanceof Translation)) this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = values.translations;
4222
+ else throw new TypeError("The translations must be an array of type Translation.");
4191
4223
  }
4192
4224
  /**
4193
4225
  * Clones this instance, optionally updating it with the given values.
@@ -4504,6 +4536,9 @@ var Object$1 = class Object$1 {
4504
4536
  clone.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = [values.announceAuthorization];
4505
4537
  clone.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = /* @__PURE__ */ new Set([0]);
4506
4538
  } else throw new TypeError("The announceAuthorization must be of type AnnounceAuthorization | URL.");
4539
+ clone.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations;
4540
+ if ("translations" in values && values.translations != null) if (Array.isArray(values.translations) && values.translations.every((v) => v instanceof Translation)) clone.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = values.translations;
4541
+ else throw new TypeError("The translations must be an array of type Translation.");
4507
4542
  return clone;
4508
4543
  }
4509
4544
  async #fetchAttachment(url, options = {}) {
@@ -8274,6 +8309,16 @@ var Object$1 = class Object$1 {
8274
8309
  }
8275
8310
  return v;
8276
8311
  }
8312
+ /** Translation metadata for the language versions in this object's content,
8313
+ * name, or summary maps, as defined by the draft
8314
+ * [FEP-22cd](https://w3id.org/fep/22cd). Each entry describes one translated
8315
+ * language; directly authored languages have no entry. The entries share
8316
+ * this object's identity, replies, and reactions. Translator credit grants
8317
+ * no authority to update the object.
8318
+ */
8319
+ get translations() {
8320
+ return this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations;
8321
+ }
8277
8322
  /**
8278
8323
  * Converts this object to a JSON-LD structure.
8279
8324
  * @param options The options to use.
@@ -8676,6 +8721,16 @@ var Object$1 = class Object$1 {
8676
8721
  compactItems.push(item);
8677
8722
  }
8678
8723
  if (compactItems.length > 0) result["announceAuthorization"] = compactItems.length > 1 ? compactItems : compactItems[0];
8724
+ compactItems = [];
8725
+ for (const v of this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations) {
8726
+ const item = await v.toJsonLd({
8727
+ ...options,
8728
+ format: void 0,
8729
+ context: void 0
8730
+ });
8731
+ compactItems.push(item);
8732
+ }
8733
+ if (compactItems.length > 0) result["translations"] = compactItems.length > 1 ? compactItems : compactItems[0];
8679
8734
  result["type"] = "Object";
8680
8735
  if (this.id != null) result["id"] = (0, _fedify_vocab_runtime.formatIri)(this.id);
8681
8736
  result["@context"] = [
@@ -9126,13 +9181,24 @@ var Object$1 = class Object$1 {
9126
9181
  array.push(element);
9127
9182
  }
9128
9183
  if (array.length > 0) values["https://gotosocial.org/ns#announceAuthorization"] = array;
9184
+ array = [];
9185
+ for (const v of this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations) {
9186
+ let element = await v.toJsonLd(options);
9187
+ if (Array.isArray(element)) {
9188
+ if (element.length < 1) continue;
9189
+ if (element.length == 1) element = element[0];
9190
+ }
9191
+ if (typeof element === "undefined") continue;
9192
+ array.push(element);
9193
+ }
9194
+ if (array.length > 0) values["https://w3id.org/fep/22cd#translations"] = array;
9129
9195
  values["@type"] = ["https://www.w3.org/ns/activitystreams#Object"];
9130
9196
  if (this.id != null) values["@id"] = (0, _fedify_vocab_runtime.formatIri)(this.id);
9131
9197
  if (options.format === "expand") return await _fedify_vocab_runtime_jsonld.default.expand(values, {
9132
9198
  documentLoader: options.contextLoader,
9133
9199
  keepFreeFloatingNodes: true
9134
9200
  });
9135
- const docContext = options.context ?? [
9201
+ let docContext = options.context ?? [
9136
9202
  "https://www.w3.org/ns/activitystreams",
9137
9203
  "https://w3id.org/security/data-integrity/v1",
9138
9204
  "https://gotosocial.org/ns",
@@ -9145,7 +9211,15 @@ var Object$1 = class Object$1 {
9145
9211
  }
9146
9212
  }
9147
9213
  ];
9148
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
9214
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
9215
+ if (options.context == null) {
9216
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
9217
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
9218
+ if (additionalContexts.length > 0) {
9219
+ docContext = [...currentContexts, ...additionalContexts];
9220
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
9221
+ }
9222
+ }
9149
9223
  if (docContext != null) {
9150
9224
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
9151
9225
  else compacted.proof["@context"] = docContext;
@@ -9158,6 +9232,7 @@ var Object$1 = class Object$1 {
9158
9232
  if (this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary != null && this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary.length > 0) return false;
9159
9233
  if (this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof != null && this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length > 0) return false;
9160
9234
  if (this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy != null && this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy.length > 0) return false;
9235
+ if (this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations != null && this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations.length > 0) return false;
9161
9236
  return true;
9162
9237
  }
9163
9238
  /**
@@ -10559,6 +10634,22 @@ var Object$1 = class Object$1 {
10559
10634
  _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.push(decoded);
10560
10635
  }
10561
10636
  instance.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization;
10637
+ const _a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = [];
10638
+ let _a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations__array = values["https://w3id.org/fep/22cd#translations"];
10639
+ for (const v of _a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations__array == null ? [] : _a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations__array.length === 1 && "@list" in _a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations__array[0] ? _a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations__array[0]["@list"] : _a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations__array) {
10640
+ if (v == null) continue;
10641
+ const decoded = await Translation.fromJsonLd(v, {
10642
+ ...options,
10643
+ baseUrl: options.baseUrl
10644
+ });
10645
+ if (typeof decoded === "undefined") {
10646
+ shouldCacheJsonLd = false;
10647
+ continue;
10648
+ }
10649
+ if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
10650
+ _a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations.push(decoded);
10651
+ }
10652
+ instance.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = _a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations;
10562
10653
  instance._shouldCacheJsonLd = shouldCacheJsonLd;
10563
10654
  if (shouldCacheJsonLd && (!("_fromSubclass" in options) || !options._fromSubclass)) try {
10564
10655
  if (cacheJsonLd != null && cacheJsonLd !== expanded) {
@@ -10779,6 +10870,11 @@ var Object$1 = class Object$1 {
10779
10870
  [Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
10780
10871
  } : v);
10781
10872
  if (_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.length == 1) proxy.announceAuthorization = _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization[0];
10873
+ const _a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations.map((v) => v instanceof URL ? {
10874
+ [Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
10875
+ [Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
10876
+ } : v);
10877
+ if (_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations.length > 1 || !("translation" in proxy) && _a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations.length > 0) proxy.translations = _a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations;
10782
10878
  return proxy;
10783
10879
  }
10784
10880
  };
@@ -10863,11 +10959,19 @@ var Emoji = class Emoji extends Object$1 {
10863
10959
  documentLoader: options.contextLoader,
10864
10960
  keepFreeFloatingNodes: true
10865
10961
  });
10866
- const docContext = options.context ?? ["https://www.w3.org/ns/activitystreams", {
10962
+ let docContext = options.context ?? ["https://www.w3.org/ns/activitystreams", {
10867
10963
  "toot": "http://joinmastodon.org/ns#",
10868
10964
  "Emoji": "toot:Emoji"
10869
10965
  }];
10870
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
10966
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
10967
+ if (options.context == null) {
10968
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
10969
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
10970
+ if (additionalContexts.length > 0) {
10971
+ docContext = [...currentContexts, ...additionalContexts];
10972
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
10973
+ }
10974
+ }
10871
10975
  if (docContext != null) {
10872
10976
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
10873
10977
  else compacted.proof["@context"] = docContext;
@@ -11441,7 +11545,7 @@ var ChatMessage = class ChatMessage extends Object$1 {
11441
11545
  documentLoader: options.contextLoader,
11442
11546
  keepFreeFloatingNodes: true
11443
11547
  });
11444
- const docContext = options.context ?? [
11548
+ let docContext = options.context ?? [
11445
11549
  "https://www.w3.org/ns/activitystreams",
11446
11550
  "https://w3id.org/security/data-integrity/v1",
11447
11551
  "https://gotosocial.org/ns",
@@ -11469,7 +11573,15 @@ var ChatMessage = class ChatMessage extends Object$1 {
11469
11573
  }
11470
11574
  }
11471
11575
  ];
11472
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
11576
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
11577
+ if (options.context == null) {
11578
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
11579
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
11580
+ if (additionalContexts.length > 0) {
11581
+ docContext = [...currentContexts, ...additionalContexts];
11582
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
11583
+ }
11584
+ }
11473
11585
  if (docContext != null) {
11474
11586
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
11475
11587
  else compacted.proof["@context"] = docContext;
@@ -13031,14 +13143,22 @@ var Activity = class Activity extends Object$1 {
13031
13143
  documentLoader: options.contextLoader,
13032
13144
  keepFreeFloatingNodes: true
13033
13145
  });
13034
- const docContext = options.context ?? [
13146
+ let docContext = options.context ?? [
13035
13147
  "https://w3id.org/identity/v1",
13036
13148
  "https://www.w3.org/ns/activitystreams",
13037
13149
  "https://w3id.org/security/v1",
13038
13150
  "https://w3id.org/security/data-integrity/v1",
13039
13151
  "https://gotosocial.org/ns"
13040
13152
  ];
13041
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
13153
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
13154
+ if (options.context == null) {
13155
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
13156
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
13157
+ if (additionalContexts.length > 0) {
13158
+ docContext = [...currentContexts, ...additionalContexts];
13159
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
13160
+ }
13161
+ }
13042
13162
  if (docContext != null) {
13043
13163
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
13044
13164
  else compacted.proof["@context"] = docContext;
@@ -13413,7 +13533,7 @@ var EmojiReact = class EmojiReact extends Activity {
13413
13533
  documentLoader: options.contextLoader,
13414
13534
  keepFreeFloatingNodes: true
13415
13535
  });
13416
- const docContext = options.context ?? [
13536
+ let docContext = options.context ?? [
13417
13537
  "https://w3id.org/identity/v1",
13418
13538
  "https://www.w3.org/ns/activitystreams",
13419
13539
  "https://w3id.org/security/data-integrity/v1",
@@ -13425,7 +13545,15 @@ var EmojiReact = class EmojiReact extends Activity {
13425
13545
  "Emoji": "toot:Emoji"
13426
13546
  }
13427
13547
  ];
13428
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
13548
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
13549
+ if (options.context == null) {
13550
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
13551
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
13552
+ if (additionalContexts.length > 0) {
13553
+ docContext = [...currentContexts, ...additionalContexts];
13554
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
13555
+ }
13556
+ }
13429
13557
  if (docContext != null) {
13430
13558
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
13431
13559
  else compacted.proof["@context"] = docContext;
@@ -13718,12 +13846,20 @@ var PropertyValue = class {
13718
13846
  documentLoader: options.contextLoader,
13719
13847
  keepFreeFloatingNodes: true
13720
13848
  });
13721
- const docContext = options.context ?? ["https://www.w3.org/ns/activitystreams", {
13849
+ let docContext = options.context ?? ["https://www.w3.org/ns/activitystreams", {
13722
13850
  "schema": "http://schema.org#",
13723
13851
  "PropertyValue": "schema:PropertyValue",
13724
13852
  "value": "schema:value"
13725
13853
  }];
13726
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
13854
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
13855
+ if (options.context == null) {
13856
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
13857
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
13858
+ if (additionalContexts.length > 0) {
13859
+ docContext = [...currentContexts, ...additionalContexts];
13860
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
13861
+ }
13862
+ }
13727
13863
  if (docContext != null) {}
13728
13864
  return compacted;
13729
13865
  }
@@ -14043,12 +14179,20 @@ var Measure = class {
14043
14179
  documentLoader: options.contextLoader,
14044
14180
  keepFreeFloatingNodes: true
14045
14181
  });
14046
- const docContext = options.context ?? ["https://www.w3.org/ns/activitystreams", {
14182
+ let docContext = options.context ?? ["https://www.w3.org/ns/activitystreams", {
14047
14183
  "om2": "http://www.ontology-of-units-of-measure.org/resource/om-2/",
14048
14184
  "hasUnit": "om2:hasUnit",
14049
14185
  "hasNumericalValue": "om2:hasNumericalValue"
14050
14186
  }];
14051
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
14187
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
14188
+ if (options.context == null) {
14189
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
14190
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
14191
+ if (additionalContexts.length > 0) {
14192
+ docContext = [...currentContexts, ...additionalContexts];
14193
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
14194
+ }
14195
+ }
14052
14196
  if (docContext != null) {}
14053
14197
  return compacted;
14054
14198
  }
@@ -14585,246 +14729,262 @@ var AnnounceAuthorization = class AnnounceAuthorization extends Object$1 {
14585
14729
  documentLoader: options.contextLoader,
14586
14730
  keepFreeFloatingNodes: true
14587
14731
  });
14588
- const docContext = options.context ?? [
14732
+ let docContext = options.context ?? [
14589
14733
  "https://www.w3.org/ns/activitystreams",
14590
14734
  "https://w3id.org/security/data-integrity/v1",
14591
14735
  "https://gotosocial.org/ns"
14592
14736
  ];
14593
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
14594
- if (docContext != null) {
14595
- if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
14596
- else compacted.proof["@context"] = docContext;
14597
- }
14598
- return compacted;
14599
- }
14600
- isCompactable() {
14601
- return super.isCompactable();
14602
- }
14603
- /**
14604
- * Converts a JSON-LD structure to an object of this type.
14605
- * @param json The JSON-LD structure to convert.
14606
- * @param options The options to use.
14607
- * - `documentLoader`: The loader for remote JSON-LD documents.
14608
- * - `contextLoader`: The loader for remote JSON-LD contexts.
14609
- * - `tracerProvider`: The OpenTelemetry tracer provider to use.
14610
- * If omitted, the global tracer provider is used.
14611
- * @returns The object of this type.
14612
- * @throws {TypeError} If the given `json` is invalid.
14613
- */
14614
- static async fromJsonLd(json, options = {}) {
14615
- return await (options.tracerProvider ?? _opentelemetry_api.trace.getTracerProvider()).getTracer("@fedify/vocab-tools", "2.4.0").startActiveSpan("activitypub.parse_object", async (span) => {
14616
- try {
14617
- const object = await this.__fromJsonLd__AnnounceAuthorization__(json, span, options);
14618
- if (object.id != null) span.setAttribute("activitypub.object.id", object.id.href);
14619
- return object;
14620
- } catch (error) {
14621
- span.setStatus({
14622
- code: _opentelemetry_api.SpanStatusCode.ERROR,
14623
- message: String(error)
14624
- });
14625
- throw error;
14626
- } finally {
14627
- span.end();
14737
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
14738
+ if (options.context == null) {
14739
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
14740
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
14741
+ if (additionalContexts.length > 0) {
14742
+ docContext = [...currentContexts, ...additionalContexts];
14743
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
14744
+ }
14745
+ }
14746
+ if (docContext != null) {
14747
+ if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
14748
+ else compacted.proof["@context"] = docContext;
14749
+ }
14750
+ return compacted;
14751
+ }
14752
+ isCompactable() {
14753
+ return super.isCompactable();
14754
+ }
14755
+ /**
14756
+ * Converts a JSON-LD structure to an object of this type.
14757
+ * @param json The JSON-LD structure to convert.
14758
+ * @param options The options to use.
14759
+ * - `documentLoader`: The loader for remote JSON-LD documents.
14760
+ * - `contextLoader`: The loader for remote JSON-LD contexts.
14761
+ * - `tracerProvider`: The OpenTelemetry tracer provider to use.
14762
+ * If omitted, the global tracer provider is used.
14763
+ * @returns The object of this type.
14764
+ * @throws {TypeError} If the given `json` is invalid.
14765
+ */
14766
+ static async fromJsonLd(json, options = {}) {
14767
+ return await (options.tracerProvider ?? _opentelemetry_api.trace.getTracerProvider()).getTracer("@fedify/vocab-tools", "2.4.0").startActiveSpan("activitypub.parse_object", async (span) => {
14768
+ try {
14769
+ const object = await this.__fromJsonLd__AnnounceAuthorization__(json, span, options);
14770
+ if (object.id != null) span.setAttribute("activitypub.object.id", object.id.href);
14771
+ return object;
14772
+ } catch (error) {
14773
+ span.setStatus({
14774
+ code: _opentelemetry_api.SpanStatusCode.ERROR,
14775
+ message: String(error)
14776
+ });
14777
+ throw error;
14778
+ } finally {
14779
+ span.end();
14780
+ }
14781
+ });
14782
+ }
14783
+ static async __fromJsonLd__AnnounceAuthorization__(json, span, options = {}) {
14784
+ if (typeof json === "undefined") throw new TypeError("Invalid JSON-LD: undefined.");
14785
+ else if (json === null) throw new TypeError("Invalid JSON-LD: null.");
14786
+ options = {
14787
+ ...options,
14788
+ documentLoader: options.documentLoader ?? (0, _fedify_vocab_runtime.getDocumentLoader)(),
14789
+ contextLoader: options.contextLoader ?? (0, _fedify_vocab_runtime.getDocumentLoader)(),
14790
+ tracerProvider: options.tracerProvider ?? _opentelemetry_api.trace.getTracerProvider()
14791
+ };
14792
+ let values;
14793
+ let expanded;
14794
+ if ("_fromSubclass" in options && options._fromSubclass && typeof json === "object" && !Array.isArray(json)) {
14795
+ values = json;
14796
+ expanded = [values];
14797
+ } else if (globalThis.Object.keys(json).length == 0) {
14798
+ values = {};
14799
+ expanded = [values];
14800
+ } else {
14801
+ expanded = await _fedify_vocab_runtime_jsonld.default.expand(json, {
14802
+ documentLoader: options.contextLoader,
14803
+ keepFreeFloatingNodes: true
14804
+ });
14805
+ values = expanded[0] ?? {};
14806
+ }
14807
+ const id = (0, _fedify_vocab_runtime.parseJsonLdId)(values["@id"], options.baseUrl);
14808
+ if (id != null && options.baseUrl == null) options = {
14809
+ ...options,
14810
+ baseUrl: id
14811
+ };
14812
+ if ("@type" in values) span.setAttribute("activitypub.object.type", values["@type"]);
14813
+ if ("@type" in values && !values["@type"].every((t) => t.startsWith("_:"))) {
14814
+ if (!values["@type"].includes("https://gotosocial.org/ns#AnnounceAuthorization")) throw new TypeError("Invalid type: " + values["@type"]);
14815
+ }
14816
+ let cacheJsonLd = !("_fromSubclass" in options) || !options._fromSubclass ? (0, _fedify_vocab_runtime_internal_jsonld_cache.normalizeJsonLdIris)(expanded, PORTABLE_IRI_KEYS, PORTABLE_IRI_PATTERN) : void 0;
14817
+ if (cacheJsonLd != null && cacheJsonLd !== expanded) cacheJsonLd = structuredClone(cacheJsonLd);
14818
+ const superValues = structuredClone(values);
14819
+ delete superValues["@type"];
14820
+ const instance = await super.fromJsonLd(superValues, {
14821
+ ...options,
14822
+ _fromSubclass: true
14823
+ });
14824
+ if (!(instance instanceof AnnounceAuthorization)) throw new TypeError("Unexpected type: " + instance.constructor.name);
14825
+ let shouldCacheJsonLd = instance._shouldCacheJsonLd;
14826
+ const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [];
14827
+ let _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array = values["https://gotosocial.org/ns#interactingObject"];
14828
+ for (const v of _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array == null ? [] : _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array.length === 1 && "@list" in _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array[0] ? _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array[0]["@list"] : _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array) {
14829
+ if (v == null) continue;
14830
+ if (typeof v === "object" && "@id" in v && !("@type" in v) && globalThis.Object.keys(v).length === 1) {
14831
+ if (v["@id"].startsWith("_:")) continue;
14832
+ _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push((0, _fedify_vocab_runtime.parseIri)(v["@id"], options.baseUrl));
14833
+ continue;
14834
+ }
14835
+ const decoded = await Object$1.fromJsonLd(v, {
14836
+ ...options,
14837
+ baseUrl: options.baseUrl
14838
+ });
14839
+ if (typeof decoded === "undefined") {
14840
+ shouldCacheJsonLd = false;
14841
+ continue;
14842
+ }
14843
+ if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
14844
+ _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push(decoded);
14845
+ }
14846
+ instance.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject;
14847
+ const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [];
14848
+ let _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array = values["https://gotosocial.org/ns#interactionTarget"];
14849
+ for (const v of _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array == null ? [] : _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array.length === 1 && "@list" in _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array[0] ? _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array[0]["@list"] : _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array) {
14850
+ if (v == null) continue;
14851
+ if (typeof v === "object" && "@id" in v && !("@type" in v) && globalThis.Object.keys(v).length === 1) {
14852
+ if (v["@id"].startsWith("_:")) continue;
14853
+ _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push((0, _fedify_vocab_runtime.parseIri)(v["@id"], options.baseUrl));
14854
+ continue;
14855
+ }
14856
+ const decoded = await Object$1.fromJsonLd(v, {
14857
+ ...options,
14858
+ baseUrl: options.baseUrl
14859
+ });
14860
+ if (typeof decoded === "undefined") {
14861
+ shouldCacheJsonLd = false;
14862
+ continue;
14863
+ }
14864
+ if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
14865
+ _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push(decoded);
14866
+ }
14867
+ instance.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget;
14868
+ instance._shouldCacheJsonLd = shouldCacheJsonLd;
14869
+ if (shouldCacheJsonLd && (!("_fromSubclass" in options) || !options._fromSubclass)) try {
14870
+ if (cacheJsonLd != null && cacheJsonLd !== expanded) {
14871
+ const compactArray = Array.isArray(json) && json.length === 1;
14872
+ const jsonLd = compactArray ? json[0] : json;
14873
+ const cachedJsonLd = await (0, _fedify_vocab_runtime_internal_jsonld_cache.compactJsonLdCache)(cacheJsonLd, jsonLd, options.contextLoader);
14874
+ instance._cachedJsonLd = compactArray ? [cachedJsonLd] : cachedJsonLd;
14875
+ } else instance._cachedJsonLd = structuredClone(json);
14876
+ } catch {
14877
+ (0, _logtape_logtape.getLogger)(["fedify", "vocab"]).warn("Failed to cache JSON-LD: {json}", { json });
14878
+ }
14879
+ return instance;
14880
+ }
14881
+ _getCustomInspectProxy() {
14882
+ const proxy = super._getCustomInspectProxy();
14883
+ const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.map((v) => v instanceof URL ? {
14884
+ [Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
14885
+ [Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
14886
+ } : v);
14887
+ if (_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length == 1) proxy.interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0];
14888
+ const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.map((v) => v instanceof URL ? {
14889
+ [Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
14890
+ [Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
14891
+ } : v);
14892
+ if (_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length == 1) proxy.interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0];
14893
+ return proxy;
14894
+ }
14895
+ };
14896
+ AnnounceAuthorization.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
14897
+ return "AnnounceAuthorization " + inspect(this._getCustomInspectProxy(), options);
14898
+ };
14899
+ AnnounceAuthorization.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
14900
+ return "AnnounceAuthorization " + inspect(this._getCustomInspectProxy(), options);
14901
+ };
14902
+ /** A request to announce (boost) a post that requires approval from
14903
+ * the post author.
14904
+ *
14905
+ * The `object` property references the post to be announced, and
14906
+ * the `instrument` property contains the {@link Announce} activity itself.
14907
+ *
14908
+ * The post author responds with an {@link Accept} (with an
14909
+ * {@link AnnounceAuthorization} as `result`) or a {@link Reject}.
14910
+ *
14911
+ * See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/)
14912
+ * for details.
14913
+ */
14914
+ var AnnounceRequest = class AnnounceRequest extends Activity {
14915
+ /**
14916
+ * The type URI of {@link AnnounceRequest}: `https://gotosocial.org/ns#AnnounceRequest`.
14917
+ */
14918
+ static get typeId() {
14919
+ return new URL("https://gotosocial.org/ns#AnnounceRequest");
14920
+ }
14921
+ /**
14922
+ * Constructs a new instance of AnnounceRequest with the given values.
14923
+ * @param values The values to initialize the instance with.
14924
+ * @param options The options to use for initialization.
14925
+ */
14926
+ constructor(values, options = {}) {
14927
+ super(values, options);
14928
+ }
14929
+ /**
14930
+ * Clones this instance, optionally updating it with the given values.
14931
+ * @param values The values to update the clone with.
14932
+ * @param options The options to use for cloning.
14933
+ * @returns The cloned instance.
14934
+ */
14935
+ clone(values = {}, options = {}) {
14936
+ if (this._warning != null) {
14937
+ (0, _logtape_logtape.getLogger)(this._warning.category).warn(this._warning.message, this._warning.values);
14938
+ options = {
14939
+ ...options,
14940
+ $warning: this._warning
14941
+ };
14942
+ }
14943
+ return super.clone(values, options);
14944
+ }
14945
+ /**
14946
+ * Converts this object to a JSON-LD structure.
14947
+ * @param options The options to use.
14948
+ * - `format`: The format of the output: `compact` or
14949
+ `expand`.
14950
+ * - `contextLoader`: The loader for remote JSON-LD contexts.
14951
+ * - `context`: The JSON-LD context to use. Not applicable
14952
+ when `format` is set to `'expand'`.
14953
+ * @returns The JSON-LD representation of this object.
14954
+ */
14955
+ async toJsonLd(options = {}) {
14956
+ if (options.format == null && this._cachedJsonLd != null) return this._cachedJsonLd;
14957
+ if (options.format !== "compact" && options.context != null) throw new TypeError("The context option can only be used when the format option is set to 'compact'.");
14958
+ options = {
14959
+ ...options,
14960
+ contextLoader: options.contextLoader ?? (0, _fedify_vocab_runtime.getDocumentLoader)()
14961
+ };
14962
+ const values = (await super.toJsonLd({
14963
+ ...options,
14964
+ format: "expand",
14965
+ context: void 0
14966
+ }))[0];
14967
+ values["@type"] = ["https://gotosocial.org/ns#AnnounceRequest"];
14968
+ if (this.id != null) values["@id"] = (0, _fedify_vocab_runtime.formatIri)(this.id);
14969
+ if (options.format === "expand") return await _fedify_vocab_runtime_jsonld.default.expand(values, {
14970
+ documentLoader: options.contextLoader,
14971
+ keepFreeFloatingNodes: true
14972
+ });
14973
+ let docContext = options.context ?? [
14974
+ "https://w3id.org/identity/v1",
14975
+ "https://www.w3.org/ns/activitystreams",
14976
+ "https://w3id.org/security/data-integrity/v1",
14977
+ "https://gotosocial.org/ns"
14978
+ ];
14979
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
14980
+ if (options.context == null) {
14981
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
14982
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
14983
+ if (additionalContexts.length > 0) {
14984
+ docContext = [...currentContexts, ...additionalContexts];
14985
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
14628
14986
  }
14629
- });
14630
- }
14631
- static async __fromJsonLd__AnnounceAuthorization__(json, span, options = {}) {
14632
- if (typeof json === "undefined") throw new TypeError("Invalid JSON-LD: undefined.");
14633
- else if (json === null) throw new TypeError("Invalid JSON-LD: null.");
14634
- options = {
14635
- ...options,
14636
- documentLoader: options.documentLoader ?? (0, _fedify_vocab_runtime.getDocumentLoader)(),
14637
- contextLoader: options.contextLoader ?? (0, _fedify_vocab_runtime.getDocumentLoader)(),
14638
- tracerProvider: options.tracerProvider ?? _opentelemetry_api.trace.getTracerProvider()
14639
- };
14640
- let values;
14641
- let expanded;
14642
- if ("_fromSubclass" in options && options._fromSubclass && typeof json === "object" && !Array.isArray(json)) {
14643
- values = json;
14644
- expanded = [values];
14645
- } else if (globalThis.Object.keys(json).length == 0) {
14646
- values = {};
14647
- expanded = [values];
14648
- } else {
14649
- expanded = await _fedify_vocab_runtime_jsonld.default.expand(json, {
14650
- documentLoader: options.contextLoader,
14651
- keepFreeFloatingNodes: true
14652
- });
14653
- values = expanded[0] ?? {};
14654
- }
14655
- const id = (0, _fedify_vocab_runtime.parseJsonLdId)(values["@id"], options.baseUrl);
14656
- if (id != null && options.baseUrl == null) options = {
14657
- ...options,
14658
- baseUrl: id
14659
- };
14660
- if ("@type" in values) span.setAttribute("activitypub.object.type", values["@type"]);
14661
- if ("@type" in values && !values["@type"].every((t) => t.startsWith("_:"))) {
14662
- if (!values["@type"].includes("https://gotosocial.org/ns#AnnounceAuthorization")) throw new TypeError("Invalid type: " + values["@type"]);
14663
14987
  }
14664
- let cacheJsonLd = !("_fromSubclass" in options) || !options._fromSubclass ? (0, _fedify_vocab_runtime_internal_jsonld_cache.normalizeJsonLdIris)(expanded, PORTABLE_IRI_KEYS, PORTABLE_IRI_PATTERN) : void 0;
14665
- if (cacheJsonLd != null && cacheJsonLd !== expanded) cacheJsonLd = structuredClone(cacheJsonLd);
14666
- const superValues = structuredClone(values);
14667
- delete superValues["@type"];
14668
- const instance = await super.fromJsonLd(superValues, {
14669
- ...options,
14670
- _fromSubclass: true
14671
- });
14672
- if (!(instance instanceof AnnounceAuthorization)) throw new TypeError("Unexpected type: " + instance.constructor.name);
14673
- let shouldCacheJsonLd = instance._shouldCacheJsonLd;
14674
- const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [];
14675
- let _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array = values["https://gotosocial.org/ns#interactingObject"];
14676
- for (const v of _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array == null ? [] : _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array.length === 1 && "@list" in _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array[0] ? _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array[0]["@list"] : _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array) {
14677
- if (v == null) continue;
14678
- if (typeof v === "object" && "@id" in v && !("@type" in v) && globalThis.Object.keys(v).length === 1) {
14679
- if (v["@id"].startsWith("_:")) continue;
14680
- _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push((0, _fedify_vocab_runtime.parseIri)(v["@id"], options.baseUrl));
14681
- continue;
14682
- }
14683
- const decoded = await Object$1.fromJsonLd(v, {
14684
- ...options,
14685
- baseUrl: options.baseUrl
14686
- });
14687
- if (typeof decoded === "undefined") {
14688
- shouldCacheJsonLd = false;
14689
- continue;
14690
- }
14691
- if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
14692
- _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push(decoded);
14693
- }
14694
- instance.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject;
14695
- const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [];
14696
- let _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array = values["https://gotosocial.org/ns#interactionTarget"];
14697
- for (const v of _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array == null ? [] : _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array.length === 1 && "@list" in _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array[0] ? _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array[0]["@list"] : _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array) {
14698
- if (v == null) continue;
14699
- if (typeof v === "object" && "@id" in v && !("@type" in v) && globalThis.Object.keys(v).length === 1) {
14700
- if (v["@id"].startsWith("_:")) continue;
14701
- _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push((0, _fedify_vocab_runtime.parseIri)(v["@id"], options.baseUrl));
14702
- continue;
14703
- }
14704
- const decoded = await Object$1.fromJsonLd(v, {
14705
- ...options,
14706
- baseUrl: options.baseUrl
14707
- });
14708
- if (typeof decoded === "undefined") {
14709
- shouldCacheJsonLd = false;
14710
- continue;
14711
- }
14712
- if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
14713
- _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push(decoded);
14714
- }
14715
- instance.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget;
14716
- instance._shouldCacheJsonLd = shouldCacheJsonLd;
14717
- if (shouldCacheJsonLd && (!("_fromSubclass" in options) || !options._fromSubclass)) try {
14718
- if (cacheJsonLd != null && cacheJsonLd !== expanded) {
14719
- const compactArray = Array.isArray(json) && json.length === 1;
14720
- const jsonLd = compactArray ? json[0] : json;
14721
- const cachedJsonLd = await (0, _fedify_vocab_runtime_internal_jsonld_cache.compactJsonLdCache)(cacheJsonLd, jsonLd, options.contextLoader);
14722
- instance._cachedJsonLd = compactArray ? [cachedJsonLd] : cachedJsonLd;
14723
- } else instance._cachedJsonLd = structuredClone(json);
14724
- } catch {
14725
- (0, _logtape_logtape.getLogger)(["fedify", "vocab"]).warn("Failed to cache JSON-LD: {json}", { json });
14726
- }
14727
- return instance;
14728
- }
14729
- _getCustomInspectProxy() {
14730
- const proxy = super._getCustomInspectProxy();
14731
- const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.map((v) => v instanceof URL ? {
14732
- [Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
14733
- [Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
14734
- } : v);
14735
- if (_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length == 1) proxy.interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0];
14736
- const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.map((v) => v instanceof URL ? {
14737
- [Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
14738
- [Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
14739
- } : v);
14740
- if (_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length == 1) proxy.interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0];
14741
- return proxy;
14742
- }
14743
- };
14744
- AnnounceAuthorization.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
14745
- return "AnnounceAuthorization " + inspect(this._getCustomInspectProxy(), options);
14746
- };
14747
- AnnounceAuthorization.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
14748
- return "AnnounceAuthorization " + inspect(this._getCustomInspectProxy(), options);
14749
- };
14750
- /** A request to announce (boost) a post that requires approval from
14751
- * the post author.
14752
- *
14753
- * The `object` property references the post to be announced, and
14754
- * the `instrument` property contains the {@link Announce} activity itself.
14755
- *
14756
- * The post author responds with an {@link Accept} (with an
14757
- * {@link AnnounceAuthorization} as `result`) or a {@link Reject}.
14758
- *
14759
- * See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/)
14760
- * for details.
14761
- */
14762
- var AnnounceRequest = class AnnounceRequest extends Activity {
14763
- /**
14764
- * The type URI of {@link AnnounceRequest}: `https://gotosocial.org/ns#AnnounceRequest`.
14765
- */
14766
- static get typeId() {
14767
- return new URL("https://gotosocial.org/ns#AnnounceRequest");
14768
- }
14769
- /**
14770
- * Constructs a new instance of AnnounceRequest with the given values.
14771
- * @param values The values to initialize the instance with.
14772
- * @param options The options to use for initialization.
14773
- */
14774
- constructor(values, options = {}) {
14775
- super(values, options);
14776
- }
14777
- /**
14778
- * Clones this instance, optionally updating it with the given values.
14779
- * @param values The values to update the clone with.
14780
- * @param options The options to use for cloning.
14781
- * @returns The cloned instance.
14782
- */
14783
- clone(values = {}, options = {}) {
14784
- if (this._warning != null) {
14785
- (0, _logtape_logtape.getLogger)(this._warning.category).warn(this._warning.message, this._warning.values);
14786
- options = {
14787
- ...options,
14788
- $warning: this._warning
14789
- };
14790
- }
14791
- return super.clone(values, options);
14792
- }
14793
- /**
14794
- * Converts this object to a JSON-LD structure.
14795
- * @param options The options to use.
14796
- * - `format`: The format of the output: `compact` or
14797
- `expand`.
14798
- * - `contextLoader`: The loader for remote JSON-LD contexts.
14799
- * - `context`: The JSON-LD context to use. Not applicable
14800
- when `format` is set to `'expand'`.
14801
- * @returns The JSON-LD representation of this object.
14802
- */
14803
- async toJsonLd(options = {}) {
14804
- if (options.format == null && this._cachedJsonLd != null) return this._cachedJsonLd;
14805
- if (options.format !== "compact" && options.context != null) throw new TypeError("The context option can only be used when the format option is set to 'compact'.");
14806
- options = {
14807
- ...options,
14808
- contextLoader: options.contextLoader ?? (0, _fedify_vocab_runtime.getDocumentLoader)()
14809
- };
14810
- const values = (await super.toJsonLd({
14811
- ...options,
14812
- format: "expand",
14813
- context: void 0
14814
- }))[0];
14815
- values["@type"] = ["https://gotosocial.org/ns#AnnounceRequest"];
14816
- if (this.id != null) values["@id"] = (0, _fedify_vocab_runtime.formatIri)(this.id);
14817
- if (options.format === "expand") return await _fedify_vocab_runtime_jsonld.default.expand(values, {
14818
- documentLoader: options.contextLoader,
14819
- keepFreeFloatingNodes: true
14820
- });
14821
- const docContext = options.context ?? [
14822
- "https://w3id.org/identity/v1",
14823
- "https://www.w3.org/ns/activitystreams",
14824
- "https://w3id.org/security/data-integrity/v1",
14825
- "https://gotosocial.org/ns"
14826
- ];
14827
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
14828
14988
  if (docContext != null) {
14829
14989
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
14830
14990
  else compacted.proof["@context"] = docContext;
@@ -15174,8 +15334,16 @@ var InteractionPolicy = class {
15174
15334
  documentLoader: options.contextLoader,
15175
15335
  keepFreeFloatingNodes: true
15176
15336
  });
15177
- const docContext = options.context ?? ["https://gotosocial.org/ns", "https://w3id.org/fep/7aa9"];
15178
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
15337
+ let docContext = options.context ?? ["https://gotosocial.org/ns", "https://w3id.org/fep/7aa9"];
15338
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
15339
+ if (options.context == null) {
15340
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
15341
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
15342
+ if (additionalContexts.length > 0) {
15343
+ docContext = [...currentContexts, ...additionalContexts];
15344
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
15345
+ }
15346
+ }
15179
15347
  if (docContext != null) {}
15180
15348
  return compacted;
15181
15349
  }
@@ -15591,8 +15759,16 @@ var InteractionRule = class {
15591
15759
  documentLoader: options.contextLoader,
15592
15760
  keepFreeFloatingNodes: true
15593
15761
  });
15594
- const docContext = options.context ?? "https://gotosocial.org/ns";
15595
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
15762
+ let docContext = options.context ?? "https://gotosocial.org/ns";
15763
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
15764
+ if (options.context == null) {
15765
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
15766
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
15767
+ if (additionalContexts.length > 0) {
15768
+ docContext = [...currentContexts, ...additionalContexts];
15769
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
15770
+ }
15771
+ }
15596
15772
  if (docContext != null) {}
15597
15773
  return compacted;
15598
15774
  }
@@ -16130,12 +16306,20 @@ var LikeAuthorization = class LikeAuthorization extends Object$1 {
16130
16306
  documentLoader: options.contextLoader,
16131
16307
  keepFreeFloatingNodes: true
16132
16308
  });
16133
- const docContext = options.context ?? [
16309
+ let docContext = options.context ?? [
16134
16310
  "https://www.w3.org/ns/activitystreams",
16135
16311
  "https://w3id.org/security/data-integrity/v1",
16136
16312
  "https://gotosocial.org/ns"
16137
16313
  ];
16138
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
16314
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
16315
+ if (options.context == null) {
16316
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
16317
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
16318
+ if (additionalContexts.length > 0) {
16319
+ docContext = [...currentContexts, ...additionalContexts];
16320
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
16321
+ }
16322
+ }
16139
16323
  if (docContext != null) {
16140
16324
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
16141
16325
  else compacted.proof["@context"] = docContext;
@@ -16362,13 +16546,21 @@ var LikeRequest = class LikeRequest extends Activity {
16362
16546
  documentLoader: options.contextLoader,
16363
16547
  keepFreeFloatingNodes: true
16364
16548
  });
16365
- const docContext = options.context ?? [
16549
+ let docContext = options.context ?? [
16366
16550
  "https://w3id.org/identity/v1",
16367
16551
  "https://www.w3.org/ns/activitystreams",
16368
16552
  "https://w3id.org/security/data-integrity/v1",
16369
16553
  "https://gotosocial.org/ns"
16370
16554
  ];
16371
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
16555
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
16556
+ if (options.context == null) {
16557
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
16558
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
16559
+ if (additionalContexts.length > 0) {
16560
+ docContext = [...currentContexts, ...additionalContexts];
16561
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
16562
+ }
16563
+ }
16372
16564
  if (docContext != null) {
16373
16565
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
16374
16566
  else compacted.proof["@context"] = docContext;
@@ -16872,12 +17064,20 @@ var ReplyAuthorization = class ReplyAuthorization extends Object$1 {
16872
17064
  documentLoader: options.contextLoader,
16873
17065
  keepFreeFloatingNodes: true
16874
17066
  });
16875
- const docContext = options.context ?? [
17067
+ let docContext = options.context ?? [
16876
17068
  "https://www.w3.org/ns/activitystreams",
16877
17069
  "https://w3id.org/security/data-integrity/v1",
16878
17070
  "https://gotosocial.org/ns"
16879
17071
  ];
16880
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
17072
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
17073
+ if (options.context == null) {
17074
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
17075
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
17076
+ if (additionalContexts.length > 0) {
17077
+ docContext = [...currentContexts, ...additionalContexts];
17078
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
17079
+ }
17080
+ }
16881
17081
  if (docContext != null) {
16882
17082
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
16883
17083
  else compacted.proof["@context"] = docContext;
@@ -17104,13 +17304,21 @@ var ReplyRequest = class ReplyRequest extends Activity {
17104
17304
  documentLoader: options.contextLoader,
17105
17305
  keepFreeFloatingNodes: true
17106
17306
  });
17107
- const docContext = options.context ?? [
17307
+ let docContext = options.context ?? [
17108
17308
  "https://w3id.org/identity/v1",
17109
17309
  "https://www.w3.org/ns/activitystreams",
17110
17310
  "https://w3id.org/security/data-integrity/v1",
17111
17311
  "https://gotosocial.org/ns"
17112
17312
  ];
17113
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
17313
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
17314
+ if (options.context == null) {
17315
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
17316
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
17317
+ if (additionalContexts.length > 0) {
17318
+ docContext = [...currentContexts, ...additionalContexts];
17319
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
17320
+ }
17321
+ }
17114
17322
  if (docContext != null) {
17115
17323
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
17116
17324
  else compacted.proof["@context"] = docContext;
@@ -17614,13 +17822,21 @@ var QuoteAuthorization = class QuoteAuthorization extends Object$1 {
17614
17822
  documentLoader: options.contextLoader,
17615
17823
  keepFreeFloatingNodes: true
17616
17824
  });
17617
- const docContext = options.context ?? [
17825
+ let docContext = options.context ?? [
17618
17826
  "https://www.w3.org/ns/activitystreams",
17619
17827
  "https://w3id.org/security/data-integrity/v1",
17620
17828
  "https://gotosocial.org/ns",
17621
17829
  { "QuoteAuthorization": "https://w3id.org/fep/044f#QuoteAuthorization" }
17622
17830
  ];
17623
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
17831
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
17832
+ if (options.context == null) {
17833
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
17834
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
17835
+ if (additionalContexts.length > 0) {
17836
+ docContext = [...currentContexts, ...additionalContexts];
17837
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
17838
+ }
17839
+ }
17624
17840
  if (docContext != null) {
17625
17841
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
17626
17842
  else compacted.proof["@context"] = docContext;
@@ -17847,7 +18063,7 @@ var QuoteRequest = class QuoteRequest extends Activity {
17847
18063
  documentLoader: options.contextLoader,
17848
18064
  keepFreeFloatingNodes: true
17849
18065
  });
17850
- const docContext = options.context ?? [
18066
+ let docContext = options.context ?? [
17851
18067
  "https://w3id.org/identity/v1",
17852
18068
  "https://www.w3.org/ns/activitystreams",
17853
18069
  "https://w3id.org/security/data-integrity/v1",
@@ -17883,7 +18099,15 @@ var QuoteRequest = class QuoteRequest extends Activity {
17883
18099
  }
17884
18100
  }
17885
18101
  ];
17886
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
18102
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
18103
+ if (options.context == null) {
18104
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
18105
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
18106
+ if (additionalContexts.length > 0) {
18107
+ docContext = [...currentContexts, ...additionalContexts];
18108
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
18109
+ }
18110
+ }
17887
18111
  if (docContext != null) {
17888
18112
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
17889
18113
  else compacted.proof["@context"] = docContext;
@@ -17952,18 +18176,816 @@ var QuoteRequest = class QuoteRequest extends Activity {
17952
18176
  };
17953
18177
  if ("@type" in values) span.setAttribute("activitypub.object.type", values["@type"]);
17954
18178
  if ("@type" in values && !values["@type"].every((t) => t.startsWith("_:"))) {
17955
- if (!values["@type"].includes("https://w3id.org/fep/044f#QuoteRequest")) throw new TypeError("Invalid type: " + values["@type"]);
18179
+ if (!values["@type"].includes("https://w3id.org/fep/044f#QuoteRequest")) throw new TypeError("Invalid type: " + values["@type"]);
18180
+ }
18181
+ let cacheJsonLd = !("_fromSubclass" in options) || !options._fromSubclass ? (0, _fedify_vocab_runtime_internal_jsonld_cache.normalizeJsonLdIris)(expanded, PORTABLE_IRI_KEYS, PORTABLE_IRI_PATTERN) : void 0;
18182
+ if (cacheJsonLd != null && cacheJsonLd !== expanded) cacheJsonLd = structuredClone(cacheJsonLd);
18183
+ const superValues = structuredClone(values);
18184
+ delete superValues["@type"];
18185
+ const instance = await super.fromJsonLd(superValues, {
18186
+ ...options,
18187
+ _fromSubclass: true
18188
+ });
18189
+ if (!(instance instanceof QuoteRequest)) throw new TypeError("Unexpected type: " + instance.constructor.name);
18190
+ let shouldCacheJsonLd = instance._shouldCacheJsonLd;
18191
+ instance._shouldCacheJsonLd = shouldCacheJsonLd;
18192
+ if (shouldCacheJsonLd && (!("_fromSubclass" in options) || !options._fromSubclass)) try {
18193
+ if (cacheJsonLd != null && cacheJsonLd !== expanded) {
18194
+ const compactArray = Array.isArray(json) && json.length === 1;
18195
+ const jsonLd = compactArray ? json[0] : json;
18196
+ const cachedJsonLd = await (0, _fedify_vocab_runtime_internal_jsonld_cache.compactJsonLdCache)(cacheJsonLd, jsonLd, options.contextLoader);
18197
+ instance._cachedJsonLd = compactArray ? [cachedJsonLd] : cachedJsonLd;
18198
+ } else instance._cachedJsonLd = structuredClone(json);
18199
+ } catch {
18200
+ (0, _logtape_logtape.getLogger)(["fedify", "vocab"]).warn("Failed to cache JSON-LD: {json}", { json });
18201
+ }
18202
+ return instance;
18203
+ }
18204
+ _getCustomInspectProxy() {
18205
+ return super._getCustomInspectProxy();
18206
+ }
18207
+ };
18208
+ QuoteRequest.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
18209
+ return "QuoteRequest " + inspect(this._getCustomInspectProxy(), options);
18210
+ };
18211
+ QuoteRequest.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
18212
+ return "QuoteRequest " + inspect(this._getCustomInspectProxy(), options);
18213
+ };
18214
+ /** Translator credit and source freshness for one language version of an
18215
+ * {@link Object}, as defined by the draft
18216
+ * [FEP-22cd](https://w3id.org/fep/22cd). This is embedded metadata, not an
18217
+ * independent post or activity target. Its optional identifier need not be
18218
+ * dereferenceable and does not establish trust in embedded translator actors.
18219
+ *
18220
+ * Targets [draft revision 6d0d6559](https://codeberg.org/fediverse/fep/src/commit/6d0d6559054baeb7b71a5f2bdc14fc4c09b66f39/fep/22cd/fep-22cd.md).
18221
+ */
18222
+ var Translation = class {
18223
+ #documentLoader;
18224
+ #contextLoader;
18225
+ #tracerProvider;
18226
+ #warning;
18227
+ #cachedJsonLd;
18228
+ #_baseUrl;
18229
+ #shouldCacheJsonLd = true;
18230
+ id;
18231
+ get _documentLoader() {
18232
+ return this.#documentLoader;
18233
+ }
18234
+ get _contextLoader() {
18235
+ return this.#contextLoader;
18236
+ }
18237
+ get _tracerProvider() {
18238
+ return this.#tracerProvider;
18239
+ }
18240
+ get _warning() {
18241
+ return this.#warning;
18242
+ }
18243
+ get _cachedJsonLd() {
18244
+ return this.#cachedJsonLd;
18245
+ }
18246
+ set _cachedJsonLd(value) {
18247
+ this.#cachedJsonLd = value;
18248
+ }
18249
+ get _baseUrl() {
18250
+ return this.#_baseUrl;
18251
+ }
18252
+ get _shouldCacheJsonLd() {
18253
+ return this.#shouldCacheJsonLd;
18254
+ }
18255
+ set _shouldCacheJsonLd(value) {
18256
+ this.#shouldCacheJsonLd = value;
18257
+ }
18258
+ static _shouldCacheDecodedJsonLd(value) {
18259
+ if (value == null || typeof value !== "object") return true;
18260
+ if (!("_shouldCacheJsonLd" in value)) return true;
18261
+ return value._shouldCacheJsonLd;
18262
+ }
18263
+ /**
18264
+ * The type URI of {@link Translation}: `https://w3id.org/fep/22cd#Translation`.
18265
+ */
18266
+ static get typeId() {
18267
+ return new URL("https://w3id.org/fep/22cd#Translation");
18268
+ }
18269
+ #_diXuPmFWiEqfLPhhrxg6Xc7ixZG = [];
18270
+ #_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = [];
18271
+ #_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = /* @__PURE__ */ new Set();
18272
+ #_Msz9PwRg7cWkiXPL4ixyQLtuuH7 = [];
18273
+ #_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated = [];
18274
+ #_4KvkQNz1JjGs8S7iJDcGrUYETbUW = [];
18275
+ #_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = [];
18276
+ /**
18277
+ * Constructs a new instance of Translation with the given values.
18278
+ * @param values The values to initialize the instance with.
18279
+ * @param options The options to use for initialization.
18280
+ */
18281
+ constructor(values, options = {}) {
18282
+ this.#documentLoader = options.documentLoader;
18283
+ this.#contextLoader = options.contextLoader;
18284
+ this.#tracerProvider = options.tracerProvider;
18285
+ const baseUrl = options.baseUrl;
18286
+ this.#_baseUrl = baseUrl == null ? void 0 : new URL(baseUrl.href);
18287
+ if ("$warning" in options) this.#warning = options.$warning;
18288
+ if (values.id == null || values.id instanceof URL) this.id = values.id ?? null;
18289
+ else throw new TypeError("The id must be a URL.");
18290
+ if ("language" in values && values.language != null) if (values.language instanceof Intl.Locale) this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG = [values.language];
18291
+ else throw new TypeError("The language must be of type Intl.Locale.");
18292
+ if ("translator" in values && values.translator != null) if (values.translator instanceof Application || values.translator instanceof Group || values.translator instanceof Organization || values.translator instanceof Person || values.translator instanceof Service || values.translator instanceof URL) {
18293
+ this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = [values.translator];
18294
+ this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.add(0);
18295
+ } else throw new TypeError("The translator must be of type Application | Group | Organization | Person | Service | URL.");
18296
+ if ("translators" in values && values.translators != null) {
18297
+ if ("translator" in values && values.translator != null) throw new TypeError("Cannot initialize both translator and translators at the same time.");
18298
+ if (Array.isArray(values.translators) && values.translators.every((v) => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) {
18299
+ this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = values.translators;
18300
+ for (let i = 0; i < values.translators.length; i++) this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.add(i);
18301
+ } else throw new TypeError("The translators must be an array of type Application | Group | Organization | Person | Service | URL.");
18302
+ }
18303
+ if ("original" in values && values.original != null) if (values.original instanceof URL) this.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7 = [values.original];
18304
+ else throw new TypeError("The original must be of type URL.");
18305
+ if ("sourceUpdated" in values && values.sourceUpdated != null) if ((0, _fedify_vocab_runtime_temporal.isTemporalInstant)(values.sourceUpdated)) this.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated = [values.sourceUpdated];
18306
+ else throw new TypeError("The sourceUpdated must be of type Temporal.Instant.");
18307
+ if ("basis" in values && values.basis != null) if (values.basis instanceof URL) this.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW = [values.basis];
18308
+ else throw new TypeError("The basis must be of type URL.");
18309
+ if ("url" in values && values.url != null) if (values.url instanceof URL || values.url instanceof Link) this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = [values.url];
18310
+ else throw new TypeError("The url must be of type URL | Link.");
18311
+ if ("urls" in values && values.urls != null) {
18312
+ if ("url" in values && values.url != null) throw new TypeError("Cannot initialize both url and urls at the same time.");
18313
+ if (Array.isArray(values.urls) && values.urls.every((v) => v instanceof URL || v instanceof Link)) this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = values.urls;
18314
+ else throw new TypeError("The urls must be an array of type URL | Link.");
18315
+ }
18316
+ }
18317
+ /**
18318
+ * Clones this instance, optionally updating it with the given values.
18319
+ * @param values The values to update the clone with.
18320
+ * @param options The options to use for cloning.
18321
+ * @returns The cloned instance.
18322
+ */
18323
+ clone(values = {}, options = {}) {
18324
+ if (this._warning != null) {
18325
+ (0, _logtape_logtape.getLogger)(this._warning.category).warn(this._warning.message, this._warning.values);
18326
+ options = {
18327
+ ...options,
18328
+ $warning: this._warning
18329
+ };
18330
+ }
18331
+ const clone = new this.constructor({ id: values.id ?? this.id }, options);
18332
+ clone.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG = this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG;
18333
+ if ("language" in values && values.language != null) if (values.language instanceof Intl.Locale) clone.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG = [values.language];
18334
+ else throw new TypeError("The language must be of type Intl.Locale.");
18335
+ clone.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR;
18336
+ clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = new Set(this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR);
18337
+ if ("translator" in values && values.translator != null) if (values.translator instanceof Application || values.translator instanceof Group || values.translator instanceof Organization || values.translator instanceof Person || values.translator instanceof Service || values.translator instanceof URL) {
18338
+ clone.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = [values.translator];
18339
+ clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = /* @__PURE__ */ new Set([0]);
18340
+ } else throw new TypeError("The translator must be of type Application | Group | Organization | Person | Service | URL.");
18341
+ if ("translators" in values && values.translators != null) {
18342
+ if ("translator" in values && values.translator != null) throw new TypeError("Cannot update both translator and translators at the same time.");
18343
+ if (Array.isArray(values.translators) && values.translators.every((v) => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) {
18344
+ clone.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = values.translators;
18345
+ clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = /* @__PURE__ */ new Set();
18346
+ for (let i = 0; i < values.translators.length; i++) clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.add(i);
18347
+ } else throw new TypeError("The translators must be an array of type Application | Group | Organization | Person | Service | URL.");
18348
+ }
18349
+ clone.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7 = this.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7;
18350
+ if ("original" in values && values.original != null) if (values.original instanceof URL) clone.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7 = [values.original];
18351
+ else throw new TypeError("The original must be of type URL.");
18352
+ clone.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated = this.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated;
18353
+ if ("sourceUpdated" in values && values.sourceUpdated != null) if ((0, _fedify_vocab_runtime_temporal.isTemporalInstant)(values.sourceUpdated)) clone.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated = [values.sourceUpdated];
18354
+ else throw new TypeError("The sourceUpdated must be of type Temporal.Instant.");
18355
+ clone.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW = this.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW;
18356
+ if ("basis" in values && values.basis != null) if (values.basis instanceof URL) clone.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW = [values.basis];
18357
+ else throw new TypeError("The basis must be of type URL.");
18358
+ clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url;
18359
+ if ("url" in values && values.url != null) if (values.url instanceof URL || values.url instanceof Link) clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = [values.url];
18360
+ else throw new TypeError("The url must be of type URL | Link.");
18361
+ if ("urls" in values && values.urls != null) {
18362
+ if ("url" in values && values.url != null) throw new TypeError("Cannot update both url and urls at the same time.");
18363
+ if (Array.isArray(values.urls) && values.urls.every((v) => v instanceof URL || v instanceof Link)) clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = values.urls;
18364
+ else throw new TypeError("The urls must be an array of type URL | Link.");
18365
+ }
18366
+ return clone;
18367
+ }
18368
+ /** The translated language. Publishers must match a language in the
18369
+ * containing object's content, name, or summary map.
18370
+ */
18371
+ get language() {
18372
+ if (this._warning != null) (0, _logtape_logtape.getLogger)(this._warning.category).warn(this._warning.message, this._warning.values);
18373
+ if (this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG.length < 1) return null;
18374
+ return this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG[0];
18375
+ }
18376
+ async #fetchTranslator(url, options = {}) {
18377
+ const documentLoader = options.documentLoader ?? this._documentLoader ?? (0, _fedify_vocab_runtime.getDocumentLoader)();
18378
+ const contextLoader = options.contextLoader ?? this._contextLoader ?? (0, _fedify_vocab_runtime.getDocumentLoader)();
18379
+ const tracerProvider = options.tracerProvider ?? this._tracerProvider ?? _opentelemetry_api.trace.getTracerProvider();
18380
+ return await tracerProvider.getTracer("@fedify/vocab-tools", "2.4.0").startActiveSpan("activitypub.lookup_object", async (span) => {
18381
+ const lookupUrl = (0, _fedify_vocab_runtime.formatIri)(url);
18382
+ let fetchResult;
18383
+ try {
18384
+ fetchResult = await documentLoader(lookupUrl);
18385
+ } catch (error) {
18386
+ span.setStatus({
18387
+ code: _opentelemetry_api.SpanStatusCode.ERROR,
18388
+ message: String(error)
18389
+ });
18390
+ span.end();
18391
+ if (options.suppressError) {
18392
+ (0, _logtape_logtape.getLogger)(["fedify", "vocab"]).error("Failed to fetch {url}: {error}", {
18393
+ error,
18394
+ url: lookupUrl
18395
+ });
18396
+ return null;
18397
+ }
18398
+ throw error;
18399
+ }
18400
+ const { document, documentUrl } = fetchResult;
18401
+ const baseUrl = (0, _fedify_vocab_runtime.parseIri)(documentUrl);
18402
+ try {
18403
+ const obj = await this.#translator_fromJsonLd(document, {
18404
+ documentLoader,
18405
+ contextLoader,
18406
+ tracerProvider,
18407
+ baseUrl
18408
+ });
18409
+ if (obj?.id != null && !(0, _fedify_vocab_runtime_internal_jsonld_cache.isTrustedIriOrigin)(options, obj.id, baseUrl)) {
18410
+ if (options.crossOrigin === "throw") throw new Error("The object's @id (" + obj.id.href + ") has a different origin than the document URL (" + baseUrl.href + "); refusing to return the object. If you want to bypass this check and are aware ofthe security implications, set the crossOrigin option to \"trust\".");
18411
+ (0, _logtape_logtape.getLogger)(["fedify", "vocab"]).warn("The object's @id ({objectId}) has a different origin than the document URL ({documentUrl}); refusing to return the object. If you want to bypass this check and are aware of the security implications, set the crossOrigin option to \"trust\".", {
18412
+ ...fetchResult,
18413
+ objectId: obj.id.href
18414
+ });
18415
+ return null;
18416
+ }
18417
+ span.setAttribute("activitypub.object.id", (obj.id ?? url).href);
18418
+ span.setAttribute("activitypub.object.type", obj.constructor.typeId.href);
18419
+ return obj;
18420
+ } catch (e) {
18421
+ if (options.suppressError) {
18422
+ (0, _logtape_logtape.getLogger)(["fedify", "vocab"]).error("Failed to parse {url}: {error}", {
18423
+ error: e,
18424
+ url: lookupUrl
18425
+ });
18426
+ return null;
18427
+ }
18428
+ span.setStatus({
18429
+ code: _opentelemetry_api.SpanStatusCode.ERROR,
18430
+ message: String(e)
18431
+ });
18432
+ throw e;
18433
+ } finally {
18434
+ span.end();
18435
+ }
18436
+ });
18437
+ }
18438
+ async #translator_fromJsonLd(jsonLd, options) {
18439
+ const documentLoader = options.documentLoader ?? this._documentLoader ?? (0, _fedify_vocab_runtime.getDocumentLoader)();
18440
+ const contextLoader = options.contextLoader ?? this._contextLoader ?? (0, _fedify_vocab_runtime.getDocumentLoader)();
18441
+ const tracerProvider = options.tracerProvider ?? this._tracerProvider ?? _opentelemetry_api.trace.getTracerProvider();
18442
+ const baseUrl = options.baseUrl;
18443
+ try {
18444
+ return await Application.fromJsonLd(jsonLd, {
18445
+ documentLoader,
18446
+ contextLoader,
18447
+ tracerProvider,
18448
+ baseUrl
18449
+ });
18450
+ } catch (e) {
18451
+ if (!(e instanceof TypeError)) throw e;
18452
+ }
18453
+ try {
18454
+ return await Group.fromJsonLd(jsonLd, {
18455
+ documentLoader,
18456
+ contextLoader,
18457
+ tracerProvider,
18458
+ baseUrl
18459
+ });
18460
+ } catch (e) {
18461
+ if (!(e instanceof TypeError)) throw e;
18462
+ }
18463
+ try {
18464
+ return await Organization.fromJsonLd(jsonLd, {
18465
+ documentLoader,
18466
+ contextLoader,
18467
+ tracerProvider,
18468
+ baseUrl
18469
+ });
18470
+ } catch (e) {
18471
+ if (!(e instanceof TypeError)) throw e;
18472
+ }
18473
+ try {
18474
+ return await Person.fromJsonLd(jsonLd, {
18475
+ documentLoader,
18476
+ contextLoader,
18477
+ tracerProvider,
18478
+ baseUrl
18479
+ });
18480
+ } catch (e) {
18481
+ if (!(e instanceof TypeError)) throw e;
18482
+ }
18483
+ try {
18484
+ return await Service.fromJsonLd(jsonLd, {
18485
+ documentLoader,
18486
+ contextLoader,
18487
+ tracerProvider,
18488
+ baseUrl
18489
+ });
18490
+ } catch (e) {
18491
+ if (!(e instanceof TypeError)) throw e;
18492
+ }
18493
+ throw new TypeError("Expected an object of any type of: " + [
18494
+ "https://www.w3.org/ns/activitystreams#Application",
18495
+ "https://www.w3.org/ns/activitystreams#Group",
18496
+ "https://www.w3.org/ns/activitystreams#Organization",
18497
+ "https://www.w3.org/ns/activitystreams#Person",
18498
+ "https://www.w3.org/ns/activitystreams#Service"
18499
+ ].join(", "));
18500
+ }
18501
+ /**
18502
+ * Similar to
18503
+ * {@link Translation.getTranslator},
18504
+ * but returns its `@id` URL instead of the object itself.
18505
+ */
18506
+ get translatorId() {
18507
+ if (this._warning != null) (0, _logtape_logtape.getLogger)(this._warning.category).warn(this._warning.message, this._warning.values);
18508
+ if (this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.length < 1) return null;
18509
+ const v = this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR[0];
18510
+ if (v instanceof URL) return v;
18511
+ return v.id;
18512
+ }
18513
+ /** The actors credited for this language version. Their order has no
18514
+ * meaning. Human actors credit translation or review; Application and
18515
+ * Service actors credit machine output. If any actor cannot be resolved,
18516
+ * the entry's human-or-machine status is unknown. Credit is asserted by
18517
+ * the publisher and grants no publishing authority. Embedded actors with
18518
+ * identifiers are fetched before being returned unless explicitly trusted.
18519
+ */
18520
+ async getTranslator(options = {}) {
18521
+ if (this._warning != null) (0, _logtape_logtape.getLogger)(this._warning.category).warn(this._warning.message, this._warning.values);
18522
+ if (this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.length < 1) return null;
18523
+ let v = this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR[0];
18524
+ if (!(v instanceof URL) && v.id != null && !(0, _fedify_vocab_runtime_internal_jsonld_cache.isTrustedIriOrigin)(options, v.id, null) && !this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.has(0)) v = v.id;
18525
+ if (v instanceof URL) {
18526
+ const fetched = await this.#fetchTranslator(v, options);
18527
+ if (fetched == null) return null;
18528
+ this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR[0] = fetched;
18529
+ this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.add(0);
18530
+ this._cachedJsonLd = void 0;
18531
+ return fetched;
18532
+ }
18533
+ if (this._cachedJsonLd != null && typeof this._cachedJsonLd === "object" && "@context" in this._cachedJsonLd && "translator" in this._cachedJsonLd) {
18534
+ const prop = this._cachedJsonLd["translator"];
18535
+ const doc = Array.isArray(prop) ? prop[0] : prop;
18536
+ if (doc != null && typeof doc === "object" && "@context" in doc) v = await this.#translator_fromJsonLd(doc, {
18537
+ ...options,
18538
+ baseUrl: options.baseUrl ?? this._baseUrl ?? (this.id != null && (this.id.protocol === "http:" || this.id.protocol === "https:") ? this.id : void 0)
18539
+ });
18540
+ }
18541
+ if (v?.id != null && !(0, _fedify_vocab_runtime_internal_jsonld_cache.isTrustedIriOrigin)(options, v.id, null) && !this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.has(0)) {
18542
+ if (options.crossOrigin === "throw") throw new Error("The property object's @id (" + v.id.href + ") has a different origin than the property owner's @id (untrusted metadata); refusing to return the object. If you want to bypass this check and are aware of the security implications, set the crossOrigin option to \"trust\".");
18543
+ (0, _logtape_logtape.getLogger)(["fedify", "vocab"]).warn("The property object's @id ({objectId}) has a different origin than the property owner's @id ({parentObjectId}); refusing to return the object. If you want to bypass this check and are aware of the security implications, set the crossOrigin option to \"trust\".", {
18544
+ objectId: v.id.href,
18545
+ parentObjectId: "untrusted metadata"
18546
+ });
18547
+ return null;
18548
+ }
18549
+ return v;
18550
+ }
18551
+ /**
18552
+ * Similar to
18553
+ * {@link Translation.getTranslators},
18554
+ * but returns their `@id`s instead of the objects themselves.
18555
+ */
18556
+ get translatorIds() {
18557
+ if (this._warning != null) (0, _logtape_logtape.getLogger)(this._warning.category).warn(this._warning.message, this._warning.values);
18558
+ return this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.map((v) => v instanceof URL ? v : v.id).filter((id) => id !== null);
18559
+ }
18560
+ /** The actors credited for this language version. Their order has no
18561
+ * meaning. Human actors credit translation or review; Application and
18562
+ * Service actors credit machine output. If any actor cannot be resolved,
18563
+ * the entry's human-or-machine status is unknown. Credit is asserted by
18564
+ * the publisher and grants no publishing authority. Embedded actors with
18565
+ * identifiers are fetched before being returned unless explicitly trusted.
18566
+ */
18567
+ async *getTranslators(options = {}) {
18568
+ if (this._warning != null) (0, _logtape_logtape.getLogger)(this._warning.category).warn(this._warning.message, this._warning.values);
18569
+ const vs = this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR;
18570
+ for (let i = 0; i < vs.length; i++) {
18571
+ let v = vs[i];
18572
+ if (!(v instanceof URL) && v.id != null && !(0, _fedify_vocab_runtime_internal_jsonld_cache.isTrustedIriOrigin)(options, v.id, null) && !this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.has(i)) v = v.id;
18573
+ if (v instanceof URL) {
18574
+ const fetched = await this.#fetchTranslator(v, options);
18575
+ if (fetched == null) continue;
18576
+ vs[i] = fetched;
18577
+ this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.add(i);
18578
+ this._cachedJsonLd = void 0;
18579
+ yield fetched;
18580
+ continue;
18581
+ }
18582
+ if (this._cachedJsonLd != null && typeof this._cachedJsonLd === "object" && "@context" in this._cachedJsonLd && "translator" in this._cachedJsonLd) {
18583
+ const prop = this._cachedJsonLd["translator"];
18584
+ const obj = Array.isArray(prop) ? prop[i] : prop;
18585
+ if (obj != null && typeof obj === "object" && "@context" in obj) v = await this.#translator_fromJsonLd(obj, {
18586
+ ...options,
18587
+ baseUrl: options.baseUrl ?? this._baseUrl ?? (this.id != null && (this.id.protocol === "http:" || this.id.protocol === "https:") ? this.id : void 0)
18588
+ });
18589
+ }
18590
+ if (v?.id != null && !(0, _fedify_vocab_runtime_internal_jsonld_cache.isTrustedIriOrigin)(options, v.id, null) && !this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.has(i)) {
18591
+ if (options.crossOrigin === "throw") throw new Error("The property object's @id (" + v.id.href + ") has a different origin than the property owner's @id (untrusted metadata); refusing to return the object. If you want to bypass this check and are aware of the security implications, set the crossOrigin option to \"trust\".");
18592
+ (0, _logtape_logtape.getLogger)(["fedify", "vocab"]).warn("The property object's @id ({objectId}) has a different origin than the property owner's @id ({parentObjectId}); refusing to return the object. If you want to bypass this check and are aware of the security implications, set the crossOrigin option to \"trust\".", {
18593
+ objectId: v.id.href,
18594
+ parentObjectId: "untrusted metadata"
18595
+ });
18596
+ continue;
18597
+ }
18598
+ yield v;
18599
+ }
18600
+ }
18601
+ /** The identifier of the containing object. FEP-22cd translations share
18602
+ * that object's identity rather than introducing separate posts.
18603
+ */
18604
+ get original() {
18605
+ if (this._warning != null) (0, _logtape_logtape.getLogger)(this._warning.category).warn(this._warning.message, this._warning.values);
18606
+ if (this.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7.length < 1) return null;
18607
+ return this.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7[0];
18608
+ }
18609
+ /** The source object's updated timestamp (or published timestamp if it has
18610
+ * no updated timestamp) at the last human review of this translation.
18611
+ * An absent value makes no freshness claim. A value earlier than the
18612
+ * current source timestamp indicates a potentially stale translation;
18613
+ * an equal or later value reflects the current source.
18614
+ */
18615
+ get sourceUpdated() {
18616
+ if (this._warning != null) (0, _logtape_logtape.getLogger)(this._warning.category).warn(this._warning.message, this._warning.values);
18617
+ if (this.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated.length < 1) return null;
18618
+ return this.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated[0];
18619
+ }
18620
+ /** An optional public revision resource identifying the source reviewed.
18621
+ * Supplements sourceUpdated without requiring private revision history
18622
+ * to be exposed.
18623
+ */
18624
+ get basis() {
18625
+ if (this._warning != null) (0, _logtape_logtape.getLogger)(this._warning.category).warn(this._warning.message, this._warning.values);
18626
+ if (this.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW.length < 1) return null;
18627
+ return this.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW[0];
18628
+ }
18629
+ /** Links to renderings of this specific language version.
18630
+ */
18631
+ get url() {
18632
+ if (this._warning != null) (0, _logtape_logtape.getLogger)(this._warning.category).warn(this._warning.message, this._warning.values);
18633
+ if (this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length < 1) return null;
18634
+ return this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url[0];
18635
+ }
18636
+ /** Links to renderings of this specific language version.
18637
+ */
18638
+ get urls() {
18639
+ return this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url;
18640
+ }
18641
+ /**
18642
+ * Converts this object to a JSON-LD structure.
18643
+ * @param options The options to use.
18644
+ * - `format`: The format of the output: `compact` or
18645
+ `expand`.
18646
+ * - `contextLoader`: The loader for remote JSON-LD contexts.
18647
+ * - `context`: The JSON-LD context to use. Not applicable
18648
+ when `format` is set to `'expand'`.
18649
+ * @returns The JSON-LD representation of this object.
18650
+ */
18651
+ async toJsonLd(options = {}) {
18652
+ if (options.format == null && this._cachedJsonLd != null) return this._cachedJsonLd;
18653
+ if (options.format !== "compact" && options.context != null) throw new TypeError("The context option can only be used when the format option is set to 'compact'.");
18654
+ options = {
18655
+ ...options,
18656
+ contextLoader: options.contextLoader ?? (0, _fedify_vocab_runtime.getDocumentLoader)()
18657
+ };
18658
+ if (options.format == null && this.isCompactable()) {
18659
+ const result = {};
18660
+ let compactItems = [];
18661
+ for (const v of this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG) {
18662
+ const item = v.baseName;
18663
+ compactItems.push(item);
18664
+ }
18665
+ if (compactItems.length > 0) result["inLanguage"] = compactItems.length > 1 ? compactItems : compactItems[0];
18666
+ compactItems = [];
18667
+ for (const v of this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR) {
18668
+ const item = v instanceof URL ? (0, _fedify_vocab_runtime.formatIri)(v) : v instanceof Application ? await v.toJsonLd({
18669
+ ...options,
18670
+ format: void 0,
18671
+ context: void 0
18672
+ }) : v instanceof Group ? await v.toJsonLd({
18673
+ ...options,
18674
+ format: void 0,
18675
+ context: void 0
18676
+ }) : v instanceof Organization ? await v.toJsonLd({
18677
+ ...options,
18678
+ format: void 0,
18679
+ context: void 0
18680
+ }) : v instanceof Person ? await v.toJsonLd({
18681
+ ...options,
18682
+ format: void 0,
18683
+ context: void 0
18684
+ }) : await v.toJsonLd({
18685
+ ...options,
18686
+ format: void 0,
18687
+ context: void 0
18688
+ });
18689
+ compactItems.push(item);
18690
+ }
18691
+ if (compactItems.length > 0) result["translator"] = compactItems.length > 1 ? compactItems : compactItems[0];
18692
+ compactItems = [];
18693
+ for (const v of this.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7) {
18694
+ const item = (0, _fedify_vocab_runtime.formatIri)(v);
18695
+ compactItems.push(item);
18696
+ }
18697
+ if (compactItems.length > 0) result["translationOfWork"] = compactItems.length > 1 ? compactItems : compactItems[0];
18698
+ compactItems = [];
18699
+ for (const v of this.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated) {
18700
+ const item = v.toString();
18701
+ compactItems.push(item);
18702
+ }
18703
+ if (compactItems.length > 0) result["sourceUpdated"] = compactItems.length > 1 ? compactItems : compactItems[0];
18704
+ compactItems = [];
18705
+ for (const v of this.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW) {
18706
+ const item = (0, _fedify_vocab_runtime.formatIri)(v);
18707
+ compactItems.push(item);
18708
+ }
18709
+ if (compactItems.length > 0) result["isBasedOn"] = compactItems.length > 1 ? compactItems : compactItems[0];
18710
+ compactItems = [];
18711
+ for (const v of this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url) {
18712
+ const item = v instanceof URL ? (0, _fedify_vocab_runtime.formatIri)(v) : await v.toJsonLd({
18713
+ ...options,
18714
+ format: void 0,
18715
+ context: void 0
18716
+ });
18717
+ compactItems.push(item);
18718
+ }
18719
+ if (compactItems.length > 0) result["url"] = compactItems.length > 1 ? compactItems : compactItems[0];
18720
+ result["type"] = "Translation";
18721
+ if (this.id != null) result["id"] = (0, _fedify_vocab_runtime.formatIri)(this.id);
18722
+ result["@context"] = ["https://www.w3.org/ns/activitystreams", "https://w3id.org/fep/22cd"];
18723
+ return result;
18724
+ }
18725
+ let array;
18726
+ const values = {};
18727
+ array = [];
18728
+ for (const v of this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG) {
18729
+ let element = { "@value": v.baseName };
18730
+ if (Array.isArray(element)) {
18731
+ if (element.length < 1) continue;
18732
+ if (element.length == 1) element = element[0];
18733
+ }
18734
+ if (typeof element === "undefined") continue;
18735
+ array.push(element);
18736
+ }
18737
+ if (array.length > 0) values["https://schema.org/inLanguage"] = array;
18738
+ array = [];
18739
+ for (const v of this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR) {
18740
+ let element = v instanceof URL ? { "@id": (0, _fedify_vocab_runtime.formatIri)(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options);
18741
+ if (Array.isArray(element)) {
18742
+ if (element.length < 1) continue;
18743
+ if (element.length == 1) element = element[0];
18744
+ }
18745
+ if (typeof element === "undefined") continue;
18746
+ array.push(element);
18747
+ }
18748
+ if (array.length > 0) values["https://schema.org/translator"] = array;
18749
+ array = [];
18750
+ for (const v of this.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7) {
18751
+ let element = { "@id": (0, _fedify_vocab_runtime.formatIri)(v) };
18752
+ if (Array.isArray(element)) {
18753
+ if (element.length < 1) continue;
18754
+ if (element.length == 1) element = element[0];
18755
+ }
18756
+ if (typeof element === "undefined") continue;
18757
+ array.push(element);
18758
+ }
18759
+ if (array.length > 0) values["https://schema.org/translationOfWork"] = array;
18760
+ array = [];
18761
+ for (const v of this.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated) {
18762
+ let element = {
18763
+ "@type": "http://www.w3.org/2001/XMLSchema#dateTime",
18764
+ "@value": v.toString()
18765
+ };
18766
+ if (Array.isArray(element)) {
18767
+ if (element.length < 1) continue;
18768
+ if (element.length == 1) element = element[0];
18769
+ }
18770
+ if (typeof element === "undefined") continue;
18771
+ array.push(element);
18772
+ }
18773
+ if (array.length > 0) values["https://w3id.org/fep/22cd#sourceUpdated"] = array;
18774
+ array = [];
18775
+ for (const v of this.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW) {
18776
+ let element = { "@id": (0, _fedify_vocab_runtime.formatIri)(v) };
18777
+ if (Array.isArray(element)) {
18778
+ if (element.length < 1) continue;
18779
+ if (element.length == 1) element = element[0];
18780
+ }
18781
+ if (typeof element === "undefined") continue;
18782
+ array.push(element);
18783
+ }
18784
+ if (array.length > 0) values["https://schema.org/isBasedOn"] = array;
18785
+ array = [];
18786
+ for (const v of this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url) {
18787
+ let element = v instanceof URL ? { "@id": (0, _fedify_vocab_runtime.formatIri)(v) } : await v.toJsonLd(options);
18788
+ if (Array.isArray(element)) {
18789
+ if (element.length < 1) continue;
18790
+ if (element.length == 1) element = element[0];
18791
+ }
18792
+ if (typeof element === "undefined") continue;
18793
+ array.push(element);
18794
+ }
18795
+ if (array.length > 0) values["https://www.w3.org/ns/activitystreams#url"] = array;
18796
+ values["@type"] = ["https://w3id.org/fep/22cd#Translation"];
18797
+ if (this.id != null) values["@id"] = (0, _fedify_vocab_runtime.formatIri)(this.id);
18798
+ if (options.format === "expand") return await _fedify_vocab_runtime_jsonld.default.expand(values, {
18799
+ documentLoader: options.contextLoader,
18800
+ keepFreeFloatingNodes: true
18801
+ });
18802
+ let docContext = options.context ?? ["https://www.w3.org/ns/activitystreams", "https://w3id.org/fep/22cd"];
18803
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
18804
+ if (options.context == null) {
18805
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
18806
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
18807
+ if (additionalContexts.length > 0) {
18808
+ docContext = [...currentContexts, ...additionalContexts];
18809
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
18810
+ }
18811
+ }
18812
+ if (docContext != null) {}
18813
+ return compacted;
18814
+ }
18815
+ isCompactable() {
18816
+ if (this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR != null && this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.length > 0) return false;
18817
+ return true;
18818
+ }
18819
+ /**
18820
+ * Converts a JSON-LD structure to an object of this type.
18821
+ * @param json The JSON-LD structure to convert.
18822
+ * @param options The options to use.
18823
+ * - `documentLoader`: The loader for remote JSON-LD documents.
18824
+ * - `contextLoader`: The loader for remote JSON-LD contexts.
18825
+ * - `tracerProvider`: The OpenTelemetry tracer provider to use.
18826
+ * If omitted, the global tracer provider is used.
18827
+ * @returns The object of this type.
18828
+ * @throws {TypeError} If the given `json` is invalid.
18829
+ */
18830
+ static async fromJsonLd(json, options = {}) {
18831
+ return await (options.tracerProvider ?? _opentelemetry_api.trace.getTracerProvider()).getTracer("@fedify/vocab-tools", "2.4.0").startActiveSpan("activitypub.parse_object", async (span) => {
18832
+ try {
18833
+ const object = await this.__fromJsonLd__Translation__(json, span, options);
18834
+ if (object.id != null) span.setAttribute("activitypub.object.id", object.id.href);
18835
+ return object;
18836
+ } catch (error) {
18837
+ span.setStatus({
18838
+ code: _opentelemetry_api.SpanStatusCode.ERROR,
18839
+ message: String(error)
18840
+ });
18841
+ throw error;
18842
+ } finally {
18843
+ span.end();
18844
+ }
18845
+ });
18846
+ }
18847
+ static async __fromJsonLd__Translation__(json, span, options = {}) {
18848
+ if (typeof json === "undefined") throw new TypeError("Invalid JSON-LD: undefined.");
18849
+ else if (json === null) throw new TypeError("Invalid JSON-LD: null.");
18850
+ options = {
18851
+ ...options,
18852
+ documentLoader: options.documentLoader ?? (0, _fedify_vocab_runtime.getDocumentLoader)(),
18853
+ contextLoader: options.contextLoader ?? (0, _fedify_vocab_runtime.getDocumentLoader)(),
18854
+ tracerProvider: options.tracerProvider ?? _opentelemetry_api.trace.getTracerProvider()
18855
+ };
18856
+ let values;
18857
+ let expanded;
18858
+ if ("_fromSubclass" in options && options._fromSubclass && typeof json === "object" && !Array.isArray(json)) {
18859
+ values = json;
18860
+ expanded = [values];
18861
+ } else if (globalThis.Object.keys(json).length == 0) {
18862
+ values = {};
18863
+ expanded = [values];
18864
+ } else {
18865
+ expanded = await _fedify_vocab_runtime_jsonld.default.expand(json, {
18866
+ documentLoader: options.contextLoader,
18867
+ keepFreeFloatingNodes: true
18868
+ });
18869
+ values = expanded[0] ?? {};
18870
+ }
18871
+ const id = (0, _fedify_vocab_runtime.parseJsonLdId)(values["@id"], options.baseUrl);
18872
+ if (id != null && options.baseUrl == null) options = {
18873
+ ...options,
18874
+ baseUrl: id
18875
+ };
18876
+ if ("@type" in values) span.setAttribute("activitypub.object.type", values["@type"]);
18877
+ if ("@type" in values && !values["@type"].every((t) => t.startsWith("_:"))) {
18878
+ if (!values["@type"].includes("https://w3id.org/fep/22cd#Translation")) throw new TypeError("Invalid type: " + values["@type"]);
17956
18879
  }
17957
18880
  let cacheJsonLd = !("_fromSubclass" in options) || !options._fromSubclass ? (0, _fedify_vocab_runtime_internal_jsonld_cache.normalizeJsonLdIris)(expanded, PORTABLE_IRI_KEYS, PORTABLE_IRI_PATTERN) : void 0;
17958
18881
  if (cacheJsonLd != null && cacheJsonLd !== expanded) cacheJsonLd = structuredClone(cacheJsonLd);
17959
- const superValues = structuredClone(values);
17960
- delete superValues["@type"];
17961
- const instance = await super.fromJsonLd(superValues, {
17962
- ...options,
17963
- _fromSubclass: true
17964
- });
17965
- if (!(instance instanceof QuoteRequest)) throw new TypeError("Unexpected type: " + instance.constructor.name);
18882
+ const instance = new this({ id }, options);
17966
18883
  let shouldCacheJsonLd = instance._shouldCacheJsonLd;
18884
+ const _diXuPmFWiEqfLPhhrxg6Xc7ixZG = [];
18885
+ let _diXuPmFWiEqfLPhhrxg6Xc7ixZG__array = values["https://schema.org/inLanguage"];
18886
+ for (const v of _diXuPmFWiEqfLPhhrxg6Xc7ixZG__array == null ? [] : _diXuPmFWiEqfLPhhrxg6Xc7ixZG__array.length === 1 && "@list" in _diXuPmFWiEqfLPhhrxg6Xc7ixZG__array[0] ? _diXuPmFWiEqfLPhhrxg6Xc7ixZG__array[0]["@list"] : _diXuPmFWiEqfLPhhrxg6Xc7ixZG__array) {
18887
+ if (v == null) continue;
18888
+ const decoded = new Intl.Locale(v["@value"]);
18889
+ if (typeof decoded === "undefined") {
18890
+ shouldCacheJsonLd = false;
18891
+ continue;
18892
+ }
18893
+ if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
18894
+ _diXuPmFWiEqfLPhhrxg6Xc7ixZG.push(decoded);
18895
+ }
18896
+ instance.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG = _diXuPmFWiEqfLPhhrxg6Xc7ixZG;
18897
+ const _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = [];
18898
+ let _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR__array = values["https://schema.org/translator"];
18899
+ for (const v of _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR__array == null ? [] : _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR__array.length === 1 && "@list" in _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR__array[0] ? _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR__array[0]["@list"] : _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR__array) {
18900
+ if (v == null) continue;
18901
+ if (typeof v === "object" && "@id" in v && !("@type" in v) && globalThis.Object.keys(v).length === 1) {
18902
+ if (v["@id"].startsWith("_:")) continue;
18903
+ _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.push((0, _fedify_vocab_runtime.parseIri)(v["@id"], options.baseUrl));
18904
+ continue;
18905
+ }
18906
+ const decoded = typeof v === "object" && "@type" in v && Array.isArray(v["@type"]) && v["@type"].includes("https://www.w3.org/ns/activitystreams#Application") ? await Application.fromJsonLd(v, {
18907
+ ...options,
18908
+ baseUrl: options.baseUrl
18909
+ }) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"]) && v["@type"].includes("https://www.w3.org/ns/activitystreams#Group") ? await Group.fromJsonLd(v, {
18910
+ ...options,
18911
+ baseUrl: options.baseUrl
18912
+ }) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"]) && v["@type"].includes("https://www.w3.org/ns/activitystreams#Organization") ? await Organization.fromJsonLd(v, {
18913
+ ...options,
18914
+ baseUrl: options.baseUrl
18915
+ }) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"]) && v["@type"].includes("https://www.w3.org/ns/activitystreams#Person") ? await Person.fromJsonLd(v, {
18916
+ ...options,
18917
+ baseUrl: options.baseUrl
18918
+ }) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"]) && v["@type"].includes("https://www.w3.org/ns/activitystreams#Service") ? await Service.fromJsonLd(v, {
18919
+ ...options,
18920
+ baseUrl: options.baseUrl
18921
+ }) : void 0;
18922
+ if (typeof decoded === "undefined") {
18923
+ shouldCacheJsonLd = false;
18924
+ continue;
18925
+ }
18926
+ if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
18927
+ _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.push(decoded);
18928
+ }
18929
+ instance.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR;
18930
+ const _Msz9PwRg7cWkiXPL4ixyQLtuuH7 = [];
18931
+ let _Msz9PwRg7cWkiXPL4ixyQLtuuH7__array = values["https://schema.org/translationOfWork"];
18932
+ for (const v of _Msz9PwRg7cWkiXPL4ixyQLtuuH7__array == null ? [] : _Msz9PwRg7cWkiXPL4ixyQLtuuH7__array.length === 1 && "@list" in _Msz9PwRg7cWkiXPL4ixyQLtuuH7__array[0] ? _Msz9PwRg7cWkiXPL4ixyQLtuuH7__array[0]["@list"] : _Msz9PwRg7cWkiXPL4ixyQLtuuH7__array) {
18933
+ if (v == null) continue;
18934
+ const decoded = (0, _fedify_vocab_runtime.parseIri)(v["@id"], options.baseUrl);
18935
+ if (typeof decoded === "undefined") {
18936
+ shouldCacheJsonLd = false;
18937
+ continue;
18938
+ }
18939
+ if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
18940
+ _Msz9PwRg7cWkiXPL4ixyQLtuuH7.push(decoded);
18941
+ }
18942
+ instance.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7 = _Msz9PwRg7cWkiXPL4ixyQLtuuH7;
18943
+ const _yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated = [];
18944
+ let _yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated__array = values["https://w3id.org/fep/22cd#sourceUpdated"];
18945
+ for (const v of _yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated__array == null ? [] : _yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated__array.length === 1 && "@list" in _yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated__array[0] ? _yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated__array[0]["@list"] : _yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated__array) {
18946
+ if (v == null) continue;
18947
+ const decoded = Temporal$1.Instant.from(v["@value"].substring(19).match(/[Z+-]/) ? v["@value"] : v["@value"] + "Z");
18948
+ if (typeof decoded === "undefined") {
18949
+ shouldCacheJsonLd = false;
18950
+ continue;
18951
+ }
18952
+ if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
18953
+ _yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated.push(decoded);
18954
+ }
18955
+ instance.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated = _yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated;
18956
+ const _4KvkQNz1JjGs8S7iJDcGrUYETbUW = [];
18957
+ let _4KvkQNz1JjGs8S7iJDcGrUYETbUW__array = values["https://schema.org/isBasedOn"];
18958
+ for (const v of _4KvkQNz1JjGs8S7iJDcGrUYETbUW__array == null ? [] : _4KvkQNz1JjGs8S7iJDcGrUYETbUW__array.length === 1 && "@list" in _4KvkQNz1JjGs8S7iJDcGrUYETbUW__array[0] ? _4KvkQNz1JjGs8S7iJDcGrUYETbUW__array[0]["@list"] : _4KvkQNz1JjGs8S7iJDcGrUYETbUW__array) {
18959
+ if (v == null) continue;
18960
+ const decoded = (0, _fedify_vocab_runtime.parseIri)(v["@id"], options.baseUrl);
18961
+ if (typeof decoded === "undefined") {
18962
+ shouldCacheJsonLd = false;
18963
+ continue;
18964
+ }
18965
+ if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
18966
+ _4KvkQNz1JjGs8S7iJDcGrUYETbUW.push(decoded);
18967
+ }
18968
+ instance.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW = _4KvkQNz1JjGs8S7iJDcGrUYETbUW;
18969
+ const _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = [];
18970
+ let _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url__array = values["https://www.w3.org/ns/activitystreams#url"];
18971
+ for (const v of _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url__array == null ? [] : _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url__array.length === 1 && "@list" in _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url__array[0] ? _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url__array[0]["@list"] : _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url__array) {
18972
+ if (v == null) continue;
18973
+ const decoded = v != null && typeof v === "object" && "@id" in v && typeof v["@id"] === "string" && v["@id"] !== "" ? (0, _fedify_vocab_runtime.parseIri)(v["@id"], options.baseUrl) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"]) && [
18974
+ "https://www.w3.org/ns/activitystreams#Link",
18975
+ "https://www.w3.org/ns/activitystreams#Hashtag",
18976
+ "https://www.w3.org/ns/activitystreams#Mention"
18977
+ ].some((t) => v["@type"].includes(t)) ? await Link.fromJsonLd(v, {
18978
+ ...options,
18979
+ baseUrl: options.baseUrl
18980
+ }) : void 0;
18981
+ if (typeof decoded === "undefined") {
18982
+ shouldCacheJsonLd = false;
18983
+ continue;
18984
+ }
18985
+ if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
18986
+ _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.push(decoded);
18987
+ }
18988
+ instance.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url;
17967
18989
  instance._shouldCacheJsonLd = shouldCacheJsonLd;
17968
18990
  if (shouldCacheJsonLd && (!("_fromSubclass" in options) || !options._fromSubclass)) try {
17969
18991
  if (cacheJsonLd != null && cacheJsonLd !== expanded) {
@@ -17978,14 +19000,51 @@ var QuoteRequest = class QuoteRequest extends Activity {
17978
19000
  return instance;
17979
19001
  }
17980
19002
  _getCustomInspectProxy() {
17981
- return super._getCustomInspectProxy();
19003
+ const proxy = {};
19004
+ if (this.id != null) proxy.id = {
19005
+ [Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(this.id.href, options),
19006
+ [Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(this.id.href, options)
19007
+ };
19008
+ const _diXuPmFWiEqfLPhhrxg6Xc7ixZG = this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG.map((v) => v instanceof URL ? {
19009
+ [Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
19010
+ [Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
19011
+ } : v);
19012
+ if (_diXuPmFWiEqfLPhhrxg6Xc7ixZG.length == 1) proxy.language = _diXuPmFWiEqfLPhhrxg6Xc7ixZG[0];
19013
+ const _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.map((v) => v instanceof URL ? {
19014
+ [Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
19015
+ [Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
19016
+ } : v);
19017
+ if (_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.length == 1) proxy.translator = _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR[0];
19018
+ if (_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.length > 1 || !("translator" in proxy) && _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.length > 0) proxy.translators = _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR;
19019
+ const _Msz9PwRg7cWkiXPL4ixyQLtuuH7 = this.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7.map((v) => v instanceof URL ? {
19020
+ [Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
19021
+ [Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
19022
+ } : v);
19023
+ if (_Msz9PwRg7cWkiXPL4ixyQLtuuH7.length == 1) proxy.original = _Msz9PwRg7cWkiXPL4ixyQLtuuH7[0];
19024
+ const _yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated = this.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated.map((v) => v instanceof URL ? {
19025
+ [Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
19026
+ [Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
19027
+ } : v);
19028
+ if (_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated.length == 1) proxy.sourceUpdated = _yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated[0];
19029
+ const _4KvkQNz1JjGs8S7iJDcGrUYETbUW = this.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW.map((v) => v instanceof URL ? {
19030
+ [Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
19031
+ [Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
19032
+ } : v);
19033
+ if (_4KvkQNz1JjGs8S7iJDcGrUYETbUW.length == 1) proxy.basis = _4KvkQNz1JjGs8S7iJDcGrUYETbUW[0];
19034
+ const _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.map((v) => v instanceof URL ? {
19035
+ [Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
19036
+ [Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
19037
+ } : v);
19038
+ if (_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length == 1) proxy.url = _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url[0];
19039
+ if (_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length > 1 || !("url" in proxy) && _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length > 0) proxy.urls = _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url;
19040
+ return proxy;
17982
19041
  }
17983
19042
  };
17984
- QuoteRequest.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
17985
- return "QuoteRequest " + inspect(this._getCustomInspectProxy(), options);
19043
+ Translation.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
19044
+ return "Translation " + inspect(this._getCustomInspectProxy(), options);
17986
19045
  };
17987
- QuoteRequest.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
17988
- return "QuoteRequest " + inspect(this._getCustomInspectProxy(), options);
19046
+ Translation.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
19047
+ return "Translation " + inspect(this._getCustomInspectProxy(), options);
17989
19048
  };
17990
19049
  /** Proves that an actor consented to being included in a
17991
19050
  * {@link FeaturedCollection}.
@@ -18383,13 +19442,21 @@ var FeatureAuthorization = class FeatureAuthorization extends Object$1 {
18383
19442
  documentLoader: options.contextLoader,
18384
19443
  keepFreeFloatingNodes: true
18385
19444
  });
18386
- const docContext = options.context ?? [
19445
+ let docContext = options.context ?? [
18387
19446
  "https://www.w3.org/ns/activitystreams",
18388
19447
  "https://w3id.org/security/data-integrity/v1",
18389
19448
  "https://gotosocial.org/ns",
18390
19449
  "https://w3id.org/fep/7aa9"
18391
19450
  ];
18392
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
19451
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
19452
+ if (options.context == null) {
19453
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
19454
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
19455
+ if (additionalContexts.length > 0) {
19456
+ docContext = [...currentContexts, ...additionalContexts];
19457
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
19458
+ }
19459
+ }
18393
19460
  if (docContext != null) {
18394
19461
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
18395
19462
  else compacted.proof["@context"] = docContext;
@@ -18613,14 +19680,22 @@ var FeatureRequest = class FeatureRequest extends Activity {
18613
19680
  documentLoader: options.contextLoader,
18614
19681
  keepFreeFloatingNodes: true
18615
19682
  });
18616
- const docContext = options.context ?? [
19683
+ let docContext = options.context ?? [
18617
19684
  "https://w3id.org/identity/v1",
18618
19685
  "https://www.w3.org/ns/activitystreams",
18619
19686
  "https://w3id.org/security/data-integrity/v1",
18620
19687
  "https://gotosocial.org/ns",
18621
19688
  "https://w3id.org/fep/7aa9"
18622
19689
  ];
18623
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
19690
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
19691
+ if (options.context == null) {
19692
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
19693
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
19694
+ if (additionalContexts.length > 0) {
19695
+ docContext = [...currentContexts, ...additionalContexts];
19696
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
19697
+ }
19698
+ }
18624
19699
  if (docContext != null) {
18625
19700
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
18626
19701
  else compacted.proof["@context"] = docContext;
@@ -20771,7 +21846,7 @@ var Collection = class Collection extends Object$1 {
20771
21846
  documentLoader: options.contextLoader,
20772
21847
  keepFreeFloatingNodes: true
20773
21848
  });
20774
- const docContext = options.context ?? [
21849
+ let docContext = options.context ?? [
20775
21850
  "https://www.w3.org/ns/activitystreams",
20776
21851
  "https://w3id.org/security/data-integrity/v1",
20777
21852
  "https://gotosocial.org/ns",
@@ -20803,7 +21878,15 @@ var Collection = class Collection extends Object$1 {
20803
21878
  }
20804
21879
  }
20805
21880
  ];
20806
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
21881
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
21882
+ if (options.context == null) {
21883
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
21884
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
21885
+ if (additionalContexts.length > 0) {
21886
+ docContext = [...currentContexts, ...additionalContexts];
21887
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
21888
+ }
21889
+ }
20807
21890
  if (docContext != null) {
20808
21891
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
20809
21892
  else compacted.proof["@context"] = docContext;
@@ -21599,7 +22682,7 @@ var OrderedCollection = class OrderedCollection extends Collection {
21599
22682
  documentLoader: options.contextLoader,
21600
22683
  keepFreeFloatingNodes: true
21601
22684
  });
21602
- const docContext = options.context ?? [
22685
+ let docContext = options.context ?? [
21603
22686
  "https://www.w3.org/ns/activitystreams",
21604
22687
  "https://w3id.org/security/data-integrity/v1",
21605
22688
  "https://gotosocial.org/ns",
@@ -21631,7 +22714,15 @@ var OrderedCollection = class OrderedCollection extends Collection {
21631
22714
  }
21632
22715
  }
21633
22716
  ];
21634
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
22717
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
22718
+ if (options.context == null) {
22719
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
22720
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
22721
+ if (additionalContexts.length > 0) {
22722
+ docContext = [...currentContexts, ...additionalContexts];
22723
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
22724
+ }
22725
+ }
21635
22726
  if (docContext != null) {
21636
22727
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
21637
22728
  else compacted.proof["@context"] = docContext;
@@ -21994,7 +23085,7 @@ var FeaturedCollection = class FeaturedCollection extends OrderedCollection {
21994
23085
  documentLoader: options.contextLoader,
21995
23086
  keepFreeFloatingNodes: true
21996
23087
  });
21997
- const docContext = options.context ?? [
23088
+ let docContext = options.context ?? [
21998
23089
  "https://www.w3.org/ns/activitystreams",
21999
23090
  "https://w3id.org/security/data-integrity/v1",
22000
23091
  "https://gotosocial.org/ns",
@@ -22006,7 +23097,15 @@ var FeaturedCollection = class FeaturedCollection extends OrderedCollection {
22006
23097
  "Hashtag": "as:Hashtag"
22007
23098
  }
22008
23099
  ];
22009
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
23100
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
23101
+ if (options.context == null) {
23102
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
23103
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
23104
+ if (additionalContexts.length > 0) {
23105
+ docContext = [...currentContexts, ...additionalContexts];
23106
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
23107
+ }
23108
+ }
22010
23109
  if (docContext != null) {
22011
23110
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
22012
23111
  else compacted.proof["@context"] = docContext;
@@ -22546,13 +23645,21 @@ var FeaturedItem = class FeaturedItem extends Object$1 {
22546
23645
  documentLoader: options.contextLoader,
22547
23646
  keepFreeFloatingNodes: true
22548
23647
  });
22549
- const docContext = options.context ?? [
23648
+ let docContext = options.context ?? [
22550
23649
  "https://www.w3.org/ns/activitystreams",
22551
23650
  "https://w3id.org/security/data-integrity/v1",
22552
23651
  "https://gotosocial.org/ns",
22553
23652
  "https://w3id.org/fep/7aa9"
22554
23653
  ];
22555
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
23654
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
23655
+ if (options.context == null) {
23656
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
23657
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
23658
+ if (additionalContexts.length > 0) {
23659
+ docContext = [...currentContexts, ...additionalContexts];
23660
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
23661
+ }
23662
+ }
22556
23663
  if (docContext != null) {
22557
23664
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
22558
23665
  else compacted.proof["@context"] = docContext;
@@ -22859,8 +23966,16 @@ var DidService = class {
22859
23966
  documentLoader: options.contextLoader,
22860
23967
  keepFreeFloatingNodes: true
22861
23968
  });
22862
- const docContext = options.context ?? "https://www.w3.org/ns/did/v1";
22863
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
23969
+ let docContext = options.context ?? "https://www.w3.org/ns/did/v1";
23970
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
23971
+ if (options.context == null) {
23972
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
23973
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
23974
+ if (additionalContexts.length > 0) {
23975
+ docContext = [...currentContexts, ...additionalContexts];
23976
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
23977
+ }
23978
+ }
22864
23979
  if (docContext != null) {}
22865
23980
  return compacted;
22866
23981
  }
@@ -23041,8 +24156,16 @@ var Export = class Export extends DidService {
23041
24156
  documentLoader: options.contextLoader,
23042
24157
  keepFreeFloatingNodes: true
23043
24158
  });
23044
- const docContext = options.context ?? "https://www.w3.org/ns/did/v1";
23045
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
24159
+ let docContext = options.context ?? "https://www.w3.org/ns/did/v1";
24160
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
24161
+ if (options.context == null) {
24162
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
24163
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
24164
+ if (additionalContexts.length > 0) {
24165
+ docContext = [...currentContexts, ...additionalContexts];
24166
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
24167
+ }
24168
+ }
23046
24169
  if (docContext != null) {}
23047
24170
  return compacted;
23048
24171
  }
@@ -23500,8 +24623,16 @@ var DataIntegrityProof = class {
23500
24623
  documentLoader: options.contextLoader,
23501
24624
  keepFreeFloatingNodes: true
23502
24625
  });
23503
- const docContext = options.context ?? "https://w3id.org/security/data-integrity/v1";
23504
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
24626
+ let docContext = options.context ?? "https://w3id.org/security/data-integrity/v1";
24627
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
24628
+ if (options.context == null) {
24629
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
24630
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
24631
+ if (additionalContexts.length > 0) {
24632
+ docContext = [...currentContexts, ...additionalContexts];
24633
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
24634
+ }
24635
+ }
23505
24636
  if (docContext != null) {}
23506
24637
  return compacted;
23507
24638
  }
@@ -24061,8 +25192,16 @@ var CryptographicKey = class {
24061
25192
  documentLoader: options.contextLoader,
24062
25193
  keepFreeFloatingNodes: true
24063
25194
  });
24064
- const docContext = options.context ?? "https://w3id.org/security/v1";
24065
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
25195
+ let docContext = options.context ?? "https://w3id.org/security/v1";
25196
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
25197
+ if (options.context == null) {
25198
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
25199
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
25200
+ if (additionalContexts.length > 0) {
25201
+ docContext = [...currentContexts, ...additionalContexts];
25202
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
25203
+ }
25204
+ }
24066
25205
  if (docContext != null) {}
24067
25206
  return compacted;
24068
25207
  }
@@ -24589,8 +25728,16 @@ var Multikey = class {
24589
25728
  documentLoader: options.contextLoader,
24590
25729
  keepFreeFloatingNodes: true
24591
25730
  });
24592
- const docContext = options.context ?? "https://w3id.org/security/multikey/v1";
24593
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
25731
+ let docContext = options.context ?? "https://w3id.org/security/multikey/v1";
25732
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
25733
+ if (options.context == null) {
25734
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
25735
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
25736
+ if (additionalContexts.length > 0) {
25737
+ docContext = [...currentContexts, ...additionalContexts];
25738
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
25739
+ }
25740
+ }
24594
25741
  if (docContext != null) {}
24595
25742
  return compacted;
24596
25743
  }
@@ -24928,7 +26075,7 @@ var Agreement = class Agreement extends Object$1 {
24928
26075
  documentLoader: options.contextLoader,
24929
26076
  keepFreeFloatingNodes: true
24930
26077
  });
24931
- const docContext = options.context ?? [
26078
+ let docContext = options.context ?? [
24932
26079
  "https://www.w3.org/ns/activitystreams",
24933
26080
  "https://w3id.org/security/data-integrity/v1",
24934
26081
  "https://gotosocial.org/ns",
@@ -24954,7 +26101,15 @@ var Agreement = class Agreement extends Object$1 {
24954
26101
  "hasNumericalValue": "om2:hasNumericalValue"
24955
26102
  }
24956
26103
  ];
24957
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
26104
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
26105
+ if (options.context == null) {
26106
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
26107
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
26108
+ if (additionalContexts.length > 0) {
26109
+ docContext = [...currentContexts, ...additionalContexts];
26110
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
26111
+ }
26112
+ }
24958
26113
  if (docContext != null) {
24959
26114
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
24960
26115
  else compacted.proof["@context"] = docContext;
@@ -25298,7 +26453,7 @@ var Commitment = class {
25298
26453
  documentLoader: options.contextLoader,
25299
26454
  keepFreeFloatingNodes: true
25300
26455
  });
25301
- const docContext = options.context ?? ["https://www.w3.org/ns/activitystreams", {
26456
+ let docContext = options.context ?? ["https://www.w3.org/ns/activitystreams", {
25302
26457
  "vf": "https://w3id.org/valueflows/ont/vf#",
25303
26458
  "om2": "http://www.ontology-of-units-of-measure.org/resource/om-2/",
25304
26459
  "Commitment": "vf:Commitment",
@@ -25310,7 +26465,15 @@ var Commitment = class {
25310
26465
  "hasUnit": "om2:hasUnit",
25311
26466
  "hasNumericalValue": "om2:hasNumericalValue"
25312
26467
  }];
25313
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
26468
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
26469
+ if (options.context == null) {
26470
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
26471
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
26472
+ if (additionalContexts.length > 0) {
26473
+ docContext = [...currentContexts, ...additionalContexts];
26474
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
26475
+ }
26476
+ }
25314
26477
  if (docContext != null) {}
25315
26478
  return compacted;
25316
26479
  }
@@ -25740,7 +26903,7 @@ var Intent = class {
25740
26903
  documentLoader: options.contextLoader,
25741
26904
  keepFreeFloatingNodes: true
25742
26905
  });
25743
- const docContext = options.context ?? ["https://www.w3.org/ns/activitystreams", {
26906
+ let docContext = options.context ?? ["https://www.w3.org/ns/activitystreams", {
25744
26907
  "vf": "https://w3id.org/valueflows/ont/vf#",
25745
26908
  "om2": "http://www.ontology-of-units-of-measure.org/resource/om-2/",
25746
26909
  "Intent": "vf:Intent",
@@ -25755,7 +26918,15 @@ var Intent = class {
25755
26918
  "hasUnit": "om2:hasUnit",
25756
26919
  "hasNumericalValue": "om2:hasNumericalValue"
25757
26920
  }];
25758
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
26921
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
26922
+ if (options.context == null) {
26923
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
26924
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
26925
+ if (additionalContexts.length > 0) {
26926
+ docContext = [...currentContexts, ...additionalContexts];
26927
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
26928
+ }
26929
+ }
25759
26930
  if (docContext != null) {}
25760
26931
  return compacted;
25761
26932
  }
@@ -26200,7 +27371,7 @@ var Proposal = class Proposal extends Object$1 {
26200
27371
  documentLoader: options.contextLoader,
26201
27372
  keepFreeFloatingNodes: true
26202
27373
  });
26203
- const docContext = options.context ?? [
27374
+ let docContext = options.context ?? [
26204
27375
  "https://www.w3.org/ns/activitystreams",
26205
27376
  "https://w3id.org/security/data-integrity/v1",
26206
27377
  "https://gotosocial.org/ns",
@@ -26231,7 +27402,15 @@ var Proposal = class Proposal extends Object$1 {
26231
27402
  "hasNumericalValue": "om2:hasNumericalValue"
26232
27403
  }
26233
27404
  ];
26234
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
27405
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
27406
+ if (options.context == null) {
27407
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
27408
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
27409
+ if (additionalContexts.length > 0) {
27410
+ docContext = [...currentContexts, ...additionalContexts];
27411
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
27412
+ }
27413
+ }
26235
27414
  if (docContext != null) {
26236
27415
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
26237
27416
  else compacted.proof["@context"] = docContext;
@@ -26477,13 +27656,21 @@ var Accept = class Accept extends Activity {
26477
27656
  documentLoader: options.contextLoader,
26478
27657
  keepFreeFloatingNodes: true
26479
27658
  });
26480
- const docContext = options.context ?? [
27659
+ let docContext = options.context ?? [
26481
27660
  "https://w3id.org/identity/v1",
26482
27661
  "https://www.w3.org/ns/activitystreams",
26483
27662
  "https://w3id.org/security/data-integrity/v1",
26484
27663
  "https://gotosocial.org/ns"
26485
27664
  ];
26486
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
27665
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
27666
+ if (options.context == null) {
27667
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
27668
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
27669
+ if (additionalContexts.length > 0) {
27670
+ docContext = [...currentContexts, ...additionalContexts];
27671
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
27672
+ }
27673
+ }
26487
27674
  if (docContext != null) {
26488
27675
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
26489
27676
  else compacted.proof["@context"] = docContext;
@@ -26652,13 +27839,21 @@ var Add = class Add extends Activity {
26652
27839
  documentLoader: options.contextLoader,
26653
27840
  keepFreeFloatingNodes: true
26654
27841
  });
26655
- const docContext = options.context ?? [
27842
+ let docContext = options.context ?? [
26656
27843
  "https://w3id.org/identity/v1",
26657
27844
  "https://www.w3.org/ns/activitystreams",
26658
27845
  "https://w3id.org/security/data-integrity/v1",
26659
27846
  "https://gotosocial.org/ns"
26660
27847
  ];
26661
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
27848
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
27849
+ if (options.context == null) {
27850
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
27851
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
27852
+ if (additionalContexts.length > 0) {
27853
+ docContext = [...currentContexts, ...additionalContexts];
27854
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
27855
+ }
27856
+ }
26662
27857
  if (docContext != null) {
26663
27858
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
26664
27859
  else compacted.proof["@context"] = docContext;
@@ -26825,7 +28020,7 @@ var Announce = class Announce extends Activity {
26825
28020
  documentLoader: options.contextLoader,
26826
28021
  keepFreeFloatingNodes: true
26827
28022
  });
26828
- const docContext = options.context ?? [
28023
+ let docContext = options.context ?? [
26829
28024
  "https://w3id.org/identity/v1",
26830
28025
  "https://www.w3.org/ns/activitystreams",
26831
28026
  "https://w3id.org/security/data-integrity/v1",
@@ -26860,7 +28055,15 @@ var Announce = class Announce extends Activity {
26860
28055
  }
26861
28056
  }
26862
28057
  ];
26863
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
28058
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
28059
+ if (options.context == null) {
28060
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
28061
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
28062
+ if (additionalContexts.length > 0) {
28063
+ docContext = [...currentContexts, ...additionalContexts];
28064
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
28065
+ }
28066
+ }
26864
28067
  if (docContext != null) {
26865
28068
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
26866
28069
  else compacted.proof["@context"] = docContext;
@@ -30097,7 +31300,7 @@ var Application = class Application extends Object$1 {
30097
31300
  documentLoader: options.contextLoader,
30098
31301
  keepFreeFloatingNodes: true
30099
31302
  });
30100
- const docContext = options.context ?? [
31303
+ let docContext = options.context ?? [
30101
31304
  "https://www.w3.org/ns/activitystreams",
30102
31305
  "https://w3id.org/fep/ef61",
30103
31306
  "https://w3id.org/security/v1",
@@ -30142,7 +31345,15 @@ var Application = class Application extends Object$1 {
30142
31345
  "isCat": "misskey:isCat"
30143
31346
  }
30144
31347
  ];
30145
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
31348
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
31349
+ if (options.context == null) {
31350
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
31351
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
31352
+ if (additionalContexts.length > 0) {
31353
+ docContext = [...currentContexts, ...additionalContexts];
31354
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
31355
+ }
31356
+ }
30146
31357
  if (docContext != null) {
30147
31358
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
30148
31359
  else compacted.proof["@context"] = docContext;
@@ -30895,13 +32106,21 @@ var IntransitiveActivity = class IntransitiveActivity extends Activity {
30895
32106
  documentLoader: options.contextLoader,
30896
32107
  keepFreeFloatingNodes: true
30897
32108
  });
30898
- const docContext = options.context ?? [
32109
+ let docContext = options.context ?? [
30899
32110
  "https://w3id.org/identity/v1",
30900
32111
  "https://www.w3.org/ns/activitystreams",
30901
32112
  "https://w3id.org/security/data-integrity/v1",
30902
32113
  "https://gotosocial.org/ns"
30903
32114
  ];
30904
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
32115
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
32116
+ if (options.context == null) {
32117
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
32118
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
32119
+ if (additionalContexts.length > 0) {
32120
+ docContext = [...currentContexts, ...additionalContexts];
32121
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
32122
+ }
32123
+ }
30905
32124
  if (docContext != null) {
30906
32125
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
30907
32126
  else compacted.proof["@context"] = docContext;
@@ -31071,13 +32290,21 @@ var Arrive = class Arrive extends IntransitiveActivity {
31071
32290
  documentLoader: options.contextLoader,
31072
32291
  keepFreeFloatingNodes: true
31073
32292
  });
31074
- const docContext = options.context ?? [
32293
+ let docContext = options.context ?? [
31075
32294
  "https://w3id.org/identity/v1",
31076
32295
  "https://www.w3.org/ns/activitystreams",
31077
32296
  "https://w3id.org/security/data-integrity/v1",
31078
32297
  "https://gotosocial.org/ns"
31079
32298
  ];
31080
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
32299
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
32300
+ if (options.context == null) {
32301
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
32302
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
32303
+ if (additionalContexts.length > 0) {
32304
+ docContext = [...currentContexts, ...additionalContexts];
32305
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
32306
+ }
32307
+ }
31081
32308
  if (docContext != null) {
31082
32309
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
31083
32310
  else compacted.proof["@context"] = docContext;
@@ -31648,7 +32875,7 @@ var Article = class Article extends Object$1 {
31648
32875
  documentLoader: options.contextLoader,
31649
32876
  keepFreeFloatingNodes: true
31650
32877
  });
31651
- const docContext = options.context ?? [
32878
+ let docContext = options.context ?? [
31652
32879
  "https://www.w3.org/ns/activitystreams",
31653
32880
  "https://w3id.org/security/data-integrity/v1",
31654
32881
  "https://gotosocial.org/ns",
@@ -31677,7 +32904,15 @@ var Article = class Article extends Object$1 {
31677
32904
  }
31678
32905
  }
31679
32906
  ];
31680
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
32907
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
32908
+ if (options.context == null) {
32909
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
32910
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
32911
+ if (additionalContexts.length > 0) {
32912
+ docContext = [...currentContexts, ...additionalContexts];
32913
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
32914
+ }
32915
+ }
31681
32916
  if (docContext != null) {
31682
32917
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
31683
32918
  else compacted.proof["@context"] = docContext;
@@ -32034,13 +33269,21 @@ var Document = class Document extends Object$1 {
32034
33269
  documentLoader: options.contextLoader,
32035
33270
  keepFreeFloatingNodes: true
32036
33271
  });
32037
- const docContext = options.context ?? [
33272
+ let docContext = options.context ?? [
32038
33273
  "https://www.w3.org/ns/activitystreams",
32039
33274
  "https://w3id.org/security/data-integrity/v2",
32040
33275
  { "digestMultibase": "https://www.w3.org/ns/credentials/v2#digestMultibase" },
32041
33276
  "https://gotosocial.org/ns"
32042
33277
  ];
32043
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
33278
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
33279
+ if (options.context == null) {
33280
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
33281
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
33282
+ if (additionalContexts.length > 0) {
33283
+ docContext = [...currentContexts, ...additionalContexts];
33284
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
33285
+ }
33286
+ }
32044
33287
  if (docContext != null) {
32045
33288
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
32046
33289
  else compacted.proof["@context"] = docContext;
@@ -32280,13 +33523,21 @@ var Audio = class Audio extends Document {
32280
33523
  documentLoader: options.contextLoader,
32281
33524
  keepFreeFloatingNodes: true
32282
33525
  });
32283
- const docContext = options.context ?? [
33526
+ let docContext = options.context ?? [
32284
33527
  "https://www.w3.org/ns/activitystreams",
32285
33528
  "https://w3id.org/security/data-integrity/v2",
32286
33529
  { "digestMultibase": "https://www.w3.org/ns/credentials/v2#digestMultibase" },
32287
33530
  "https://gotosocial.org/ns"
32288
33531
  ];
32289
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
33532
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
33533
+ if (options.context == null) {
33534
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
33535
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
33536
+ if (additionalContexts.length > 0) {
33537
+ docContext = [...currentContexts, ...additionalContexts];
33538
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
33539
+ }
33540
+ }
32290
33541
  if (docContext != null) {
32291
33542
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
32292
33543
  else compacted.proof["@context"] = docContext;
@@ -32446,194 +33697,210 @@ var Ignore = class Ignore extends Activity {
32446
33697
  format: "expand",
32447
33698
  context: void 0
32448
33699
  }))[0];
32449
- values["@type"] = ["https://www.w3.org/ns/activitystreams#Ignore"];
33700
+ values["@type"] = ["https://www.w3.org/ns/activitystreams#Ignore"];
33701
+ if (this.id != null) values["@id"] = (0, _fedify_vocab_runtime.formatIri)(this.id);
33702
+ if (options.format === "expand") return await _fedify_vocab_runtime_jsonld.default.expand(values, {
33703
+ documentLoader: options.contextLoader,
33704
+ keepFreeFloatingNodes: true
33705
+ });
33706
+ let docContext = options.context ?? [
33707
+ "https://w3id.org/identity/v1",
33708
+ "https://www.w3.org/ns/activitystreams",
33709
+ "https://w3id.org/security/data-integrity/v1",
33710
+ "https://gotosocial.org/ns"
33711
+ ];
33712
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
33713
+ if (options.context == null) {
33714
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
33715
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
33716
+ if (additionalContexts.length > 0) {
33717
+ docContext = [...currentContexts, ...additionalContexts];
33718
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
33719
+ }
33720
+ }
33721
+ if (docContext != null) {
33722
+ if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
33723
+ else compacted.proof["@context"] = docContext;
33724
+ }
33725
+ return compacted;
33726
+ }
33727
+ isCompactable() {
33728
+ return super.isCompactable();
33729
+ }
33730
+ /**
33731
+ * Converts a JSON-LD structure to an object of this type.
33732
+ * @param json The JSON-LD structure to convert.
33733
+ * @param options The options to use.
33734
+ * - `documentLoader`: The loader for remote JSON-LD documents.
33735
+ * - `contextLoader`: The loader for remote JSON-LD contexts.
33736
+ * - `tracerProvider`: The OpenTelemetry tracer provider to use.
33737
+ * If omitted, the global tracer provider is used.
33738
+ * @returns The object of this type.
33739
+ * @throws {TypeError} If the given `json` is invalid.
33740
+ */
33741
+ static async fromJsonLd(json, options = {}) {
33742
+ return await (options.tracerProvider ?? _opentelemetry_api.trace.getTracerProvider()).getTracer("@fedify/vocab-tools", "2.4.0").startActiveSpan("activitypub.parse_object", async (span) => {
33743
+ try {
33744
+ const object = await this.__fromJsonLd__Ignore__(json, span, options);
33745
+ if (object.id != null) span.setAttribute("activitypub.object.id", object.id.href);
33746
+ return object;
33747
+ } catch (error) {
33748
+ span.setStatus({
33749
+ code: _opentelemetry_api.SpanStatusCode.ERROR,
33750
+ message: String(error)
33751
+ });
33752
+ throw error;
33753
+ } finally {
33754
+ span.end();
33755
+ }
33756
+ });
33757
+ }
33758
+ static async __fromJsonLd__Ignore__(json, span, options = {}) {
33759
+ if (typeof json === "undefined") throw new TypeError("Invalid JSON-LD: undefined.");
33760
+ else if (json === null) throw new TypeError("Invalid JSON-LD: null.");
33761
+ options = {
33762
+ ...options,
33763
+ documentLoader: options.documentLoader ?? (0, _fedify_vocab_runtime.getDocumentLoader)(),
33764
+ contextLoader: options.contextLoader ?? (0, _fedify_vocab_runtime.getDocumentLoader)(),
33765
+ tracerProvider: options.tracerProvider ?? _opentelemetry_api.trace.getTracerProvider()
33766
+ };
33767
+ let values;
33768
+ let expanded;
33769
+ if ("_fromSubclass" in options && options._fromSubclass && typeof json === "object" && !Array.isArray(json)) {
33770
+ values = json;
33771
+ expanded = [values];
33772
+ } else if (globalThis.Object.keys(json).length == 0) {
33773
+ values = {};
33774
+ expanded = [values];
33775
+ } else {
33776
+ expanded = await _fedify_vocab_runtime_jsonld.default.expand(json, {
33777
+ documentLoader: options.contextLoader,
33778
+ keepFreeFloatingNodes: true
33779
+ });
33780
+ values = expanded[0] ?? {};
33781
+ }
33782
+ const id = (0, _fedify_vocab_runtime.parseJsonLdId)(values["@id"], options.baseUrl);
33783
+ if (id != null && options.baseUrl == null) options = {
33784
+ ...options,
33785
+ baseUrl: id
33786
+ };
33787
+ if ("@type" in values) span.setAttribute("activitypub.object.type", values["@type"]);
33788
+ if ("@type" in values && !values["@type"].every((t) => t.startsWith("_:"))) {
33789
+ if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Block")) return await Block.fromJsonLd(json, options);
33790
+ if (!values["@type"].includes("https://www.w3.org/ns/activitystreams#Ignore")) throw new TypeError("Invalid type: " + values["@type"]);
33791
+ }
33792
+ let cacheJsonLd = !("_fromSubclass" in options) || !options._fromSubclass ? (0, _fedify_vocab_runtime_internal_jsonld_cache.normalizeJsonLdIris)(expanded, PORTABLE_IRI_KEYS, PORTABLE_IRI_PATTERN) : void 0;
33793
+ if (cacheJsonLd != null && cacheJsonLd !== expanded) cacheJsonLd = structuredClone(cacheJsonLd);
33794
+ const superValues = structuredClone(values);
33795
+ delete superValues["@type"];
33796
+ const instance = await super.fromJsonLd(superValues, {
33797
+ ...options,
33798
+ _fromSubclass: true
33799
+ });
33800
+ if (!(instance instanceof Ignore)) throw new TypeError("Unexpected type: " + instance.constructor.name);
33801
+ let shouldCacheJsonLd = instance._shouldCacheJsonLd;
33802
+ instance._shouldCacheJsonLd = shouldCacheJsonLd;
33803
+ if (shouldCacheJsonLd && (!("_fromSubclass" in options) || !options._fromSubclass)) try {
33804
+ if (cacheJsonLd != null && cacheJsonLd !== expanded) {
33805
+ const compactArray = Array.isArray(json) && json.length === 1;
33806
+ const jsonLd = compactArray ? json[0] : json;
33807
+ const cachedJsonLd = await (0, _fedify_vocab_runtime_internal_jsonld_cache.compactJsonLdCache)(cacheJsonLd, jsonLd, options.contextLoader);
33808
+ instance._cachedJsonLd = compactArray ? [cachedJsonLd] : cachedJsonLd;
33809
+ } else instance._cachedJsonLd = structuredClone(json);
33810
+ } catch {
33811
+ (0, _logtape_logtape.getLogger)(["fedify", "vocab"]).warn("Failed to cache JSON-LD: {json}", { json });
33812
+ }
33813
+ return instance;
33814
+ }
33815
+ _getCustomInspectProxy() {
33816
+ return super._getCustomInspectProxy();
33817
+ }
33818
+ };
33819
+ Ignore.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
33820
+ return "Ignore " + inspect(this._getCustomInspectProxy(), options);
33821
+ };
33822
+ Ignore.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
33823
+ return "Ignore " + inspect(this._getCustomInspectProxy(), options);
33824
+ };
33825
+ /** Indicates that the `actor` is blocking the `object`. Blocking is a stronger
33826
+ * form of {@link Ignore}. The typical use is to support social systems that
33827
+ * allow one user to block activities or content of other users. The `target`
33828
+ * and `origin` typically have no defined meaning.
33829
+ */
33830
+ var Block = class Block extends Ignore {
33831
+ /**
33832
+ * The type URI of {@link Block}: `https://www.w3.org/ns/activitystreams#Block`.
33833
+ */
33834
+ static get typeId() {
33835
+ return new URL("https://www.w3.org/ns/activitystreams#Block");
33836
+ }
33837
+ /**
33838
+ * Constructs a new instance of Block with the given values.
33839
+ * @param values The values to initialize the instance with.
33840
+ * @param options The options to use for initialization.
33841
+ */
33842
+ constructor(values, options = {}) {
33843
+ super(values, options);
33844
+ }
33845
+ /**
33846
+ * Clones this instance, optionally updating it with the given values.
33847
+ * @param values The values to update the clone with.
33848
+ * @param options The options to use for cloning.
33849
+ * @returns The cloned instance.
33850
+ */
33851
+ clone(values = {}, options = {}) {
33852
+ if (this._warning != null) {
33853
+ (0, _logtape_logtape.getLogger)(this._warning.category).warn(this._warning.message, this._warning.values);
33854
+ options = {
33855
+ ...options,
33856
+ $warning: this._warning
33857
+ };
33858
+ }
33859
+ return super.clone(values, options);
33860
+ }
33861
+ /**
33862
+ * Converts this object to a JSON-LD structure.
33863
+ * @param options The options to use.
33864
+ * - `format`: The format of the output: `compact` or
33865
+ `expand`.
33866
+ * - `contextLoader`: The loader for remote JSON-LD contexts.
33867
+ * - `context`: The JSON-LD context to use. Not applicable
33868
+ when `format` is set to `'expand'`.
33869
+ * @returns The JSON-LD representation of this object.
33870
+ */
33871
+ async toJsonLd(options = {}) {
33872
+ if (options.format == null && this._cachedJsonLd != null) return this._cachedJsonLd;
33873
+ if (options.format !== "compact" && options.context != null) throw new TypeError("The context option can only be used when the format option is set to 'compact'.");
33874
+ options = {
33875
+ ...options,
33876
+ contextLoader: options.contextLoader ?? (0, _fedify_vocab_runtime.getDocumentLoader)()
33877
+ };
33878
+ const values = (await super.toJsonLd({
33879
+ ...options,
33880
+ format: "expand",
33881
+ context: void 0
33882
+ }))[0];
33883
+ values["@type"] = ["https://www.w3.org/ns/activitystreams#Block"];
32450
33884
  if (this.id != null) values["@id"] = (0, _fedify_vocab_runtime.formatIri)(this.id);
32451
33885
  if (options.format === "expand") return await _fedify_vocab_runtime_jsonld.default.expand(values, {
32452
33886
  documentLoader: options.contextLoader,
32453
33887
  keepFreeFloatingNodes: true
32454
33888
  });
32455
- const docContext = options.context ?? [
33889
+ let docContext = options.context ?? [
32456
33890
  "https://w3id.org/identity/v1",
32457
33891
  "https://www.w3.org/ns/activitystreams",
32458
33892
  "https://w3id.org/security/data-integrity/v1",
32459
33893
  "https://gotosocial.org/ns"
32460
33894
  ];
32461
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
32462
- if (docContext != null) {
32463
- if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
32464
- else compacted.proof["@context"] = docContext;
32465
- }
32466
- return compacted;
32467
- }
32468
- isCompactable() {
32469
- return super.isCompactable();
32470
- }
32471
- /**
32472
- * Converts a JSON-LD structure to an object of this type.
32473
- * @param json The JSON-LD structure to convert.
32474
- * @param options The options to use.
32475
- * - `documentLoader`: The loader for remote JSON-LD documents.
32476
- * - `contextLoader`: The loader for remote JSON-LD contexts.
32477
- * - `tracerProvider`: The OpenTelemetry tracer provider to use.
32478
- * If omitted, the global tracer provider is used.
32479
- * @returns The object of this type.
32480
- * @throws {TypeError} If the given `json` is invalid.
32481
- */
32482
- static async fromJsonLd(json, options = {}) {
32483
- return await (options.tracerProvider ?? _opentelemetry_api.trace.getTracerProvider()).getTracer("@fedify/vocab-tools", "2.4.0").startActiveSpan("activitypub.parse_object", async (span) => {
32484
- try {
32485
- const object = await this.__fromJsonLd__Ignore__(json, span, options);
32486
- if (object.id != null) span.setAttribute("activitypub.object.id", object.id.href);
32487
- return object;
32488
- } catch (error) {
32489
- span.setStatus({
32490
- code: _opentelemetry_api.SpanStatusCode.ERROR,
32491
- message: String(error)
32492
- });
32493
- throw error;
32494
- } finally {
32495
- span.end();
33895
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
33896
+ if (options.context == null) {
33897
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
33898
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
33899
+ if (additionalContexts.length > 0) {
33900
+ docContext = [...currentContexts, ...additionalContexts];
33901
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
32496
33902
  }
32497
- });
32498
- }
32499
- static async __fromJsonLd__Ignore__(json, span, options = {}) {
32500
- if (typeof json === "undefined") throw new TypeError("Invalid JSON-LD: undefined.");
32501
- else if (json === null) throw new TypeError("Invalid JSON-LD: null.");
32502
- options = {
32503
- ...options,
32504
- documentLoader: options.documentLoader ?? (0, _fedify_vocab_runtime.getDocumentLoader)(),
32505
- contextLoader: options.contextLoader ?? (0, _fedify_vocab_runtime.getDocumentLoader)(),
32506
- tracerProvider: options.tracerProvider ?? _opentelemetry_api.trace.getTracerProvider()
32507
- };
32508
- let values;
32509
- let expanded;
32510
- if ("_fromSubclass" in options && options._fromSubclass && typeof json === "object" && !Array.isArray(json)) {
32511
- values = json;
32512
- expanded = [values];
32513
- } else if (globalThis.Object.keys(json).length == 0) {
32514
- values = {};
32515
- expanded = [values];
32516
- } else {
32517
- expanded = await _fedify_vocab_runtime_jsonld.default.expand(json, {
32518
- documentLoader: options.contextLoader,
32519
- keepFreeFloatingNodes: true
32520
- });
32521
- values = expanded[0] ?? {};
32522
33903
  }
32523
- const id = (0, _fedify_vocab_runtime.parseJsonLdId)(values["@id"], options.baseUrl);
32524
- if (id != null && options.baseUrl == null) options = {
32525
- ...options,
32526
- baseUrl: id
32527
- };
32528
- if ("@type" in values) span.setAttribute("activitypub.object.type", values["@type"]);
32529
- if ("@type" in values && !values["@type"].every((t) => t.startsWith("_:"))) {
32530
- if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Block")) return await Block.fromJsonLd(json, options);
32531
- if (!values["@type"].includes("https://www.w3.org/ns/activitystreams#Ignore")) throw new TypeError("Invalid type: " + values["@type"]);
32532
- }
32533
- let cacheJsonLd = !("_fromSubclass" in options) || !options._fromSubclass ? (0, _fedify_vocab_runtime_internal_jsonld_cache.normalizeJsonLdIris)(expanded, PORTABLE_IRI_KEYS, PORTABLE_IRI_PATTERN) : void 0;
32534
- if (cacheJsonLd != null && cacheJsonLd !== expanded) cacheJsonLd = structuredClone(cacheJsonLd);
32535
- const superValues = structuredClone(values);
32536
- delete superValues["@type"];
32537
- const instance = await super.fromJsonLd(superValues, {
32538
- ...options,
32539
- _fromSubclass: true
32540
- });
32541
- if (!(instance instanceof Ignore)) throw new TypeError("Unexpected type: " + instance.constructor.name);
32542
- let shouldCacheJsonLd = instance._shouldCacheJsonLd;
32543
- instance._shouldCacheJsonLd = shouldCacheJsonLd;
32544
- if (shouldCacheJsonLd && (!("_fromSubclass" in options) || !options._fromSubclass)) try {
32545
- if (cacheJsonLd != null && cacheJsonLd !== expanded) {
32546
- const compactArray = Array.isArray(json) && json.length === 1;
32547
- const jsonLd = compactArray ? json[0] : json;
32548
- const cachedJsonLd = await (0, _fedify_vocab_runtime_internal_jsonld_cache.compactJsonLdCache)(cacheJsonLd, jsonLd, options.contextLoader);
32549
- instance._cachedJsonLd = compactArray ? [cachedJsonLd] : cachedJsonLd;
32550
- } else instance._cachedJsonLd = structuredClone(json);
32551
- } catch {
32552
- (0, _logtape_logtape.getLogger)(["fedify", "vocab"]).warn("Failed to cache JSON-LD: {json}", { json });
32553
- }
32554
- return instance;
32555
- }
32556
- _getCustomInspectProxy() {
32557
- return super._getCustomInspectProxy();
32558
- }
32559
- };
32560
- Ignore.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
32561
- return "Ignore " + inspect(this._getCustomInspectProxy(), options);
32562
- };
32563
- Ignore.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
32564
- return "Ignore " + inspect(this._getCustomInspectProxy(), options);
32565
- };
32566
- /** Indicates that the `actor` is blocking the `object`. Blocking is a stronger
32567
- * form of {@link Ignore}. The typical use is to support social systems that
32568
- * allow one user to block activities or content of other users. The `target`
32569
- * and `origin` typically have no defined meaning.
32570
- */
32571
- var Block = class Block extends Ignore {
32572
- /**
32573
- * The type URI of {@link Block}: `https://www.w3.org/ns/activitystreams#Block`.
32574
- */
32575
- static get typeId() {
32576
- return new URL("https://www.w3.org/ns/activitystreams#Block");
32577
- }
32578
- /**
32579
- * Constructs a new instance of Block with the given values.
32580
- * @param values The values to initialize the instance with.
32581
- * @param options The options to use for initialization.
32582
- */
32583
- constructor(values, options = {}) {
32584
- super(values, options);
32585
- }
32586
- /**
32587
- * Clones this instance, optionally updating it with the given values.
32588
- * @param values The values to update the clone with.
32589
- * @param options The options to use for cloning.
32590
- * @returns The cloned instance.
32591
- */
32592
- clone(values = {}, options = {}) {
32593
- if (this._warning != null) {
32594
- (0, _logtape_logtape.getLogger)(this._warning.category).warn(this._warning.message, this._warning.values);
32595
- options = {
32596
- ...options,
32597
- $warning: this._warning
32598
- };
32599
- }
32600
- return super.clone(values, options);
32601
- }
32602
- /**
32603
- * Converts this object to a JSON-LD structure.
32604
- * @param options The options to use.
32605
- * - `format`: The format of the output: `compact` or
32606
- `expand`.
32607
- * - `contextLoader`: The loader for remote JSON-LD contexts.
32608
- * - `context`: The JSON-LD context to use. Not applicable
32609
- when `format` is set to `'expand'`.
32610
- * @returns The JSON-LD representation of this object.
32611
- */
32612
- async toJsonLd(options = {}) {
32613
- if (options.format == null && this._cachedJsonLd != null) return this._cachedJsonLd;
32614
- if (options.format !== "compact" && options.context != null) throw new TypeError("The context option can only be used when the format option is set to 'compact'.");
32615
- options = {
32616
- ...options,
32617
- contextLoader: options.contextLoader ?? (0, _fedify_vocab_runtime.getDocumentLoader)()
32618
- };
32619
- const values = (await super.toJsonLd({
32620
- ...options,
32621
- format: "expand",
32622
- context: void 0
32623
- }))[0];
32624
- values["@type"] = ["https://www.w3.org/ns/activitystreams#Block"];
32625
- if (this.id != null) values["@id"] = (0, _fedify_vocab_runtime.formatIri)(this.id);
32626
- if (options.format === "expand") return await _fedify_vocab_runtime_jsonld.default.expand(values, {
32627
- documentLoader: options.contextLoader,
32628
- keepFreeFloatingNodes: true
32629
- });
32630
- const docContext = options.context ?? [
32631
- "https://w3id.org/identity/v1",
32632
- "https://www.w3.org/ns/activitystreams",
32633
- "https://w3id.org/security/data-integrity/v1",
32634
- "https://gotosocial.org/ns"
32635
- ];
32636
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
32637
33904
  if (docContext != null) {
32638
33905
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
32639
33906
  else compacted.proof["@context"] = docContext;
@@ -33316,7 +34583,7 @@ var CollectionPage = class CollectionPage extends Collection {
33316
34583
  documentLoader: options.contextLoader,
33317
34584
  keepFreeFloatingNodes: true
33318
34585
  });
33319
- const docContext = options.context ?? [
34586
+ let docContext = options.context ?? [
33320
34587
  "https://www.w3.org/ns/activitystreams",
33321
34588
  "https://w3id.org/security/data-integrity/v1",
33322
34589
  "https://gotosocial.org/ns",
@@ -33348,7 +34615,15 @@ var CollectionPage = class CollectionPage extends Collection {
33348
34615
  }
33349
34616
  }
33350
34617
  ];
33351
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
34618
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
34619
+ if (options.context == null) {
34620
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
34621
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
34622
+ if (additionalContexts.length > 0) {
34623
+ docContext = [...currentContexts, ...additionalContexts];
34624
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
34625
+ }
34626
+ }
33352
34627
  if (docContext != null) {
33353
34628
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
33354
34629
  else compacted.proof["@context"] = docContext;
@@ -33593,7 +34868,7 @@ var Create = class Create extends Activity {
33593
34868
  documentLoader: options.contextLoader,
33594
34869
  keepFreeFloatingNodes: true
33595
34870
  });
33596
- const docContext = options.context ?? [
34871
+ let docContext = options.context ?? [
33597
34872
  "https://w3id.org/identity/v1",
33598
34873
  "https://www.w3.org/ns/activitystreams",
33599
34874
  "https://w3id.org/security/data-integrity/v1",
@@ -33629,7 +34904,15 @@ var Create = class Create extends Activity {
33629
34904
  }
33630
34905
  }
33631
34906
  ];
33632
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
34907
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
34908
+ if (options.context == null) {
34909
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
34910
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
34911
+ if (additionalContexts.length > 0) {
34912
+ docContext = [...currentContexts, ...additionalContexts];
34913
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
34914
+ }
34915
+ }
33633
34916
  if (docContext != null) {
33634
34917
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
33635
34918
  else compacted.proof["@context"] = docContext;
@@ -33795,7 +35078,7 @@ var Delete = class Delete extends Activity {
33795
35078
  documentLoader: options.contextLoader,
33796
35079
  keepFreeFloatingNodes: true
33797
35080
  });
33798
- const docContext = options.context ?? [
35081
+ let docContext = options.context ?? [
33799
35082
  "https://w3id.org/identity/v1",
33800
35083
  "https://www.w3.org/ns/activitystreams",
33801
35084
  "https://w3id.org/security/data-integrity/v1",
@@ -33827,7 +35110,15 @@ var Delete = class Delete extends Activity {
33827
35110
  }
33828
35111
  }
33829
35112
  ];
33830
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
35113
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
35114
+ if (options.context == null) {
35115
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
35116
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
35117
+ if (additionalContexts.length > 0) {
35118
+ docContext = [...currentContexts, ...additionalContexts];
35119
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
35120
+ }
35121
+ }
33831
35122
  if (docContext != null) {
33832
35123
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
33833
35124
  else compacted.proof["@context"] = docContext;
@@ -33992,7 +35283,7 @@ var Dislike = class Dislike extends Activity {
33992
35283
  documentLoader: options.contextLoader,
33993
35284
  keepFreeFloatingNodes: true
33994
35285
  });
33995
- const docContext = options.context ?? [
35286
+ let docContext = options.context ?? [
33996
35287
  "https://w3id.org/identity/v1",
33997
35288
  "https://www.w3.org/ns/activitystreams",
33998
35289
  "https://w3id.org/security/data-integrity/v1",
@@ -34002,7 +35293,15 @@ var Dislike = class Dislike extends Activity {
34002
35293
  "Emoji": "toot:Emoji"
34003
35294
  }
34004
35295
  ];
34005
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
35296
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
35297
+ if (options.context == null) {
35298
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
35299
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
35300
+ if (additionalContexts.length > 0) {
35301
+ docContext = [...currentContexts, ...additionalContexts];
35302
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
35303
+ }
35304
+ }
34006
35305
  if (docContext != null) {
34007
35306
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
34008
35307
  else compacted.proof["@context"] = docContext;
@@ -34455,8 +35754,16 @@ var Endpoints = class {
34455
35754
  documentLoader: options.contextLoader,
34456
35755
  keepFreeFloatingNodes: true
34457
35756
  });
34458
- const docContext = options.context ?? "https://www.w3.org/ns/activitystreams";
34459
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
35757
+ let docContext = options.context ?? "https://www.w3.org/ns/activitystreams";
35758
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
35759
+ if (options.context == null) {
35760
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
35761
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
35762
+ if (additionalContexts.length > 0) {
35763
+ docContext = [...currentContexts, ...additionalContexts];
35764
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
35765
+ }
35766
+ }
34460
35767
  if (docContext != null) {}
34461
35768
  return compacted;
34462
35769
  }
@@ -34758,12 +36065,20 @@ var Event = class Event extends Object$1 {
34758
36065
  documentLoader: options.contextLoader,
34759
36066
  keepFreeFloatingNodes: true
34760
36067
  });
34761
- const docContext = options.context ?? [
36068
+ let docContext = options.context ?? [
34762
36069
  "https://www.w3.org/ns/activitystreams",
34763
36070
  "https://w3id.org/security/data-integrity/v1",
34764
36071
  "https://gotosocial.org/ns"
34765
36072
  ];
34766
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
36073
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
36074
+ if (options.context == null) {
36075
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
36076
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
36077
+ if (additionalContexts.length > 0) {
36078
+ docContext = [...currentContexts, ...additionalContexts];
36079
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
36080
+ }
36081
+ }
34767
36082
  if (docContext != null) {
34768
36083
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
34769
36084
  else compacted.proof["@context"] = docContext;
@@ -34930,13 +36245,21 @@ var Flag = class Flag extends Activity {
34930
36245
  documentLoader: options.contextLoader,
34931
36246
  keepFreeFloatingNodes: true
34932
36247
  });
34933
- const docContext = options.context ?? [
36248
+ let docContext = options.context ?? [
34934
36249
  "https://w3id.org/identity/v1",
34935
36250
  "https://www.w3.org/ns/activitystreams",
34936
36251
  "https://w3id.org/security/data-integrity/v1",
34937
36252
  "https://gotosocial.org/ns"
34938
36253
  ];
34939
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
36254
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
36255
+ if (options.context == null) {
36256
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
36257
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
36258
+ if (additionalContexts.length > 0) {
36259
+ docContext = [...currentContexts, ...additionalContexts];
36260
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
36261
+ }
36262
+ }
34940
36263
  if (docContext != null) {
34941
36264
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
34942
36265
  else compacted.proof["@context"] = docContext;
@@ -35104,7 +36427,7 @@ var Follow = class Follow extends Activity {
35104
36427
  documentLoader: options.contextLoader,
35105
36428
  keepFreeFloatingNodes: true
35106
36429
  });
35107
- const docContext = options.context ?? [
36430
+ let docContext = options.context ?? [
35108
36431
  "https://w3id.org/identity/v1",
35109
36432
  "https://www.w3.org/ns/activitystreams",
35110
36433
  "https://w3id.org/security/v1",
@@ -35113,7 +36436,15 @@ var Follow = class Follow extends Activity {
35113
36436
  "https://w3id.org/security/multikey/v1",
35114
36437
  "https://gotosocial.org/ns"
35115
36438
  ];
35116
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
36439
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
36440
+ if (options.context == null) {
36441
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
36442
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
36443
+ if (additionalContexts.length > 0) {
36444
+ docContext = [...currentContexts, ...additionalContexts];
36445
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
36446
+ }
36447
+ }
35117
36448
  if (docContext != null) {
35118
36449
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
35119
36450
  else compacted.proof["@context"] = docContext;
@@ -38350,7 +39681,7 @@ var Group = class Group extends Object$1 {
38350
39681
  documentLoader: options.contextLoader,
38351
39682
  keepFreeFloatingNodes: true
38352
39683
  });
38353
- const docContext = options.context ?? [
39684
+ let docContext = options.context ?? [
38354
39685
  "https://www.w3.org/ns/activitystreams",
38355
39686
  "https://w3id.org/fep/ef61",
38356
39687
  "https://w3id.org/security/v1",
@@ -38395,7 +39726,15 @@ var Group = class Group extends Object$1 {
38395
39726
  "isCat": "misskey:isCat"
38396
39727
  }
38397
39728
  ];
38398
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
39729
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
39730
+ if (options.context == null) {
39731
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
39732
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
39733
+ if (additionalContexts.length > 0) {
39734
+ docContext = [...currentContexts, ...additionalContexts];
39735
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
39736
+ }
39737
+ }
38399
39738
  if (docContext != null) {
38400
39739
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
38401
39740
  else compacted.proof["@context"] = docContext;
@@ -39679,8 +41018,16 @@ var Link = class Link {
39679
41018
  documentLoader: options.contextLoader,
39680
41019
  keepFreeFloatingNodes: true
39681
41020
  });
39682
- const docContext = options.context ?? ["https://www.w3.org/ns/activitystreams", "https://w3id.org/fep/ef61"];
39683
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
41021
+ let docContext = options.context ?? ["https://www.w3.org/ns/activitystreams", "https://w3id.org/fep/ef61"];
41022
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
41023
+ if (options.context == null) {
41024
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
41025
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
41026
+ if (additionalContexts.length > 0) {
41027
+ docContext = [...currentContexts, ...additionalContexts];
41028
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
41029
+ }
41030
+ }
39684
41031
  if (docContext != null) {}
39685
41032
  return compacted;
39686
41033
  }
@@ -40106,8 +41453,16 @@ var Hashtag = class Hashtag extends Link {
40106
41453
  documentLoader: options.contextLoader,
40107
41454
  keepFreeFloatingNodes: true
40108
41455
  });
40109
- const docContext = options.context ?? ["https://www.w3.org/ns/activitystreams", { "Hashtag": "as:Hashtag" }];
40110
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
41456
+ let docContext = options.context ?? ["https://www.w3.org/ns/activitystreams", { "Hashtag": "as:Hashtag" }];
41457
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
41458
+ if (options.context == null) {
41459
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
41460
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
41461
+ if (additionalContexts.length > 0) {
41462
+ docContext = [...currentContexts, ...additionalContexts];
41463
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
41464
+ }
41465
+ }
40111
41466
  if (docContext != null) {}
40112
41467
  return compacted;
40113
41468
  }
@@ -40285,13 +41640,21 @@ var Image = class Image extends Document {
40285
41640
  documentLoader: options.contextLoader,
40286
41641
  keepFreeFloatingNodes: true
40287
41642
  });
40288
- const docContext = options.context ?? [
41643
+ let docContext = options.context ?? [
40289
41644
  "https://www.w3.org/ns/activitystreams",
40290
41645
  "https://w3id.org/security/data-integrity/v2",
40291
41646
  { "digestMultibase": "https://www.w3.org/ns/credentials/v2#digestMultibase" },
40292
41647
  "https://gotosocial.org/ns"
40293
41648
  ];
40294
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
41649
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
41650
+ if (options.context == null) {
41651
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
41652
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
41653
+ if (additionalContexts.length > 0) {
41654
+ docContext = [...currentContexts, ...additionalContexts];
41655
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
41656
+ }
41657
+ }
40295
41658
  if (docContext != null) {
40296
41659
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
40297
41660
  else compacted.proof["@context"] = docContext;
@@ -40458,13 +41821,21 @@ var Offer = class Offer extends Activity {
40458
41821
  documentLoader: options.contextLoader,
40459
41822
  keepFreeFloatingNodes: true
40460
41823
  });
40461
- const docContext = options.context ?? [
41824
+ let docContext = options.context ?? [
40462
41825
  "https://w3id.org/identity/v1",
40463
41826
  "https://www.w3.org/ns/activitystreams",
40464
41827
  "https://w3id.org/security/data-integrity/v1",
40465
41828
  "https://gotosocial.org/ns"
40466
41829
  ];
40467
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
41830
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
41831
+ if (options.context == null) {
41832
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
41833
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
41834
+ if (additionalContexts.length > 0) {
41835
+ docContext = [...currentContexts, ...additionalContexts];
41836
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
41837
+ }
41838
+ }
40468
41839
  if (docContext != null) {
40469
41840
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
40470
41841
  else compacted.proof["@context"] = docContext;
@@ -40631,13 +42002,21 @@ var Invite = class Invite extends Offer {
40631
42002
  documentLoader: options.contextLoader,
40632
42003
  keepFreeFloatingNodes: true
40633
42004
  });
40634
- const docContext = options.context ?? [
42005
+ let docContext = options.context ?? [
40635
42006
  "https://w3id.org/identity/v1",
40636
42007
  "https://www.w3.org/ns/activitystreams",
40637
42008
  "https://w3id.org/security/data-integrity/v1",
40638
42009
  "https://gotosocial.org/ns"
40639
42010
  ];
40640
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
42011
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
42012
+ if (options.context == null) {
42013
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
42014
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
42015
+ if (additionalContexts.length > 0) {
42016
+ docContext = [...currentContexts, ...additionalContexts];
42017
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
42018
+ }
42019
+ }
40641
42020
  if (docContext != null) {
40642
42021
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
40643
42022
  else compacted.proof["@context"] = docContext;
@@ -40803,13 +42182,21 @@ var Join = class Join extends Activity {
40803
42182
  documentLoader: options.contextLoader,
40804
42183
  keepFreeFloatingNodes: true
40805
42184
  });
40806
- const docContext = options.context ?? [
42185
+ let docContext = options.context ?? [
40807
42186
  "https://w3id.org/identity/v1",
40808
42187
  "https://www.w3.org/ns/activitystreams",
40809
42188
  "https://w3id.org/security/data-integrity/v1",
40810
42189
  "https://gotosocial.org/ns"
40811
42190
  ];
40812
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
42191
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
42192
+ if (options.context == null) {
42193
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
42194
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
42195
+ if (additionalContexts.length > 0) {
42196
+ docContext = [...currentContexts, ...additionalContexts];
42197
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
42198
+ }
42199
+ }
40813
42200
  if (docContext != null) {
40814
42201
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
40815
42202
  else compacted.proof["@context"] = docContext;
@@ -40975,13 +42362,21 @@ var Leave = class Leave extends Activity {
40975
42362
  documentLoader: options.contextLoader,
40976
42363
  keepFreeFloatingNodes: true
40977
42364
  });
40978
- const docContext = options.context ?? [
42365
+ let docContext = options.context ?? [
40979
42366
  "https://w3id.org/identity/v1",
40980
42367
  "https://www.w3.org/ns/activitystreams",
40981
42368
  "https://w3id.org/security/data-integrity/v1",
40982
42369
  "https://gotosocial.org/ns"
40983
42370
  ];
40984
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
42371
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
42372
+ if (options.context == null) {
42373
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
42374
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
42375
+ if (additionalContexts.length > 0) {
42376
+ docContext = [...currentContexts, ...additionalContexts];
42377
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
42378
+ }
42379
+ }
40985
42380
  if (docContext != null) {
40986
42381
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
40987
42382
  else compacted.proof["@context"] = docContext;
@@ -41147,7 +42542,7 @@ var Like = class Like extends Activity {
41147
42542
  documentLoader: options.contextLoader,
41148
42543
  keepFreeFloatingNodes: true
41149
42544
  });
41150
- const docContext = options.context ?? [
42545
+ let docContext = options.context ?? [
41151
42546
  "https://w3id.org/identity/v1",
41152
42547
  "https://www.w3.org/ns/activitystreams",
41153
42548
  "https://w3id.org/security/data-integrity/v1",
@@ -41157,7 +42552,15 @@ var Like = class Like extends Activity {
41157
42552
  "Emoji": "toot:Emoji"
41158
42553
  }
41159
42554
  ];
41160
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
42555
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
42556
+ if (options.context == null) {
42557
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
42558
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
42559
+ if (additionalContexts.length > 0) {
42560
+ docContext = [...currentContexts, ...additionalContexts];
42561
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
42562
+ }
42563
+ }
41161
42564
  if (docContext != null) {
41162
42565
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
41163
42566
  else compacted.proof["@context"] = docContext;
@@ -41322,13 +42725,21 @@ var Listen = class Listen extends Activity {
41322
42725
  documentLoader: options.contextLoader,
41323
42726
  keepFreeFloatingNodes: true
41324
42727
  });
41325
- const docContext = options.context ?? [
42728
+ let docContext = options.context ?? [
41326
42729
  "https://w3id.org/identity/v1",
41327
42730
  "https://www.w3.org/ns/activitystreams",
41328
42731
  "https://w3id.org/security/data-integrity/v1",
41329
42732
  "https://gotosocial.org/ns"
41330
42733
  ];
41331
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
42734
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
42735
+ if (options.context == null) {
42736
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
42737
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
42738
+ if (additionalContexts.length > 0) {
42739
+ docContext = [...currentContexts, ...additionalContexts];
42740
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
42741
+ }
42742
+ }
41332
42743
  if (docContext != null) {
41333
42744
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
41334
42745
  else compacted.proof["@context"] = docContext;
@@ -41504,8 +42915,16 @@ var Mention = class Mention extends Link {
41504
42915
  documentLoader: options.contextLoader,
41505
42916
  keepFreeFloatingNodes: true
41506
42917
  });
41507
- const docContext = options.context ?? "https://www.w3.org/ns/activitystreams";
41508
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
42918
+ let docContext = options.context ?? "https://www.w3.org/ns/activitystreams";
42919
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
42920
+ if (options.context == null) {
42921
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
42922
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
42923
+ if (additionalContexts.length > 0) {
42924
+ docContext = [...currentContexts, ...additionalContexts];
42925
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
42926
+ }
42927
+ }
41509
42928
  if (docContext != null) {}
41510
42929
  return compacted;
41511
42930
  }
@@ -41669,13 +43088,21 @@ var Move = class Move extends Activity {
41669
43088
  documentLoader: options.contextLoader,
41670
43089
  keepFreeFloatingNodes: true
41671
43090
  });
41672
- const docContext = options.context ?? [
43091
+ let docContext = options.context ?? [
41673
43092
  "https://w3id.org/identity/v1",
41674
43093
  "https://www.w3.org/ns/activitystreams",
41675
43094
  "https://w3id.org/security/data-integrity/v1",
41676
43095
  "https://gotosocial.org/ns"
41677
43096
  ];
41678
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
43097
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
43098
+ if (options.context == null) {
43099
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
43100
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
43101
+ if (additionalContexts.length > 0) {
43102
+ docContext = [...currentContexts, ...additionalContexts];
43103
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
43104
+ }
43105
+ }
41679
43106
  if (docContext != null) {
41680
43107
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
41681
43108
  else compacted.proof["@context"] = docContext;
@@ -42247,7 +43674,7 @@ var Note = class Note extends Object$1 {
42247
43674
  documentLoader: options.contextLoader,
42248
43675
  keepFreeFloatingNodes: true
42249
43676
  });
42250
- const docContext = options.context ?? [
43677
+ let docContext = options.context ?? [
42251
43678
  "https://www.w3.org/ns/activitystreams",
42252
43679
  "https://w3id.org/security/data-integrity/v1",
42253
43680
  "https://gotosocial.org/ns",
@@ -42276,7 +43703,15 @@ var Note = class Note extends Object$1 {
42276
43703
  }
42277
43704
  }
42278
43705
  ];
42279
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
43706
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
43707
+ if (options.context == null) {
43708
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
43709
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
43710
+ if (additionalContexts.length > 0) {
43711
+ docContext = [...currentContexts, ...additionalContexts];
43712
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
43713
+ }
43714
+ }
42280
43715
  if (docContext != null) {
42281
43716
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
42282
43717
  else compacted.proof["@context"] = docContext;
@@ -42768,7 +44203,7 @@ var OrderedCollectionPage = class OrderedCollectionPage extends CollectionPage {
42768
44203
  documentLoader: options.contextLoader,
42769
44204
  keepFreeFloatingNodes: true
42770
44205
  });
42771
- const docContext = options.context ?? [
44206
+ let docContext = options.context ?? [
42772
44207
  "https://www.w3.org/ns/activitystreams",
42773
44208
  "https://w3id.org/security/data-integrity/v1",
42774
44209
  "https://gotosocial.org/ns",
@@ -42800,7 +44235,15 @@ var OrderedCollectionPage = class OrderedCollectionPage extends CollectionPage {
42800
44235
  }
42801
44236
  }
42802
44237
  ];
42803
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
44238
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
44239
+ if (options.context == null) {
44240
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
44241
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
44242
+ if (additionalContexts.length > 0) {
44243
+ docContext = [...currentContexts, ...additionalContexts];
44244
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
44245
+ }
44246
+ }
42804
44247
  if (docContext != null) {
42805
44248
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
42806
44249
  else compacted.proof["@context"] = docContext;
@@ -46159,7 +47602,7 @@ var Organization = class Organization extends Object$1 {
46159
47602
  documentLoader: options.contextLoader,
46160
47603
  keepFreeFloatingNodes: true
46161
47604
  });
46162
- const docContext = options.context ?? [
47605
+ let docContext = options.context ?? [
46163
47606
  "https://www.w3.org/ns/activitystreams",
46164
47607
  "https://w3id.org/fep/ef61",
46165
47608
  "https://w3id.org/security/v1",
@@ -46204,7 +47647,15 @@ var Organization = class Organization extends Object$1 {
46204
47647
  "isCat": "misskey:isCat"
46205
47648
  }
46206
47649
  ];
46207
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
47650
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
47651
+ if (options.context == null) {
47652
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
47653
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
47654
+ if (additionalContexts.length > 0) {
47655
+ docContext = [...currentContexts, ...additionalContexts];
47656
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
47657
+ }
47658
+ }
46208
47659
  if (docContext != null) {
46209
47660
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
46210
47661
  else compacted.proof["@context"] = docContext;
@@ -46971,13 +48422,21 @@ var Page = class Page extends Document {
46971
48422
  documentLoader: options.contextLoader,
46972
48423
  keepFreeFloatingNodes: true
46973
48424
  });
46974
- const docContext = options.context ?? [
48425
+ let docContext = options.context ?? [
46975
48426
  "https://www.w3.org/ns/activitystreams",
46976
48427
  "https://w3id.org/security/data-integrity/v2",
46977
48428
  { "digestMultibase": "https://www.w3.org/ns/credentials/v2#digestMultibase" },
46978
48429
  "https://gotosocial.org/ns"
46979
48430
  ];
46980
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
48431
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
48432
+ if (options.context == null) {
48433
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
48434
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
48435
+ if (additionalContexts.length > 0) {
48436
+ docContext = [...currentContexts, ...additionalContexts];
48437
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
48438
+ }
48439
+ }
46981
48440
  if (docContext != null) {
46982
48441
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
46983
48442
  else compacted.proof["@context"] = docContext;
@@ -50214,7 +51673,7 @@ var Person = class Person extends Object$1 {
50214
51673
  documentLoader: options.contextLoader,
50215
51674
  keepFreeFloatingNodes: true
50216
51675
  });
50217
- const docContext = options.context ?? [
51676
+ let docContext = options.context ?? [
50218
51677
  "https://www.w3.org/ns/activitystreams",
50219
51678
  "https://w3id.org/fep/ef61",
50220
51679
  "https://w3id.org/security/v1",
@@ -50259,7 +51718,15 @@ var Person = class Person extends Object$1 {
50259
51718
  "isCat": "misskey:isCat"
50260
51719
  }
50261
51720
  ];
50262
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
51721
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
51722
+ if (options.context == null) {
51723
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
51724
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
51725
+ if (additionalContexts.length > 0) {
51726
+ docContext = [...currentContexts, ...additionalContexts];
51727
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
51728
+ }
51729
+ }
50263
51730
  if (docContext != null) {
50264
51731
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
50265
51732
  else compacted.proof["@context"] = docContext;
@@ -51232,12 +52699,20 @@ var Place = class Place extends Object$1 {
51232
52699
  documentLoader: options.contextLoader,
51233
52700
  keepFreeFloatingNodes: true
51234
52701
  });
51235
- const docContext = options.context ?? [
52702
+ let docContext = options.context ?? [
51236
52703
  "https://www.w3.org/ns/activitystreams",
51237
52704
  "https://w3id.org/security/data-integrity/v1",
51238
52705
  "https://gotosocial.org/ns"
51239
52706
  ];
51240
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
52707
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
52708
+ if (options.context == null) {
52709
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
52710
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
52711
+ if (additionalContexts.length > 0) {
52712
+ docContext = [...currentContexts, ...additionalContexts];
52713
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
52714
+ }
52715
+ }
51241
52716
  if (docContext != null) {
51242
52717
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
51243
52718
  else compacted.proof["@context"] = docContext;
@@ -51690,12 +53165,20 @@ var Profile = class Profile extends Object$1 {
51690
53165
  documentLoader: options.contextLoader,
51691
53166
  keepFreeFloatingNodes: true
51692
53167
  });
51693
- const docContext = options.context ?? [
53168
+ let docContext = options.context ?? [
51694
53169
  "https://www.w3.org/ns/activitystreams",
51695
53170
  "https://w3id.org/security/data-integrity/v1",
51696
53171
  "https://gotosocial.org/ns"
51697
53172
  ];
51698
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
53173
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
53174
+ if (options.context == null) {
53175
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
53176
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
53177
+ if (additionalContexts.length > 0) {
53178
+ docContext = [...currentContexts, ...additionalContexts];
53179
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
53180
+ }
53181
+ }
51699
53182
  if (docContext != null) {
51700
53183
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
51701
53184
  else compacted.proof["@context"] = docContext;
@@ -52587,7 +54070,7 @@ var Question = class Question extends IntransitiveActivity {
52587
54070
  documentLoader: options.contextLoader,
52588
54071
  keepFreeFloatingNodes: true
52589
54072
  });
52590
- const docContext = options.context ?? [
54073
+ let docContext = options.context ?? [
52591
54074
  "https://w3id.org/identity/v1",
52592
54075
  "https://www.w3.org/ns/activitystreams",
52593
54076
  "https://w3id.org/security/data-integrity/v1",
@@ -52621,7 +54104,15 @@ var Question = class Question extends IntransitiveActivity {
52621
54104
  }
52622
54105
  }
52623
54106
  ];
52624
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
54107
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
54108
+ if (options.context == null) {
54109
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
54110
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
54111
+ if (additionalContexts.length > 0) {
54112
+ docContext = [...currentContexts, ...additionalContexts];
54113
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
54114
+ }
54115
+ }
52625
54116
  if (docContext != null) {
52626
54117
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
52627
54118
  else compacted.proof["@context"] = docContext;
@@ -52947,13 +54438,21 @@ var Read = class Read extends Activity {
52947
54438
  documentLoader: options.contextLoader,
52948
54439
  keepFreeFloatingNodes: true
52949
54440
  });
52950
- const docContext = options.context ?? [
54441
+ let docContext = options.context ?? [
52951
54442
  "https://w3id.org/identity/v1",
52952
54443
  "https://www.w3.org/ns/activitystreams",
52953
54444
  "https://w3id.org/security/data-integrity/v1",
52954
54445
  "https://gotosocial.org/ns"
52955
54446
  ];
52956
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
54447
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
54448
+ if (options.context == null) {
54449
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
54450
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
54451
+ if (additionalContexts.length > 0) {
54452
+ docContext = [...currentContexts, ...additionalContexts];
54453
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
54454
+ }
54455
+ }
52957
54456
  if (docContext != null) {
52958
54457
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
52959
54458
  else compacted.proof["@context"] = docContext;
@@ -53119,13 +54618,21 @@ var Reject = class Reject extends Activity {
53119
54618
  documentLoader: options.contextLoader,
53120
54619
  keepFreeFloatingNodes: true
53121
54620
  });
53122
- const docContext = options.context ?? [
54621
+ let docContext = options.context ?? [
53123
54622
  "https://w3id.org/identity/v1",
53124
54623
  "https://www.w3.org/ns/activitystreams",
53125
54624
  "https://w3id.org/security/data-integrity/v1",
53126
54625
  "https://gotosocial.org/ns"
53127
54626
  ];
53128
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
54627
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
54628
+ if (options.context == null) {
54629
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
54630
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
54631
+ if (additionalContexts.length > 0) {
54632
+ docContext = [...currentContexts, ...additionalContexts];
54633
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
54634
+ }
54635
+ }
53129
54636
  if (docContext != null) {
53130
54637
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
53131
54638
  else compacted.proof["@context"] = docContext;
@@ -53912,12 +55419,20 @@ var Relationship = class Relationship extends Object$1 {
53912
55419
  documentLoader: options.contextLoader,
53913
55420
  keepFreeFloatingNodes: true
53914
55421
  });
53915
- const docContext = options.context ?? [
55422
+ let docContext = options.context ?? [
53916
55423
  "https://www.w3.org/ns/activitystreams",
53917
55424
  "https://w3id.org/security/data-integrity/v1",
53918
55425
  "https://gotosocial.org/ns"
53919
55426
  ];
53920
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
55427
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
55428
+ if (options.context == null) {
55429
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
55430
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
55431
+ if (additionalContexts.length > 0) {
55432
+ docContext = [...currentContexts, ...additionalContexts];
55433
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
55434
+ }
55435
+ }
53921
55436
  if (docContext != null) {
53922
55437
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
53923
55438
  else compacted.proof["@context"] = docContext;
@@ -54164,13 +55679,21 @@ var Remove = class Remove extends Activity {
54164
55679
  documentLoader: options.contextLoader,
54165
55680
  keepFreeFloatingNodes: true
54166
55681
  });
54167
- const docContext = options.context ?? [
55682
+ let docContext = options.context ?? [
54168
55683
  "https://w3id.org/identity/v1",
54169
55684
  "https://www.w3.org/ns/activitystreams",
54170
55685
  "https://w3id.org/security/data-integrity/v1",
54171
55686
  "https://gotosocial.org/ns"
54172
55687
  ];
54173
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
55688
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
55689
+ if (options.context == null) {
55690
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
55691
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
55692
+ if (additionalContexts.length > 0) {
55693
+ docContext = [...currentContexts, ...additionalContexts];
55694
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
55695
+ }
55696
+ }
54174
55697
  if (docContext != null) {
54175
55698
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
54176
55699
  else compacted.proof["@context"] = docContext;
@@ -57407,7 +58930,7 @@ var Service = class Service extends Object$1 {
57407
58930
  documentLoader: options.contextLoader,
57408
58931
  keepFreeFloatingNodes: true
57409
58932
  });
57410
- const docContext = options.context ?? [
58933
+ let docContext = options.context ?? [
57411
58934
  "https://www.w3.org/ns/activitystreams",
57412
58935
  "https://w3id.org/fep/ef61",
57413
58936
  "https://w3id.org/security/v1",
@@ -57452,7 +58975,15 @@ var Service = class Service extends Object$1 {
57452
58975
  "isCat": "misskey:isCat"
57453
58976
  }
57454
58977
  ];
57455
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
58978
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
58979
+ if (options.context == null) {
58980
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
58981
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
58982
+ if (additionalContexts.length > 0) {
58983
+ docContext = [...currentContexts, ...additionalContexts];
58984
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
58985
+ }
58986
+ }
57456
58987
  if (docContext != null) {
57457
58988
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
57458
58989
  else compacted.proof["@context"] = docContext;
@@ -58334,8 +59865,16 @@ var Source = class {
58334
59865
  documentLoader: options.contextLoader,
58335
59866
  keepFreeFloatingNodes: true
58336
59867
  });
58337
- const docContext = options.context ?? "https://www.w3.org/ns/activitystreams";
58338
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
59868
+ let docContext = options.context ?? "https://www.w3.org/ns/activitystreams";
59869
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
59870
+ if (options.context == null) {
59871
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
59872
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
59873
+ if (additionalContexts.length > 0) {
59874
+ docContext = [...currentContexts, ...additionalContexts];
59875
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
59876
+ }
59877
+ }
58339
59878
  if (docContext != null) {}
58340
59879
  return compacted;
58341
59880
  }
@@ -58535,13 +60074,21 @@ var TentativeAccept = class TentativeAccept extends Accept {
58535
60074
  documentLoader: options.contextLoader,
58536
60075
  keepFreeFloatingNodes: true
58537
60076
  });
58538
- const docContext = options.context ?? [
60077
+ let docContext = options.context ?? [
58539
60078
  "https://w3id.org/identity/v1",
58540
60079
  "https://www.w3.org/ns/activitystreams",
58541
60080
  "https://w3id.org/security/data-integrity/v1",
58542
60081
  "https://gotosocial.org/ns"
58543
60082
  ];
58544
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
60083
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
60084
+ if (options.context == null) {
60085
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
60086
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
60087
+ if (additionalContexts.length > 0) {
60088
+ docContext = [...currentContexts, ...additionalContexts];
60089
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
60090
+ }
60091
+ }
58545
60092
  if (docContext != null) {
58546
60093
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
58547
60094
  else compacted.proof["@context"] = docContext;
@@ -58707,13 +60254,21 @@ var TentativeReject = class TentativeReject extends Reject {
58707
60254
  documentLoader: options.contextLoader,
58708
60255
  keepFreeFloatingNodes: true
58709
60256
  });
58710
- const docContext = options.context ?? [
60257
+ let docContext = options.context ?? [
58711
60258
  "https://w3id.org/identity/v1",
58712
60259
  "https://www.w3.org/ns/activitystreams",
58713
60260
  "https://w3id.org/security/data-integrity/v1",
58714
60261
  "https://gotosocial.org/ns"
58715
60262
  ];
58716
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
60263
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
60264
+ if (options.context == null) {
60265
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
60266
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
60267
+ if (additionalContexts.length > 0) {
60268
+ docContext = [...currentContexts, ...additionalContexts];
60269
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
60270
+ }
60271
+ }
58717
60272
  if (docContext != null) {
58718
60273
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
58719
60274
  else compacted.proof["@context"] = docContext;
@@ -58978,12 +60533,20 @@ var Tombstone = class Tombstone extends Object$1 {
58978
60533
  documentLoader: options.contextLoader,
58979
60534
  keepFreeFloatingNodes: true
58980
60535
  });
58981
- const docContext = options.context ?? [
60536
+ let docContext = options.context ?? [
58982
60537
  "https://www.w3.org/ns/activitystreams",
58983
60538
  "https://w3id.org/security/data-integrity/v1",
58984
60539
  "https://gotosocial.org/ns"
58985
60540
  ];
58986
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
60541
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
60542
+ if (options.context == null) {
60543
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
60544
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
60545
+ if (additionalContexts.length > 0) {
60546
+ docContext = [...currentContexts, ...additionalContexts];
60547
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
60548
+ }
60549
+ }
58987
60550
  if (docContext != null) {
58988
60551
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
58989
60552
  else compacted.proof["@context"] = docContext;
@@ -59195,13 +60758,21 @@ var Travel = class Travel extends IntransitiveActivity {
59195
60758
  documentLoader: options.contextLoader,
59196
60759
  keepFreeFloatingNodes: true
59197
60760
  });
59198
- const docContext = options.context ?? [
60761
+ let docContext = options.context ?? [
59199
60762
  "https://w3id.org/identity/v1",
59200
60763
  "https://www.w3.org/ns/activitystreams",
59201
60764
  "https://w3id.org/security/data-integrity/v1",
59202
60765
  "https://gotosocial.org/ns"
59203
60766
  ];
59204
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
60767
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
60768
+ if (options.context == null) {
60769
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
60770
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
60771
+ if (additionalContexts.length > 0) {
60772
+ docContext = [...currentContexts, ...additionalContexts];
60773
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
60774
+ }
60775
+ }
59205
60776
  if (docContext != null) {
59206
60777
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
59207
60778
  else compacted.proof["@context"] = docContext;
@@ -59372,7 +60943,7 @@ var Undo = class Undo extends Activity {
59372
60943
  documentLoader: options.contextLoader,
59373
60944
  keepFreeFloatingNodes: true
59374
60945
  });
59375
- const docContext = options.context ?? [
60946
+ let docContext = options.context ?? [
59376
60947
  "https://w3id.org/identity/v1",
59377
60948
  "https://www.w3.org/ns/activitystreams",
59378
60949
  "https://w3id.org/security/v1",
@@ -59387,7 +60958,15 @@ var Undo = class Undo extends Activity {
59387
60958
  "Emoji": "toot:Emoji"
59388
60959
  }
59389
60960
  ];
59390
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
60961
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
60962
+ if (options.context == null) {
60963
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
60964
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
60965
+ if (additionalContexts.length > 0) {
60966
+ docContext = [...currentContexts, ...additionalContexts];
60967
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
60968
+ }
60969
+ }
59391
60970
  if (docContext != null) {
59392
60971
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
59393
60972
  else compacted.proof["@context"] = docContext;
@@ -59556,7 +61135,7 @@ var Update = class Update extends Activity {
59556
61135
  documentLoader: options.contextLoader,
59557
61136
  keepFreeFloatingNodes: true
59558
61137
  });
59559
- const docContext = options.context ?? [
61138
+ let docContext = options.context ?? [
59560
61139
  "https://w3id.org/identity/v1",
59561
61140
  "https://www.w3.org/ns/activitystreams",
59562
61141
  "https://w3id.org/security/v1",
@@ -59621,7 +61200,15 @@ var Update = class Update extends Activity {
59621
61200
  }
59622
61201
  }
59623
61202
  ];
59624
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
61203
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
61204
+ if (options.context == null) {
61205
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
61206
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
61207
+ if (additionalContexts.length > 0) {
61208
+ docContext = [...currentContexts, ...additionalContexts];
61209
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
61210
+ }
61211
+ }
59625
61212
  if (docContext != null) {
59626
61213
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
59627
61214
  else compacted.proof["@context"] = docContext;
@@ -59802,13 +61389,21 @@ var Video = class Video extends Document {
59802
61389
  documentLoader: options.contextLoader,
59803
61390
  keepFreeFloatingNodes: true
59804
61391
  });
59805
- const docContext = options.context ?? [
61392
+ let docContext = options.context ?? [
59806
61393
  "https://www.w3.org/ns/activitystreams",
59807
61394
  "https://w3id.org/security/data-integrity/v2",
59808
61395
  { "digestMultibase": "https://www.w3.org/ns/credentials/v2#digestMultibase" },
59809
61396
  "https://gotosocial.org/ns"
59810
61397
  ];
59811
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
61398
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
61399
+ if (options.context == null) {
61400
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
61401
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
61402
+ if (additionalContexts.length > 0) {
61403
+ docContext = [...currentContexts, ...additionalContexts];
61404
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
61405
+ }
61406
+ }
59812
61407
  if (docContext != null) {
59813
61408
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
59814
61409
  else compacted.proof["@context"] = docContext;
@@ -59973,13 +61568,21 @@ var View = class View extends Activity {
59973
61568
  documentLoader: options.contextLoader,
59974
61569
  keepFreeFloatingNodes: true
59975
61570
  });
59976
- const docContext = options.context ?? [
61571
+ let docContext = options.context ?? [
59977
61572
  "https://w3id.org/identity/v1",
59978
61573
  "https://www.w3.org/ns/activitystreams",
59979
61574
  "https://w3id.org/security/data-integrity/v1",
59980
61575
  "https://gotosocial.org/ns"
59981
61576
  ];
59982
- const compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
61577
+ let compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
61578
+ if (options.context == null) {
61579
+ const currentContexts = Array.isArray(docContext) ? docContext : [docContext];
61580
+ const additionalContexts = getExtraContexts(compacted).filter((context) => !currentContexts.includes(context));
61581
+ if (additionalContexts.length > 0) {
61582
+ docContext = [...currentContexts, ...additionalContexts];
61583
+ compacted = await _fedify_vocab_runtime_jsonld.default.compact(values, docContext, { documentLoader: options.contextLoader });
61584
+ }
61585
+ }
59983
61586
  if (docContext != null) {
59984
61587
  if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
59985
61588
  else compacted.proof["@context"] = docContext;
@@ -60816,6 +62419,7 @@ exports.Source = Source;
60816
62419
  exports.TentativeAccept = TentativeAccept;
60817
62420
  exports.TentativeReject = TentativeReject;
60818
62421
  exports.Tombstone = Tombstone;
62422
+ exports.Translation = Translation;
60819
62423
  exports.Travel = Travel;
60820
62424
  exports.Undo = Undo;
60821
62425
  exports.Update = Update;