From 89c78d3dbff3a3b05537c153d55498d9619f49e4 Mon Sep 17 00:00:00 2001 From: Hong Minhee Date: Sun, 3 Mar 2024 20:38:12 +0900 Subject: [PATCH] More tests --- .gitignore | 1 + codegen/__snapshots__/class.test.ts.snap | 17499 +++++++++++++++++++++ codegen/class.test.ts | 16 +- codegen/codec.ts | 19 +- codegen/constructor.ts | 12 + codegen/type.ts | 13 +- deno.json | 4 +- runtime/docloader.test.ts | 86 + runtime/docloader.ts | 2 +- testing/fixtures/example.com/wrong-type | 3 + vocab/__snapshots__/vocab.test.ts.snap | 6592 ++++++++ vocab/actor.test.ts | 88 + vocab/actor.ts | 2 +- vocab/key.yaml | 3 +- vocab/like.yaml | 1 + vocab/mod.test.ts | 348 - vocab/vocab.test.ts | 749 + 17 files changed, 25075 insertions(+), 363 deletions(-) create mode 100644 codegen/__snapshots__/class.test.ts.snap create mode 100644 runtime/docloader.test.ts create mode 100644 testing/fixtures/example.com/wrong-type create mode 100644 vocab/__snapshots__/vocab.test.ts.snap create mode 100644 vocab/actor.test.ts delete mode 100644 vocab/mod.test.ts create mode 100644 vocab/vocab.test.ts diff --git a/.gitignore b/.gitignore index 276cdd6..3a53e82 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ .cov.lcov .DS_Store .test-report.xml +coverage/ deno.lock docs/*.css docs/*.html diff --git a/codegen/__snapshots__/class.test.ts.snap b/codegen/__snapshots__/class.test.ts.snap new file mode 100644 index 0000000..c28bb9a --- /dev/null +++ b/codegen/__snapshots__/class.test.ts.snap @@ -0,0 +1,17499 @@ +export const snapshot = {}; + +snapshot[`generateClasses() 1`] = ` +"// deno-lint-ignore-file ban-unused-ignore +import jsonld from \\"npm:jsonld@8.3.2\\";import { LanguageTag, parseLanguageTag } + from \\"npm:@phensley/language-tag@1.8.0\\"; +import { exportSPKI, importSPKI } from \\"npm:jose@5.2.2\\"; +import { DocumentLoader, fetchDocumentLoader } + from \\"/Users/dahlia/Library/CloudStorage/OneDrive-Personal/Projects/fedikit/runtime/docloader.ts\\"; +import { LanguageString } from \\"/Users/dahlia/Library/CloudStorage/OneDrive-Personal/Projects/fedikit/runtime/langstr.ts\\"; + + +/** Describes an object of any kind. The Object type serves as the base type for + * most of the other kinds of objects defined in the Activity Vocabulary, + * including other Core types such as {@link Activity}, + * {@link IntransitiveActivity}, {@link Collection} and + * {@link OrderedCollection}. + * + */ +export class Object { +readonly id: URL | null; +#_49BipA5dq9eoH8LX8xdsVumveTca: (Object | Link | URL)[] = []; +#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py: (Object | URL)[] = []; +#_3ocC3VVi88cEd5sPWL8djkZsvTN6: (Object | URL)[] = []; +#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz: (string | LanguageString)[] = []; +#_3mhZzGXSpQ431mBSz2kvych22v4e: (Object | Link | URL)[] = []; +#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav: (string | LanguageString)[] = []; +#_219RwDanjScTv5tYCjwGZVCM7KZ9: Temporal.Instant[] = []; +#_86xFhmgBapoMvYqjbjRuDPayTrS: (Object | Link | URL)[] = []; +#_33CjRLy5ujtsUrwRSCrsggvGdKuR: (Image | Link | URL)[] = []; +#_3dXrUdkARxwyJLtJcYi1AJ92H41U: (Image | Link | URL)[] = []; +#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s: (Object | Link | URL)[] = []; +#_31k5MUZJsnsPNg8dQQJieWaXTFnR: (Object | Link | URL)[] = []; +#_gCVTegXxWWCw6wWRxa1QF65zusg: (Link | Object | URL)[] = []; +#_5e258TDXtuhaFRPZiGoDfEpjdMr: Temporal.Instant[] = []; +#_7UpwM3JWcXhADcscukEehBorf6k: (Collection | URL)[] = []; +#_2w3Jmue4up8iVDUA51WZqomEF438: Temporal.Instant[] = []; +#_4LqirZspQbFWWQEbFcXAxm7tTDN1: (string | LanguageString)[] = []; +#_5chuqj6s95p5gg2sk1HntGfarRf: (Object | Link | URL)[] = []; +#_385aB7ySixcf5Un6z3VsWmThgCzQ: Temporal.Instant[] = []; +#_2oPEH9MQ3aj8JVwyYuWkqoVwV865: (URL | Link)[] = []; +#_3hFbw7DTpHhq3cvVhkY8njhcsXbd: (Object | URL)[] = []; +#_aLZupjwL8XB7tzdLgCMXdjZ6qej: (Object | URL)[] = []; +#_42a1SvBs24QSLzKcfjCyNTjW5a1g: (Object | URL)[] = []; +#_3qvegKUB8YLgTXRpEf8E6JZSkz2H: (Object | URL)[] = []; +#_3BLrzmscsjHCw8TF5BHRW9WkPnX8: string[] = []; +#_3bNvLMBN1bCJETiTihM3wvi1B2JX: Temporal.Duration[] = []; + + /** + * Constructs a new instance of Object with the given values. + * @param values The values to initialize the instance with. + */ + constructor(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;} +) { +this.id = values.id ?? null; + if (\\"attachments\\" in values && values.attachments != null) { + + this.#_49BipA5dq9eoH8LX8xdsVumveTca = values.attachments; + } + + if (\\"attributedTo\\" in values && values.attributedTo != null) { + this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py = [values.attributedTo]; + } + + if (\\"attributedTos\\" in values && values.attributedTos != null) { + + if (\\"attributedTo\\" in values && + values.attributedTo != null) { + throw new TypeError( + \\"Cannot initialize both attributedTo and \\" + + \\"attributedTos at the same time.\\", + ); + } + + this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py = values.attributedTos; + } + + if (\\"audience\\" in values && values.audience != null) { + this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6 = [values.audience]; + } + + if (\\"audiences\\" in values && values.audiences != null) { + + if (\\"audience\\" in values && + values.audience != null) { + throw new TypeError( + \\"Cannot initialize both audience and \\" + + \\"audiences at the same time.\\", + ); + } + + this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6 = values.audiences; + } + + if (\\"content\\" in values && values.content != null) { + this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz = [values.content]; + } + + if (\\"contents\\" in values && values.contents != null) { + + if (\\"content\\" in values && + values.content != null) { + throw new TypeError( + \\"Cannot initialize both content and \\" + + \\"contents at the same time.\\", + ); + } + + this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz = values.contents; + } + + if (\\"contexts\\" in values && values.contexts != null) { + + this.#_3mhZzGXSpQ431mBSz2kvych22v4e = values.contexts; + } + + if (\\"name\\" in values && values.name != null) { + this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav = [values.name]; + } + + if (\\"names\\" in values && values.names != null) { + + if (\\"name\\" in values && + values.name != null) { + throw new TypeError( + \\"Cannot initialize both name and \\" + + \\"names at the same time.\\", + ); + } + + this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav = values.names; + } + + if (\\"endTime\\" in values && values.endTime != null) { + this.#_219RwDanjScTv5tYCjwGZVCM7KZ9 = [values.endTime]; + } + + if (\\"generators\\" in values && values.generators != null) { + + this.#_86xFhmgBapoMvYqjbjRuDPayTrS = values.generators; + } + + if (\\"icons\\" in values && values.icons != null) { + + this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR = values.icons; + } + + if (\\"images\\" in values && values.images != null) { + + this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U = values.images; + } + + if (\\"replyTarget\\" in values && values.replyTarget != null) { + this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s = [values.replyTarget]; + } + + if (\\"replyTargets\\" in values && values.replyTargets != null) { + + if (\\"replyTarget\\" in values && + values.replyTarget != null) { + throw new TypeError( + \\"Cannot initialize both replyTarget and \\" + + \\"replyTargets at the same time.\\", + ); + } + + this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s = values.replyTargets; + } + + if (\\"location\\" in values && values.location != null) { + this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR = [values.location]; + } + + if (\\"locations\\" in values && values.locations != null) { + + if (\\"location\\" in values && + values.location != null) { + throw new TypeError( + \\"Cannot initialize both location and \\" + + \\"locations at the same time.\\", + ); + } + + this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR = values.locations; + } + + if (\\"preview\\" in values && values.preview != null) { + this.#_gCVTegXxWWCw6wWRxa1QF65zusg = [values.preview]; + } + + if (\\"previews\\" in values && values.previews != null) { + + if (\\"preview\\" in values && + values.preview != null) { + throw new TypeError( + \\"Cannot initialize both preview and \\" + + \\"previews at the same time.\\", + ); + } + + this.#_gCVTegXxWWCw6wWRxa1QF65zusg = values.previews; + } + + if (\\"published\\" in values && values.published != null) { + this.#_5e258TDXtuhaFRPZiGoDfEpjdMr = [values.published]; + } + + if (\\"replies\\" in values && values.replies != null) { + this.#_7UpwM3JWcXhADcscukEehBorf6k = [values.replies]; + } + + if (\\"startTime\\" in values && values.startTime != null) { + this.#_2w3Jmue4up8iVDUA51WZqomEF438 = [values.startTime]; + } + + if (\\"summary\\" in values && values.summary != null) { + this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1 = [values.summary]; + } + + if (\\"summaries\\" in values && values.summaries != null) { + + if (\\"summary\\" in values && + values.summary != null) { + throw new TypeError( + \\"Cannot initialize both summary and \\" + + \\"summaries at the same time.\\", + ); + } + + this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1 = values.summaries; + } + + if (\\"tags\\" in values && values.tags != null) { + + this.#_5chuqj6s95p5gg2sk1HntGfarRf = values.tags; + } + + if (\\"updated\\" in values && values.updated != null) { + this.#_385aB7ySixcf5Un6z3VsWmThgCzQ = [values.updated]; + } + + if (\\"url\\" in values && values.url != null) { + this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865 = [values.url]; + } + + if (\\"urls\\" in values && values.urls != null) { + + if (\\"url\\" in values && + values.url != null) { + throw new TypeError( + \\"Cannot initialize both url and \\" + + \\"urls at the same time.\\", + ); + } + + this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865 = values.urls; + } + + if (\\"to\\" in values && values.to != null) { + this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd = [values.to]; + } + + if (\\"tos\\" in values && values.tos != null) { + + if (\\"to\\" in values && + values.to != null) { + throw new TypeError( + \\"Cannot initialize both to and \\" + + \\"tos at the same time.\\", + ); + } + + this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd = values.tos; + } + + if (\\"bto\\" in values && values.bto != null) { + this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej = [values.bto]; + } + + if (\\"btos\\" in values && values.btos != null) { + + if (\\"bto\\" in values && + values.bto != null) { + throw new TypeError( + \\"Cannot initialize both bto and \\" + + \\"btos at the same time.\\", + ); + } + + this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej = values.btos; + } + + if (\\"cc\\" in values && values.cc != null) { + this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g = [values.cc]; + } + + if (\\"ccs\\" in values && values.ccs != null) { + + if (\\"cc\\" in values && + values.cc != null) { + throw new TypeError( + \\"Cannot initialize both cc and \\" + + \\"ccs at the same time.\\", + ); + } + + this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g = values.ccs; + } + + if (\\"bcc\\" in values && values.bcc != null) { + this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H = [values.bcc]; + } + + if (\\"bccs\\" in values && values.bccs != null) { + + if (\\"bcc\\" in values && + values.bcc != null) { + throw new TypeError( + \\"Cannot initialize both bcc and \\" + + \\"bccs at the same time.\\", + ); + } + + this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H = values.bccs; + } + + if (\\"mediaType\\" in values && values.mediaType != null) { + this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8 = [values.mediaType]; + } + + if (\\"duration\\" in values && values.duration != null) { + this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX = [values.duration]; + } + } + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @returns The cloned instance. + */ + clone(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;} + = {}): Object { + + // @ts-ignore: this.constructor is not recognized as a constructor, but it is. + const clone: Object = new this.constructor({ id: values.id }); + clone.#_49BipA5dq9eoH8LX8xdsVumveTca = this.#_49BipA5dq9eoH8LX8xdsVumveTca; + if (\\"attachments\\" in values && values.attachments != null) { + + clone.#_49BipA5dq9eoH8LX8xdsVumveTca = values.attachments; + } + clone.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py = this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py; + if (\\"attributedTo\\" in values && values.attributedTo != null) { + clone.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py = [values.attributedTo]; + } + + if (\\"attributedTos\\" in values && values.attributedTos != null) { + + if (\\"attributedTo\\" in values && + values.attributedTo != null) { + throw new TypeError( + \\"Cannot update both attributedTo and \\" + + \\"attributedTos at the same time.\\", + ); + } + + clone.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py = values.attributedTos; + } + clone.#_3ocC3VVi88cEd5sPWL8djkZsvTN6 = this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6; + if (\\"audience\\" in values && values.audience != null) { + clone.#_3ocC3VVi88cEd5sPWL8djkZsvTN6 = [values.audience]; + } + + if (\\"audiences\\" in values && values.audiences != null) { + + if (\\"audience\\" in values && + values.audience != null) { + throw new TypeError( + \\"Cannot update both audience and \\" + + \\"audiences at the same time.\\", + ); + } + + clone.#_3ocC3VVi88cEd5sPWL8djkZsvTN6 = values.audiences; + } + clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz = this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz; + if (\\"content\\" in values && values.content != null) { + clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz = [values.content]; + } + + if (\\"contents\\" in values && values.contents != null) { + + if (\\"content\\" in values && + values.content != null) { + throw new TypeError( + \\"Cannot update both content and \\" + + \\"contents at the same time.\\", + ); + } + + clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz = values.contents; + } + clone.#_3mhZzGXSpQ431mBSz2kvych22v4e = this.#_3mhZzGXSpQ431mBSz2kvych22v4e; + if (\\"contexts\\" in values && values.contexts != null) { + + clone.#_3mhZzGXSpQ431mBSz2kvych22v4e = values.contexts; + } + clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav; + if (\\"name\\" in values && values.name != null) { + clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav = [values.name]; + } + + if (\\"names\\" in values && values.names != null) { + + if (\\"name\\" in values && + values.name != null) { + throw new TypeError( + \\"Cannot update both name and \\" + + \\"names at the same time.\\", + ); + } + + clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav = values.names; + } + clone.#_219RwDanjScTv5tYCjwGZVCM7KZ9 = this.#_219RwDanjScTv5tYCjwGZVCM7KZ9; + if (\\"endTime\\" in values && values.endTime != null) { + clone.#_219RwDanjScTv5tYCjwGZVCM7KZ9 = [values.endTime]; + } + clone.#_86xFhmgBapoMvYqjbjRuDPayTrS = this.#_86xFhmgBapoMvYqjbjRuDPayTrS; + if (\\"generators\\" in values && values.generators != null) { + + clone.#_86xFhmgBapoMvYqjbjRuDPayTrS = values.generators; + } + clone.#_33CjRLy5ujtsUrwRSCrsggvGdKuR = this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR; + if (\\"icons\\" in values && values.icons != null) { + + clone.#_33CjRLy5ujtsUrwRSCrsggvGdKuR = values.icons; + } + clone.#_3dXrUdkARxwyJLtJcYi1AJ92H41U = this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U; + if (\\"images\\" in values && values.images != null) { + + clone.#_3dXrUdkARxwyJLtJcYi1AJ92H41U = values.images; + } + clone.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s = this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s; + if (\\"replyTarget\\" in values && values.replyTarget != null) { + clone.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s = [values.replyTarget]; + } + + if (\\"replyTargets\\" in values && values.replyTargets != null) { + + if (\\"replyTarget\\" in values && + values.replyTarget != null) { + throw new TypeError( + \\"Cannot update both replyTarget and \\" + + \\"replyTargets at the same time.\\", + ); + } + + clone.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s = values.replyTargets; + } + clone.#_31k5MUZJsnsPNg8dQQJieWaXTFnR = this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR; + if (\\"location\\" in values && values.location != null) { + clone.#_31k5MUZJsnsPNg8dQQJieWaXTFnR = [values.location]; + } + + if (\\"locations\\" in values && values.locations != null) { + + if (\\"location\\" in values && + values.location != null) { + throw new TypeError( + \\"Cannot update both location and \\" + + \\"locations at the same time.\\", + ); + } + + clone.#_31k5MUZJsnsPNg8dQQJieWaXTFnR = values.locations; + } + clone.#_gCVTegXxWWCw6wWRxa1QF65zusg = this.#_gCVTegXxWWCw6wWRxa1QF65zusg; + if (\\"preview\\" in values && values.preview != null) { + clone.#_gCVTegXxWWCw6wWRxa1QF65zusg = [values.preview]; + } + + if (\\"previews\\" in values && values.previews != null) { + + if (\\"preview\\" in values && + values.preview != null) { + throw new TypeError( + \\"Cannot update both preview and \\" + + \\"previews at the same time.\\", + ); + } + + clone.#_gCVTegXxWWCw6wWRxa1QF65zusg = values.previews; + } + clone.#_5e258TDXtuhaFRPZiGoDfEpjdMr = this.#_5e258TDXtuhaFRPZiGoDfEpjdMr; + if (\\"published\\" in values && values.published != null) { + clone.#_5e258TDXtuhaFRPZiGoDfEpjdMr = [values.published]; + } + clone.#_7UpwM3JWcXhADcscukEehBorf6k = this.#_7UpwM3JWcXhADcscukEehBorf6k; + if (\\"replies\\" in values && values.replies != null) { + clone.#_7UpwM3JWcXhADcscukEehBorf6k = [values.replies]; + } + clone.#_2w3Jmue4up8iVDUA51WZqomEF438 = this.#_2w3Jmue4up8iVDUA51WZqomEF438; + if (\\"startTime\\" in values && values.startTime != null) { + clone.#_2w3Jmue4up8iVDUA51WZqomEF438 = [values.startTime]; + } + clone.#_4LqirZspQbFWWQEbFcXAxm7tTDN1 = this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1; + if (\\"summary\\" in values && values.summary != null) { + clone.#_4LqirZspQbFWWQEbFcXAxm7tTDN1 = [values.summary]; + } + + if (\\"summaries\\" in values && values.summaries != null) { + + if (\\"summary\\" in values && + values.summary != null) { + throw new TypeError( + \\"Cannot update both summary and \\" + + \\"summaries at the same time.\\", + ); + } + + clone.#_4LqirZspQbFWWQEbFcXAxm7tTDN1 = values.summaries; + } + clone.#_5chuqj6s95p5gg2sk1HntGfarRf = this.#_5chuqj6s95p5gg2sk1HntGfarRf; + if (\\"tags\\" in values && values.tags != null) { + + clone.#_5chuqj6s95p5gg2sk1HntGfarRf = values.tags; + } + clone.#_385aB7ySixcf5Un6z3VsWmThgCzQ = this.#_385aB7ySixcf5Un6z3VsWmThgCzQ; + if (\\"updated\\" in values && values.updated != null) { + clone.#_385aB7ySixcf5Un6z3VsWmThgCzQ = [values.updated]; + } + clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865 = this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865; + if (\\"url\\" in values && values.url != null) { + clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865 = [values.url]; + } + + if (\\"urls\\" in values && values.urls != null) { + + if (\\"url\\" in values && + values.url != null) { + throw new TypeError( + \\"Cannot update both url and \\" + + \\"urls at the same time.\\", + ); + } + + clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865 = values.urls; + } + clone.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd = this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd; + if (\\"to\\" in values && values.to != null) { + clone.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd = [values.to]; + } + + if (\\"tos\\" in values && values.tos != null) { + + if (\\"to\\" in values && + values.to != null) { + throw new TypeError( + \\"Cannot update both to and \\" + + \\"tos at the same time.\\", + ); + } + + clone.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd = values.tos; + } + clone.#_aLZupjwL8XB7tzdLgCMXdjZ6qej = this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej; + if (\\"bto\\" in values && values.bto != null) { + clone.#_aLZupjwL8XB7tzdLgCMXdjZ6qej = [values.bto]; + } + + if (\\"btos\\" in values && values.btos != null) { + + if (\\"bto\\" in values && + values.bto != null) { + throw new TypeError( + \\"Cannot update both bto and \\" + + \\"btos at the same time.\\", + ); + } + + clone.#_aLZupjwL8XB7tzdLgCMXdjZ6qej = values.btos; + } + clone.#_42a1SvBs24QSLzKcfjCyNTjW5a1g = this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g; + if (\\"cc\\" in values && values.cc != null) { + clone.#_42a1SvBs24QSLzKcfjCyNTjW5a1g = [values.cc]; + } + + if (\\"ccs\\" in values && values.ccs != null) { + + if (\\"cc\\" in values && + values.cc != null) { + throw new TypeError( + \\"Cannot update both cc and \\" + + \\"ccs at the same time.\\", + ); + } + + clone.#_42a1SvBs24QSLzKcfjCyNTjW5a1g = values.ccs; + } + clone.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H = this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H; + if (\\"bcc\\" in values && values.bcc != null) { + clone.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H = [values.bcc]; + } + + if (\\"bccs\\" in values && values.bccs != null) { + + if (\\"bcc\\" in values && + values.bcc != null) { + throw new TypeError( + \\"Cannot update both bcc and \\" + + \\"bccs at the same time.\\", + ); + } + + clone.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H = values.bccs; + } + clone.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8 = this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8; + if (\\"mediaType\\" in values && values.mediaType != null) { + clone.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8 = [values.mediaType]; + } + clone.#_3bNvLMBN1bCJETiTihM3wvi1B2JX = this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX; + if (\\"duration\\" in values && values.duration != null) { + clone.#_3bNvLMBN1bCJETiTihM3wvi1B2JX = [values.duration]; + } + + return clone; + } + + async #fetchAttachment( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await Object.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Link.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"https://www.w3.org/ns/activitystreams#Link\\"].join(\\", \\")); + } + + /** + * Similar to {@link getAttachments()}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get attachmentIds(): URL[] { + return this.#_49BipA5dq9eoH8LX8xdsVumveTca.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** Identifies a resource attached or related to an object that potentially + * requires special handling. The intent is to provide a model that is at + * least semantically similar to attachments in email. + * + */ + + async* getAttachments( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): AsyncIterable { + const vs = this.#_49BipA5dq9eoH8LX8xdsVumveTca; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = + await this.#fetchAttachment( + v, options); + vs[i] = fetched; + yield fetched; + continue; + } + yield v; + } + } + + async #fetchAttributedTo( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await Object.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); + } + + /** + * Similar to {@link getAttributedTo()}, + * but returns its \`@id\` URL instead of the object itself. + */ + get attributedToId(): URL | null { + if (this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py.length < 1) return null; + const v = this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** Identifies one or more entities to which this object is attributed. + * The attributed entities might not be Actors. For instance, + * an object might be attributed to the completion of another activity. + * + */ + + async getAttributedTo( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + if (this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py.length < 1) return null; + const v = this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py[0]; + if (v instanceof URL) { + const fetched = + await this.#fetchAttributedTo(v, options); + this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py[0] = fetched; + return fetched; + } + return v; + } + + /** + * Similar to {@link getAttributedTos()}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get attributedToIds(): URL[] { + return this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** Identifies one or more entities to which this object is attributed. + * The attributed entities might not be Actors. For instance, + * an object might be attributed to the completion of another activity. + * + */ + + async* getAttributedTos( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): AsyncIterable { + const vs = this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = + await this.#fetchAttributedTo( + v, options); + vs[i] = fetched; + yield fetched; + continue; + } + yield v; + } + } + + async #fetchAudience( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await Object.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); + } + + /** + * Similar to {@link getAudience()}, + * but returns its \`@id\` URL instead of the object itself. + */ + get audienceId(): URL | null { + if (this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6.length < 1) return null; + const v = this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** Identifies one or more entities that represent the total population of + * entities for which the object can considered to be relevant. + * + */ + + async getAudience( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + if (this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6.length < 1) return null; + const v = this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6[0]; + if (v instanceof URL) { + const fetched = + await this.#fetchAudience(v, options); + this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6[0] = fetched; + return fetched; + } + return v; + } + + /** + * Similar to {@link getAudiences()}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get audienceIds(): URL[] { + return this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** Identifies one or more entities that represent the total population of + * entities for which the object can considered to be relevant. + * + */ + + async* getAudiences( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): AsyncIterable { + const vs = this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = + await this.#fetchAudience( + v, options); + vs[i] = fetched; + yield fetched; + continue; + } + yield v; + } + } + +/** The content or textual representation of the Object encoded as a JSON + * string. By default, the value of \`content\` is HTML. The \`mediaType\` + * property can be used in the object to indicate a different content type. + * + * The content MAY be expressed using multiple language-tagged values. + * + */ +get content(): (string | LanguageString | null) { + if (this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz.length < 1) return null; + return this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz[0]; + } + +/** The content or textual representation of the Object encoded as a JSON + * string. By default, the value of \`content\` is HTML. The \`mediaType\` + * property can be used in the object to indicate a different content type. + * + * The content MAY be expressed using multiple language-tagged values. + * + */ +get contents(): (string | LanguageString)[] { + return this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz; + } + + async #fetchContext( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await Object.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Link.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"https://www.w3.org/ns/activitystreams#Link\\"].join(\\", \\")); + } + + /** + * Similar to {@link getContexts()}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get contextIds(): URL[] { + return this.#_3mhZzGXSpQ431mBSz2kvych22v4e.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** Identifies the context within which the object exists or an activity was + * performed. + * + * The notion of \\"context\\" used is intentionally vague. The intended function + * is to serve as a means of grouping objects and activities that share + * a common originating context or purpose. An example could be all activities + * relating to a common project or event. + * + */ + + async* getContexts( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): AsyncIterable { + const vs = this.#_3mhZzGXSpQ431mBSz2kvych22v4e; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = + await this.#fetchContext( + v, options); + vs[i] = fetched; + yield fetched; + continue; + } + yield v; + } + } + +/** A simple, human-readable, plain-text name for the object. HTML markup MUST + * NOT be included. The name MAY be expressed using multiple language-tagged + * values. + * + */ +get name(): (string | LanguageString | null) { + if (this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav.length < 1) return null; + return this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav[0]; + } + +/** A simple, human-readable, plain-text name for the object. HTML markup MUST + * NOT be included. The name MAY be expressed using multiple language-tagged + * values. + * + */ +get names(): (string | LanguageString)[] { + return this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav; + } + +/** The date and time describing the actual or expected ending time of + * the object. When used with an {@link Activity} object, for instance, + * the \`endTime\`\` property specifies the moment the activity concluded + * or is expected to conclude. + * + */ +get endTime(): (Temporal.Instant | null) { + if (this.#_219RwDanjScTv5tYCjwGZVCM7KZ9.length < 1) return null; + return this.#_219RwDanjScTv5tYCjwGZVCM7KZ9[0]; + } + + async #fetchGenerator( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await Object.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Link.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"https://www.w3.org/ns/activitystreams#Link\\"].join(\\", \\")); + } + + /** + * Similar to {@link getGenerators()}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get generatorIds(): URL[] { + return this.#_86xFhmgBapoMvYqjbjRuDPayTrS.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** Identifies the entity (e.g. an application) that generated the object. + * + */ + + async* getGenerators( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): AsyncIterable { + const vs = this.#_86xFhmgBapoMvYqjbjRuDPayTrS; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = + await this.#fetchGenerator( + v, options); + vs[i] = fetched; + yield fetched; + continue; + } + yield v; + } + } + + async #fetchIcon( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await Image.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Link.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Link\\"].join(\\", \\")); + } + + /** + * Similar to {@link getIcons()}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get iconIds(): URL[] { + return this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** Indicates an entity that describes an icon for this object. + * The image should have an aspect ratio of one (horizontal) to one + * (vertical) and should be suitable for presentation at a small size. + * + */ + + async* getIcons( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): AsyncIterable { + const vs = this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = + await this.#fetchIcon( + v, options); + vs[i] = fetched; + yield fetched; + continue; + } + yield v; + } + } + + async #fetchImage( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await Image.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Link.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Link\\"].join(\\", \\")); + } + + /** + * Similar to {@link getImages()}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get imageIds(): URL[] { + return this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** Indicates an entity that describes an image for this object. + * Unlike the icon property, there are no aspect ratio or display size + * limitations assumed. + * + */ + + async* getImages( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): AsyncIterable { + const vs = this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = + await this.#fetchImage( + v, options); + vs[i] = fetched; + yield fetched; + continue; + } + yield v; + } + } + + async #fetchReplyTarget( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await Object.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Link.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"https://www.w3.org/ns/activitystreams#Link\\"].join(\\", \\")); + } + + /** + * Similar to {@link getReplyTarget()}, + * but returns its \`@id\` URL instead of the object itself. + */ + get replyTargetId(): URL | null { + if (this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s.length < 1) return null; + const v = this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** Indicates one or more entities for which this object is considered + * a response. + * + */ + + async getReplyTarget( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + if (this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s.length < 1) return null; + const v = this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s[0]; + if (v instanceof URL) { + const fetched = + await this.#fetchReplyTarget(v, options); + this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s[0] = fetched; + return fetched; + } + return v; + } + + /** + * Similar to {@link getReplyTargets()}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get replyTargetIds(): URL[] { + return this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** Indicates one or more entities for which this object is considered + * a response. + * + */ + + async* getReplyTargets( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): AsyncIterable { + const vs = this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = + await this.#fetchReplyTarget( + v, options); + vs[i] = fetched; + yield fetched; + continue; + } + yield v; + } + } + + async #fetchLocation( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await Object.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Link.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"https://www.w3.org/ns/activitystreams#Link\\"].join(\\", \\")); + } + + /** + * Similar to {@link getLocation()}, + * but returns its \`@id\` URL instead of the object itself. + */ + get locationId(): URL | null { + if (this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR.length < 1) return null; + const v = this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** Indicates one or more physical or logical locations associated with + * the object. + * + */ + + async getLocation( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + if (this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR.length < 1) return null; + const v = this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR[0]; + if (v instanceof URL) { + const fetched = + await this.#fetchLocation(v, options); + this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR[0] = fetched; + return fetched; + } + return v; + } + + /** + * Similar to {@link getLocations()}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get locationIds(): URL[] { + return this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** Indicates one or more physical or logical locations associated with + * the object. + * + */ + + async* getLocations( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): AsyncIterable { + const vs = this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = + await this.#fetchLocation( + v, options); + vs[i] = fetched; + yield fetched; + continue; + } + yield v; + } + } + + async #fetchPreview( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await Link.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Object.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Link\\",\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); + } + + /** + * Similar to {@link getPreview()}, + * but returns its \`@id\` URL instead of the object itself. + */ + get previewId(): URL | null { + if (this.#_gCVTegXxWWCw6wWRxa1QF65zusg.length < 1) return null; + const v = this.#_gCVTegXxWWCw6wWRxa1QF65zusg[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** Identifies an entity that provides a preview of this object. + * + */ + + async getPreview( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + if (this.#_gCVTegXxWWCw6wWRxa1QF65zusg.length < 1) return null; + const v = this.#_gCVTegXxWWCw6wWRxa1QF65zusg[0]; + if (v instanceof URL) { + const fetched = + await this.#fetchPreview(v, options); + this.#_gCVTegXxWWCw6wWRxa1QF65zusg[0] = fetched; + return fetched; + } + return v; + } + + /** + * Similar to {@link getPreviews()}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get previewIds(): URL[] { + return this.#_gCVTegXxWWCw6wWRxa1QF65zusg.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** Identifies an entity that provides a preview of this object. + * + */ + + async* getPreviews( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): AsyncIterable { + const vs = this.#_gCVTegXxWWCw6wWRxa1QF65zusg; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = + await this.#fetchPreview( + v, options); + vs[i] = fetched; + yield fetched; + continue; + } + yield v; + } + } + +/** The date and time at which the object was published. + */ +get published(): (Temporal.Instant | null) { + if (this.#_5e258TDXtuhaFRPZiGoDfEpjdMr.length < 1) return null; + return this.#_5e258TDXtuhaFRPZiGoDfEpjdMr[0]; + } + + async #fetchReplies( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await Collection.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Collection\\"].join(\\", \\")); + } + + /** + * Similar to {@link getReplies()}, + * but returns its \`@id\` URL instead of the object itself. + */ + get repliesId(): URL | null { + if (this.#_7UpwM3JWcXhADcscukEehBorf6k.length < 1) return null; + const v = this.#_7UpwM3JWcXhADcscukEehBorf6k[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** Identifies a {@link Collection} containing objects considered to be + * responses to this object. + * + */ + + async getReplies( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + if (this.#_7UpwM3JWcXhADcscukEehBorf6k.length < 1) return null; + const v = this.#_7UpwM3JWcXhADcscukEehBorf6k[0]; + if (v instanceof URL) { + const fetched = + await this.#fetchReplies(v, options); + this.#_7UpwM3JWcXhADcscukEehBorf6k[0] = fetched; + return fetched; + } + return v; + } + +/** The date and time describing the actual or expected starting time of + * the object. When used with an {@link Activity} object, for instance, + * the \`startTime\` property specifies the moment the activity began or + * is scheduled to begin. + * + */ +get startTime(): (Temporal.Instant | null) { + if (this.#_2w3Jmue4up8iVDUA51WZqomEF438.length < 1) return null; + return this.#_2w3Jmue4up8iVDUA51WZqomEF438[0]; + } + +/** A natural language summarization of the object encoded as HTML. + * Multiple language tagged summaries MAY be provided. + * + */ +get summary(): (string | LanguageString | null) { + if (this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1.length < 1) return null; + return this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1[0]; + } + +/** A natural language summarization of the object encoded as HTML. + * Multiple language tagged summaries MAY be provided. + * + */ +get summaries(): (string | LanguageString)[] { + return this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1; + } + + async #fetchTag( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await Object.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Link.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"https://www.w3.org/ns/activitystreams#Link\\"].join(\\", \\")); + } + + /** + * Similar to {@link getTags()}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get tagIds(): URL[] { + return this.#_5chuqj6s95p5gg2sk1HntGfarRf.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** One or more \\"tags\\" that have been associated with an objects. + * A tag can be any kind of Object. The key difference between \`attachment\` + * and \`tag\` is that the former implies association by inclusion, + * while the latter implies associated by reference. + * + */ + + async* getTags( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): AsyncIterable { + const vs = this.#_5chuqj6s95p5gg2sk1HntGfarRf; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = + await this.#fetchTag( + v, options); + vs[i] = fetched; + yield fetched; + continue; + } + yield v; + } + } + +/** The date and time at which the object was updated. + */ +get updated(): (Temporal.Instant | null) { + if (this.#_385aB7ySixcf5Un6z3VsWmThgCzQ.length < 1) return null; + return this.#_385aB7ySixcf5Un6z3VsWmThgCzQ[0]; + } + +/** Identifies one or more links to representations of the object. + * + */ +get url(): (URL | Link | null) { + if (this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865.length < 1) return null; + return this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865[0]; + } + +/** Identifies one or more links to representations of the object. + * + */ +get urls(): (URL | Link)[] { + return this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865; + } + + async #fetchTo( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await Object.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); + } + + /** + * Similar to {@link getTo()}, + * but returns its \`@id\` URL instead of the object itself. + */ + get toId(): URL | null { + if (this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd.length < 1) return null; + const v = this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** Identifies an entity considered to be part of the public primary audience + * of an Object. + * + */ + + async getTo( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + if (this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd.length < 1) return null; + const v = this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd[0]; + if (v instanceof URL) { + const fetched = + await this.#fetchTo(v, options); + this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd[0] = fetched; + return fetched; + } + return v; + } + + /** + * Similar to {@link getTos()}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get toIds(): URL[] { + return this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** Identifies an entity considered to be part of the public primary audience + * of an Object. + * + */ + + async* getTos( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): AsyncIterable { + const vs = this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = + await this.#fetchTo( + v, options); + vs[i] = fetched; + yield fetched; + continue; + } + yield v; + } + } + + async #fetchBto( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await Object.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); + } + + /** + * Similar to {@link getBto()}, + * but returns its \`@id\` URL instead of the object itself. + */ + get btoId(): URL | null { + if (this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej.length < 1) return null; + const v = this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** Identifies an Object that is part of the private primary audience of + * this Object. + * + */ + + async getBto( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + if (this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej.length < 1) return null; + const v = this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej[0]; + if (v instanceof URL) { + const fetched = + await this.#fetchBto(v, options); + this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej[0] = fetched; + return fetched; + } + return v; + } + + /** + * Similar to {@link getBtos()}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get btoIds(): URL[] { + return this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** Identifies an Object that is part of the private primary audience of + * this Object. + * + */ + + async* getBtos( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): AsyncIterable { + const vs = this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = + await this.#fetchBto( + v, options); + vs[i] = fetched; + yield fetched; + continue; + } + yield v; + } + } + + async #fetchCc( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await Object.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); + } + + /** + * Similar to {@link getCc()}, + * but returns its \`@id\` URL instead of the object itself. + */ + get ccId(): URL | null { + if (this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g.length < 1) return null; + const v = this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** Identifies an Object that is part of the public secondary audience of + * this Object. + * + */ + + async getCc( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + if (this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g.length < 1) return null; + const v = this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g[0]; + if (v instanceof URL) { + const fetched = + await this.#fetchCc(v, options); + this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g[0] = fetched; + return fetched; + } + return v; + } + + /** + * Similar to {@link getCcs()}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get ccIds(): URL[] { + return this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** Identifies an Object that is part of the public secondary audience of + * this Object. + * + */ + + async* getCcs( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): AsyncIterable { + const vs = this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = + await this.#fetchCc( + v, options); + vs[i] = fetched; + yield fetched; + continue; + } + yield v; + } + } + + async #fetchBcc( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await Object.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); + } + + /** + * Similar to {@link getBcc()}, + * but returns its \`@id\` URL instead of the object itself. + */ + get bccId(): URL | null { + if (this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H.length < 1) return null; + const v = this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** Identifies one or more Objects that are part of the private secondary + * audience of this Object. + * + */ + + async getBcc( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + if (this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H.length < 1) return null; + const v = this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H[0]; + if (v instanceof URL) { + const fetched = + await this.#fetchBcc(v, options); + this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H[0] = fetched; + return fetched; + } + return v; + } + + /** + * Similar to {@link getBccs()}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get bccIds(): URL[] { + return this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** Identifies one or more Objects that are part of the private secondary + * audience of this Object. + * + */ + + async* getBccs( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): AsyncIterable { + const vs = this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = + await this.#fetchBcc( + v, options); + vs[i] = fetched; + yield fetched; + continue; + } + yield v; + } + } + +/** When used on an {@link Object}, identifies the MIME media type of the value + * of the \`content\` property. If not specified, the \`content\` property is + * assumed to contain \`text/html\` content. + * + */ +get mediaType(): (string | null) { + if (this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8.length < 1) return null; + return this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8[0]; + } + +/** When the object describes a time-bound resource, such as an audio or video, + * a meeting, etc, the \`duration\` property indicates the object's approximate + * duration. The value MUST be expressed as an \`xsd:duration\` as defined by + * W3C XML Schema Definition Language (XSD) 1.1 Part 2: DataTypes, section + * 3.3.6 (e.g. a period of 5 seconds is represented as \`PT5S\`). + * + */ +get duration(): (Temporal.Duration | null) { + if (this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX.length < 1) return null; + return this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX[0]; + } + + /** + * Converts this object to a JSON-LD structure. + * @returns The JSON-LD representation of this object. + */ + async toJsonLd(options: { + expand?: boolean, + documentLoader?: DocumentLoader + } = {}): Promise { + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + const values: Record = {}; + array = []; + for (const v of this.#_49BipA5dq9eoH8LX8xdsVumveTca) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : v instanceof Object ? await v.toJsonLd(options) : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#attachment\\"] = array; + + array = []; + for (const v of this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#attributedTo\\"] = array; + + array = []; + for (const v of this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#audience\\"] = array; + + array = []; + for (const v of this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz) { + array.push( + typeof v === \\"string\\" ? { \\"@value\\": v } : { + \\"@value\\": v.toString(), + \\"@language\\": v.language.compact(), + } + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#content\\"] = array; + + array = []; + for (const v of this.#_3mhZzGXSpQ431mBSz2kvych22v4e) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : v instanceof Object ? await v.toJsonLd(options) : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#context\\"] = array; + + array = []; + for (const v of this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav) { + array.push( + typeof v === \\"string\\" ? { \\"@value\\": v } : { + \\"@value\\": v.toString(), + \\"@language\\": v.language.compact(), + } + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#name\\"] = array; + + array = []; + for (const v of this.#_219RwDanjScTv5tYCjwGZVCM7KZ9) { + array.push( + { + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\", + \\"@value\\": v.toString(), + } + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#endTime\\"] = array; + + array = []; + for (const v of this.#_86xFhmgBapoMvYqjbjRuDPayTrS) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : v instanceof Object ? await v.toJsonLd(options) : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#generator\\"] = array; + + array = []; + for (const v of this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : v instanceof Image ? await v.toJsonLd(options) : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#icon\\"] = array; + + array = []; + for (const v of this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : v instanceof Image ? await v.toJsonLd(options) : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#image\\"] = array; + + array = []; + for (const v of this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : v instanceof Object ? await v.toJsonLd(options) : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#inReplyTo\\"] = array; + + array = []; + for (const v of this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : v instanceof Object ? await v.toJsonLd(options) : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#location\\"] = array; + + array = []; + for (const v of this.#_gCVTegXxWWCw6wWRxa1QF65zusg) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : v instanceof Link ? await v.toJsonLd(options) : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#preview\\"] = array; + + array = []; + for (const v of this.#_5e258TDXtuhaFRPZiGoDfEpjdMr) { + array.push( + { + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\", + \\"@value\\": v.toString(), + } + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#published\\"] = array; + + array = []; + for (const v of this.#_7UpwM3JWcXhADcscukEehBorf6k) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#replies\\"] = array; + + array = []; + for (const v of this.#_2w3Jmue4up8iVDUA51WZqomEF438) { + array.push( + { + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\", + \\"@value\\": v.toString(), + } + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#startTime\\"] = array; + + array = []; + for (const v of this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1) { + array.push( + typeof v === \\"string\\" ? { \\"@value\\": v } : { + \\"@value\\": v.toString(), + \\"@language\\": v.language.compact(), + } + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#summary\\"] = array; + + array = []; + for (const v of this.#_5chuqj6s95p5gg2sk1HntGfarRf) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : v instanceof Object ? await v.toJsonLd(options) : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#tag\\"] = array; + + array = []; + for (const v of this.#_385aB7ySixcf5Un6z3VsWmThgCzQ) { + array.push( + { + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\", + \\"@value\\": v.toString(), + } + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#updated\\"] = array; + + array = []; + for (const v of this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#url\\"] = array; + + array = []; + for (const v of this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#to\\"] = array; + + array = []; + for (const v of this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#bto\\"] = array; + + array = []; + for (const v of this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#cc\\"] = array; + + array = []; + for (const v of this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#bcc\\"] = array; + + array = []; + for (const v of this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8) { + array.push( + { \\"@value\\": v } + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#mediaType\\"] = array; + + array = []; + for (const v of this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX) { + array.push( + { + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#duration\\", + \\"@value\\": v.toString(), + } + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#duration\\"] = array; + + values[\\"@type\\"] = [\\"https://www.w3.org/ns/activitystreams#Object\\"]; + if (this.id) values[\\"@id\\"] = this.id.href; + if (options.expand) { + return await jsonld.expand(values, options); + } + return await jsonld.compact( + values, + \\"https://www.w3.org/ns/activitystreams\\", + options + ); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static async fromJsonLd( + json: unknown, + options: { documentLoader?: DocumentLoader } = {} + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + ...options, + keepFreeFloatingNodes: true, + }); + // deno-lint-ignore no-explicit-any + values = (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + if (\\"@type\\" in values) { + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Relationship\\")) { + delete values[\\"@type\\"]; + return await Relationship.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Note\\")) { + delete values[\\"@type\\"]; + return await Note.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Person\\")) { + delete values[\\"@type\\"]; + return await Person.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Event\\")) { + delete values[\\"@type\\"]; + return await Event.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Service\\")) { + delete values[\\"@type\\"]; + return await Service.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Article\\")) { + delete values[\\"@type\\"]; + return await Article.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Organization\\")) { + delete values[\\"@type\\"]; + return await Organization.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Place\\")) { + delete values[\\"@type\\"]; + return await Place.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Document\\")) { + delete values[\\"@type\\"]; + return await Document.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Video\\")) { + delete values[\\"@type\\"]; + return await Video.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Page\\")) { + delete values[\\"@type\\"]; + return await Page.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Image\\")) { + delete values[\\"@type\\"]; + return await Image.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Audio\\")) { + delete values[\\"@type\\"]; + return await Audio.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Activity\\")) { + delete values[\\"@type\\"]; + return await Activity.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Follow\\")) { + delete values[\\"@type\\"]; + return await Follow.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Reject\\")) { + delete values[\\"@type\\"]; + return await Reject.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Delete\\")) { + delete values[\\"@type\\"]; + return await Delete.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Like\\")) { + delete values[\\"@type\\"]; + return await Like.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Ignore\\")) { + delete values[\\"@type\\"]; + return await Ignore.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Block\\")) { + delete values[\\"@type\\"]; + return await Block.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Remove\\")) { + delete values[\\"@type\\"]; + return await Remove.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Undo\\")) { + delete values[\\"@type\\"]; + return await Undo.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Add\\")) { + delete values[\\"@type\\"]; + return await Add.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Accept\\")) { + delete values[\\"@type\\"]; + return await Accept.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Create\\")) { + delete values[\\"@type\\"]; + return await Create.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\")) { + delete values[\\"@type\\"]; + return await IntransitiveActivity.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Dislike\\")) { + delete values[\\"@type\\"]; + return await Dislike.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Flag\\")) { + delete values[\\"@type\\"]; + return await Flag.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Update\\")) { + delete values[\\"@type\\"]; + return await Update.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Announce\\")) { + delete values[\\"@type\\"]; + return await Announce.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Profile\\")) { + delete values[\\"@type\\"]; + return await Profile.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Group\\")) { + delete values[\\"@type\\"]; + return await Group.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Collection\\")) { + delete values[\\"@type\\"]; + return await Collection.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#CollectionPage\\")) { + delete values[\\"@type\\"]; + return await CollectionPage.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\")) { + delete values[\\"@type\\"]; + return await OrderedCollectionPage.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\")) { + delete values[\\"@type\\"]; + return await OrderedCollection.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Application\\")) { + delete values[\\"@type\\"]; + return await Application.fromJsonLd(values, options); + } + + if (!values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Object\\")) { + throw new TypeError(\\"Invalid type: \\" + values[\\"@type\\"]); + } + } + + const instance = new this({ + id: \\"@id\\" in values ? new URL(values[\\"@id\\"] as string) : undefined, + }); + const _49BipA5dq9eoH8LX8xdsVumveTca: (Object | Link | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#attachment\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _49BipA5dq9eoH8LX8xdsVumveTca.push(new URL(v[\\"@id\\"])); + continue; + } + + const decoded = + typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Application\\"].some( + t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( + v, options) : typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Link\\",\\"https://www.w3.org/ns/activitystreams#Mention\\"].some( + t => v[\\"@type\\"].includes(t)) ? await Link.fromJsonLd( + v, options) : undefined + ; + if (typeof decoded === \\"undefined\\") continue; + _49BipA5dq9eoH8LX8xdsVumveTca.push(decoded); + + } + instance.#_49BipA5dq9eoH8LX8xdsVumveTca = _49BipA5dq9eoH8LX8xdsVumveTca; + const _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py: (Object | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#attributedTo\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py.push(new URL(v[\\"@id\\"])); + continue; + } + _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py.push(await Object.fromJsonLd( + v, options)) + } + instance.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py = _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py; + const _3ocC3VVi88cEd5sPWL8djkZsvTN6: (Object | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#audience\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _3ocC3VVi88cEd5sPWL8djkZsvTN6.push(new URL(v[\\"@id\\"])); + continue; + } + _3ocC3VVi88cEd5sPWL8djkZsvTN6.push(await Object.fromJsonLd( + v, options)) + } + instance.#_3ocC3VVi88cEd5sPWL8djkZsvTN6 = _3ocC3VVi88cEd5sPWL8djkZsvTN6; + const _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz: (string | LanguageString)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#content\\"] ?? []) { + if (v == null) continue; + + const decoded = + typeof v === \\"object\\" && \\"@value\\" in v + && typeof v[\\"@value\\"] === \\"string\\" && !(\\"@language\\" in v) ? v[\\"@value\\"] : typeof v === \\"object\\" && \\"@language\\" in v && \\"@value\\" in v + && typeof v[\\"@language\\"] === \\"string\\" + && typeof v[\\"@value\\"] === \\"string\\" ? new LanguageString(v[\\"@value\\"], v[\\"@language\\"]) : undefined + ; + if (typeof decoded === \\"undefined\\") continue; + _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz.push(decoded); + + } + instance.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz = _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz; + const _3mhZzGXSpQ431mBSz2kvych22v4e: (Object | Link | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#context\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _3mhZzGXSpQ431mBSz2kvych22v4e.push(new URL(v[\\"@id\\"])); + continue; + } + + const decoded = + typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Application\\"].some( + t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( + v, options) : typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Link\\",\\"https://www.w3.org/ns/activitystreams#Mention\\"].some( + t => v[\\"@type\\"].includes(t)) ? await Link.fromJsonLd( + v, options) : undefined + ; + if (typeof decoded === \\"undefined\\") continue; + _3mhZzGXSpQ431mBSz2kvych22v4e.push(decoded); + + } + instance.#_3mhZzGXSpQ431mBSz2kvych22v4e = _3mhZzGXSpQ431mBSz2kvych22v4e; + const _4ZHbBuK7PrsvGgrjM8wgc6KMWjav: (string | LanguageString)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#name\\"] ?? []) { + if (v == null) continue; + + const decoded = + typeof v === \\"object\\" && \\"@value\\" in v + && typeof v[\\"@value\\"] === \\"string\\" && !(\\"@language\\" in v) ? v[\\"@value\\"] : typeof v === \\"object\\" && \\"@language\\" in v && \\"@value\\" in v + && typeof v[\\"@language\\"] === \\"string\\" + && typeof v[\\"@value\\"] === \\"string\\" ? new LanguageString(v[\\"@value\\"], v[\\"@language\\"]) : undefined + ; + if (typeof decoded === \\"undefined\\") continue; + _4ZHbBuK7PrsvGgrjM8wgc6KMWjav.push(decoded); + + } + instance.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav = _4ZHbBuK7PrsvGgrjM8wgc6KMWjav; + const _219RwDanjScTv5tYCjwGZVCM7KZ9: Temporal.Instant[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#endTime\\"] ?? []) { + if (v == null) continue; + _219RwDanjScTv5tYCjwGZVCM7KZ9.push(Temporal.Instant.from(v[\\"@value\\"])) + } + instance.#_219RwDanjScTv5tYCjwGZVCM7KZ9 = _219RwDanjScTv5tYCjwGZVCM7KZ9; + const _86xFhmgBapoMvYqjbjRuDPayTrS: (Object | Link | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#generator\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _86xFhmgBapoMvYqjbjRuDPayTrS.push(new URL(v[\\"@id\\"])); + continue; + } + + const decoded = + typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Application\\"].some( + t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( + v, options) : typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Link\\",\\"https://www.w3.org/ns/activitystreams#Mention\\"].some( + t => v[\\"@type\\"].includes(t)) ? await Link.fromJsonLd( + v, options) : undefined + ; + if (typeof decoded === \\"undefined\\") continue; + _86xFhmgBapoMvYqjbjRuDPayTrS.push(decoded); + + } + instance.#_86xFhmgBapoMvYqjbjRuDPayTrS = _86xFhmgBapoMvYqjbjRuDPayTrS; + const _33CjRLy5ujtsUrwRSCrsggvGdKuR: (Image | Link | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#icon\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _33CjRLy5ujtsUrwRSCrsggvGdKuR.push(new URL(v[\\"@id\\"])); + continue; + } + + const decoded = + typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Image\\") ? await Image.fromJsonLd( + v, options) : typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Link\\",\\"https://www.w3.org/ns/activitystreams#Mention\\"].some( + t => v[\\"@type\\"].includes(t)) ? await Link.fromJsonLd( + v, options) : undefined + ; + if (typeof decoded === \\"undefined\\") continue; + _33CjRLy5ujtsUrwRSCrsggvGdKuR.push(decoded); + + } + instance.#_33CjRLy5ujtsUrwRSCrsggvGdKuR = _33CjRLy5ujtsUrwRSCrsggvGdKuR; + const _3dXrUdkARxwyJLtJcYi1AJ92H41U: (Image | Link | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#image\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _3dXrUdkARxwyJLtJcYi1AJ92H41U.push(new URL(v[\\"@id\\"])); + continue; + } + + const decoded = + typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Image\\") ? await Image.fromJsonLd( + v, options) : typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Link\\",\\"https://www.w3.org/ns/activitystreams#Mention\\"].some( + t => v[\\"@type\\"].includes(t)) ? await Link.fromJsonLd( + v, options) : undefined + ; + if (typeof decoded === \\"undefined\\") continue; + _3dXrUdkARxwyJLtJcYi1AJ92H41U.push(decoded); + + } + instance.#_3dXrUdkARxwyJLtJcYi1AJ92H41U = _3dXrUdkARxwyJLtJcYi1AJ92H41U; + const _3fpbDrvZgf3Kq1a5V9aByFn8kx3s: (Object | Link | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#inReplyTo\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _3fpbDrvZgf3Kq1a5V9aByFn8kx3s.push(new URL(v[\\"@id\\"])); + continue; + } + + const decoded = + typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Application\\"].some( + t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( + v, options) : typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Link\\",\\"https://www.w3.org/ns/activitystreams#Mention\\"].some( + t => v[\\"@type\\"].includes(t)) ? await Link.fromJsonLd( + v, options) : undefined + ; + if (typeof decoded === \\"undefined\\") continue; + _3fpbDrvZgf3Kq1a5V9aByFn8kx3s.push(decoded); + + } + instance.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s = _3fpbDrvZgf3Kq1a5V9aByFn8kx3s; + const _31k5MUZJsnsPNg8dQQJieWaXTFnR: (Object | Link | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#location\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _31k5MUZJsnsPNg8dQQJieWaXTFnR.push(new URL(v[\\"@id\\"])); + continue; + } + + const decoded = + typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Application\\"].some( + t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( + v, options) : typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Link\\",\\"https://www.w3.org/ns/activitystreams#Mention\\"].some( + t => v[\\"@type\\"].includes(t)) ? await Link.fromJsonLd( + v, options) : undefined + ; + if (typeof decoded === \\"undefined\\") continue; + _31k5MUZJsnsPNg8dQQJieWaXTFnR.push(decoded); + + } + instance.#_31k5MUZJsnsPNg8dQQJieWaXTFnR = _31k5MUZJsnsPNg8dQQJieWaXTFnR; + const _gCVTegXxWWCw6wWRxa1QF65zusg: (Link | Object | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#preview\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _gCVTegXxWWCw6wWRxa1QF65zusg.push(new URL(v[\\"@id\\"])); + continue; + } + + const decoded = + typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Link\\",\\"https://www.w3.org/ns/activitystreams#Mention\\"].some( + t => v[\\"@type\\"].includes(t)) ? await Link.fromJsonLd( + v, options) : typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Application\\"].some( + t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( + v, options) : undefined + ; + if (typeof decoded === \\"undefined\\") continue; + _gCVTegXxWWCw6wWRxa1QF65zusg.push(decoded); + + } + instance.#_gCVTegXxWWCw6wWRxa1QF65zusg = _gCVTegXxWWCw6wWRxa1QF65zusg; + const _5e258TDXtuhaFRPZiGoDfEpjdMr: Temporal.Instant[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#published\\"] ?? []) { + if (v == null) continue; + _5e258TDXtuhaFRPZiGoDfEpjdMr.push(Temporal.Instant.from(v[\\"@value\\"])) + } + instance.#_5e258TDXtuhaFRPZiGoDfEpjdMr = _5e258TDXtuhaFRPZiGoDfEpjdMr; + const _7UpwM3JWcXhADcscukEehBorf6k: (Collection | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#replies\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _7UpwM3JWcXhADcscukEehBorf6k.push(new URL(v[\\"@id\\"])); + continue; + } + _7UpwM3JWcXhADcscukEehBorf6k.push(await Collection.fromJsonLd( + v, options)) + } + instance.#_7UpwM3JWcXhADcscukEehBorf6k = _7UpwM3JWcXhADcscukEehBorf6k; + const _2w3Jmue4up8iVDUA51WZqomEF438: Temporal.Instant[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#startTime\\"] ?? []) { + if (v == null) continue; + _2w3Jmue4up8iVDUA51WZqomEF438.push(Temporal.Instant.from(v[\\"@value\\"])) + } + instance.#_2w3Jmue4up8iVDUA51WZqomEF438 = _2w3Jmue4up8iVDUA51WZqomEF438; + const _4LqirZspQbFWWQEbFcXAxm7tTDN1: (string | LanguageString)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#summary\\"] ?? []) { + if (v == null) continue; + + const decoded = + typeof v === \\"object\\" && \\"@value\\" in v + && typeof v[\\"@value\\"] === \\"string\\" && !(\\"@language\\" in v) ? v[\\"@value\\"] : typeof v === \\"object\\" && \\"@language\\" in v && \\"@value\\" in v + && typeof v[\\"@language\\"] === \\"string\\" + && typeof v[\\"@value\\"] === \\"string\\" ? new LanguageString(v[\\"@value\\"], v[\\"@language\\"]) : undefined + ; + if (typeof decoded === \\"undefined\\") continue; + _4LqirZspQbFWWQEbFcXAxm7tTDN1.push(decoded); + + } + instance.#_4LqirZspQbFWWQEbFcXAxm7tTDN1 = _4LqirZspQbFWWQEbFcXAxm7tTDN1; + const _5chuqj6s95p5gg2sk1HntGfarRf: (Object | Link | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#tag\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _5chuqj6s95p5gg2sk1HntGfarRf.push(new URL(v[\\"@id\\"])); + continue; + } + + const decoded = + typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Application\\"].some( + t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( + v, options) : typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Link\\",\\"https://www.w3.org/ns/activitystreams#Mention\\"].some( + t => v[\\"@type\\"].includes(t)) ? await Link.fromJsonLd( + v, options) : undefined + ; + if (typeof decoded === \\"undefined\\") continue; + _5chuqj6s95p5gg2sk1HntGfarRf.push(decoded); + + } + instance.#_5chuqj6s95p5gg2sk1HntGfarRf = _5chuqj6s95p5gg2sk1HntGfarRf; + const _385aB7ySixcf5Un6z3VsWmThgCzQ: Temporal.Instant[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#updated\\"] ?? []) { + if (v == null) continue; + _385aB7ySixcf5Un6z3VsWmThgCzQ.push(Temporal.Instant.from(v[\\"@value\\"])) + } + instance.#_385aB7ySixcf5Un6z3VsWmThgCzQ = _385aB7ySixcf5Un6z3VsWmThgCzQ; + const _2oPEH9MQ3aj8JVwyYuWkqoVwV865: (URL | Link)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#url\\"] ?? []) { + if (v == null) continue; + + const decoded = + typeof v === \\"object\\" && \\"@id\\" in v + && typeof v[\\"@id\\"] === \\"string\\" ? new URL(v[\\"@id\\"]) : typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Link\\",\\"https://www.w3.org/ns/activitystreams#Mention\\"].some( + t => v[\\"@type\\"].includes(t)) ? await Link.fromJsonLd( + v, options) : undefined + ; + if (typeof decoded === \\"undefined\\") continue; + _2oPEH9MQ3aj8JVwyYuWkqoVwV865.push(decoded); + + } + instance.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865 = _2oPEH9MQ3aj8JVwyYuWkqoVwV865; + const _3hFbw7DTpHhq3cvVhkY8njhcsXbd: (Object | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#to\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _3hFbw7DTpHhq3cvVhkY8njhcsXbd.push(new URL(v[\\"@id\\"])); + continue; + } + _3hFbw7DTpHhq3cvVhkY8njhcsXbd.push(await Object.fromJsonLd( + v, options)) + } + instance.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd = _3hFbw7DTpHhq3cvVhkY8njhcsXbd; + const _aLZupjwL8XB7tzdLgCMXdjZ6qej: (Object | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#bto\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _aLZupjwL8XB7tzdLgCMXdjZ6qej.push(new URL(v[\\"@id\\"])); + continue; + } + _aLZupjwL8XB7tzdLgCMXdjZ6qej.push(await Object.fromJsonLd( + v, options)) + } + instance.#_aLZupjwL8XB7tzdLgCMXdjZ6qej = _aLZupjwL8XB7tzdLgCMXdjZ6qej; + const _42a1SvBs24QSLzKcfjCyNTjW5a1g: (Object | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#cc\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _42a1SvBs24QSLzKcfjCyNTjW5a1g.push(new URL(v[\\"@id\\"])); + continue; + } + _42a1SvBs24QSLzKcfjCyNTjW5a1g.push(await Object.fromJsonLd( + v, options)) + } + instance.#_42a1SvBs24QSLzKcfjCyNTjW5a1g = _42a1SvBs24QSLzKcfjCyNTjW5a1g; + const _3qvegKUB8YLgTXRpEf8E6JZSkz2H: (Object | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#bcc\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _3qvegKUB8YLgTXRpEf8E6JZSkz2H.push(new URL(v[\\"@id\\"])); + continue; + } + _3qvegKUB8YLgTXRpEf8E6JZSkz2H.push(await Object.fromJsonLd( + v, options)) + } + instance.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H = _3qvegKUB8YLgTXRpEf8E6JZSkz2H; + const _3BLrzmscsjHCw8TF5BHRW9WkPnX8: string[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#mediaType\\"] ?? []) { + if (v == null) continue; + _3BLrzmscsjHCw8TF5BHRW9WkPnX8.push(v[\\"@value\\"]) + } + instance.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8 = _3BLrzmscsjHCw8TF5BHRW9WkPnX8; + const _3bNvLMBN1bCJETiTihM3wvi1B2JX: Temporal.Duration[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#duration\\"] ?? []) { + if (v == null) continue; + _3bNvLMBN1bCJETiTihM3wvi1B2JX.push(Temporal.Duration.from(v[\\"@value\\"])) + } + instance.#_3bNvLMBN1bCJETiTihM3wvi1B2JX = _3bNvLMBN1bCJETiTihM3wvi1B2JX; + + return instance; + } + + protected _getCustomInspectProxy(): Record { + + const proxy: Record = {}; + if (this.id != null) { + proxy.id = { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(this.id!.href, options), + }; + } + + const _49BipA5dq9eoH8LX8xdsVumveTca = this.#_49BipA5dq9eoH8LX8xdsVumveTca.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_49BipA5dq9eoH8LX8xdsVumveTca.length > 1 + || !(\\"attachment\\" in proxy) + && _49BipA5dq9eoH8LX8xdsVumveTca.length > 0) { + proxy.attachments = _49BipA5dq9eoH8LX8xdsVumveTca; + } + + const _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py = this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py.length == 1) { + proxy.attributedTo = _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py[0]; + } + + if (_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py.length > 1 + || !(\\"attributedTo\\" in proxy) + && _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py.length > 0) { + proxy.attributedTos = _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py; + } + + const _3ocC3VVi88cEd5sPWL8djkZsvTN6 = this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_3ocC3VVi88cEd5sPWL8djkZsvTN6.length == 1) { + proxy.audience = _3ocC3VVi88cEd5sPWL8djkZsvTN6[0]; + } + + if (_3ocC3VVi88cEd5sPWL8djkZsvTN6.length > 1 + || !(\\"audience\\" in proxy) + && _3ocC3VVi88cEd5sPWL8djkZsvTN6.length > 0) { + proxy.audiences = _3ocC3VVi88cEd5sPWL8djkZsvTN6; + } + const _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz = this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz; + if (_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz.length == 1) { + proxy.content = _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz[0]; + } + + if (_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz.length > 1 + || !(\\"content\\" in proxy) + && _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz.length > 0) { + proxy.contents = _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz; + } + + const _3mhZzGXSpQ431mBSz2kvych22v4e = this.#_3mhZzGXSpQ431mBSz2kvych22v4e.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_3mhZzGXSpQ431mBSz2kvych22v4e.length > 1 + || !(\\"context\\" in proxy) + && _3mhZzGXSpQ431mBSz2kvych22v4e.length > 0) { + proxy.contexts = _3mhZzGXSpQ431mBSz2kvych22v4e; + } + const _4ZHbBuK7PrsvGgrjM8wgc6KMWjav = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav; + if (_4ZHbBuK7PrsvGgrjM8wgc6KMWjav.length == 1) { + proxy.name = _4ZHbBuK7PrsvGgrjM8wgc6KMWjav[0]; + } + + if (_4ZHbBuK7PrsvGgrjM8wgc6KMWjav.length > 1 + || !(\\"name\\" in proxy) + && _4ZHbBuK7PrsvGgrjM8wgc6KMWjav.length > 0) { + proxy.names = _4ZHbBuK7PrsvGgrjM8wgc6KMWjav; + } + const _219RwDanjScTv5tYCjwGZVCM7KZ9 = this.#_219RwDanjScTv5tYCjwGZVCM7KZ9; + if (_219RwDanjScTv5tYCjwGZVCM7KZ9.length == 1) { + proxy.endTime = _219RwDanjScTv5tYCjwGZVCM7KZ9[0]; + } + + const _86xFhmgBapoMvYqjbjRuDPayTrS = this.#_86xFhmgBapoMvYqjbjRuDPayTrS.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_86xFhmgBapoMvYqjbjRuDPayTrS.length > 1 + || !(\\"generator\\" in proxy) + && _86xFhmgBapoMvYqjbjRuDPayTrS.length > 0) { + proxy.generators = _86xFhmgBapoMvYqjbjRuDPayTrS; + } + + const _33CjRLy5ujtsUrwRSCrsggvGdKuR = this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_33CjRLy5ujtsUrwRSCrsggvGdKuR.length > 1 + || !(\\"icon\\" in proxy) + && _33CjRLy5ujtsUrwRSCrsggvGdKuR.length > 0) { + proxy.icons = _33CjRLy5ujtsUrwRSCrsggvGdKuR; + } + + const _3dXrUdkARxwyJLtJcYi1AJ92H41U = this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_3dXrUdkARxwyJLtJcYi1AJ92H41U.length > 1 + || !(\\"image\\" in proxy) + && _3dXrUdkARxwyJLtJcYi1AJ92H41U.length > 0) { + proxy.images = _3dXrUdkARxwyJLtJcYi1AJ92H41U; + } + + const _3fpbDrvZgf3Kq1a5V9aByFn8kx3s = this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_3fpbDrvZgf3Kq1a5V9aByFn8kx3s.length == 1) { + proxy.replyTarget = _3fpbDrvZgf3Kq1a5V9aByFn8kx3s[0]; + } + + if (_3fpbDrvZgf3Kq1a5V9aByFn8kx3s.length > 1 + || !(\\"replyTarget\\" in proxy) + && _3fpbDrvZgf3Kq1a5V9aByFn8kx3s.length > 0) { + proxy.replyTargets = _3fpbDrvZgf3Kq1a5V9aByFn8kx3s; + } + + const _31k5MUZJsnsPNg8dQQJieWaXTFnR = this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_31k5MUZJsnsPNg8dQQJieWaXTFnR.length == 1) { + proxy.location = _31k5MUZJsnsPNg8dQQJieWaXTFnR[0]; + } + + if (_31k5MUZJsnsPNg8dQQJieWaXTFnR.length > 1 + || !(\\"location\\" in proxy) + && _31k5MUZJsnsPNg8dQQJieWaXTFnR.length > 0) { + proxy.locations = _31k5MUZJsnsPNg8dQQJieWaXTFnR; + } + + const _gCVTegXxWWCw6wWRxa1QF65zusg = this.#_gCVTegXxWWCw6wWRxa1QF65zusg.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_gCVTegXxWWCw6wWRxa1QF65zusg.length == 1) { + proxy.preview = _gCVTegXxWWCw6wWRxa1QF65zusg[0]; + } + + if (_gCVTegXxWWCw6wWRxa1QF65zusg.length > 1 + || !(\\"preview\\" in proxy) + && _gCVTegXxWWCw6wWRxa1QF65zusg.length > 0) { + proxy.previews = _gCVTegXxWWCw6wWRxa1QF65zusg; + } + const _5e258TDXtuhaFRPZiGoDfEpjdMr = this.#_5e258TDXtuhaFRPZiGoDfEpjdMr; + if (_5e258TDXtuhaFRPZiGoDfEpjdMr.length == 1) { + proxy.published = _5e258TDXtuhaFRPZiGoDfEpjdMr[0]; + } + + const _7UpwM3JWcXhADcscukEehBorf6k = this.#_7UpwM3JWcXhADcscukEehBorf6k.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_7UpwM3JWcXhADcscukEehBorf6k.length == 1) { + proxy.replies = _7UpwM3JWcXhADcscukEehBorf6k[0]; + } + const _2w3Jmue4up8iVDUA51WZqomEF438 = this.#_2w3Jmue4up8iVDUA51WZqomEF438; + if (_2w3Jmue4up8iVDUA51WZqomEF438.length == 1) { + proxy.startTime = _2w3Jmue4up8iVDUA51WZqomEF438[0]; + } + const _4LqirZspQbFWWQEbFcXAxm7tTDN1 = this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1; + if (_4LqirZspQbFWWQEbFcXAxm7tTDN1.length == 1) { + proxy.summary = _4LqirZspQbFWWQEbFcXAxm7tTDN1[0]; + } + + if (_4LqirZspQbFWWQEbFcXAxm7tTDN1.length > 1 + || !(\\"summary\\" in proxy) + && _4LqirZspQbFWWQEbFcXAxm7tTDN1.length > 0) { + proxy.summaries = _4LqirZspQbFWWQEbFcXAxm7tTDN1; + } + + const _5chuqj6s95p5gg2sk1HntGfarRf = this.#_5chuqj6s95p5gg2sk1HntGfarRf.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_5chuqj6s95p5gg2sk1HntGfarRf.length > 1 + || !(\\"tag\\" in proxy) + && _5chuqj6s95p5gg2sk1HntGfarRf.length > 0) { + proxy.tags = _5chuqj6s95p5gg2sk1HntGfarRf; + } + const _385aB7ySixcf5Un6z3VsWmThgCzQ = this.#_385aB7ySixcf5Un6z3VsWmThgCzQ; + if (_385aB7ySixcf5Un6z3VsWmThgCzQ.length == 1) { + proxy.updated = _385aB7ySixcf5Un6z3VsWmThgCzQ[0]; + } + const _2oPEH9MQ3aj8JVwyYuWkqoVwV865 = this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865; + if (_2oPEH9MQ3aj8JVwyYuWkqoVwV865.length == 1) { + proxy.url = _2oPEH9MQ3aj8JVwyYuWkqoVwV865[0]; + } + + if (_2oPEH9MQ3aj8JVwyYuWkqoVwV865.length > 1 + || !(\\"url\\" in proxy) + && _2oPEH9MQ3aj8JVwyYuWkqoVwV865.length > 0) { + proxy.urls = _2oPEH9MQ3aj8JVwyYuWkqoVwV865; + } + + const _3hFbw7DTpHhq3cvVhkY8njhcsXbd = this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_3hFbw7DTpHhq3cvVhkY8njhcsXbd.length == 1) { + proxy.to = _3hFbw7DTpHhq3cvVhkY8njhcsXbd[0]; + } + + if (_3hFbw7DTpHhq3cvVhkY8njhcsXbd.length > 1 + || !(\\"to\\" in proxy) + && _3hFbw7DTpHhq3cvVhkY8njhcsXbd.length > 0) { + proxy.tos = _3hFbw7DTpHhq3cvVhkY8njhcsXbd; + } + + const _aLZupjwL8XB7tzdLgCMXdjZ6qej = this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_aLZupjwL8XB7tzdLgCMXdjZ6qej.length == 1) { + proxy.bto = _aLZupjwL8XB7tzdLgCMXdjZ6qej[0]; + } + + if (_aLZupjwL8XB7tzdLgCMXdjZ6qej.length > 1 + || !(\\"bto\\" in proxy) + && _aLZupjwL8XB7tzdLgCMXdjZ6qej.length > 0) { + proxy.btos = _aLZupjwL8XB7tzdLgCMXdjZ6qej; + } + + const _42a1SvBs24QSLzKcfjCyNTjW5a1g = this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_42a1SvBs24QSLzKcfjCyNTjW5a1g.length == 1) { + proxy.cc = _42a1SvBs24QSLzKcfjCyNTjW5a1g[0]; + } + + if (_42a1SvBs24QSLzKcfjCyNTjW5a1g.length > 1 + || !(\\"cc\\" in proxy) + && _42a1SvBs24QSLzKcfjCyNTjW5a1g.length > 0) { + proxy.ccs = _42a1SvBs24QSLzKcfjCyNTjW5a1g; + } + + const _3qvegKUB8YLgTXRpEf8E6JZSkz2H = this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_3qvegKUB8YLgTXRpEf8E6JZSkz2H.length == 1) { + proxy.bcc = _3qvegKUB8YLgTXRpEf8E6JZSkz2H[0]; + } + + if (_3qvegKUB8YLgTXRpEf8E6JZSkz2H.length > 1 + || !(\\"bcc\\" in proxy) + && _3qvegKUB8YLgTXRpEf8E6JZSkz2H.length > 0) { + proxy.bccs = _3qvegKUB8YLgTXRpEf8E6JZSkz2H; + } + const _3BLrzmscsjHCw8TF5BHRW9WkPnX8 = this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8; + if (_3BLrzmscsjHCw8TF5BHRW9WkPnX8.length == 1) { + proxy.mediaType = _3BLrzmscsjHCw8TF5BHRW9WkPnX8[0]; + } + const _3bNvLMBN1bCJETiTihM3wvi1B2JX = this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX; + if (_3bNvLMBN1bCJETiTihM3wvi1B2JX.length == 1) { + proxy.duration = _3bNvLMBN1bCJETiTihM3wvi1B2JX[0]; + } + + return proxy; + } + + [Symbol.for(\\"Deno.customInspect\\")]( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"Object \\" + inspect(proxy, options); + } + } + +/** A \`Collection\` is a subtype of {@link Object} that represents ordered or + * unordered sets of {@link Object} or {@link Link} instances. + * + * Refer to the Activity Streams 2.0 Core specification for a complete + * description of the Collection type. + * + */ +export class Collection extends Object { +#_XDbmNDuWHmrhqH712zqtecdbv1V: number[] = []; +#_3UyUdxnyn6cDn53QKrh4MBiearma: (CollectionPage | Link | URL)[] = []; +#_J52RqweMe6hhv7RnLJMC8BExTE5: (CollectionPage | Link | URL)[] = []; +#_gyJJnyEFnuNVi1HFZKfAn3Hfn26: (CollectionPage | Link | URL)[] = []; +#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg: (Object | Link | URL)[] = []; + + /** + * Constructs a new instance of Collection with the given values. + * @param values The values to initialize the instance with. + */ + constructor(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;totalItems?: number | null;current?: CollectionPage | Link | URL | null;first?: CollectionPage | Link | URL | null;last?: CollectionPage | Link | URL | null;items?: (Object | Link | URL)[];} +) { +super(values); + if (\\"totalItems\\" in values && values.totalItems != null) { + this.#_XDbmNDuWHmrhqH712zqtecdbv1V = [values.totalItems]; + } + + if (\\"current\\" in values && values.current != null) { + this.#_3UyUdxnyn6cDn53QKrh4MBiearma = [values.current]; + } + + if (\\"first\\" in values && values.first != null) { + this.#_J52RqweMe6hhv7RnLJMC8BExTE5 = [values.first]; + } + + if (\\"last\\" in values && values.last != null) { + this.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26 = [values.last]; + } + + if (\\"items\\" in values && values.items != null) { + + this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg = values.items; + } + } + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @returns The cloned instance. + */ + clone(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;totalItems?: number | null;current?: CollectionPage | Link | URL | null;first?: CollectionPage | Link | URL | null;last?: CollectionPage | Link | URL | null;items?: (Object | Link | URL)[];} + = {}): Collection { +const clone = super.clone(values) as unknown as Collection;clone.#_XDbmNDuWHmrhqH712zqtecdbv1V = this.#_XDbmNDuWHmrhqH712zqtecdbv1V; + if (\\"totalItems\\" in values && values.totalItems != null) { + clone.#_XDbmNDuWHmrhqH712zqtecdbv1V = [values.totalItems]; + } + clone.#_3UyUdxnyn6cDn53QKrh4MBiearma = this.#_3UyUdxnyn6cDn53QKrh4MBiearma; + if (\\"current\\" in values && values.current != null) { + clone.#_3UyUdxnyn6cDn53QKrh4MBiearma = [values.current]; + } + clone.#_J52RqweMe6hhv7RnLJMC8BExTE5 = this.#_J52RqweMe6hhv7RnLJMC8BExTE5; + if (\\"first\\" in values && values.first != null) { + clone.#_J52RqweMe6hhv7RnLJMC8BExTE5 = [values.first]; + } + clone.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26 = this.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26; + if (\\"last\\" in values && values.last != null) { + clone.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26 = [values.last]; + } + clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg = this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg; + if (\\"items\\" in values && values.items != null) { + + clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg = values.items; + } + + return clone; + } + +/** A non-negative integer specifying the total number of objects contained by + * the logical view of the collection. This number might not reflect the actual + * number of items serialized within the {@link Collection} object instance. + * + */ +get totalItems(): (number | null) { + if (this.#_XDbmNDuWHmrhqH712zqtecdbv1V.length < 1) return null; + return this.#_XDbmNDuWHmrhqH712zqtecdbv1V[0]; + } + + async #fetchCurrent( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await CollectionPage.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Link.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#Link\\"].join(\\", \\")); + } + + /** + * Similar to {@link getCurrent()}, + * but returns its \`@id\` URL instead of the object itself. + */ + get currentId(): URL | null { + if (this.#_3UyUdxnyn6cDn53QKrh4MBiearma.length < 1) return null; + const v = this.#_3UyUdxnyn6cDn53QKrh4MBiearma[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** In a paged {@link Collection}, indicates the page that contains + * the most recently updated member items. + * + */ + + async getCurrent( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + if (this.#_3UyUdxnyn6cDn53QKrh4MBiearma.length < 1) return null; + const v = this.#_3UyUdxnyn6cDn53QKrh4MBiearma[0]; + if (v instanceof URL) { + const fetched = + await this.#fetchCurrent(v, options); + this.#_3UyUdxnyn6cDn53QKrh4MBiearma[0] = fetched; + return fetched; + } + return v; + } + + async #fetchFirst( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await CollectionPage.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Link.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#Link\\"].join(\\", \\")); + } + + /** + * Similar to {@link getFirst()}, + * but returns its \`@id\` URL instead of the object itself. + */ + get firstId(): URL | null { + if (this.#_J52RqweMe6hhv7RnLJMC8BExTE5.length < 1) return null; + const v = this.#_J52RqweMe6hhv7RnLJMC8BExTE5[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** In a paged {@link Collection}, indicates the furthest preceding page of + * items in the collection. + * + */ + + async getFirst( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + if (this.#_J52RqweMe6hhv7RnLJMC8BExTE5.length < 1) return null; + const v = this.#_J52RqweMe6hhv7RnLJMC8BExTE5[0]; + if (v instanceof URL) { + const fetched = + await this.#fetchFirst(v, options); + this.#_J52RqweMe6hhv7RnLJMC8BExTE5[0] = fetched; + return fetched; + } + return v; + } + + async #fetchLast( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await CollectionPage.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Link.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#Link\\"].join(\\", \\")); + } + + /** + * Similar to {@link getLast()}, + * but returns its \`@id\` URL instead of the object itself. + */ + get lastId(): URL | null { + if (this.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26.length < 1) return null; + const v = this.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** In a paged {@link Collection}, indicates the furthest proceeding page of + * the collection. + * + */ + + async getLast( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + if (this.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26.length < 1) return null; + const v = this.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26[0]; + if (v instanceof URL) { + const fetched = + await this.#fetchLast(v, options); + this.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26[0] = fetched; + return fetched; + } + return v; + } + + async #fetchItem( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await Object.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Link.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"https://www.w3.org/ns/activitystreams#Link\\"].join(\\", \\")); + } + + /** + * Similar to {@link getItems()}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get itemIds(): URL[] { + return this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** Identifies the items contained in a collection. The items might be ordered + * or unordered. + * + */ + + async* getItems( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): AsyncIterable { + const vs = this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = + await this.#fetchItem( + v, options); + vs[i] = fetched; + yield fetched; + continue; + } + yield v; + } + } + + /** + * Converts this object to a JSON-LD structure. + * @returns The JSON-LD representation of this object. + */ + async toJsonLd(options: { + expand?: boolean, + documentLoader?: DocumentLoader + } = {}): Promise { + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + + const baseValues = await super.toJsonLd({ + ...options, + expand: true, + }) as unknown[]; + const values = baseValues[0] as Record; + + array = []; + for (const v of this.#_XDbmNDuWHmrhqH712zqtecdbv1V) { + array.push( + { + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\", + \\"@value\\": v, + } + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#totalItems\\"] = array; + + array = []; + for (const v of this.#_3UyUdxnyn6cDn53QKrh4MBiearma) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : v instanceof CollectionPage ? await v.toJsonLd(options) : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#current\\"] = array; + + array = []; + for (const v of this.#_J52RqweMe6hhv7RnLJMC8BExTE5) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : v instanceof CollectionPage ? await v.toJsonLd(options) : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#first\\"] = array; + + array = []; + for (const v of this.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : v instanceof CollectionPage ? await v.toJsonLd(options) : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#last\\"] = array; + + array = []; + for (const v of this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : v instanceof Object ? await v.toJsonLd(options) : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#items\\"] = array; + + values[\\"@type\\"] = [\\"https://www.w3.org/ns/activitystreams#Collection\\"]; + if (this.id) values[\\"@id\\"] = this.id.href; + if (options.expand) { + return await jsonld.expand(values, options); + } + return await jsonld.compact( + values, + \\"https://www.w3.org/ns/activitystreams\\", + options + ); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static async fromJsonLd( + json: unknown, + options: { documentLoader?: DocumentLoader } = {} + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + ...options, + keepFreeFloatingNodes: true, + }); + // deno-lint-ignore no-explicit-any + values = (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + if (\\"@type\\" in values) { + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#CollectionPage\\")) { + delete values[\\"@type\\"]; + return await CollectionPage.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\")) { + delete values[\\"@type\\"]; + return await OrderedCollectionPage.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\")) { + delete values[\\"@type\\"]; + return await OrderedCollection.fromJsonLd(values, options); + } + + if (!values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Collection\\")) { + throw new TypeError(\\"Invalid type: \\" + values[\\"@type\\"]); + } + } + + const instance = await super.fromJsonLd(values, options); + if (!(instance instanceof Collection)) { + throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); + } + const _XDbmNDuWHmrhqH712zqtecdbv1V: number[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#totalItems\\"] ?? []) { + if (v == null) continue; + _XDbmNDuWHmrhqH712zqtecdbv1V.push(v[\\"@value\\"]) + } + instance.#_XDbmNDuWHmrhqH712zqtecdbv1V = _XDbmNDuWHmrhqH712zqtecdbv1V; + const _3UyUdxnyn6cDn53QKrh4MBiearma: (CollectionPage | Link | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#current\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _3UyUdxnyn6cDn53QKrh4MBiearma.push(new URL(v[\\"@id\\"])); + continue; + } + + const decoded = + typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\"].some( + t => v[\\"@type\\"].includes(t)) ? await CollectionPage.fromJsonLd( + v, options) : typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Link\\",\\"https://www.w3.org/ns/activitystreams#Mention\\"].some( + t => v[\\"@type\\"].includes(t)) ? await Link.fromJsonLd( + v, options) : undefined + ; + if (typeof decoded === \\"undefined\\") continue; + _3UyUdxnyn6cDn53QKrh4MBiearma.push(decoded); + + } + instance.#_3UyUdxnyn6cDn53QKrh4MBiearma = _3UyUdxnyn6cDn53QKrh4MBiearma; + const _J52RqweMe6hhv7RnLJMC8BExTE5: (CollectionPage | Link | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#first\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _J52RqweMe6hhv7RnLJMC8BExTE5.push(new URL(v[\\"@id\\"])); + continue; + } + + const decoded = + typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\"].some( + t => v[\\"@type\\"].includes(t)) ? await CollectionPage.fromJsonLd( + v, options) : typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Link\\",\\"https://www.w3.org/ns/activitystreams#Mention\\"].some( + t => v[\\"@type\\"].includes(t)) ? await Link.fromJsonLd( + v, options) : undefined + ; + if (typeof decoded === \\"undefined\\") continue; + _J52RqweMe6hhv7RnLJMC8BExTE5.push(decoded); + + } + instance.#_J52RqweMe6hhv7RnLJMC8BExTE5 = _J52RqweMe6hhv7RnLJMC8BExTE5; + const _gyJJnyEFnuNVi1HFZKfAn3Hfn26: (CollectionPage | Link | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#last\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _gyJJnyEFnuNVi1HFZKfAn3Hfn26.push(new URL(v[\\"@id\\"])); + continue; + } + + const decoded = + typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\"].some( + t => v[\\"@type\\"].includes(t)) ? await CollectionPage.fromJsonLd( + v, options) : typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Link\\",\\"https://www.w3.org/ns/activitystreams#Mention\\"].some( + t => v[\\"@type\\"].includes(t)) ? await Link.fromJsonLd( + v, options) : undefined + ; + if (typeof decoded === \\"undefined\\") continue; + _gyJJnyEFnuNVi1HFZKfAn3Hfn26.push(decoded); + + } + instance.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26 = _gyJJnyEFnuNVi1HFZKfAn3Hfn26; + const _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg: (Object | Link | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#items\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg.push(new URL(v[\\"@id\\"])); + continue; + } + + const decoded = + typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Application\\"].some( + t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( + v, options) : typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Link\\",\\"https://www.w3.org/ns/activitystreams#Mention\\"].some( + t => v[\\"@type\\"].includes(t)) ? await Link.fromJsonLd( + v, options) : undefined + ; + if (typeof decoded === \\"undefined\\") continue; + _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg.push(decoded); + + } + instance.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg = _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg; + + return instance; + } + + protected _getCustomInspectProxy(): Record { + const proxy: Record = super._getCustomInspectProxy();const _XDbmNDuWHmrhqH712zqtecdbv1V = this.#_XDbmNDuWHmrhqH712zqtecdbv1V; + if (_XDbmNDuWHmrhqH712zqtecdbv1V.length == 1) { + proxy.totalItems = _XDbmNDuWHmrhqH712zqtecdbv1V[0]; + } + + const _3UyUdxnyn6cDn53QKrh4MBiearma = this.#_3UyUdxnyn6cDn53QKrh4MBiearma.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_3UyUdxnyn6cDn53QKrh4MBiearma.length == 1) { + proxy.current = _3UyUdxnyn6cDn53QKrh4MBiearma[0]; + } + + const _J52RqweMe6hhv7RnLJMC8BExTE5 = this.#_J52RqweMe6hhv7RnLJMC8BExTE5.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_J52RqweMe6hhv7RnLJMC8BExTE5.length == 1) { + proxy.first = _J52RqweMe6hhv7RnLJMC8BExTE5[0]; + } + + const _gyJJnyEFnuNVi1HFZKfAn3Hfn26 = this.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_gyJJnyEFnuNVi1HFZKfAn3Hfn26.length == 1) { + proxy.last = _gyJJnyEFnuNVi1HFZKfAn3Hfn26[0]; + } + + const _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg = this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg.length > 1 + || !(\\"item\\" in proxy) + && _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg.length > 0) { + proxy.items = _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg; + } + + return proxy; + } + + [Symbol.for(\\"Deno.customInspect\\")]( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"Collection \\" + inspect(proxy, options); + } + } + +/** Used to represent distinct subsets of items from a \`Collection\`. + * Refer to the Activity Streams 2.0 Core for a complete description of + * the \`CollectionPage\` object. + * + */ +export class CollectionPage extends Collection { +#_2kWgBhQKjEauxx8C6qF3ZQamK4Le: (Link | Collection | URL)[] = []; +#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY: (CollectionPage | Link | URL)[] = []; +#_3b8yG8tDNzQFFEnWhCc13G8eHooA: (CollectionPage | Link | URL)[] = []; + + /** + * Constructs a new instance of CollectionPage with the given values. + * @param values The values to initialize the instance with. + */ + constructor(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;totalItems?: number | null;current?: CollectionPage | Link | URL | null;first?: CollectionPage | Link | URL | null;last?: CollectionPage | Link | URL | null;items?: (Object | Link | URL)[];partOf?: Link | Collection | URL | null;next?: CollectionPage | Link | URL | null;prev?: CollectionPage | Link | URL | null;} +) { +super(values); + if (\\"partOf\\" in values && values.partOf != null) { + this.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le = [values.partOf]; + } + + if (\\"next\\" in values && values.next != null) { + this.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY = [values.next]; + } + + if (\\"prev\\" in values && values.prev != null) { + this.#_3b8yG8tDNzQFFEnWhCc13G8eHooA = [values.prev]; + } + } + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @returns The cloned instance. + */ + clone(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;totalItems?: number | null;current?: CollectionPage | Link | URL | null;first?: CollectionPage | Link | URL | null;last?: CollectionPage | Link | URL | null;items?: (Object | Link | URL)[];partOf?: Link | Collection | URL | null;next?: CollectionPage | Link | URL | null;prev?: CollectionPage | Link | URL | null;} + = {}): CollectionPage { +const clone = super.clone(values) as unknown as CollectionPage;clone.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le = this.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le; + if (\\"partOf\\" in values && values.partOf != null) { + clone.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le = [values.partOf]; + } + clone.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY = this.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY; + if (\\"next\\" in values && values.next != null) { + clone.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY = [values.next]; + } + clone.#_3b8yG8tDNzQFFEnWhCc13G8eHooA = this.#_3b8yG8tDNzQFFEnWhCc13G8eHooA; + if (\\"prev\\" in values && values.prev != null) { + clone.#_3b8yG8tDNzQFFEnWhCc13G8eHooA = [values.prev]; + } + + return clone; + } + + async #fetchPartOf( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await Link.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Collection.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Link\\",\\"https://www.w3.org/ns/activitystreams#Collection\\"].join(\\", \\")); + } + + /** + * Similar to {@link getPartOf()}, + * but returns its \`@id\` URL instead of the object itself. + */ + get partOfId(): URL | null { + if (this.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le.length < 1) return null; + const v = this.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** Identifies the {@link Collection} to which a {@link CollectionPage} objects + * items belong. + * + */ + + async getPartOf( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + if (this.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le.length < 1) return null; + const v = this.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le[0]; + if (v instanceof URL) { + const fetched = + await this.#fetchPartOf(v, options); + this.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le[0] = fetched; + return fetched; + } + return v; + } + + async #fetchNext( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await CollectionPage.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Link.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#Link\\"].join(\\", \\")); + } + + /** + * Similar to {@link getNext()}, + * but returns its \`@id\` URL instead of the object itself. + */ + get nextId(): URL | null { + if (this.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY.length < 1) return null; + const v = this.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** In a paged {@link Collection}, indicates the next page of items. + */ + + async getNext( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + if (this.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY.length < 1) return null; + const v = this.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY[0]; + if (v instanceof URL) { + const fetched = + await this.#fetchNext(v, options); + this.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY[0] = fetched; + return fetched; + } + return v; + } + + async #fetchPrev( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await CollectionPage.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Link.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#Link\\"].join(\\", \\")); + } + + /** + * Similar to {@link getPrev()}, + * but returns its \`@id\` URL instead of the object itself. + */ + get prevId(): URL | null { + if (this.#_3b8yG8tDNzQFFEnWhCc13G8eHooA.length < 1) return null; + const v = this.#_3b8yG8tDNzQFFEnWhCc13G8eHooA[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** In a paged {@link Collection}, identifies the previous page of items. + * + */ + + async getPrev( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + if (this.#_3b8yG8tDNzQFFEnWhCc13G8eHooA.length < 1) return null; + const v = this.#_3b8yG8tDNzQFFEnWhCc13G8eHooA[0]; + if (v instanceof URL) { + const fetched = + await this.#fetchPrev(v, options); + this.#_3b8yG8tDNzQFFEnWhCc13G8eHooA[0] = fetched; + return fetched; + } + return v; + } + + /** + * Converts this object to a JSON-LD structure. + * @returns The JSON-LD representation of this object. + */ + async toJsonLd(options: { + expand?: boolean, + documentLoader?: DocumentLoader + } = {}): Promise { + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + + const baseValues = await super.toJsonLd({ + ...options, + expand: true, + }) as unknown[]; + const values = baseValues[0] as Record; + + array = []; + for (const v of this.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : v instanceof Link ? await v.toJsonLd(options) : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#partOf\\"] = array; + + array = []; + for (const v of this.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : v instanceof CollectionPage ? await v.toJsonLd(options) : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#next\\"] = array; + + array = []; + for (const v of this.#_3b8yG8tDNzQFFEnWhCc13G8eHooA) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : v instanceof CollectionPage ? await v.toJsonLd(options) : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#prev\\"] = array; + + values[\\"@type\\"] = [\\"https://www.w3.org/ns/activitystreams#CollectionPage\\"]; + if (this.id) values[\\"@id\\"] = this.id.href; + if (options.expand) { + return await jsonld.expand(values, options); + } + return await jsonld.compact( + values, + \\"https://www.w3.org/ns/activitystreams\\", + options + ); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static async fromJsonLd( + json: unknown, + options: { documentLoader?: DocumentLoader } = {} + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + ...options, + keepFreeFloatingNodes: true, + }); + // deno-lint-ignore no-explicit-any + values = (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + if (\\"@type\\" in values) { + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\")) { + delete values[\\"@type\\"]; + return await OrderedCollectionPage.fromJsonLd(values, options); + } + + if (!values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#CollectionPage\\")) { + throw new TypeError(\\"Invalid type: \\" + values[\\"@type\\"]); + } + } + + const instance = await super.fromJsonLd(values, options); + if (!(instance instanceof CollectionPage)) { + throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); + } + const _2kWgBhQKjEauxx8C6qF3ZQamK4Le: (Link | Collection | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#partOf\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _2kWgBhQKjEauxx8C6qF3ZQamK4Le.push(new URL(v[\\"@id\\"])); + continue; + } + + const decoded = + typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Link\\",\\"https://www.w3.org/ns/activitystreams#Mention\\"].some( + t => v[\\"@type\\"].includes(t)) ? await Link.fromJsonLd( + v, options) : typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\"].some( + t => v[\\"@type\\"].includes(t)) ? await Collection.fromJsonLd( + v, options) : undefined + ; + if (typeof decoded === \\"undefined\\") continue; + _2kWgBhQKjEauxx8C6qF3ZQamK4Le.push(decoded); + + } + instance.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le = _2kWgBhQKjEauxx8C6qF3ZQamK4Le; + const _3BT4kQLcXhHx7TAWaNDKh8nFn9eY: (CollectionPage | Link | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#next\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _3BT4kQLcXhHx7TAWaNDKh8nFn9eY.push(new URL(v[\\"@id\\"])); + continue; + } + + const decoded = + typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\"].some( + t => v[\\"@type\\"].includes(t)) ? await CollectionPage.fromJsonLd( + v, options) : typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Link\\",\\"https://www.w3.org/ns/activitystreams#Mention\\"].some( + t => v[\\"@type\\"].includes(t)) ? await Link.fromJsonLd( + v, options) : undefined + ; + if (typeof decoded === \\"undefined\\") continue; + _3BT4kQLcXhHx7TAWaNDKh8nFn9eY.push(decoded); + + } + instance.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY = _3BT4kQLcXhHx7TAWaNDKh8nFn9eY; + const _3b8yG8tDNzQFFEnWhCc13G8eHooA: (CollectionPage | Link | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#prev\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _3b8yG8tDNzQFFEnWhCc13G8eHooA.push(new URL(v[\\"@id\\"])); + continue; + } + + const decoded = + typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\"].some( + t => v[\\"@type\\"].includes(t)) ? await CollectionPage.fromJsonLd( + v, options) : typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Link\\",\\"https://www.w3.org/ns/activitystreams#Mention\\"].some( + t => v[\\"@type\\"].includes(t)) ? await Link.fromJsonLd( + v, options) : undefined + ; + if (typeof decoded === \\"undefined\\") continue; + _3b8yG8tDNzQFFEnWhCc13G8eHooA.push(decoded); + + } + instance.#_3b8yG8tDNzQFFEnWhCc13G8eHooA = _3b8yG8tDNzQFFEnWhCc13G8eHooA; + + return instance; + } + + protected _getCustomInspectProxy(): Record { + const proxy: Record = super._getCustomInspectProxy(); + const _2kWgBhQKjEauxx8C6qF3ZQamK4Le = this.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_2kWgBhQKjEauxx8C6qF3ZQamK4Le.length == 1) { + proxy.partOf = _2kWgBhQKjEauxx8C6qF3ZQamK4Le[0]; + } + + const _3BT4kQLcXhHx7TAWaNDKh8nFn9eY = this.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_3BT4kQLcXhHx7TAWaNDKh8nFn9eY.length == 1) { + proxy.next = _3BT4kQLcXhHx7TAWaNDKh8nFn9eY[0]; + } + + const _3b8yG8tDNzQFFEnWhCc13G8eHooA = this.#_3b8yG8tDNzQFFEnWhCc13G8eHooA.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_3b8yG8tDNzQFFEnWhCc13G8eHooA.length == 1) { + proxy.prev = _3b8yG8tDNzQFFEnWhCc13G8eHooA[0]; + } + + return proxy; + } + + [Symbol.for(\\"Deno.customInspect\\")]( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"CollectionPage \\" + inspect(proxy, options); + } + } + +/** A Link is an indirect, qualified reference to a resource identified by a URL. + * The fundamental model for links is established by RFC 5988. Many of the + * properties defined by the Activity Vocabulary allow values that are either + * instances of {@link Object} or {@link Link}. When a {@link Link} is used, + * it establishes a qualified relation connecting the subject (the containing + * object) to the resource identified by the \`href\`. Properties of + * the {@link Link} are properties of the reference as opposed to properties of + * the resource. + * + */ +export class Link { +readonly id: URL | null; +#_pVjLsybKQdmkjuU7MHjiVmNnuj7: URL[] = []; +#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ: string[] = []; +#_3BLrzmscsjHCw8TF5BHRW9WkPnX8: string[] = []; +#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav: (string | LanguageString)[] = []; +#_f57HKWCp1YRBbTJE8PF12RbDJGf: LanguageTag[] = []; +#_2cGKFeFJMmiNpGZFEF75mCwFQsKb: number[] = []; +#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe: number[] = []; +#_gCVTegXxWWCw6wWRxa1QF65zusg: (Link | Object | URL)[] = []; + + /** + * Constructs a new instance of Link with the given values. + * @param values The values to initialize the instance with. + */ + constructor(values: + { +id?: URL | null; +href?: URL | null;rel?: string | null; +rels?: string[];mediaType?: string | null;name?: string | LanguageString | null; +names?: (string | LanguageString)[];language?: LanguageTag | null;height?: number | null;width?: number | null;previews?: (Link | Object | URL)[];} +) { +this.id = values.id ?? null; + if (\\"href\\" in values && values.href != null) { + this.#_pVjLsybKQdmkjuU7MHjiVmNnuj7 = [values.href]; + } + + if (\\"rel\\" in values && values.rel != null) { + this.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ = [values.rel]; + } + + if (\\"rels\\" in values && values.rels != null) { + + if (\\"rel\\" in values && + values.rel != null) { + throw new TypeError( + \\"Cannot initialize both rel and \\" + + \\"rels at the same time.\\", + ); + } + + this.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ = values.rels; + } + + if (\\"mediaType\\" in values && values.mediaType != null) { + this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8 = [values.mediaType]; + } + + if (\\"name\\" in values && values.name != null) { + this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav = [values.name]; + } + + if (\\"names\\" in values && values.names != null) { + + if (\\"name\\" in values && + values.name != null) { + throw new TypeError( + \\"Cannot initialize both name and \\" + + \\"names at the same time.\\", + ); + } + + this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav = values.names; + } + + if (\\"language\\" in values && values.language != null) { + this.#_f57HKWCp1YRBbTJE8PF12RbDJGf = [values.language]; + } + + if (\\"height\\" in values && values.height != null) { + this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb = [values.height]; + } + + if (\\"width\\" in values && values.width != null) { + this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe = [values.width]; + } + + if (\\"previews\\" in values && values.previews != null) { + + this.#_gCVTegXxWWCw6wWRxa1QF65zusg = values.previews; + } + } + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @returns The cloned instance. + */ + clone(values: + { +id?: URL | null; +href?: URL | null;rel?: string | null; +rels?: string[];mediaType?: string | null;name?: string | LanguageString | null; +names?: (string | LanguageString)[];language?: LanguageTag | null;height?: number | null;width?: number | null;previews?: (Link | Object | URL)[];} + = {}): Link { + + // @ts-ignore: this.constructor is not recognized as a constructor, but it is. + const clone: Link = new this.constructor({ id: values.id }); + clone.#_pVjLsybKQdmkjuU7MHjiVmNnuj7 = this.#_pVjLsybKQdmkjuU7MHjiVmNnuj7; + if (\\"href\\" in values && values.href != null) { + clone.#_pVjLsybKQdmkjuU7MHjiVmNnuj7 = [values.href]; + } + clone.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ = this.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ; + if (\\"rel\\" in values && values.rel != null) { + clone.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ = [values.rel]; + } + + if (\\"rels\\" in values && values.rels != null) { + + if (\\"rel\\" in values && + values.rel != null) { + throw new TypeError( + \\"Cannot update both rel and \\" + + \\"rels at the same time.\\", + ); + } + + clone.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ = values.rels; + } + clone.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8 = this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8; + if (\\"mediaType\\" in values && values.mediaType != null) { + clone.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8 = [values.mediaType]; + } + clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav; + if (\\"name\\" in values && values.name != null) { + clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav = [values.name]; + } + + if (\\"names\\" in values && values.names != null) { + + if (\\"name\\" in values && + values.name != null) { + throw new TypeError( + \\"Cannot update both name and \\" + + \\"names at the same time.\\", + ); + } + + clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav = values.names; + } + clone.#_f57HKWCp1YRBbTJE8PF12RbDJGf = this.#_f57HKWCp1YRBbTJE8PF12RbDJGf; + if (\\"language\\" in values && values.language != null) { + clone.#_f57HKWCp1YRBbTJE8PF12RbDJGf = [values.language]; + } + clone.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb = this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb; + if (\\"height\\" in values && values.height != null) { + clone.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb = [values.height]; + } + clone.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe = this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe; + if (\\"width\\" in values && values.width != null) { + clone.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe = [values.width]; + } + clone.#_gCVTegXxWWCw6wWRxa1QF65zusg = this.#_gCVTegXxWWCw6wWRxa1QF65zusg; + if (\\"previews\\" in values && values.previews != null) { + + clone.#_gCVTegXxWWCw6wWRxa1QF65zusg = values.previews; + } + + return clone; + } + +/** The target resource pointed to by a {@link Link}. + */ +get href(): (URL | null) { + if (this.#_pVjLsybKQdmkjuU7MHjiVmNnuj7.length < 1) return null; + return this.#_pVjLsybKQdmkjuU7MHjiVmNnuj7[0]; + } + +/** A link relation associated with a {@link Link}. The value MUST conform to + * both the HTML5 and RFC 5988 \\"link relation\\" definitions. + * + * In the HTML5, any string not containing the space (U+0020), tab (U+0009), + * LF (U+000A), FF (U+000C), CR (U+000D) or comma (U+002C) characters can + * be used as a valid link relation. + * + */ +get rel(): (string | null) { + if (this.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ.length < 1) return null; + return this.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ[0]; + } + +/** A link relation associated with a {@link Link}. The value MUST conform to + * both the HTML5 and RFC 5988 \\"link relation\\" definitions. + * + * In the HTML5, any string not containing the space (U+0020), tab (U+0009), + * LF (U+000A), FF (U+000C), CR (U+000D) or comma (U+002C) characters can + * be used as a valid link relation. + * + */ +get rels(): string[] { + return this.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ; + } + +/** When used on a {@link Link}, identifies the MIME media type of the + * referenced resource. + * + */ +get mediaType(): (string | null) { + if (this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8.length < 1) return null; + return this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8[0]; + } + +/** A simple, human-readable, plain-text name for the object. HTML markup MUST + * NOT be included. The name MAY be expressed using multiple language-tagged + * values. + * + */ +get name(): (string | LanguageString | null) { + if (this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav.length < 1) return null; + return this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav[0]; + } + +/** A simple, human-readable, plain-text name for the object. HTML markup MUST + * NOT be included. The name MAY be expressed using multiple language-tagged + * values. + * + */ +get names(): (string | LanguageString)[] { + return this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav; + } + +/** Hints as to the language used by the target resource. + * Value MUST be a BCP 47 Language-Tag. + * + */ +get language(): (LanguageTag | null) { + if (this.#_f57HKWCp1YRBbTJE8PF12RbDJGf.length < 1) return null; + return this.#_f57HKWCp1YRBbTJE8PF12RbDJGf[0]; + } + +/** On a {@link Link}, specifies a hint as to the rendering height in + * device-independent pixels of the linked resource. + * + */ +get height(): (number | null) { + if (this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb.length < 1) return null; + return this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb[0]; + } + +/** On a {@link Link}, specifies a hint as to the rendering width in + * device-independent pixels of the linked resource. + * + */ +get width(): (number | null) { + if (this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe.length < 1) return null; + return this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe[0]; + } + + async #fetchPreview( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await Link.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Object.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Link\\",\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); + } + + /** + * Similar to {@link getPreviews()}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get previewIds(): URL[] { + return this.#_gCVTegXxWWCw6wWRxa1QF65zusg.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** Identifies an entity that provides a preview of this object. + */ + + async* getPreviews( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): AsyncIterable { + const vs = this.#_gCVTegXxWWCw6wWRxa1QF65zusg; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = + await this.#fetchPreview( + v, options); + vs[i] = fetched; + yield fetched; + continue; + } + yield v; + } + } + + /** + * Converts this object to a JSON-LD structure. + * @returns The JSON-LD representation of this object. + */ + async toJsonLd(options: { + expand?: boolean, + documentLoader?: DocumentLoader + } = {}): Promise { + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + const values: Record = {}; + array = []; + for (const v of this.#_pVjLsybKQdmkjuU7MHjiVmNnuj7) { + array.push( + { \\"@id\\": v.href } + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#href\\"] = array; + + array = []; + for (const v of this.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ) { + array.push( + { \\"@value\\": v } + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#rel\\"] = array; + + array = []; + for (const v of this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8) { + array.push( + { \\"@value\\": v } + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#mediaType\\"] = array; + + array = []; + for (const v of this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav) { + array.push( + typeof v === \\"string\\" ? { \\"@value\\": v } : { + \\"@value\\": v.toString(), + \\"@language\\": v.language.compact(), + } + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#name\\"] = array; + + array = []; + for (const v of this.#_f57HKWCp1YRBbTJE8PF12RbDJGf) { + array.push( + { \\"@value\\": v.compact() } + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#hreflang\\"] = array; + + array = []; + for (const v of this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb) { + array.push( + { + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\", + \\"@value\\": v, + } + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#height\\"] = array; + + array = []; + for (const v of this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe) { + array.push( + { + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\", + \\"@value\\": v, + } + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#width\\"] = array; + + array = []; + for (const v of this.#_gCVTegXxWWCw6wWRxa1QF65zusg) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : v instanceof Link ? await v.toJsonLd(options) : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#preview\\"] = array; + + values[\\"@type\\"] = [\\"https://www.w3.org/ns/activitystreams#Link\\"]; + if (this.id) values[\\"@id\\"] = this.id.href; + if (options.expand) { + return await jsonld.expand(values, options); + } + return await jsonld.compact( + values, + \\"https://www.w3.org/ns/activitystreams\\", + options + ); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static async fromJsonLd( + json: unknown, + options: { documentLoader?: DocumentLoader } = {} + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + ...options, + keepFreeFloatingNodes: true, + }); + // deno-lint-ignore no-explicit-any + values = (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + if (\\"@type\\" in values) { + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Mention\\")) { + delete values[\\"@type\\"]; + return await Mention.fromJsonLd(values, options); + } + + if (!values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Link\\")) { + throw new TypeError(\\"Invalid type: \\" + values[\\"@type\\"]); + } + } + + const instance = new this({ + id: \\"@id\\" in values ? new URL(values[\\"@id\\"] as string) : undefined, + }); + const _pVjLsybKQdmkjuU7MHjiVmNnuj7: URL[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#href\\"] ?? []) { + if (v == null) continue; + _pVjLsybKQdmkjuU7MHjiVmNnuj7.push(new URL(v[\\"@id\\"])) + } + instance.#_pVjLsybKQdmkjuU7MHjiVmNnuj7 = _pVjLsybKQdmkjuU7MHjiVmNnuj7; + const _2a1c5GkfkQsnyyLybF8UXBQfFuHZ: string[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#rel\\"] ?? []) { + if (v == null) continue; + _2a1c5GkfkQsnyyLybF8UXBQfFuHZ.push(v[\\"@value\\"]) + } + instance.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ = _2a1c5GkfkQsnyyLybF8UXBQfFuHZ; + const _3BLrzmscsjHCw8TF5BHRW9WkPnX8: string[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#mediaType\\"] ?? []) { + if (v == null) continue; + _3BLrzmscsjHCw8TF5BHRW9WkPnX8.push(v[\\"@value\\"]) + } + instance.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8 = _3BLrzmscsjHCw8TF5BHRW9WkPnX8; + const _4ZHbBuK7PrsvGgrjM8wgc6KMWjav: (string | LanguageString)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#name\\"] ?? []) { + if (v == null) continue; + + const decoded = + typeof v === \\"object\\" && \\"@value\\" in v + && typeof v[\\"@value\\"] === \\"string\\" && !(\\"@language\\" in v) ? v[\\"@value\\"] : typeof v === \\"object\\" && \\"@language\\" in v && \\"@value\\" in v + && typeof v[\\"@language\\"] === \\"string\\" + && typeof v[\\"@value\\"] === \\"string\\" ? new LanguageString(v[\\"@value\\"], v[\\"@language\\"]) : undefined + ; + if (typeof decoded === \\"undefined\\") continue; + _4ZHbBuK7PrsvGgrjM8wgc6KMWjav.push(decoded); + + } + instance.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav = _4ZHbBuK7PrsvGgrjM8wgc6KMWjav; + const _f57HKWCp1YRBbTJE8PF12RbDJGf: LanguageTag[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#hreflang\\"] ?? []) { + if (v == null) continue; + _f57HKWCp1YRBbTJE8PF12RbDJGf.push(parseLanguageTag(v[\\"@value\\"])) + } + instance.#_f57HKWCp1YRBbTJE8PF12RbDJGf = _f57HKWCp1YRBbTJE8PF12RbDJGf; + const _2cGKFeFJMmiNpGZFEF75mCwFQsKb: number[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#height\\"] ?? []) { + if (v == null) continue; + _2cGKFeFJMmiNpGZFEF75mCwFQsKb.push(v[\\"@value\\"]) + } + instance.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb = _2cGKFeFJMmiNpGZFEF75mCwFQsKb; + const _2e9AP7WdHBJYAgXG6GEyq7nSkNMe: number[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#width\\"] ?? []) { + if (v == null) continue; + _2e9AP7WdHBJYAgXG6GEyq7nSkNMe.push(v[\\"@value\\"]) + } + instance.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe = _2e9AP7WdHBJYAgXG6GEyq7nSkNMe; + const _gCVTegXxWWCw6wWRxa1QF65zusg: (Link | Object | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#preview\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _gCVTegXxWWCw6wWRxa1QF65zusg.push(new URL(v[\\"@id\\"])); + continue; + } + + const decoded = + typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Link\\",\\"https://www.w3.org/ns/activitystreams#Mention\\"].some( + t => v[\\"@type\\"].includes(t)) ? await Link.fromJsonLd( + v, options) : typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Application\\"].some( + t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( + v, options) : undefined + ; + if (typeof decoded === \\"undefined\\") continue; + _gCVTegXxWWCw6wWRxa1QF65zusg.push(decoded); + + } + instance.#_gCVTegXxWWCw6wWRxa1QF65zusg = _gCVTegXxWWCw6wWRxa1QF65zusg; + + return instance; + } + + protected _getCustomInspectProxy(): Record { + + const proxy: Record = {}; + if (this.id != null) { + proxy.id = { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(this.id!.href, options), + }; + } + const _pVjLsybKQdmkjuU7MHjiVmNnuj7 = this.#_pVjLsybKQdmkjuU7MHjiVmNnuj7; + if (_pVjLsybKQdmkjuU7MHjiVmNnuj7.length == 1) { + proxy.href = _pVjLsybKQdmkjuU7MHjiVmNnuj7[0]; + } + const _2a1c5GkfkQsnyyLybF8UXBQfFuHZ = this.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ; + if (_2a1c5GkfkQsnyyLybF8UXBQfFuHZ.length == 1) { + proxy.rel = _2a1c5GkfkQsnyyLybF8UXBQfFuHZ[0]; + } + + if (_2a1c5GkfkQsnyyLybF8UXBQfFuHZ.length > 1 + || !(\\"rel\\" in proxy) + && _2a1c5GkfkQsnyyLybF8UXBQfFuHZ.length > 0) { + proxy.rels = _2a1c5GkfkQsnyyLybF8UXBQfFuHZ; + } + const _3BLrzmscsjHCw8TF5BHRW9WkPnX8 = this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8; + if (_3BLrzmscsjHCw8TF5BHRW9WkPnX8.length == 1) { + proxy.mediaType = _3BLrzmscsjHCw8TF5BHRW9WkPnX8[0]; + } + const _4ZHbBuK7PrsvGgrjM8wgc6KMWjav = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav; + if (_4ZHbBuK7PrsvGgrjM8wgc6KMWjav.length == 1) { + proxy.name = _4ZHbBuK7PrsvGgrjM8wgc6KMWjav[0]; + } + + if (_4ZHbBuK7PrsvGgrjM8wgc6KMWjav.length > 1 + || !(\\"name\\" in proxy) + && _4ZHbBuK7PrsvGgrjM8wgc6KMWjav.length > 0) { + proxy.names = _4ZHbBuK7PrsvGgrjM8wgc6KMWjav; + } + const _f57HKWCp1YRBbTJE8PF12RbDJGf = this.#_f57HKWCp1YRBbTJE8PF12RbDJGf; + if (_f57HKWCp1YRBbTJE8PF12RbDJGf.length == 1) { + proxy.language = _f57HKWCp1YRBbTJE8PF12RbDJGf[0]; + } + const _2cGKFeFJMmiNpGZFEF75mCwFQsKb = this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb; + if (_2cGKFeFJMmiNpGZFEF75mCwFQsKb.length == 1) { + proxy.height = _2cGKFeFJMmiNpGZFEF75mCwFQsKb[0]; + } + const _2e9AP7WdHBJYAgXG6GEyq7nSkNMe = this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe; + if (_2e9AP7WdHBJYAgXG6GEyq7nSkNMe.length == 1) { + proxy.width = _2e9AP7WdHBJYAgXG6GEyq7nSkNMe[0]; + } + + const _gCVTegXxWWCw6wWRxa1QF65zusg = this.#_gCVTegXxWWCw6wWRxa1QF65zusg.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_gCVTegXxWWCw6wWRxa1QF65zusg.length > 1 + || !(\\"preview\\" in proxy) + && _gCVTegXxWWCw6wWRxa1QF65zusg.length > 0) { + proxy.previews = _gCVTegXxWWCw6wWRxa1QF65zusg; + } + + return proxy; + } + + [Symbol.for(\\"Deno.customInspect\\")]( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"Link \\" + inspect(proxy, options); + } + } + +/** A specialized {@link Link} that represents an @mention. + */ +export class Mention extends Link { + + /** + * Constructs a new instance of Mention with the given values. + * @param values The values to initialize the instance with. + */ + constructor(values: + { +id?: URL | null; +href?: URL | null;rel?: string | null; +rels?: string[];mediaType?: string | null;name?: string | LanguageString | null; +names?: (string | LanguageString)[];language?: LanguageTag | null;height?: number | null;width?: number | null;previews?: (Link | Object | URL)[];} +) { +super(values);} + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @returns The cloned instance. + */ + clone(values: + { +id?: URL | null; +href?: URL | null;rel?: string | null; +rels?: string[];mediaType?: string | null;name?: string | LanguageString | null; +names?: (string | LanguageString)[];language?: LanguageTag | null;height?: number | null;width?: number | null;previews?: (Link | Object | URL)[];} + = {}): Mention { +const clone = super.clone(values) as unknown as Mention; + return clone; + } + + /** + * Converts this object to a JSON-LD structure. + * @returns The JSON-LD representation of this object. + */ + async toJsonLd(options: { + expand?: boolean, + documentLoader?: DocumentLoader + } = {}): Promise { + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + + const baseValues = await super.toJsonLd({ + ...options, + expand: true, + }) as unknown[]; + const values = baseValues[0] as Record; + + values[\\"@type\\"] = [\\"https://www.w3.org/ns/activitystreams#Mention\\"]; + if (this.id) values[\\"@id\\"] = this.id.href; + if (options.expand) { + return await jsonld.expand(values, options); + } + return await jsonld.compact( + values, + \\"https://www.w3.org/ns/activitystreams\\", + options + ); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static async fromJsonLd( + json: unknown, + options: { documentLoader?: DocumentLoader } = {} + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + ...options, + keepFreeFloatingNodes: true, + }); + // deno-lint-ignore no-explicit-any + values = (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + + const instance = await super.fromJsonLd(values, options); + if (!(instance instanceof Mention)) { + throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); + } + + return instance; + } + + protected _getCustomInspectProxy(): Record { + const proxy: Record = super._getCustomInspectProxy(); + return proxy; + } + + [Symbol.for(\\"Deno.customInspect\\")]( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"Mention \\" + inspect(proxy, options); + } + } + +/** A key owned by an actor. + */ +export class CryptographicKey { +readonly id: URL | null; +#_5UJq9NDh3ZHgswFwwdVxQvJxdx2: (Application | Group | Organization | Person | Service | URL)[] = []; +#_2fE2QMDdg6KFGqa4NEC3TmjApSAD: CryptoKey[] = []; + + /** + * Constructs a new instance of CryptographicKey with the given values. + * @param values The values to initialize the instance with. + */ + constructor(values: + { +id?: URL | null; +owner?: Application | Group | Organization | Person | Service | URL | null;publicKey?: CryptoKey | null;} +) { +this.id = values.id ?? null; + if (\\"owner\\" in values && values.owner != null) { + this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2 = [values.owner]; + } + + if (\\"publicKey\\" in values && values.publicKey != null) { + this.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD = [values.publicKey]; + } + } + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @returns The cloned instance. + */ + clone(values: + { +id?: URL | null; +owner?: Application | Group | Organization | Person | Service | URL | null;publicKey?: CryptoKey | null;} + = {}): CryptographicKey { + + // @ts-ignore: this.constructor is not recognized as a constructor, but it is. + const clone: CryptographicKey = new this.constructor({ id: values.id }); + clone.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2 = this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2; + if (\\"owner\\" in values && values.owner != null) { + clone.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2 = [values.owner]; + } + clone.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD = this.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD; + if (\\"publicKey\\" in values && values.publicKey != null) { + clone.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD = [values.publicKey]; + } + + return clone; + } + + async #fetchOwner( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await Application.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Group.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Organization.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Person.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Service.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Service\\"].join(\\", \\")); + } + + /** + * Similar to {@link getOwner()}, + * but returns its \`@id\` URL instead of the object itself. + */ + get ownerId(): URL | null { + if (this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2.length < 1) return null; + const v = this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** An actor who owns this key. + */ + + async getOwner( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + if (this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2.length < 1) return null; + const v = this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2[0]; + if (v instanceof URL) { + const fetched = + await this.#fetchOwner(v, options); + this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2[0] = fetched; + return fetched; + } + return v; + } + +/** A PEM-encoded public key. + */ +get publicKey(): (CryptoKey | null) { + if (this.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD.length < 1) return null; + return this.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD[0]; + } + + /** + * Converts this object to a JSON-LD structure. + * @returns The JSON-LD representation of this object. + */ + async toJsonLd(options: { + expand?: boolean, + documentLoader?: DocumentLoader + } = {}): Promise { + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + const values: Record = {}; + array = []; + for (const v of this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : 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) + ); + } + if (array.length > 0) values[\\"https://w3id.org/security#owner\\"] = array; + + array = []; + for (const v of this.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD) { + array.push( + { \\"@value\\": await exportSPKI(v) } + ); + } + if (array.length > 0) values[\\"https://w3id.org/security#publicKeyPem\\"] = array; + + values[\\"@type\\"] = [\\"https://w3id.org/security#Key\\"]; + if (this.id) values[\\"@id\\"] = this.id.href; + if (options.expand) { + return await jsonld.expand(values, options); + } + return await jsonld.compact( + values, + \\"https://w3id.org/security/v1\\", + options + ); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static async fromJsonLd( + json: unknown, + options: { documentLoader?: DocumentLoader } = {} + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + ...options, + keepFreeFloatingNodes: true, + }); + // deno-lint-ignore no-explicit-any + values = (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + + const instance = new this({ + id: \\"@id\\" in values ? new URL(values[\\"@id\\"] as string) : undefined, + }); + const _5UJq9NDh3ZHgswFwwdVxQvJxdx2: (Application | Group | Organization | Person | Service | URL)[] = []; + + for (const v of values[\\"https://w3id.org/security#owner\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _5UJq9NDh3ZHgswFwwdVxQvJxdx2.push(new URL(v[\\"@id\\"])); + continue; + } + + 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, options) : typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Group\\") ? await Group.fromJsonLd( + v, options) : typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Organization\\") ? await Organization.fromJsonLd( + v, options) : typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Person\\") ? await Person.fromJsonLd( + v, options) : typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Service\\") ? await Service.fromJsonLd( + v, options) : undefined + ; + if (typeof decoded === \\"undefined\\") continue; + _5UJq9NDh3ZHgswFwwdVxQvJxdx2.push(decoded); + + } + instance.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2 = _5UJq9NDh3ZHgswFwwdVxQvJxdx2; + const _2fE2QMDdg6KFGqa4NEC3TmjApSAD: CryptoKey[] = []; + + for (const v of values[\\"https://w3id.org/security#publicKeyPem\\"] ?? []) { + if (v == null) continue; + _2fE2QMDdg6KFGqa4NEC3TmjApSAD.push(await importSPKI(v[\\"@value\\"], \\"RS256\\", { + extractable: true + })) + } + instance.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD = _2fE2QMDdg6KFGqa4NEC3TmjApSAD; + + return instance; + } + + protected _getCustomInspectProxy(): Record { + + const proxy: Record = {}; + if (this.id != null) { + proxy.id = { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(this.id!.href, options), + }; + } + + const _5UJq9NDh3ZHgswFwwdVxQvJxdx2 = this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_5UJq9NDh3ZHgswFwwdVxQvJxdx2.length == 1) { + proxy.owner = _5UJq9NDh3ZHgswFwwdVxQvJxdx2[0]; + } + const _2fE2QMDdg6KFGqa4NEC3TmjApSAD = this.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD; + if (_2fE2QMDdg6KFGqa4NEC3TmjApSAD.length == 1) { + proxy.publicKey = _2fE2QMDdg6KFGqa4NEC3TmjApSAD[0]; + } + + return proxy; + } + + [Symbol.for(\\"Deno.customInspect\\")]( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"CryptographicKey \\" + inspect(proxy, options); + } + } + +/** An Activity is a subtype of {@link Object} that describes some form of action + * that may happen, is currently happening, or has already happened. + * The {@link Activity} type itself serves as an abstract base type for all types + * of activities. It is important to note that the {@link Activity} type itself + * does not carry any specific semantics about the kind of action being taken. + * + */ +export class Activity extends Object { +#_2DjTTboo3CNHU2a2JQqUSE2dbv9D: (Object | Link | URL)[] = []; +#_2MH19yxjn1wnHsNfa5n4JBhJzxyc: (Object | Link | URL)[] = []; + + /** + * Constructs a new instance of Activity with the given values. + * @param values The values to initialize the instance with. + */ + constructor(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;actor?: Object | Link | URL | null; +actors?: (Object | Link | URL)[];object?: Object | Link | URL | null; +objects?: (Object | Link | URL)[];} +) { +super(values); + if (\\"actor\\" in values && values.actor != null) { + this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D = [values.actor]; + } + + if (\\"actors\\" in values && values.actors != null) { + + if (\\"actor\\" in values && + values.actor != null) { + throw new TypeError( + \\"Cannot initialize both actor and \\" + + \\"actors at the same time.\\", + ); + } + + this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D = values.actors; + } + + if (\\"object\\" in values && values.object != null) { + this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc = [values.object]; + } + + if (\\"objects\\" in values && values.objects != null) { + + if (\\"object\\" in values && + values.object != null) { + throw new TypeError( + \\"Cannot initialize both object and \\" + + \\"objects at the same time.\\", + ); + } + + this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc = values.objects; + } + } + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @returns The cloned instance. + */ + clone(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;actor?: Object | Link | URL | null; +actors?: (Object | Link | URL)[];object?: Object | Link | URL | null; +objects?: (Object | Link | URL)[];} + = {}): Activity { +const clone = super.clone(values) as unknown as Activity;clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D; + if (\\"actor\\" in values && values.actor != null) { + clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D = [values.actor]; + } + + if (\\"actors\\" in values && values.actors != null) { + + if (\\"actor\\" in values && + values.actor != null) { + throw new TypeError( + \\"Cannot update both actor and \\" + + \\"actors at the same time.\\", + ); + } + + clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D = values.actors; + } + clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc; + if (\\"object\\" in values && values.object != null) { + clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc = [values.object]; + } + + if (\\"objects\\" in values && values.objects != null) { + + if (\\"object\\" in values && + values.object != null) { + throw new TypeError( + \\"Cannot update both object and \\" + + \\"objects at the same time.\\", + ); + } + + clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc = values.objects; + } + + return clone; + } + + async #fetchActor( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await Object.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Link.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"https://www.w3.org/ns/activitystreams#Link\\"].join(\\", \\")); + } + + /** + * Similar to {@link getActor()}, + * but returns its \`@id\` URL instead of the object itself. + */ + get actorId(): URL | null { + if (this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D.length < 1) return null; + const v = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** Describes one or more entities that either performed or are expected to + * perform the activity. Any single activity can have multiple actors. + * The actor MAY be specified using an indirect {@link Link}. + * + */ + + async getActor( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + if (this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D.length < 1) return null; + const v = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D[0]; + if (v instanceof URL) { + const fetched = + await this.#fetchActor(v, options); + this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D[0] = fetched; + return fetched; + } + return v; + } + + /** + * Similar to {@link getActors()}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get actorIds(): URL[] { + return this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** Describes one or more entities that either performed or are expected to + * perform the activity. Any single activity can have multiple actors. + * The actor MAY be specified using an indirect {@link Link}. + * + */ + + async* getActors( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): AsyncIterable { + const vs = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = + await this.#fetchActor( + v, options); + vs[i] = fetched; + yield fetched; + continue; + } + yield v; + } + } + + async #fetchObject( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await Object.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Link.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"https://www.w3.org/ns/activitystreams#Link\\"].join(\\", \\")); + } + + /** + * Similar to {@link getObject()}, + * but returns its \`@id\` URL instead of the object itself. + */ + get objectId(): URL | null { + if (this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc.length < 1) return null; + const v = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** When used within an {@link Activity}, describes the direct object of + * the activity. For instance, in the activity \\"John added a movie to his + * wishlist\\", the object of the activity is the movie added. + * + */ + + async getObject( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + if (this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc.length < 1) return null; + const v = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc[0]; + if (v instanceof URL) { + const fetched = + await this.#fetchObject(v, options); + this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc[0] = fetched; + return fetched; + } + return v; + } + + /** + * Similar to {@link getObjects()}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get objectIds(): URL[] { + return this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** When used within an {@link Activity}, describes the direct object of + * the activity. For instance, in the activity \\"John added a movie to his + * wishlist\\", the object of the activity is the movie added. + * + */ + + async* getObjects( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): AsyncIterable { + const vs = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = + await this.#fetchObject( + v, options); + vs[i] = fetched; + yield fetched; + continue; + } + yield v; + } + } + + /** + * Converts this object to a JSON-LD structure. + * @returns The JSON-LD representation of this object. + */ + async toJsonLd(options: { + expand?: boolean, + documentLoader?: DocumentLoader + } = {}): Promise { + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + + const baseValues = await super.toJsonLd({ + ...options, + expand: true, + }) as unknown[]; + const values = baseValues[0] as Record; + + array = []; + for (const v of this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : v instanceof Object ? await v.toJsonLd(options) : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#actor\\"] = array; + + array = []; + for (const v of this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : v instanceof Object ? await v.toJsonLd(options) : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#object\\"] = array; + + values[\\"@type\\"] = [\\"https://www.w3.org/ns/activitystreams#Activity\\"]; + if (this.id) values[\\"@id\\"] = this.id.href; + if (options.expand) { + return await jsonld.expand(values, options); + } + return await jsonld.compact( + values, + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\"], + options + ); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static async fromJsonLd( + json: unknown, + options: { documentLoader?: DocumentLoader } = {} + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + ...options, + keepFreeFloatingNodes: true, + }); + // deno-lint-ignore no-explicit-any + values = (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + if (\\"@type\\" in values) { + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Follow\\")) { + delete values[\\"@type\\"]; + return await Follow.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Reject\\")) { + delete values[\\"@type\\"]; + return await Reject.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Delete\\")) { + delete values[\\"@type\\"]; + return await Delete.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Like\\")) { + delete values[\\"@type\\"]; + return await Like.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Ignore\\")) { + delete values[\\"@type\\"]; + return await Ignore.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Block\\")) { + delete values[\\"@type\\"]; + return await Block.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Remove\\")) { + delete values[\\"@type\\"]; + return await Remove.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Undo\\")) { + delete values[\\"@type\\"]; + return await Undo.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Add\\")) { + delete values[\\"@type\\"]; + return await Add.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Accept\\")) { + delete values[\\"@type\\"]; + return await Accept.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Create\\")) { + delete values[\\"@type\\"]; + return await Create.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\")) { + delete values[\\"@type\\"]; + return await IntransitiveActivity.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Dislike\\")) { + delete values[\\"@type\\"]; + return await Dislike.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Flag\\")) { + delete values[\\"@type\\"]; + return await Flag.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Update\\")) { + delete values[\\"@type\\"]; + return await Update.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Announce\\")) { + delete values[\\"@type\\"]; + return await Announce.fromJsonLd(values, options); + } + + if (!values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Activity\\")) { + throw new TypeError(\\"Invalid type: \\" + values[\\"@type\\"]); + } + } + + const instance = await super.fromJsonLd(values, options); + if (!(instance instanceof Activity)) { + throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); + } + const _2DjTTboo3CNHU2a2JQqUSE2dbv9D: (Object | Link | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#actor\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _2DjTTboo3CNHU2a2JQqUSE2dbv9D.push(new URL(v[\\"@id\\"])); + continue; + } + + const decoded = + typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Application\\"].some( + t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( + v, options) : typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Link\\",\\"https://www.w3.org/ns/activitystreams#Mention\\"].some( + t => v[\\"@type\\"].includes(t)) ? await Link.fromJsonLd( + v, options) : undefined + ; + if (typeof decoded === \\"undefined\\") continue; + _2DjTTboo3CNHU2a2JQqUSE2dbv9D.push(decoded); + + } + instance.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D = _2DjTTboo3CNHU2a2JQqUSE2dbv9D; + const _2MH19yxjn1wnHsNfa5n4JBhJzxyc: (Object | Link | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#object\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _2MH19yxjn1wnHsNfa5n4JBhJzxyc.push(new URL(v[\\"@id\\"])); + continue; + } + + const decoded = + typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Application\\"].some( + t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( + v, options) : typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Link\\",\\"https://www.w3.org/ns/activitystreams#Mention\\"].some( + t => v[\\"@type\\"].includes(t)) ? await Link.fromJsonLd( + v, options) : undefined + ; + if (typeof decoded === \\"undefined\\") continue; + _2MH19yxjn1wnHsNfa5n4JBhJzxyc.push(decoded); + + } + instance.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc = _2MH19yxjn1wnHsNfa5n4JBhJzxyc; + + return instance; + } + + protected _getCustomInspectProxy(): Record { + const proxy: Record = super._getCustomInspectProxy(); + const _2DjTTboo3CNHU2a2JQqUSE2dbv9D = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_2DjTTboo3CNHU2a2JQqUSE2dbv9D.length == 1) { + proxy.actor = _2DjTTboo3CNHU2a2JQqUSE2dbv9D[0]; + } + + if (_2DjTTboo3CNHU2a2JQqUSE2dbv9D.length > 1 + || !(\\"actor\\" in proxy) + && _2DjTTboo3CNHU2a2JQqUSE2dbv9D.length > 0) { + proxy.actors = _2DjTTboo3CNHU2a2JQqUSE2dbv9D; + } + + const _2MH19yxjn1wnHsNfa5n4JBhJzxyc = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_2MH19yxjn1wnHsNfa5n4JBhJzxyc.length == 1) { + proxy.object = _2MH19yxjn1wnHsNfa5n4JBhJzxyc[0]; + } + + if (_2MH19yxjn1wnHsNfa5n4JBhJzxyc.length > 1 + || !(\\"object\\" in proxy) + && _2MH19yxjn1wnHsNfa5n4JBhJzxyc.length > 0) { + proxy.objects = _2MH19yxjn1wnHsNfa5n4JBhJzxyc; + } + + return proxy; + } + + [Symbol.for(\\"Deno.customInspect\\")]( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"Activity \\" + inspect(proxy, options); + } + } + +/** Indicates that the \`actor\` is \\"following\\" the \`object\`. Following is defined + * in the sense typically used within Social systems in which the actor is + * interested in any activity performed by or on the object. The \`target\` and + * \`origin\` typically have no defined meaning. + * + */ +export class Follow extends Activity { + + /** + * Constructs a new instance of Follow with the given values. + * @param values The values to initialize the instance with. + */ + constructor(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;actor?: Object | Link | URL | null; +actors?: (Object | Link | URL)[];object?: Object | Link | URL | null; +objects?: (Object | Link | URL)[];} +) { +super(values);} + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @returns The cloned instance. + */ + clone(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;actor?: Object | Link | URL | null; +actors?: (Object | Link | URL)[];object?: Object | Link | URL | null; +objects?: (Object | Link | URL)[];} + = {}): Follow { +const clone = super.clone(values) as unknown as Follow; + return clone; + } + + /** + * Converts this object to a JSON-LD structure. + * @returns The JSON-LD representation of this object. + */ + async toJsonLd(options: { + expand?: boolean, + documentLoader?: DocumentLoader + } = {}): Promise { + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + + const baseValues = await super.toJsonLd({ + ...options, + expand: true, + }) as unknown[]; + const values = baseValues[0] as Record; + + values[\\"@type\\"] = [\\"https://www.w3.org/ns/activitystreams#Follow\\"]; + if (this.id) values[\\"@id\\"] = this.id.href; + if (options.expand) { + return await jsonld.expand(values, options); + } + return await jsonld.compact( + values, + \\"https://www.w3.org/ns/activitystreams\\", + options + ); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static async fromJsonLd( + json: unknown, + options: { documentLoader?: DocumentLoader } = {} + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + ...options, + keepFreeFloatingNodes: true, + }); + // deno-lint-ignore no-explicit-any + values = (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + + const instance = await super.fromJsonLd(values, options); + if (!(instance instanceof Follow)) { + throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); + } + + return instance; + } + + protected _getCustomInspectProxy(): Record { + const proxy: Record = super._getCustomInspectProxy(); + return proxy; + } + + [Symbol.for(\\"Deno.customInspect\\")]( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"Follow \\" + inspect(proxy, options); + } + } + +/** Indicates that the \`actor\` is rejecting the \`object\`. The \`target\` and + * \`origin\` typically have no defined meaning. + * + */ +export class Reject extends Activity { + + /** + * Constructs a new instance of Reject with the given values. + * @param values The values to initialize the instance with. + */ + constructor(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;actor?: Object | Link | URL | null; +actors?: (Object | Link | URL)[];object?: Object | Link | URL | null; +objects?: (Object | Link | URL)[];} +) { +super(values);} + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @returns The cloned instance. + */ + clone(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;actor?: Object | Link | URL | null; +actors?: (Object | Link | URL)[];object?: Object | Link | URL | null; +objects?: (Object | Link | URL)[];} + = {}): Reject { +const clone = super.clone(values) as unknown as Reject; + return clone; + } + + /** + * Converts this object to a JSON-LD structure. + * @returns The JSON-LD representation of this object. + */ + async toJsonLd(options: { + expand?: boolean, + documentLoader?: DocumentLoader + } = {}): Promise { + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + + const baseValues = await super.toJsonLd({ + ...options, + expand: true, + }) as unknown[]; + const values = baseValues[0] as Record; + + values[\\"@type\\"] = [\\"https://www.w3.org/ns/activitystreams#Reject\\"]; + if (this.id) values[\\"@id\\"] = this.id.href; + if (options.expand) { + return await jsonld.expand(values, options); + } + return await jsonld.compact( + values, + \\"https://www.w3.org/ns/activitystreams\\", + options + ); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static async fromJsonLd( + json: unknown, + options: { documentLoader?: DocumentLoader } = {} + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + ...options, + keepFreeFloatingNodes: true, + }); + // deno-lint-ignore no-explicit-any + values = (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + + const instance = await super.fromJsonLd(values, options); + if (!(instance instanceof Reject)) { + throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); + } + + return instance; + } + + protected _getCustomInspectProxy(): Record { + const proxy: Record = super._getCustomInspectProxy(); + return proxy; + } + + [Symbol.for(\\"Deno.customInspect\\")]( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"Reject \\" + inspect(proxy, options); + } + } + +/** Describes a relationship between two individuals. + * The {@link Relationship.subject} and {@link Relationship.object} properties + * are used to identify the connected individuals. + * + * See [5.2 Representing Relationships Between + * Entities](https://www.w3.org/TR/activitystreams-vocabulary/#connections) + * for additional information. + * + */ +export class Relationship extends Object { +#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq: (Object | URL)[] = []; +#_2MH19yxjn1wnHsNfa5n4JBhJzxyc: (Object | URL)[] = []; +#_4Lzz89F9qipAQSGkWyX9DGWiUojG: (Object | URL)[] = []; + + /** + * Constructs a new instance of Relationship with the given values. + * @param values The values to initialize the instance with. + */ + constructor(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;subject?: Object | URL | null;object?: Object | URL | null; +objects?: (Object | URL)[];relationship?: Object | URL | null; +relationships?: (Object | URL)[];} +) { +super(values); + if (\\"subject\\" in values && values.subject != null) { + this.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq = [values.subject]; + } + + if (\\"object\\" in values && values.object != null) { + this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc = [values.object]; + } + + if (\\"objects\\" in values && values.objects != null) { + + if (\\"object\\" in values && + values.object != null) { + throw new TypeError( + \\"Cannot initialize both object and \\" + + \\"objects at the same time.\\", + ); + } + + this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc = values.objects; + } + + if (\\"relationship\\" in values && values.relationship != null) { + this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG = [values.relationship]; + } + + if (\\"relationships\\" in values && values.relationships != null) { + + if (\\"relationship\\" in values && + values.relationship != null) { + throw new TypeError( + \\"Cannot initialize both relationship and \\" + + \\"relationships at the same time.\\", + ); + } + + this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG = values.relationships; + } + } + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @returns The cloned instance. + */ + clone(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;subject?: Object | URL | null;object?: Object | URL | null; +objects?: (Object | URL)[];relationship?: Object | URL | null; +relationships?: (Object | URL)[];} + = {}): Relationship { +const clone = super.clone(values) as unknown as Relationship;clone.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq = this.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq; + if (\\"subject\\" in values && values.subject != null) { + clone.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq = [values.subject]; + } + clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc; + if (\\"object\\" in values && values.object != null) { + clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc = [values.object]; + } + + if (\\"objects\\" in values && values.objects != null) { + + if (\\"object\\" in values && + values.object != null) { + throw new TypeError( + \\"Cannot update both object and \\" + + \\"objects at the same time.\\", + ); + } + + clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc = values.objects; + } + clone.#_4Lzz89F9qipAQSGkWyX9DGWiUojG = this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG; + if (\\"relationship\\" in values && values.relationship != null) { + clone.#_4Lzz89F9qipAQSGkWyX9DGWiUojG = [values.relationship]; + } + + if (\\"relationships\\" in values && values.relationships != null) { + + if (\\"relationship\\" in values && + values.relationship != null) { + throw new TypeError( + \\"Cannot update both relationship and \\" + + \\"relationships at the same time.\\", + ); + } + + clone.#_4Lzz89F9qipAQSGkWyX9DGWiUojG = values.relationships; + } + + return clone; + } + + async #fetchSubject( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await Object.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); + } + + /** + * Similar to {@link getSubject()}, + * but returns its \`@id\` URL instead of the object itself. + */ + get subjectId(): URL | null { + if (this.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq.length < 1) return null; + const v = this.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** On a {@link Relationship} object, the {@link Relationship.subject} property + * identifies one of the connected individuals. For instance, + * for a {@link Relationship} object describing \\"John is related to Sally\\", + * the {@link Relationship.subject} property would refer to John. + * + */ + + async getSubject( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + if (this.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq.length < 1) return null; + const v = this.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq[0]; + if (v instanceof URL) { + const fetched = + await this.#fetchSubject(v, options); + this.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq[0] = fetched; + return fetched; + } + return v; + } + + async #fetchObject( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await Object.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); + } + + /** + * Similar to {@link getObject()}, + * but returns its \`@id\` URL instead of the object itself. + */ + get objectId(): URL | null { + if (this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc.length < 1) return null; + const v = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** Describes the entity to which the {@link Relationship.subject} is related. + * + */ + + async getObject( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + if (this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc.length < 1) return null; + const v = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc[0]; + if (v instanceof URL) { + const fetched = + await this.#fetchObject(v, options); + this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc[0] = fetched; + return fetched; + } + return v; + } + + /** + * Similar to {@link getObjects()}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get objectIds(): URL[] { + return this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** Describes the entity to which the {@link Relationship.subject} is related. + * + */ + + async* getObjects( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): AsyncIterable { + const vs = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = + await this.#fetchObject( + v, options); + vs[i] = fetched; + yield fetched; + continue; + } + yield v; + } + } + + async #fetchRelationship( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await Object.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); + } + + /** + * Similar to {@link getRelationship()}, + * but returns its \`@id\` URL instead of the object itself. + */ + get relationshipId(): URL | null { + if (this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG.length < 1) return null; + const v = this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** On a {@link Relationship} object, the {@link Relationship.relationship} + * property identifies the kind of relationship that exists between + * {@link Relationship.subject} and {@link Relationship.object}. + * + */ + + async getRelationship( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + if (this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG.length < 1) return null; + const v = this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG[0]; + if (v instanceof URL) { + const fetched = + await this.#fetchRelationship(v, options); + this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG[0] = fetched; + return fetched; + } + return v; + } + + /** + * Similar to {@link getRelationships()}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get relationshipIds(): URL[] { + return this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** On a {@link Relationship} object, the {@link Relationship.relationship} + * property identifies the kind of relationship that exists between + * {@link Relationship.subject} and {@link Relationship.object}. + * + */ + + async* getRelationships( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): AsyncIterable { + const vs = this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = + await this.#fetchRelationship( + v, options); + vs[i] = fetched; + yield fetched; + continue; + } + yield v; + } + } + + /** + * Converts this object to a JSON-LD structure. + * @returns The JSON-LD representation of this object. + */ + async toJsonLd(options: { + expand?: boolean, + documentLoader?: DocumentLoader + } = {}): Promise { + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + + const baseValues = await super.toJsonLd({ + ...options, + expand: true, + }) as unknown[]; + const values = baseValues[0] as Record; + + array = []; + for (const v of this.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#subject\\"] = array; + + array = []; + for (const v of this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#object\\"] = array; + + array = []; + for (const v of this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#relationship\\"] = array; + + values[\\"@type\\"] = [\\"https://www.w3.org/ns/activitystreams#Relationship\\"]; + if (this.id) values[\\"@id\\"] = this.id.href; + if (options.expand) { + return await jsonld.expand(values, options); + } + return await jsonld.compact( + values, + \\"https://www.w3.org/ns/activitystreams\\", + options + ); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static async fromJsonLd( + json: unknown, + options: { documentLoader?: DocumentLoader } = {} + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + ...options, + keepFreeFloatingNodes: true, + }); + // deno-lint-ignore no-explicit-any + values = (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + + const instance = await super.fromJsonLd(values, options); + if (!(instance instanceof Relationship)) { + throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); + } + const _2Zqdmi46ZnDQsECS6mzwhrv3rUKq: (Object | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#subject\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _2Zqdmi46ZnDQsECS6mzwhrv3rUKq.push(new URL(v[\\"@id\\"])); + continue; + } + _2Zqdmi46ZnDQsECS6mzwhrv3rUKq.push(await Object.fromJsonLd( + v, options)) + } + instance.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq = _2Zqdmi46ZnDQsECS6mzwhrv3rUKq; + const _2MH19yxjn1wnHsNfa5n4JBhJzxyc: (Object | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#object\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _2MH19yxjn1wnHsNfa5n4JBhJzxyc.push(new URL(v[\\"@id\\"])); + continue; + } + _2MH19yxjn1wnHsNfa5n4JBhJzxyc.push(await Object.fromJsonLd( + v, options)) + } + instance.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc = _2MH19yxjn1wnHsNfa5n4JBhJzxyc; + const _4Lzz89F9qipAQSGkWyX9DGWiUojG: (Object | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#relationship\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _4Lzz89F9qipAQSGkWyX9DGWiUojG.push(new URL(v[\\"@id\\"])); + continue; + } + _4Lzz89F9qipAQSGkWyX9DGWiUojG.push(await Object.fromJsonLd( + v, options)) + } + instance.#_4Lzz89F9qipAQSGkWyX9DGWiUojG = _4Lzz89F9qipAQSGkWyX9DGWiUojG; + + return instance; + } + + protected _getCustomInspectProxy(): Record { + const proxy: Record = super._getCustomInspectProxy(); + const _2Zqdmi46ZnDQsECS6mzwhrv3rUKq = this.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_2Zqdmi46ZnDQsECS6mzwhrv3rUKq.length == 1) { + proxy.subject = _2Zqdmi46ZnDQsECS6mzwhrv3rUKq[0]; + } + + const _2MH19yxjn1wnHsNfa5n4JBhJzxyc = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_2MH19yxjn1wnHsNfa5n4JBhJzxyc.length == 1) { + proxy.object = _2MH19yxjn1wnHsNfa5n4JBhJzxyc[0]; + } + + if (_2MH19yxjn1wnHsNfa5n4JBhJzxyc.length > 1 + || !(\\"object\\" in proxy) + && _2MH19yxjn1wnHsNfa5n4JBhJzxyc.length > 0) { + proxy.objects = _2MH19yxjn1wnHsNfa5n4JBhJzxyc; + } + + const _4Lzz89F9qipAQSGkWyX9DGWiUojG = this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_4Lzz89F9qipAQSGkWyX9DGWiUojG.length == 1) { + proxy.relationship = _4Lzz89F9qipAQSGkWyX9DGWiUojG[0]; + } + + if (_4Lzz89F9qipAQSGkWyX9DGWiUojG.length > 1 + || !(\\"relationship\\" in proxy) + && _4Lzz89F9qipAQSGkWyX9DGWiUojG.length > 0) { + proxy.relationships = _4Lzz89F9qipAQSGkWyX9DGWiUojG; + } + + return proxy; + } + + [Symbol.for(\\"Deno.customInspect\\")]( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"Relationship \\" + inspect(proxy, options); + } + } + +/** Indicates that the \`actor\` has deleted the \`object\`. If specified, + * the \`origin\` indicates the context from which the \`object\` was deleted. + * + */ +export class Delete extends Activity { + + /** + * Constructs a new instance of Delete with the given values. + * @param values The values to initialize the instance with. + */ + constructor(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;actor?: Object | Link | URL | null; +actors?: (Object | Link | URL)[];object?: Object | Link | URL | null; +objects?: (Object | Link | URL)[];} +) { +super(values);} + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @returns The cloned instance. + */ + clone(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;actor?: Object | Link | URL | null; +actors?: (Object | Link | URL)[];object?: Object | Link | URL | null; +objects?: (Object | Link | URL)[];} + = {}): Delete { +const clone = super.clone(values) as unknown as Delete; + return clone; + } + + /** + * Converts this object to a JSON-LD structure. + * @returns The JSON-LD representation of this object. + */ + async toJsonLd(options: { + expand?: boolean, + documentLoader?: DocumentLoader + } = {}): Promise { + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + + const baseValues = await super.toJsonLd({ + ...options, + expand: true, + }) as unknown[]; + const values = baseValues[0] as Record; + + values[\\"@type\\"] = [\\"https://www.w3.org/ns/activitystreams#Delete\\"]; + if (this.id) values[\\"@id\\"] = this.id.href; + if (options.expand) { + return await jsonld.expand(values, options); + } + return await jsonld.compact( + values, + \\"https://www.w3.org/ns/activitystreams\\", + options + ); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static async fromJsonLd( + json: unknown, + options: { documentLoader?: DocumentLoader } = {} + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + ...options, + keepFreeFloatingNodes: true, + }); + // deno-lint-ignore no-explicit-any + values = (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + + const instance = await super.fromJsonLd(values, options); + if (!(instance instanceof Delete)) { + throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); + } + + return instance; + } + + protected _getCustomInspectProxy(): Record { + const proxy: Record = super._getCustomInspectProxy(); + return proxy; + } + + [Symbol.for(\\"Deno.customInspect\\")]( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"Delete \\" + inspect(proxy, options); + } + } + +/** Indicates that the \`actor\` is ignoring the \`object\`. The \`target\` and + * \`origin\` typically have no defined meaning. + * + */ +export class Ignore extends Activity { + + /** + * Constructs a new instance of Ignore with the given values. + * @param values The values to initialize the instance with. + */ + constructor(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;actor?: Object | Link | URL | null; +actors?: (Object | Link | URL)[];object?: Object | Link | URL | null; +objects?: (Object | Link | URL)[];} +) { +super(values);} + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @returns The cloned instance. + */ + clone(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;actor?: Object | Link | URL | null; +actors?: (Object | Link | URL)[];object?: Object | Link | URL | null; +objects?: (Object | Link | URL)[];} + = {}): Ignore { +const clone = super.clone(values) as unknown as Ignore; + return clone; + } + + /** + * Converts this object to a JSON-LD structure. + * @returns The JSON-LD representation of this object. + */ + async toJsonLd(options: { + expand?: boolean, + documentLoader?: DocumentLoader + } = {}): Promise { + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + + const baseValues = await super.toJsonLd({ + ...options, + expand: true, + }) as unknown[]; + const values = baseValues[0] as Record; + + values[\\"@type\\"] = [\\"https://www.w3.org/ns/activitystreams#Ignore\\"]; + if (this.id) values[\\"@id\\"] = this.id.href; + if (options.expand) { + return await jsonld.expand(values, options); + } + return await jsonld.compact( + values, + \\"https://www.w3.org/ns/activitystreams\\", + options + ); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static async fromJsonLd( + json: unknown, + options: { documentLoader?: DocumentLoader } = {} + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + ...options, + keepFreeFloatingNodes: true, + }); + // deno-lint-ignore no-explicit-any + values = (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + if (\\"@type\\" in values) { + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Block\\")) { + delete values[\\"@type\\"]; + return await Block.fromJsonLd(values, options); + } + + if (!values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Ignore\\")) { + throw new TypeError(\\"Invalid type: \\" + values[\\"@type\\"]); + } + } + + const instance = await super.fromJsonLd(values, options); + if (!(instance instanceof Ignore)) { + throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); + } + + return instance; + } + + protected _getCustomInspectProxy(): Record { + const proxy: Record = super._getCustomInspectProxy(); + return proxy; + } + + [Symbol.for(\\"Deno.customInspect\\")]( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"Ignore \\" + inspect(proxy, options); + } + } + +/** Indicates that the \`actor\` is blocking the \`object\`. Blocking is a stronger + * form of {@link Ignore}. The typical use is to support social systems that + * allow one user to block activities or content of other users. The \`target\` + * and \`origin\` typically have no defined meaning. + * + */ +export class Block extends Ignore { + + /** + * Constructs a new instance of Block with the given values. + * @param values The values to initialize the instance with. + */ + constructor(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;actor?: Object | Link | URL | null; +actors?: (Object | Link | URL)[];object?: Object | Link | URL | null; +objects?: (Object | Link | URL)[];} +) { +super(values);} + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @returns The cloned instance. + */ + clone(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;actor?: Object | Link | URL | null; +actors?: (Object | Link | URL)[];object?: Object | Link | URL | null; +objects?: (Object | Link | URL)[];} + = {}): Block { +const clone = super.clone(values) as unknown as Block; + return clone; + } + + /** + * Converts this object to a JSON-LD structure. + * @returns The JSON-LD representation of this object. + */ + async toJsonLd(options: { + expand?: boolean, + documentLoader?: DocumentLoader + } = {}): Promise { + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + + const baseValues = await super.toJsonLd({ + ...options, + expand: true, + }) as unknown[]; + const values = baseValues[0] as Record; + + values[\\"@type\\"] = [\\"https://www.w3.org/ns/activitystreams#Block\\"]; + if (this.id) values[\\"@id\\"] = this.id.href; + if (options.expand) { + return await jsonld.expand(values, options); + } + return await jsonld.compact( + values, + \\"https://www.w3.org/ns/activitystreams\\", + options + ); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static async fromJsonLd( + json: unknown, + options: { documentLoader?: DocumentLoader } = {} + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + ...options, + keepFreeFloatingNodes: true, + }); + // deno-lint-ignore no-explicit-any + values = (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + + const instance = await super.fromJsonLd(values, options); + if (!(instance instanceof Block)) { + throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); + } + + return instance; + } + + protected _getCustomInspectProxy(): Record { + const proxy: Record = super._getCustomInspectProxy(); + return proxy; + } + + [Symbol.for(\\"Deno.customInspect\\")]( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"Block \\" + inspect(proxy, options); + } + } + +/** Represents a short written work typically less than a single paragraph in + * length. + * + */ +export class Note extends Object { + + /** + * Constructs a new instance of Note with the given values. + * @param values The values to initialize the instance with. + */ + constructor(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;} +) { +super(values);} + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @returns The cloned instance. + */ + clone(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;} + = {}): Note { +const clone = super.clone(values) as unknown as Note; + return clone; + } + + /** + * Converts this object to a JSON-LD structure. + * @returns The JSON-LD representation of this object. + */ + async toJsonLd(options: { + expand?: boolean, + documentLoader?: DocumentLoader + } = {}): Promise { + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + + const baseValues = await super.toJsonLd({ + ...options, + expand: true, + }) as unknown[]; + const values = baseValues[0] as Record; + + values[\\"@type\\"] = [\\"https://www.w3.org/ns/activitystreams#Note\\"]; + if (this.id) values[\\"@id\\"] = this.id.href; + if (options.expand) { + return await jsonld.expand(values, options); + } + return await jsonld.compact( + values, + \\"https://www.w3.org/ns/activitystreams\\", + options + ); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static async fromJsonLd( + json: unknown, + options: { documentLoader?: DocumentLoader } = {} + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + ...options, + keepFreeFloatingNodes: true, + }); + // deno-lint-ignore no-explicit-any + values = (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + + const instance = await super.fromJsonLd(values, options); + if (!(instance instanceof Note)) { + throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); + } + + return instance; + } + + protected _getCustomInspectProxy(): Record { + const proxy: Record = super._getCustomInspectProxy(); + return proxy; + } + + [Symbol.for(\\"Deno.customInspect\\")]( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"Note \\" + inspect(proxy, options); + } + } + +/** Indicates that the \`actor\` likes, recommends or endorses the \`object\`. + * The \`target\` and \`origin\` typically have no defined meaning. + * + */ +export class Like extends Activity { + + /** + * Constructs a new instance of Like with the given values. + * @param values The values to initialize the instance with. + */ + constructor(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;actor?: Object | Link | URL | null; +actors?: (Object | Link | URL)[];object?: Object | Link | URL | null; +objects?: (Object | Link | URL)[];} +) { +super(values);} + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @returns The cloned instance. + */ + clone(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;actor?: Object | Link | URL | null; +actors?: (Object | Link | URL)[];object?: Object | Link | URL | null; +objects?: (Object | Link | URL)[];} + = {}): Like { +const clone = super.clone(values) as unknown as Like; + return clone; + } + + /** + * Converts this object to a JSON-LD structure. + * @returns The JSON-LD representation of this object. + */ + async toJsonLd(options: { + expand?: boolean, + documentLoader?: DocumentLoader + } = {}): Promise { + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + + const baseValues = await super.toJsonLd({ + ...options, + expand: true, + }) as unknown[]; + const values = baseValues[0] as Record; + + values[\\"@type\\"] = [\\"https://www.w3.org/ns/activitystreams#Like\\"]; + if (this.id) values[\\"@id\\"] = this.id.href; + if (options.expand) { + return await jsonld.expand(values, options); + } + return await jsonld.compact( + values, + \\"https://www.w3.org/ns/activitystreams\\", + options + ); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static async fromJsonLd( + json: unknown, + options: { documentLoader?: DocumentLoader } = {} + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + ...options, + keepFreeFloatingNodes: true, + }); + // deno-lint-ignore no-explicit-any + values = (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + + const instance = await super.fromJsonLd(values, options); + if (!(instance instanceof Like)) { + throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); + } + + return instance; + } + + protected _getCustomInspectProxy(): Record { + const proxy: Record = super._getCustomInspectProxy(); + return proxy; + } + + [Symbol.for(\\"Deno.customInspect\\")]( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"Like \\" + inspect(proxy, options); + } + } + +/** Represents an individual person. + */ +export class Person extends Object { +#_3isuDgRAKSntq9XdbjiNxjwyPZAf: (string | LanguageString)[] = []; +#_axq166E2eZADq34V4MYUc8KMZdC: (CryptographicKey | URL)[] = []; +#_36QNc9MxfkKf6h8sEUQSHnV9NZA: boolean[] = []; +#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB: (OrderedCollection | URL)[] = []; +#_41QwhqJouoLg3h8dRPKat21brynC: (OrderedCollection | URL)[] = []; +#_3yAv8jymNfNuJUDuBzJ1NQhdbAee: (Collection | URL)[] = []; +#_BBCTgfphhsFzpVfKTykGSpBNwoA: (Collection | URL)[] = []; +#_3bgkPwJanyTCoVFM9ovRcus8tKkU: (Collection | URL)[] = []; +#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9: (Collection | URL)[] = []; +#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG: Endpoints[] = []; + + /** + * Constructs a new instance of Person with the given values. + * @param values The values to initialize the instance with. + */ + constructor(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;preferredUsername?: string | LanguageString | null; +preferredUsernames?: (string | LanguageString)[];publicKey?: CryptographicKey | URL | null; +publicKeys?: (CryptographicKey | URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | URL | null;outbox?: OrderedCollection | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;linked?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;} +) { +super(values); + if (\\"preferredUsername\\" in values && values.preferredUsername != null) { + this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf = [values.preferredUsername]; + } + + if (\\"preferredUsernames\\" in values && values.preferredUsernames != null) { + + if (\\"preferredUsername\\" in values && + values.preferredUsername != null) { + throw new TypeError( + \\"Cannot initialize both preferredUsername and \\" + + \\"preferredUsernames at the same time.\\", + ); + } + + this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf = values.preferredUsernames; + } + + if (\\"publicKey\\" in values && values.publicKey != null) { + this.#_axq166E2eZADq34V4MYUc8KMZdC = [values.publicKey]; + } + + if (\\"publicKeys\\" in values && values.publicKeys != null) { + + if (\\"publicKey\\" in values && + values.publicKey != null) { + throw new TypeError( + \\"Cannot initialize both publicKey and \\" + + \\"publicKeys at the same time.\\", + ); + } + + this.#_axq166E2eZADq34V4MYUc8KMZdC = values.publicKeys; + } + + if (\\"manuallyApprovesFollowers\\" in values && values.manuallyApprovesFollowers != null) { + this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA = [values.manuallyApprovesFollowers]; + } + + if (\\"inbox\\" in values && values.inbox != null) { + this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB = [values.inbox]; + } + + if (\\"outbox\\" in values && values.outbox != null) { + this.#_41QwhqJouoLg3h8dRPKat21brynC = [values.outbox]; + } + + if (\\"following\\" in values && values.following != null) { + this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee = [values.following]; + } + + if (\\"followers\\" in values && values.followers != null) { + this.#_BBCTgfphhsFzpVfKTykGSpBNwoA = [values.followers]; + } + + if (\\"linked\\" in values && values.linked != null) { + this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU = [values.linked]; + } + + if (\\"streams\\" in values && values.streams != null) { + + this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = values.streams; + } + + if (\\"endpoints\\" in values && values.endpoints != null) { + this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG = [values.endpoints]; + } + } + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @returns The cloned instance. + */ + clone(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;preferredUsername?: string | LanguageString | null; +preferredUsernames?: (string | LanguageString)[];publicKey?: CryptographicKey | URL | null; +publicKeys?: (CryptographicKey | URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | URL | null;outbox?: OrderedCollection | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;linked?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;} + = {}): Person { +const clone = super.clone(values) as unknown as Person;clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf = this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf; + if (\\"preferredUsername\\" in values && values.preferredUsername != null) { + clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf = [values.preferredUsername]; + } + + if (\\"preferredUsernames\\" in values && values.preferredUsernames != null) { + + if (\\"preferredUsername\\" in values && + values.preferredUsername != null) { + throw new TypeError( + \\"Cannot update both preferredUsername and \\" + + \\"preferredUsernames at the same time.\\", + ); + } + + clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf = values.preferredUsernames; + } + clone.#_axq166E2eZADq34V4MYUc8KMZdC = this.#_axq166E2eZADq34V4MYUc8KMZdC; + if (\\"publicKey\\" in values && values.publicKey != null) { + clone.#_axq166E2eZADq34V4MYUc8KMZdC = [values.publicKey]; + } + + if (\\"publicKeys\\" in values && values.publicKeys != null) { + + if (\\"publicKey\\" in values && + values.publicKey != null) { + throw new TypeError( + \\"Cannot update both publicKey and \\" + + \\"publicKeys at the same time.\\", + ); + } + + clone.#_axq166E2eZADq34V4MYUc8KMZdC = values.publicKeys; + } + clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA; + if (\\"manuallyApprovesFollowers\\" in values && values.manuallyApprovesFollowers != null) { + clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA = [values.manuallyApprovesFollowers]; + } + clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB; + if (\\"inbox\\" in values && values.inbox != null) { + clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB = [values.inbox]; + } + clone.#_41QwhqJouoLg3h8dRPKat21brynC = this.#_41QwhqJouoLg3h8dRPKat21brynC; + if (\\"outbox\\" in values && values.outbox != null) { + clone.#_41QwhqJouoLg3h8dRPKat21brynC = [values.outbox]; + } + clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee; + if (\\"following\\" in values && values.following != null) { + clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee = [values.following]; + } + clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA; + if (\\"followers\\" in values && values.followers != null) { + clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA = [values.followers]; + } + clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU; + if (\\"linked\\" in values && values.linked != null) { + clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU = [values.linked]; + } + clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9; + if (\\"streams\\" in values && values.streams != null) { + + clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = values.streams; + } + clone.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG = this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG; + if (\\"endpoints\\" in values && values.endpoints != null) { + clone.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG = [values.endpoints]; + } + + return clone; + } + +/** A short username which may be used to refer to the actor, + * with no uniqueness guarantees. + * + */ +get preferredUsername(): (string | LanguageString | null) { + if (this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf.length < 1) return null; + return this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf[0]; + } + +/** A short username which may be used to refer to the actor, + * with no uniqueness guarantees. + * + */ +get preferredUsernames(): (string | LanguageString)[] { + return this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf; + } + + async #fetchPublicKey( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await CryptographicKey.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://w3id.org/security#Key\\"].join(\\", \\")); + } + + /** + * Similar to {@link getPublicKey()}, + * but returns its \`@id\` URL instead of the object itself. + */ + get publicKeyId(): URL | null { + if (this.#_axq166E2eZADq34V4MYUc8KMZdC.length < 1) return null; + const v = this.#_axq166E2eZADq34V4MYUc8KMZdC[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** A public part of the key pair owned by this actor. + */ + + async getPublicKey( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + if (this.#_axq166E2eZADq34V4MYUc8KMZdC.length < 1) return null; + const v = this.#_axq166E2eZADq34V4MYUc8KMZdC[0]; + if (v instanceof URL) { + const fetched = + await this.#fetchPublicKey(v, options); + this.#_axq166E2eZADq34V4MYUc8KMZdC[0] = fetched; + return fetched; + } + return v; + } + + /** + * Similar to {@link getPublicKeys()}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get publicKeyIds(): URL[] { + return this.#_axq166E2eZADq34V4MYUc8KMZdC.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** A public part of the key pair owned by this actor. + */ + + async* getPublicKeys( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): AsyncIterable { + const vs = this.#_axq166E2eZADq34V4MYUc8KMZdC; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = + await this.#fetchPublicKey( + v, options); + vs[i] = fetched; + yield fetched; + continue; + } + yield v; + } + } + +/** When \`true\`, conveys that for this actor, follow requests are not usually + * automatically approved, but instead are examined by a person who may accept + * or reject the request, at some time in the future. Setting of \`false\` + * conveys no information and may be ignored. This information is typically + * used to affect display of accounts, such as showing an account as private or + * locked. + * + */ +get manuallyApprovesFollowers(): (boolean | null) { + if (this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA.length < 1) return null; + return this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA[0]; + } + + async #fetchInbox( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await OrderedCollection.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\"].join(\\", \\")); + } + + /** + * Similar to {@link getInbox()}, + * but returns its \`@id\` URL instead of the object itself. + */ + get inboxId(): URL | null { + if (this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB.length < 1) return null; + const v = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** The inbox stream contains all activities received by the actor. The server + * SHOULD filter content according to the requester's permission. In general, + * the owner of an inbox is likely to be able to access all of their inbox + * contents. Depending on access control, some other content may be public, + * whereas other content may require authentication for non-owner users, + * if they can access the inbox at all. + * + * The server MUST perform de-duplication of activities returned by the inbox. + * Duplication can occur if an activity is addressed both to an actor's + * followers, and a specific actor who also follows the recipient actor, + * and the server has failed to de-duplicate the recipients list. + * Such deduplication MUST be performed by comparing the \`id\` of the activities + * and dropping any activities already seen. + * + */ + + async getInbox( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + if (this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB.length < 1) return null; + const v = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB[0]; + if (v instanceof URL) { + const fetched = + await this.#fetchInbox(v, options); + this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB[0] = fetched; + return fetched; + } + return v; + } + + async #fetchOutbox( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await OrderedCollection.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\"].join(\\", \\")); + } + + /** + * Similar to {@link getOutbox()}, + * but returns its \`@id\` URL instead of the object itself. + */ + get outboxId(): URL | null { + if (this.#_41QwhqJouoLg3h8dRPKat21brynC.length < 1) return null; + const v = this.#_41QwhqJouoLg3h8dRPKat21brynC[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** The outbox stream contains activities the user has published, + * subject to the ability of the requestor to retrieve the activity + * (that is, the contents of the outbox are filtered by the permissions of + * the person reading it). If a user submits a request without + * [Authorization](https://www.w3.org/TR/activitypub/#authorization) + * the server should respond with all of the + * [Public](https://www.w3.org/TR/activitypub/#public-addressing) posts. + * This could potentially be all relevant objects published by the user, + * though the number of available items is left to the discretion of those + * implementing and deploying the server. + * + */ + + async getOutbox( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + if (this.#_41QwhqJouoLg3h8dRPKat21brynC.length < 1) return null; + const v = this.#_41QwhqJouoLg3h8dRPKat21brynC[0]; + if (v instanceof URL) { + const fetched = + await this.#fetchOutbox(v, options); + this.#_41QwhqJouoLg3h8dRPKat21brynC[0] = fetched; + return fetched; + } + return v; + } + + async #fetchFollowing( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await Collection.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Collection\\"].join(\\", \\")); + } + + /** + * Similar to {@link getFollowing()}, + * but returns its \`@id\` URL instead of the object itself. + */ + get followingId(): URL | null { + if (this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee.length < 1) return null; + const v = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** This is a list of everybody that the actor has followed, added as a + * [side effect](https://www.w3.org/TR/activitypub/#follow-activity-outbox). + * The \`following\` collection MUST be either an {@link OrderedCollection} + * or a {@link Collection} and MAY be filtered on privileges of + * an authenticated user or as appropriate when no authentication is given. + * + */ + + async getFollowing( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + if (this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee.length < 1) return null; + const v = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee[0]; + if (v instanceof URL) { + const fetched = + await this.#fetchFollowing(v, options); + this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee[0] = fetched; + return fetched; + } + return v; + } + + async #fetchFollowers( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await Collection.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Collection\\"].join(\\", \\")); + } + + /** + * Similar to {@link getFollowers()}, + * but returns its \`@id\` URL instead of the object itself. + */ + get followersId(): URL | null { + if (this.#_BBCTgfphhsFzpVfKTykGSpBNwoA.length < 1) return null; + const v = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** This is a list of everyone who has sent a {@link Follow} activity + * for the actor, added as a + * [side effect](https://www.w3.org/TR/activitypub/#follow-activity-outbox). + * This is where one would find a list of all the actors that are following + * the actor. The \`followers\` collection MUST be either + * an {@link OrderedCollection} or a {@link Collection} and MAY be filtered on + * privileges of an authenticated user or as appropriate when no authentication + * is given. + * + */ + + async getFollowers( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + if (this.#_BBCTgfphhsFzpVfKTykGSpBNwoA.length < 1) return null; + const v = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA[0]; + if (v instanceof URL) { + const fetched = + await this.#fetchFollowers(v, options); + this.#_BBCTgfphhsFzpVfKTykGSpBNwoA[0] = fetched; + return fetched; + } + return v; + } + + async #fetchLinked( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await Collection.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Collection\\"].join(\\", \\")); + } + + /** + * Similar to {@link getLinked()}, + * but returns its \`@id\` URL instead of the object itself. + */ + get linkedId(): URL | null { + if (this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU.length < 1) return null; + const v = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** This is a list of every object from all of the actor's {@link Like} + * activities, added as a + * [side effect](https://www.w3.org/TR/activitypub/#like-activity-outbox). + * The \`liked\` collection MUST be either an {@link OrderedCollection} or + * a {@link Collection} and MAY be filtered on privileges of an authenticated + * user or as appropriate when no authentication is given. + * + */ + + async getLinked( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + if (this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU.length < 1) return null; + const v = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU[0]; + if (v instanceof URL) { + const fetched = + await this.#fetchLinked(v, options); + this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU[0] = fetched; + return fetched; + } + return v; + } + + async #fetchStream( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await Collection.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Collection\\"].join(\\", \\")); + } + + /** + * Similar to {@link getStreams()}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get streamIds(): URL[] { + return this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** A list of supplementary Collections which may be of interest. + * + */ + + async* getStreams( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): AsyncIterable { + const vs = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = + await this.#fetchStream( + v, options); + vs[i] = fetched; + yield fetched; + continue; + } + yield v; + } + } + +/** A JSON object which maps additional (typically server/domain-wide) endpoints + * which may be useful either for this actor or someone referencing this actor. + * This mapping may be nested inside the actor document as the value or may be + * a link to a JSON-LD document with these properties. + * + */ +get endpoints(): (Endpoints | null) { + if (this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG.length < 1) return null; + return this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG[0]; + } + + /** + * Converts this object to a JSON-LD structure. + * @returns The JSON-LD representation of this object. + */ + async toJsonLd(options: { + expand?: boolean, + documentLoader?: DocumentLoader + } = {}): Promise { + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + + const baseValues = await super.toJsonLd({ + ...options, + expand: true, + }) as unknown[]; + const values = baseValues[0] as Record; + + array = []; + for (const v of this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf) { + array.push( + typeof v === \\"string\\" ? { \\"@value\\": v } : { + \\"@value\\": v.toString(), + \\"@language\\": v.language.compact(), + } + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#preferredUsername\\"] = array; + + array = []; + for (const v of this.#_axq166E2eZADq34V4MYUc8KMZdC) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://w3id.org/security#publicKey\\"] = array; + + array = []; + for (const v of this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA) { + array.push( + { \\"@value\\": v } + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers\\"] = array; + + array = []; + for (const v of this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"http://www.w3.org/ns/ldp#inbox\\"] = array; + + array = []; + for (const v of this.#_41QwhqJouoLg3h8dRPKat21brynC) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#outbox\\"] = array; + + array = []; + for (const v of this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#following\\"] = array; + + array = []; + for (const v of this.#_BBCTgfphhsFzpVfKTykGSpBNwoA) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#followers\\"] = array; + + array = []; + for (const v of this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#liked\\"] = array; + + array = []; + for (const v of this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#streams\\"] = array; + + array = []; + for (const v of this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG) { + array.push( + await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#endpoints\\"] = array; + + values[\\"@type\\"] = [\\"https://www.w3.org/ns/activitystreams#Person\\"]; + if (this.id) values[\\"@id\\"] = this.id.href; + if (options.expand) { + return await jsonld.expand(values, options); + } + return await jsonld.compact( + values, + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\"], + options + ); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static async fromJsonLd( + json: unknown, + options: { documentLoader?: DocumentLoader } = {} + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + ...options, + keepFreeFloatingNodes: true, + }); + // deno-lint-ignore no-explicit-any + values = (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + + const instance = await super.fromJsonLd(values, options); + if (!(instance instanceof Person)) { + throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); + } + const _3isuDgRAKSntq9XdbjiNxjwyPZAf: (string | LanguageString)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#preferredUsername\\"] ?? []) { + if (v == null) continue; + + const decoded = + typeof v === \\"object\\" && \\"@value\\" in v + && typeof v[\\"@value\\"] === \\"string\\" && !(\\"@language\\" in v) ? v[\\"@value\\"] : typeof v === \\"object\\" && \\"@language\\" in v && \\"@value\\" in v + && typeof v[\\"@language\\"] === \\"string\\" + && typeof v[\\"@value\\"] === \\"string\\" ? new LanguageString(v[\\"@value\\"], v[\\"@language\\"]) : undefined + ; + if (typeof decoded === \\"undefined\\") continue; + _3isuDgRAKSntq9XdbjiNxjwyPZAf.push(decoded); + + } + instance.#_3isuDgRAKSntq9XdbjiNxjwyPZAf = _3isuDgRAKSntq9XdbjiNxjwyPZAf; + const _axq166E2eZADq34V4MYUc8KMZdC: (CryptographicKey | URL)[] = []; + + for (const v of values[\\"https://w3id.org/security#publicKey\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _axq166E2eZADq34V4MYUc8KMZdC.push(new URL(v[\\"@id\\"])); + continue; + } + _axq166E2eZADq34V4MYUc8KMZdC.push(await CryptographicKey.fromJsonLd( + v, options)) + } + instance.#_axq166E2eZADq34V4MYUc8KMZdC = _axq166E2eZADq34V4MYUc8KMZdC; + const _36QNc9MxfkKf6h8sEUQSHnV9NZA: boolean[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers\\"] ?? []) { + if (v == null) continue; + _36QNc9MxfkKf6h8sEUQSHnV9NZA.push(v[\\"@value\\"]) + } + instance.#_36QNc9MxfkKf6h8sEUQSHnV9NZA = _36QNc9MxfkKf6h8sEUQSHnV9NZA; + const _3ghX3VfZXXbLvhCRH7QJqpzLrXjB: (OrderedCollection | URL)[] = []; + + for (const v of values[\\"http://www.w3.org/ns/ldp#inbox\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _3ghX3VfZXXbLvhCRH7QJqpzLrXjB.push(new URL(v[\\"@id\\"])); + continue; + } + _3ghX3VfZXXbLvhCRH7QJqpzLrXjB.push(await OrderedCollection.fromJsonLd( + v, options)) + } + instance.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB = _3ghX3VfZXXbLvhCRH7QJqpzLrXjB; + const _41QwhqJouoLg3h8dRPKat21brynC: (OrderedCollection | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#outbox\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _41QwhqJouoLg3h8dRPKat21brynC.push(new URL(v[\\"@id\\"])); + continue; + } + _41QwhqJouoLg3h8dRPKat21brynC.push(await OrderedCollection.fromJsonLd( + v, options)) + } + instance.#_41QwhqJouoLg3h8dRPKat21brynC = _41QwhqJouoLg3h8dRPKat21brynC; + const _3yAv8jymNfNuJUDuBzJ1NQhdbAee: (Collection | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#following\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _3yAv8jymNfNuJUDuBzJ1NQhdbAee.push(new URL(v[\\"@id\\"])); + continue; + } + _3yAv8jymNfNuJUDuBzJ1NQhdbAee.push(await Collection.fromJsonLd( + v, options)) + } + instance.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee = _3yAv8jymNfNuJUDuBzJ1NQhdbAee; + const _BBCTgfphhsFzpVfKTykGSpBNwoA: (Collection | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#followers\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _BBCTgfphhsFzpVfKTykGSpBNwoA.push(new URL(v[\\"@id\\"])); + continue; + } + _BBCTgfphhsFzpVfKTykGSpBNwoA.push(await Collection.fromJsonLd( + v, options)) + } + instance.#_BBCTgfphhsFzpVfKTykGSpBNwoA = _BBCTgfphhsFzpVfKTykGSpBNwoA; + const _3bgkPwJanyTCoVFM9ovRcus8tKkU: (Collection | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#liked\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _3bgkPwJanyTCoVFM9ovRcus8tKkU.push(new URL(v[\\"@id\\"])); + continue; + } + _3bgkPwJanyTCoVFM9ovRcus8tKkU.push(await Collection.fromJsonLd( + v, options)) + } + instance.#_3bgkPwJanyTCoVFM9ovRcus8tKkU = _3bgkPwJanyTCoVFM9ovRcus8tKkU; + const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9: (Collection | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#streams\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _3sG2Hdwn9qzKGu9mpYkqakAMUkH9.push(new URL(v[\\"@id\\"])); + continue; + } + _3sG2Hdwn9qzKGu9mpYkqakAMUkH9.push(await Collection.fromJsonLd( + v, options)) + } + instance.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = _3sG2Hdwn9qzKGu9mpYkqakAMUkH9; + const _sEoQwUbfk4hEfugzNQ2ZiDcLMkG: Endpoints[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#endpoints\\"] ?? []) { + if (v == null) continue; + _sEoQwUbfk4hEfugzNQ2ZiDcLMkG.push(await Endpoints.fromJsonLd( + v, options)) + } + instance.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG = _sEoQwUbfk4hEfugzNQ2ZiDcLMkG; + + return instance; + } + + protected _getCustomInspectProxy(): Record { + const proxy: Record = super._getCustomInspectProxy();const _3isuDgRAKSntq9XdbjiNxjwyPZAf = this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf; + if (_3isuDgRAKSntq9XdbjiNxjwyPZAf.length == 1) { + proxy.preferredUsername = _3isuDgRAKSntq9XdbjiNxjwyPZAf[0]; + } + + if (_3isuDgRAKSntq9XdbjiNxjwyPZAf.length > 1 + || !(\\"preferredUsername\\" in proxy) + && _3isuDgRAKSntq9XdbjiNxjwyPZAf.length > 0) { + proxy.preferredUsernames = _3isuDgRAKSntq9XdbjiNxjwyPZAf; + } + + const _axq166E2eZADq34V4MYUc8KMZdC = this.#_axq166E2eZADq34V4MYUc8KMZdC.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_axq166E2eZADq34V4MYUc8KMZdC.length == 1) { + proxy.publicKey = _axq166E2eZADq34V4MYUc8KMZdC[0]; + } + + if (_axq166E2eZADq34V4MYUc8KMZdC.length > 1 + || !(\\"publicKey\\" in proxy) + && _axq166E2eZADq34V4MYUc8KMZdC.length > 0) { + proxy.publicKeys = _axq166E2eZADq34V4MYUc8KMZdC; + } + const _36QNc9MxfkKf6h8sEUQSHnV9NZA = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA; + if (_36QNc9MxfkKf6h8sEUQSHnV9NZA.length == 1) { + proxy.manuallyApprovesFollowers = _36QNc9MxfkKf6h8sEUQSHnV9NZA[0]; + } + + const _3ghX3VfZXXbLvhCRH7QJqpzLrXjB = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_3ghX3VfZXXbLvhCRH7QJqpzLrXjB.length == 1) { + proxy.inbox = _3ghX3VfZXXbLvhCRH7QJqpzLrXjB[0]; + } + + const _41QwhqJouoLg3h8dRPKat21brynC = this.#_41QwhqJouoLg3h8dRPKat21brynC.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_41QwhqJouoLg3h8dRPKat21brynC.length == 1) { + proxy.outbox = _41QwhqJouoLg3h8dRPKat21brynC[0]; + } + + const _3yAv8jymNfNuJUDuBzJ1NQhdbAee = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_3yAv8jymNfNuJUDuBzJ1NQhdbAee.length == 1) { + proxy.following = _3yAv8jymNfNuJUDuBzJ1NQhdbAee[0]; + } + + const _BBCTgfphhsFzpVfKTykGSpBNwoA = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_BBCTgfphhsFzpVfKTykGSpBNwoA.length == 1) { + proxy.followers = _BBCTgfphhsFzpVfKTykGSpBNwoA[0]; + } + + const _3bgkPwJanyTCoVFM9ovRcus8tKkU = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_3bgkPwJanyTCoVFM9ovRcus8tKkU.length == 1) { + proxy.linked = _3bgkPwJanyTCoVFM9ovRcus8tKkU[0]; + } + + const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_3sG2Hdwn9qzKGu9mpYkqakAMUkH9.length > 1 + || !(\\"stream\\" in proxy) + && _3sG2Hdwn9qzKGu9mpYkqakAMUkH9.length > 0) { + proxy.streams = _3sG2Hdwn9qzKGu9mpYkqakAMUkH9; + } + const _sEoQwUbfk4hEfugzNQ2ZiDcLMkG = this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG; + if (_sEoQwUbfk4hEfugzNQ2ZiDcLMkG.length == 1) { + proxy.endpoints = _sEoQwUbfk4hEfugzNQ2ZiDcLMkG[0]; + } + + return proxy; + } + + [Symbol.for(\\"Deno.customInspect\\")]( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"Person \\" + inspect(proxy, options); + } + } + +/** Represents any kind of event. + */ +export class Event extends Object { + + /** + * Constructs a new instance of Event with the given values. + * @param values The values to initialize the instance with. + */ + constructor(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;} +) { +super(values);} + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @returns The cloned instance. + */ + clone(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;} + = {}): Event { +const clone = super.clone(values) as unknown as Event; + return clone; + } + + /** + * Converts this object to a JSON-LD structure. + * @returns The JSON-LD representation of this object. + */ + async toJsonLd(options: { + expand?: boolean, + documentLoader?: DocumentLoader + } = {}): Promise { + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + + const baseValues = await super.toJsonLd({ + ...options, + expand: true, + }) as unknown[]; + const values = baseValues[0] as Record; + + values[\\"@type\\"] = [\\"https://www.w3.org/ns/activitystreams#Event\\"]; + if (this.id) values[\\"@id\\"] = this.id.href; + if (options.expand) { + return await jsonld.expand(values, options); + } + return await jsonld.compact( + values, + \\"https://www.w3.org/ns/activitystreams\\", + options + ); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static async fromJsonLd( + json: unknown, + options: { documentLoader?: DocumentLoader } = {} + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + ...options, + keepFreeFloatingNodes: true, + }); + // deno-lint-ignore no-explicit-any + values = (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + + const instance = await super.fromJsonLd(values, options); + if (!(instance instanceof Event)) { + throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); + } + + return instance; + } + + protected _getCustomInspectProxy(): Record { + const proxy: Record = super._getCustomInspectProxy(); + return proxy; + } + + [Symbol.for(\\"Deno.customInspect\\")]( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"Event \\" + inspect(proxy, options); + } + } + +/** A subtype of {@link Collection} in which members of the logical collection + * are assumed to always be strictly ordered. + * + */ +export class OrderedCollection extends Collection { + + /** + * Constructs a new instance of OrderedCollection with the given values. + * @param values The values to initialize the instance with. + */ + constructor(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;totalItems?: number | null;current?: CollectionPage | Link | URL | null;first?: CollectionPage | Link | URL | null;last?: CollectionPage | Link | URL | null;items?: (Object | Link | URL)[];} +) { +super(values);} + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @returns The cloned instance. + */ + clone(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;totalItems?: number | null;current?: CollectionPage | Link | URL | null;first?: CollectionPage | Link | URL | null;last?: CollectionPage | Link | URL | null;items?: (Object | Link | URL)[];} + = {}): OrderedCollection { +const clone = super.clone(values) as unknown as OrderedCollection; + return clone; + } + + /** + * Converts this object to a JSON-LD structure. + * @returns The JSON-LD representation of this object. + */ + async toJsonLd(options: { + expand?: boolean, + documentLoader?: DocumentLoader + } = {}): Promise { + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + + const baseValues = await super.toJsonLd({ + ...options, + expand: true, + }) as unknown[]; + const values = baseValues[0] as Record; + + values[\\"@type\\"] = [\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\"]; + if (this.id) values[\\"@id\\"] = this.id.href; + if (options.expand) { + return await jsonld.expand(values, options); + } + return await jsonld.compact( + values, + \\"https://www.w3.org/ns/activitystreams\\", + options + ); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static async fromJsonLd( + json: unknown, + options: { documentLoader?: DocumentLoader } = {} + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + ...options, + keepFreeFloatingNodes: true, + }); + // deno-lint-ignore no-explicit-any + values = (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + + const instance = await super.fromJsonLd(values, options); + if (!(instance instanceof OrderedCollection)) { + throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); + } + + return instance; + } + + protected _getCustomInspectProxy(): Record { + const proxy: Record = super._getCustomInspectProxy(); + return proxy; + } + + [Symbol.for(\\"Deno.customInspect\\")]( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"OrderedCollection \\" + inspect(proxy, options); + } + } + +/** Represents a service of any kind. + */ +export class Service extends Object { +#_3isuDgRAKSntq9XdbjiNxjwyPZAf: (string | LanguageString)[] = []; +#_axq166E2eZADq34V4MYUc8KMZdC: (CryptographicKey | URL)[] = []; +#_36QNc9MxfkKf6h8sEUQSHnV9NZA: boolean[] = []; +#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB: (OrderedCollection | URL)[] = []; +#_41QwhqJouoLg3h8dRPKat21brynC: (OrderedCollection | URL)[] = []; +#_3yAv8jymNfNuJUDuBzJ1NQhdbAee: (Collection | URL)[] = []; +#_BBCTgfphhsFzpVfKTykGSpBNwoA: (Collection | URL)[] = []; +#_3bgkPwJanyTCoVFM9ovRcus8tKkU: (Collection | URL)[] = []; +#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9: (Collection | URL)[] = []; +#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG: Endpoints[] = []; + + /** + * Constructs a new instance of Service with the given values. + * @param values The values to initialize the instance with. + */ + constructor(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;preferredUsername?: string | LanguageString | null; +preferredUsernames?: (string | LanguageString)[];publicKey?: CryptographicKey | URL | null; +publicKeys?: (CryptographicKey | URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | URL | null;outbox?: OrderedCollection | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;linked?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;} +) { +super(values); + if (\\"preferredUsername\\" in values && values.preferredUsername != null) { + this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf = [values.preferredUsername]; + } + + if (\\"preferredUsernames\\" in values && values.preferredUsernames != null) { + + if (\\"preferredUsername\\" in values && + values.preferredUsername != null) { + throw new TypeError( + \\"Cannot initialize both preferredUsername and \\" + + \\"preferredUsernames at the same time.\\", + ); + } + + this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf = values.preferredUsernames; + } + + if (\\"publicKey\\" in values && values.publicKey != null) { + this.#_axq166E2eZADq34V4MYUc8KMZdC = [values.publicKey]; + } + + if (\\"publicKeys\\" in values && values.publicKeys != null) { + + if (\\"publicKey\\" in values && + values.publicKey != null) { + throw new TypeError( + \\"Cannot initialize both publicKey and \\" + + \\"publicKeys at the same time.\\", + ); + } + + this.#_axq166E2eZADq34V4MYUc8KMZdC = values.publicKeys; + } + + if (\\"manuallyApprovesFollowers\\" in values && values.manuallyApprovesFollowers != null) { + this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA = [values.manuallyApprovesFollowers]; + } + + if (\\"inbox\\" in values && values.inbox != null) { + this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB = [values.inbox]; + } + + if (\\"outbox\\" in values && values.outbox != null) { + this.#_41QwhqJouoLg3h8dRPKat21brynC = [values.outbox]; + } + + if (\\"following\\" in values && values.following != null) { + this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee = [values.following]; + } + + if (\\"followers\\" in values && values.followers != null) { + this.#_BBCTgfphhsFzpVfKTykGSpBNwoA = [values.followers]; + } + + if (\\"linked\\" in values && values.linked != null) { + this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU = [values.linked]; + } + + if (\\"streams\\" in values && values.streams != null) { + + this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = values.streams; + } + + if (\\"endpoints\\" in values && values.endpoints != null) { + this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG = [values.endpoints]; + } + } + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @returns The cloned instance. + */ + clone(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;preferredUsername?: string | LanguageString | null; +preferredUsernames?: (string | LanguageString)[];publicKey?: CryptographicKey | URL | null; +publicKeys?: (CryptographicKey | URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | URL | null;outbox?: OrderedCollection | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;linked?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;} + = {}): Service { +const clone = super.clone(values) as unknown as Service;clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf = this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf; + if (\\"preferredUsername\\" in values && values.preferredUsername != null) { + clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf = [values.preferredUsername]; + } + + if (\\"preferredUsernames\\" in values && values.preferredUsernames != null) { + + if (\\"preferredUsername\\" in values && + values.preferredUsername != null) { + throw new TypeError( + \\"Cannot update both preferredUsername and \\" + + \\"preferredUsernames at the same time.\\", + ); + } + + clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf = values.preferredUsernames; + } + clone.#_axq166E2eZADq34V4MYUc8KMZdC = this.#_axq166E2eZADq34V4MYUc8KMZdC; + if (\\"publicKey\\" in values && values.publicKey != null) { + clone.#_axq166E2eZADq34V4MYUc8KMZdC = [values.publicKey]; + } + + if (\\"publicKeys\\" in values && values.publicKeys != null) { + + if (\\"publicKey\\" in values && + values.publicKey != null) { + throw new TypeError( + \\"Cannot update both publicKey and \\" + + \\"publicKeys at the same time.\\", + ); + } + + clone.#_axq166E2eZADq34V4MYUc8KMZdC = values.publicKeys; + } + clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA; + if (\\"manuallyApprovesFollowers\\" in values && values.manuallyApprovesFollowers != null) { + clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA = [values.manuallyApprovesFollowers]; + } + clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB; + if (\\"inbox\\" in values && values.inbox != null) { + clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB = [values.inbox]; + } + clone.#_41QwhqJouoLg3h8dRPKat21brynC = this.#_41QwhqJouoLg3h8dRPKat21brynC; + if (\\"outbox\\" in values && values.outbox != null) { + clone.#_41QwhqJouoLg3h8dRPKat21brynC = [values.outbox]; + } + clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee; + if (\\"following\\" in values && values.following != null) { + clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee = [values.following]; + } + clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA; + if (\\"followers\\" in values && values.followers != null) { + clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA = [values.followers]; + } + clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU; + if (\\"linked\\" in values && values.linked != null) { + clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU = [values.linked]; + } + clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9; + if (\\"streams\\" in values && values.streams != null) { + + clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = values.streams; + } + clone.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG = this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG; + if (\\"endpoints\\" in values && values.endpoints != null) { + clone.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG = [values.endpoints]; + } + + return clone; + } + +/** A short username which may be used to refer to the actor, + * with no uniqueness guarantees. + * + */ +get preferredUsername(): (string | LanguageString | null) { + if (this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf.length < 1) return null; + return this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf[0]; + } + +/** A short username which may be used to refer to the actor, + * with no uniqueness guarantees. + * + */ +get preferredUsernames(): (string | LanguageString)[] { + return this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf; + } + + async #fetchPublicKey( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await CryptographicKey.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://w3id.org/security#Key\\"].join(\\", \\")); + } + + /** + * Similar to {@link getPublicKey()}, + * but returns its \`@id\` URL instead of the object itself. + */ + get publicKeyId(): URL | null { + if (this.#_axq166E2eZADq34V4MYUc8KMZdC.length < 1) return null; + const v = this.#_axq166E2eZADq34V4MYUc8KMZdC[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** A public part of the key pair owned by this actor. + */ + + async getPublicKey( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + if (this.#_axq166E2eZADq34V4MYUc8KMZdC.length < 1) return null; + const v = this.#_axq166E2eZADq34V4MYUc8KMZdC[0]; + if (v instanceof URL) { + const fetched = + await this.#fetchPublicKey(v, options); + this.#_axq166E2eZADq34V4MYUc8KMZdC[0] = fetched; + return fetched; + } + return v; + } + + /** + * Similar to {@link getPublicKeys()}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get publicKeyIds(): URL[] { + return this.#_axq166E2eZADq34V4MYUc8KMZdC.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** A public part of the key pair owned by this actor. + */ + + async* getPublicKeys( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): AsyncIterable { + const vs = this.#_axq166E2eZADq34V4MYUc8KMZdC; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = + await this.#fetchPublicKey( + v, options); + vs[i] = fetched; + yield fetched; + continue; + } + yield v; + } + } + +/** When \`true\`, conveys that for this actor, follow requests are not usually + * automatically approved, but instead are examined by a person who may accept + * or reject the request, at some time in the future. Setting of \`false\` + * conveys no information and may be ignored. This information is typically + * used to affect display of accounts, such as showing an account as private or + * locked. + * + */ +get manuallyApprovesFollowers(): (boolean | null) { + if (this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA.length < 1) return null; + return this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA[0]; + } + + async #fetchInbox( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await OrderedCollection.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\"].join(\\", \\")); + } + + /** + * Similar to {@link getInbox()}, + * but returns its \`@id\` URL instead of the object itself. + */ + get inboxId(): URL | null { + if (this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB.length < 1) return null; + const v = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** The inbox stream contains all activities received by the actor. The server + * SHOULD filter content according to the requester's permission. In general, + * the owner of an inbox is likely to be able to access all of their inbox + * contents. Depending on access control, some other content may be public, + * whereas other content may require authentication for non-owner users, + * if they can access the inbox at all. + * + * The server MUST perform de-duplication of activities returned by the inbox. + * Duplication can occur if an activity is addressed both to an actor's + * followers, and a specific actor who also follows the recipient actor, + * and the server has failed to de-duplicate the recipients list. + * Such deduplication MUST be performed by comparing the \`id\` of the activities + * and dropping any activities already seen. + * + */ + + async getInbox( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + if (this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB.length < 1) return null; + const v = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB[0]; + if (v instanceof URL) { + const fetched = + await this.#fetchInbox(v, options); + this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB[0] = fetched; + return fetched; + } + return v; + } + + async #fetchOutbox( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await OrderedCollection.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\"].join(\\", \\")); + } + + /** + * Similar to {@link getOutbox()}, + * but returns its \`@id\` URL instead of the object itself. + */ + get outboxId(): URL | null { + if (this.#_41QwhqJouoLg3h8dRPKat21brynC.length < 1) return null; + const v = this.#_41QwhqJouoLg3h8dRPKat21brynC[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** The outbox stream contains activities the user has published, + * subject to the ability of the requestor to retrieve the activity + * (that is, the contents of the outbox are filtered by the permissions of + * the person reading it). If a user submits a request without + * [Authorization](https://www.w3.org/TR/activitypub/#authorization) + * the server should respond with all of the + * [Public](https://www.w3.org/TR/activitypub/#public-addressing) posts. + * This could potentially be all relevant objects published by the user, + * though the number of available items is left to the discretion of those + * implementing and deploying the server. + * + */ + + async getOutbox( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + if (this.#_41QwhqJouoLg3h8dRPKat21brynC.length < 1) return null; + const v = this.#_41QwhqJouoLg3h8dRPKat21brynC[0]; + if (v instanceof URL) { + const fetched = + await this.#fetchOutbox(v, options); + this.#_41QwhqJouoLg3h8dRPKat21brynC[0] = fetched; + return fetched; + } + return v; + } + + async #fetchFollowing( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await Collection.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Collection\\"].join(\\", \\")); + } + + /** + * Similar to {@link getFollowing()}, + * but returns its \`@id\` URL instead of the object itself. + */ + get followingId(): URL | null { + if (this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee.length < 1) return null; + const v = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** This is a list of everybody that the actor has followed, added as a + * [side effect](https://www.w3.org/TR/activitypub/#follow-activity-outbox). + * The \`following\` collection MUST be either an {@link OrderedCollection} + * or a {@link Collection} and MAY be filtered on privileges of + * an authenticated user or as appropriate when no authentication is given. + * + */ + + async getFollowing( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + if (this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee.length < 1) return null; + const v = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee[0]; + if (v instanceof URL) { + const fetched = + await this.#fetchFollowing(v, options); + this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee[0] = fetched; + return fetched; + } + return v; + } + + async #fetchFollowers( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await Collection.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Collection\\"].join(\\", \\")); + } + + /** + * Similar to {@link getFollowers()}, + * but returns its \`@id\` URL instead of the object itself. + */ + get followersId(): URL | null { + if (this.#_BBCTgfphhsFzpVfKTykGSpBNwoA.length < 1) return null; + const v = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** This is a list of everyone who has sent a {@link Follow} activity + * for the actor, added as a + * [side effect](https://www.w3.org/TR/activitypub/#follow-activity-outbox). + * This is where one would find a list of all the actors that are following + * the actor. The \`followers\` collection MUST be either + * an {@link OrderedCollection} or a {@link Collection} and MAY be filtered on + * privileges of an authenticated user or as appropriate when no authentication + * is given. + * + */ + + async getFollowers( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + if (this.#_BBCTgfphhsFzpVfKTykGSpBNwoA.length < 1) return null; + const v = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA[0]; + if (v instanceof URL) { + const fetched = + await this.#fetchFollowers(v, options); + this.#_BBCTgfphhsFzpVfKTykGSpBNwoA[0] = fetched; + return fetched; + } + return v; + } + + async #fetchLinked( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await Collection.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Collection\\"].join(\\", \\")); + } + + /** + * Similar to {@link getLinked()}, + * but returns its \`@id\` URL instead of the object itself. + */ + get linkedId(): URL | null { + if (this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU.length < 1) return null; + const v = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** This is a list of every object from all of the actor's {@link Like} + * activities, added as a + * [side effect](https://www.w3.org/TR/activitypub/#like-activity-outbox). + * The \`liked\` collection MUST be either an {@link OrderedCollection} or + * a {@link Collection} and MAY be filtered on privileges of an authenticated + * user or as appropriate when no authentication is given. + * + */ + + async getLinked( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + if (this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU.length < 1) return null; + const v = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU[0]; + if (v instanceof URL) { + const fetched = + await this.#fetchLinked(v, options); + this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU[0] = fetched; + return fetched; + } + return v; + } + + async #fetchStream( + url: URL, + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): Promise { + const documentLoader = options.documentLoader ?? fetchDocumentLoader; + const { document } = await documentLoader(url.href); + + try { + return await Collection.fromJsonLd(document, options); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Collection\\"].join(\\", \\")); + } + + /** + * Similar to {@link getStreams()}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get streamIds(): URL[] { + return this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** A list of supplementary Collections which may be of interest. + * + */ + + async* getStreams( + options: { + documentLoader?: (url: string) => Promise<{ + contextUrl: string | null; + document: unknown; + documentUrl: string; + }> + } = {} + ): AsyncIterable { + const vs = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = + await this.#fetchStream( + v, options); + vs[i] = fetched; + yield fetched; + continue; + } + yield v; + } + } + +/** A JSON object which maps additional (typically server/domain-wide) endpoints + * which may be useful either for this actor or someone referencing this actor. + * This mapping may be nested inside the actor document as the value or may be + * a link to a JSON-LD document with these properties. + * + */ +get endpoints(): (Endpoints | null) { + if (this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG.length < 1) return null; + return this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG[0]; + } + + /** + * Converts this object to a JSON-LD structure. + * @returns The JSON-LD representation of this object. + */ + async toJsonLd(options: { + expand?: boolean, + documentLoader?: DocumentLoader + } = {}): Promise { + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + + const baseValues = await super.toJsonLd({ + ...options, + expand: true, + }) as unknown[]; + const values = baseValues[0] as Record; + + array = []; + for (const v of this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf) { + array.push( + typeof v === \\"string\\" ? { \\"@value\\": v } : { + \\"@value\\": v.toString(), + \\"@language\\": v.language.compact(), + } + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#preferredUsername\\"] = array; + + array = []; + for (const v of this.#_axq166E2eZADq34V4MYUc8KMZdC) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://w3id.org/security#publicKey\\"] = array; + + array = []; + for (const v of this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA) { + array.push( + { \\"@value\\": v } + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers\\"] = array; + + array = []; + for (const v of this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"http://www.w3.org/ns/ldp#inbox\\"] = array; + + array = []; + for (const v of this.#_41QwhqJouoLg3h8dRPKat21brynC) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#outbox\\"] = array; + + array = []; + for (const v of this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#following\\"] = array; + + array = []; + for (const v of this.#_BBCTgfphhsFzpVfKTykGSpBNwoA) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#followers\\"] = array; + + array = []; + for (const v of this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#liked\\"] = array; + + array = []; + for (const v of this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9) { + array.push( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#streams\\"] = array; + + array = []; + for (const v of this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG) { + array.push( + await v.toJsonLd(options) + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#endpoints\\"] = array; + + values[\\"@type\\"] = [\\"https://www.w3.org/ns/activitystreams#Service\\"]; + if (this.id) values[\\"@id\\"] = this.id.href; + if (options.expand) { + return await jsonld.expand(values, options); + } + return await jsonld.compact( + values, + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\"], + options + ); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static async fromJsonLd( + json: unknown, + options: { documentLoader?: DocumentLoader } = {} + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + ...options, + keepFreeFloatingNodes: true, + }); + // deno-lint-ignore no-explicit-any + values = (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + + const instance = await super.fromJsonLd(values, options); + if (!(instance instanceof Service)) { + throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); + } + const _3isuDgRAKSntq9XdbjiNxjwyPZAf: (string | LanguageString)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#preferredUsername\\"] ?? []) { + if (v == null) continue; + + const decoded = + typeof v === \\"object\\" && \\"@value\\" in v + && typeof v[\\"@value\\"] === \\"string\\" && !(\\"@language\\" in v) ? v[\\"@value\\"] : typeof v === \\"object\\" && \\"@language\\" in v && \\"@value\\" in v + && typeof v[\\"@language\\"] === \\"string\\" + && typeof v[\\"@value\\"] === \\"string\\" ? new LanguageString(v[\\"@value\\"], v[\\"@language\\"]) : undefined + ; + if (typeof decoded === \\"undefined\\") continue; + _3isuDgRAKSntq9XdbjiNxjwyPZAf.push(decoded); + + } + instance.#_3isuDgRAKSntq9XdbjiNxjwyPZAf = _3isuDgRAKSntq9XdbjiNxjwyPZAf; + const _axq166E2eZADq34V4MYUc8KMZdC: (CryptographicKey | URL)[] = []; + + for (const v of values[\\"https://w3id.org/security#publicKey\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _axq166E2eZADq34V4MYUc8KMZdC.push(new URL(v[\\"@id\\"])); + continue; + } + _axq166E2eZADq34V4MYUc8KMZdC.push(await CryptographicKey.fromJsonLd( + v, options)) + } + instance.#_axq166E2eZADq34V4MYUc8KMZdC = _axq166E2eZADq34V4MYUc8KMZdC; + const _36QNc9MxfkKf6h8sEUQSHnV9NZA: boolean[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers\\"] ?? []) { + if (v == null) continue; + _36QNc9MxfkKf6h8sEUQSHnV9NZA.push(v[\\"@value\\"]) + } + instance.#_36QNc9MxfkKf6h8sEUQSHnV9NZA = _36QNc9MxfkKf6h8sEUQSHnV9NZA; + const _3ghX3VfZXXbLvhCRH7QJqpzLrXjB: (OrderedCollection | URL)[] = []; + + for (const v of values[\\"http://www.w3.org/ns/ldp#inbox\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _3ghX3VfZXXbLvhCRH7QJqpzLrXjB.push(new URL(v[\\"@id\\"])); + continue; + } + _3ghX3VfZXXbLvhCRH7QJqpzLrXjB.push(await OrderedCollection.fromJsonLd( + v, options)) + } + instance.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB = _3ghX3VfZXXbLvhCRH7QJqpzLrXjB; + const _41QwhqJouoLg3h8dRPKat21brynC: (OrderedCollection | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#outbox\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _41QwhqJouoLg3h8dRPKat21brynC.push(new URL(v[\\"@id\\"])); + continue; + } + _41QwhqJouoLg3h8dRPKat21brynC.push(await OrderedCollection.fromJsonLd( + v, options)) + } + instance.#_41QwhqJouoLg3h8dRPKat21brynC = _41QwhqJouoLg3h8dRPKat21brynC; + const _3yAv8jymNfNuJUDuBzJ1NQhdbAee: (Collection | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#following\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _3yAv8jymNfNuJUDuBzJ1NQhdbAee.push(new URL(v[\\"@id\\"])); + continue; + } + _3yAv8jymNfNuJUDuBzJ1NQhdbAee.push(await Collection.fromJsonLd( + v, options)) + } + instance.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee = _3yAv8jymNfNuJUDuBzJ1NQhdbAee; + const _BBCTgfphhsFzpVfKTykGSpBNwoA: (Collection | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#followers\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _BBCTgfphhsFzpVfKTykGSpBNwoA.push(new URL(v[\\"@id\\"])); + continue; + } + _BBCTgfphhsFzpVfKTykGSpBNwoA.push(await Collection.fromJsonLd( + v, options)) + } + instance.#_BBCTgfphhsFzpVfKTykGSpBNwoA = _BBCTgfphhsFzpVfKTykGSpBNwoA; + const _3bgkPwJanyTCoVFM9ovRcus8tKkU: (Collection | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#liked\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _3bgkPwJanyTCoVFM9ovRcus8tKkU.push(new URL(v[\\"@id\\"])); + continue; + } + _3bgkPwJanyTCoVFM9ovRcus8tKkU.push(await Collection.fromJsonLd( + v, options)) + } + instance.#_3bgkPwJanyTCoVFM9ovRcus8tKkU = _3bgkPwJanyTCoVFM9ovRcus8tKkU; + const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9: (Collection | URL)[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#streams\\"] ?? []) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _3sG2Hdwn9qzKGu9mpYkqakAMUkH9.push(new URL(v[\\"@id\\"])); + continue; + } + _3sG2Hdwn9qzKGu9mpYkqakAMUkH9.push(await Collection.fromJsonLd( + v, options)) + } + instance.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = _3sG2Hdwn9qzKGu9mpYkqakAMUkH9; + const _sEoQwUbfk4hEfugzNQ2ZiDcLMkG: Endpoints[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#endpoints\\"] ?? []) { + if (v == null) continue; + _sEoQwUbfk4hEfugzNQ2ZiDcLMkG.push(await Endpoints.fromJsonLd( + v, options)) + } + instance.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG = _sEoQwUbfk4hEfugzNQ2ZiDcLMkG; + + return instance; + } + + protected _getCustomInspectProxy(): Record { + const proxy: Record = super._getCustomInspectProxy();const _3isuDgRAKSntq9XdbjiNxjwyPZAf = this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf; + if (_3isuDgRAKSntq9XdbjiNxjwyPZAf.length == 1) { + proxy.preferredUsername = _3isuDgRAKSntq9XdbjiNxjwyPZAf[0]; + } + + if (_3isuDgRAKSntq9XdbjiNxjwyPZAf.length > 1 + || !(\\"preferredUsername\\" in proxy) + && _3isuDgRAKSntq9XdbjiNxjwyPZAf.length > 0) { + proxy.preferredUsernames = _3isuDgRAKSntq9XdbjiNxjwyPZAf; + } + + const _axq166E2eZADq34V4MYUc8KMZdC = this.#_axq166E2eZADq34V4MYUc8KMZdC.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_axq166E2eZADq34V4MYUc8KMZdC.length == 1) { + proxy.publicKey = _axq166E2eZADq34V4MYUc8KMZdC[0]; + } + + if (_axq166E2eZADq34V4MYUc8KMZdC.length > 1 + || !(\\"publicKey\\" in proxy) + && _axq166E2eZADq34V4MYUc8KMZdC.length > 0) { + proxy.publicKeys = _axq166E2eZADq34V4MYUc8KMZdC; + } + const _36QNc9MxfkKf6h8sEUQSHnV9NZA = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA; + if (_36QNc9MxfkKf6h8sEUQSHnV9NZA.length == 1) { + proxy.manuallyApprovesFollowers = _36QNc9MxfkKf6h8sEUQSHnV9NZA[0]; + } + + const _3ghX3VfZXXbLvhCRH7QJqpzLrXjB = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_3ghX3VfZXXbLvhCRH7QJqpzLrXjB.length == 1) { + proxy.inbox = _3ghX3VfZXXbLvhCRH7QJqpzLrXjB[0]; + } + + const _41QwhqJouoLg3h8dRPKat21brynC = this.#_41QwhqJouoLg3h8dRPKat21brynC.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_41QwhqJouoLg3h8dRPKat21brynC.length == 1) { + proxy.outbox = _41QwhqJouoLg3h8dRPKat21brynC[0]; + } + + const _3yAv8jymNfNuJUDuBzJ1NQhdbAee = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_3yAv8jymNfNuJUDuBzJ1NQhdbAee.length == 1) { + proxy.following = _3yAv8jymNfNuJUDuBzJ1NQhdbAee[0]; + } + + const _BBCTgfphhsFzpVfKTykGSpBNwoA = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_BBCTgfphhsFzpVfKTykGSpBNwoA.length == 1) { + proxy.followers = _BBCTgfphhsFzpVfKTykGSpBNwoA[0]; + } + + const _3bgkPwJanyTCoVFM9ovRcus8tKkU = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_3bgkPwJanyTCoVFM9ovRcus8tKkU.length == 1) { + proxy.linked = _3bgkPwJanyTCoVFM9ovRcus8tKkU[0]; + } + + const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9 = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9.map(v => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options) + } + : v); + + if (_3sG2Hdwn9qzKGu9mpYkqakAMUkH9.length > 1 + || !(\\"stream\\" in proxy) + && _3sG2Hdwn9qzKGu9mpYkqakAMUkH9.length > 0) { + proxy.streams = _3sG2Hdwn9qzKGu9mpYkqakAMUkH9; + } + const _sEoQwUbfk4hEfugzNQ2ZiDcLMkG = this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG; + if (_sEoQwUbfk4hEfugzNQ2ZiDcLMkG.length == 1) { + proxy.endpoints = _sEoQwUbfk4hEfugzNQ2ZiDcLMkG[0]; + } + + return proxy; + } + + [Symbol.for(\\"Deno.customInspect\\")]( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"Service \\" + inspect(proxy, options); + } + } + +/** Represents any kind of multi-paragraph written work. + */ +export class Article extends Object { + + /** + * Constructs a new instance of Article with the given values. + * @param values The values to initialize the instance with. + */ + constructor(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;} +) { +super(values);} + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @returns The cloned instance. + */ + clone(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;} + = {}): Article { +const clone = super.clone(values) as unknown as Article; + return clone; + } + + /** + * Converts this object to a JSON-LD structure. + * @returns The JSON-LD representation of this object. + */ + async toJsonLd(options: { + expand?: boolean, + documentLoader?: DocumentLoader + } = {}): Promise { + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + + const baseValues = await super.toJsonLd({ + ...options, + expand: true, + }) as unknown[]; + const values = baseValues[0] as Record; + + values[\\"@type\\"] = [\\"https://www.w3.org/ns/activitystreams#Article\\"]; + if (this.id) values[\\"@id\\"] = this.id.href; + if (options.expand) { + return await jsonld.expand(values, options); + } + return await jsonld.compact( + values, + \\"https://www.w3.org/ns/activitystreams\\", + options + ); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static async fromJsonLd( + json: unknown, + options: { documentLoader?: DocumentLoader } = {} + ): Promise
{ + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + ...options, + keepFreeFloatingNodes: true, + }); + // deno-lint-ignore no-explicit-any + values = (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + + const instance = await super.fromJsonLd(values, options); + if (!(instance instanceof Article)) { + throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); + } + + return instance; + } + + protected _getCustomInspectProxy(): Record { + const proxy: Record = super._getCustomInspectProxy(); + return proxy; + } + + [Symbol.for(\\"Deno.customInspect\\")]( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"Article \\" + inspect(proxy, options); + } + } + +/** Used to represent ordered subsets of items from an \`OrderedCollection\`. + * Refer to the Activity Streams 2.0 Core for a complete description of + * the \`OrderedCollectionPage\` object. + * + */ +export class OrderedCollectionPage extends CollectionPage { +#_2W4yinFwqmpneu2h4m1mZ3pcLADd: number[] = []; + + /** + * Constructs a new instance of OrderedCollectionPage with the given values. + * @param values The values to initialize the instance with. + */ + constructor(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;totalItems?: number | null;current?: CollectionPage | Link | URL | null;first?: CollectionPage | Link | URL | null;last?: CollectionPage | Link | URL | null;items?: (Object | Link | URL)[];partOf?: Link | Collection | URL | null;next?: CollectionPage | Link | URL | null;prev?: CollectionPage | Link | URL | null;startIndex?: number | null;} +) { +super(values); + if (\\"startIndex\\" in values && values.startIndex != null) { + this.#_2W4yinFwqmpneu2h4m1mZ3pcLADd = [values.startIndex]; + } + } + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @returns The cloned instance. + */ + clone(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;totalItems?: number | null;current?: CollectionPage | Link | URL | null;first?: CollectionPage | Link | URL | null;last?: CollectionPage | Link | URL | null;items?: (Object | Link | URL)[];partOf?: Link | Collection | URL | null;next?: CollectionPage | Link | URL | null;prev?: CollectionPage | Link | URL | null;startIndex?: number | null;} + = {}): OrderedCollectionPage { +const clone = super.clone(values) as unknown as OrderedCollectionPage;clone.#_2W4yinFwqmpneu2h4m1mZ3pcLADd = this.#_2W4yinFwqmpneu2h4m1mZ3pcLADd; + if (\\"startIndex\\" in values && values.startIndex != null) { + clone.#_2W4yinFwqmpneu2h4m1mZ3pcLADd = [values.startIndex]; + } + + return clone; + } + +/** A non-negative integer value identifying the relative position within + * the logical view of a strictly ordered collection. + * + */ +get startIndex(): (number | null) { + if (this.#_2W4yinFwqmpneu2h4m1mZ3pcLADd.length < 1) return null; + return this.#_2W4yinFwqmpneu2h4m1mZ3pcLADd[0]; + } + + /** + * Converts this object to a JSON-LD structure. + * @returns The JSON-LD representation of this object. + */ + async toJsonLd(options: { + expand?: boolean, + documentLoader?: DocumentLoader + } = {}): Promise { + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + + const baseValues = await super.toJsonLd({ + ...options, + expand: true, + }) as unknown[]; + const values = baseValues[0] as Record; + + array = []; + for (const v of this.#_2W4yinFwqmpneu2h4m1mZ3pcLADd) { + array.push( + { + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\", + \\"@value\\": v, + } + ); + } + if (array.length > 0) values[\\"https://www.w3.org/ns/activitystreams#startIndex\\"] = array; + + values[\\"@type\\"] = [\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\"]; + if (this.id) values[\\"@id\\"] = this.id.href; + if (options.expand) { + return await jsonld.expand(values, options); + } + return await jsonld.compact( + values, + \\"https://www.w3.org/ns/activitystreams\\", + options + ); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static async fromJsonLd( + json: unknown, + options: { documentLoader?: DocumentLoader } = {} + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + ...options, + keepFreeFloatingNodes: true, + }); + // deno-lint-ignore no-explicit-any + values = (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + + const instance = await super.fromJsonLd(values, options); + if (!(instance instanceof OrderedCollectionPage)) { + throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); + } + const _2W4yinFwqmpneu2h4m1mZ3pcLADd: number[] = []; + + for (const v of values[\\"https://www.w3.org/ns/activitystreams#startIndex\\"] ?? []) { + if (v == null) continue; + _2W4yinFwqmpneu2h4m1mZ3pcLADd.push(v[\\"@value\\"]) + } + instance.#_2W4yinFwqmpneu2h4m1mZ3pcLADd = _2W4yinFwqmpneu2h4m1mZ3pcLADd; + + return instance; + } + + protected _getCustomInspectProxy(): Record { + const proxy: Record = super._getCustomInspectProxy();const _2W4yinFwqmpneu2h4m1mZ3pcLADd = this.#_2W4yinFwqmpneu2h4m1mZ3pcLADd; + if (_2W4yinFwqmpneu2h4m1mZ3pcLADd.length == 1) { + proxy.startIndex = _2W4yinFwqmpneu2h4m1mZ3pcLADd[0]; + } + + return proxy; + } + + [Symbol.for(\\"Deno.customInspect\\")]( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"OrderedCollectionPage \\" + inspect(proxy, options); + } + } + +/** Indicates that the \`actor\` is removing the \`object\`. If specified, + * the \`origin\` indicates the context from which the \`object\` is being removed. + * + */ +export class Remove extends Activity { + + /** + * Constructs a new instance of Remove with the given values. + * @param values The values to initialize the instance with. + */ + constructor(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;actor?: Object | Link | URL | null; +actors?: (Object | Link | URL)[];object?: Object | Link | URL | null; +objects?: (Object | Link | URL)[];} +) { +super(values);} + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @returns The cloned instance. + */ + clone(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;actor?: Object | Link | URL | null; +actors?: (Object | Link | URL)[];object?: Object | Link | URL | null; +objects?: (Object | Link | URL)[];} + = {}): Remove { +const clone = super.clone(values) as unknown as Remove; + return clone; + } + + /** + * Converts this object to a JSON-LD structure. + * @returns The JSON-LD representation of this object. + */ + async toJsonLd(options: { + expand?: boolean, + documentLoader?: DocumentLoader + } = {}): Promise { + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + + const baseValues = await super.toJsonLd({ + ...options, + expand: true, + }) as unknown[]; + const values = baseValues[0] as Record; + + values[\\"@type\\"] = [\\"https://www.w3.org/ns/activitystreams#Remove\\"]; + if (this.id) values[\\"@id\\"] = this.id.href; + if (options.expand) { + return await jsonld.expand(values, options); + } + return await jsonld.compact( + values, + \\"https://www.w3.org/ns/activitystreams\\", + options + ); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static async fromJsonLd( + json: unknown, + options: { documentLoader?: DocumentLoader } = {} + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + ...options, + keepFreeFloatingNodes: true, + }); + // deno-lint-ignore no-explicit-any + values = (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + + const instance = await super.fromJsonLd(values, options); + if (!(instance instanceof Remove)) { + throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); + } + + return instance; + } + + protected _getCustomInspectProxy(): Record { + const proxy: Record = super._getCustomInspectProxy(); + return proxy; + } + + [Symbol.for(\\"Deno.customInspect\\")]( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"Remove \\" + inspect(proxy, options); + } + } + +/** Represents a document of any kind. + */ +export class Document extends Object { + + /** + * Constructs a new instance of Document with the given values. + * @param values The values to initialize the instance with. + */ + constructor(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;} +) { +super(values);} + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @returns The cloned instance. + */ + clone(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;} + = {}): Document { +const clone = super.clone(values) as unknown as Document; + return clone; + } + + /** + * Converts this object to a JSON-LD structure. + * @returns The JSON-LD representation of this object. + */ + async toJsonLd(options: { + expand?: boolean, + documentLoader?: DocumentLoader + } = {}): Promise { + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + + const baseValues = await super.toJsonLd({ + ...options, + expand: true, + }) as unknown[]; + const values = baseValues[0] as Record; + + values[\\"@type\\"] = [\\"https://www.w3.org/ns/activitystreams#Document\\"]; + if (this.id) values[\\"@id\\"] = this.id.href; + if (options.expand) { + return await jsonld.expand(values, options); + } + return await jsonld.compact( + values, + \\"https://www.w3.org/ns/activitystreams\\", + options + ); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static async fromJsonLd( + json: unknown, + options: { documentLoader?: DocumentLoader } = {} + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + ...options, + keepFreeFloatingNodes: true, + }); + // deno-lint-ignore no-explicit-any + values = (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + if (\\"@type\\" in values) { + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Video\\")) { + delete values[\\"@type\\"]; + return await Video.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Page\\")) { + delete values[\\"@type\\"]; + return await Page.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Image\\")) { + delete values[\\"@type\\"]; + return await Image.fromJsonLd(values, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Audio\\")) { + delete values[\\"@type\\"]; + return await Audio.fromJsonLd(values, options); + } + + if (!values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Document\\")) { + throw new TypeError(\\"Invalid type: \\" + values[\\"@type\\"]); + } + } + + const instance = await super.fromJsonLd(values, options); + if (!(instance instanceof Document)) { + throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); + } + + return instance; + } + + protected _getCustomInspectProxy(): Record { + const proxy: Record = super._getCustomInspectProxy(); + return proxy; + } + + [Symbol.for(\\"Deno.customInspect\\")]( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"Document \\" + inspect(proxy, options); + } + } + +/** Represents a video document of any kind. + */ +export class Video extends Document { + + /** + * Constructs a new instance of Video with the given values. + * @param values The values to initialize the instance with. + */ + constructor(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;} +) { +super(values);} + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @returns The cloned instance. + */ + clone(values: + { +id?: URL | null; +attachments?: (Object | Link | URL)[];attributedTo?: Object | URL | null; +attributedTos?: (Object | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: (string | LanguageString)[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: (string | LanguageString)[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icons?: (Image | Link | URL)[];images?: (Image | Link | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: (string | LanguageString)[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: (URL | Link)[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;} + = {}): Video { +const clone = super.clone(values) as unknown as Video; + return clone; + } + + /** + * Converts this object to a JSON-LD structure. + * @returns The JSON-LD representation of this object. + */ + async toJsonLd(options: { + expand?: boolean, + documentLoader?: DocumentLoader + } = {}): Promise { + options = { + ...options, + documentLoader: options.documentLoader ?? fetchDocumentLoader, + }; + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + + const baseValues = await super.toJsonLd({ + ...options, + expand: true, + }) as unknown[]; + const values = baseValues[0] as Record; + + values[\\"@type\\"] = [\\"https://www.w3.org/ns/activitystreams#Video\\"]; + if (this.id) values[\\"@id\\"] = this.id.href; + if (options.expand) { + return await jsonld.expand(values, options); + } + return await jsonld.compact( + values, + \\"https://www.w3.org/ns/activitystreams\\", + options + ); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static async fromJsonLd( + json: unknown, + options: { documentLoader?: DocumentLoader } = {} + ): Promise