@react-x11/components 0.4.0 → 0.6.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.
Files changed (248) hide show
  1. package/README.md +143 -8
  2. package/dist/charts/components.d.ts +3 -1
  3. package/dist/charts/components.d.ts.map +1 -1
  4. package/dist/charts/components.js +8 -4
  5. package/dist/charts/components.js.map +1 -1
  6. package/dist/charts/node.d.ts +13 -6
  7. package/dist/charts/node.d.ts.map +1 -1
  8. package/dist/charts/node.js +75 -24
  9. package/dist/charts/node.js.map +1 -1
  10. package/dist/charts/render.d.ts +4 -0
  11. package/dist/charts/render.d.ts.map +1 -1
  12. package/dist/charts/render.js +11 -6
  13. package/dist/charts/render.js.map +1 -1
  14. package/dist/code-editor/node.d.ts +47 -16
  15. package/dist/code-editor/node.d.ts.map +1 -1
  16. package/dist/code-editor/node.js +121 -51
  17. package/dist/code-editor/node.js.map +1 -1
  18. package/dist/flow/draw.d.ts +19 -1
  19. package/dist/flow/draw.d.ts.map +1 -1
  20. package/dist/flow/draw.js +64 -35
  21. package/dist/flow/draw.js.map +1 -1
  22. package/dist/flow/index.d.ts.map +1 -1
  23. package/dist/flow/index.js +24 -8
  24. package/dist/flow/index.js.map +1 -1
  25. package/dist/flow/model.d.ts +4 -2
  26. package/dist/flow/model.d.ts.map +1 -1
  27. package/dist/flow/model.js +4 -2
  28. package/dist/flow/model.js.map +1 -1
  29. package/dist/flow/node.d.ts +40 -9
  30. package/dist/flow/node.d.ts.map +1 -1
  31. package/dist/flow/node.js +142 -53
  32. package/dist/flow/node.js.map +1 -1
  33. package/dist/flow/types.d.ts +46 -21
  34. package/dist/flow/types.d.ts.map +1 -1
  35. package/dist/formula/index.d.ts +4 -2
  36. package/dist/formula/index.d.ts.map +1 -1
  37. package/dist/formula/index.js.map +1 -1
  38. package/dist/formula/node.d.ts +5 -1
  39. package/dist/formula/node.d.ts.map +1 -1
  40. package/dist/formula/node.js +19 -3
  41. package/dist/formula/node.js.map +1 -1
  42. package/dist/html/controls.d.ts +4 -1
  43. package/dist/html/controls.d.ts.map +1 -1
  44. package/dist/html/controls.js.map +1 -1
  45. package/dist/html/css/cascade.d.ts +11 -5
  46. package/dist/html/css/cascade.d.ts.map +1 -1
  47. package/dist/html/css/cascade.js +18 -8
  48. package/dist/html/css/cascade.js.map +1 -1
  49. package/dist/html/css/parse.d.ts +15 -10
  50. package/dist/html/css/parse.d.ts.map +1 -1
  51. package/dist/html/css/parse.js +41 -16
  52. package/dist/html/css/parse.js.map +1 -1
  53. package/dist/html/css/style.d.ts +3 -0
  54. package/dist/html/css/style.d.ts.map +1 -1
  55. package/dist/html/css/style.js +3 -1
  56. package/dist/html/css/style.js.map +1 -1
  57. package/dist/html/css/values.d.ts +14 -1
  58. package/dist/html/css/values.d.ts.map +1 -1
  59. package/dist/html/css/values.js +11 -8
  60. package/dist/html/css/values.js.map +1 -1
  61. package/dist/html/index.d.ts.map +1 -1
  62. package/dist/html/index.js +1 -0
  63. package/dist/html/index.js.map +1 -1
  64. package/dist/html/layout/boxes.d.ts +12 -5
  65. package/dist/html/layout/boxes.d.ts.map +1 -1
  66. package/dist/html/layout/boxes.js +7 -4
  67. package/dist/html/layout/boxes.js.map +1 -1
  68. package/dist/html/layout/inline.d.ts.map +1 -1
  69. package/dist/html/layout/inline.js +22 -1
  70. package/dist/html/layout/inline.js.map +1 -1
  71. package/dist/html/node.d.ts +22 -8
  72. package/dist/html/node.d.ts.map +1 -1
  73. package/dist/html/node.js +97 -15
  74. package/dist/html/node.js.map +1 -1
  75. package/dist/html/paint.d.ts +3 -0
  76. package/dist/html/paint.d.ts.map +1 -1
  77. package/dist/html/paint.js +2 -2
  78. package/dist/html/paint.js.map +1 -1
  79. package/dist/index.d.ts +8 -2
  80. package/dist/index.d.ts.map +1 -1
  81. package/dist/index.js +21 -0
  82. package/dist/index.js.map +1 -1
  83. package/dist/maps/clip.d.ts +43 -0
  84. package/dist/maps/clip.d.ts.map +1 -0
  85. package/dist/maps/clip.js +171 -0
  86. package/dist/maps/clip.js.map +1 -0
  87. package/dist/maps/gzip.d.ts +15 -0
  88. package/dist/maps/gzip.d.ts.map +1 -0
  89. package/dist/maps/gzip.js +56 -0
  90. package/dist/maps/gzip.js.map +1 -0
  91. package/dist/maps/index.d.ts +55 -0
  92. package/dist/maps/index.d.ts.map +1 -0
  93. package/dist/maps/index.js +141 -0
  94. package/dist/maps/index.js.map +1 -0
  95. package/dist/maps/labels.d.ts +123 -0
  96. package/dist/maps/labels.d.ts.map +1 -0
  97. package/dist/maps/labels.js +323 -0
  98. package/dist/maps/labels.js.map +1 -0
  99. package/dist/maps/mvt.d.ts +244 -0
  100. package/dist/maps/mvt.d.ts.map +1 -0
  101. package/dist/maps/mvt.js +820 -0
  102. package/dist/maps/mvt.js.map +1 -0
  103. package/dist/maps/node.d.ts +278 -0
  104. package/dist/maps/node.d.ts.map +1 -0
  105. package/dist/maps/node.js +1459 -0
  106. package/dist/maps/node.js.map +1 -0
  107. package/dist/maps/overlay.d.ts +157 -0
  108. package/dist/maps/overlay.d.ts.map +1 -0
  109. package/dist/maps/overlay.js +472 -0
  110. package/dist/maps/overlay.js.map +1 -0
  111. package/dist/maps/paint.d.ts +226 -0
  112. package/dist/maps/paint.d.ts.map +1 -0
  113. package/dist/maps/paint.js +705 -0
  114. package/dist/maps/paint.js.map +1 -0
  115. package/dist/maps/proj.d.ts +281 -0
  116. package/dist/maps/proj.d.ts.map +1 -0
  117. package/dist/maps/proj.js +451 -0
  118. package/dist/maps/proj.js.map +1 -0
  119. package/dist/maps/sources.d.ts +256 -0
  120. package/dist/maps/sources.d.ts.map +1 -0
  121. package/dist/maps/sources.js +210 -0
  122. package/dist/maps/sources.js.map +1 -0
  123. package/dist/maps/style.d.ts +141 -0
  124. package/dist/maps/style.d.ts.map +1 -0
  125. package/dist/maps/style.js +147 -0
  126. package/dist/maps/style.js.map +1 -0
  127. package/dist/maps/styles.d.ts +82 -0
  128. package/dist/maps/styles.d.ts.map +1 -0
  129. package/dist/maps/styles.js +898 -0
  130. package/dist/maps/styles.js.map +1 -0
  131. package/dist/maps/tiles.d.ts +283 -0
  132. package/dist/maps/tiles.d.ts.map +1 -0
  133. package/dist/maps/tiles.js +469 -0
  134. package/dist/maps/tiles.js.map +1 -0
  135. package/dist/maps/types.d.ts +244 -0
  136. package/dist/maps/types.d.ts.map +1 -0
  137. package/dist/maps/types.js +2 -0
  138. package/dist/maps/types.js.map +1 -0
  139. package/dist/markdown/ast.d.ts +80 -6
  140. package/dist/markdown/ast.d.ts.map +1 -1
  141. package/dist/markdown/ast.js +13 -4
  142. package/dist/markdown/ast.js.map +1 -1
  143. package/dist/markdown/expressions.d.ts +27 -0
  144. package/dist/markdown/expressions.d.ts.map +1 -0
  145. package/dist/markdown/expressions.js +203 -0
  146. package/dist/markdown/expressions.js.map +1 -0
  147. package/dist/markdown/index.d.ts +61 -2
  148. package/dist/markdown/index.d.ts.map +1 -1
  149. package/dist/markdown/index.js +101 -2
  150. package/dist/markdown/index.js.map +1 -1
  151. package/dist/markdown/parse.d.ts +1 -1
  152. package/dist/markdown/parse.d.ts.map +1 -1
  153. package/dist/markdown/parse.js +163 -15
  154. package/dist/markdown/parse.js.map +1 -1
  155. package/dist/markdown/spans.d.ts.map +1 -1
  156. package/dist/markdown/spans.js +4 -0
  157. package/dist/markdown/spans.js.map +1 -1
  158. package/dist/markdown/tags.d.ts +35 -0
  159. package/dist/markdown/tags.d.ts.map +1 -0
  160. package/dist/markdown/tags.js +213 -0
  161. package/dist/markdown/tags.js.map +1 -0
  162. package/dist/reorder/hx.d.ts +18 -0
  163. package/dist/reorder/hx.d.ts.map +1 -0
  164. package/dist/reorder/hx.js +10 -0
  165. package/dist/reorder/hx.js.map +1 -0
  166. package/dist/reorder/index.d.ts +314 -0
  167. package/dist/reorder/index.d.ts.map +1 -0
  168. package/dist/reorder/index.js +1539 -0
  169. package/dist/reorder/index.js.map +1 -0
  170. package/dist/reorder/model.d.ts +107 -0
  171. package/dist/reorder/model.d.ts.map +1 -0
  172. package/dist/reorder/model.js +162 -0
  173. package/dist/reorder/model.js.map +1 -0
  174. package/dist/richtext/node.d.ts +15 -5
  175. package/dist/richtext/node.d.ts.map +1 -1
  176. package/dist/richtext/node.js +40 -11
  177. package/dist/richtext/node.js.map +1 -1
  178. package/dist/richtext/runs.d.ts +35 -13
  179. package/dist/richtext/runs.d.ts.map +1 -1
  180. package/dist/richtext/runs.js +83 -27
  181. package/dist/richtext/runs.js.map +1 -1
  182. package/dist/tabs/index.d.ts +17 -0
  183. package/dist/tabs/index.d.ts.map +1 -1
  184. package/dist/tabs/index.js +849 -186
  185. package/dist/tabs/index.js.map +1 -1
  186. package/dist/terminal/vt/fonts.d.ts +45 -15
  187. package/dist/terminal/vt/fonts.d.ts.map +1 -1
  188. package/dist/terminal/vt/fonts.js +89 -19
  189. package/dist/terminal/vt/fonts.js.map +1 -1
  190. package/dist/terminal/vt/node.d.ts +42 -0
  191. package/dist/terminal/vt/node.d.ts.map +1 -1
  192. package/dist/terminal/vt/node.js +95 -11
  193. package/dist/terminal/vt/node.js.map +1 -1
  194. package/dist/terminal/vt/renderer.d.ts.map +1 -1
  195. package/dist/terminal/vt/renderer.js +13 -3
  196. package/dist/terminal/vt/renderer.js.map +1 -1
  197. package/package.json +14 -3
  198. package/src/charts/components.ts +14 -7
  199. package/src/charts/node.ts +81 -26
  200. package/src/charts/render.ts +16 -6
  201. package/src/code-editor/node.ts +147 -53
  202. package/src/flow/draw.ts +104 -35
  203. package/src/flow/index.ts +33 -13
  204. package/src/flow/model.ts +4 -2
  205. package/src/flow/node.ts +158 -59
  206. package/src/flow/types.ts +46 -21
  207. package/src/formula/index.ts +4 -2
  208. package/src/formula/node.ts +24 -5
  209. package/src/html/controls.ts +4 -1
  210. package/src/html/css/cascade.ts +18 -7
  211. package/src/html/css/parse.ts +46 -21
  212. package/src/html/css/style.ts +6 -1
  213. package/src/html/css/values.ts +25 -9
  214. package/src/html/index.ts +1 -0
  215. package/src/html/layout/boxes.ts +19 -9
  216. package/src/html/layout/inline.ts +23 -1
  217. package/src/html/node.ts +110 -17
  218. package/src/html/paint.ts +17 -2
  219. package/src/index.ts +102 -0
  220. package/src/maps/clip.ts +184 -0
  221. package/src/maps/gzip.ts +66 -0
  222. package/src/maps/index.ts +316 -0
  223. package/src/maps/labels.ts +442 -0
  224. package/src/maps/mvt.ts +857 -0
  225. package/src/maps/node.ts +1819 -0
  226. package/src/maps/overlay.ts +639 -0
  227. package/src/maps/paint.ts +978 -0
  228. package/src/maps/proj.ts +641 -0
  229. package/src/maps/sources.ts +425 -0
  230. package/src/maps/style.ts +309 -0
  231. package/src/maps/styles.ts +1040 -0
  232. package/src/maps/tiles.ts +676 -0
  233. package/src/maps/types.ts +260 -0
  234. package/src/markdown/ast.ts +85 -9
  235. package/src/markdown/expressions.ts +223 -0
  236. package/src/markdown/index.ts +190 -5
  237. package/src/markdown/parse.ts +230 -15
  238. package/src/markdown/spans.ts +4 -0
  239. package/src/markdown/tags.ts +240 -0
  240. package/src/reorder/hx.ts +31 -0
  241. package/src/reorder/index.ts +2223 -0
  242. package/src/reorder/model.ts +232 -0
  243. package/src/richtext/node.ts +49 -14
  244. package/src/richtext/runs.ts +115 -30
  245. package/src/tabs/index.ts +1040 -204
  246. package/src/terminal/vt/fonts.ts +128 -36
  247. package/src/terminal/vt/node.ts +105 -12
  248. package/src/terminal/vt/renderer.ts +13 -3
