quillmark_core/region.rs
1//! Schema-field geometry, queried from a compiled
2//! [`LiveSession`](crate::LiveSession) via
3//! [`regions`](crate::LiveSession::regions) and
4//! [`field_at`](crate::LiveSession::field_at).
5//!
6//! A region ties a rectangle on the rendered page to the **quill schema field**
7//! that produced it — the address the document author already uses to refer to
8//! that field (the same address the Typst plate reads as `data.*` and the
9//! pdfform binder resolves against `compile_data`). The two directions a
10//! consumer navigates get two queries: `regions` answers *field → rectangle*
11//! (scroll to / highlight the focused field), `field_at` answers *point →
12//! field* (click a rendered field → focus it in the editor).
13//!
14//! Three producers feed regions, all keyed on the schema path:
15//!
16//! - **Content fields** (a richtext body, a `richtext[]` element, a card's
17//! content field) are tracked by the **spans** their glyphs carry: the
18//! backend evaluates each one's value at its own generated call site and
19//! records the site's byte window, so every glyph of that content resolves
20//! back to its field — through *any* placement context, including a package
21//! that rebuilds the content (a `show`-rule pass that captures paragraphs
22//! into a state buffer and re-emits them), because the origin rides the
23//! glyph, not a sibling marker a rebuild could drop. A field that is blank
24//! or draws nothing (an empty or whitespace-only body) has no inked extent
25//! to bound and surfaces no region — present-but-empty is not the same as
26//! placed.
27//! - **Direct scalar references** — every `data.<field>` / `data.at("field")`
28//! expression in the plate is its own tracked site: the interpolated
29//! value's glyphs carry a span at or around that reference expression. A
30//! scalar shown in both a header and a footer surfaces both sites, because
31//! two source expressions are two origins; a reference wrapped in an
32//! expression (`#upper(data.subject)`) attributes the whole expression's
33//! ink to the field as long as it is the expression's only reference. Not
34//! tracked: an expression mixing several fields (`data.from + ", " + rank`
35//! has no single owner), a value laundered through an intermediate binding
36//! (`#let s = data.x` … `#s`), and card scalars read from the per-card
37//! loop variable (`card.from` is *one* expression site shared by every card
38//! instance — span data holds no per-instance identity; bind a widget for
39//! those).
40//! - **Form-field widgets** carry a schema path explicitly: pdfform binds it
41//! from the form mapping; a Typst `form-field` binds it from its `field:`
42//! argument. A widget that binds none produces **no** region — its backend
43//! identifier (the `/T` widget name) is not a schema address, so there is
44//! nothing for a consumer to route to. Only schema-addressable fields surface
45//! a region.
46//!
47//! **First placement only.** A content value placed at two sites surfaces one
48//! region set — its first placement's — because span data cannot distinguish
49//! "package chrome interrupting one placement" from "a second placement of
50//! the same value", and a spanning union would claim the ink between them.
51//! The first placement is one region per page it touches, in page order, so
52//! highlighting covers continuation pages — page marginals (headers, footers,
53//! page numbers) between one page's body and the next's do not end it, only a
54//! same-page interruption does: foreign ink within a page (a rebuild's
55//! numbering chrome) shrinks the region to the placement's true start rather
56//! than lying about extent. `field` is still not unique in the
57//! result: page fragments, several scalar reference sites, or tracked content
58//! plus a bound widget each surface independently.
59//! [`LiveSession::regions`](crate::LiveSession::regions) passes the backend's
60//! entries through; consumers group by `field`. Later placements stay
61//! reachable point-wise: [`field_at`](crate::LiveSession::field_at) resolves
62//! a click on *any* placement, since one concrete point identifies one drawn
63//! item whose origin is unambiguous.
64//!
65//! Regions are primarily a session-level query: the geometry is a property of
66//! the current compile, re-read from the session per edit without producing
67//! any byte artifact — the interactive-preview path (overlays over a
68//! `paint`-ed canvas) reads it that way. A one-shot byte render carries the
69//! same sidecar only on request ([`RenderOptions::regions`](crate::RenderOptions))
70//! for consumers without a live session (static SVG overlays, PDF
71//! post-processing, CI coverage probes). Either way regions are an overlay
72//! sidecar, never a compositing input: every canvas backend hands back a
73//! complete page raster, so nothing about the picture depends on reading a
74//! region. Empty for backends that place no schema fields.
75
76/// One schema field placement's extent on a rendered page.
77///
78/// `rect` is `[x0, y0, x1, y1]` in PDF points with a **bottom-left** origin —
79/// the same final geometry the stamp spine writes to the widget `/Rect`, so the
80/// region and the rendered field describe the identical box.
81///
82/// `field` is **not** unique within the `Vec` that
83/// [`LiveSession::regions`](crate::LiveSession::regions) returns: a content
84/// field breaks into one entry **per segment** (paragraph, heading, whole code
85/// fence) and per page each segment touches, a scalar referenced at several
86/// plate sites yields one per site, and tracked content plus a bound widget
87/// yields both. Consumers group by `field`; every entry routes to that field.
88/// The whole-field box is **derived** — the union of a page's `span`-bearing
89/// segment rects, so inter-paragraph whitespace stays uncovered (#829); the
90/// [`field_boxes`] helper (and
91/// [`LiveSession::field_boxes`](crate::LiveSession::field_boxes)) owns that
92/// union so consumers need not reimplement it.
93#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
94#[serde(rename_all = "camelCase")]
95pub struct RenderedRegion {
96 /// The field's plate-space schema address as the backend keys it —
97 /// `"signature_block"` or `"$cards.<kind>.<ordinal>.<field>"` (a per-kind
98 /// ordinal). This is the backend-native form; a binding that owns the
99 /// document's card kinds translates it to a canonical
100 /// [`DocPath`] at its boundary
101 /// ([`plate_addr_to_doc_path`]), so its consumers see one absolute-index
102 /// grammar. A core consumer reading `RenderedRegion` directly sees the
103 /// plate-space form.
104 pub field: String,
105 /// 0-based page index.
106 pub page: usize,
107 /// `[x0, y0, x1, y1]`, PDF points, bottom-left origin.
108 pub rect: [f32; 4],
109 /// The content slice this box covers: USV `[start, end)` into the field's
110 /// `Content` for content ink (one segment's range), `None` for a scalar
111 /// reference site or a widget — geometry with no content address. Additive
112 /// and optional: omitted from the wire when `None`.
113 #[serde(default, skip_serializing_if = "Option::is_none")]
114 pub span: Option<[usize; 2]>,
115}
116
117impl RenderedRegion {
118 /// Whether the point (`x`, `y`, PDF points, bottom-left origin) on `page`
119 /// falls inside this region, edges inclusive. The one point-in-region
120 /// predicate every `field_at` hit-test shares, so a click at a region
121 /// border resolves identically everywhere.
122 pub fn contains(&self, page: usize, x: f32, y: f32) -> bool {
123 self.page == page
124 && self.rect[0] <= x
125 && x <= self.rect[2]
126 && self.rect[1] <= y
127 && y <= self.rect[3]
128 }
129}
130
131/// The whole-field highlight boxes for `field`, derived from a region set: one
132/// union rect per page, over that field's **`span`-bearing** (content) regions.
133///
134/// This owns the subtle part [`regions`](crate::LiveSession::regions) leaves to
135/// consumers — filter by field, keep only the segment rects that carry a `span`,
136/// union per page, inherit first-placement-only from the input — so a
137/// "highlight the focused field" consumer never reimplements it and cannot
138/// reintroduce the field-level union the #829 disjointness invariant exists to
139/// prevent (the input is already striped; this unions the *bounding* box per
140/// page, so inter-paragraph whitespace still is not a separate box but the
141/// derived rect does bound it). Pass the output of
142/// [`LiveSession::regions`](crate::LiveSession::regions) (or a one-shot
143/// [`RenderOptions::regions`](crate::RenderOptions) sidecar); the convenience
144/// [`LiveSession::field_boxes`](crate::LiveSession::field_boxes) reads the
145/// session's own.
146///
147/// **Content only.** A scalar-reference site or a widget carries no `span`
148/// ([`RenderedRegion::span`] is `None`), so a field placed *only* as a scalar
149/// reference or a bound widget yields an empty result here — its highlight box
150/// is a single region's `rect`, read straight from the region set with no
151/// derivation. Each returned region carries the union `span`
152/// (`[min start, max end)` over the page's contributing segments);
153/// `page`-ascending.
154pub fn field_boxes(regions: &[RenderedRegion], field: &str) -> Vec<RenderedRegion> {
155 let mut by_page: Vec<RenderedRegion> = Vec::new();
156 for r in regions
157 .iter()
158 .filter(|r| r.field == field && r.span.is_some())
159 {
160 let span = r.span.expect("filtered to span-bearing");
161 match by_page.iter_mut().find(|acc| acc.page == r.page) {
162 Some(acc) => {
163 acc.rect[0] = acc.rect[0].min(r.rect[0]);
164 acc.rect[1] = acc.rect[1].min(r.rect[1]);
165 acc.rect[2] = acc.rect[2].max(r.rect[2]);
166 acc.rect[3] = acc.rect[3].max(r.rect[3]);
167 let s = acc.span.expect("union region carries a span");
168 acc.span = Some([s[0].min(span[0]), s[1].max(span[1])]);
169 }
170 None => by_page.push(RenderedRegion {
171 field: r.field.clone(),
172 page: r.page,
173 rect: r.rect,
174 span: Some(span),
175 }),
176 }
177 }
178 by_page.sort_by_key(|r| r.page);
179 by_page
180}
181
182// ── Address translation: plate-space geometry ⇄ DocPath ─────────────────────
183//
184// A backend keys a region on the **plate-space** address its compiled plate
185// composes (`$path` = `$cards.<kind>.<ordinal>.`, `crates/backends/typst`), a
186// grammar with a `$cards` sigil, dot separators, and **per-kind ordinals**.
187// That grammar is the template-author contract inside the plate and stays
188// there; it must not cross to a consumer, which speaks one canonical
189// [`DocPath`]. The session owns the translation, resolving the per-kind ordinal
190// to the document-array absolute index (and back) against the ordered card
191// kinds of the current compile — so `regions` / `fieldAt` / `positionAt` /
192// `locate` speak `DocPath`, never `$cards.` ordinals.
193
194use crate::path::{DocPath, DocSeg};
195
196/// The absolute document-array index of the `ord`-th (0-based) card of `kind`,
197/// scanning `card_kinds` (the current compile's ordered card kinds; `None` is a
198/// kindless card) in order. `None` when fewer than `ord + 1` cards of that kind
199/// exist.
200fn abs_card_index(card_kinds: &[Option<&str>], kind: &str, ord: usize) -> Option<usize> {
201 card_kinds
202 .iter()
203 .enumerate()
204 .filter(|(_, k)| **k == Some(kind))
205 .nth(ord)
206 .map(|(i, _)| i)
207}
208
209/// The per-kind ordinal of the card at absolute index `abs` — how many cards of
210/// the same kind precede it, matching the plate's `emit_cards` counter. `None`
211/// when `abs` is out of range or the card is kindless.
212fn per_kind_ordinal(card_kinds: &[Option<&str>], abs: usize) -> Option<usize> {
213 let kind = (*card_kinds.get(abs)?)?;
214 Some(
215 card_kinds[..abs]
216 .iter()
217 .filter(|k| **k == Some(kind))
218 .count(),
219 )
220}
221
222/// Translate a backend plate-space geometry address into a canonical
223/// [`DocPath`], resolving the per-kind ordinal to the absolute card index via
224/// `card_kinds`. The grammar handled is exactly what geometry emits: `$body`
225/// (main body), a bare `<field>` (main field), `$cards.<kind>.<ord>.<field>`
226/// (card field), and `$cards.<kind>.<ord>.$body` (card body). `None` for an
227/// address outside that grammar or one naming a card the kind list cannot
228/// place — the caller keeps the original string.
229pub fn plate_addr_to_doc_path(addr: &str, card_kinds: &[Option<&str>]) -> Option<DocPath> {
230 if addr == "$body" {
231 return Some(DocPath::main_body());
232 }
233 if let Some(rest) = addr.strip_prefix("$cards.") {
234 let mut it = rest.splitn(3, '.');
235 let kind = it.next()?;
236 let ord: usize = it.next()?.parse().ok()?;
237 let tail = it.next()?;
238 let abs = abs_card_index(card_kinds, kind, ord)?;
239 let card = DocPath::card(Some(kind), abs);
240 return Some(if tail == "$body" {
241 card.body()
242 } else {
243 card.field(tail)
244 });
245 }
246 // A plate-space bare main field (`subject`) roots at `main` in `DocPath`
247 // space (`main.subject`), so a consumer always receives a parsed, rooted
248 // path. An unrecognized `$`-token (never a main field) does not translate.
249 if addr.starts_with('$') {
250 return None;
251 }
252 Some(DocPath::main().field(addr))
253}
254
255/// Translate a canonical [`DocPath`] geometry address back to the backend
256/// plate-space form (`main.body` → `$body`, `cards.<kind>[<abs>].<field>` →
257/// `$cards.<kind>.<ord>.<field>`), resolving the absolute card index to its
258/// per-kind ordinal via `card_kinds`. `None` when the path is not a geometry
259/// address (a document-model shape geometry never keys) or names a card the
260/// kind list cannot place. The inverse of [`plate_addr_to_doc_path`], for the
261/// `field`-taking queries (`locate`, `fieldBoxes`).
262pub fn doc_path_to_plate_addr(path: &DocPath, card_kinds: &[Option<&str>]) -> Option<String> {
263 match path.segs() {
264 [DocSeg::Main, DocSeg::Body] => Some("$body".to_string()),
265 [DocSeg::Main, DocSeg::Field { name }] => Some(name.clone()),
266 [DocSeg::Card {
267 kind: Some(kind),
268 index,
269 }, rest @ ..] => {
270 // The path must actually name the card that sits at `index`.
271 if card_kinds.get(*index).copied().flatten() != Some(kind.as_str()) {
272 return None;
273 }
274 let ord = per_kind_ordinal(card_kinds, *index)?;
275 match rest {
276 [DocSeg::Field { name }] => Some(format!("$cards.{kind}.{ord}.{name}")),
277 [DocSeg::Body] => Some(format!("$cards.{kind}.{ord}.$body")),
278 _ => None,
279 }
280 }
281 _ => None,
282 }
283}
284
285/// How precisely a [`ContentHit::pos`] resolved — the marker a caret UI reads to
286/// decide whether to trust the offset. The value is never sub-cluster; the two
287/// variants distinguish the finest this API offers from the segment floor it
288/// degrades to.
289#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
290#[serde(rename_all = "camelCase")]
291pub enum HitGranularity {
292 /// Cluster-exact: `pos` is the first content char of the grapheme cluster
293 /// under the point. The finest resolution — a char that escaped to several
294 /// generated bytes (`*`→`\*`, `你`→3, the `//`→`\/\/` coupling) still floors
295 /// to its cluster's first char, so this is *not* sub-character. A caret UI
296 /// can place the caret at `pos` directly.
297 Cluster,
298 /// Segment-floored: the point landed on origin-less ink (list markers,
299 /// numbering, a multi-line code fence's interior — spans that resolve to no
300 /// single run), so `pos` degraded to the containing segment's content start
301 /// rather than a wrong finer position. A caret UI should treat `pos` as the
302 /// segment it selected, not a within-segment caret.
303 Segment,
304}
305
306/// A resolved point → content position: the schema field a click landed in and
307/// the USV offset into that field's `Content`. The forward
308/// [`position_at`](crate::LiveSession::position_at) direction, paired with
309/// [`locate`](crate::LiveSession::locate) (content position → caret rect).
310///
311/// `pos` is **cluster-exact, not sub-character**: a hit inside a char that
312/// escaped to several generated bytes (`*`→`\*`, `你`→3, the `//`→`\/\/`
313/// coupling) floors to that cluster's first content char. A click on
314/// origin-less ink (list markers, numbering, a multi-line code fence's interior
315/// — spans that resolve to no single run) degrades to the containing segment's
316/// content start rather than a wrong finer position, and a click off all content
317/// ink resolves to nothing. [`granularity`](Self::granularity) reports which of
318/// those two happened, so a caret UI need not guess.
319#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
320#[serde(rename_all = "camelCase")]
321pub struct ContentHit {
322 /// The content field's schema path (same address space as
323 /// [`RenderedRegion::field`]).
324 pub field: String,
325 /// USV offset into the field's `Content`.
326 pub pos: usize,
327 /// Whether [`pos`](Self::pos) is cluster-exact or floored to the segment
328 /// start ([`HitGranularity`]). `None` when the backend does not report it (a
329 /// hit straight from a backend with no source map, or an older wire payload).
330 /// Additive-optional: omitted from the wire when `None`.
331 #[serde(default, skip_serializing_if = "Option::is_none")]
332 pub granularity: Option<HitGranularity>,
333}
334
335#[cfg(test)]
336mod tests {
337 use super::*;
338
339 #[test]
340 fn region_round_trips_through_json() {
341 let region = RenderedRegion {
342 field: "full_name".to_string(),
343 page: 0,
344 rect: [180.0, 715.0, 520.0, 735.0],
345 span: Some([12, 34]),
346 };
347 let json = serde_json::to_string(®ion).unwrap();
348 assert!(json.contains("\"field\":\"full_name\""), "{json}");
349 assert!(json.contains("\"span\":[12,34]"), "{json}");
350 let back: RenderedRegion = serde_json::from_str(&json).unwrap();
351 assert_eq!(back, region);
352 }
353
354 /// `span` is omitted when `None` and defaults back on read — the
355 /// additive-optional discipline that lets a scalar/widget region (no content
356 /// address) parse the same as a content region carrying a span.
357 #[test]
358 fn optional_span_omitted_when_none() {
359 let region = RenderedRegion {
360 field: "subject".to_string(),
361 page: 0,
362 rect: [1.0, 2.0, 3.0, 4.0],
363 span: None,
364 };
365 let json = serde_json::to_string(®ion).unwrap();
366 assert!(!json.contains("span"), "scalar region omits span: {json}");
367 let back: RenderedRegion = serde_json::from_str(&json).unwrap();
368 assert_eq!(back, region);
369 }
370
371 #[test]
372 fn content_hit_round_trips_through_json() {
373 let hit = ContentHit {
374 field: "body".to_string(),
375 pos: 42,
376 granularity: Some(HitGranularity::Cluster),
377 };
378 let json = serde_json::to_string(&hit).unwrap();
379 assert!(json.contains("\"field\":\"body\"") && json.contains("\"pos\":42"));
380 assert!(json.contains("\"granularity\":\"cluster\""), "{json}");
381 let back: ContentHit = serde_json::from_str(&json).unwrap();
382 assert_eq!(back, hit);
383
384 // The segment-floored variant serializes to its own tag, so a caret UI
385 // can tell a trusted cluster offset from a floored one.
386 let seg = ContentHit {
387 field: "body".to_string(),
388 pos: 7,
389 granularity: Some(HitGranularity::Segment),
390 };
391 let json = serde_json::to_string(&seg).unwrap();
392 assert!(json.contains("\"granularity\":\"segment\""), "{json}");
393 assert_eq!(serde_json::from_str::<ContentHit>(&json).unwrap(), seg);
394 }
395
396 /// `granularity` omits when `None` and defaults back on read — the
397 /// additive-optional discipline, so a hit straight from a backend (no source
398 /// map) parses the same as the earlier hit shape lacking it.
399 #[test]
400 fn content_hit_omits_optionals_when_none() {
401 let hit = ContentHit {
402 field: "body".to_string(),
403 pos: 42,
404 granularity: None,
405 };
406 let json = serde_json::to_string(&hit).unwrap();
407 assert!(
408 !json.contains("granularity"),
409 "unreported granularity omitted: {json}"
410 );
411 let back: ContentHit = serde_json::from_str(&json).unwrap();
412 assert_eq!(back, hit);
413 }
414
415 fn content(field: &str, page: usize, rect: [f32; 4], span: [usize; 2]) -> RenderedRegion {
416 RenderedRegion {
417 field: field.to_string(),
418 page,
419 rect,
420 span: Some(span),
421 }
422 }
423
424 /// `field_boxes` unions a page's span-bearing segment rects into one box and
425 /// ignores other fields — the whole-field highlight consumers used to derive
426 /// by hand. The union `span` bounds `[min start, max end)`, and each page
427 /// gets its own box, page-ascending.
428 #[test]
429 fn field_boxes_unions_span_bearing_segments_per_page() {
430 let regions = vec![
431 content("$body", 0, [10.0, 700.0, 200.0, 720.0], [0, 12]),
432 content("$body", 0, [10.0, 660.0, 260.0, 680.0], [13, 40]),
433 content("$body", 1, [10.0, 700.0, 150.0, 720.0], [41, 55]),
434 content("subject", 0, [10.0, 740.0, 90.0, 752.0], [0, 5]),
435 ];
436 let boxes = field_boxes(®ions, "$body");
437 assert_eq!(boxes.len(), 2, "one box per page $body touches");
438 assert_eq!(boxes[0].page, 0);
439 assert_eq!(boxes[0].rect, [10.0, 660.0, 260.0, 720.0], "page-0 union");
440 assert_eq!(boxes[0].span, Some([0, 40]), "page-0 union span");
441 assert_eq!(boxes[1].page, 1);
442 assert_eq!(boxes[1].rect, [10.0, 700.0, 150.0, 720.0]);
443 }
444
445 /// A field placed only as a scalar reference or widget (no `span`) yields no
446 /// derived content box — its highlight is a single region's `rect`, read
447 /// straight from the set.
448 #[test]
449 fn field_boxes_empty_for_span_less_field() {
450 let regions = vec![RenderedRegion {
451 field: "subject".to_string(),
452 page: 0,
453 rect: [10.0, 740.0, 90.0, 752.0],
454 span: None,
455 }];
456 assert!(field_boxes(®ions, "subject").is_empty());
457 }
458
459 // ── Plate-space ⇄ DocPath translation ────────────────────────────────────
460
461 /// Two `note` cards interleaved with one `annotation`: the per-kind ordinal
462 /// is not the absolute index once kinds interleave, so the two grammars
463 /// genuinely differ and the kind list is load-bearing.
464 const KINDS: &[Option<&str>] = &[Some("note"), Some("annotation"), Some("note")];
465
466 fn to_doc(addr: &str) -> Option<String> {
467 plate_addr_to_doc_path(addr, KINDS).map(|p| p.to_string())
468 }
469 fn to_plate(path: &str) -> Option<String> {
470 doc_path_to_plate_addr(&path.parse().unwrap(), KINDS)
471 }
472
473 #[test]
474 fn plate_to_docpath_resolves_the_absolute_index() {
475 // The 2nd `note` (ordinal 1) sits at absolute index 2.
476 assert_eq!(to_doc("$cards.note.1.on").as_deref(), Some("cards.note[2].on"));
477 // The 1st `note` (ordinal 0) is absolute 0; the `annotation` is absolute 1.
478 assert_eq!(to_doc("$cards.note.0.on").as_deref(), Some("cards.note[0].on"));
479 assert_eq!(
480 to_doc("$cards.annotation.0.text").as_deref(),
481 Some("cards.annotation[1].text")
482 );
483 // Bodies and main.
484 assert_eq!(to_doc("$body").as_deref(), Some("main.body"));
485 assert_eq!(
486 to_doc("$cards.note.1.$body").as_deref(),
487 Some("cards.note[2].body")
488 );
489 // A plate-space bare main field roots at `main` in DocPath space.
490 assert_eq!(to_doc("signature_block").as_deref(), Some("main.signature_block"));
491 }
492
493 #[test]
494 fn docpath_to_plate_is_the_inverse() {
495 for plate in [
496 "$body",
497 "signature_block",
498 "$cards.note.0.on",
499 "$cards.note.1.on",
500 "$cards.annotation.0.text",
501 "$cards.note.1.$body",
502 ] {
503 let doc = to_doc(plate).unwrap();
504 assert_eq!(to_plate(&doc).as_deref(), Some(plate), "round-trip {plate}");
505 }
506 }
507
508 #[test]
509 fn translation_rejects_unplaceable_and_foreign_shapes() {
510 // A 3rd `note` (ordinal 2) does not exist — only two notes.
511 assert_eq!(to_doc("$cards.note.2.on"), None);
512 // A DocPath whose kind disagrees with the slot does not translate back.
513 assert_eq!(
514 doc_path_to_plate_addr(&"cards.annotation[0].x".parse().unwrap(), KINDS),
515 None
516 );
517 // A document-model shape geometry never keys (nested main field).
518 assert_eq!(
519 doc_path_to_plate_addr(&"recipients[0].name".parse().unwrap(), KINDS),
520 None
521 );
522 }
523}