@bitbitpress/client 1.1.1 → 1.1.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.
Files changed (48) hide show
  1. package/README.md +39 -19
  2. package/dist/data/assets.d.ts +11 -3
  3. package/dist/data/assets.d.ts.map +1 -1
  4. package/dist/data/assets.js +2 -2
  5. package/dist/data/assets.js.map +1 -1
  6. package/dist/data/index.d.ts +2 -2
  7. package/dist/generated/openapi.d.ts +41 -12
  8. package/dist/index.d.ts +1 -1
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/react/index.d.ts +16 -11
  11. package/dist/react/index.d.ts.map +1 -1
  12. package/dist/react/index.js +37 -10
  13. package/dist/react/index.js.map +1 -1
  14. package/dist/react-native-expo/BitBitView.d.ts +32 -0
  15. package/dist/react-native-expo/BitBitView.d.ts.map +1 -0
  16. package/dist/react-native-expo/BitBitView.js +130 -0
  17. package/dist/react-native-expo/BitBitView.js.map +1 -0
  18. package/dist/react-native-expo/bootstrapHtml.d.ts +20 -0
  19. package/dist/react-native-expo/bootstrapHtml.d.ts.map +1 -0
  20. package/dist/react-native-expo/bootstrapHtml.js +79 -0
  21. package/dist/react-native-expo/bootstrapHtml.js.map +1 -0
  22. package/dist/react-native-expo/index.d.ts +2 -0
  23. package/dist/react-native-expo/index.d.ts.map +1 -1
  24. package/dist/react-native-expo/index.js +1 -0
  25. package/dist/react-native-expo/index.js.map +1 -1
  26. package/dist/runtime/index.d.ts +13 -0
  27. package/dist/runtime/index.d.ts.map +1 -1
  28. package/dist/runtime/index.js.map +1 -1
  29. package/dist/synthesisUi/context.d.ts +2 -2
  30. package/dist/synthesisUi/context.js +1 -1
  31. package/dist/synthesisUi/types.d.ts +14 -2
  32. package/dist/synthesisUi/types.d.ts.map +1 -1
  33. package/dist/user/index.d.ts +5 -5
  34. package/dist/user/interaction.d.ts +2 -4
  35. package/dist/user/interaction.d.ts.map +1 -1
  36. package/dist/user/interaction.js +2 -4
  37. package/dist/user/interaction.js.map +1 -1
  38. package/dist/user/synthesize.d.ts +16 -15
  39. package/dist/user/synthesize.d.ts.map +1 -1
  40. package/dist/user/synthesize.js +2 -1
  41. package/dist/user/synthesize.js.map +1 -1
  42. package/dist/user/synthesizeUi.d.ts +35 -13
  43. package/dist/user/synthesizeUi.d.ts.map +1 -1
  44. package/dist/user/synthesizeUi.js +38 -9
  45. package/dist/user/synthesizeUi.js.map +1 -1
  46. package/dist/user/typeDefs.d.ts +13 -0
  47. package/dist/user/typeDefs.d.ts.map +1 -1
  48. package/package.json +7 -6
