diff --git a/.gitignore b/.gitignore index 276cdd66..3a53e822 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 00000000..d43de375 --- /dev/null +++ b/codegen/__snapshots__/class.test.ts.snap @@ -0,0 +1,17541 @@ +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 \\"../runtime/docloader.ts\\"; +import { LanguageString } from \\"../runtime/langstr.ts\\"; + + +/** 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, + }); + values = + // deno-lint-ignore no-explicit-any + (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); + } + } + +/** 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, + }); + values = + // deno-lint-ignore no-explicit-any + (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + if (\\"@type\\" in values) { + + 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#Accept\\")) { + delete values[\\"@type\\"]; + return await Accept.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#Announce\\")) { + delete values[\\"@type\\"]; + return await Announce.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#Delete\\")) { + delete values[\\"@type\\"]; + return await Delete.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#Follow\\")) { + delete values[\\"@type\\"]; + return await Follow.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#IntransitiveActivity\\")) { + delete values[\\"@type\\"]; + return await IntransitiveActivity.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#Reject\\")) { + delete values[\\"@type\\"]; + return await Reject.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#Update\\")) { + delete values[\\"@type\\"]; + return await Update.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#Article\\")) { + delete values[\\"@type\\"]; + return await Article.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#Document\\")) { + delete values[\\"@type\\"]; + return await Document.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#Image\\")) { + delete values[\\"@type\\"]; + return await Image.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#Video\\")) { + delete values[\\"@type\\"]; + return await Video.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#Group\\")) { + delete values[\\"@type\\"]; + return await Group.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#Organization\\")) { + delete values[\\"@type\\"]; + return await Organization.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#Place\\")) { + delete values[\\"@type\\"]; + return await Place.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#Relationship\\")) { + delete values[\\"@type\\"]; + return await Relationship.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#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#Activity\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"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#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\"].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#Activity\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"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#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\"].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#Activity\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"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#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\"].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#Activity\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"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#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\"].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#Activity\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"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#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\"].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#Activity\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"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#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\"].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#Activity\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"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#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\"].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); + } + } + +/** 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, + }); + values = + // deno-lint-ignore no-explicit-any + (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + if (\\"@type\\" in values) { + + 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#Add\\")) { + delete values[\\"@type\\"]; + return await Add.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#Create\\")) { + delete values[\\"@type\\"]; + return await Create.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#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#Follow\\")) { + delete values[\\"@type\\"]; + return await Follow.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#IntransitiveActivity\\")) { + delete values[\\"@type\\"]; + return await IntransitiveActivity.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#Reject\\")) { + delete values[\\"@type\\"]; + return await Reject.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#Update\\")) { + delete values[\\"@type\\"]; + return await Update.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#Activity\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"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#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\"].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#Activity\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"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#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\"].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\` accepts the \`object\`. The \`target\` property can be + * used in certain circumstances to indicate the context into which the \`object\` + * has been accepted. + * + */ +export class Accept extends Activity { + + /** + * Constructs a new instance of Accept 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)[];} + = {}): Accept { +const clone = super.clone(values) as unknown as Accept; + 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#Accept\\"]; + 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, + }); + values = + // deno-lint-ignore no-explicit-any + (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + + const instance = await super.fromJsonLd(values, options); + if (!(instance instanceof Accept)) { + 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 \\"Accept \\" + inspect(proxy, options); + } + } + +/** Indicates that the \`actor\` has added the \`object\` to the \`target\`. + * If the \`target\` property is not explicitly specified, the target would need + * to be determined implicitly by context. The \`origin\` can be used to identify + * the context from which the \`object\` originated. + * + */ +export class Add extends Activity { + + /** + * Constructs a new instance of Add 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)[];} + = {}): Add { +const clone = super.clone(values) as unknown as Add; + 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#Add\\"]; + 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, + }); + values = + // deno-lint-ignore no-explicit-any + (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + + const instance = await super.fromJsonLd(values, options); + if (!(instance instanceof Add)) { + 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 \\"Add \\" + inspect(proxy, options); + } + } + +/** Indicates that the \`actor\` is calling the \`target\`'s attention the \`object\`. + * + * The \`origin\` typically has no defined meaning. + * + */ +export class Announce extends Activity { + + /** + * Constructs a new instance of Announce 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)[];} + = {}): Announce { +const clone = super.clone(values) as unknown as Announce; + 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#Announce\\"]; + 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, + }); + values = + // deno-lint-ignore no-explicit-any + (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + + const instance = await super.fromJsonLd(values, options); + if (!(instance instanceof Announce)) { + 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 \\"Announce \\" + inspect(proxy, options); + } + } + +/** Describes a software application. + */ +export class Application 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 Application 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;} + = {}): Application { +const clone = super.clone(values) as unknown as Application;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#Application\\"]; + 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, + }); + values = + // deno-lint-ignore no-explicit-any + (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + + const instance = await super.fromJsonLd(values, options); + if (!(instance instanceof Application)) { + 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 \\"Application \\" + 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, + }); + values = + // deno-lint-ignore no-explicit-any + (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); + } + } + +/** 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, + }); + values = + // deno-lint-ignore no-explicit-any + (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + if (\\"@type\\" in values) { + + 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#Image\\")) { + delete values[\\"@type\\"]; + return await Image.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#Video\\")) { + delete values[\\"@type\\"]; + return await Video.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 an audio document of any kind. + */ +export class Audio extends Document { + + /** + * Constructs a new instance of Audio 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;} + = {}): Audio { +const clone = super.clone(values) as unknown as Audio; + 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#Audio\\"]; + 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