@fragno-dev/telegram-fragment 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/client/react.d.ts +129 -3
- package/dist/browser/client/react.d.ts.map +1 -1
- package/dist/browser/client/react.js +32 -22
- package/dist/browser/client/react.js.map +1 -1
- package/dist/browser/client/solid.d.ts +129 -3
- package/dist/browser/client/solid.d.ts.map +1 -1
- package/dist/browser/client/solid.js +2 -2
- package/dist/browser/client/solid.js.map +1 -1
- package/dist/browser/client/svelte.d.ts +129 -3
- package/dist/browser/client/svelte.d.ts.map +1 -1
- package/dist/browser/client/svelte.js +1 -1
- package/dist/browser/client/vanilla.d.ts +129 -3
- package/dist/browser/client/vanilla.d.ts.map +1 -1
- package/dist/browser/client/vanilla.js +1 -1
- package/dist/browser/client/vue.d.ts +129 -3
- package/dist/browser/client/vue.d.ts.map +1 -1
- package/dist/browser/client/vue.js +1 -1
- package/dist/browser/{client-Bk-J98pf.d.ts → client-BumUy6cu.d.ts} +87 -83
- package/dist/browser/client-BumUy6cu.d.ts.map +1 -0
- package/dist/browser/index.d.ts +697 -48
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser/index.js +2 -2
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/{schema-QDMf15Vn.js → schema-IrJsGm4M.js} +264 -41
- package/dist/browser/schema-IrJsGm4M.js.map +1 -0
- package/dist/node/definition.d.ts.map +1 -1
- package/dist/node/index.d.ts +260 -13
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +2 -2
- package/dist/node/index.js.map +1 -1
- package/dist/node/routes.d.ts +130 -9
- package/dist/node/routes.d.ts.map +1 -1
- package/dist/node/routes.js +25 -15
- package/dist/node/routes.js.map +1 -1
- package/dist/node/services.js +56 -53
- package/dist/node/services.js.map +1 -1
- package/dist/node/telegram-api.js +80 -16
- package/dist/node/telegram-api.js.map +1 -1
- package/dist/node/telegram-utils.js +284 -9
- package/dist/node/telegram-utils.js.map +1 -1
- package/dist/node/types.d.ts +308 -27
- package/dist/node/types.d.ts.map +1 -1
- package/dist/node/types.js +232 -27
- package/dist/node/types.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -8
- package/dist/browser/client-Bk-J98pf.d.ts.map +0 -1
- package/dist/browser/schema-QDMf15Vn.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as FragnoPublicClientConfig, c as InferOr, d as MaybeExtractPathParamsOrWiden, f as QueryParamsHint, i as ReadableAtom, l as ExtractPathParamsOrWiden, o as NonGetHTTPMethod, r as FetcherValue, s as FragnoClientError, u as HasPathParams } from "../client-BumUy6cu.js";
|
|
2
2
|
import * as zod from "zod";
|
|
3
3
|
import "react";
|
|
4
4
|
import * as zod_v4_core0 from "zod/v4/core";
|
|
@@ -98,7 +98,7 @@ declare function createTelegramFragmentClient(config?: FragnoPublicClientConfig)
|
|
|
98
98
|
supergroup: "supergroup";
|
|
99
99
|
channel: "channel";
|
|
100
100
|
}>>>;
|
|
101
|
-
}, zod_v4_core0.$
|
|
101
|
+
}, zod_v4_core0.$strip>>>;
|
|
102
102
|
createdAt: zod.ZodDate;
|
|
103
103
|
updatedAt: zod.ZodDate;
|
|
104
104
|
}, zod_v4_core0.$strip>>, string, "type">;
|
|
@@ -122,7 +122,7 @@ declare function createTelegramFragmentClient(config?: FragnoPublicClientConfig)
|
|
|
122
122
|
supergroup: "supergroup";
|
|
123
123
|
channel: "channel";
|
|
124
124
|
}>>>;
|
|
125
|
-
}, zod_v4_core0.$
|
|
125
|
+
}, zod_v4_core0.$strip>>>;
|
|
126
126
|
createdAt: zod.ZodDate;
|
|
127
127
|
updatedAt: zod.ZodDate;
|
|
128
128
|
}, zod_v4_core0.$strip>;
|
|
@@ -160,6 +160,132 @@ declare function createTelegramFragmentClient(config?: FragnoPublicClientConfig)
|
|
|
160
160
|
channel_post: "channel_post";
|
|
161
161
|
}>;
|
|
162
162
|
text: zod.ZodNullable<zod.ZodString>;
|
|
163
|
+
attachments: zod.ZodArray<zod.ZodDiscriminatedUnion<[zod.ZodObject<{
|
|
164
|
+
kind: zod.ZodLiteral<"photo">;
|
|
165
|
+
fileId: zod.ZodString;
|
|
166
|
+
fileUniqueId: zod.ZodString;
|
|
167
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
168
|
+
width: zod.ZodNumber;
|
|
169
|
+
height: zod.ZodNumber;
|
|
170
|
+
thumbnail: zod.ZodOptional<zod.ZodObject<{
|
|
171
|
+
fileId: zod.ZodString;
|
|
172
|
+
fileUniqueId: zod.ZodString;
|
|
173
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
174
|
+
width: zod.ZodNumber;
|
|
175
|
+
height: zod.ZodNumber;
|
|
176
|
+
}, zod_v4_core0.$strip>>;
|
|
177
|
+
sizes: zod.ZodArray<zod.ZodObject<{
|
|
178
|
+
fileId: zod.ZodString;
|
|
179
|
+
fileUniqueId: zod.ZodString;
|
|
180
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
181
|
+
width: zod.ZodNumber;
|
|
182
|
+
height: zod.ZodNumber;
|
|
183
|
+
}, zod_v4_core0.$strip>>;
|
|
184
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
185
|
+
kind: zod.ZodLiteral<"voice">;
|
|
186
|
+
fileId: zod.ZodString;
|
|
187
|
+
fileUniqueId: zod.ZodString;
|
|
188
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
189
|
+
duration: zod.ZodNumber;
|
|
190
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
191
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
192
|
+
kind: zod.ZodLiteral<"audio">;
|
|
193
|
+
fileId: zod.ZodString;
|
|
194
|
+
fileUniqueId: zod.ZodString;
|
|
195
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
196
|
+
duration: zod.ZodNumber;
|
|
197
|
+
performer: zod.ZodOptional<zod.ZodString>;
|
|
198
|
+
title: zod.ZodOptional<zod.ZodString>;
|
|
199
|
+
fileName: zod.ZodOptional<zod.ZodString>;
|
|
200
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
201
|
+
thumbnail: zod.ZodOptional<zod.ZodObject<{
|
|
202
|
+
fileId: zod.ZodString;
|
|
203
|
+
fileUniqueId: zod.ZodString;
|
|
204
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
205
|
+
width: zod.ZodNumber;
|
|
206
|
+
height: zod.ZodNumber;
|
|
207
|
+
}, zod_v4_core0.$strip>>;
|
|
208
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
209
|
+
kind: zod.ZodLiteral<"document">;
|
|
210
|
+
fileId: zod.ZodString;
|
|
211
|
+
fileUniqueId: zod.ZodString;
|
|
212
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
213
|
+
fileName: zod.ZodOptional<zod.ZodString>;
|
|
214
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
215
|
+
thumbnail: zod.ZodOptional<zod.ZodObject<{
|
|
216
|
+
fileId: zod.ZodString;
|
|
217
|
+
fileUniqueId: zod.ZodString;
|
|
218
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
219
|
+
width: zod.ZodNumber;
|
|
220
|
+
height: zod.ZodNumber;
|
|
221
|
+
}, zod_v4_core0.$strip>>;
|
|
222
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
223
|
+
kind: zod.ZodLiteral<"video">;
|
|
224
|
+
fileId: zod.ZodString;
|
|
225
|
+
fileUniqueId: zod.ZodString;
|
|
226
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
227
|
+
width: zod.ZodNumber;
|
|
228
|
+
height: zod.ZodNumber;
|
|
229
|
+
duration: zod.ZodNumber;
|
|
230
|
+
fileName: zod.ZodOptional<zod.ZodString>;
|
|
231
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
232
|
+
thumbnail: zod.ZodOptional<zod.ZodObject<{
|
|
233
|
+
fileId: zod.ZodString;
|
|
234
|
+
fileUniqueId: zod.ZodString;
|
|
235
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
236
|
+
width: zod.ZodNumber;
|
|
237
|
+
height: zod.ZodNumber;
|
|
238
|
+
}, zod_v4_core0.$strip>>;
|
|
239
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
240
|
+
kind: zod.ZodLiteral<"video_note">;
|
|
241
|
+
fileId: zod.ZodString;
|
|
242
|
+
fileUniqueId: zod.ZodString;
|
|
243
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
244
|
+
length: zod.ZodNumber;
|
|
245
|
+
duration: zod.ZodNumber;
|
|
246
|
+
thumbnail: zod.ZodOptional<zod.ZodObject<{
|
|
247
|
+
fileId: zod.ZodString;
|
|
248
|
+
fileUniqueId: zod.ZodString;
|
|
249
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
250
|
+
width: zod.ZodNumber;
|
|
251
|
+
height: zod.ZodNumber;
|
|
252
|
+
}, zod_v4_core0.$strip>>;
|
|
253
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
254
|
+
kind: zod.ZodLiteral<"sticker">;
|
|
255
|
+
fileId: zod.ZodString;
|
|
256
|
+
fileUniqueId: zod.ZodString;
|
|
257
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
258
|
+
width: zod.ZodNumber;
|
|
259
|
+
height: zod.ZodNumber;
|
|
260
|
+
emoji: zod.ZodOptional<zod.ZodString>;
|
|
261
|
+
setName: zod.ZodOptional<zod.ZodString>;
|
|
262
|
+
isAnimated: zod.ZodBoolean;
|
|
263
|
+
isVideo: zod.ZodBoolean;
|
|
264
|
+
thumbnail: zod.ZodOptional<zod.ZodObject<{
|
|
265
|
+
fileId: zod.ZodString;
|
|
266
|
+
fileUniqueId: zod.ZodString;
|
|
267
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
268
|
+
width: zod.ZodNumber;
|
|
269
|
+
height: zod.ZodNumber;
|
|
270
|
+
}, zod_v4_core0.$strip>>;
|
|
271
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
272
|
+
kind: zod.ZodLiteral<"animation">;
|
|
273
|
+
fileId: zod.ZodString;
|
|
274
|
+
fileUniqueId: zod.ZodString;
|
|
275
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
276
|
+
width: zod.ZodNumber;
|
|
277
|
+
height: zod.ZodNumber;
|
|
278
|
+
duration: zod.ZodNumber;
|
|
279
|
+
fileName: zod.ZodOptional<zod.ZodString>;
|
|
280
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
281
|
+
thumbnail: zod.ZodOptional<zod.ZodObject<{
|
|
282
|
+
fileId: zod.ZodString;
|
|
283
|
+
fileUniqueId: zod.ZodString;
|
|
284
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
285
|
+
width: zod.ZodNumber;
|
|
286
|
+
height: zod.ZodNumber;
|
|
287
|
+
}, zod_v4_core0.$strip>>;
|
|
288
|
+
}, zod_v4_core0.$strip>], "kind">>;
|
|
163
289
|
payload: zod.ZodNullable<zod.ZodUnknown>;
|
|
164
290
|
sentAt: zod.ZodDate;
|
|
165
291
|
editedAt: zod.ZodNullable<zod.ZodDate>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.ts","names":["ExtractPathParamsOrWiden","HasPathParams","MaybeExtractPathParamsOrWiden","QueryParamsHint","InferOr","
|
|
1
|
+
{"version":3,"file":"react.d.ts","names":["ExtractPathParamsOrWiden","HasPathParams","MaybeExtractPathParamsOrWiden","QueryParamsHint","InferOr","FragnoClientError","FragnoClientHookData","FragnoClientMutatorData","FragnoStoreFactoryData","FragnoStoreObjectData","NonGetHTTPMethod","ReadableAtom","Store","StoreValue","FetcherValue","react0","DependencyList","StandardSchemaV1","FragnoReactHook","_TMethod","TPath$1","TOutputSchema$1","TErrorCode$1","TQueryParameters$1","InferOutput","NonNullable","path","query","args","FragnoReactMutator","TInputSchema","body","Promise","mutate","loading","error","data","FragnoReactStoreValue","T","TStore","K","FragnoReactStore","TArgs","useFragno","Record","TPath","TOutputSchema","TErrorCode","TQueryParameters","TMethod","TInput","TOutput","TError","TStoreObj","TStoreArgs","clientObj","StoreKeys","setKey","k","v","UseStoreOptions","SomeStore","deps","keys","useStore","store","options","FragnoHydrator","children","React","ReactNode"],"sources":["../../../../fragno/dist/client/react.d.ts","../../../src/client/react.ts"],"mappings":";;;;;;;;KAYKkB,eAAAA,yEAAwFD,gBAAAA,qEAAqFW,IAAAA;EAChLF,IAAAA,GAAOxB,6BAAAA,CAA8BkB,OAAAA,WAAkBT,YAAAA;EACvDgB,KAAAA,GAAQxB,eAAAA,CAAgBoB,kBAAAA,WAA6BZ,YAAAA;AAAAA,MACjDG,YAAAA,CAAaG,gBAAAA,CAAiBO,WAAAA,CAAYH,eAAAA,GAAkBhB,iBAAAA,CAAkBoB,WAAAA,CAAYH,YAAAA;AAAAA,KAC3FO,kBAAAA,kBAAoCnB,gBAAAA,+CAA+DO,gBAAAA,sCAAsDA,gBAAAA;EAC5JgB,MAAAA;IACEF,IAAAA;IACAL,IAAAA;IACAC;EAAAA;IAEAI,IAAAA,GAAO3B,OAAAA,CAAQ0B,YAAAA;IACfJ,IAAAA,GAAOzB,aAAAA,CAAcmB,OAAAA,iBAAwBpB,wBAAAA,CAAyBoB,OAAAA,WAAkBT,YAAAA;IACxFgB,KAAAA,GAAQxB,eAAAA,CAAgBoB,kBAAAA,WAA6BZ,YAAAA;EAAAA,MACjDqB,OAAAA,CAAQ5B,OAAAA,CAAQiB,eAAAA;EACtBa,OAAAA;EACAC,KAAAA,GAAQ9B,iBAAAA,CAAkBoB,WAAAA,CAAYH,YAAAA;EACtCc,IAAAA,GAAOhC,OAAAA,CAAQiB,eAAAA;AAAAA;;;;;;iBCvBD,4BAAA,CAA6B,MAAA,GAAQ,wBAAA;;;YAA6B,GAAA,CAAA,SAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as isStore, l as isGetHook, p as isReadableAtom, u as isMutatorHook } from "../schema-IrJsGm4M.js";
|
|
2
2
|
import { createTelegramFragmentClients } from "../index.js";
|
|
3
3
|
import { useCallback, useEffect, useMemo, useRef, useSyncExternalStore } from "react";
|
|
4
4
|
|
|
5
|
-
//#region ../../node_modules/.pnpm/nanostores@1.
|
|
5
|
+
//#region ../../node_modules/.pnpm/nanostores@1.2.0/node_modules/nanostores/listen-keys/index.js
|
|
6
6
|
function listenKeys($store, keys, listener) {
|
|
7
7
|
let keysSet = new Set(keys).add(void 0);
|
|
8
8
|
return $store.listen((value, oldValue, changed) => {
|
|
@@ -52,21 +52,33 @@ const getStoreDisposer = (value) => {
|
|
|
52
52
|
const disposer = value[Symbol.dispose];
|
|
53
53
|
return typeof disposer === "function" ? disposer.bind(value) : void 0;
|
|
54
54
|
};
|
|
55
|
+
const createReactStoreObjectView = (value, getAtomValue) => {
|
|
56
|
+
const atomValues = /* @__PURE__ */ new Map();
|
|
57
|
+
const boundMethods = /* @__PURE__ */ new Map();
|
|
58
|
+
return new Proxy(value, { get(target, property, _receiver) {
|
|
59
|
+
const propertyValue = Reflect.get(target, property, target);
|
|
60
|
+
if (isReadableAtom(propertyValue)) {
|
|
61
|
+
if (atomValues.has(propertyValue)) return atomValues.get(propertyValue);
|
|
62
|
+
const atomValue = getAtomValue(propertyValue);
|
|
63
|
+
atomValues.set(propertyValue, atomValue);
|
|
64
|
+
return atomValue;
|
|
65
|
+
}
|
|
66
|
+
if (typeof propertyValue === "function") {
|
|
67
|
+
if (boundMethods.has(property)) return boundMethods.get(property);
|
|
68
|
+
const boundMethod = propertyValue.bind(target);
|
|
69
|
+
boundMethods.set(property, boundMethod);
|
|
70
|
+
return boundMethod;
|
|
71
|
+
}
|
|
72
|
+
return propertyValue;
|
|
73
|
+
} });
|
|
74
|
+
};
|
|
55
75
|
function unwrapReactStoreValueOnServer(value) {
|
|
56
76
|
if (isReadableAtom(value)) return value.get();
|
|
57
|
-
|
|
58
|
-
for (const key in value) {
|
|
59
|
-
if (!Object.prototype.hasOwnProperty.call(value, key)) continue;
|
|
60
|
-
const fieldValue = value[key];
|
|
61
|
-
if (isReadableAtom(fieldValue)) result[key] = fieldValue.get();
|
|
62
|
-
else result[key] = fieldValue;
|
|
63
|
-
}
|
|
64
|
-
return result;
|
|
77
|
+
return createReactStoreObjectView(value, (store) => store.get());
|
|
65
78
|
}
|
|
66
79
|
function unwrapReactStoreValue(value) {
|
|
67
80
|
if (isReadableAtom(value)) return useStore(value);
|
|
68
|
-
const
|
|
69
|
-
const atomEntries = keys.flatMap((key) => {
|
|
81
|
+
const atomEntries = Object.keys(value).flatMap((key) => {
|
|
70
82
|
const fieldValue = value[key];
|
|
71
83
|
return isReadableAtom(fieldValue) ? [[key, fieldValue]] : [];
|
|
72
84
|
});
|
|
@@ -84,16 +96,14 @@ function unwrapReactStoreValue(value) {
|
|
|
84
96
|
for (const unsubscribe of unsubscribes) unsubscribe();
|
|
85
97
|
};
|
|
86
98
|
}, getSnapshot, getSnapshot);
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
return result;
|
|
99
|
+
return useMemo(() => createReactStoreObjectView(value, (store) => {
|
|
100
|
+
const atomIndex = atomEntries.findIndex(([, entryStore]) => entryStore === store);
|
|
101
|
+
return atomIndex === -1 ? store.get() : atomValues[atomIndex];
|
|
102
|
+
}), [
|
|
103
|
+
value,
|
|
104
|
+
atomEntries,
|
|
105
|
+
atomValues
|
|
106
|
+
]);
|
|
97
107
|
}
|
|
98
108
|
function createReactStore(hook) {
|
|
99
109
|
return (...args) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.js","names":["listenKeys","$store","keys","listener","keysSet","Set","add","undefined","listen","value","oldValue","changed","has","subscribeKeys","unbind","isReadableAtom","hydrateFromWindow","isGetHook","isMutatorHook","isStore","listenKeys","useCallback","useEffect","useMemo","useRef","useSyncExternalStore","createReactHook","hook","path","query","pathParamValues","Object","values","queryParamValues","store","window","get","useStore","createReactMutator","mutatorStore","isPlainObject","value","prototype","getPrototypeOf","areStoreFactoryValuesEqual","left","right","is","Array","isArray","length","every","index","Date","getTime","leftKeys","keys","sort","rightKeys","key","areStoreFactoryArgsEqual","getStoreDisposer","disposer","Symbol","dispose","bind","unwrapReactStoreValueOnServer","result","hasOwnProperty","call","fieldValue","unwrapReactStoreValue","atomEntries","flatMap","snapshotRef","map","getSnapshot","nextSnapshot","previousSnapshot","current","entry","atomValues","onStoreChange","unsubscribes","listen","unsubscribe","atomIndex","createReactStore","args","stableArgsRef","pendingDisposalsRef","Map","factory","obj","pendingTimeout","clearTimeout","delete","timeoutId","setTimeout","set","useFragno","clientObj","options","deps","subscribe","onChange","emitChange","FragnoHydrator","children","FragnoPublicClientConfig","useFragno","createTelegramFragmentClients","createTelegramFragmentClient","config"],"sources":["../../../../../node_modules/.pnpm/nanostores@1.1.0/node_modules/nanostores/listen-keys/index.js","../../../../fragno/dist/client/react.js","../../../src/client/react.ts"],"sourcesContent":["export function listenKeys($store, keys, listener) {\n let keysSet = new Set(keys).add(undefined)\n return $store.listen((value, oldValue, changed) => {\n if (keysSet.has(changed)) {\n listener(value, oldValue, changed)\n }\n })\n}\n\nexport function subscribeKeys($store, keys, listener) {\n let unbind = listenKeys($store, keys, listener)\n listener($store.value)\n return unbind\n}\n","import { isReadableAtom } from \"../util/nanostores.js\";\nimport { hydrateFromWindow } from \"../util/ssr.js\";\nimport { isGetHook, isMutatorHook, isStore } from \"./client.js\";\nimport { listenKeys } from \"nanostores\";\nimport { useCallback, useEffect, useMemo, useRef, useSyncExternalStore } from \"react\";\n\n//#region src/client/react.ts\nfunction createReactHook(hook) {\n\treturn ({ path, query } = {}) => {\n\t\tconst pathParamValues = path ? Object.values(path) : [];\n\t\tconst queryParamValues = query ? Object.values(query) : [];\n\t\tconst store = useMemo(() => hook.store({\n\t\t\tpath,\n\t\t\tquery\n\t\t}), [hook, ...[...pathParamValues, ...queryParamValues]]);\n\t\tif (typeof window === \"undefined\") return store.get();\n\t\treturn useStore(store);\n\t};\n}\nfunction createReactMutator(hook) {\n\treturn () => {\n\t\treturn useStore(useMemo(() => hook.mutatorStore, [hook]));\n\t};\n}\nconst isPlainObject = (value) => {\n\tif (!value || typeof value !== \"object\") return false;\n\tconst prototype = Object.getPrototypeOf(value);\n\treturn prototype === Object.prototype || prototype === null;\n};\nconst areStoreFactoryValuesEqual = (left, right) => {\n\tif (Object.is(left, right)) return true;\n\tif (Array.isArray(left) && Array.isArray(right)) return left.length === right.length && left.every((value, index) => areStoreFactoryValuesEqual(value, right[index]));\n\tif (left instanceof Date && right instanceof Date) return left.getTime() === right.getTime();\n\tif (isReadableAtom(left) || isReadableAtom(right)) return left === right;\n\tif (typeof left === \"function\" || typeof right === \"function\") return left === right;\n\tif (isPlainObject(left) && isPlainObject(right)) {\n\t\tconst leftKeys = Object.keys(left).sort();\n\t\tconst rightKeys = Object.keys(right).sort();\n\t\treturn leftKeys.length === rightKeys.length && leftKeys.every((key, index) => key === rightKeys[index] && areStoreFactoryValuesEqual(left[key], right[key]));\n\t}\n\treturn false;\n};\nconst areStoreFactoryArgsEqual = (left, right) => left.length === right.length && left.every((value, index) => areStoreFactoryValuesEqual(value, right[index]));\nconst getStoreDisposer = (value) => {\n\tconst disposer = value[Symbol.dispose];\n\treturn typeof disposer === \"function\" ? disposer.bind(value) : void 0;\n};\nfunction unwrapReactStoreValueOnServer(value) {\n\tif (isReadableAtom(value)) return value.get();\n\tconst result = {};\n\tfor (const key in value) {\n\t\tif (!Object.prototype.hasOwnProperty.call(value, key)) continue;\n\t\tconst fieldValue = value[key];\n\t\tif (isReadableAtom(fieldValue)) result[key] = fieldValue.get();\n\t\telse result[key] = fieldValue;\n\t}\n\treturn result;\n}\nfunction unwrapReactStoreValue(value) {\n\tif (isReadableAtom(value)) return useStore(value);\n\tconst keys = Object.keys(value);\n\tconst atomEntries = keys.flatMap((key) => {\n\t\tconst fieldValue = value[key];\n\t\treturn isReadableAtom(fieldValue) ? [[key, fieldValue]] : [];\n\t});\n\tconst snapshotRef = useRef(atomEntries.map(([, store]) => store.get()));\n\tconst getSnapshot = () => {\n\t\tconst nextSnapshot = atomEntries.map(([, store]) => store.get());\n\t\tconst previousSnapshot = snapshotRef.current;\n\t\tif (previousSnapshot.length === nextSnapshot.length && previousSnapshot.every((entry, index) => Object.is(entry, nextSnapshot[index]))) return previousSnapshot;\n\t\tsnapshotRef.current = nextSnapshot;\n\t\treturn nextSnapshot;\n\t};\n\tconst atomValues = useSyncExternalStore((onStoreChange) => {\n\t\tconst unsubscribes = atomEntries.map(([, store]) => store.listen(onStoreChange));\n\t\treturn () => {\n\t\t\tfor (const unsubscribe of unsubscribes) unsubscribe();\n\t\t};\n\t}, getSnapshot, getSnapshot);\n\tconst result = {};\n\tlet atomIndex = 0;\n\tfor (const key of keys) {\n\t\tconst fieldValue = value[key];\n\t\tif (isReadableAtom(fieldValue)) {\n\t\t\tresult[key] = atomValues[atomIndex];\n\t\t\tatomIndex += 1;\n\t\t} else result[key] = fieldValue;\n\t}\n\treturn result;\n}\nfunction createReactStore(hook) {\n\treturn ((...args) => {\n\t\tconst stableArgsRef = useRef(args);\n\t\tconst pendingDisposalsRef = useRef(/* @__PURE__ */ new Map());\n\t\tif (!areStoreFactoryArgsEqual(stableArgsRef.current, args)) stableArgsRef.current = args;\n\t\tconst value = useMemo(() => {\n\t\t\tif (\"factory\" in hook) return hook.factory(...stableArgsRef.current);\n\t\t\treturn hook.obj;\n\t\t}, [hook, stableArgsRef.current]);\n\t\tuseEffect(() => {\n\t\t\tconst disposer = getStoreDisposer(value);\n\t\t\tconst pendingTimeout = pendingDisposalsRef.current.get(value);\n\t\t\tif (pendingTimeout !== void 0) {\n\t\t\t\tclearTimeout(pendingTimeout);\n\t\t\t\tpendingDisposalsRef.current.delete(value);\n\t\t\t}\n\t\t\treturn () => {\n\t\t\t\tif (!disposer) return;\n\t\t\t\tconst timeoutId = setTimeout(() => {\n\t\t\t\t\tpendingDisposalsRef.current.delete(value);\n\t\t\t\t\tdisposer();\n\t\t\t\t}, 0);\n\t\t\t\tpendingDisposalsRef.current.set(value, timeoutId);\n\t\t\t};\n\t\t}, [value]);\n\t\tif (typeof window === \"undefined\") return unwrapReactStoreValueOnServer(value);\n\t\treturn unwrapReactStoreValue(value);\n\t});\n}\nfunction useFragno(clientObj) {\n\tconst result = {};\n\tfor (const key in clientObj) {\n\t\tif (!Object.prototype.hasOwnProperty.call(clientObj, key)) continue;\n\t\tconst hook = clientObj[key];\n\t\tif (isGetHook(hook)) result[key] = createReactHook(hook);\n\t\telse if (isMutatorHook(hook)) result[key] = createReactMutator(hook);\n\t\telse if (isStore(hook)) result[key] = createReactStore(hook);\n\t\telse result[key] = hook;\n\t}\n\treturn result;\n}\nfunction useStore(store, options = {}) {\n\tconst snapshotRef = useRef(store.get());\n\tconst { keys, deps = [store, keys] } = options;\n\tconst subscribe = useCallback((onChange) => {\n\t\tconst emitChange = (value) => {\n\t\t\tif (snapshotRef.current === value) return;\n\t\t\tsnapshotRef.current = value;\n\t\t\tonChange();\n\t\t};\n\t\temitChange(store.value);\n\t\tif (keys?.length) return listenKeys(store, keys, emitChange);\n\t\treturn store.listen(emitChange);\n\t}, deps);\n\tconst get = () => snapshotRef.current;\n\treturn useSyncExternalStore(subscribe, get, () => {\n\t\treturn get();\n\t});\n}\nfunction FragnoHydrator({ children }) {\n\tuseMemo(() => {\n\t\thydrateFromWindow();\n\t}, []);\n\treturn children;\n}\n\n//#endregion\nexport { FragnoHydrator, useFragno, useStore };\n//# sourceMappingURL=react.js.map","import type { FragnoPublicClientConfig } from \"@fragno-dev/core/client\";\nimport { useFragno } from \"@fragno-dev/core/react\";\n\nimport { createTelegramFragmentClients } from \"..\";\n\nexport function createTelegramFragmentClient(config: FragnoPublicClientConfig = {}) {\n return useFragno(createTelegramFragmentClients(config));\n}\n"],"x_google_ignoreList":[0],"mappings":";;;;;AAAA,SAAgBA,WAAWC,QAAQC,MAAMC,UAAU;CACjD,IAAIC,UAAU,IAAIC,IAAIH,KAAK,CAACI,IAAIC,OAAU;AAC1C,QAAON,OAAOO,QAAQC,OAAOC,UAAUC,YAAY;AACjD,MAAIP,QAAQQ,IAAID,QAAQ,CACtBR,UAASM,OAAOC,UAAUC,QAAQ;GAEpC;;;;;ACCJ,SAASe,gBAAgBC,MAAM;AAC9B,SAAQ,EAAEC,MAAMC,UAAU,EAAE,KAAK;EAChC,MAAMC,kBAAkBF,OAAOG,OAAOC,OAAOJ,KAAK,GAAG,EAAE;EACvD,MAAMK,mBAAmBJ,QAAQE,OAAOC,OAAOH,MAAM,GAAG,EAAE;EAC1D,MAAMK,QAAQX,cAAcI,KAAKO,MAAM;GACtCN;GACAC;GACA,CAAC,EAAE,CAACF,MAAM,GAAG,CAAC,GAAGG,iBAAiB,GAAGG,iBAAiB,CAAC,CAAC;AACzD,MAAI,OAAOE,WAAW,YAAa,QAAOD,MAAME,KAAK;AACrD,SAAOC,SAASH,MAAM;;;AAGxB,SAASI,mBAAmBX,MAAM;AACjC,cAAa;AACZ,SAAOU,SAASd,cAAcI,KAAKY,cAAc,CAACZ,KAAK,CAAC,CAAC;;;AAG3D,MAAMa,iBAAiBC,UAAU;AAChC,KAAI,CAACA,SAAS,OAAOA,UAAU,SAAU,QAAO;CAChD,MAAMC,YAAYX,OAAOY,eAAeF,MAAM;AAC9C,QAAOC,cAAcX,OAAOW,aAAaA,cAAc;;AAExD,MAAME,8BAA8BC,MAAMC,UAAU;AACnD,KAAIf,OAAOgB,GAAGF,MAAMC,MAAM,CAAE,QAAO;AACnC,KAAIE,MAAMC,QAAQJ,KAAK,IAAIG,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B,QAAOwC;;AAER,SAAS9B,SAASH,OAAOoE,UAAU,EAAE,EAAE;CACtC,MAAM5B,cAAclD,OAAOU,MAAME,KAAK,CAAC;CACvC,MAAM,EAAEoB,MAAM+C,OAAO,CAACrE,OAAOsB,KAAI,KAAM8C;CACvC,MAAME,YAAYnF,aAAaoF,aAAa;EAC3C,MAAMC,cAAcjE,UAAU;AAC7B,OAAIiC,YAAYK,YAAYtC,MAAO;AACnCiC,eAAYK,UAAUtC;AACtBgE,aAAU;;AAEXC,aAAWxE,MAAMO,MAAM;AACvB,MAAIe,MAAMN,OAAQ,QAAO9B,WAAWc,OAAOsB,MAAMkD,WAAW;AAC5D,SAAOxE,MAAMkD,OAAOsB,WAAW;IAC7BH,KAAK;CACR,MAAMnE,YAAYsC,YAAYK;AAC9B,QAAOtD,qBAAqB+E,WAAWpE,WAAW;AACjD,SAAOA,KAAK;GACX;;;;;AC9IH,SAAgB4E,6BAA6BC,SAAmC,EAAE,EAAE;AAClF,QAAOH,UAAUC,8BAA8BE,OAAO,CAAC"}
|
|
1
|
+
{"version":3,"file":"react.js","names":["listenKeys","$store","keys","listener","keysSet","Set","add","undefined","listen","value","oldValue","changed","has","subscribeKeys","unbind","isReadableAtom","hydrateFromWindow","isGetHook","isMutatorHook","isStore","listenKeys","useCallback","useEffect","useMemo","useRef","useSyncExternalStore","createReactHook","hook","path","query","pathParamValues","Object","values","queryParamValues","store","window","get","useStore","createReactMutator","mutatorStore","isPlainObject","value","prototype","getPrototypeOf","areStoreFactoryValuesEqual","left","right","is","Array","isArray","length","every","index","Date","getTime","leftKeys","keys","sort","rightKeys","key","areStoreFactoryArgsEqual","getStoreDisposer","disposer","Symbol","dispose","bind","createReactStoreObjectView","getAtomValue","atomValues","Map","boundMethods","Proxy","target","property","_receiver","propertyValue","Reflect","has","atomValue","set","boundMethod","unwrapReactStoreValueOnServer","unwrapReactStoreValue","atomEntries","flatMap","fieldValue","snapshotRef","map","getSnapshot","nextSnapshot","previousSnapshot","current","entry","onStoreChange","unsubscribes","listen","unsubscribe","atomIndex","findIndex","entryStore","createReactStore","args","stableArgsRef","pendingDisposalsRef","factory","obj","pendingTimeout","clearTimeout","delete","timeoutId","setTimeout","useFragno","clientObj","result","hasOwnProperty","call","options","deps","subscribe","onChange","emitChange","FragnoHydrator","children","FragnoPublicClientConfig","useFragno","createTelegramFragmentClients","createTelegramFragmentClient","config"],"sources":["../../../../../node_modules/.pnpm/nanostores@1.2.0/node_modules/nanostores/listen-keys/index.js","../../../../fragno/dist/client/react.js","../../../src/client/react.ts"],"sourcesContent":["export function listenKeys($store, keys, listener) {\n let keysSet = new Set(keys).add(undefined)\n return $store.listen((value, oldValue, changed) => {\n if (keysSet.has(changed)) {\n listener(value, oldValue, changed)\n }\n })\n}\n\nexport function subscribeKeys($store, keys, listener) {\n let unbind = listenKeys($store, keys, listener)\n listener($store.value)\n return unbind\n}\n","import { isReadableAtom } from \"../util/nanostores.js\";\nimport { hydrateFromWindow } from \"../util/ssr.js\";\nimport { isGetHook, isMutatorHook, isStore } from \"./client.js\";\nimport { listenKeys } from \"nanostores\";\nimport { useCallback, useEffect, useMemo, useRef, useSyncExternalStore } from \"react\";\n\n//#region src/client/react.ts\nfunction createReactHook(hook) {\n\treturn ({ path, query } = {}) => {\n\t\tconst pathParamValues = path ? Object.values(path) : [];\n\t\tconst queryParamValues = query ? Object.values(query) : [];\n\t\tconst store = useMemo(() => hook.store({\n\t\t\tpath,\n\t\t\tquery\n\t\t}), [hook, ...[...pathParamValues, ...queryParamValues]]);\n\t\tif (typeof window === \"undefined\") return store.get();\n\t\treturn useStore(store);\n\t};\n}\nfunction createReactMutator(hook) {\n\treturn () => {\n\t\treturn useStore(useMemo(() => hook.mutatorStore, [hook]));\n\t};\n}\nconst isPlainObject = (value) => {\n\tif (!value || typeof value !== \"object\") return false;\n\tconst prototype = Object.getPrototypeOf(value);\n\treturn prototype === Object.prototype || prototype === null;\n};\nconst areStoreFactoryValuesEqual = (left, right) => {\n\tif (Object.is(left, right)) return true;\n\tif (Array.isArray(left) && Array.isArray(right)) return left.length === right.length && left.every((value, index) => areStoreFactoryValuesEqual(value, right[index]));\n\tif (left instanceof Date && right instanceof Date) return left.getTime() === right.getTime();\n\tif (isReadableAtom(left) || isReadableAtom(right)) return left === right;\n\tif (typeof left === \"function\" || typeof right === \"function\") return left === right;\n\tif (isPlainObject(left) && isPlainObject(right)) {\n\t\tconst leftKeys = Object.keys(left).sort();\n\t\tconst rightKeys = Object.keys(right).sort();\n\t\treturn leftKeys.length === rightKeys.length && leftKeys.every((key, index) => key === rightKeys[index] && areStoreFactoryValuesEqual(left[key], right[key]));\n\t}\n\treturn false;\n};\nconst areStoreFactoryArgsEqual = (left, right) => left.length === right.length && left.every((value, index) => areStoreFactoryValuesEqual(value, right[index]));\nconst getStoreDisposer = (value) => {\n\tconst disposer = value[Symbol.dispose];\n\treturn typeof disposer === \"function\" ? disposer.bind(value) : void 0;\n};\nconst createReactStoreObjectView = (value, getAtomValue) => {\n\tconst atomValues = /* @__PURE__ */ new Map();\n\tconst boundMethods = /* @__PURE__ */ new Map();\n\treturn new Proxy(value, { get(target, property, _receiver) {\n\t\tconst propertyValue = Reflect.get(target, property, target);\n\t\tif (isReadableAtom(propertyValue)) {\n\t\t\tif (atomValues.has(propertyValue)) return atomValues.get(propertyValue);\n\t\t\tconst atomValue = getAtomValue(propertyValue);\n\t\t\tatomValues.set(propertyValue, atomValue);\n\t\t\treturn atomValue;\n\t\t}\n\t\tif (typeof propertyValue === \"function\") {\n\t\t\tif (boundMethods.has(property)) return boundMethods.get(property);\n\t\t\tconst boundMethod = propertyValue.bind(target);\n\t\t\tboundMethods.set(property, boundMethod);\n\t\t\treturn boundMethod;\n\t\t}\n\t\treturn propertyValue;\n\t} });\n};\nfunction unwrapReactStoreValueOnServer(value) {\n\tif (isReadableAtom(value)) return value.get();\n\treturn createReactStoreObjectView(value, (store) => store.get());\n}\nfunction unwrapReactStoreValue(value) {\n\tif (isReadableAtom(value)) return useStore(value);\n\tconst atomEntries = Object.keys(value).flatMap((key) => {\n\t\tconst fieldValue = value[key];\n\t\treturn isReadableAtom(fieldValue) ? [[key, fieldValue]] : [];\n\t});\n\tconst snapshotRef = useRef(atomEntries.map(([, store]) => store.get()));\n\tconst getSnapshot = () => {\n\t\tconst nextSnapshot = atomEntries.map(([, store]) => store.get());\n\t\tconst previousSnapshot = snapshotRef.current;\n\t\tif (previousSnapshot.length === nextSnapshot.length && previousSnapshot.every((entry, index) => Object.is(entry, nextSnapshot[index]))) return previousSnapshot;\n\t\tsnapshotRef.current = nextSnapshot;\n\t\treturn nextSnapshot;\n\t};\n\tconst atomValues = useSyncExternalStore((onStoreChange) => {\n\t\tconst unsubscribes = atomEntries.map(([, store]) => store.listen(onStoreChange));\n\t\treturn () => {\n\t\t\tfor (const unsubscribe of unsubscribes) unsubscribe();\n\t\t};\n\t}, getSnapshot, getSnapshot);\n\treturn useMemo(() => createReactStoreObjectView(value, (store) => {\n\t\tconst atomIndex = atomEntries.findIndex(([, entryStore]) => entryStore === store);\n\t\treturn atomIndex === -1 ? store.get() : atomValues[atomIndex];\n\t}), [\n\t\tvalue,\n\t\tatomEntries,\n\t\tatomValues\n\t]);\n}\nfunction createReactStore(hook) {\n\treturn ((...args) => {\n\t\tconst stableArgsRef = useRef(args);\n\t\tconst pendingDisposalsRef = useRef(/* @__PURE__ */ new Map());\n\t\tif (!areStoreFactoryArgsEqual(stableArgsRef.current, args)) stableArgsRef.current = args;\n\t\tconst value = useMemo(() => {\n\t\t\tif (\"factory\" in hook) return hook.factory(...stableArgsRef.current);\n\t\t\treturn hook.obj;\n\t\t}, [hook, stableArgsRef.current]);\n\t\tuseEffect(() => {\n\t\t\tconst disposer = getStoreDisposer(value);\n\t\t\tconst pendingTimeout = pendingDisposalsRef.current.get(value);\n\t\t\tif (pendingTimeout !== void 0) {\n\t\t\t\tclearTimeout(pendingTimeout);\n\t\t\t\tpendingDisposalsRef.current.delete(value);\n\t\t\t}\n\t\t\treturn () => {\n\t\t\t\tif (!disposer) return;\n\t\t\t\tconst timeoutId = setTimeout(() => {\n\t\t\t\t\tpendingDisposalsRef.current.delete(value);\n\t\t\t\t\tdisposer();\n\t\t\t\t}, 0);\n\t\t\t\tpendingDisposalsRef.current.set(value, timeoutId);\n\t\t\t};\n\t\t}, [value]);\n\t\tif (typeof window === \"undefined\") return unwrapReactStoreValueOnServer(value);\n\t\treturn unwrapReactStoreValue(value);\n\t});\n}\nfunction useFragno(clientObj) {\n\tconst result = {};\n\tfor (const key in clientObj) {\n\t\tif (!Object.prototype.hasOwnProperty.call(clientObj, key)) continue;\n\t\tconst hook = clientObj[key];\n\t\tif (isGetHook(hook)) result[key] = createReactHook(hook);\n\t\telse if (isMutatorHook(hook)) result[key] = createReactMutator(hook);\n\t\telse if (isStore(hook)) result[key] = createReactStore(hook);\n\t\telse result[key] = hook;\n\t}\n\treturn result;\n}\nfunction useStore(store, options = {}) {\n\tconst snapshotRef = useRef(store.get());\n\tconst { keys, deps = [store, keys] } = options;\n\tconst subscribe = useCallback((onChange) => {\n\t\tconst emitChange = (value) => {\n\t\t\tif (snapshotRef.current === value) return;\n\t\t\tsnapshotRef.current = value;\n\t\t\tonChange();\n\t\t};\n\t\temitChange(store.value);\n\t\tif (keys?.length) return listenKeys(store, keys, emitChange);\n\t\treturn store.listen(emitChange);\n\t}, deps);\n\tconst get = () => snapshotRef.current;\n\treturn useSyncExternalStore(subscribe, get, () => {\n\t\treturn get();\n\t});\n}\nfunction FragnoHydrator({ children }) {\n\tuseMemo(() => {\n\t\thydrateFromWindow();\n\t}, []);\n\treturn children;\n}\n\n//#endregion\nexport { FragnoHydrator, useFragno, useStore };\n//# sourceMappingURL=react.js.map","import type { FragnoPublicClientConfig } from \"@fragno-dev/core/client\";\nimport { useFragno } from \"@fragno-dev/core/react\";\n\nimport { createTelegramFragmentClients } from \"..\";\n\nexport function createTelegramFragmentClient(config: FragnoPublicClientConfig = {}) {\n return useFragno(createTelegramFragmentClients(config));\n}\n"],"x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WAAWrD,IAAI,CAAE;EAC3D,MAAMhC,OAAOqF,UAAUrD;AACvB,MAAI1C,UAAUU,KAAK,CAAEsF,QAAOtD,OAAOjC,gBAAgBC,KAAK;WAC/CT,cAAcS,KAAK,CAAEsF,QAAOtD,OAAOrB,mBAAmBX,KAAK;WAC3DR,QAAQQ,KAAK,CAAEsF,QAAOtD,OAAOyC,iBAAiBzE,KAAK;MACvDsF,QAAOtD,OAAOhC;;AAEpB,QAAOsF;;AAER,SAAS5E,SAASH,OAAOkF,UAAU,EAAE,EAAE;CACtC,MAAM9B,cAAc9D,OAAOU,MAAME,KAAK,CAAC;CACvC,MAAM,EAAEoB,MAAM6D,OAAO,CAACnF,OAAOsB,KAAI,KAAM4D;CACvC,MAAME,YAAYjG,aAAakG,aAAa;EAC3C,MAAMC,cAAc/E,UAAU;AAC7B,OAAI6C,YAAYK,YAAYlD,MAAO;AACnC6C,eAAYK,UAAUlD;AACtB8E,aAAU;;AAEXC,aAAWtF,MAAMO,MAAM;AACvB,MAAIe,MAAMN,OAAQ,QAAO9B,WAAWc,OAAOsB,MAAMgE,WAAW;AAC5D,SAAOtF,MAAM6D,OAAOyB,WAAW;IAC7BH,KAAK;CACR,MAAMjF,YAAYkD,YAAYK;AAC9B,QAAOlE,qBAAqB6F,WAAWlF,WAAW;AACjD,SAAOA,KAAK;GACX;;;;;ACxJH,SAAgB0F,6BAA6BC,SAAmC,EAAE,EAAE;AAClF,QAAOH,UAAUC,8BAA8BE,OAAO,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as FragnoPublicClientConfig, c as InferOr, d as MaybeExtractPathParamsOrWiden, f as QueryParamsHint, i as ReadableAtom, o as NonGetHTTPMethod, s as FragnoClientError } from "../client-BumUy6cu.js";
|
|
2
2
|
import * as zod from "zod";
|
|
3
3
|
import { Accessor } from "solid-js";
|
|
4
4
|
import * as zod_v4_core0 from "zod/v4/core";
|
|
@@ -100,7 +100,7 @@ declare function createTelegramFragmentClient(config?: FragnoPublicClientConfig)
|
|
|
100
100
|
supergroup: "supergroup";
|
|
101
101
|
channel: "channel";
|
|
102
102
|
}>>>;
|
|
103
|
-
}, zod_v4_core0.$
|
|
103
|
+
}, zod_v4_core0.$strip>>>;
|
|
104
104
|
createdAt: zod.ZodDate;
|
|
105
105
|
updatedAt: zod.ZodDate;
|
|
106
106
|
}, zod_v4_core0.$strip>>, string, "type">;
|
|
@@ -124,7 +124,7 @@ declare function createTelegramFragmentClient(config?: FragnoPublicClientConfig)
|
|
|
124
124
|
supergroup: "supergroup";
|
|
125
125
|
channel: "channel";
|
|
126
126
|
}>>>;
|
|
127
|
-
}, zod_v4_core0.$
|
|
127
|
+
}, zod_v4_core0.$strip>>>;
|
|
128
128
|
createdAt: zod.ZodDate;
|
|
129
129
|
updatedAt: zod.ZodDate;
|
|
130
130
|
}, zod_v4_core0.$strip>;
|
|
@@ -162,6 +162,132 @@ declare function createTelegramFragmentClient(config?: FragnoPublicClientConfig)
|
|
|
162
162
|
channel_post: "channel_post";
|
|
163
163
|
}>;
|
|
164
164
|
text: zod.ZodNullable<zod.ZodString>;
|
|
165
|
+
attachments: zod.ZodArray<zod.ZodDiscriminatedUnion<[zod.ZodObject<{
|
|
166
|
+
kind: zod.ZodLiteral<"photo">;
|
|
167
|
+
fileId: zod.ZodString;
|
|
168
|
+
fileUniqueId: zod.ZodString;
|
|
169
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
170
|
+
width: zod.ZodNumber;
|
|
171
|
+
height: zod.ZodNumber;
|
|
172
|
+
thumbnail: zod.ZodOptional<zod.ZodObject<{
|
|
173
|
+
fileId: zod.ZodString;
|
|
174
|
+
fileUniqueId: zod.ZodString;
|
|
175
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
176
|
+
width: zod.ZodNumber;
|
|
177
|
+
height: zod.ZodNumber;
|
|
178
|
+
}, zod_v4_core0.$strip>>;
|
|
179
|
+
sizes: zod.ZodArray<zod.ZodObject<{
|
|
180
|
+
fileId: zod.ZodString;
|
|
181
|
+
fileUniqueId: zod.ZodString;
|
|
182
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
183
|
+
width: zod.ZodNumber;
|
|
184
|
+
height: zod.ZodNumber;
|
|
185
|
+
}, zod_v4_core0.$strip>>;
|
|
186
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
187
|
+
kind: zod.ZodLiteral<"voice">;
|
|
188
|
+
fileId: zod.ZodString;
|
|
189
|
+
fileUniqueId: zod.ZodString;
|
|
190
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
191
|
+
duration: zod.ZodNumber;
|
|
192
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
193
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
194
|
+
kind: zod.ZodLiteral<"audio">;
|
|
195
|
+
fileId: zod.ZodString;
|
|
196
|
+
fileUniqueId: zod.ZodString;
|
|
197
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
198
|
+
duration: zod.ZodNumber;
|
|
199
|
+
performer: zod.ZodOptional<zod.ZodString>;
|
|
200
|
+
title: zod.ZodOptional<zod.ZodString>;
|
|
201
|
+
fileName: zod.ZodOptional<zod.ZodString>;
|
|
202
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
203
|
+
thumbnail: zod.ZodOptional<zod.ZodObject<{
|
|
204
|
+
fileId: zod.ZodString;
|
|
205
|
+
fileUniqueId: zod.ZodString;
|
|
206
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
207
|
+
width: zod.ZodNumber;
|
|
208
|
+
height: zod.ZodNumber;
|
|
209
|
+
}, zod_v4_core0.$strip>>;
|
|
210
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
211
|
+
kind: zod.ZodLiteral<"document">;
|
|
212
|
+
fileId: zod.ZodString;
|
|
213
|
+
fileUniqueId: zod.ZodString;
|
|
214
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
215
|
+
fileName: zod.ZodOptional<zod.ZodString>;
|
|
216
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
217
|
+
thumbnail: zod.ZodOptional<zod.ZodObject<{
|
|
218
|
+
fileId: zod.ZodString;
|
|
219
|
+
fileUniqueId: zod.ZodString;
|
|
220
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
221
|
+
width: zod.ZodNumber;
|
|
222
|
+
height: zod.ZodNumber;
|
|
223
|
+
}, zod_v4_core0.$strip>>;
|
|
224
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
225
|
+
kind: zod.ZodLiteral<"video">;
|
|
226
|
+
fileId: zod.ZodString;
|
|
227
|
+
fileUniqueId: zod.ZodString;
|
|
228
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
229
|
+
width: zod.ZodNumber;
|
|
230
|
+
height: zod.ZodNumber;
|
|
231
|
+
duration: zod.ZodNumber;
|
|
232
|
+
fileName: zod.ZodOptional<zod.ZodString>;
|
|
233
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
234
|
+
thumbnail: zod.ZodOptional<zod.ZodObject<{
|
|
235
|
+
fileId: zod.ZodString;
|
|
236
|
+
fileUniqueId: zod.ZodString;
|
|
237
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
238
|
+
width: zod.ZodNumber;
|
|
239
|
+
height: zod.ZodNumber;
|
|
240
|
+
}, zod_v4_core0.$strip>>;
|
|
241
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
242
|
+
kind: zod.ZodLiteral<"video_note">;
|
|
243
|
+
fileId: zod.ZodString;
|
|
244
|
+
fileUniqueId: zod.ZodString;
|
|
245
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
246
|
+
length: zod.ZodNumber;
|
|
247
|
+
duration: zod.ZodNumber;
|
|
248
|
+
thumbnail: zod.ZodOptional<zod.ZodObject<{
|
|
249
|
+
fileId: zod.ZodString;
|
|
250
|
+
fileUniqueId: zod.ZodString;
|
|
251
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
252
|
+
width: zod.ZodNumber;
|
|
253
|
+
height: zod.ZodNumber;
|
|
254
|
+
}, zod_v4_core0.$strip>>;
|
|
255
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
256
|
+
kind: zod.ZodLiteral<"sticker">;
|
|
257
|
+
fileId: zod.ZodString;
|
|
258
|
+
fileUniqueId: zod.ZodString;
|
|
259
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
260
|
+
width: zod.ZodNumber;
|
|
261
|
+
height: zod.ZodNumber;
|
|
262
|
+
emoji: zod.ZodOptional<zod.ZodString>;
|
|
263
|
+
setName: zod.ZodOptional<zod.ZodString>;
|
|
264
|
+
isAnimated: zod.ZodBoolean;
|
|
265
|
+
isVideo: zod.ZodBoolean;
|
|
266
|
+
thumbnail: zod.ZodOptional<zod.ZodObject<{
|
|
267
|
+
fileId: zod.ZodString;
|
|
268
|
+
fileUniqueId: zod.ZodString;
|
|
269
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
270
|
+
width: zod.ZodNumber;
|
|
271
|
+
height: zod.ZodNumber;
|
|
272
|
+
}, zod_v4_core0.$strip>>;
|
|
273
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
274
|
+
kind: zod.ZodLiteral<"animation">;
|
|
275
|
+
fileId: zod.ZodString;
|
|
276
|
+
fileUniqueId: zod.ZodString;
|
|
277
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
278
|
+
width: zod.ZodNumber;
|
|
279
|
+
height: zod.ZodNumber;
|
|
280
|
+
duration: zod.ZodNumber;
|
|
281
|
+
fileName: zod.ZodOptional<zod.ZodString>;
|
|
282
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
283
|
+
thumbnail: zod.ZodOptional<zod.ZodObject<{
|
|
284
|
+
fileId: zod.ZodString;
|
|
285
|
+
fileUniqueId: zod.ZodString;
|
|
286
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
287
|
+
width: zod.ZodNumber;
|
|
288
|
+
height: zod.ZodNumber;
|
|
289
|
+
}, zod_v4_core0.$strip>>;
|
|
290
|
+
}, zod_v4_core0.$strip>], "kind">>;
|
|
165
291
|
payload: zod.ZodNullable<zod.ZodUnknown>;
|
|
166
292
|
sentAt: zod.ZodDate;
|
|
167
293
|
editedAt: zod.ZodNullable<zod.ZodDate>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solid.d.ts","names":["MaybeExtractPathParamsOrWiden","QueryParamsHint","InferOr","
|
|
1
|
+
{"version":3,"file":"solid.d.ts","names":["MaybeExtractPathParamsOrWiden","QueryParamsHint","InferOr","FragnoClientError","FragnoClientHookData","FragnoClientMutatorData","FragnoStoreData","FragnoStoreFactoryData","FragnoStoreObjectData","NonGetHTTPMethod","ReadableAtom","Store","StoreValue","Accessor","StandardSchemaV1","FragnoSolidHook","_TMethod","TPath$1","TOutputSchema$1","TErrorCode$1","TQueryParameters$1","path","query","args","data","loading","error","FragnoSolidMutator","TInputSchema","Promise","mutate","body","isAccessor","value","accessorToAtom","T$1","accessor","FragnoSolidStoreValue","K","FragnoSolidStaticStore","FragnoSolidStore","TStore","TArgs","T","useFragno","Record","TPath","TOutputSchema","TErrorCode","TQueryParameters","TMethod","TInput","TOutput","TError","clientObj"],"sources":["../../../../fragno/dist/client/solid.d.ts","../../../src/client/solid.ts"],"mappings":";;;;;;;;KAUKe,eAAAA,yEAAwFD,gBAAAA,qEAAqFS,IAAAA;EAChLF,IAAAA,GAAOrB,6BAAAA,CAA8BiB,OAAAA,WAAkBJ,QAAAA,WAAmBH,YAAAA;EAC1EY,KAAAA,GAAQrB,eAAAA,CAAgBmB,kBAAAA,WAA6BP,QAAAA,WAAmBH,YAAAA;AAAAA;EAExEc,IAAAA,EAAMX,QAAAA,CAASX,OAAAA,CAAQgB,eAAAA;EACvBO,OAAAA,EAASZ,QAAAA;EACTa,KAAAA,EAAOb,QAAAA,CAASV,iBAAAA,CAAkBgB,YAAAA;AAAAA;AAAAA,KAE/BQ,kBAAAA,kBAAoClB,gBAAAA,+CAA+DK,gBAAAA,sCAAsDA,gBAAAA;EAC5JgB,MAAAA,GAASP,IAAAA;IACPQ,IAAAA,GAAO7B,OAAAA,CAAQ0B,YAAAA;IACfP,IAAAA,GAAOrB,6BAAAA,CAA8BiB,OAAAA,WAAkBJ,QAAAA,WAAmBH,YAAAA;IAC1EY,KAAAA,GAAQrB,eAAAA,CAAgBmB,kBAAAA,WAA6BP,QAAAA,WAAmBH,YAAAA;EAAAA,MACpEmB,OAAAA,CAAQ3B,OAAAA,CAAQgB,eAAAA;EACtBO,OAAAA,EAASZ,QAAAA;EACTa,KAAAA,EAAOb,QAAAA,CAASV,iBAAAA,CAAkBgB,YAAAA;EAClCK,IAAAA,EAAMX,QAAAA,CAASX,OAAAA,CAAQgB,eAAAA;AAAAA;;;;;;;;iBCrBT,4BAAA,CAA6B,MAAA,GAAQ,wBAAA;;;YAA6B,GAAA,CAAA,SAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as isStore, f as atom, l as isGetHook, p as isReadableAtom, u as isMutatorHook } from "../schema-IrJsGm4M.js";
|
|
2
2
|
import { createTelegramFragmentClients } from "../index.js";
|
|
3
3
|
import { createEffect, onCleanup } from "solid-js";
|
|
4
4
|
import { createStore, reconcile } from "solid-js/store";
|
|
5
5
|
|
|
6
|
-
//#region ../../node_modules/.pnpm/@nanostores+solid@1.1.1_nanostores@1.
|
|
6
|
+
//#region ../../node_modules/.pnpm/@nanostores+solid@1.1.1_nanostores@1.2.0_solid-js@1.9.10/node_modules/@nanostores/solid/dist/index.js
|
|
7
7
|
function m(e, o = {}) {
|
|
8
8
|
let t = e.listen(() => {}), [r, s] = createStore({ value: e.get() }), n = e.subscribe((i) => {
|
|
9
9
|
s("value", reconcile(i, o));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solid.js","names":["createStore","c","reconcile","u","onCleanup","S","m","e","o","t","listen","r","s","value","get","n","subscribe","i","useStore","isReadableAtom","isGetHook","isMutatorHook","isStore","atom","createEffect","onCleanup","useStore","isAccessor","value","accessorToAtom","accessor","a","set","createSolidHook","hook","path","query","pathParams","queryParams","key","Object","entries","v","storeValue","store","data","loading","error","createSolidMutator","mutatorStore","mutate","args","body","unwrapSolidStoreValue","result","prototype","hasOwnProperty","call","fieldValue","createSolidStore","obj","factory","disposer","Symbol","dispose","useFragno","clientObj","FragnoPublicClientConfig","useFragno","createTelegramFragmentClients","createTelegramFragmentClient","config"],"sources":["../../../../../node_modules/.pnpm/@nanostores+solid@1.1.1_nanostores@1.
|
|
1
|
+
{"version":3,"file":"solid.js","names":["createStore","c","reconcile","u","onCleanup","S","m","e","o","t","listen","r","s","value","get","n","subscribe","i","useStore","isReadableAtom","isGetHook","isMutatorHook","isStore","atom","createEffect","onCleanup","useStore","isAccessor","value","accessorToAtom","accessor","a","set","createSolidHook","hook","path","query","pathParams","queryParams","key","Object","entries","v","storeValue","store","data","loading","error","createSolidMutator","mutatorStore","mutate","args","body","unwrapSolidStoreValue","result","prototype","hasOwnProperty","call","fieldValue","createSolidStore","obj","factory","disposer","Symbol","dispose","useFragno","clientObj","FragnoPublicClientConfig","useFragno","createTelegramFragmentClients","createTelegramFragmentClient","config"],"sources":["../../../../../node_modules/.pnpm/@nanostores+solid@1.1.1_nanostores@1.2.0_solid-js@1.9.10/node_modules/@nanostores/solid/dist/index.js","../../../../fragno/dist/client/solid.js","../../../src/client/solid.ts"],"sourcesContent":["import{createStore as c,reconcile as u}from\"solid-js/store\";import{onCleanup as S}from\"solid-js\";function m(e,o={}){let t=e.listen(()=>{}),[r,s]=c({value:e.get()}),n=e.subscribe(i=>{s(\"value\",u(i,o))});return S(()=>n()),t(),()=>r.value}export{m as useStore};\n","import { isReadableAtom } from \"../util/nanostores.js\";\nimport { isGetHook, isMutatorHook, isStore } from \"./client.js\";\nimport { atom } from \"nanostores\";\nimport { createEffect, onCleanup } from \"solid-js\";\nimport { useStore } from \"@nanostores/solid\";\n\n//#region src/client/solid.ts\n/**\n* Type guard to check if a value is a SolidJS Accessor.\n*\n* @private\n*/\nfunction isAccessor(value) {\n\treturn typeof value === \"function\";\n}\n/**\n* Converts a SolidJS Accessor to a NanoStore Atom.\n*\n* This is used to convert SolidJS accessors to atoms, so that we can use them in the store.\n*\n* @private\n*/\nfunction accessorToAtom(accessor) {\n\tconst a = atom(accessor());\n\tcreateEffect(() => {\n\t\ta.set(accessor());\n\t});\n\treturn a;\n}\nfunction createSolidHook(hook) {\n\treturn ({ path, query } = {}) => {\n\t\tconst pathParams = {};\n\t\tconst queryParams = {};\n\t\tfor (const [key, value] of Object.entries(path ?? {})) {\n\t\t\tconst v = value;\n\t\t\tpathParams[key] = isAccessor(v) ? accessorToAtom(v) : v;\n\t\t}\n\t\tfor (const [key, value] of Object.entries(query ?? {})) {\n\t\t\tconst v = value;\n\t\t\tqueryParams[key] = isAccessor(v) ? accessorToAtom(v) : v;\n\t\t}\n\t\tconst storeValue = useStore(hook.store({\n\t\t\tpath: pathParams,\n\t\t\tquery: queryParams\n\t\t}));\n\t\treturn {\n\t\t\tdata: () => storeValue().data,\n\t\t\tloading: () => storeValue().loading,\n\t\t\terror: () => storeValue().error\n\t\t};\n\t};\n}\nfunction createSolidMutator(hook) {\n\treturn () => {\n\t\tconst store = useStore(hook.mutatorStore);\n\t\tconst mutate = async (args) => {\n\t\t\tconst { body, path, query } = args;\n\t\t\tconst pathParams = {};\n\t\t\tconst queryParams = {};\n\t\t\tfor (const [key, value] of Object.entries(path ?? {})) {\n\t\t\t\tconst v = value;\n\t\t\t\tpathParams[key] = isAccessor(v) ? v() : v;\n\t\t\t}\n\t\t\tfor (const [key, value] of Object.entries(query ?? {})) {\n\t\t\t\tconst v = value;\n\t\t\t\tqueryParams[key] = isAccessor(v) ? v() : v;\n\t\t\t}\n\t\t\treturn hook.mutatorStore.mutate({\n\t\t\t\tbody,\n\t\t\t\tpath: pathParams,\n\t\t\t\tquery: queryParams\n\t\t\t});\n\t\t};\n\t\treturn {\n\t\t\tmutate,\n\t\t\tdata: () => store().data,\n\t\t\tloading: () => store().loading,\n\t\t\terror: () => store().error\n\t\t};\n\t};\n}\nfunction unwrapSolidStoreValue(value) {\n\tif (isReadableAtom(value)) return useStore(value);\n\tconst result = {};\n\tfor (const key in value) {\n\t\tif (!Object.prototype.hasOwnProperty.call(value, key)) continue;\n\t\tconst fieldValue = value[key];\n\t\tif (isReadableAtom(fieldValue)) result[key] = useStore(fieldValue);\n\t\telse result[key] = fieldValue;\n\t}\n\treturn result;\n}\nfunction createSolidStore(hook) {\n\tif (\"obj\" in hook) {\n\t\tif (isReadableAtom(hook.obj)) return useStore(hook.obj);\n\t\treturn (() => unwrapSolidStoreValue(hook.obj));\n\t}\n\treturn ((...args) => {\n\t\tconst value = hook.factory(...args);\n\t\tconst disposer = value[Symbol.dispose];\n\t\tif (typeof disposer === \"function\") onCleanup(() => {\n\t\t\tdisposer.call(value);\n\t\t});\n\t\treturn unwrapSolidStoreValue(value);\n\t});\n}\nfunction useFragno(clientObj) {\n\tconst result = {};\n\tfor (const key in clientObj) {\n\t\tif (!Object.prototype.hasOwnProperty.call(clientObj, key)) continue;\n\t\tconst hook = clientObj[key];\n\t\tif (isGetHook(hook)) result[key] = createSolidHook(hook);\n\t\telse if (isMutatorHook(hook)) result[key] = createSolidMutator(hook);\n\t\telse if (isStore(hook)) result[key] = createSolidStore(hook);\n\t\telse result[key] = hook;\n\t}\n\treturn result;\n}\n\n//#endregion\nexport { accessorToAtom, isAccessor, useFragno };\n//# sourceMappingURL=solid.js.map","import type { FragnoPublicClientConfig } from \"@fragno-dev/core/client\";\nimport { useFragno } from \"@fragno-dev/core/solid\";\n\nimport { createTelegramFragmentClients } from \"..\";\n\nexport function createTelegramFragmentClient(config: FragnoPublicClientConfig = {}) {\n return useFragno(createTelegramFragmentClients(config));\n}\n"],"x_google_ignoreList":[0],"mappings":";;;;;;AAAiG,SAASM,EAAEC,GAAEC,IAAE,EAAE,EAAC;CAAC,IAAIC,IAAEF,EAAEG,aAAW,GAAG,EAAC,CAACC,GAAEC,KAAGX,YAAE,EAACY,OAAMN,EAAEO,KAAI,EAAE,CAAC,EAACC,IAAER,EAAES,WAAUC,MAAG;AAACL,IAAE,SAAQT,UAAEc,GAAET,EAAE,CAAC;GAAE;AAAC,QAAOH,gBAAMU,GAAG,CAAC,EAACN,GAAG,QAAKE,EAAEE;;;;;;;;;;ACYtO,SAASc,WAAWC,OAAO;AAC1B,QAAO,OAAOA,UAAU;;;;;;;;;AASzB,SAASC,eAAeC,UAAU;CACjC,MAAMC,IAAIR,qBAAKO,UAAU,CAAC;AAC1BN,oBAAmB;AAClBO,IAAEC,IAAIF,UAAU,CAAC;GAChB;AACF,QAAOC;;AAER,SAASE,gBAAgBC,MAAM;AAC9B,SAAQ,EAAEC,MAAMC,UAAU,EAAE,KAAK;EAChC,MAAMC,aAAa,EAAE;EACrB,MAAMC,cAAc,EAAE;AACtB,OAAK,MAAM,CAACC,KAAKX,UAAUY,OAAOC,QAAQN,QAAQ,EAAE,CAAC,EAAE;GACtD,MAAMO,IAAId;AACVS,cAAWE,OAAOZ,WAAWe,EAAE,GAAGb,eAAea,EAAE,GAAGA;;AAEvD,OAAK,MAAM,CAACH,KAAKX,UAAUY,OAAOC,QAAQL,SAAS,EAAE,CAAC,EAAE;GACvD,MAAMM,IAAId;AACVU,eAAYC,OAAOZ,WAAWe,EAAE,GAAGb,eAAea,EAAE,GAAGA;;EAExD,MAAMC,aAAajB,EAASQ,KAAKU,MAAM;GACtCT,MAAME;GACND,OAAOE;GACP,CAAC,CAAC;AACH,SAAO;GACNO,YAAYF,YAAY,CAACE;GACzBC,eAAeH,YAAY,CAACG;GAC5BC,aAAaJ,YAAY,CAACI;GAC1B;;;AAGH,SAASC,mBAAmBd,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