@@ -0,0 +1,130 @@
1
+ import { createElement, useCallback, useEffect, useRef, useState } from 'react';
2
+ import { WebView } from 'react-native-webview';
3
+ import { useBitBitContext } from '../synthesisUi/context.js';
4
+ import { buildBootstrapHtml } from './bootstrapHtml.js';
5
+ /**
6
+ * React Native view for a server-generated mobile SynthesisUI. The generated
7
+ * bundle is plain DOM (Preact + htm), so it runs in a `WebView`: this streams
8
+ * the UI by `keyName`, loads the bundle in the WebView, pushes `data` in as it
9
+ * streams, and relays the view's `track`/`onEvent`/`navigate` back out. Mirrors
10
+ * the web `<BitBitView>` API + auto-beaconing.
11
+ */
12
+ export function BitBitView({ client: clientProp, keyName, platform = 'mobile', onTrack, onEvent, onNavigate, style, inputs, output, searchOptionsOverrides, synthesisHistoryLimit, }) {
13
+ const contextClient = useBitBitContext()?.client;
14
+ const client = clientProp ?? contextClient;
15
+ const webRef = useRef(null);
16
+ const [html, setHtml] = useState(null);
17
+ // Latest streamed data + history + whether the WebView has loaded the bundle
18
+ // and can receive it. Refs (not state) so streaming doesn't churn renders.
19
+ const dataRef = useRef(undefined);
20
+ const historyRef = useRef(undefined);
21
+ const readyRef = useRef(false);
22
+ // Auto-beacon when `client` is a full BitBitPressClient (the bare preview
23
+ // fetcher has no `trackItem`). Failures are swallowed — analytics never break
24
+ // the view.
25
+ const trackItem = client?.user?.trackItem;
26
+ const beacon = useCallback((type, name, payload) => {
27
+ trackItem?.({ keyName, type, ...(name != null && { name }), payload })?.catch?.(() => { });
28
+ }, [trackItem, keyName]);
29
+ const pushData = useCallback((data, history) => {
30
+ webRef.current?.injectJavaScript(`window.__bb && window.__bb.update(${JSON.stringify(data)}, ${JSON.stringify(history)}); true;`);
31
+ }, []);
32
+ // Stream the UI: `manifest` builds the WebView document; `data` events push
33
+ // into the (already-loaded) WebView, or stash until it signals `ready`.
34
+ useEffect(() => {
35
+ if (!client)
36
+ return;
37
+ let cancelled = false;
38
+ readyRef.current = false;
39
+ dataRef.current = undefined;
40
+ historyRef.current = undefined;
41
+ setHtml(null);
42
+ void (async () => {
43
+ try {
44
+ const stream = await client.user.synthesizeUi({
45
+ keyName,
46
+ platform,
47
+ inputs,
48
+ output,
49
+ searchOptionsOverrides,
50
+ synthesisHistoryLimit,
51
+ });
52
+ for await (const event of stream) {
53
+ if (cancelled)
54
+ break;
55
+ if (event.type === 'manifest') {
56
+ const bundle = event.bundleUrl ?? event.bundleSource;
57
+ if (bundle)
58
+ setHtml(buildBootstrapHtml({ bundle, theme: event.theme }));
59
+ }
60
+ else if (event.type === 'data') {
61
+ dataRef.current = event.data;
62
+ historyRef.current = event.synthesisHistoryEntries;
63
+ if (readyRef.current)
64
+ pushData(event.data, event.synthesisHistoryEntries);
65
+ }
66
+ }
67
+ }
68
+ catch {
69
+ // A failed stream leaves the view unrendered rather than crashing.
70
+ }
71
+ })();
72
+ return () => {
73
+ cancelled = true;
74
+ };
75
+ }, [
76
+ client,
77
+ keyName,
78
+ platform,
79
+ pushData,
80
+ inputs,
81
+ output,
82
+ searchOptionsOverrides,
83
+ synthesisHistoryLimit,
84
+ ]);
85
+ const onMessage = useCallback((e) => {
86
+ let msg;
87
+ try {
88
+ msg = JSON.parse(e.nativeEvent.data);
89
+ }
90
+ catch {
91
+ return;
92
+ }
93
+ switch (msg.kind) {
94
+ case 'ready':
95
+ readyRef.current = true;
96
+ if (dataRef.current !== undefined)
97
+ pushData(dataRef.current, historyRef.current);
98
+ break;
99
+ case 'view':
100
+ beacon('VIEW');
101
+ break;
102
+ case 'track':
103
+ onTrack?.(msg.event, msg.payload);
104
+ beacon('CLICK', msg.event, msg.payload);
105
+ break;
106
+ case 'event':
107
+ onEvent?.(msg.name, msg.payload);
108
+ break;
109
+ case 'navigate':
110
+ onNavigate?.(msg.href);
111
+ break;
112
+ }
113
+ }, [beacon, onTrack, onEvent, onNavigate, pushData]);
114
+ if (!html)
115
+ return null;
116
+ return createElement(WebView, {
117
+ ref: webRef,
118
+ source: { html, baseUrl: 'https://localhost/' },
119
+ originWhitelist: ['*'],
120
+ onMessage,
121
+ javaScriptEnabled: true,
122
+ domStorageEnabled: true,
123
+ allowsInlineMediaPlayback: true,
124
+ mediaPlaybackRequiresUserAction: false,
125
+ // Links go to `onNavigate`, never in-WebView navigation.
126
+ onShouldStartLoadWithRequest: (request) => request.url === 'https://localhost/' || request.url.startsWith('about:'),
127
+ style: style ?? { flex: 1, backgroundColor: 'transparent' },
128
+ });
129
+ }
130
+ //# sourceMappingURL=BitBitView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BitBitView.js","sourceRoot":"","sources":["../../src/react-native-expo/BitBitView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChF,OAAO,EAAE,OAAO,EAA4B,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAM7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAgCxD;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,MAAM,EAAE,UAAU,EAClB,OAAO,EACP,QAAQ,GAAG,QAAQ,EACnB,OAAO,EACP,OAAO,EACP,UAAU,EACV,KAAK,EACL,MAAM,EACN,MAAM,EACN,sBAAsB,EACtB,qBAAqB,GACL;IAChB,MAAM,aAAa,GAAG,gBAA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,OAAO,EAAE;QAC5B,GAAG,EAAE,MAAM;QACX,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,oBAAoB,EAAE;QAC/C,eAAe,EAAE,CAAC,GAAG,CAAC;QACtB,SAAS;QACT,iBAAiB,EAAE,IAAI;QACvB,iBAAiB,EAAE,IAAI;QACvB,yBAAyB,EAAE,IAAI;QAC/B,+BAA+B,EAAE,KAAK;QACtC,yDAAyD;QACzD,4BAA4B,EAAE,CAAC,OAAwB,EAAE,EAAE,CACzD,OAAO,CAAC,GAAG,KAAK,oBAAoB,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC;QAC1E,KAAK,EAAE,KAAK,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,eAAe,EAAE,aAAa,EAAE;KAC5D,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * The HTML document a mobile SynthesisUI WebView loads. It runs the generated
3
+ * bundle (Preact + htm DOM) inside the WebView and bridges both directions:
4
+ *
5
+ * - **data in**: native calls `window.__bb.update(data, history)` (via
6
+ * `injectJavaScript`) on each streamed `data` event; it mounts on the first
7
+ * one, updates after. `history` is forwarded into the view's props.
8
+ * - **events out**: the bundle's `ctx.track/onEvent/navigate` post `{ kind, … }`
9
+ * messages to native through `window.ReactNativeWebView.postMessage`, plus
10
+ * lifecycle signals (`ready`, `view`).
11
+ *
12
+ * `theme` and the bundle ref (a CDN `bundleUrl` or inline `bundleSource`) are
13
+ * baked in as JSON so there's no string-escaping surprise. Loading a bundle is
14
+ * the same blob→import dance the web runtime uses, but run inside the WebView.
15
+ */
16
+ export declare function buildBootstrapHtml(params: {
17
+ bundle: string;
18
+ theme: Record<string, string>;
19
+ }): string;
20
+ //# sourceMappingURL=bootstrapHtml.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrapHtml.d.ts","sourceRoot":"","sources":["../../src/react-native-expo/bootstrapHtml.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B,GAAG,MAAM,CA8DT"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * The HTML document a mobile SynthesisUI WebView loads. It runs the generated
3
+ * bundle (Preact + htm DOM) inside the WebView and bridges both directions:
4
+ *
5
+ * - **data in**: native calls `window.__bb.update(data, history)` (via
6
+ * `injectJavaScript`) on each streamed `data` event; it mounts on the first
7
+ * one, updates after. `history` is forwarded into the view's props.
8
+ * - **events out**: the bundle's `ctx.track/onEvent/navigate` post `{ kind, … }`
9
+ * messages to native through `window.ReactNativeWebView.postMessage`, plus
10
+ * lifecycle signals (`ready`, `view`).
11
+ *
12
+ * `theme` and the bundle ref (a CDN `bundleUrl` or inline `bundleSource`) are
13
+ * baked in as JSON so there's no string-escaping surprise. Loading a bundle is
14
+ * the same blob→import dance the web runtime uses, but run inside the WebView.
15
+ */
16
+ export function buildBootstrapHtml(params) {
17
+ const bundle = JSON.stringify(params.bundle);
18
+ const theme = JSON.stringify(params.theme);
19
+ return `<!doctype html>
20
+ <html>
21
+ <head>
22
+ <meta charset="utf-8">
23
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, viewport-fit=cover">
24
+ <style>
25
+ html, body { margin: 0; padding: 0; }
26
+ /* Viewport units (not %) so the app fills the WebView height without a
27
+ definite parent-height chain, which collapses in a WebView. */
28
+ body { min-height: 100vh; min-height: 100dvh; }
29
+ #bb-root {
30
+ min-height: 100vh;
31
+ min-height: 100dvh;
32
+ display: flex;
33
+ flex-direction: column;
34
+ }
35
+ /* Let the mounted app grow to fill the height (still scrolls when taller). */
36
+ #bb-root > * { flex: 1 0 auto; }
37
+ * { box-sizing: border-box; }
38
+ :root { -webkit-tap-highlight-color: transparent; }
39
+ </style>
40
+ </head>
41
+ <body>
42
+ <div id="bb-root"></div>
43
+ <script type="module">
44
+ const post = (m) => { try { window.ReactNativeWebView.postMessage(JSON.stringify(m)); } catch (e) {} };
45
+ const bb = (window.__bb = { theme: ${theme}, mod: null, handle: null, pending: null, viewed: false });
46
+ const wrap = (h) => (typeof h === 'function' ? { update() {}, unmount: h } : h);
47
+ const ctx = () => ({
48
+ theme: bb.theme,
49
+ track: (event, payload) => post({ kind: 'track', event, payload }),
50
+ onEvent: (name, payload) => post({ kind: 'event', name, payload }),
51
+ navigate: (href) => post({ kind: 'navigate', href }),
52
+ });
53
+ // Called by native (injectJavaScript) with each streamed data payload (+ the
54
+ // optional history array, forwarded into the view's props).
55
+ bb.update = (data, history) => {
56
+ if (!bb.mod) { bb.pending = { data, history }; return; }
57
+ const el = document.getElementById('bb-root');
58
+ const props = { data, history, ctx: ctx() };
59
+ if (bb.handle) { bb.handle.update(props); return; }
60
+ bb.handle = wrap(bb.mod.mount(el, props));
61
+ if (!bb.viewed) { bb.viewed = true; post({ kind: 'view' }); }
62
+ };
63
+ (async () => {
64
+ try {
65
+ const src = ${bundle};
66
+ const url = /^(https?:|blob:|data:|\\/)/.test(src)
67
+ ? src
68
+ : URL.createObjectURL(new Blob([src], { type: 'text/javascript' }));
69
+ bb.mod = await import(url);
70
+ if (typeof bb.mod.mount !== 'function') throw new Error('generated bundle has no mount()');
71
+ post({ kind: 'ready' });
72
+ if (bb.pending != null) bb.update(bb.pending.data, bb.pending.history);
73
+ } catch (e) {}
74
+ })();
75
+ </script>
76
+ </body>
77
+ </html>`;
78
+ }
79
+ //# sourceMappingURL=bootstrapHtml.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrapHtml.js","sourceRoot":"","sources":["../../src/react-native-expo/bootstrapHtml.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAGlC;IACC,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC7C,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC3C,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;qCA0B4B,KAAK;;;;;;;;;;;;;;;;;;;;kBAoBxB,MAAM;;;;;;;;;;;;QAYhB,CAAC;AACT,CAAC"}
@@ -1,2 +1,4 @@
1
1
  export { type BitBitContextValue, BitBitProvider } from '../synthesisUi/context.js';