@@ -0,0 +1,244 @@
1
+ import type { Style } from 'react-x11/style';
2
+ import type { ReactNode, Ref } from 'react';
3
+ import type { LngLat, LngLatBounds, MapCamera, TileId } from './proj.js';
4
+ import type { MapSource } from './sources.js';
5
+ import type { MapStyle } from './style.js';
6
+ import type { MapMarker, MapOverlay } from './overlay.js';
7
+ export type { LngLat, LngLatBounds, MapCamera };
8
+ export type { MapSource, TileData, TileRequest } from './sources.js';
9
+ export type { MapMarker, MapOverlay, OverlayPalette } from './overlay.js';
10
+ export type { MapStyle, MapStyleLayer, MapFilter, FillLayer, LineLayer, CircleLayer, SymbolLayer, Zoomed, } from './style.js';
11
+ /** Where a pointer event happened, in every space that could be wanted. */
12
+ export interface MapPointerEvent {
13
+ /** Geographic. */
14
+ lngLat: LngLat;
15
+ /** Pane-local logical pixels. */
16
+ x: number;
17
+ y: number;
18
+ /** The marker under the pointer, when there was one. */
19
+ marker: MapMarker | null;
20
+ /** Modifier state, as the synthetic event reported it. */
21
+ shiftKey: boolean;
22
+ ctrlKey: boolean;
23
+ altKey: boolean;
24
+ metaKey: boolean;
25
+ /** `1` left, `2` middle, `3` right. */
26
+ button: number;
27
+ }
28
+ /** What one frame cost — for a performance HUD, and what
29
+ * `scripts/bench/maps.ts` reads. */
30
+ export interface MapFrameStats {
31
+ /** Milliseconds spent rasterizing tiles into their surfaces this frame.
32
+ * Bounded by `rasterBudgetMs` except for the one run that crossed it. */
33
+ rasterMs: number;
34
+ /** …and compositing them, drawing the labels, overlays and markers. */
35
+ drawMs: number;
36
+ /** Tiles the cover asked for. */
37
+ tiles: number;
38
+ /** …of which were composited from their own finished surface. Under
39
+ * `progressive` this also counts the half-drawn ones. */
40
+ ready: number;
41
+ /** …and how many were drawn from a coarser ancestor instead, scaled up.
42
+ * What covers a hole while zooming *in*. */
43
+ fromAncestor: number;
44
+ /** …and how many from their finer descendants, scaled down. What covers
45
+ * a hole while zooming *out*, where there is no ancestor to borrow. */
46
+ fromDescendant: number;
47
+ /** Tiles still to rasterize — non-zero means the map is still sharpening
48
+ * and another frame is already scheduled. */
49
+ pending: number;
50
+ /** Labels placed, and labels drawn. */
51
+ labels: number;
52
+ /**
53
+ * Tiles in the cover whose load failed and are waiting on a retry.
54
+ *
55
+ * Here because a map whose tiles all fail looks exactly like a map that
56
+ * is still loading — an empty background and nothing else — and the
57
+ * difference is not something a user can see.
58
+ */
59
+ errors: number;
60
+ /** Bytes of rendered surfaces the cache is holding. */
61
+ surfaceBytes: number;
62
+ /**
63
+ * What this pass repainted, in device pixels, or `null` for a full one.
64
+ *
65
+ * The number to watch when a map looks busy: a frame that is only
66
+ * continuing a rasterization should claim almost nothing, because the
67
+ * tile being drawn is a second surface nobody is looking at. A run of
68
+ * full-pane damage while tiles are still landing means something is
69
+ * asking for repaints it does not need — which on a backend that paints
70
+ * many frames a second reads as flashing.
71
+ */
72
+ damage: {
73
+ x: number;
74
+ y: number;
75
+ width: number;
76
+ height: number;
77
+ } | null;
78
+ /** What the rasterizer did, summed over the tiles drawn this frame. */
79
+ draw: {
80
+ features: number;
81
+ vertices: number;
82
+ decimated: number;
83
+ culled: number;
84
+ batches: number;
85
+ };
86
+ }
87
+ /** Options for framing a box. */
88
+ export interface FitBoundsOptions {
89
+ /** Logical pixels kept clear on every side. 24 by default. */
90
+ padding?: number;
91
+ maxZoom?: number;
92
+ }
93
+ /** The imperative surface, through `ref`. */
94
+ export interface MapHandle {
95
+ getCamera(): MapCamera;
96
+ setCamera(camera: Partial<MapCamera>): void;
97
+ panBy(dx: number, dy: number): void;
98
+ zoomIn(step?: number): void;
99
+ zoomOut(step?: number): void;
100
+ zoomTo(zoom: number): void;
101
+ /** Frame a box. */
102
+ fitBounds(bounds: LngLatBounds, options?: FitBoundsOptions): void;
103
+ /** Frame every marker, or the ones named. */
104
+ fitMarkers(ids?: readonly string[], options?: FitBoundsOptions): void;
105
+ /** What the pane can see. `west > east` across the antimeridian. */
106
+ getBounds(): LngLatBounds;
107
+ /** Geography to pane-local logical pixels, and back. */
108
+ project(position: LngLat): {
109
+ x: number;
110
+ y: number;
111
+ };
112
+ unproject(x: number, y: number): LngLat;
113
+ /** The marker at a pane-local point, or null. */
114
+ markerAt(x: number, y: number): MapMarker | null;
115
+ /** Throw away every rendered tile — after a style edit an application
116
+ * made in place, which the map cannot see. */
117
+ refresh(): void;
118
+ /** What the last frame cost. */
119
+ stats(): MapFrameStats | null;
120
+ }
121
+ /** What the `<mapview>` element takes. `<Map>` adds the uncontrolled
122
+ * camera and the box around it. */
123
+ export interface MapViewProps {
124
+ /**
125
+ * Where tiles come from, drawn in order — a basemap, then an overlay
126
+ * pyramid over it. Empty draws the style's background and nothing else,
127
+ * which is what a map with only markers on it wants.
128
+ */
129
+ sources?: readonly MapSource[];
130
+ /** How to draw them. Defaults to {@link shortbreadStyle} in the theme's
131
+ * light or dark palette. */
132
+ mapStyle?: MapStyle;
133
+ /**
134
+ * The camera, controlled. Leave it out and the **element** owns it —
135
+ * which is not just a convenience: an element-owned camera means a pan is
136
+ * a blit and a claim, with no React render in the loop at all.
137
+ */
138
+ camera?: MapCamera;
139
+ /** Where an element-owned camera starts. Read once, at construction. */
140
+ defaultCamera?: MapCamera;
141
+ onCameraChange?: (camera: MapCamera) => void;
142
+ /** Fired when a gesture ends and the camera has settled — the moment to
143
+ * fetch what is now on screen. */
144
+ onMoveEnd?: (camera: MapCamera) => void;
145
+ minZoom?: number;
146
+ maxZoom?: number;
147
+ markers?: readonly MapMarker[];
148
+ overlays?: readonly MapOverlay[];
149
+ onMapClick?: (event: MapPointerEvent) => void;
150
+ onMarkerClick?: (marker: MapMarker, event: MapPointerEvent) => void;
151
+ /**
152
+ * The marker under the pointer, or null when it left every marker.
153
+ *
154
+ * `event` is null for the leave that comes from the pointer leaving the
155
+ * map altogether: there is no position on the map to report, and
156
+ * inventing one would be worse than saying so.
157
+ */
158
+ onMarkerHover?: (marker: MapMarker | null, event: MapPointerEvent | null) => void;
159
+ /** `false` freezes the camera: no drag, no wheel, no keys. The map still
160
+ * draws and still reports clicks. */
161
+ interactive?: boolean;
162
+ /**
163
+ * Show a tile as it is drawn rather than when it is finished.
164
+ *
165
+ * `false` by default, which is what every other map client does: a tile
166
+ * appears whole, and until it does the coarser one already in the cache
167
+ * is scaled up in its place. `true` composites a tile's surface as soon
168
+ * as it exists — so a dense tile arrives as water, then landuse, then
169
+ * road casings, then roads, across a dozen frames — which is honest about
170
+ * what the renderer is doing and does not look like a map.
171
+ *
172
+ * The one thing the default costs is a transition that invalidates every
173
+ * surface at once: a `mapStyle` change, `refresh()`, or a display-scale
174
+ * change leaves no finished tile *and* no finished ancestor, so the map
175
+ * drops to its background colour until the new tiles land. `true` shows
176
+ * it repainting instead.
177
+ */
178
+ progressive?: boolean;
179
+ /**
180
+ * Milliseconds a frame may spend rasterizing tiles. 8 by default, which
181
+ * leaves the rest of a 60 Hz frame for everything else; a tile that takes
182
+ * longer than the budget is finished over the frames after it. `0`
183
+ * suspends rasterization, which is what a gesture does on its own.
184
+ */
185
+ rasterBudgetMs?: number;
186
+ /**
187
+ * Device pixels per logical pixel for the tile surfaces, if not the
188
+ * display's.
189
+ *
190
+ * Lowering it to 1 on a retina panel makes rasterization about 1.6×
191
+ * quicker and the basemap correspondingly softer; labels, markers and
192
+ * overlays are unaffected, since none of them goes through a tile
193
+ * surface. Worth having on a slow machine, and worth knowing about before
194
+ * reaching for it.
195
+ */
196
+ rasterScale?: number;
197
+ /** Bytes of rendered tile surfaces to keep. 128 MB by default. */
198
+ surfaceBudget?: number;
199
+ /**
200
+ * Vertices after which the rasterizer flushes its path. 12,000 by
201
+ * default.
202
+ *
203
+ * A real trade on X11, where a fill becomes one coverage-mask upload and
204
+ * a bigger path is fewer of them over the same pixels. It used to be a
205
+ * per-backend trade — `CGContextStrokePath` was quadratic in the number
206
+ * of subpaths, so the Cocoa backend wanted the opposite value and this
207
+ * element probed for it — and react-x11 2.6.1 chunks that stroke inside
208
+ * the backend instead (react-x11#457). Set it only with a profile in
209
+ * hand.
210
+ */
211
+ batchVertices?: number;
212
+ /** What the licence requires, drawn in the corner. Taken from the
213
+ * sources when they carry one; `''` removes it, which is the
214
+ * application saying it has put the attribution somewhere else. */
215
+ attribution?: string;
216
+ /** Called once per painted frame with what it cost. */
217
+ onFrame?: (stats: MapFrameStats) => void;
218
+ /**
219
+ * Called once per failed tile load, with whatever the source threw.
220
+ *
221
+ * Nothing is drawn for a failed tile, so without this a source that is
222
+ * misconfigured, rate-limited or down is indistinguishable from one that
223
+ * is slow. The tile is retried on a backoff (0.5 s doubling to 30 s), so
224
+ * this fires again for each retry rather than once and forever.
225
+ */
226
+ onTileError?: (error: unknown, tile: TileId & {
227
+ sourceId: string;
228
+ }) => void;
229
+ style?: Style;
230
+ role?: string;
231
+ 'aria-label'?: string;
232
+ 'data-testname'?: string;
233
+ ref?: Ref<unknown>;
234
+ }
235
+ /** What `<Map>` takes. */
236
+ export interface MapProps extends Omit<MapViewProps, 'ref'> {
237
+ ref?: Ref<MapHandle>;
238
+ /** Anything absolutely positioned over the map — a legend, a control
239
+ * panel. Laid out as siblings of the drawn pane rather than inside it,
240
+ * because a registered element paints its children *before* its own
241
+ * drawing and anything inside would be painted over. */
242
+ children?: ReactNode;
243
+ }
244
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/maps/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1D,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC;AAChD,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACrE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC1E,YAAY,EACV,QAAQ,EACR,aAAa,EACb,SAAS,EACT,SAAS,EACT,SAAS,EACT,WAAW,EACX,WAAW,EACX,MAAM,GACP,MAAM,YAAY,CAAC;AAEpB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pE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uDAAuD;IACvD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IACzC;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC5E,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,GAAG,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;CACpB;AAED,0BAA0B;AAC1B,MAAM,WAAW,QAAS,SAAQ,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC;IACzD,GAAG,CAAC,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC;IACrB;;;6DAGyD;IACzD,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/maps/types.ts"],"names":[],"mappings":""}
@@ -1,5 +1,15 @@
1
1
  /** Inline content, inside a paragraph, heading, list item or table cell. */
