@assistant-ui/store 0.2.11 → 0.2.13
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/AuiIf.d.ts +19 -15
- package/dist/AuiIf.d.ts.map +1 -1
- package/dist/AuiIf.js +27 -24
- package/dist/AuiIf.js.map +1 -1
- package/dist/Derived.d.ts +15 -11
- package/dist/Derived.d.ts.map +1 -1
- package/dist/Derived.js +24 -20
- package/dist/Derived.js.map +1 -1
- package/dist/RenderChildrenWithAccessor.d.ts +13 -6
- package/dist/RenderChildrenWithAccessor.d.ts.map +1 -1
- package/dist/RenderChildrenWithAccessor.js +42 -48
- package/dist/RenderChildrenWithAccessor.js.map +1 -1
- package/dist/attachTransformScopes.d.ts +11 -10
- package/dist/attachTransformScopes.d.ts.map +1 -1
- package/dist/attachTransformScopes.js +20 -23
- package/dist/attachTransformScopes.js.map +1 -1
- package/dist/index.d.ts +15 -16
- package/dist/index.js +14 -18
- package/dist/tapClientList.d.ts +26 -23
- package/dist/tapClientList.d.ts.map +1 -1
- package/dist/tapClientList.js +66 -63
- package/dist/tapClientList.js.map +1 -1
- package/dist/tapClientLookup.d.ts +14 -11
- package/dist/tapClientLookup.d.ts.map +1 -1
- package/dist/tapClientLookup.js +31 -37
- package/dist/tapClientLookup.js.map +1 -1
- package/dist/tapClientResource.d.ts +12 -9
- package/dist/tapClientResource.d.ts.map +1 -1
- package/dist/tapClientResource.js +92 -104
- package/dist/tapClientResource.js.map +1 -1
- package/dist/types/client.d.ts +50 -42
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/client.js +0 -2
- package/dist/types/events.d.ts +23 -24
- package/dist/types/events.d.ts.map +1 -1
- package/dist/types/events.js +13 -6
- package/dist/types/events.js.map +1 -1
- package/dist/useAui.d.ts +17 -15
- package/dist/useAui.d.ts.map +1 -1
- package/dist/useAui.js +176 -191
- package/dist/useAui.js.map +1 -1
- package/dist/useAuiEvent.d.ts +6 -2
- package/dist/useAuiEvent.d.ts.map +1 -1
- package/dist/useAuiEvent.js +58 -47
- package/dist/useAuiEvent.js.map +1 -1
- package/dist/useAuiState.d.ts +6 -2
- package/dist/useAuiState.d.ts.map +1 -1
- package/dist/useAuiState.js +44 -42
- package/dist/useAuiState.js.map +1 -1
- package/dist/utils/BaseProxyHandler.d.ts +19 -16
- package/dist/utils/BaseProxyHandler.d.ts.map +1 -1
- package/dist/utils/BaseProxyHandler.js +46 -43
- package/dist/utils/BaseProxyHandler.js.map +1 -1
- package/dist/utils/NotificationManager.d.ts +13 -9
- package/dist/utils/NotificationManager.d.ts.map +1 -1
- package/dist/utils/NotificationManager.js +69 -82
- package/dist/utils/NotificationManager.js.map +1 -1
- package/dist/utils/proxied-assistant-state.d.ts +8 -4
- package/dist/utils/proxied-assistant-state.d.ts.map +1 -1
- package/dist/utils/proxied-assistant-state.js +28 -26
- package/dist/utils/proxied-assistant-state.js.map +1 -1
- package/dist/utils/react-assistant-context.d.ts +15 -10
- package/dist/utils/react-assistant-context.d.ts.map +1 -1
- package/dist/utils/react-assistant-context.js +69 -67
- package/dist/utils/react-assistant-context.js.map +1 -1
- package/dist/utils/splitClients.d.ts +12 -8
- package/dist/utils/splitClients.d.ts.map +1 -1
- package/dist/utils/splitClients.js +39 -43
- package/dist/utils/splitClients.js.map +1 -1
- package/dist/utils/tap-assistant-context.d.ts +17 -14
- package/dist/utils/tap-assistant-context.d.ts.map +1 -1
- package/dist/utils/tap-assistant-context.js +18 -15
- package/dist/utils/tap-assistant-context.js.map +1 -1
- package/dist/utils/tap-client-stack-context.d.ts +10 -6
- package/dist/utils/tap-client-stack-context.d.ts.map +1 -1
- package/dist/utils/tap-client-stack-context.js +22 -19
- package/dist/utils/tap-client-stack-context.js.map +1 -1
- package/dist/wrapperResource.d.ts +6 -2
- package/dist/wrapperResource.d.ts.map +1 -1
- package/dist/wrapperResource.js +12 -9
- package/dist/wrapperResource.js.map +1 -1
- package/package.json +7 -7
- package/src/RenderChildrenWithAccessor.tsx +1 -1
- package/src/__tests__/RenderChildrenWithAccessor.test.tsx +0 -1
- package/src/__tests__/hooks.test.tsx +0 -1
- package/src/tapClientLookup.ts +1 -1
- package/src/types/client.ts +1 -3
- package/src/types/events.ts +1 -3
- package/src/useAui.ts +1 -2
- package/src/useAuiEvent.ts +1 -4
- package/src/utils/splitClients.ts +1 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/types/client.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tapClientList.d.ts","
|
|
1
|
+
{"version":3,"file":"tapClientList.d.ts","names":[],"sources":["../src/tapClientList.ts"],"mappings":";;;;KAKK,gBAAA,aAA6B,QAAQ;EACxC,QAAA;AAAA,IAEE,CAAA;AAAA,cAwBS,aAAA,2BAAyC,aAAA,EACpD,KAAA,EAAO,aAAA,CAAc,KAAA,CAAM,KAAA,EAAO,QAAA;EAElC,KAAA,EAAO,gBAAA,CAAiB,QAAA;EACxB,GAAA,GAAM,MAAA;IAAU,KAAA;EAAA;IAAoB,GAAA;EAAA,MAAkB,QAAA;EACtD,GAAA,GAAM,WAAA,EAAa,KAAA;AAAA;AAAA,kBAuEJ,aAAA;EAAA,KACH,aAAA;IACV,GAAA;IACA,cAAA,QAAsB,KAAA;IACtB,MAAA;EAAA;EAAA,KAGU,KAAA,yBAA8B,aAAA;IACxC,aAAA,EAAe,KAAA;IACf,MAAA,GAAS,IAAA,EAAM,KAAA;IACf,QAAA,EAAU,qBAAA,CAAsB,QAAA,EAAU,aAAA,CAAc,KAAA;EAAA;AAAA"}
|
package/dist/tapClientList.js
CHANGED
|
@@ -1,68 +1,71 @@
|
|
|
1
|
-
import { tapConst, tapState, withKey } from "@assistant-ui/tap";
|
|
2
1
|
import { tapClientLookup } from "./tapClientLookup.js";
|
|
2
|
+
import { tapConst, tapState, withKey } from "@assistant-ui/tap";
|
|
3
|
+
//#region src/tapClientList.ts
|
|
3
4
|
const createProps = (key, data, remove) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
remove,
|
|
13
|
-
};
|
|
5
|
+
return {
|
|
6
|
+
key,
|
|
7
|
+
getInitialData: () => {
|
|
8
|
+
if (!data.hasData) throw new Error("getInitialData may only be called during initial render");
|
|
9
|
+
return data.data;
|
|
10
|
+
},
|
|
11
|
+
remove
|
|
12
|
+
};
|
|
14
13
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
14
|
+
const tapClientList = (props) => {
|
|
15
|
+
const { initialValues, getKey, resource: Resource } = props;
|
|
16
|
+
const initialDataHandles = tapConst(() => [], []);
|
|
17
|
+
const [items, setItems] = tapState(() => {
|
|
18
|
+
const entries = [];
|
|
19
|
+
for (const data of initialValues) {
|
|
20
|
+
const key = getKey(data);
|
|
21
|
+
const handle = {
|
|
22
|
+
data,
|
|
23
|
+
hasData: true
|
|
24
|
+
};
|
|
25
|
+
entries.push([key, createProps(key, handle, () => {
|
|
26
|
+
setItems((items) => {
|
|
27
|
+
const newItems = { ...items };
|
|
28
|
+
delete newItems[key];
|
|
29
|
+
return newItems;
|
|
30
|
+
});
|
|
31
|
+
})]);
|
|
32
|
+
initialDataHandles.push(handle);
|
|
33
|
+
}
|
|
34
|
+
return Object.fromEntries(entries);
|
|
35
|
+
});
|
|
36
|
+
const lookup = tapClientLookup(() => Object.values(items).map((props) => withKey(props.key, Resource(props))), [items, Resource]);
|
|
37
|
+
initialDataHandles.forEach((handle) => {
|
|
38
|
+
handle.data = void 0;
|
|
39
|
+
handle.hasData = false;
|
|
40
|
+
});
|
|
41
|
+
const add = (data) => {
|
|
42
|
+
const key = getKey(data);
|
|
43
|
+
setItems((items) => {
|
|
44
|
+
if (key in items) throw new Error(`Tried to add item with a key ${key} that already exists`);
|
|
45
|
+
const handle = {
|
|
46
|
+
data,
|
|
47
|
+
hasData: true
|
|
48
|
+
};
|
|
49
|
+
initialDataHandles.push(handle);
|
|
50
|
+
return {
|
|
51
|
+
...items,
|
|
52
|
+
[key]: createProps(key, handle, () => {
|
|
53
|
+
setItems((items) => {
|
|
54
|
+
const newItems = { ...items };
|
|
55
|
+
delete newItems[key];
|
|
56
|
+
return newItems;
|
|
57
|
+
});
|
|
58
|
+
})
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
return {
|
|
63
|
+
state: lookup.state,
|
|
64
|
+
get: lookup.get,
|
|
65
|
+
add
|
|
66
|
+
};
|
|
67
67
|
};
|
|
68
|
+
//#endregion
|
|
69
|
+
export { tapClientList };
|
|
70
|
+
|
|
68
71
|
//# sourceMappingURL=tapClientList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tapClientList.js","
|
|
1
|
+
{"version":3,"file":"tapClientList.js","names":[],"sources":["../src/tapClientList.ts"],"sourcesContent":["import { tapConst, tapState, withKey } from \"@assistant-ui/tap\";\nimport type { ContravariantResource } from \"@assistant-ui/tap\";\nimport { tapClientLookup } from \"./tapClientLookup\";\nimport type { ClientMethods } from \"./types/client\";\n\ntype InferClientState<TMethods> = TMethods extends {\n getState: () => infer S;\n}\n ? S\n : unknown;\n\ntype DataHandle<TData> = { data: TData | undefined; hasData: boolean };\n\nconst createProps = <TData>(\n key: string,\n data: DataHandle<TData>,\n remove: () => void,\n): tapClientList.ResourceProps<TData> => {\n return {\n key,\n getInitialData: () => {\n if (!data.hasData) {\n throw new Error(\n \"getInitialData may only be called during initial render\",\n );\n }\n return data.data!;\n },\n remove,\n };\n};\n\nexport const tapClientList = <TData, TMethods extends ClientMethods>(\n props: tapClientList.Props<TData, TMethods>,\n): {\n state: InferClientState<TMethods>[];\n get: (lookup: { index: number } | { key: string }) => TMethods;\n add: (initialData: TData) => void;\n} => {\n const { initialValues, getKey, resource: Resource } = props;\n\n type Props = tapClientList.ResourceProps<TData>;\n\n const initialDataHandles: DataHandle<TData>[] = tapConst(() => [], []);\n\n const [items, setItems] = tapState<Record<string, Props>>(() => {\n const entries: [string, Props][] = [];\n for (const data of initialValues) {\n const key = getKey(data);\n const handle = { data, hasData: true };\n entries.push([\n key,\n createProps(key, handle, () => {\n setItems((items) => {\n const newItems = { ...items };\n delete newItems[key];\n return newItems;\n });\n }),\n ]);\n initialDataHandles.push(handle);\n }\n return Object.fromEntries(entries);\n });\n\n const lookup = tapClientLookup<TMethods>(\n () =>\n Object.values(items).map((props) => withKey(props.key, Resource(props))),\n [items, Resource],\n );\n\n initialDataHandles.forEach((handle) => {\n handle.data = undefined;\n handle.hasData = false;\n });\n\n const add = (data: TData) => {\n const key = getKey(data);\n setItems((items) => {\n if (key in items) {\n throw new Error(\n `Tried to add item with a key ${key} that already exists`,\n );\n }\n\n const handle = { data, hasData: true };\n initialDataHandles.push(handle);\n\n return {\n ...items,\n [key]: createProps(key, handle, () => {\n setItems((items) => {\n const newItems = { ...items };\n delete newItems[key];\n return newItems;\n });\n }),\n };\n });\n };\n\n return {\n state: lookup.state,\n get: lookup.get,\n add,\n };\n};\n\nexport namespace tapClientList {\n export type ResourceProps<TData> = {\n key: string;\n getInitialData: () => TData;\n remove: () => void;\n };\n\n export type Props<TData, TMethods extends ClientMethods> = {\n initialValues: TData[];\n getKey: (data: TData) => string;\n resource: ContravariantResource<TMethods, ResourceProps<TData>>;\n };\n}\n"],"mappings":";;;AAaA,MAAM,eACJ,KACA,MACA,WACuC;CACvC,OAAO;EACL;EACA,sBAAsB;GACpB,IAAI,CAAC,KAAK,SACR,MAAM,IAAI,MACR,yDACF;GAEF,OAAO,KAAK;EACd;EACA;CACF;AACF;AAEA,MAAa,iBACX,UAKG;CACH,MAAM,EAAE,eAAe,QAAQ,UAAU,aAAa;CAItD,MAAM,qBAA0C,eAAe,CAAC,GAAG,CAAC,CAAC;CAErE,MAAM,CAAC,OAAO,YAAY,eAAsC;EAC9D,MAAM,UAA6B,CAAC;EACpC,KAAK,MAAM,QAAQ,eAAe;GAChC,MAAM,MAAM,OAAO,IAAI;GACvB,MAAM,SAAS;IAAE;IAAM,SAAS;GAAK;GACrC,QAAQ,KAAK,CACX,KACA,YAAY,KAAK,cAAc;IAC7B,UAAU,UAAU;KAClB,MAAM,WAAW,EAAE,GAAG,MAAM;KAC5B,OAAO,SAAS;KAChB,OAAO;IACT,CAAC;GACH,CAAC,CACH,CAAC;GACD,mBAAmB,KAAK,MAAM;EAChC;EACA,OAAO,OAAO,YAAY,OAAO;CACnC,CAAC;CAED,MAAM,SAAS,sBAEX,OAAO,OAAO,KAAK,EAAE,KAAK,UAAU,QAAQ,MAAM,KAAK,SAAS,KAAK,CAAC,CAAC,GACzE,CAAC,OAAO,QAAQ,CAClB;CAEA,mBAAmB,SAAS,WAAW;EACrC,OAAO,OAAO,KAAA;EACd,OAAO,UAAU;CACnB,CAAC;CAED,MAAM,OAAO,SAAgB;EAC3B,MAAM,MAAM,OAAO,IAAI;EACvB,UAAU,UAAU;GAClB,IAAI,OAAO,OACT,MAAM,IAAI,MACR,gCAAgC,IAAI,qBACtC;GAGF,MAAM,SAAS;IAAE;IAAM,SAAS;GAAK;GACrC,mBAAmB,KAAK,MAAM;GAE9B,OAAO;IACL,GAAG;KACF,MAAM,YAAY,KAAK,cAAc;KACpC,UAAU,UAAU;MAClB,MAAM,WAAW,EAAE,GAAG,MAAM;MAC5B,OAAO,SAAS;MAChB,OAAO;KACT,CAAC;IACH,CAAC;GACH;EACF,CAAC;CACH;CAEA,OAAO;EACL,OAAO,OAAO;EACd,KAAK,OAAO;EACZ;CACF;AACF"}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { ClientMethods } from "./types/client.js";
|
|
2
|
+
import { ResourceElement } from "@assistant-ui/tap";
|
|
3
|
+
|
|
4
|
+
//#region src/tapClientLookup.d.ts
|
|
3
5
|
type InferClientState<TMethods> = TMethods extends {
|
|
4
|
-
|
|
6
|
+
getState: () => infer S;
|
|
5
7
|
} ? S : unknown;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
declare function tapClientLookup<TMethods extends ClientMethods>(getElements: () => readonly ResourceElement<TMethods>[], getElementsDeps: readonly unknown[]): {
|
|
9
|
+
state: InferClientState<TMethods>[];
|
|
10
|
+
get: (lookup: {
|
|
11
|
+
index: number;
|
|
12
|
+
} | {
|
|
13
|
+
key: string;
|
|
14
|
+
}) => TMethods;
|
|
13
15
|
};
|
|
14
|
-
|
|
16
|
+
//#endregion
|
|
17
|
+
export { tapClientLookup };
|
|
15
18
|
//# sourceMappingURL=tapClientLookup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tapClientLookup.d.ts","
|
|
1
|
+
{"version":3,"file":"tapClientLookup.d.ts","names":[],"sources":["../src/tapClientLookup.ts"],"mappings":";;;;KAUK,gBAAA,aAA6B,QAAQ;EACxC,QAAA;AAAA,IAEE,CAAA;AAAA,iBAgBY,eAAA,kBAAiC,aAAA,EAC/C,WAAA,iBAA4B,eAAA,CAAgB,QAAA,KAC5C,eAAA;EAEA,KAAA,EAAO,gBAAA,CAAiB,QAAA;EACxB,GAAA,GAAM,MAAA;IAAU,KAAA;EAAA;IAAoB,GAAA;EAAA,MAAkB,QAAA;AAAA"}
|
package/dist/tapClientLookup.js
CHANGED
|
@@ -1,42 +1,36 @@
|
|
|
1
|
-
import { tapMemo, tapResource, tapResources, } from "@assistant-ui/tap";
|
|
2
|
-
import { ClientResource } from "./tapClientResource.js";
|
|
3
1
|
import { wrapperResource } from "./wrapperResource.js";
|
|
2
|
+
import { ClientResource } from "./tapClientResource.js";
|
|
3
|
+
import { tapMemo, tapResource, tapResources } from "@assistant-ui/tap";
|
|
4
|
+
//#region src/tapClientLookup.ts
|
|
4
5
|
const ClientResourceWithKey = wrapperResource((el) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
return tapResource(ClientResource(el));
|
|
6
|
+
if (el.key === void 0) throw new Error("tapClientResource: Element has no key");
|
|
7
|
+
return tapResource(ClientResource(el));
|
|
9
8
|
});
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
const index = keyToIndex[lookup.key];
|
|
35
|
-
if (index === undefined) {
|
|
36
|
-
throw new Error(`tapClientLookup: Key "${lookup.key}" not found`);
|
|
37
|
-
}
|
|
38
|
-
return resources[index].methods;
|
|
39
|
-
},
|
|
40
|
-
};
|
|
9
|
+
function tapClientLookup(getElements, getElementsDeps) {
|
|
10
|
+
const resources = tapResources(() => getElements().map((el) => ClientResourceWithKey(el)), getElementsDeps);
|
|
11
|
+
const keys = tapMemo(() => Object.keys(resources), [resources]);
|
|
12
|
+
const keyToIndex = tapMemo(() => {
|
|
13
|
+
return resources.reduce((acc, resource, index) => {
|
|
14
|
+
acc[resource.key] = index;
|
|
15
|
+
return acc;
|
|
16
|
+
}, {});
|
|
17
|
+
}, [resources]);
|
|
18
|
+
return {
|
|
19
|
+
state: tapMemo(() => {
|
|
20
|
+
return resources.map((r) => r.state);
|
|
21
|
+
}, [resources]),
|
|
22
|
+
get: (lookup) => {
|
|
23
|
+
if ("index" in lookup) {
|
|
24
|
+
if (lookup.index < 0 || lookup.index >= keys.length) throw new Error(`tapClientLookup: Index ${lookup.index} out of bounds (length: ${keys.length})`);
|
|
25
|
+
return resources[lookup.index].methods;
|
|
26
|
+
}
|
|
27
|
+
const index = keyToIndex[lookup.key];
|
|
28
|
+
if (index === void 0) throw new Error(`tapClientLookup: Key "${lookup.key}" not found`);
|
|
29
|
+
return resources[index].methods;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
41
32
|
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { tapClientLookup };
|
|
35
|
+
|
|
42
36
|
//# sourceMappingURL=tapClientLookup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tapClientLookup.js","
|
|
1
|
+
{"version":3,"file":"tapClientLookup.js","names":[],"sources":["../src/tapClientLookup.ts"],"sourcesContent":["import {\n tapMemo,\n tapResource,\n tapResources,\n type ResourceElement,\n} from \"@assistant-ui/tap\";\nimport type { ClientMethods } from \"./types/client\";\nimport { ClientResource } from \"./tapClientResource\";\nimport { wrapperResource } from \"./wrapperResource\";\n\ntype InferClientState<TMethods> = TMethods extends {\n getState: () => infer S;\n}\n ? S\n : unknown;\n\nconst ClientResourceWithKey = wrapperResource(\n <TMethods extends ClientMethods>(el: ResourceElement<TMethods>) => {\n if (el.key === undefined) {\n throw new Error(\"tapClientResource: Element has no key\");\n }\n return tapResource(ClientResource(el)) as {\n methods: TMethods;\n state: InferClientState<TMethods>;\n key: string | number;\n };\n },\n);\n\nexport function tapClientLookup<TMethods extends ClientMethods>(\n getElements: () => readonly ResourceElement<TMethods>[],\n getElementsDeps: readonly unknown[],\n): {\n state: InferClientState<TMethods>[];\n get: (lookup: { index: number } | { key: string }) => TMethods;\n} {\n const resources = tapResources(\n () => getElements().map((el) => ClientResourceWithKey(el)),\n // oxlint-disable-next-line tap-hooks/exhaustive-deps -- caller-supplied deps array\n getElementsDeps,\n );\n\n const keys = tapMemo(() => Object.keys(resources), [resources]);\n\n // For arrays, track element key -> index mapping\n const keyToIndex = tapMemo(() => {\n return resources.reduce(\n (acc, resource, index) => {\n acc[resource.key] = index;\n return acc;\n },\n {} as Record<string, number>,\n );\n }, [resources]);\n\n const state = tapMemo(() => {\n return resources.map((r) => r.state);\n }, [resources]);\n\n return {\n state,\n get: (lookup: { index: number } | { key: string }) => {\n if (\"index\" in lookup) {\n if (lookup.index < 0 || lookup.index >= keys.length) {\n throw new Error(\n `tapClientLookup: Index ${lookup.index} out of bounds (length: ${keys.length})`,\n );\n }\n return resources[lookup.index]!.methods;\n }\n\n const index = keyToIndex[lookup.key];\n if (index === undefined) {\n throw new Error(`tapClientLookup: Key \"${lookup.key}\" not found`);\n }\n return resources[index]!.methods;\n },\n };\n}\n"],"mappings":";;;;AAgBA,MAAM,wBAAwB,iBACK,OAAkC;CACjE,IAAI,GAAG,QAAQ,KAAA,GACb,MAAM,IAAI,MAAM,uCAAuC;CAEzD,OAAO,YAAY,eAAe,EAAE,CAAC;AAKvC,CACF;AAEA,SAAgB,gBACd,aACA,iBAIA;CACA,MAAM,YAAY,mBACV,YAAY,EAAE,KAAK,OAAO,sBAAsB,EAAE,CAAC,GAEzD,eACF;CAEA,MAAM,OAAO,cAAc,OAAO,KAAK,SAAS,GAAG,CAAC,SAAS,CAAC;CAG9D,MAAM,aAAa,cAAc;EAC/B,OAAO,UAAU,QACd,KAAK,UAAU,UAAU;GACxB,IAAI,SAAS,OAAO;GACpB,OAAO;EACT,GACA,CAAC,CACH;CACF,GAAG,CAAC,SAAS,CAAC;CAMd,OAAO;EACL,OALY,cAAc;GAC1B,OAAO,UAAU,KAAK,MAAM,EAAE,KAAK;EACrC,GAAG,CAAC,SAAS,CAGP;EACJ,MAAM,WAAgD;GACpD,IAAI,WAAW,QAAQ;IACrB,IAAI,OAAO,QAAQ,KAAK,OAAO,SAAS,KAAK,QAC3C,MAAM,IAAI,MACR,0BAA0B,OAAO,MAAM,0BAA0B,KAAK,OAAO,EAC/E;IAEF,OAAO,UAAU,OAAO,OAAQ;GAClC;GAEA,MAAM,QAAQ,WAAW,OAAO;GAChC,IAAI,UAAU,KAAA,GACZ,MAAM,IAAI,MAAM,yBAAyB,OAAO,IAAI,YAAY;GAElE,OAAO,UAAU,OAAQ;EAC3B;CACF;AACF"}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { ClientMethods } from "./types/client.js";
|
|
2
|
+
import { ResourceElement } from "@assistant-ui/tap";
|
|
3
|
+
|
|
4
|
+
//#region src/tapClientResource.d.ts
|
|
5
|
+
declare const getClientState: (client: ClientMethods) => any;
|
|
4
6
|
type InferClientState<TMethods> = TMethods extends {
|
|
5
|
-
|
|
7
|
+
getState: () => infer S;
|
|
6
8
|
} ? S : undefined;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
declare const tapClientResource: <TMethods extends ClientMethods>(element: ResourceElement<TMethods>) => {
|
|
10
|
+
state: InferClientState<TMethods>;
|
|
11
|
+
methods: TMethods;
|
|
12
|
+
key: string | number | undefined;
|
|
11
13
|
};
|
|
12
|
-
|
|
14
|
+
//#endregion
|
|
15
|
+
export { getClientState, tapClientResource };
|
|
13
16
|
//# sourceMappingURL=tapClientResource.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tapClientResource.d.ts","
|
|
1
|
+
{"version":3,"file":"tapClientResource.d.ts","names":[],"sources":["../src/tapClientResource.ts"],"mappings":";;;;cA6Ba,cAAA,GAAkB,MAAqB,EAAb,aAAa;AAAA,KA6I/C,gBAAA,aAA6B,QAAQ;EACxC,QAAA;AAAA,IAEE,CAAA;AAAA,cAGS,iBAAA,oBAAsC,aAAA,EACjD,OAAA,EAAS,eAAA,CAAgB,QAAA;EAEzB,KAAA,EAAO,gBAAA,CAAiB,QAAA;EACxB,OAAA,EAAS,QAAA;EACT,GAAA;AAAA"}
|
|
@@ -1,114 +1,102 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { BaseProxyHandler, handleIntrospectionProp, } from "./utils/BaseProxyHandler.js";
|
|
1
|
+
import { SYMBOL_CLIENT_INDEX, tapClientStack, tapWithClientStack } from "./utils/tap-client-stack-context.js";
|
|
2
|
+
import { BaseProxyHandler, handleIntrospectionProp } from "./utils/BaseProxyHandler.js";
|
|
4
3
|
import { wrapperResource } from "./wrapperResource.js";
|
|
4
|
+
import { tapEffect, tapMemo, tapRef, tapResource } from "@assistant-ui/tap";
|
|
5
|
+
//#region src/tapClientResource.ts
|
|
5
6
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
* Symbol used internally to get state from ClientProxy.
|
|
8
|
+
* This allows getState() to be optional in the user-facing client.
|
|
9
|
+
*/
|
|
9
10
|
const SYMBOL_GET_OUTPUT = Symbol("assistant-ui.store.getValue");
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"Ensure your Derived get() returns a client created with tapClientResource(), not a plain resource.");
|
|
15
|
-
}
|
|
16
|
-
return output.getState?.();
|
|
11
|
+
const getClientState = (client) => {
|
|
12
|
+
const output = client[SYMBOL_GET_OUTPUT];
|
|
13
|
+
if (!output) throw new Error("Client scope contains a non-client resource. Ensure your Derived get() returns a client created with tapClientResource(), not a plain resource.");
|
|
14
|
+
return output.getState?.();
|
|
17
15
|
};
|
|
18
|
-
|
|
19
|
-
const fieldAccessFns = new Map();
|
|
16
|
+
const fieldAccessFns = /* @__PURE__ */ new Map();
|
|
20
17
|
function getOrCreateProxyFn(prop) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
throw new Error(`Method "${String(prop)}" is not implemented.`);
|
|
36
|
-
if (typeof method !== "function")
|
|
37
|
-
throw new Error(`"${String(prop)}" is not a function.`);
|
|
38
|
-
return method(...args);
|
|
39
|
-
};
|
|
40
|
-
fieldAccessFns.set(prop, template);
|
|
41
|
-
}
|
|
42
|
-
return template;
|
|
43
|
-
}
|
|
44
|
-
class ClientProxyHandler extends BaseProxyHandler {
|
|
45
|
-
outputRef;
|
|
46
|
-
index;
|
|
47
|
-
boundFns;
|
|
48
|
-
cachedReceiver;
|
|
49
|
-
constructor(outputRef, index) {
|
|
50
|
-
super();
|
|
51
|
-
this.outputRef = outputRef;
|
|
52
|
-
this.index = index;
|
|
53
|
-
}
|
|
54
|
-
get(_, prop, receiver) {
|
|
55
|
-
if (prop === SYMBOL_GET_OUTPUT)
|
|
56
|
-
return this.outputRef.current;
|
|
57
|
-
if (prop === SYMBOL_CLIENT_INDEX)
|
|
58
|
-
return this.index;
|
|
59
|
-
const introspection = handleIntrospectionProp(prop, "ClientProxy");
|
|
60
|
-
if (introspection !== false)
|
|
61
|
-
return introspection;
|
|
62
|
-
const value = this.outputRef.current[prop];
|
|
63
|
-
if (typeof value === "function") {
|
|
64
|
-
if (this.cachedReceiver !== receiver) {
|
|
65
|
-
this.boundFns = new Map();
|
|
66
|
-
this.cachedReceiver = receiver;
|
|
67
|
-
}
|
|
68
|
-
let bound = this.boundFns.get(prop);
|
|
69
|
-
if (!bound) {
|
|
70
|
-
bound = getOrCreateProxyFn(prop).bind(receiver);
|
|
71
|
-
this.boundFns.set(prop, bound);
|
|
72
|
-
}
|
|
73
|
-
return bound;
|
|
74
|
-
}
|
|
75
|
-
return value;
|
|
76
|
-
}
|
|
77
|
-
ownKeys() {
|
|
78
|
-
return Object.keys(this.outputRef.current);
|
|
79
|
-
}
|
|
80
|
-
has(_, prop) {
|
|
81
|
-
if (prop === SYMBOL_GET_OUTPUT)
|
|
82
|
-
return true;
|
|
83
|
-
if (prop === SYMBOL_CLIENT_INDEX)
|
|
84
|
-
return true;
|
|
85
|
-
return prop in this.outputRef.current;
|
|
86
|
-
}
|
|
18
|
+
let template = fieldAccessFns.get(prop);
|
|
19
|
+
if (!template) {
|
|
20
|
+
template = function(...args) {
|
|
21
|
+
if (!this || typeof this !== "object") throw new Error(`Method "${String(prop)}" called without proper context. This may indicate the function was called incorrectly.`);
|
|
22
|
+
const output = this[SYMBOL_GET_OUTPUT];
|
|
23
|
+
if (!output) throw new Error(`Method "${String(prop)}" called on invalid client proxy. Ensure you are calling this method on a valid client instance.`);
|
|
24
|
+
const method = output[prop];
|
|
25
|
+
if (!method) throw new Error(`Method "${String(prop)}" is not implemented.`);
|
|
26
|
+
if (typeof method !== "function") throw new Error(`"${String(prop)}" is not a function.`);
|
|
27
|
+
return method(...args);
|
|
28
|
+
};
|
|
29
|
+
fieldAccessFns.set(prop, template);
|
|
30
|
+
}
|
|
31
|
+
return template;
|
|
87
32
|
}
|
|
33
|
+
var ClientProxyHandler = class extends BaseProxyHandler {
|
|
34
|
+
outputRef;
|
|
35
|
+
index;
|
|
36
|
+
boundFns;
|
|
37
|
+
cachedReceiver;
|
|
38
|
+
constructor(outputRef, index) {
|
|
39
|
+
super();
|
|
40
|
+
this.outputRef = outputRef;
|
|
41
|
+
this.index = index;
|
|
42
|
+
}
|
|
43
|
+
get(_, prop, receiver) {
|
|
44
|
+
if (prop === SYMBOL_GET_OUTPUT) return this.outputRef.current;
|
|
45
|
+
if (prop === SYMBOL_CLIENT_INDEX) return this.index;
|
|
46
|
+
const introspection = handleIntrospectionProp(prop, "ClientProxy");
|
|
47
|
+
if (introspection !== false) return introspection;
|
|
48
|
+
const value = this.outputRef.current[prop];
|
|
49
|
+
if (typeof value === "function") {
|
|
50
|
+
if (this.cachedReceiver !== receiver) {
|
|
51
|
+
this.boundFns = /* @__PURE__ */ new Map();
|
|
52
|
+
this.cachedReceiver = receiver;
|
|
53
|
+
}
|
|
54
|
+
let bound = this.boundFns.get(prop);
|
|
55
|
+
if (!bound) {
|
|
56
|
+
bound = getOrCreateProxyFn(prop).bind(receiver);
|
|
57
|
+
this.boundFns.set(prop, bound);
|
|
58
|
+
}
|
|
59
|
+
return bound;
|
|
60
|
+
}
|
|
61
|
+
return value;
|
|
62
|
+
}
|
|
63
|
+
ownKeys() {
|
|
64
|
+
return Object.keys(this.outputRef.current);
|
|
65
|
+
}
|
|
66
|
+
has(_, prop) {
|
|
67
|
+
if (prop === SYMBOL_GET_OUTPUT) return true;
|
|
68
|
+
if (prop === SYMBOL_CLIENT_INDEX) return true;
|
|
69
|
+
return prop in this.outputRef.current;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
88
72
|
/**
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
73
|
+
* Resource that wraps a plain resource element to create a stable client proxy.
|
|
74
|
+
*
|
|
75
|
+
* Takes a ResourceElement that returns methods (with optional getState()) and
|
|
76
|
+
* wraps it to produce a stable client proxy. This adds the client to the
|
|
77
|
+
* client stack, enabling event scoping.
|
|
78
|
+
*
|
|
79
|
+
* @internal
|
|
80
|
+
*/
|
|
81
|
+
const ClientResource = wrapperResource((element) => {
|
|
82
|
+
const valueRef = tapRef(null);
|
|
83
|
+
const index = tapClientStack().length;
|
|
84
|
+
const methods = tapMemo(() => new Proxy({}, new ClientProxyHandler(valueRef, index)), [index]);
|
|
85
|
+
const value = tapWithClientStack(methods, () => tapResource(element));
|
|
86
|
+
if (!valueRef.current) valueRef.current = value;
|
|
87
|
+
tapEffect(() => {
|
|
88
|
+
valueRef.current = value;
|
|
89
|
+
});
|
|
90
|
+
return {
|
|
91
|
+
methods,
|
|
92
|
+
state: value.getState?.(),
|
|
93
|
+
key: element.key
|
|
94
|
+
};
|
|
110
95
|
});
|
|
111
|
-
|
|
112
|
-
|
|
96
|
+
const tapClientResource = (element) => {
|
|
97
|
+
return tapResource(ClientResource(element));
|
|
113
98
|
};
|
|
99
|
+
//#endregion
|
|
100
|
+
export { ClientResource, getClientState, tapClientResource };
|
|
101
|
+
|
|
114
102
|
//# sourceMappingURL=tapClientResource.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tapClientResource.js","
|
|
1
|
+
{"version":3,"file":"tapClientResource.js","names":[],"sources":["../src/tapClientResource.ts"],"sourcesContent":["import {\n tapEffect,\n tapMemo,\n tapRef,\n type ResourceElement,\n tapResource,\n} from \"@assistant-ui/tap\";\nimport type { ClientMethods } from \"./types/client\";\nimport {\n tapClientStack,\n tapWithClientStack,\n SYMBOL_CLIENT_INDEX,\n} from \"./utils/tap-client-stack-context\";\nimport {\n BaseProxyHandler,\n handleIntrospectionProp,\n} from \"./utils/BaseProxyHandler\";\nimport { wrapperResource } from \"./wrapperResource\";\n\n/**\n * Symbol used internally to get state from ClientProxy.\n * This allows getState() to be optional in the user-facing client.\n */\nconst SYMBOL_GET_OUTPUT = Symbol(\"assistant-ui.store.getValue\");\n\ntype ClientInternal = {\n [SYMBOL_GET_OUTPUT]: ClientMethods;\n};\n\nexport const getClientState = (client: ClientMethods) => {\n const output = (client as unknown as ClientInternal)[SYMBOL_GET_OUTPUT];\n if (!output) {\n throw new Error(\n \"Client scope contains a non-client resource. \" +\n \"Ensure your Derived get() returns a client created with tapClientResource(), not a plain resource.\",\n );\n }\n return (output as any).getState?.();\n};\n\n// Global cache for function templates by field name\nconst fieldAccessFns = new Map<\n string | symbol,\n (this: unknown, ...args: unknown[]) => unknown\n>();\n\nfunction getOrCreateProxyFn(prop: string | symbol) {\n let template = fieldAccessFns.get(prop);\n if (!template) {\n template = function (this: unknown, ...args: unknown[]) {\n if (!this || typeof this !== \"object\") {\n throw new Error(\n `Method \"${String(prop)}\" called without proper context. ` +\n `This may indicate the function was called incorrectly.`,\n );\n }\n\n const output = (this as ClientInternal)[SYMBOL_GET_OUTPUT];\n if (!output) {\n throw new Error(\n `Method \"${String(prop)}\" called on invalid client proxy. ` +\n `Ensure you are calling this method on a valid client instance.`,\n );\n }\n\n const method = output[prop];\n if (!method)\n throw new Error(`Method \"${String(prop)}\" is not implemented.`);\n if (typeof method !== \"function\")\n throw new Error(`\"${String(prop)}\" is not a function.`);\n return method(...args);\n };\n fieldAccessFns.set(prop, template);\n }\n return template;\n}\n\nclass ClientProxyHandler\n extends BaseProxyHandler\n implements ProxyHandler<object>\n{\n private boundFns:\n | Map<string | symbol, (...args: never) => unknown>\n | undefined;\n private cachedReceiver: unknown;\n\n constructor(\n private readonly outputRef: {\n current: ClientMethods;\n },\n private readonly index: number,\n ) {\n super();\n }\n\n get(_: unknown, prop: string | symbol, receiver: unknown) {\n if (prop === SYMBOL_GET_OUTPUT) return this.outputRef.current;\n if (prop === SYMBOL_CLIENT_INDEX) return this.index;\n const introspection = handleIntrospectionProp(prop, \"ClientProxy\");\n if (introspection !== false) return introspection;\n const value = this.outputRef.current[prop];\n if (typeof value === \"function\") {\n if (this.cachedReceiver !== receiver) {\n this.boundFns = new Map();\n this.cachedReceiver = receiver;\n }\n let bound = this.boundFns!.get(prop);\n if (!bound) {\n bound = getOrCreateProxyFn(prop).bind(receiver);\n this.boundFns!.set(prop, bound);\n }\n return bound;\n }\n return value;\n }\n\n ownKeys(): ArrayLike<string | symbol> {\n return Object.keys(this.outputRef.current);\n }\n\n has(_: unknown, prop: string | symbol) {\n if (prop === SYMBOL_GET_OUTPUT) return true;\n if (prop === SYMBOL_CLIENT_INDEX) return true;\n return prop in this.outputRef.current;\n }\n}\n\n/**\n * Resource that wraps a plain resource element to create a stable client proxy.\n *\n * Takes a ResourceElement that returns methods (with optional getState()) and\n * wraps it to produce a stable client proxy. This adds the client to the\n * client stack, enabling event scoping.\n *\n * @internal\n */\nexport const ClientResource = wrapperResource(\n <TMethods extends ClientMethods>(\n element: ResourceElement<TMethods>,\n ): {\n methods: TMethods;\n state: unknown;\n key: string | number | undefined;\n } => {\n const valueRef = tapRef(null as unknown as TMethods);\n\n const index = tapClientStack().length;\n const methods = tapMemo(\n () =>\n new Proxy<TMethods>(\n {} as TMethods,\n new ClientProxyHandler(valueRef, index),\n ),\n [index],\n );\n\n const value = tapWithClientStack(methods, () => tapResource(element));\n if (!valueRef.current) {\n valueRef.current = value;\n }\n\n tapEffect(() => {\n valueRef.current = value;\n });\n\n const state = (value as any).getState?.();\n return { methods, state, key: element.key };\n },\n);\n\ntype InferClientState<TMethods> = TMethods extends {\n getState: () => infer S;\n}\n ? S\n : undefined;\n\nexport const tapClientResource = <TMethods extends ClientMethods>(\n element: ResourceElement<TMethods>,\n): {\n state: InferClientState<TMethods>;\n methods: TMethods;\n key: string | number | undefined;\n} => {\n return tapResource(ClientResource(element)) as {\n state: InferClientState<TMethods>;\n methods: TMethods;\n key: string | number | undefined;\n };\n};\n"],"mappings":";;;;;;;;;AAuBA,MAAM,oBAAoB,OAAO,6BAA6B;AAM9D,MAAa,kBAAkB,WAA0B;CACvD,MAAM,SAAU,OAAqC;CACrD,IAAI,CAAC,QACH,MAAM,IAAI,MACR,iJAEF;CAEF,OAAQ,OAAe,WAAW;AACpC;AAGA,MAAM,iCAAiB,IAAI,IAGzB;AAEF,SAAS,mBAAmB,MAAuB;CACjD,IAAI,WAAW,eAAe,IAAI,IAAI;CACtC,IAAI,CAAC,UAAU;EACb,WAAW,SAAyB,GAAG,MAAiB;GACtD,IAAI,CAAC,QAAQ,OAAO,SAAS,UAC3B,MAAM,IAAI,MACR,WAAW,OAAO,IAAI,EAAE,wFAE1B;GAGF,MAAM,SAAU,KAAwB;GACxC,IAAI,CAAC,QACH,MAAM,IAAI,MACR,WAAW,OAAO,IAAI,EAAE,iGAE1B;GAGF,MAAM,SAAS,OAAO;GACtB,IAAI,CAAC,QACH,MAAM,IAAI,MAAM,WAAW,OAAO,IAAI,EAAE,sBAAsB;GAChE,IAAI,OAAO,WAAW,YACpB,MAAM,IAAI,MAAM,IAAI,OAAO,IAAI,EAAE,qBAAqB;GACxD,OAAO,OAAO,GAAG,IAAI;EACvB;EACA,eAAe,IAAI,MAAM,QAAQ;CACnC;CACA,OAAO;AACT;AAEA,IAAM,qBAAN,cACU,iBAEV;CAOqB;CAGA;CATnB;CAGA;CAEA,YACE,WAGA,OACA;EACA,MAAM;EALW,KAAA,YAAA;EAGA,KAAA,QAAA;CAGnB;CAEA,IAAI,GAAY,MAAuB,UAAmB;EACxD,IAAI,SAAS,mBAAmB,OAAO,KAAK,UAAU;EACtD,IAAI,SAAS,qBAAqB,OAAO,KAAK;EAC9C,MAAM,gBAAgB,wBAAwB,MAAM,aAAa;EACjE,IAAI,kBAAkB,OAAO,OAAO;EACpC,MAAM,QAAQ,KAAK,UAAU,QAAQ;EACrC,IAAI,OAAO,UAAU,YAAY;GAC/B,IAAI,KAAK,mBAAmB,UAAU;IACpC,KAAK,2BAAW,IAAI,IAAI;IACxB,KAAK,iBAAiB;GACxB;GACA,IAAI,QAAQ,KAAK,SAAU,IAAI,IAAI;GACnC,IAAI,CAAC,OAAO;IACV,QAAQ,mBAAmB,IAAI,EAAE,KAAK,QAAQ;IAC9C,KAAK,SAAU,IAAI,MAAM,KAAK;GAChC;GACA,OAAO;EACT;EACA,OAAO;CACT;CAEA,UAAsC;EACpC,OAAO,OAAO,KAAK,KAAK,UAAU,OAAO;CAC3C;CAEA,IAAI,GAAY,MAAuB;EACrC,IAAI,SAAS,mBAAmB,OAAO;EACvC,IAAI,SAAS,qBAAqB,OAAO;EACzC,OAAO,QAAQ,KAAK,UAAU;CAChC;AACF;;;;;;;;;;AAWA,MAAa,iBAAiB,iBAE1B,YAKG;CACH,MAAM,WAAW,OAAO,IAA2B;CAEnD,MAAM,QAAQ,eAAe,EAAE;CAC/B,MAAM,UAAU,cAEZ,IAAI,MACF,CAAC,GACD,IAAI,mBAAmB,UAAU,KAAK,CACxC,GACF,CAAC,KAAK,CACR;CAEA,MAAM,QAAQ,mBAAmB,eAAe,YAAY,OAAO,CAAC;CACpE,IAAI,CAAC,SAAS,SACZ,SAAS,UAAU;CAGrB,gBAAgB;EACd,SAAS,UAAU;CACrB,CAAC;CAGD,OAAO;EAAE;EAAS,OADH,MAAc,WAAW;EACf,KAAK,QAAQ;CAAI;AAC5C,CACF;AAQA,MAAa,qBACX,YAKG;CACH,OAAO,YAAY,eAAe,OAAO,CAAC;AAK5C"}
|