2
+ export type { SynthesisUiPlatform, SynthesisUiStreamEvent, SynthesizeUiFetcher, } from '../synthesisUi/types.js';
3
+ export { BitBitView, type BitBitViewProps } from './BitBitView.js';
2
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react-native-expo/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react-native-expo/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AACpF,YAAY,EACV,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export { BitBitProvider } from '../synthesisUi/context.js';
2
+ export { BitBitView } from './BitBitView.js';
2
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react-native-expo/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,cAAc,EAAE,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react-native-expo/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAMpF,OAAO,EAAE,UAAU,EAAwB,MAAM,iBAAiB,CAAC"}
@@ -8,11 +8,24 @@
8
8
  * never shares a React instance with the bundle, sidestepping duplicate-React
9
9
  * hook errors. The contract here is types + DOM glue only (no React import).
10
10
  */
11
+ /** A prior synthesis output exposed to the view alongside the current `data`
12
+ * (same output schema). Present only when the request set
13
+ * `synthesisHistoryLimit > 0`. */
14
+ export interface SynthesisUiHistoryEntry<T = unknown> {
15
+ /** Id of this historical `SynthesisOutput` — pass to the submission methods to
16
+ * attach/read app-user submissions against that specific output. */
17
+ synthesisOutputId?: string;
18
+ data: T;
19
+ }
11
20
  /** Props every generated view receives. `data` is the synthesis output
12
21
  * (typed from the config's output schema); `ctx` is the host-provided
13
22
  * runtime. This is a shared TYPE, not a runtime dependency. */
