@buoy-gg/console 4.0.2

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 (151) hide show
  1. package/LICENSE +58 -0
  2. package/README.md +55 -0
  3. package/lib/commonjs/components/ConsoleIcon.js +47 -0
  4. package/lib/commonjs/components/ConsoleIcon.js.map +1 -0
  5. package/lib/commonjs/components/ConsoleLogList.js +145 -0
  6. package/lib/commonjs/components/ConsoleLogList.js.map +1 -0
  7. package/lib/commonjs/components/ConsoleModal.js +48 -0
  8. package/lib/commonjs/components/ConsoleModal.js.map +1 -0
  9. package/lib/commonjs/components/ConsoleRoot.js +28 -0
  10. package/lib/commonjs/components/ConsoleRoot.js.map +1 -0
  11. package/lib/commonjs/devtools/ConsoleBody.js +235 -0
  12. package/lib/commonjs/devtools/ConsoleBody.js.map +1 -0
  13. package/lib/commonjs/devtools/ConsoleHeader.js +146 -0
  14. package/lib/commonjs/devtools/ConsoleHeader.js.map +1 -0
  15. package/lib/commonjs/devtools/ConsoleMessageRow.js +338 -0
  16. package/lib/commonjs/devtools/ConsoleMessageRow.js.map +1 -0
  17. package/lib/commonjs/devtools/ConsoleValue.js +254 -0
  18. package/lib/commonjs/devtools/ConsoleValue.js.map +1 -0
  19. package/lib/commonjs/devtools/ConsoleView.js +51 -0
  20. package/lib/commonjs/devtools/ConsoleView.js.map +1 -0
  21. package/lib/commonjs/devtools/consoleFilter.js +125 -0
  22. package/lib/commonjs/devtools/consoleFilter.js.map +1 -0
  23. package/lib/commonjs/devtools/consoleFormat.js +313 -0
  24. package/lib/commonjs/devtools/consoleFormat.js.map +1 -0
  25. package/lib/commonjs/devtools/origin.js +191 -0
  26. package/lib/commonjs/devtools/origin.js.map +1 -0
  27. package/lib/commonjs/devtools/theme.js +143 -0
  28. package/lib/commonjs/devtools/theme.js.map +1 -0
  29. package/lib/commonjs/devtools/useConsoleController.js +82 -0
  30. package/lib/commonjs/devtools/useConsoleController.js.map +1 -0
  31. package/lib/commonjs/devtools/useConsoleMessages.js +241 -0
  32. package/lib/commonjs/devtools/useConsoleMessages.js.map +1 -0
  33. package/lib/commonjs/hooks/useConsoleLogs.js +23 -0
  34. package/lib/commonjs/hooks/useConsoleLogs.js.map +1 -0
  35. package/lib/commonjs/index.js +175 -0
  36. package/lib/commonjs/index.js.map +1 -0
  37. package/lib/commonjs/package.json +1 -0
  38. package/lib/commonjs/preset.js +45 -0
  39. package/lib/commonjs/preset.js.map +1 -0
  40. package/lib/commonjs/store/consoleLogStore.js +298 -0
  41. package/lib/commonjs/store/consoleLogStore.js.map +1 -0
  42. package/lib/commonjs/store/sanitize.js +64 -0
  43. package/lib/commonjs/store/sanitize.js.map +1 -0
  44. package/lib/commonjs/sync/consoleSyncAdapter.js +47 -0
  45. package/lib/commonjs/sync/consoleSyncAdapter.js.map +1 -0
  46. package/lib/module/components/ConsoleIcon.js +42 -0
  47. package/lib/module/components/ConsoleIcon.js.map +1 -0
  48. package/lib/module/components/ConsoleLogList.js +140 -0
  49. package/lib/module/components/ConsoleLogList.js.map +1 -0
  50. package/lib/module/components/ConsoleModal.js +44 -0
  51. package/lib/module/components/ConsoleModal.js.map +1 -0
  52. package/lib/module/components/ConsoleRoot.js +25 -0
  53. package/lib/module/components/ConsoleRoot.js.map +1 -0
  54. package/lib/module/devtools/ConsoleBody.js +230 -0
  55. package/lib/module/devtools/ConsoleBody.js.map +1 -0
  56. package/lib/module/devtools/ConsoleHeader.js +141 -0
  57. package/lib/module/devtools/ConsoleHeader.js.map +1 -0
  58. package/lib/module/devtools/ConsoleMessageRow.js +333 -0
  59. package/lib/module/devtools/ConsoleMessageRow.js.map +1 -0
  60. package/lib/module/devtools/ConsoleValue.js +249 -0
  61. package/lib/module/devtools/ConsoleValue.js.map +1 -0
  62. package/lib/module/devtools/ConsoleView.js +46 -0
  63. package/lib/module/devtools/ConsoleView.js.map +1 -0
  64. package/lib/module/devtools/consoleFilter.js +119 -0
  65. package/lib/module/devtools/consoleFilter.js.map +1 -0
  66. package/lib/module/devtools/consoleFormat.js +309 -0
  67. package/lib/module/devtools/consoleFormat.js.map +1 -0
  68. package/lib/module/devtools/origin.js +183 -0
  69. package/lib/module/devtools/origin.js.map +1 -0
  70. package/lib/module/devtools/theme.js +140 -0
  71. package/lib/module/devtools/theme.js.map +1 -0
  72. package/lib/module/devtools/useConsoleController.js +79 -0
  73. package/lib/module/devtools/useConsoleController.js.map +1 -0
  74. package/lib/module/devtools/useConsoleMessages.js +238 -0
  75. package/lib/module/devtools/useConsoleMessages.js.map +1 -0
  76. package/lib/module/hooks/useConsoleLogs.js +19 -0
  77. package/lib/module/hooks/useConsoleLogs.js.map +1 -0
  78. package/lib/module/index.js +52 -0
  79. package/lib/module/index.js.map +1 -0
  80. package/lib/module/preset.js +40 -0
  81. package/lib/module/preset.js.map +1 -0
  82. package/lib/module/store/consoleLogStore.js +284 -0
  83. package/lib/module/store/consoleLogStore.js.map +1 -0
  84. package/lib/module/store/sanitize.js +60 -0
  85. package/lib/module/store/sanitize.js.map +1 -0
  86. package/lib/module/sync/consoleSyncAdapter.js +43 -0
  87. package/lib/module/sync/consoleSyncAdapter.js.map +1 -0
  88. package/lib/typescript/components/ConsoleIcon.d.ts +14 -0
  89. package/lib/typescript/components/ConsoleIcon.d.ts.map +1 -0
  90. package/lib/typescript/components/ConsoleLogList.d.ts +8 -0
  91. package/lib/typescript/components/ConsoleLogList.d.ts.map +1 -0
  92. package/lib/typescript/components/ConsoleModal.d.ts +18 -0
  93. package/lib/typescript/components/ConsoleModal.d.ts.map +1 -0
  94. package/lib/typescript/components/ConsoleRoot.d.ts +14 -0
  95. package/lib/typescript/components/ConsoleRoot.d.ts.map +1 -0
  96. package/lib/typescript/devtools/ConsoleBody.d.ts +11 -0
  97. package/lib/typescript/devtools/ConsoleBody.d.ts.map +1 -0
  98. package/lib/typescript/devtools/ConsoleHeader.d.ts +17 -0
  99. package/lib/typescript/devtools/ConsoleHeader.d.ts.map +1 -0
  100. package/lib/typescript/devtools/ConsoleMessageRow.d.ts +20 -0
  101. package/lib/typescript/devtools/ConsoleMessageRow.d.ts.map +1 -0
  102. package/lib/typescript/devtools/ConsoleValue.d.ts +21 -0
  103. package/lib/typescript/devtools/ConsoleValue.d.ts.map +1 -0
  104. package/lib/typescript/devtools/ConsoleView.d.ts +10 -0
  105. package/lib/typescript/devtools/ConsoleView.d.ts.map +1 -0
  106. package/lib/typescript/devtools/consoleFilter.d.ts +31 -0
  107. package/lib/typescript/devtools/consoleFilter.d.ts.map +1 -0
  108. package/lib/typescript/devtools/consoleFormat.d.ts +29 -0
  109. package/lib/typescript/devtools/consoleFormat.d.ts.map +1 -0
  110. package/lib/typescript/devtools/origin.d.ts +39 -0
  111. package/lib/typescript/devtools/origin.d.ts.map +1 -0
  112. package/lib/typescript/devtools/theme.d.ts +57 -0
  113. package/lib/typescript/devtools/theme.d.ts.map +1 -0
  114. package/lib/typescript/devtools/useConsoleController.d.ts +35 -0
  115. package/lib/typescript/devtools/useConsoleController.d.ts.map +1 -0
  116. package/lib/typescript/devtools/useConsoleMessages.d.ts +74 -0
  117. package/lib/typescript/devtools/useConsoleMessages.d.ts.map +1 -0
  118. package/lib/typescript/hooks/useConsoleLogs.d.ts +11 -0
  119. package/lib/typescript/hooks/useConsoleLogs.d.ts.map +1 -0
  120. package/lib/typescript/index.d.ts +26 -0
  121. package/lib/typescript/index.d.ts.map +1 -0
  122. package/lib/typescript/preset.d.ts +38 -0
  123. package/lib/typescript/preset.d.ts.map +1 -0
  124. package/lib/typescript/store/consoleLogStore.d.ts +71 -0
  125. package/lib/typescript/store/consoleLogStore.d.ts.map +1 -0
  126. package/lib/typescript/store/sanitize.d.ts +11 -0
  127. package/lib/typescript/store/sanitize.d.ts.map +1 -0
  128. package/lib/typescript/sync/consoleSyncAdapter.d.ts +30 -0
  129. package/lib/typescript/sync/consoleSyncAdapter.d.ts.map +1 -0
  130. package/package.json +56 -0
  131. package/src/components/ConsoleIcon.tsx +49 -0
  132. package/src/components/ConsoleLogList.tsx +133 -0
  133. package/src/components/ConsoleModal.tsx +48 -0
  134. package/src/components/ConsoleRoot.tsx +25 -0
  135. package/src/devtools/ConsoleBody.tsx +225 -0
  136. package/src/devtools/ConsoleHeader.tsx +149 -0
  137. package/src/devtools/ConsoleMessageRow.tsx +345 -0
  138. package/src/devtools/ConsoleValue.tsx +265 -0
  139. package/src/devtools/ConsoleView.tsx +41 -0
  140. package/src/devtools/consoleFilter.ts +123 -0
  141. package/src/devtools/consoleFormat.ts +314 -0
  142. package/src/devtools/origin.ts +190 -0
  143. package/src/devtools/theme.ts +137 -0
  144. package/src/devtools/useConsoleController.ts +104 -0
  145. package/src/devtools/useConsoleMessages.ts +337 -0
  146. package/src/hooks/useConsoleLogs.ts +26 -0
  147. package/src/index.tsx +69 -0
  148. package/src/preset.tsx +35 -0
  149. package/src/store/consoleLogStore.ts +346 -0
  150. package/src/store/sanitize.ts +58 -0
  151. package/src/sync/consoleSyncAdapter.ts +49 -0
