@fedify/fedify 0.12.0-dev.305 → 0.12.0-dev.308
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGES.md +1 -10
- package/esm/federation/handler.js +2 -2
- package/esm/federation/middleware.js +1 -1
- package/package.json +1 -7
- package/types/federation/handler.d.ts +1 -1
- package/types/federation/handler.d.ts.map +1 -1
- package/types/federation/middleware.d.ts +3 -3
- package/types/federation/middleware.d.ts.map +1 -1
- package/esm/x/astro.js +0 -86
- package/types/x/astro.d.ts +0 -90
- package/types/x/astro.d.ts.map +0 -1
package/CHANGES.md
CHANGED
@@ -86,7 +86,7 @@ To be released.
|
|
86
86
|
- Added `VerifyRequestOptions.keyCache` property.
|
87
87
|
- Added `VerifyProofOptions.keyCache` property.
|
88
88
|
- Added `VerifyObjectOptions.keyCache` property.
|
89
|
-
- Added `FederationKvPrefixes.
|
89
|
+
- Added `FederationKvPrefixes.publicKey` property.
|
90
90
|
|
91
91
|
- The built-in document loaders now recognize JSON-LD context provided in
|
92
92
|
an HTTP `Link` header. [[#6]]
|
@@ -131,13 +131,6 @@ To be released.
|
|
131
131
|
the `getAuthenticatedDocumentLoader()` function, which can be used to
|
132
132
|
allow fetching private network addresses.
|
133
133
|
|
134
|
-
- Added `@fedify/fedify/x/astro` module for integrating with [Astro]
|
135
|
-
middleware. [[#50]]
|
136
|
-
|
137
|
-
- Added `createMiddleware()` function.
|
138
|
-
- Added `createFetchOptions()` function.
|
139
|
-
- Added `ContextDataFactory` type.
|
140
|
-
|
141
134
|
- Added `fedify init` subcommand. [[#105]]
|
142
135
|
|
143
136
|
- Added more log messages using the [LogTape] library. Currently the below
|
@@ -147,7 +140,6 @@ To be released.
|
|
147
140
|
|
148
141
|
[@fedify/cli]: https://www.npmjs.com/package/@fedify/cli
|
149
142
|
[#6]: https://github.com/dahlia/fedify/issues/6
|
150
|
-
[#50]: https://github.com/dahlia/fedify/issues/50
|
151
143
|
[#53]: https://github.com/dahlia/fedify/issues/53
|
152
144
|
[#66]: https://github.com/dahlia/fedify/issues/66
|
153
145
|
[#70]: https://github.com/dahlia/fedify/issues/70
|
@@ -157,7 +149,6 @@ To be released.
|
|
157
149
|
[#104]: https://github.com/dahlia/fedify/issues/104
|
158
150
|
[#105]: https://github.com/dahlia/fedify/issues/105
|
159
151
|
[#107]: https://github.com/dahlia/fedify/issues/107
|
160
|
-
[Astro]: https://astro.build/
|
161
152
|
|
162
153
|
|
163
154
|
Version 0.11.3
|
@@ -199,7 +199,7 @@ export async function handleInbox(request, { handle, context, kv, kvPrefixes, qu
|
|
199
199
|
const keyCache = {
|
200
200
|
async get(keyId) {
|
201
201
|
const serialized = await kv.get([
|
202
|
-
...kvPrefixes.
|
202
|
+
...kvPrefixes.publicKey,
|
203
203
|
keyId.href,
|
204
204
|
]);
|
205
205
|
if (serialized == null)
|
@@ -218,7 +218,7 @@ export async function handleInbox(request, { handle, context, kv, kvPrefixes, qu
|
|
218
218
|
},
|
219
219
|
async set(keyId, key) {
|
220
220
|
const serialized = await key.toJsonLd(context);
|
221
|
-
await kv.set([...kvPrefixes.
|
221
|
+
await kv.set([...kvPrefixes.publicKey, keyId.href], serialized);
|
222
222
|
},
|
223
223
|
};
|
224
224
|
let activity;
|
@@ -83,7 +83,7 @@ export class Federation {
|
|
83
83
|
...({
|
84
84
|
activityIdempotence: ["_fedify", "activityIdempotence"],
|
85
85
|
remoteDocument: ["_fedify", "remoteDocument"],
|
86
|
-
|
86
|
+
publicKey: ["_fedify", "publicKey"],
|
87
87
|
}),
|
88
88
|
...(options.kvPrefixes ?? {}),
|
89
89
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fedify/fedify",
|
3
|
-
"version": "0.12.0-dev.
|
3
|
+
"version": "0.12.0-dev.308+cf9b4a9a",
|
4
4
|
"description": "An ActivityPub server framework",
|
5
5
|
"keywords": [
|
6
6
|
"ActivityPub",
|
@@ -65,12 +65,6 @@
|
|
65
65
|
"default": "./esm/webfinger/mod.js"
|
66
66
|
}
|
67
67
|
},
|
68
|
-
"./x/astro": {
|
69
|
-
"import": {
|
70
|
-
"types": "./types/x/astro.d.ts",
|
71
|
-
"default": "./esm/x/astro.js"
|
72
|
-
}
|
73
|
-
},
|
74
68
|
"./x/hono": {
|
75
69
|
"import": {
|
76
70
|
"types": "./types/x/hono.d.ts",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/federation/handler.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAG5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAK9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAGL,IAAI,EAEJ,MAAM,EAGP,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,wBAAwB,EACxB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG5C,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CASvD;AAED,MAAM,WAAW,sBAAsB,CAAC,YAAY;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,cAAc,CAAC,YAAY,CAAC,CAAC;IACtC,eAAe,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC,CAAC;IAChD,kBAAkB,CAAC,EAAE,kBAAkB,CAAC,YAAY,CAAC,CAAC;IACtD,cAAc,CAAC,OAAO,EAAE,O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,EACV,mBAAmB,GACpB,EAAE,sBAAsB,CAAC,YAAY,CAAC,GACtC,OAAO,CAAC,QAAQ,CAAC,CAoMnB;AAED;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,aAAa,EAAE,cAAc,CAAC;CAC/B;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,wBAAwB,GACjC,OAAO,CAAC,QAAQ,CAAC,CAOnB;AAED;;;;;;;;GAQG;AACH,wBAAsB,6BAA6B,CACjD,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,wBAAwB,GACjC,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAK1B"}
|
@@ -170,11 +170,11 @@ export interface FederationKvPrefixes {
|
|
170
170
|
*/
|
171
171
|
remoteDocument: KvKey;
|
172
172
|
/**
|
173
|
-
* The key prefix used for caching public keys.
|
174
|
-
* by default.
|
173
|
+
* The key prefix used for caching public keys.
|
174
|
+
* `["_fedify", "publicKey"]` by default.
|
175
175
|
* @since 0.12.0
|
176
176
|
*/
|
177
|
-
|
177
|
+
publicKey: KvKey;
|
178
178
|
}
|
179
179
|
/**
|
180
180
|
* Create a new {@link Federation} instance.
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/federation/middleware.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAG5C,OAAO,EACL,KAAK,kCAAkC,EACvC,KAAK,cAAc,EAIpB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EACL,QAAQ,EAER,KAAK,OAAO,EACZ,KAAK,IAAI,EAET,KAAK,MAAM,EACZ,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EACV,eAA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C,EAAE,OAAO,CAAC;CACpC;AAED;;;GAGG;AACH,MAAM,WAAW,oBACf,SACE,IAAI,CAAC,uBAAuB,EAAE,mBAAmB,GAAG,kBAAkB,CAAC;IACzE;;;;;OAKG;IACH,KAAK,CAAC,EAAE,YAAY,CAAC;IAErB;;;;OAIG;IACH,aAAa,CAAC,EAAE,cAAc,CAAC;IAE/B;;;;;;OAMG;IACH,kCAAkC,CAAC,EAAE,kCAAkC,CAAC;IAExE;;;;;;;;;OASG;IACH,aAAa,CAAC,EAAE,kBAAkB,CAAC;IAEnC;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC;IAEpD;;;;;;;;;;;;OAYG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,mBAAmB,EAAE,KAAK,CAAC;IAE3B;;;OAGG;IACH,cAAc,EAAE,KAAK,CAAC;IAEtB;;;;OAIG;IACH,
|
1
|
+
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/federation/middleware.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAG5C,OAAO,EACL,KAAK,kCAAkC,EACvC,KAAK,cAAc,EAIpB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EACL,QAAQ,EAER,KAAK,OAAO,EACZ,KAAK,IAAI,EAET,KAAK,MAAM,EACZ,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EACV,eAAe,EACf,sBAAsB,EACtB,uBAAuB,EACvB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,wBAAwB,EACxB,gBAAgB,EAChB,kBAAkB,EAClB,wBAAwB,EACz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AAE,OAAO,CAAC,CAAC;IAEpD;;;;OAIG;IACH,aAAa,CACX,MAAM,EAAE,gBAAgB,CAAC,YAAY,EAAE,OAAO,CAAC,GAC9C,yBAAyB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IAEpD;;;;;OAKG;IACH,SAAS,CACP,SAAS,EAAE,kBAAkB,CAAC,YAAY,CAAC,GAC1C,yBAAyB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;CACrD;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB,CAAC,YAAY;IAChD;;;;;;OAMG;IACH,EAAE,CAAC,SAAS,SAAS,QAAQ,EAE3B,IAAI,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,SAAS,EACvC,QAAQ,EAAE,aAAa,CAAC,YAAY,EAAE,SAAS,CAAC,GAC/C,oBAAoB,CAAC,YAAY,CAAC,CAAC;IAEtC;;;;;;OAMG;IACH,OAAO,CACL,OAAO,EAAE,iBAAiB,CAAC,YAAY,CAAC,GACvC,oBAAoB,CAAC,YAAY,CAAC,CAAC;IAEtC;;;;;;;;OAQG;IACH,sBAAsB,CACpB,UAAU,EAAE,wBAAwB,CAAC,YAAY,CAAC,GACjD,oBAAoB,CAAC,YAAY,CAAC,CAAC;CACvC;AAED,UAAU,2BAA2B,CAAC,YAAY,CAChD,SAAQ,mBAAmB;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,YAAY,CAAC;CAC3B"}
|
package/esm/x/astro.js
DELETED
@@ -1,86 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Create options for the {@link Federation.fetch} method to integrate with
|
3
|
-
* Astro.
|
4
|
-
*
|
5
|
-
* @example src/middleware.ts
|
6
|
-
* ``` typescript
|
7
|
-
* import { defineMiddleware } from "astro:middleware";
|
8
|
-
* import { createFetchOptions } from "@fedify/fedify/x/astro";
|
9
|
-
* import { federation } from "./federation"; // Import the `Federation` object
|
10
|
-
*
|
11
|
-
* export const onRequest = defineMiddleware((context, next) => {
|
12
|
-
* return federation.fetch(context.request, {
|
13
|
-
* contextData: undefined,
|
14
|
-
* ...createFetchOptions(context, next),
|
15
|
-
* });
|
16
|
-
* });
|
17
|
-
* ```
|
18
|
-
*
|
19
|
-
* @typeParam TAstroContext A type of the Astro context.
|
20
|
-
* @param context An Astro context.
|
21
|
-
* @param next A function to call the next middleware.
|
22
|
-
* @returns Options for the {@link Federation.fetch} method.
|
23
|
-
* @since 0.12.0
|
24
|
-
*/
|
25
|
-
export function createFetchOptions(_context, next) {
|
26
|
-
return {
|
27
|
-
// If the `federation` object finds a request not responsible for it
|
28
|
-
// (i.e., not a federation-related request), it will call the `next`
|
29
|
-
// provided by the Astro framework to continue the request handling
|
30
|
-
// by Astro:
|
31
|
-
onNotFound: next,
|
32
|
-
// Similar to `onNotFound`, but slightly more tricky one.
|
33
|
-
// When the `federation` object finds a request not acceptable type-wise
|
34
|
-
// (i.e., a user-agent doesn't want JSON-LD), it will call the `next`
|
35
|
-
// provided by the Astro framework so that it renders HTML if there's some
|
36
|
-
// page. Otherwise, it will simply return a 406 Not Acceptable response.
|
37
|
-
// This kind of trick enables the Fedify and Astro to share the same routes
|
38
|
-
// and they do content negotiation depending on `Accept` header:
|
39
|
-
async onNotAcceptable(_request) {
|
40
|
-
const response = await next();
|
41
|
-
if (response.status !== 404)
|
42
|
-
return response;
|
43
|
-
return new Response("Not acceptable", {
|
44
|
-
status: 406,
|
45
|
-
headers: {
|
46
|
-
"Content-Type": "text/plain",
|
47
|
-
Vary: "Accept",
|
48
|
-
},
|
49
|
-
});
|
50
|
-
},
|
51
|
-
};
|
52
|
-
}
|
53
|
-
/**
|
54
|
-
* Create an Astro middleware handler to integrate with the {@link Federation}
|
55
|
-
* object.
|
56
|
-
*
|
57
|
-
* @example src/middleware.ts
|
58
|
-
* ``` typescript
|
59
|
-
* import type { MiddlewareHandler } from "astro";
|
60
|
-
* import { createMiddleware } from "@fedify/fedify/x/astro";
|
61
|
-
* import { federation } from "./federation"; // Import the `Federation` object
|
62
|
-
*
|
63
|
-
* export const onRequest: MiddlewareHandler = createMiddleware(
|
64
|
-
* federation,
|
65
|
-
* (astroContext) => "context data",
|
66
|
-
* );
|
67
|
-
* ```
|
68
|
-
*
|
69
|
-
* @typeParam TContextData A type of the context data for the {@link Federation}
|
70
|
-
* object.
|
71
|
-
* @typeParam TAstroContext A type of the Astro context.
|
72
|
-
* @param federation A {@link Federation} object to integrate with Astro.
|
73
|
-
* @param contextDataFactory A factory function to create a context data for the
|
74
|
-
* {@link Federation} object.
|
75
|
-
* @returns An Astro middleware handler.
|
76
|
-
* @since 0.12.0
|
77
|
-
*/
|
78
|
-
export function createMiddleware(federation, contextDataFactory) {
|
79
|
-
return async (context, next) => {
|
80
|
-
const contextData = await contextDataFactory(context);
|
81
|
-
return await federation.fetch(context.request, {
|
82
|
-
contextData,
|
83
|
-
...createFetchOptions(context, next),
|
84
|
-
});
|
85
|
-
};
|
86
|
-
}
|
package/types/x/astro.d.ts
DELETED
@@ -1,90 +0,0 @@
|
|
1
|
-
/// <reference types="node" />
|
2
|
-
/// <reference types="node" />
|
3
|
-
/**
|
4
|
-
* Fedify with Astro
|
5
|
-
* =================
|
6
|
-
*
|
7
|
-
* This module contains some utilities for integrating Fedify with
|
8
|
-
* the [Astro] framework.
|
9
|
-
*
|
10
|
-
* > [!NOTE]
|
11
|
-
* >
|
12
|
-
* > Astro integration requires [on-demand server rendering][1].
|
13
|
-
*
|
14
|
-
* [Astro]: https://astro.build/
|
15
|
-
* [1]: https://docs.astro.build/en/guides/server-side-rendering/
|
16
|
-
*
|
17
|
-
* @module
|
18
|
-
* @since 0.12.0
|
19
|
-
*/
|
20
|
-
import type { Federation, FederationFetchOptions } from "../federation/middleware.js";
|
21
|
-
interface AstroContext {
|
22
|
-
request: Request;
|
23
|
-
}
|
24
|
-
type RewritePayload = string | URL | Request;
|
25
|
-
type MiddlewareNext = (rewritePayload?: RewritePayload) => Promise<Response>;
|
26
|
-
type MiddlewareHandler<TAstroContext extends AstroContext> = (context: TAstroContext, next: MiddlewareNext) => Promise<Response> | Response | Promise<void> | void;
|
27
|
-
/**
|
28
|
-
* Create options for the {@link Federation.fetch} method to integrate with
|
29
|
-
* Astro.
|
30
|
-
*
|
31
|
-
* @example src/middleware.ts
|
32
|
-
* ``` typescript
|
33
|
-
* import { defineMiddleware } from "astro:middleware";
|
34
|
-
* import { createFetchOptions } from "@fedify/fedify/x/astro";
|
35
|
-
* import { federation } from "./federation"; // Import the `Federation` object
|
36
|
-
*
|
37
|
-
* export const onRequest = defineMiddleware((context, next) => {
|
38
|
-
* return federation.fetch(context.request, {
|
39
|
-
* contextData: undefined,
|
40
|
-
* ...createFetchOptions(context, next),
|
41
|
-
* });
|
42
|
-
* });
|
43
|
-
* ```
|
44
|
-
*
|
45
|
-
* @typeParam TAstroContext A type of the Astro context.
|
46
|
-
* @param context An Astro context.
|
47
|
-
* @param next A function to call the next middleware.
|
48
|
-
* @returns Options for the {@link Federation.fetch} method.
|
49
|
-
* @since 0.12.0
|
50
|
-
*/
|
51
|
-
export declare function createFetchOptions<TAstroContext extends AstroContext>(_context: TAstroContext, next: MiddlewareNext): Omit<FederationFetchOptions<void>, "contextData">;
|
52
|
-
/**
|
53
|
-
* The factory function to create a context data for
|
54
|
-
* the {@link Federation.fetch}.
|
55
|
-
*
|
56
|
-
* @typeParam TContextData A type of the context data.
|
57
|
-
* @typeParam TAstroContext A type of the Astro context.
|
58
|
-
* @param context An Astro context.
|
59
|
-
* @returns The context data for the {@link Federation.fetch}.
|
60
|
-
* @since 0.12.0
|
61
|
-
*/
|
62
|
-
export type ContextDataFactory<TContextData, TAstroContext extends AstroContext> = (context: TAstroContext) => TContextData | Promise<TContextData>;
|
63
|
-
/**
|
64
|
-
* Create an Astro middleware handler to integrate with the {@link Federation}
|
65
|
-
* object.
|
66
|
-
*
|
67
|
-
* @example src/middleware.ts
|
68
|
-
* ``` typescript
|
69
|
-
* import type { MiddlewareHandler } from "astro";
|
70
|
-
* import { createMiddleware } from "@fedify/fedify/x/astro";
|
71
|
-
* import { federation } from "./federation"; // Import the `Federation` object
|
72
|
-
*
|
73
|
-
* export const onRequest: MiddlewareHandler = createMiddleware(
|
74
|
-
* federation,
|
75
|
-
* (astroContext) => "context data",
|
76
|
-
* );
|
77
|
-
* ```
|
78
|
-
*
|
79
|
-
* @typeParam TContextData A type of the context data for the {@link Federation}
|
80
|
-
* object.
|
81
|
-
* @typeParam TAstroContext A type of the Astro context.
|
82
|
-
* @param federation A {@link Federation} object to integrate with Astro.
|
83
|
-
* @param contextDataFactory A factory function to create a context data for the
|
84
|
-
* {@link Federation} object.
|
85
|
-
* @returns An Astro middleware handler.
|
86
|
-
* @since 0.12.0
|
87
|
-
*/
|
88
|
-
export declare function createMiddleware<TContextData, TAstroContext extends AstroContext>(federation: Federation<TContextData>, contextDataFactory: ContextDataFactory<TContextData, TAstroContext>): MiddlewareHandler<TAstroContext>;
|
89
|
-
export {};
|
90
|
-
//# sourceMappingURL=astro.d.ts.map
|
package/types/x/astro.d.ts.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"astro.d.ts","sourceRoot":"","sources":["../../src/x/astro.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,EACV,UAAU,EACV,sBAAsB,EACvB,MAAM,6BAA6B,CAAC;AAErC,UAAU,YAAY;IACpB,OAAO,EAAE,OAAO,CAAC;CAClB;AACD,KAAK,cAAc,GAAG,MAAM,GAAG,GAAG,GAAG,OAAO,CAAC;AAC7C,KAAK,cAAc,GAAG,CACpB,cAAc,CAAC,EAAE,cAAc,KAC5B,OAAO,CAAC,QAAQ,CAAC,CAAC;AACvB,KAAK,iBAAiB,CAAC,aAAa,SAAS,YAAY,IAAI,CAC3D,OAAO,EAAE,aAAa,EACtB,IAAI,EAAE,cAAc,KACjB,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,GAAG,OAAO,CAAC,IAAI,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