14
23
  export interface BitBitViewProps<T = unknown> {
15
24
  data: T;
25
+ /** Recent prior outputs, most-recent first (the first entry is the current
26
+ * output). Empty/absent unless the request set `synthesisHistoryLimit > 0`.
27
+ * The view may ignore it or render it (e.g. a feed of past results). */
28
+ history?: SynthesisUiHistoryEntry<T>[];
16
29
  ctx: BitBitViewContext;
17
30
  }
18
31
  export interface BitBitViewContext {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;gEAEgE;AAChE,MAAM,WAAW,eAAe,CAAC,CAAC,GAAG,OAAO;IAC1C,IAAI,EAAE,CAAC,CAAC;IACR,GAAG,EAAE,iBAAiB,CAAC;CACxB;AAED,MAAM,WAAW,iBAAiB;IAChC,0CAA0C;IAC1C,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC9C,+DAA+D;IAC/D,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;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M,MAAM,GAAG,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;IACzD,OAAO;QACL,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;YACf,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACvC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACtB,CAAC;QACD,OAAO,EAAE,GAAG,EAAE;YACZ,MAAM,CAAC,OAAO,EAAE,CAAC;YACjB,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;gBAAE,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QAC5D,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -1,12 +1,12 @@
1
1
  import { type ReactNode } from 'react';
2
2
  import type { SynthesizeUiFetcher } from './types.js';
3
3
  export type BitBitContextValue = {
4
- /** Client `<BitBitSynthesis>` fetches generated UIs through, so it can be
4
+ /** Client `<BitBitView>` fetches generated UIs through, so it can be
5
5
  * set once here instead of passed to every instance. */
6
6
  client?: SynthesizeUiFetcher;
7
7
  };
8
8
  /**
9
- * Registers shared SDK config: the `client` `<BitBitSynthesis>` fetches
9
+ * Registers shared SDK config: the `client` `<BitBitView>` fetches
10
10
  * generated UIs through. Platform-agnostic, so this provider is shared by the
11
11
  * web and native entries.
12
12
  */
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { createContext, useContext } from 'react';
3
3
  const BitBitContext = createContext(null);
4
4
  /**
5
- * Registers shared SDK config: the `client` `<BitBitSynthesis>` fetches
5
+ * Registers shared SDK config: the `client` `<BitBitView>` fetches
6
6
  * generated UIs through. Platform-agnostic, so this provider is shared by the
7
7
  * web and native entries.
8
8
  */
@@ -1,3 +1,5 @@
1
+ import type { paths } from '../generated/openapi.js';
2
+ import type { SynthesisUiHistoryEntry } from '../runtime/index.js';
1
3
  export type SynthesisUiPlatform = 'web' | 'mobile';
2
4
  /** Per-UI stream event the fetcher yields: a `manifest` (bundle ref + theme),
3
5
  * then `data` events as the synthesis output streams in. */
@@ -10,12 +12,22 @@ export type SynthesisUiStreamEvent = {
10
12
  type: 'data';
11
13
  data: unknown;
12
14
  complete: boolean;
15
+ /** Recent prior outputs (when `synthesisHistoryLimit > 0`), most-recent
16
+ * first. Forwarded into the view's `history` prop. */
17
+ synthesisHistoryEntries?: SynthesisUiHistoryEntry[];
13
18
  } | {
14
19
  type: 'error';
15
20
  error: string;
16
21
  };
17
22
  /**
18
- * Minimal structural shape `<BitBitSynthesis>` needs to fetch a UI. A
23
+ * Optional per-request synthesis inputs a UI request may carry — mirrors
24
+ * `/v1/user/synthesize` (the UI synthesizes against its attached config). Derived
25
+ * from the OpenAPI `/v1/user/synthesize-ui` item (minus `keyName`); all optional.
26
+ * Set `synthesisHistoryLimit > 0` to populate the view's `history` prop.
27
+ */
28
+ export type SynthesisUiRequestInputs = Omit<paths['/v1/user/synthesize-ui']['post']['requestBody']['content']['application/json']['items'][number], 'keyName'>;
29
+ /**
30
+ * Minimal structural shape `<BitBitView>` needs to fetch a UI. A
19
31
  * `BitBitPressClient` satisfies it via `client.user.synthesizeUi(...)`; the
20
32
  * CMS studio passes a preview fetcher that resolves the draft instead.
21
33
  */
@@ -24,7 +36,7 @@ export interface SynthesizeUiFetcher {
24
36
  synthesizeUi(request: {
25
37
  keyName: string;
26
38
  platform?: SynthesisUiPlatform;
27
- }): AsyncIterable<SynthesisUiStreamEvent> | Promise<AsyncIterable<SynthesisUiStreamEvent>>;
39
+ } & SynthesisUiRequestInputs): AsyncIterable<SynthesisUiStreamEvent> | Promise<AsyncIterable<SynthesisUiStreamEvent>>;
28
40
  };