@@ -0,0 +1,284 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * consoleLogStore
5
+ *
6
+ * Intercepts the global `console` methods and keeps a bounded ring buffer of
7
+ * captured entries, modeled after Chrome DevTools' ConsoleMessage. Direct
8
+ * console patching is the capture path (works identically on Expo, RN CLI, and
9
+ * web). The DevTools-style view layer (filtering, formatting, grouping) is built
10
+ * on top of these raw entries.
11
+ *
12
+ * By default the buffer is in-memory only, so a JS reload starts fresh — just
13
+ * like the Metro/Chrome console. A "Preserve log" toggle persists the buffer to
14
+ * storage and restores it on the next launch (Chrome's "Preserve log").
15
+ */
16
+
17
+ import * as React from "react";
18
+ import { persistentStorage } from "@buoy-gg/shared-ui";
19
+ import { sanitizeArgs } from "./sanitize";
20
+ import { parseOrigin } from "../devtools/origin";
21
+
22
+ /** The console method that produced an entry. */
23
+
24
+ /** DevTools log levels (Protocol.Log.LogEntryLevel). */
25
+
26
+ /** Methods we intercept, in the order we install them. */
27
+ const METHODS = ["log", "info", "warn", "error", "debug", "trace", "dir", "table", "assert", "group", "groupCollapsed", "groupEnd"];
28
+
29
+ /** Methods whose call site we capture a stack for. */
30
+ const STACK_METHODS = new Set(["error", "warn", "trace", "assert"]);
31
+
32
+ /** method → DevTools level. */
33
+ const METHOD_LEVEL = {
34
+ error: "error",
35
+ assert: "error",
36
+ warn: "warning",
37
+ debug: "verbose",
38
+ log: "info",
39
+ info: "info",
40
+ trace: "info",
41
+ dir: "info",
42
+ table: "info",
43
+ group: "info",
44
+ groupCollapsed: "info",
45
+ groupEnd: "info"
46
+ };
47
+
48
+ /** Max entries retained before the oldest are dropped. */
49
+ const MAX_ENTRIES = 1000;
50
+ let entries = [];
51
+ let nextId = 1;
52
+ let installed = false;
53
+ const listeners = new Set();
54
+ const clearListeners = new Set();
55
+
56
+ /** Saved originals so we can restore on uninstall and still print through. */
57
+ const originals = {};
58
+ function emit() {
59
+ for (const listener of listeners) listener();
60
+ }
61
+
62
+ /** Best-effort, single-line serialization of a single console argument. */
63
+ function formatArg(arg) {
64
+ if (typeof arg === "string") return arg;
65
+ if (arg instanceof Error) return arg.stack ?? `${arg.name}: ${arg.message}`;
66
+ if (arg === undefined) return "undefined";
67
+ if (arg === null) return "null";
68
+ if (typeof arg === "function") return `ƒ ${arg.name || "(anonymous)"}`;
69
+ try {
70
+ return JSON.stringify(arg);
71
+ } catch {
72
+ return String(arg);
73
+ }
74
+ }
75
+ function formatArgs(args) {
76
+ return args.map(formatArg).join(" ");
77
+ }
78
+
79
+ /** Drop the "Error" header + the interceptor's own frames from a raw stack. */
80
+ function cleanStack(raw) {
81
+ if (!raw) return undefined;
82
+ return raw.split("\n").slice(3).join("\n") || undefined;
83
+ }
84
+
85
+ /** Nearest owning React component stack (dev only; empty off-render). */
86
+ function captureOwnerStack() {
87
+ try {
88
+ const fn = React.captureOwnerStack;
89
+ return typeof fn === "function" ? fn() ?? undefined : undefined;
90
+ } catch {
91
+ return undefined;
92
+ }
93
+ }
94
+ function record(method, args) {
95
+ // Capture the call site for every log so we can attribute its origin.
96
+ const rawStack = new Error().stack;
97
+ const origin = parseOrigin(rawStack, captureOwnerStack());
98
+ const entry = {
99
+ id: nextId++,
100
+ method,
101
+ level: METHOD_LEVEL[method],
102
+ args,
103
+ message: formatArgs(args),
104
+ timestamp: Date.now(),
105
+ stack: STACK_METHODS.has(method) ? cleanStack(rawStack) : undefined,
106
+ origin
107
+ };
108
+ entries = entries.length >= MAX_ENTRIES ? [...entries.slice(entries.length - MAX_ENTRIES + 1), entry] : [...entries, entry];
109
+ emit();
110
+ scheduleSave();
111
+ }
112
+
113
+ /**
114
+ * Patch the global console methods. Idempotent — safe to call more than once.
115
+ * Each patched method still forwards to the original so normal logging keeps
116
+ * working (Metro terminal, Chrome, native logcat/Xcode).
117
+ */
118
+ export function installConsoleCapture() {
119
+ if (installed) return;
120
+ installed = true;
121
+ for (const method of METHODS) {
122
+ const original = console[method];
123
+ if (typeof original !== "function") continue;
124
+ originals[method] = original;
125
+ // Named so origin parsing can identify (and skip) this frame by function
126
+ // name — in a Metro bundle every frame shares one bundle URL, so filename
127
+ // filtering can't distinguish our wrapper from the real caller.
128
+ console[method] = function buoyConsoleProxy(...args) {
129
+ record(method, args);
130
+ original.apply(console, args);
131
+ };
132
+ }
133
+ }
134
+
135
+ /** Restore the original console methods. */
136
+ export function uninstallConsoleCapture() {
137
+ if (!installed) return;
138
+ installed = false;
139
+ for (const method of METHODS) {
140
+ const original = originals[method];
141
+ if (original) console[method] = original;
142
+ delete originals[method];
143
+ }
144
+ }
145
+
146
+ /** Subscribe to changes. Returns an unsubscribe function. */
147
+ export function subscribe(listener) {
148
+ listeners.add(listener);
149
+ return () => {
150
+ listeners.delete(listener);
151
+ };
152
+ }
153
+
154
+ /** Current snapshot (stable reference between mutations for useSyncExternalStore). */
155
+ export function getEntries() {
156
+ return entries;
157
+ }
158
+
159
+ /** Clear all captured entries. Fires onClear listeners (e.g. to forward the
160
+ * clear to a remote device when running in mirror mode). */
161
+ export function clearEntries() {
162
+ for (const listener of clearListeners) listener();
163
+ void clearSavedBuffer();
164
+ if (entries.length === 0) return;
165
+ entries = [];
166
+ emit();
167
+ }
168
+
169
+ // ─── Remote-mirror mode (desktop dashboard) ──────────────────────────────────
170
+ // The desktop imports this same store but, instead of patching its own console,
171
+ // drives it from device snapshots via replaceEntries(). Capture is never
172
+ // installed there, so local and remote modes never mix.
173
+
174
+ /** Replace the whole entry list from a remote snapshot. */
175
+ export function replaceEntries(next) {
176
+ entries = next.length > MAX_ENTRIES ? next.slice(next.length - MAX_ENTRIES) : next;
177
+ emit();
178
+ }
179
+
180
+ /** Register a listener fired when clearEntries() is called. Returns an
181
+ * unsubscribe function. Used by the dashboard to forward clears to the device. */
182
+ export function onClear(listener) {
183
+ clearListeners.add(listener);
184
+ return () => {
185
+ clearListeners.delete(listener);
186
+ };
187
+ }
188
+
189
+ // ─── Preserve log (persist across reload) ────────────────────────────────────
190
+ // Default OFF: the buffer is in-memory only, so a reload starts fresh. When ON,
191
+ // the buffer is saved to storage (debounced) and restored on the next launch.
192
+
193
+ const PRESERVE_KEY = "@react_buoy_console_preserve";
194
+ const BUFFER_KEY = "@react_buoy_console_buffer";
195
+ const SAVE_DEBOUNCE_MS = 600;
196
+ let preserveLog = false;
197
+ let persistenceReady = false;
198
+ const preserveListeners = new Set();
199
+ let saveTimer = null;
200
+ function emitPreserve() {
201
+ for (const listener of preserveListeners) listener();
202
+ }
203
+ function scheduleSave() {
204
+ if (!preserveLog) return;
205
+ if (saveTimer) clearTimeout(saveTimer);
206
+ saveTimer = setTimeout(saveBuffer, SAVE_DEBOUNCE_MS);
207
+ }
208
+ async function saveBuffer() {
209
+ saveTimer = null;
210
+ if (!preserveLog) return;
211
+ try {
212
+ const serializable = entries.map(entry => ({
213
+ ...entry,
214
+ args: sanitizeArgs(entry.args)
215
+ }));
216
+ await persistentStorage.setItem(BUFFER_KEY, JSON.stringify(serializable));
217
+ } catch {
218
+ // Storage unavailable — preserve is best-effort.
219
+ }
220
+ }
221
+ async function clearSavedBuffer() {
222
+ try {
223
+ await persistentStorage.removeItem(BUFFER_KEY);
224
+ } catch {
225
+ // ignore
226
+ }
227
+ }
228
+
229
+ /**
230
+ * Load the persisted preserve-log flag and, if enabled, restore the saved
231
+ * buffer. If disabled, drop any saved buffer so the session starts fresh.
232
+ * Idempotent — safe to call from ConsoleRoot on every mount.
233
+ */
234
+ export async function initConsolePersistence() {
235
+ if (persistenceReady) return;
236
+ persistenceReady = true;
237
+ try {
238
+ preserveLog = (await persistentStorage.getItem(PRESERVE_KEY)) === "true";
239
+ } catch {
240
+ preserveLog = false;
241
+ }
242
+ emitPreserve();
243
+ if (!preserveLog) {
244
+ await clearSavedBuffer();
245
+ return;
246
+ }
247
+ try {
248
+ const raw = await persistentStorage.getItem(BUFFER_KEY);
249
+ if (raw) {
250
+ const saved = JSON.parse(raw);
251
+ if (Array.isArray(saved) && saved.length) {
252
+ // Prepend restored entries before anything captured this session.
253
+ entries = [...saved, ...entries].slice(-MAX_ENTRIES);
254
+ nextId = Math.max(nextId, ...saved.map(e => e.id + 1));
255
+ emit();
256
+ }
257
+ }
258
+ } catch {
259
+ // Corrupt/absent buffer — ignore.
260
+ }
261
+ }
262
+
263
+ /** Whether logs persist across reload. */
264
+ export function getPreserveLog() {
265
+ return preserveLog;
266
+ }
267
+
268
+ /** Toggle preserve-log. Persists the flag; saves or drops the buffer. */
269
+ export function setPreserveLog(next) {
270
+ if (preserveLog === next) return;
271
+ preserveLog = next;
272
+ emitPreserve();
273
+ persistentStorage.setItem(PRESERVE_KEY, String(next)).catch(() => {});
274
+ if (next) saveBuffer();else clearSavedBuffer();
275
+ }
276
+
277
+ /** Subscribe to preserve-log changes. Returns an unsubscribe function. */
278
+ export function subscribePreserveLog(listener) {
279
+ preserveListeners.add(listener);
280
+ return () => {
281
+ preserveListeners.delete(listener);
282
+ };
283
+ }
284
+ //# sourceMappingURL=consoleLogStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","persistentStorage","sanitizeArgs","parseOrigin","METHODS","STACK_METHODS","Set","METHOD_LEVEL","error","assert","warn","debug","log","info","trace","dir","table","group","groupCollapsed","groupEnd","MAX_ENTRIES","entries","nextId","installed","listeners","clearListeners","originals","emit","listener","formatArg","arg","Error","stack","name","message","undefined","JSON","stringify","String","formatArgs","args","map","join","cleanStack","raw","split","slice","captureOwnerStack","fn","record","method","rawStack","origin","entry","id","level","timestamp","Date","now","has","length","scheduleSave","installConsoleCapture","original","console","buoyConsoleProxy","apply","uninstallConsoleCapture","subscribe","add","delete","getEntries","clearEntries","clearSavedBuffer","replaceEntries","next","onClear","PRESERVE_KEY","BUFFER_KEY","SAVE_DEBOUNCE_MS","preserveLog","persistenceReady","preserveListeners","saveTimer","emitPreserve","clearTimeout","setTimeout","saveBuffer","serializable","setItem","removeItem","initConsolePersistence","getItem","saved","parse","Array","isArray","Math","max","e","getPreserveLog","setPreserveLog","catch","subscribePreserveLog"],"sourceRoot":"../../../src","sources":["store/consoleLogStore.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,iBAAiB,QAAQ,oBAAoB;AACtD,SAASC,YAAY,QAAQ,YAAY;AACzC,SAASC,WAAW,QAAwB,oBAAoB;;AAEhE;;AAeA;;AAsBA;AACA,MAAMC,OAAwB,GAAG,CAC/B,KAAK,EACL,MAAM,EACN,MAAM,EACN,OAAO,EACP,OAAO,EACP,OAAO,EACP,KAAK,EACL,OAAO,EACP,QAAQ,EACR,OAAO,EACP,gBAAgB,EAChB,UAAU,CACX;;AAED;AACA,MAAMC,aAAa,GAAG,IAAIC,GAAG,CAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;;AAElF;AACA,MAAMC,YAAiD,GAAG;EACxDC,KAAK,EAAE,OAAO;EACdC,MAAM,EAAE,OAAO;EACfC,IAAI,EAAE,SAAS;EACfC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IA,KAAK,CAACjC,MAAM,EAAE;QACxC;QACAvC,OAAO,GAAG,CAAC,GAAGwE,KAAK,EAAE,GAAGxE,OAAO,CAAC,CAACyB,KAAK,CAAC,CAAC1B,WAAW,CAAC;QACpDE,MAAM,GAAG2E,IAAI,CAACC,GAAG,CAAC5E,MAAM,EAAE,GAAGuE,KAAK,CAACpD,GAAG,CAAE0D,CAAC,IAAKA,CAAC,CAAC7C,EAAE,GAAG,CAAC,CAAC,CAAC;QACxD3B,IAAI,CAAC,CAAC;MACR;IACF;EACF,CAAC,CAAC,MAAM;IACN;EAAA;AAEJ;;AAEA;AACA,OAAO,SAASyE,cAAcA,CAAA,EAAY;EACxC,OAAOpB,WAAW;AACpB;;AAEA;AACA,OAAO,SAASqB,cAAcA,CAAC1B,IAAa,EAAQ;EAClD,IAAIK,WAAW,KAAKL,IAAI,EAAE;EAC1BK,WAAW,GAAGL,IAAI;EAClBS,YAAY,CAAC,CAAC;EACdnF,iBAAiB,CAACwF,OAAO,CAACZ,YAAY,EAAEvC,MAAM,CAACqC,IAAI,CAAC,CAAC,CAAC2B,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;EACrE,IAAI3B,IAAI,EAAEY,UAAU,CAAC,CAAC,CAAC,KAClBd,gBAAgB,CAAC,CAAC;AACzB;;AAEA;AACA,OAAO,SAAS8B,oBAAoBA,CAAC3E,QAAkB,EAAc;EACnEsD,iBAAiB,CAACb,GAAG,CAACzC,QAAQ,CAAC;EAC/B,OAAO,MAAM;IACXsD,iBAAiB,CAACZ,MAAM,CAAC1C,QAAQ,CAAC;EACpC,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * sanitizeArgs — deep-convert captured console arguments into JSON-safe values.
5
+ *
6
+ * Captured `args` can hold Errors, functions, bigints, symbols, and circular
7
+ * references. Both the external-sync snapshot (device → desktop) and the
8
+ * preserve-log persistence need plain JSON, so this produces a structural copy
9
+ * (objects/arrays preserved so they stay expandable) with cycles broken.
10
+ */
11
+
12
+ const MAX_DEPTH = 6;
13
+ const MAX_ARRAY = 100;
14
+ const MAX_KEYS = 100;
15
+ function sanitizeValue(value, depth, seen) {
16
+ if (value === null) return null;
17
+ const t = typeof value;
18
+ if (t === "string" || t === "boolean") return value;
19
+ if (t === "number") return Number.isFinite(value) ? value : String(value);
20
+ if (t === "undefined") return "undefined";
21
+ if (t === "bigint") return `${String(value)}n`;
22
+ if (t === "function") return `ƒ ${value.name || "(anonymous)"}`;
23
+ if (t === "symbol") return value.toString();
24
+ if (value instanceof Error) {
25
+ return {
26
+ name: value.name,
27
+ message: value.message,
28
+ stack: value.stack
29
+ };
30
+ }
31
+ if (depth >= MAX_DEPTH) return Array.isArray(value) ? "[Array]" : "{…}";
32
+ const obj = value;
33
+ if (seen.has(obj)) return "[Circular]";
34
+ seen.add(obj);
35
+ try {
36
+ if (Array.isArray(value)) {
37
+ const out = value.slice(0, MAX_ARRAY).map(v => sanitizeValue(v, depth + 1, seen));
38
+ if (value.length > MAX_ARRAY) out.push(`… ${value.length - MAX_ARRAY} more`);
39
+ return out;
40
+ }
41
+ const out = {};
42
+ for (const key of Object.keys(obj).slice(0, MAX_KEYS)) {
43
+ try {
44
+ out[key] = sanitizeValue(obj[key], depth + 1, seen);
45
+ } catch {
46
+ out[key] = "[Unserializable]";
47
+ }
48
+ }
49
+ return out;
50
+ } finally {
51
+ seen.delete(obj);
52
+ }
53
+ }
54
+
55
+ /** Deep-sanitize an array of console arguments into JSON-safe values. */
56
+ export function sanitizeArgs(args) {
57
+ const seen = new WeakSet();
58
+ return args.map(arg => sanitizeValue(arg, 0, seen));
59
+ }
60
+ //# sourceMappingURL=sanitize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["MAX_DEPTH","MAX_ARRAY","MAX_KEYS","sanitizeValue","value","depth","seen","t","Number","isFinite","String","name","toString","Error","message","stack","Array","isArray","obj","has","add","out","slice","map","v","length","push","key","Object","keys","delete","sanitizeArgs","args","We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console entries from the device to the
5
+ * desktop dashboard via @buoy-gg/external-sync.
6
+ *
7
+ * Structurally matches external-sync's `ToolSyncAdapter` WITHOUT importing the
8
+ * package (so console has no hard dependency on external-sync, matching how the
9
+ * other tools' adapters are written). Auto-discovery in @buoy-gg/core picks it
10
+ * up by the export name and announces the "console" capability.
11
+ *
12
+ * Snapshots MUST be JSON-serializable. Captured `args` can hold Errors,
13
+ * functions, bigints, and circular references, so we deep-sanitize them into
14
+ * plain JSON values (objects/arrays preserved so they stay expandable on the
15
+ * dashboard).
16
+ */
17
+
18
+ import { subscribe, getEntries, clearEntries } from "../store/consoleLogStore";
19
+ import { sanitizeArgs } from "../store/sanitize";
20
+ export const consoleSyncAdapter = {
21
+ version: 1,
22
+ getSnapshot() {
23
+ const entries = getEntries().map(entry => ({
24
+ ...entry,
25
+ args: sanitizeArgs(entry.args)
26
+ }));
27
+ return {
28
+ entries
29
+ };
30
+ },
31
+ subscribe(onChange) {
32
+ return subscribe(onChange);
33
+ },
34
+ actions: {
35
+ clearEntries() {
36
+ clearEntries();
37
+ return {
38
+ cleared: true
39
+ };
40
+ }
41
+ }
42
+ };
43
+ //# sourceMappingURL=consoleSyncAdapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["subscribe","getEntries","clearEntries","sanitizeArgs","consoleSyncAdapter","version","getSnapshot","entries","map","entry","args","onChange","actions","cleared"],"sourceRoot":"../../../src","sources":["sync/consoleSyncAdapter.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,SAAS,EACTC,UAAU,EACVC,YAAY,QAEP,0BAA0B;AACjC,SAASC,YAAY,QAAQ,mBAAmB;AAMhD,OAAO,MAAMC,kBAAkB,GAAG;EAChCC,OAAO,EAAE,CAAC;EAEVC,WAAWA,CAAA,EAAoB;IAC7B,MAAMC,OAAO,GAAGN,UAAU,CAAC,CAAC,CAACO,GAAG,CAAEC,KAAK,KAAM;MAC3C,GAAGA,KAAK;MACRC,IAAI,EAAEP,YAAY,CAACM,KAAK,CAACC,IAAI;IAC/B,CAAC,CAAC,CAAC;IACH,OAAO;MAAEH;IAAQ,CAAC;EACpB,CAAC;EAEDP,SAASA,CAACW,QAAoB,EAAc;IAC1C,OAAOX,SAAS,CAACW,QAAQ,CAAC;EAC5B,CAAC;EAEDC,OAAO,EAAE;IACPV,YAAYA,CAAA,EAAsB;MAChCA,YAAY,CAAC,CAAC;MACd,OAAO;QAAEW,OAAO,EAAE;MAAK,CAAC;IAC1B;EACF;AACF,CAAC","ignoreList":[]}
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ /** Tool accent color (terminal green). */
3
+ export declare const CONSOLE_ICON_COLOR = "#10B981";
4
+ interface ConsoleIconProps {
5
+ size: number;
6
+ color?: string;
7
+ }
8
+ /**
9
+ * Dependency-free terminal glyph: a rounded window outline with a `>_` prompt.
10
+ * Rendered in the floating menu and the modal header.
11
+ */
12
+ export declare function ConsoleIcon({ size, color }: ConsoleIconProps): React.JSX.Element;
13
+ export {};
14
+ //# sourceMappingURL=ConsoleIcon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConsoleIcon.d.ts","sourceRoot":"","sources":["../../../src/components/ConsoleIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,0CAA0C;AAC1C,eAAO,MAAM,kBAAkB,YAAY,CAAC;AAE5C,UAAU,gBAAgB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,KAA0B,EAAE,EAAE,gBAAgB,qBAyBjF"}
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ /**
3
+ * Basic console log list — a flat, newest-last stream of captured entries.
4
+ * This is the proof-of-concept view; it will be replaced by a 1:1 port of
5
+ * Chrome DevTools' console once capture is verified.
6
+ */
7
+ export declare function ConsoleLogList(): React.JSX.Element;
8
+ //# sourceMappingURL=ConsoleLogList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConsoleLogList.d.ts","sourceRoot":"","sources":["../../../src/components/ConsoleLogList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AA4B1B;;;;GAIG;AACH,wBAAgB,cAAc,sBAkC7B"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * ConsoleModal
3
+ *
4
+ * Bottom-sheet wrapper for the console, rendered by FloatingDevTools when the
5
+ * Console tool is opened. The controls live in the shared ModalHeader
6
+ * (`customContent`) — matching Network/Events — and the body is the log list.
7
+ */
8
+ import type { ModalState } from "@buoy-gg/shared-ui";
9
+ interface ConsoleModalProps {
10
+ visible: boolean;
11
+ onClose: () => void;
12
+ onBack?: () => void;
13
+ onMinimize?: (modalState: ModalState) => void;
14
+ persistenceKey?: string;
15
+ }
16
+ export declare function ConsoleModal({ visible, onClose, onBack, onMinimize, persistenceKey, }: ConsoleModalProps): import("react").JSX.Element;
17
+ export {};
18
+ //# sourceMappingURL=ConsoleModal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConsoleModal.d.ts","sourceRoot":"","sources":["../../../src/components/ConsoleModal.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAKrD,UAAU,iBAAiB;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAC;IAC9C,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,OAAO,EACP,MAAM,EACN,UAAU,EACV,cAAc,GACf,EAAE,iBAAiB,+BAmBnB"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Mount once near the app root to start capturing console output immediately,
3
+ * so logs emitted before the Console tool is opened are retained.
4
+ *
5
+ * Also restores a preserved buffer (or clears any stale one) before capture
6
+ * starts, so the session honors the "Preserve log" setting from the first log.
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * <ConsoleRoot />
11
+ * ```
12
+ */
13
+ export declare function ConsoleRoot(): null;
14
+ //# sourceMappingURL=ConsoleRoot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConsoleRoot.d.ts","sourceRoot":"","sources":["../../../src/components/ConsoleRoot.tsx"],"names":[],"mappings":"AAMA;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAMlC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * ConsoleBody — the modal body. Renders the virtualized log list, or (when a
3
+ * header action selected it) a back-navigable Log levels / Console settings
4
+ * sub-view, mirroring how Network swaps its body to a filter sub-view.
5
+ */
6
+ import React from "react";
7
+ import type { ConsoleController } from "./useConsoleController";
8
+ export declare function ConsoleBody({ c }: {
9
+ c: ConsoleController;
10
+ }): React.JSX.Element;
11
+ //# sourceMappingURL=ConsoleBody.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConsoleBody.d.ts","sourceRoot":"","sources":["../../../src/devtools/ConsoleBody.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAoD,MAAM,OAAO,CAAC;AA0BzE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,wBAAgB,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE;IAAE,CAAC,EAAE,iBAAiB,CAAA;CAAE,qBAG1D"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * ConsoleHeader — the Console tool's header, built from the shared ModalHeader
3
+ * pattern so it matches Network/Events 1:1. Controls live here: the
4
+ * Timeline/Grouped TabSelector (or the search field when active), plus action
5
+ * icons for search, level filter, clear, and settings. Tapping the level/filter
6
+ * or settings icon swaps the body to a back-navigable sub-view.
7
+ */
8
+ import React from "react";
9
+ import type { ConsoleController } from "./useConsoleController";
10
+ interface ConsoleHeaderProps {
11
+ c: ConsoleController;
12
+ /** App-stack back (from the floating menu's AppHost), list view only. */
13
+ onBack?: () => void;
14
+ }
15
+ export declare function ConsoleHeader({ c, onBack }: ConsoleHeaderProps): React.JSX.Element;
16
+ export {};
17
+ //# sourceMappingURL=ConsoleHeader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConsoleHeader.d.ts","sourceRoot":"","sources":["../../../src/devtools/ConsoleHeader.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAQhE,UAAU,kBAAkB;IAC1B,CAAC,EAAE,iBAAiB,CAAC;IACrB,yEAAyE;IACzE,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,wBAAgB,aAAa,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,kBAAkB,qBA0E9D"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * ConsoleMessageRow — RN port of a single DevTools `.console-message-wrapper`.
3
+ *
4
+ * Anatomy (mirrors ConsoleViewMessage):
5
+ * [nesting markers] [group triangle] [level icon] [timestamp] [content] [repeat badge]
6
+ * Error/warning rows get the surface background + text colors; non-error/warning
7
+ * rows get a hairline top divider. Group headers show a bold title with an
8
+ * expand triangle; error/warn/trace rows can expand a captured stack trace.
9
+ */
10
+ import React from "react";
11
+ import type { DisplayRow } from "./useConsoleMessages";
12
+ interface ConsoleMessageRowProps {
13
+ row: DisplayRow;
14
+ showTimestamps: boolean;
15
+ onToggleGroup: (groupId: number, currentlyCollapsed: boolean) => void;
16
+ onToggleCluster: (key: string) => void;
17
+ }
18
+ export declare function ConsoleMessageRow({ row, showTimestamps, onToggleGroup, onToggleCluster, }: ConsoleMessageRowProps): React.JSX.Element;
19
+ export {};
20
+ //# sourceMappingURL=ConsoleMessageRow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConsoleMessageRow.d.ts","sourceRoot":"","sources":["../../../src/devtools/ConsoleMessageRow.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAmB,MAAM,OAAO,CAAC;AAKxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAyBvD,UAAU,sBAAsB;IAC9B,GAAG,EAAE,UAAU,CAAC;IAChB,cAAc,EAAE,OAAO,CAAC;IACxB,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,OAAO,KAAK,IAAI,CAAC;IACtE,eAAe,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAED,wBAAgB,iBAAiB,CAAC,EAChC,GAAG,EACH,cAAc,EACd,aAAa,EACb,eAAe,GAChB,EAAE,sBAAsB,qBAqKxB"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * ConsoleValue — RN approximation of DevTools' object/value rendering
3
+ * (ObjectPropertiesSection + RemoteObjectPreviewFormatter).
4
+ *
5
+ * Primitives render with the DevTools dark-theme `object-value-*` token colors.
6
+ * Objects/arrays render an italic one-line preview with an expand triangle;
7
+ * expanding reveals a property tree (lazy, recursive). Matches the console's
8
+ * collapsed-preview / click-to-expand behavior.
9
+ */
10
+ import React from "react";
11
+ interface ConsoleValueProps {
12
+ value: unknown;
13
+ /** Force the generic (non-preview) object tree, like %O. */
14
+ generic?: boolean;
15
+ /** Nesting depth guard. */
16
+ depth?: number;
17
+ }
18
+ /** Render a single console argument / property value. */
19
+ export declare function ConsoleValue({ value, depth }: ConsoleValueProps): React.JSX.Element;
20
+ export {};
21
+ //# sourceMappingURL=ConsoleValue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConsoleValue.d.ts","sourceRoot":"","sources":["../../../src/devtools/ConsoleValue.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAmB,MAAM,OAAO,CAAC;AAoHxC,UAAU,iBAAiB;IACzB,KAAK,EAAE,OAAO,CAAC;IACf,4DAA4D;IAC5D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,yDAAyD;AACzD,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,KAAS,EAAE,EAAE,iBAAiB,qBA0EnE"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * ConsoleView — self-contained Console panel (header bar + body) for embedding
3
+ * outside a JsModal (the desktop dashboard inline tool, or any standalone use).
4
+ *
5
+ * Inside the mobile floating menu, ConsoleModal composes the same pieces but
6
+ * routes the header into JsModal's `customContent` instead.
7
+ */
8
+ import React from "react";
9
+ export declare function ConsoleView(): React.JSX.Element;
10
+ //# sourceMappingURL=ConsoleView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConsoleView.d.ts","sourceRoot":"","sources":["../../../src/devtools/ConsoleView.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,wBAAgB,WAAW,sBAU1B"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * consoleFilter — port of DevTools `panels/console/ConsoleFilter.ts` plus the
3
+ * `TextUtils.FilterParser` text-filter grammar.
4
+ *
5
+ * - Level mask: 4 levels (verbose/info/warning/error); "Default" = all but verbose.
6
+ * - Text filter: space-separated tokens, AND-combined. Each token may be a plain
7
+ * substring, a `/regex/`, or `key:value` (url/source/context), and a leading
8
+ * `-` negates it. Our captured entries have no url/source/context fields, so
9
+ * keyed tokens degrade to a substring test against the rendered message.
10
+ */
11
+ import type { ConsoleLevel, ConsoleLogEntry } from "../store/consoleLogStore";
12
+ export type LevelsMask = Record<ConsoleLevel, boolean>;
13
+ export declare const ALL_LEVELS: LevelsMask;
14
+ /** "Default levels": everything except Verbose. */
15
+ export declare const DEFAULT_LEVELS: LevelsMask;
16
+ export interface ParsedFilter {
17
+ key?: string;
18
+ text?: string;
19
+ regex?: RegExp;
20
+ negative: boolean;
21
+ }
22
+ /** Parse a filter query string into AND-combined parsed filters. */
23
+ export declare function parseFilterQuery(query: string): ParsedFilter[];
24
+ /** DevTools ConsoleFilter.shouldBeVisible, adapted to our entry model. */
25
+ export declare function shouldBeVisible(entry: ConsoleLogEntry, levelsMask: LevelsMask, parsed: ParsedFilter[]): boolean;
26
+ declare const LEVEL_LABEL: Record<ConsoleLevel, string>;
27
+ declare const LEVEL_ORDER: ConsoleLevel[];
28
+ /** The summary shown on the level menu button. */
29
+ export declare function levelMenuSummary(mask: LevelsMask): string;
30
+ export { LEVEL_LABEL, LEVEL_ORDER };
31
+ //# sourceMappingURL=consoleFilter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consoleFilter.d.ts","sourceRoot":"","sources":["../../../src/devtools/consoleFilter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE9E,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;AAEvD,eAAO,MAAM,UAAU,EAAE,UAKxB,CAAC;AAEF,mDAAmD;AACnD,eAAO,MAAM,cAAc,EAAE,UAA8C,CAAC;AAE5E,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;CACnB;AAKD,oEAAoE;AACpE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,EAAE,CA4B9D;AAqBD,0EAA0E;AAC1E,wBAAgB,eAAe,CAC7B,KAAK,EAAE,eAAe,EACtB,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,YAAY,EAAE,GACrB,OAAO,CAKT;AAID,QAAA,MAAM,WAAW,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAK7C,CAAC;AAEF,QAAA,MAAM,WAAW,EAAE,YAAY,EAA4C,CAAC;AAM5E,kDAAkD;AAClD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAOzD;AAED,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC"}