@gurezo/web-serial-rxjs 3.1.0 → 4.0.0
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/README.ja.md +4 -7
- package/README.md +4 -7
- package/dist/errors/serial-error-code.d.ts +0 -21
- package/dist/errors/serial-error-code.d.ts.map +1 -1
- package/dist/errors/serial-error-context.d.ts +1 -6
- package/dist/errors/serial-error-context.d.ts.map +1 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +221 -427
- package/dist/index.mjs.map +4 -4
- package/dist/internal/branded-numbers.d.ts +1 -8
- package/dist/internal/branded-numbers.d.ts.map +1 -1
- package/dist/session/create-serial-session.d.ts +6 -4
- package/dist/session/create-serial-session.d.ts.map +1 -1
- package/dist/session/index.d.ts +2 -2
- package/dist/session/index.d.ts.map +1 -1
- package/dist/session/internal/error-severity.d.ts +0 -1
- package/dist/session/internal/error-severity.d.ts.map +1 -1
- package/dist/session/internal/has-web-serial-support.d.ts +6 -5
- package/dist/session/internal/has-web-serial-support.d.ts.map +1 -1
- package/dist/session/internal/line-buffer.d.ts +17 -0
- package/dist/session/internal/line-buffer.d.ts.map +1 -1
- package/dist/session/internal/port-teardown.d.ts +30 -0
- package/dist/session/internal/port-teardown.d.ts.map +1 -0
- package/dist/session/internal/receive-pipeline.d.ts +8 -5
- package/dist/session/internal/receive-pipeline.d.ts.map +1 -1
- package/dist/session/internal/session-error-reporter.d.ts +0 -1
- package/dist/session/internal/session-error-reporter.d.ts.map +1 -1
- package/dist/session/internal/session-lifecycle.d.ts +3 -5
- package/dist/session/internal/session-lifecycle.d.ts.map +1 -1
- package/dist/session/serial-session-options.d.ts +62 -94
- package/dist/session/serial-session-options.d.ts.map +1 -1
- package/dist/session/serial-session.d.ts +9 -75
- package/dist/session/serial-session.d.ts.map +1 -1
- package/dist/session/session-runtime.d.ts.map +1 -1
- package/dist/terminal/create-terminal-buffer.d.ts +24 -1
- package/dist/terminal/create-terminal-buffer.d.ts.map +1 -1
- package/dist/types.d.ts +5 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/session/internal/receive-replay-buffer.d.ts +0 -38
- package/dist/session/internal/receive-replay-buffer.d.ts.map +0 -1
|
@@ -17,7 +17,15 @@ import type { SerialSessionState } from './serial-session-state';
|
|
|
17
17
|
*
|
|
18
18
|
* @example
|
|
19
19
|
* ```typescript
|
|
20
|
-
* import {
|
|
20
|
+
* import {
|
|
21
|
+
* createSerialSession,
|
|
22
|
+
* isWebSerialSupported,
|
|
23
|
+
* SerialSessionStatus,
|
|
24
|
+
* } from '@gurezo/web-serial-rxjs';
|
|
25
|
+
*
|
|
26
|
+
* if (!isWebSerialSupported()) {
|
|
27
|
+
* // fallback UI
|
|
28
|
+
* }
|
|
21
29
|
*
|
|
22
30
|
* const session = createSerialSession({ baudRate: 115200 });
|
|
23
31
|
*
|
|
@@ -43,14 +51,6 @@ import type { SerialSessionState } from './serial-session-state';
|
|
|
43
51
|
* @see {@link https://github.com/gurezo/web-serial-rxjs/issues/203 | Issue #203}
|
|
44
52
|
*/
|
|
45
53
|
export interface SerialSession {
|
|
46
|
-
/**
|
|
47
|
-
* Synchronous feature detection for the Web Serial API.
|
|
48
|
-
*
|
|
49
|
-
* Never throws; intended for UI branching before calling `connect$`.
|
|
50
|
-
*
|
|
51
|
-
* @returns `true` when `navigator.serial` is available.
|
|
52
|
-
*/
|
|
53
|
-
isBrowserSupported(): boolean;
|
|
54
54
|
/**
|
|
55
55
|
* Open a serial port and start the internal read pump.
|
|
56
56
|
*
|
|
@@ -89,17 +89,6 @@ export interface SerialSession {
|
|
|
89
89
|
* @see {@link https://github.com/gurezo/web-serial-rxjs/issues/373 | Issue #373}
|
|
90
90
|
*/
|
|
91
91
|
dispose$(): Observable<void>;
|
|
92
|
-
/**
|
|
93
|
-
* Alias for {@link dispose$}.
|
|
94
|
-
*
|
|
95
|
-
* @deprecated Prefer {@link dispose$}. This alias is retained for backward
|
|
96
|
-
* compatibility and is scheduled for removal in the next major version.
|
|
97
|
-
*
|
|
98
|
-
* @returns An Observable that completes when disposal has finished.
|
|
99
|
-
*
|
|
100
|
-
* @see {@link https://github.com/gurezo/web-serial-rxjs/issues/433 | Issue #433}
|
|
101
|
-
*/
|
|
102
|
-
destroy$(): Observable<void>;
|
|
103
92
|
/**
|
|
104
93
|
* Canonical lifecycle source for the session.
|
|
105
94
|
*
|
|
@@ -110,49 +99,6 @@ export interface SerialSession {
|
|
|
110
99
|
* separate streams.
|
|
111
100
|
*/
|
|
112
101
|
readonly state$: Observable<SerialSessionState>;
|
|
113
|
-
/**
|
|
114
|
-
* `true` when {@link state$} has `status: 'connected'`, `false` otherwise.
|
|
115
|
-
*
|
|
116
|
-
* Derived from `state$` with `distinctUntilChanged` so UIs can bind
|
|
117
|
-
* connect/disabled flags without reimplementing the comparison.
|
|
118
|
-
*
|
|
119
|
-
* @deprecated Prefer narrowing {@link state$} with
|
|
120
|
-
* {@link SerialSessionStatus.Connected}. Retained for backward compatibility;
|
|
121
|
-
* scheduled for removal in the next major version.
|
|
122
|
-
*
|
|
123
|
-
* @see {@link https://github.com/gurezo/web-serial-rxjs/issues/435 | Issue #435}
|
|
124
|
-
*/
|
|
125
|
-
readonly isConnected$: Observable<boolean>;
|
|
126
|
-
/**
|
|
127
|
-
* The active port’s {@link SerialPort.getInfo} snapshot, or `null` when no
|
|
128
|
-
* port is open (including {@link SerialSessionStatus.Idle},
|
|
129
|
-
* {@link SerialSessionStatus.Error}, and {@link SerialSessionStatus.Unsupported}).
|
|
130
|
-
*
|
|
131
|
-
* Emits the current value on subscribe. Use with {@link state$} to know when
|
|
132
|
-
* the value is valid for your UI.
|
|
133
|
-
*
|
|
134
|
-
* @deprecated Prefer narrowing {@link state$} with
|
|
135
|
-
* {@link SerialSessionStatus.Connected} and using `state.portInfo`.
|
|
136
|
-
* Retained for backward compatibility; scheduled for removal in the next
|
|
137
|
-
* major version.
|
|
138
|
-
*
|
|
139
|
-
* @see {@link https://github.com/gurezo/web-serial-rxjs/issues/434 | Issue #434}
|
|
140
|
-
*/
|
|
141
|
-
readonly portInfo$: Observable<SerialPortInfo | null>;
|
|
142
|
-
/**
|
|
143
|
-
* Synchronous read of the last {@link portInfo$} value.
|
|
144
|
-
*
|
|
145
|
-
* @deprecated Prefer narrowing {@link state$} with
|
|
146
|
-
* {@link SerialSessionStatus.Connected} and using `state.portInfo`.
|
|
147
|
-
* Retained for backward compatibility; scheduled for removal in the next
|
|
148
|
-
* major version.
|
|
149
|
-
*
|
|
150
|
-
* @returns The same as {@link SerialPort.getInfo} for the open port, or
|
|
151
|
-
* `null` when not connected.
|
|
152
|
-
*
|
|
153
|
-
* @see {@link https://github.com/gurezo/web-serial-rxjs/issues/434 | Issue #434}
|
|
154
|
-
*/
|
|
155
|
-
getPortInfo(): SerialPortInfo | null;
|
|
156
102
|
/**
|
|
157
103
|
* Canonical fatal / non-fatal error channel.
|
|
158
104
|
*
|
|
@@ -212,18 +158,6 @@ export interface SerialSession {
|
|
|
212
158
|
* ```
|
|
213
159
|
*/
|
|
214
160
|
readonly terminalText$: Observable<string>;
|
|
215
|
-
/**
|
|
216
|
-
* Same source data as {@link receive$} but, when
|
|
217
|
-
* {@link SerialSessionOptions.receiveReplay} has `enabled: true`, it uses a
|
|
218
|
-
* replay buffer **per open connection** so new subscribers can receive the
|
|
219
|
-
* last N decoded text **chunks** from that connection. When receive replay
|
|
220
|
-
* is off (default), this is the same hot stream as {@link receive$}.
|
|
221
|
-
*
|
|
222
|
-
* Does not change {@link lines$} (line framing is not replayed here).
|
|
223
|
-
*
|
|
224
|
-
* @see {@link https://github.com/gurezo/web-serial-rxjs/issues/265 | Issue #265}
|
|
225
|
-
*/
|
|
226
|
-
readonly receiveReplay$: Observable<string>;
|
|
227
161
|
/**
|
|
228
162
|
* Decoded text split into **complete lines** using `\n`, `\r\n`, and
|
|
229
163
|
* lone interior `\r` (see implementation). Intended for **logs**,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serial-session.d.ts","sourceRoot":"","sources":["../../src/session/serial-session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEjE
|
|
1
|
+
{"version":3,"file":"serial-session.d.ts","sourceRoot":"","sources":["../../src/session/serial-session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;;;;OAQG;IACH,QAAQ,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;IAE7B;;;;;;;;;OASG;IACH,WAAW,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;IAEhC;;;;;;;;;;;;;;;OAeG;IACH,QAAQ,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;IAE7B;;;;;;;;OAQG;IACH,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,kBAAkB,CAAC,CAAC;IAEhD;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;IAE1C;;;;;;;;;;;;;;;;;;;OAmBG;IACH,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IAEtC;;;;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;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,cAAc,GAAG,QAAQ,GAAG,IAAI,CAKvE;AAED;;;;;GAKG;AACH,MAAM,WAAW,wBAAwB;IACvC,IAAI,OAAO,IAAI,cAAc,CAAC;IAC9B,IAAI,MAAM,IAAI,uBAAuB,CAAC;IACtC,IAAI,MAAM,IAAI,UAAU,CAAC,kBAAkB,CAAC,CAAC;IAC7C,UAAU,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC;IAC1C,QAAQ,IAAI,IAAI,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,cAAc,GACtB,wBAAwB,CA8C1B;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAEtD"}
|
|
@@ -45,10 +45,16 @@ export interface TerminalBuffer {
|
|
|
45
45
|
*/
|
|
46
46
|
readonly text$: Observable<string>;
|
|
47
47
|
}
|
|
48
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* Options for {@link createTerminalBuffer} memory limits.
|
|
50
|
+
*
|
|
51
|
+
* Character counts use UTF-16 string length (JavaScript `.length`).
|
|
52
|
+
* Pass `0` for `maxLines` or `maxChars` to disable that limit (unlimited).
|
|
53
|
+
*/
|
|
49
54
|
export interface TerminalBufferOptions {
|
|
50
55
|
/**
|
|
51
56
|
* Maximum number of completed lines to retain in the display buffer.
|
|
57
|
+
* `0` means unlimited. Must be a safe integer `>= 0` when validated.
|
|
52
58
|
*
|
|
53
59
|
* @default 10000
|
|
54
60
|
*/
|
|
@@ -56,6 +62,7 @@ export interface TerminalBufferOptions {
|
|
|
56
62
|
/**
|
|
57
63
|
* Maximum total characters in the cumulative display text
|
|
58
64
|
* (`completed` + `currentLine`). Oldest content is dropped first.
|
|
65
|
+
* `0` means unlimited. Must be a safe integer `>= 0` when validated.
|
|
59
66
|
*
|
|
60
67
|
* @default 1048576
|
|
61
68
|
*/
|
|
@@ -72,6 +79,22 @@ export interface TerminalBufferOptions {
|
|
|
72
79
|
}
|
|
73
80
|
/** Default limits applied when options are omitted. */
|
|
74
81
|
export declare const DEFAULT_TERMINAL_BUFFER_OPTIONS: Required<TerminalBufferOptions>;
|
|
82
|
+
/** Resolved terminal buffer options with validated branded numeric fields. */
|
|
83
|
+
export type ResolvedTerminalBufferOptions = {
|
|
84
|
+
maxLines: MaxLines;
|
|
85
|
+
maxChars: MaxChars;
|
|
86
|
+
stripAnsi: boolean;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Merge and validate {@link TerminalBufferOptions}.
|
|
90
|
+
*
|
|
91
|
+
* This is the single normalization path for terminal buffer defaults and
|
|
92
|
+
* boundary checks (session factory and standalone {@link createTerminalBuffer}).
|
|
93
|
+
*
|
|
94
|
+
* @throws {@link SerialError} with {@link SerialErrorCode.INVALID_TERMINAL_BUFFER_OPTIONS}
|
|
95
|
+
* when `maxLines` or `maxChars` are out of range.
|
|
96
|
+
*/
|
|
97
|
+
export declare function resolveTerminalBufferOptions(options?: TerminalBufferOptions): ResolvedTerminalBufferOptions;
|
|
75
98
|
/**
|
|
76
99
|
* Builds a terminal-oriented text stream from {@link SerialSession.receive$} (or any
|
|
77
100
|
* `Observable<string>` of decoded chunks). Uses internal buffering so callers need not
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-terminal-buffer.d.ts","sourceRoot":"","sources":["../../src/terminal/create-terminal-buffer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAA0B,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"create-terminal-buffer.d.ts","sourceRoot":"","sources":["../../src/terminal/create-terminal-buffer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAA0B,MAAM,MAAM,CAAC;AAG/D,OAAO,EAGL,KAAK,QAAQ,EACb,KAAK,QAAQ,EACd,MAAM,6BAA6B,CAAC;AAIrC,6EAA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E,OAAO,CAAC;CACpB,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,CAAC,EAAE,qBAAqB,GAC9B,6BAA6B,CAuC/B;AAOD;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,UAAU,CAAC,MAAM,CAAC,EAC5B,OAAO,CAAC,EAAE,qBAAqB,GAC9B,cAAc,CAoBhB"}
|
package/dist/types.d.ts
CHANGED
|
@@ -12,7 +12,12 @@ export type SerialPayload = string | Uint8Array;
|
|
|
12
12
|
* {@link SerialSessionOptions.filters}, which apply only to
|
|
13
13
|
* `navigator.serial.requestPort`.
|
|
14
14
|
*
|
|
15
|
+
* At session factory time, `baudRate` and `bufferSize` must be safe integers
|
|
16
|
+
* `> 0` (or omitted to use defaults). `0`, negatives, non-integers, `NaN`, and
|
|
17
|
+
* `Infinity` are rejected.
|
|
18
|
+
*
|
|
15
19
|
* @see {@link SerialOptions}
|
|
20
|
+
* @see {@link https://github.com/gurezo/web-serial-rxjs/issues/488 | Issue #488}
|
|
16
21
|
*/
|
|
17
22
|
export type SerialConnectionOptions = Pick<SerialOptions, 'baudRate' | 'dataBits' | 'stopBits' | 'parity' | 'bufferSize' | 'flowControl'>;
|
|
18
23
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,UAAU,CAAC;AAEhD
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,UAAU,CAAC;AAEhD;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,uBAAuB,GAAG,IAAI,CACxC,aAAa,EACb,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,QAAQ,GAAG,YAAY,GAAG,aAAa,CAC/E,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gurezo/web-serial-rxjs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "RxJS-based utilities for the Web Serial API, usable from Angular, React, Svelte, and Vanilla JavaScript/TypeScript.",
|
|
5
5
|
"author": "Akihiko Kigure <akihiko.kigure@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"web-serial-rxjs-icon.png"
|
|
22
22
|
],
|
|
23
23
|
"scripts": {
|
|
24
|
-
"build": "pnpm run build:types && pnpm run build:bundle && pnpm run build:copy-files && pnpm run build:cleanup",
|
|
24
|
+
"build": "pnpm run clean && pnpm run build:types && pnpm run build:bundle && pnpm run build:copy-files && pnpm run build:cleanup",
|
|
25
25
|
"build:types": "../../node_modules/.bin/tsc --project tsconfig.lib.json",
|
|
26
26
|
"build:bundle": "node esbuild.config.mjs",
|
|
27
27
|
"build:copy-files": "cp ../../LICENSE . 2>/dev/null || true",
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { Observable } from 'rxjs';
|
|
2
|
-
import type { MaxChars, ReceiveReplayBufferSize } from '../../internal/branded-numbers';
|
|
3
|
-
/**
|
|
4
|
-
* Options for {@link createReceiveReplayBuffer}.
|
|
5
|
-
*
|
|
6
|
-
* @see {@link https://github.com/gurezo/web-serial-rxjs/issues/372 | Issue #372}
|
|
7
|
-
*/
|
|
8
|
-
export interface ReceiveReplayBufferOptions {
|
|
9
|
-
/** Maximum number of chunks to retain. */
|
|
10
|
-
bufferSize: ReceiveReplayBufferSize;
|
|
11
|
-
/**
|
|
12
|
-
* Maximum total characters across retained chunks. `0` disables the limit.
|
|
13
|
-
*/
|
|
14
|
-
maxChars: MaxChars;
|
|
15
|
-
}
|
|
16
|
-
/** Result of {@link ReceiveReplayBuffer.next}. */
|
|
17
|
-
export interface ReceiveReplayBufferNextResult {
|
|
18
|
-
/** `true` when oldest chunks were discarded to satisfy limits. */
|
|
19
|
-
overflowed: boolean;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Bounded replay buffer for {@link SerialSession.receiveReplay$}.
|
|
23
|
-
* Replays retained chunks to new subscribers, then forwards live emissions.
|
|
24
|
-
*
|
|
25
|
-
* @internal
|
|
26
|
-
*/
|
|
27
|
-
export interface ReceiveReplayBuffer {
|
|
28
|
-
next(chunk: string): ReceiveReplayBufferNextResult;
|
|
29
|
-
asObservable(): Observable<string>;
|
|
30
|
-
complete(): void;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Create a per-connection receive replay buffer.
|
|
34
|
-
*
|
|
35
|
-
* @internal
|
|
36
|
-
*/
|
|
37
|
-
export declare function createReceiveReplayBuffer(options: ReceiveReplayBufferOptions): ReceiveReplayBuffer;
|
|
38
|
-
//# sourceMappingURL=receive-replay-buffer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"receive-replay-buffer.d.ts","sourceRoot":"","sources":["../../../src/session/internal/receive-replay-buffer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAW,MAAM,MAAM,CAAC;AAC3C,OAAO,KAAK,EACV,QAAQ,EACR,uBAAuB,EACxB,MAAM,gCAAgC,CAAC;AAExC;;;;GAIG;AACH,MAAM,WAAW,0BAA0B;IACzC,0CAA0C;IAC1C,UAAU,EAAE,uBAAuB,CAAC;IACpC;;OAEG;IACH,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,kDAAkD;AAClD,MAAM,WAAW,6BAA6B;IAC5C,kEAAkE;IAClE,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,6BAA6B,CAAC;IACnD,YAAY,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;IACnC,QAAQ,IAAI,IAAI,CAAC;CAClB;AAMD;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,0BAA0B,GAClC,mBAAmB,CAyDrB"}
|