29
41
  }
30
42
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/synthesisUi/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG,KAAK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AAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB;2DACuD;IACvD,uBAAuB,CAAC,EAAE,uBAAuB,EAAE,CAAC;CACrD,GACD;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAErC;;;;;GAKG;AACH,MAAM,MAAM,wBAAwB,GAAG,IAAI,CACzC,KAAK,CAAC,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,EACtG,SAAS,CACV,CAAC;AAEF;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE;QACJ,YAAY,CACV,OAAO,EAAE;YACP,OAAO,EAAE,MAAM,CAAC;YAChB,QAAQ,CAAC,EAAE,mBAAmB,CAAC;SAChC,GAAG,wBAAwB,GAC3B,aAAa,CAAC,sBAAsB,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC,sBAAsB,CAAC,CAAC,CAAC;KAC3F,CAAC;CACH"}
@@ -132,9 +132,9 @@ export interface UserMethods {
132
132
  /**
133
133
  * Synthesize content items personalized to the user (streaming SSE).
134
134
  *
135
- * @param items - Array of items: optional inputs (type: externalId | text | excludeExternalIds, value), output (schema), optional configurationKeyName, optional limit (number of results to return; defaults to 1), optional searchOptionsOverrides (e.g. lookbackMinutes)
135
+ * @param items - Array of items: optional inputs (type: externalId | text | excludeExternalIds, value), output (schema), optional configurationKeyName, optional synthesisHistoryLimit, optional searchOptionsOverrides (e.g. lookbackMinutes)
136
136
  * @param options - Optional: onStreamingData(index, data) called for each streaming data update per item index
137
- * @returns AsyncIterable yielding connection events (connected, complete) and data events (index, data?, complete, error?)
137
+ * @returns AsyncIterable yielding connection events (connected, complete) and data events (index, data?, synthesisOutputId?, synthesisHistoryEntries?, complete, error?)
138
138
  */
139
139
  synthesize(items: SynthesizeItems, options?: {
140
140
  onStreamingData?: (index: number, data: unknown) => void;
@@ -149,7 +149,7 @@ export interface UserMethods {
149
149
  synthesizeItem(item: SynthesizeItem, onStreamingData?: SynthesizeOnStreamingData): Promise<SynthesizeItemResponse>;
150
150
  /**
151
151
  * @deprecated Use `submissionState` keyed by the poll's `synthesisOutputId`.
152
- * Kept for older app builds; removed once `/v1/user/interactions` is.
152
+ * Kept for retrocompatibility.
153
153
  *
154
154
  * Batch-resolve interaction state for items from a synthesis output.
155
155
  * Returns aggregates and whether the current user has already responded to each.
@@ -160,7 +160,7 @@ export interface UserMethods {
160
160
  interactions(options: InteractionsRequest): Promise<NonNullable<InteractionsResponse>>;
161
161
  /**
162
162
  * @deprecated Use `submit` keyed by the poll's `synthesisOutputId`. Kept for
163
- * older app builds; removed once `/v1/user/interactions` is.
163
+ * retrocompatibility.
164
164
  *
165
165
  * Submit or update a response to an interaction (e.g. a poll answer). Returns updated aggregates.
166
166
  *
@@ -171,7 +171,7 @@ export interface UserMethods {
171
171
  respondToInteraction(interactionId: string, options: InteractionResponseRequest): Promise<NonNullable<InteractionResponseResponse>>;
172
172
  /**
173
173
  * Resolve a generated SynthesisUI by `keyName` for a platform, as a per-UI
174
- * stream (manifest, then data). This is the path `<BitBitSynthesis>` uses
174
+ * stream (manifest, then data). This is the path `<BitBitView>` uses
175
175
  * under the hood.
176
176
  */
177
177
  synthesizeUi(request: SynthesizeUiRequest): Promise<AsyncIterable<SynthesisUiStreamEvent>>;
@@ -8,8 +8,7 @@ export type InteractionResponseResponse = paths['/v1/user/interactions/{interact
8
8
  export type InteractionItem = InteractionsResponse[number];
9
9
  /**
10
10
  * @deprecated Use the submission methods (`submissionState`) keyed by the
11
- * poll's `synthesisOutputId`. Kept for older app builds; removed once the
12
- * `/v1/user/interactions` endpoint is.
11
+ * poll's `synthesisOutputId`. Kept for retrocompatibility.
13
12
  *
14
13
  * Batch-resolve interaction state for items from a synthesis output.
15
14
  * Returns aggregates and whether the current user has already responded to each.
@@ -20,8 +19,7 @@ export type InteractionItem = InteractionsResponse[number];
20
19
  */
21
20
  export declare function getInteractions(config: RequestConfig, options: InteractionsRequest): Promise<NonNullable<InteractionsResponse>>;
22
21
  /**
23
- * @deprecated Use `submit` keyed by the poll's `synthesisOutputId`. Kept for
24
- * older app builds; removed once the `/v1/user/interactions` endpoint is.
22
+ * @deprecated Use `submit` keyed by the poll's `synthesisOutputId`. Kept for retrocompatibility.
25
23
  *
26
24
  * Submit or update a response to an interaction (e.g. a poll answer). Returns updated aggregates.
27
25
  *
@@ -1 +1 @@
1
- {"version":3,"file":"interaction.d.ts","sourceRoot":"","sources":["../../src/user/interaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAGnD,MAAM,MAAM,mBAAmB,GAC7B,KAAK,CAAC,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC;AACvF,MAAM,MAAM,oBAAoB,GAC9B,KAAK,CAAC,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAElG,MAAM,MAAM,0BAA0B,GACpC,KAAK,CAAC,iDAAiD,CAAC,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC;AACjH,MAAM,MAAM,2BAA2B,GACrC,KAAK,CAAC,iDAAiD,CAAC,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5H,sFAAsF;AACtF,MAAM,MAAM,eAAe,GAAG,o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oB,CAAC,MAAM,CAAC,CAAC;AAE3D;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC,CAY5C;AAED;;;;;;;;;GASG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,aAAa,EACrB,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,WAAW,CAAC,2BAA2B,CAAC,CAAC,CAYnD"}
@@ -5,8 +5,7 @@ exports.respondToInteraction = respondToInteraction;
5
5
  const request_js_1 = require("../request.js");
6
6
  /**
7
7
  * @deprecated Use the submission methods (`submissionState`) keyed by the
8
- * poll's `synthesisOutputId`. Kept for older app builds; removed once the
9
- * `/v1/user/interactions` endpoint is.
8
+ * poll's `synthesisOutputId`. Kept for retrocompatibility.
10
9
  *
11
10
  * Batch-resolve interaction state for items from a synthesis output.
12
11
  * Returns aggregates and whether the current user has already responded to each.
@@ -27,8 +26,7 @@ async function getInteractions(config, options) {
27
26
  return response;
28
27
  }
29
28
  /**
30
- * @deprecated Use `submit` keyed by the poll's `synthesisOutputId`. Kept for
31
- * older app builds; removed once the `/v1/user/interactions` endpoint is.
29
+ * @deprecated Use `submit` keyed by the poll's `synthesisOutputId`. Kept for retrocompatibility.
32
30
  *
33
31
  * Submit or update a response to an interaction (e.g. a poll answer). Returns updated aggregates.
34
32
  *
@@ -1 +1 @@
1
- {"version":3,"file":"interaction.js","sourceRoot":"","sources":["../../src/user/interaction.ts"],"names":[],"mappings":";;AA6BA,0CAeC;AAaD,oDAgBC;AAvED,8CAA4C;AAe5C;;;;;;;;;;;GAWG;AACI,KAAK,UAAU,eAAe,CACnC,MAAqB,EACrB,OAA4B;IAE5B,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAW,EAAuB,MAAM,EAAE;QAC/D,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,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d,IAAI,EAAE,yBAAyB,aAAa,YAAY;QACxD,IAAI,EAAE,OAAO;KACd,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IAC3E,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -1,5 +1,9 @@
1
1
  import type { RequestConfig } from '../request.js';
2
2
  import type { SynthesizeItems } from './typeDefs.js';
3
+ export type SynthesisHistoryEntry = {
4
+ synthesisOutputId: string;
5
+ data: unknown;
6
+ };
3
7
  export type SynthesizeItemResponse = {
4
8
  data?: unknown;
5
9
  /**
@@ -13,7 +17,7 @@ export type SynthesizeItemResponse = {
13
17
  * ordered most-recent first. The first entry is the current synthesis itself
14
18
  * (identical to `data` unless user reranking is configured server-side).
15
19
  *
16
- * @deprecated Legacy bare-payload form, kept for older app builds. Prefer
20
+ * @deprecated Legacy bare-payload form, kept for retrocompatibility. Prefer
17
21
  * `synthesisHistoryEntries`, which also carries each entry's
18
22
  * `synthesisOutputId`.
19
23
  */
@@ -24,22 +28,18 @@ export type SynthesizeItemResponse = {
24
28
  * it to the submission methods to attach a vote/entry to that specific
25
29
  * historical output).
26
30
  */
27
- synthesisHistoryEntries?: {
28
- synthesisOutputId?: string;
29
- data: unknown;
30
- }[];
31
+ synthesisHistoryEntries?: SynthesisHistoryEntry[];
31
32
  error?: string;
32
33
  };
33
34
  /**
34
35
  * Synthesize stream event types (SSE). Per OpenAPI spec:
35
36
  * - Connection: `{ type: 'connected' | 'complete' }`
36
- * - Data: `{ index, data?, synthesisHistory?, complete, error? }`.
37
+ * - Data: `{ index, data?, synthesisOutputId?, synthesisHistoryEntries?, synthesisHistory?, complete, error? }`.
37
38
  * Multiple events may be sent for the same index as partial object updates; the final event
38
39
  * for that index has `complete: true` and contains the validated object. When the request
39
- * set `synthesisHistoryLimit > 0`, the final event also includes `synthesisHistory`: an
40
- * array of recent stored `data` payloads (most-recent first; the first entry is the current
41
- * synthesis itself identical to `data` unless user reranking is configured, in which case
42
- * it is the unreranked source).
40
+ * set `synthesisHistoryLimit > 0`, the final event includes `synthesisHistoryEntries`: an
41
+ * array of recent stored outputs paired with their `synthesisOutputId` (most-recent first).
42
+ * A deprecated `synthesisHistory` array of bare data payloads may also be present for retrocompatibility.
43
43
  */
44
44
  export type SynthesizeEvent = {
45
45
  type: 'connected';
@@ -51,13 +51,14 @@ export type SynthesizeEvent = {
51
51
  synthesisOutputId?: string;
52
52
  /** @deprecated Legacy bare-payload form; prefer `synthesisHistoryEntries`. */
53
53
  synthesisHistory?: unknown[];
54
- synthesisHistoryEntries?: {
55
- synthesisOutputId?: string;
56
- data: unknown;
57
- }[];
54
+ synthesisHistoryEntries?: SynthesisHistoryEntry[];
58
55
  complete: boolean;
59
56
  error?: string;
60
57
  };
58
+ /** Detect Zod 4 schema (has _zod internals). */
59
+ export declare function isZodSchema(value: unknown): value is {
60
+ _zod: unknown;
61
+ };
61
62
  /** Options for synthesize stream: optional callback for streaming data updates per item index. */
62
63
  export interface SynthesizeOptions {
63
64
  /** Called for each data event with complete: false, with (index, streaming data). */
@@ -67,7 +68,7 @@ export interface SynthesizeOptions {
67
68
  * Synthesize content items personalized to the user (streaming SSE).
68
69
  *
69
70
  * @param config - Request configuration with base URL, timeout, fetch, and optional token
70
- * @param items - Array of items: each has optional inputs (`type`: externalId | text | excludeExternalIds, `value`), output (schema as JSON string or Zod 4 schema), optional configurationKeyName, optional synthesisHistoryLimit (how many recent stored outputs to expose in the final event's `synthesisHistory` array; defaults to 0 — no history emitted), optional searchOptionsOverrides (e.g. lookbackMinutes)
71
+ * @param items - Array of items: each has optional inputs (`type`: externalId | text | excludeExternalIds, `value`), output (schema as JSON string or Zod 4 schema), optional configurationKeyName, optional synthesisHistoryLimit (how many recent stored outputs to expose in the final event's `synthesisHistoryEntries` array; defaults to 0 — no history emitted), optional searchOptionsOverrides (e.g. lookbackMinutes)
71
72
  * @param options - Optional: onStreamingData(index, data) called for each streaming data update per item index
72
73
  * @returns AsyncIterable yielding connection events (connected, complete) and data events (index, data?, complete, error?). Data may be partial until an event with complete: true for that index.
73
74
  */
@@ -1 +1 @@
1
- {"version":3,"file":"synthesize.d.ts","sourceRoot":"","sources":["../../src/user/synthesize.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,KAAK,EAAE,eAAe,EAAqB,MAAM,eAAe,CAAC;AAExE,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;;;;;OAQG;IACH,gBAAgB,CAAC,EAAE,OAAO,EAAE,CAAC;IAC7B;;;;;OAKG;IACH,uBAAuB,CAAC,EAAE;QAAE,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC;IAC1E,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,MAAM,eAAe,GACvB;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GACrB;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB;IACE,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,8EAA8E;IAC9E,gBAAgB,CAAC,EAAE,OAAO,EAAE,CAAC;IAC7B,uBAAuB,CAAC,EAAE;QAAE,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC;IAC1E,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AA+BN,kGAAkG;AAClG,MAAM,WAAW,iBAAiB;IAChC,qFAAqF;IACrF,eAAe,CAAC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,MAAM,CAAC;IAC3B,8EAA8E;IAC9E,gBAAgB,CAAC,EAAE,OAAO,EAAE,CAAC;IAC7B,uBAAuB,CAAC,EAAE,qBAAqB,EAAE,CAAC;IAClD,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEN,gDAAgD;AAChD,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAEtE;AA0BD,kGAAkG;AAClG,MAAM,WAAW,iBAAiB;IAChC,qFAAqF;IACrF,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1D;AAED;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAC9B,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,eAAe,EACtB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC,CAsBzC;AAED,wEAAwE;AACxE,MAAM,MAAM,yBAAyB,GACnC,OAAO,CAAC,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC"}
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isZodSchema = isZodSchema;
3
4
  exports.synthesize = synthesize;
4
5
  const zod_1 = require("zod");
5
6
  const request_js_1 = require("../request.js");
@@ -34,7 +35,7 @@ function normalizeSynthesizeItems(items) {
34
35
  * Synthesize content items personalized to the user (streaming SSE).
35
36
  *
36
37
  * @param config - Request configuration with base URL, timeout, fetch, and optional token
37
- * @param items - Array of items: each has optional inputs (`type`: externalId | text | excludeExternalIds, `value`), output (schema as JSON string or Zod 4 schema), optional configurationKeyName, optional synthesisHistoryLimit (how many recent stored outputs to expose in the final event's `synthesisHistory` array; defaults to 0 — no history emitted), optional searchOptionsOverrides (e.g. lookbackMinutes)
38
+ * @param items - Array of items: each has optional inputs (`type`: externalId | text | excludeExternalIds, `value`), output (schema as JSON string or Zod 4 schema), optional configurationKeyName, optional synthesisHistoryLimit (how many recent stored outputs to expose in the final event's `synthesisHistoryEntries` array; defaults to 0 — no history emitted), optional searchOptionsOverrides (e.g. lookbackMinutes)
38
39
  * @param options - Optional: onStreamingData(index, data) called for each streaming data update per item index
39
40
  * @returns AsyncIterable yielding connection events (connected, complete) and data events (index, data?, complete, error?). Data may be partial until an event with complete: true for that index.
40
41
  */
@@ -1 +1 @@
1
- {"version":3,"file":"synthesize.js","sourceRoot":"","sources":["../../src/user/synthesize.ts"],"names":[],"mappings":";;AAqGA,gCA0BC;AA/HD,6BAAmC;AAEnC,8CAA4C;AAwD5C,gDAAgD;AAChD,SAAS,WAAW,CAAC,KAAc;IACjC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,IAAI,KAAK,CAAC;AACxE,CAAC;AAED;;;;;GAKG;AACH,SAAS,wBAAwB,CAAC,KAAsB;IACtD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAsC,EAAE;QAC5D,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;QACnC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;YAC1C,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,YAAY,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAA,kBAAY,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QACzF,OAAO;YACL,GAAG,IAAI;YACP,MAAM,EAAE;gBACN,GAAG,IAAI,CAAC,MAAM;gBACd,MA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