2
- export type InlineNode = TextInline | CodeInline | EmphasisInline | LinkInline | BreakInline | ComponentInline;
2
+ export type InlineNode = TextInline | CodeInline | EmphasisInline | LinkInline | BreakInline | ComponentInline | ExpressionInline;
3
+ /**
4
+ * `{count}` in the middle of a sentence: unevaluated source, which the
5
+ * renderer compiles against its `scope` and turns into text. Only emitted
6
+ * when `ParseOptions.expressions` says so, so `{braces}` in an ordinary
7
+ * document remain the characters they have always been.
8
+ */
9
+ export interface ExpressionInline {
10
+ type: 'expression';
11
+ src: string;
12
+ }
3
13
  /** A run of plain text. Softbreaks arrive collapsed to spaces. */
4
14
  export interface TextInline {
5
15
  type: 'text';
@@ -32,18 +42,61 @@ export interface BreakInline {
32
42
  type: 'break';
33
43
  }
34
44
  /**
35
- * Reserved for MDX: `<Chart data={…} />` would parse to one of these. The
36
- * current parser never emits it; the renderer maps unknown names to plain
37
- * text so a future parser upgrade cannot crash an older renderer.
45
+ * An attribute's value. `literal` is what an attribute string or a `{json}`
46
+ * attribute resolves to at parse time; `expression` holds unevaluated source
47
+ * for the rung that compiles it, so that parsing stays pure and one AST can
48
+ * be rendered against two scopes (docs/prd-mdx.md, M2). The parser emits
49
+ * only `literal` today.
50
+ */
51
+ export type AttributeValue = {
52
+ kind: 'literal';
53
+ value: unknown;
54
+ } | {
55
+ kind: 'expression';
56
+ src: string;
57
+ };
58
+ /**
59
+ * A spread (`{...props}`) is an attribute with no name, so it is keyed
60
+ * `...0`, `...1`, … in the order it appeared. An attribute name cannot start
61
+ * with `.`, so these cannot collide with one; a renderer walking
62
+ * `Object.entries` in insertion order applies each spread where it was
63
+ * written, which is what decides whether it overrides `height` or `height`
64
+ * overrides it.
65
+ */
66
+ export declare const SPREAD_PREFIX = "...";
67
+ /**
68
+ * **Still reserved.** `<Badge/>` in the middle of a sentence parses to one of
69
+ * these — except that nothing emits them yet, because nothing can render
70
+ * them: a paragraph is laid out as a single `<richtext>`, and a `TextRun`
71
+ * has no way to say "reserve this much advance width for an element someone
72
+ * else paints". Giving it one is the inline half of MDX and is its own piece
73
+ * of work (baseline alignment, wrapping around the element, and what a
74
+ * selection dragged across it should copy).
75
+ *
76
+ * Kept in the union so the shape stays stable, and so a renderer written
77
+ * against it today cannot be broken by the parser learning to emit them.
38
78
  */
39
79
  export interface ComponentInline {
40
80
  type: 'component';
41
81
  name: string;
42
- attributes: Record<string, string>;
82
+ attributes: Record<string, AttributeValue>;
43
83
  children: InlineNode[];
44
84
  }
45
85
  /** Block-level content. */
46
- export type BlockNode = ParagraphBlock | HeadingBlock | CodeBlock | QuoteBlock | ListBlock | TableBlock | RuleBlock;
86
+ export type BlockNode = ParagraphBlock | HeadingBlock | CodeBlock | QuoteBlock | ListBlock | TableBlock | RuleBlock | ComponentBlock;
87
+ /**
88
+ * A component standing where a paragraph would: `<Chart data={…} />` on its
89
+ * own line, or `<Callout>` … `</Callout>` around blocks.
90
+ *
91
+ * Only emitted when `ParseOptions.isComponent` says the name is one — which
92
+ * is what keeps every document that renders today rendering the same way.
93
+ */
94
+ export interface ComponentBlock {
95
+ type: 'component';
96
+ name: string;
97
+ attributes: Record<string, AttributeValue>;
98
+ children: BlockNode[];
99
+ }
47
100
  export interface ParagraphBlock {
48
101
  type: 'paragraph';
49
102
  children: InlineNode[];
@@ -122,5 +175,26 @@ export interface ParseOptions {
122
175
  * underline or a rule) is held back. Pass false for text that is final.
123
176
  */
124
177
  partial?: boolean;
178
+ /**
179
+ * Whether `name` is a component this document may use. Absent — the
180
+ * default — means no tag is a component and `<Chart/>` stays the literal
181
+ * text it has always been, so turning MDX on is opt-in and turning it off
182
+ * is byte-for-byte the old behaviour.
183
+ *
184
+ * `<Markdown>` supplies one from its `components` prop. A dotted name
185
+ * (`Card.Header`) is passed through whole; resolving it is the caller's.
186
+ */
187
+ isComponent?: (name: string) => boolean;
188
+ /**
189
+ * Whether `{…}` may hold a JavaScript expression — in an attribute, as a
190
+ * `{...spread}`, or bare in the prose. Off by default, and off is the
191
+ * whole of rung 1: a `{…}` attribute must be JSON, and a brace in a
192
+ * paragraph is a brace.
193
+ *
194
+ * `<Markdown>` turns this on when it is given a `scope`, which is the prop
195
+ * that says the application accepts a document running code. Parsing still
196
+ * evaluates nothing — an expression is kept as source.
197
+ */
198
+ expressions?: boolean;
125
199
  }
126
200
  //# sourceMappingURL=ast.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../src/markdown/ast.ts"],"names":[],"mappings":"AAOA,4EAA4E;AAC5E,MAAM,MAAM,UAAU,GAClB,UAAU,GACV,UAAU,GACV,cAAc,GACd,UAAU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AG,IAAI,CAAC;IACxB,QAAQ,EAAE,SAAS,EAAE,CAAC;CACvB;AAED,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,IAAI,CAAC;AAE5D,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,OAAO,CAAC;IACd,oDAAoD;IACpD,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,wDAAwD;IACxD,MAAM,EAAE,UAAU,EAAE,EAAE,CAAC;IACvB,mEAAmE;IACnE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,4BAA4B;AAC5B,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB;;;;;OAKG;IACH,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IACxC;;;;;;;;;OASG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB"}
@@ -1,8 +1,17 @@
1
1
  // The markdown AST `parse.ts` produces and `index.ts` renders. Deliberately
2
2
  // small: it is the GFM constructs this component draws, not a general
3
3
  // mdast — but it is shaped so that growing it stays additive. In particular
4
- // `component` is reserved for the MDX direction: a parser extension can emit
5
- // one without the renderer, the selection model or the caches changing shape
6
- // (see "MDX" in index.ts).
7
- export {};
4
+ // `component` is the MDX direction: `ComponentBlock` is parsed and rendered
5
+ // (docs/prd-mdx.md, M1), and `ComponentInline` is still reserved see the
6
+ // note on it for why the inline half needs machinery `<richtext>` does not
7
+ // have yet.
8
+ /**
9
+ * A spread (`{...props}`) is an attribute with no name, so it is keyed
10
+ * `...0`, `...1`, … in the order it appeared. An attribute name cannot start
11
+ * with `.`, so these cannot collide with one; a renderer walking
12
+ * `Object.entries` in insertion order applies each spread where it was
13
+ * written, which is what decides whether it overrides `height` or `height`
14
+ * overrides it.
15
+ */
16
+ export const SPREAD_PREFIX = '...';
8
17
  //# sourceMappingURL=ast.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ast.js","sourceRoot":"","sources":["../../src/markdown/ast.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,sEAAsE;AACtE,4EAA4E;AAC5E,6EAA6E;AAC7E,6EAA6E;AAC7E,2BAA2B"}
1
+ {"version":3,"file":"ast.js","sourceRoot":"","sources":["../../src/markdown/ast.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,sEAAsE;AACtE,4EAA4E;AAC5E,4EAA4E;AAC5E,2EAA2E;AAC3E,2EAA2E;AAC3E,YAAY;AAqEZ;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,CAAC"}
@@ -0,0 +1,27 @@
1
+ import type { Document } from './ast.js';
2
+ /**
3
+ * What a renderer calls: source in, value out, `undefined` if it did not
4
+ * work. Never throws — a document being edited is full of expressions that
5
+ * do not work yet.
6
+ */
7
+ export type Evaluate = (src: string) => unknown;
8
+ /**
9
+ * An evaluator over `scope`. The keys are read once, so a scope mutated in
10
+ * place after this is called keeps its old shape — the same contract every
11
+ * other seam here has, and the reason the prop doc asks for a stable object.
12
+ */
13
+ export declare function evaluator(scope: Record<string, unknown>): Evaluate;
14
+ /**
15
+ * Only the tests need to reach in: a compile cache that survived between
16
+ * them would make one test's expression another's, and the warn-once flag
17
+ * would hide the second failure anyone asserted on.
18
+ */
19
+ export declare function clearExpressionCache(): void;
20
+ /**
21
+ * The document with its expressions evaluated. `raws` is carried over
22
+ * untouched: it is the block cache's key, and what changed is the values an
23
+ * expression produced, not the text that produced them — a change of `scope`
24
+ * invalidates that cache through its own identity instead.
25
+ */
26
+ export declare function resolveExpressions(doc: Document, evaluate: Evaluate): Document;
27
+ //# sourceMappingURL=expressions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expressions.d.ts","sourceRoot":"","sources":["../../src/markdown/expressions.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAa,QAAQ,EAAc,MAAM,UAAU,CAAC;AA8DhE;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;AAEhD;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,QAAQ,CAalE;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAG3C;AAgGD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,QAAQ,EACb,QAAQ,EAAE,QAAQ,GACjB,QAAQ,CAGV"}
@@ -0,0 +1,203 @@
1
+ // Compiling `{…}` — the rung where a document runs code (docs/prd-mdx.md,
2
+ // M2), and the one place in this component that calls `new Function`.
3
+ //
4
+ // It is a small file on purpose. Everything hard about MDX expressions was
5
+ // decided elsewhere: the parser holds an expression as *source* rather than
6
+ // a value, so a parse is pure and one AST can be rendered against two
7
+ // scopes; and `<Markdown>` only turns any of this on when the application
8
+ // passes a `scope`, which is the prop that means "I accept that this
9
+ // document may compute". What is left here is compiling the source once, and
10
+ // not letting a half-typed expression take down a document that is still
11
+ // being typed.
12
+ //
13
+ // **There is no sandbox.** `new Function` runs in this process with this
14
+ // process's authority. That is why the gate is a prop, and why the docs say
15
+ // in as few words as they can: do not pass `scope` alongside a document you
16
+ // did not write.
17
+ /**
18
+ * Keyed on the scope's shape *and* the source, because a compiled function
19
+ * closes over its parameter names. Bounded the way `richtext/node.ts` bounds
20
+ * its layout cache: a streaming document recompiles its tail on every chunk,
21
+ * and an unbounded map would hold every intermediate spelling of an
22
+ * expression that was being typed.
23
+ */
24
+ const CACHE = new Map();
25
+ const LIMIT = 256;
26
+ let warned = false;
27
+ /**
28
+ * Say so, once, when an expression does not work out. A document that
29
+ * silently loses a value should not be a mystery — and saying it on every
30
+ * frame of a streaming render would be worse than saying nothing.
31
+ *
32
+ * `process` and `console` come off `globalThis` because `src/` compiles with
33
+ * `types: []` — a Node global that wandered in would fail the build rather
34
+ * than become an implicit `@types/node` dependency.
35
+ */
36
+ function warnFailed(src, error) {
37
+ if (warned)
38
+ return;
39
+ warned = true;
40
+ const g = globalThis;
41
+ if (g.process?.env?.NODE_ENV === 'production')
42
+ return;
43
+ g.console?.warn('@react-x11/components: a markdown expression did not evaluate, so it ' +
44
+ `rendered as nothing: {${src}}`, error);
45
+ }
46
+ function compile(src, keys) {
47
+ const key = `${keys.join(',')} ${src}`;
48
+ const hit = CACHE.get(key);
49
+ if (hit !== undefined)
50
+ return hit;
51
+ let compiled = null;
52
+ try {
53
+ // `return (…)` rather than a bare body: an expression is what the braces
54
+ // promised, and the parentheses keep an object literal an object literal
55
+ // rather than a block.
56
+ compiled = new Function(...keys, `"use strict"; return (${src});`);
57
+ }
58
+ catch (error) {
59
+ // A syntax error is the ordinary state of an expression being typed.
60
+ warnFailed(src, error);
61
+ }
62
+ if (CACHE.size >= LIMIT)
63
+ CACHE.clear();
64
+ CACHE.set(key, compiled);
65
+ return compiled;
66
+ }
67
+ /**
68
+ * An evaluator over `scope`. The keys are read once, so a scope mutated in
69
+ * place after this is called keeps its old shape — the same contract every
70
+ * other seam here has, and the reason the prop doc asks for a stable object.
71
+ */
72
+ export function evaluator(scope) {
73
+ const keys = Object.keys(scope);
74
+ const values = keys.map((k) => scope[k]);
75
+ return (src) => {
76
+ const fn = compile(src, keys);
77
+ if (!fn)
78
+ return undefined;
79
+ try {
80
+ return fn(...values);
81
+ }
82
+ catch (error) {
83
+ warnFailed(src, error);
84
+ return undefined;
85
+ }
86
+ };
87
+ }
88
+ /**
89
+ * Only the tests need to reach in: a compile cache that survived between
90
+ * them would make one test's expression another's, and the warn-once flag
91
+ * would hide the second failure anyone asserted on.
92
+ */
93
+ export function clearExpressionCache() {
94
+ CACHE.clear();
95
+ warned = false;
96
+ }
97
+ // --- resolving a parsed document ------------------------------------------
98
+ /**
99
+ * A copy of `nodes` with every `expression` replaced by the text it
100
+ * evaluates to. Primitives stringify; anything else — an object, an array, a
101
+ * React element — renders as nothing, because a paragraph is text and there
102
+ * is nowhere in a text run to put an element (see "The inline half" in
103
+ * docs/prd-mdx.md). `null` and `undefined` are nothing on purpose, so
104
+ * `{maybe}` reads as absent rather than as the word "undefined".
105
+ */
106
+ function resolveInline(nodes, evaluate) {
107
+ let changed = false;
108
+ const out = [];
109
+ for (const node of nodes) {
110
+ if (node.type === 'expression') {
111
+ changed = true;
112
+ const value = evaluate(node.src);
113
+ const text = value == null ||
114
+ typeof value === 'object' ||
115
+ typeof value === 'function'
116
+ ? ''
117
+ : String(value);
118
+ if (text)
119
+ out.push({ type: 'text', text });
120
+ continue;
121
+ }
122
+ if ('children' in node) {
123
+ const children = resolveInline(node.children, evaluate);
124
+ if (children !== node.children) {
125
+ changed = true;
126
+ out.push({ ...node, children });
127
+ continue;
128
+ }
129
+ }
130
+ out.push(node);
131
+ }
132
+ return changed ? out : nodes;
133
+ }
134
+ function resolveBlocks(blocks, evaluate) {
135
+ let changed = false;
136
+ const out = blocks.map((block) => {
137
+ switch (block.type) {
138
+ case 'paragraph':
139
+ case 'heading': {
140
+ const children = resolveInline(block.children, evaluate);
141
+ if (children === block.children)
142
+ return block;
143
+ changed = true;
144
+ return { ...block, children };
145
+ }
146
+ case 'quote':
147
+ case 'component': {
148
+ const children = resolveBlocks(block.children, evaluate);
149
+ if (children === block.children)
150
+ return block;
151
+ changed = true;
152
+ return { ...block, children };
153
+ }
154
+ case 'list': {
155
+ let itemsChanged = false;
156
+ const items = block.items.map((item) => {
157
+ const children = resolveBlocks(item.children, evaluate);
158
+ if (children === item.children)
159
+ return item;
160
+ itemsChanged = true;
161
+ return { ...item, children };
162
+ });
163
+ if (!itemsChanged)
164
+ return block;
165
+ changed = true;
166
+ return { ...block, items };
167
+ }
168
+ case 'table': {
169
+ let rowsChanged = false;
170
+ const rows = block.rows.map((row) => row.map((cell) => {
171
+ const next = resolveInline(cell, evaluate);
172
+ if (next !== cell)
173
+ rowsChanged = true;
174
+ return next;
175
+ }));
176
+ const header = block.header.map((cell) => {
177
+ const next = resolveInline(cell, evaluate);
178
+ if (next !== cell)
179
+ rowsChanged = true;
180
+ return next;
181
+ });
182
+ if (!rowsChanged)
183
+ return block;
184
+ changed = true;
185
+ return { ...block, header, rows };
186
+ }
187
+ default:
188
+ return block;
189
+ }
190
+ });
191
+ return changed ? out : blocks;
192
+ }
193
+ /**
194
+ * The document with its expressions evaluated. `raws` is carried over
195
+ * untouched: it is the block cache's key, and what changed is the values an
196
+ * expression produced, not the text that produced them — a change of `scope`
197
+ * invalidates that cache through its own identity instead.
198
+ */
199
+ export function resolveExpressions(doc, evaluate) {
200
+ const blocks = resolveBlocks(doc.blocks, evaluate);
201
+ return blocks === doc.blocks ? doc : { blocks, raws: doc.raws };
202
+ }
203
+ //# sourceMappingURL=expressions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expressions.js","sourceRoot":"","sources":["../../src/markdown/expressions.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,sEAAsE;AACtE,EAAE;AACF,2EAA2E;AAC3E,4EAA4E;AAC5E,sEAAsE;AACtE,0EAA0E;AAC1E,qEAAqE;AACrE,6EAA6E;AAC7E,yEAAyE;AACzE,eAAe;AACf,EAAE;AACF,yEAAyE;AACzE,4EAA4E;AAC5E,4EAA4E;AAC5E,iBAAiB;AAOjB;;;;;;GAMG;AACH,MAAM,KAAK,GAAG,IAAI,GAAG,EAAoB,CAAC;AAC1C,MAAM,KAAK,GAAG,GAAG,CAAC;AAElB,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB;;;;;;;;GAQG;AACH,SAAS,UAAU,CAAC,GAAW,EAAE,KAAc;IAC7C,IAAI,MAAM;QAAE,OAAO;IACnB,MAAM,GAAG,IAAI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