@formancy/report-runtime 0.2.0 → 0.3.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/dist/index.d.mts CHANGED
@@ -1,21 +1,105 @@
1
- import { Alignment, AssetMediaType, Border, CheckedSvg, CleanSvg, EPC_CAPTION, EPC_CAPTION_MODULE, EPC_FRAME, EPC_MAX_BYTES, EPC_MAX_VERSION, EpcCaption, EpcCaption as EpcCaption$1, FACTUR_X, FACTUR_X_PROFILES, FacturXProfileTerms, FacturXProfileTerms as FacturXProfileTerms$1, FieldType, FontFamily, Format, IMAGE_REFUSAL_CODES, ImageFit, ImageRefusal, ImageRefusalCode, JpegHeader, MAX_ASSET_BYTES, MAX_ASSET_SIDE, MAX_QR_BILL_ADDITIONAL_INFORMATION, MAX_SVG_BYTES, MAX_SVG_COORDINATE, MAX_SVG_DEPTH, MAX_SVG_GROUPS, MAX_SVG_SEGMENTS, Margins, Orientation, PageSizeName, PngHeader, QR_BILL_CURRENCIES, QR_BILL_SIZE, QR_BILL_TOP, QrBillCurrency, QrBillPageBreak, QrErrorCorrection, RasterHeader, ReportDefinition, ReportDefinition as ReportDefinition$1, ReportErrorCode, Rounding, SVG_ELEMENTS, SVG_REFUSAL_CODES, SortDirection, SvgExtent, SvgRefusal, SvgRefusalCode, SvgRemoval, SvgRemovalKind, SvgViewBox, TableComponent, Width, checkQrBillAmount, checkSvg, cleanSvg, epcCaptionBreak, epcLeastVersion, epcModule, imageHeader, qrBillPageBreak, qrSymbolModules, sniffImage } from "@formancy/report-spec";
1
+ import { Alignment, AnyAssetMediaType, AssetMediaType, AssetMediaType as AssetMediaType$1, BASELINE_SHIFTS, BIDI_CONTROLS, BaselineShift, BaselineShift as BaselineShift$1, Border, CharacterRefusal, CheckedSvg, CleanSvg, DatasetRole, EPC_CAPTION, EPC_CAPTION_MODULE, EPC_FRAME, EPC_MAX_BYTES, EPC_MAX_VERSION, EpcCaption, EpcCaption as EpcCaption$1, FACTUR_X, FACTUR_X_PROFILES, FONT_EMBEDDING_REFUSALS, FONT_FACE_KEYS, FONT_FORMATS, FONT_MEDIA_TYPES, FONT_REFUSAL_CODES, FacturXProfileTerms, FacturXProfileTerms as FacturXProfileTerms$1, FieldType, Font, FontCharacters, FontEmbedding, FontEmbeddingRefusal, FontFaceKey, FontFaces, FontFamily, FontFamily as FontFamily$1, FontFormat, FontMap, FontMediaType, FontMetrics, FontNames, FontRefusal, FontRefusalCode, FontStyle, Format, IMAGE_REFUSAL_CODES, ImageFit, ImageRefusal, ImageRefusalCode, JpegHeader, MAX_ASSET_BYTES, MAX_ASSET_SIDE, MAX_CHART_SERIES, MAX_FONT_BYTES, MAX_FONT_CHARACTERS, MAX_FONT_LINE, MAX_FONT_SIZE, MAX_KEEP_WITH_ROWS, MAX_QR_BILL_ADDITIONAL_INFORMATION, MAX_SCALE, MAX_SVG_BYTES, MAX_SVG_COORDINATE, MAX_SVG_DEPTH, MAX_SVG_GROUPS, MAX_SVG_SEGMENTS, MIN_FONT_LINE, MIN_FONT_SIZE, Margins, Orientation, PRINTED_BLOCKS, PageSizeName, PngHeader, PrintedBlock, QR_BILL_CURRENCIES, QR_BILL_SIZE, QR_BILL_TOP, QrBillCurrency, QrBillPageBreak, QrErrorCorrection, RasterHeader, ReportDefinition, ReportDefinition as ReportDefinition$1, ReportErrorCode, Rounding, SVG_ELEMENTS, SVG_REFUSAL_CODES, SortDirection, SvgExtent, SvgRefusal, SvgRefusalCode, SvgRemoval, SvgRemovalKind, SvgViewBox, TableComponent, UNICODE_VERSION, Width, XRECHNUNG, XRECHNUNG_VERSIONS, XRechnungTerms, XRechnungTerms as XRechnungTerms$1, XRechnungVersion, XRechnungVersion as XRechnungVersion$1, assetDigest, characterMap, checkQrBillAmount, checkSvg, cleanSvg, epcCaptionBreak, epcLeastVersion, epcModule, faceKey, imageHeader, isFontMediaType, qrBillPageBreak, qrSymbolModules, readFont, refusedCharacter, sniffImage } from "@formancy/report-spec";
2
2
  import { Capabilities, Decimal } from "@formancy/expressions";
3
3
  import { Diagnostic, DiagnosticCode, ExpressionValues, ReportCompilation } from "@formancy/report-core";
4
- //#region src/document.d.ts
4
+ /** An exact number as the runtime holds it (`decimalToString`) and as it prints. A renderer may make a coordinate of `exact` (`Number`), and prints `text` alone. */
5
+ interface ChartValue {
6
+ readonly exact: string;
7
+ readonly text: string;
8
+ }
9
+ /** One entry of a legend: what it says, and the colour of what it names, lower-case `#rrggbb`. */
10
+ interface ChartLegendEntry {
11
+ readonly text: string;
12
+ readonly color: string;
13
+ }
14
+ /** What every kind of chart holds: its box, its words' style, its title and its legend. */
15
+ interface ChartFrame {
16
+ readonly kind: 'chart';
17
+ /** The component's id, which a refusal names as its subject. */
18
+ readonly id: string;
19
+ /** Points: the box the chart is drawn in, which the layout reserves whole whatever it holds. */
20
+ readonly width: number;
21
+ readonly height: number;
22
+ /** How its words print. */
23
+ readonly style?: TextStyle;
24
+ readonly title?: string;
25
+ /** In the order its entries print: a bar or a line chart's series where it has more than one, a pie's categories. */
26
+ readonly legend: readonly ChartLegendEntry[];
27
+ /** Present exactly when there is nothing to draw (R7, R8): the chart's empty text, printed in place of its marks. */
28
+ readonly empty?: string;
29
+ }
30
+ /** One series of a bar or a line chart: its colour, and its value at each category, null where it has none. */
31
+ interface ChartSeriesValues {
32
+ readonly color: string;
33
+ /** One per category, in its order. */
34
+ readonly values: readonly (ChartValue | null)[];
35
+ }
36
+ /** A bar or a line chart: categories along one axis, values up the other. */
37
+ interface AxisChart extends ChartFrame {
38
+ readonly chart: 'bar' | 'line';
39
+ readonly categoryTitle?: string;
40
+ readonly valueTitle?: string;
41
+ /** Each category's label, in the order the chart lists them. */
42
+ readonly categories: readonly string[];
43
+ readonly series: readonly ChartSeriesValues[];
44
+ /** The value axis, fixed: lowest first, the first and the last its range, each a gridline; a renderer draws these and no other. */
45
+ readonly ticks: readonly ChartValue[];
46
+ /** Whether each value prints its text beside its mark. */
47
+ readonly valueLabels: boolean;
48
+ }
49
+ /** A pie chart: one series, a slice for each category. */
50
+ interface PieChart extends ChartFrame {
51
+ readonly chart: 'pie';
52
+ /**
53
+ * One per category, in its order; its legend entry is the same index. A
54
+ * slice's `value.text` prints only inside its legend entry, where the
55
+ * chart labels its values: a renderer draws no label on a slice, so that
56
+ * no value prints twice or where its author turned the labels off.
57
+ */
58
+ readonly slices: readonly {
59
+ readonly color: string;
60
+ readonly value: ChartValue;
61
+ }[];
62
+ }
63
+ type Chart = AxisChart | PieChart;
5
64
  /**
6
65
  * A run of text, or a number only the engine knows when it lays out the
7
66
  * page, which prints only in the page header and footer. A run in bold
8
67
  * inside a paragraph that is not was the trial's; version 0 of the
9
68
  * definition sets weight per paragraph.
69
+ *
70
+ * A run of text may be set below or above the line, `baseline`, as its
71
+ * source run was (0061): absent, it stands on the line, and the runtime
72
+ * writes the key only where the report set one. A page counter takes none.
73
+ * What such a run prints as is `SHIFTED_SIZE` and `SHIFTED_RISE`.
10
74
  */
11
75
  type Inline = {
12
76
  readonly text: string;
13
77
  readonly bold?: boolean;
78
+ readonly baseline?: BaselineShift$1;
14
79
  } | {
15
80
  readonly field: 'pageNumber';
16
81
  } | {
17
82
  readonly field: 'pageCount';
18
83
  };
84
+ /**
85
+ * A run set below or above the line prints at this fraction of its
86
+ * paragraph's size, in the paragraph's face (0061). It is pdfmake 0.3.11's
87
+ * own figure (`TextInlines.js`), stated here as the document's, for any
88
+ * engine: the renderer counts such a run's line at it (`bound.ts`), the
89
+ * corpus reads a run at it as one of its line (`lines.ts`), and a PDF that
90
+ * draws another fails there.
91
+ */
92
+ export declare const SHIFTED_SIZE = 0.58;
93
+ /**
94
+ * How far such a run's baseline is moved from its line's, as a fraction of
95
+ * its paragraph's size, up positive: 0.75 of the reduced size up for a run
96
+ * set above the line, 0.35 of it down for one below, 0.435 and 0.203 of the
97
+ * paragraph's size. pdfmake 0.3.11's own figures (`Renderer.js`'s
98
+ * `offsetText`), as `SHIFTED_SIZE` is. The move itself takes no room in
99
+ * the line: what room a line makes for such a run, below or above it, is
100
+ * the engine's.
101
+ */
102
+ export declare const SHIFTED_RISE: Readonly<Record<BaselineShift$1, number>>;
19
103
  /**
20
104
  * How text prints: report-spec's `PrintStyle`, resolved. The runtime lays
21
105
  * each conditional style that held over the base one, a later rule's
@@ -24,7 +108,7 @@ type Inline = {
24
108
  */
25
109
  interface TextStyle {
26
110
  /** A font token, never a font's name: the renderer maps each to a font it embeds. */
27
- readonly font?: FontFamily;
111
+ readonly font?: FontFamily$1;
28
112
  /** Points. */
29
113
  readonly size?: number;
30
114
  readonly bold?: boolean;
@@ -52,9 +136,10 @@ interface TableColumn {
52
136
  * the row, so that a row's first line holds its first cell.
53
137
  *
54
138
  * A `groupHeader` is never the last row on a page: it moves to the next page
55
- * with the row it heads. A `detail` row may be taller than a page; the engine
56
- * then continues it on the next one, or refuses with `content-too-large`, and
57
- * never clips it.
139
+ * with the row it heads, or with as many of its group's first rows as it
140
+ * keeps (`keepWithRows`). A `detail` row may be taller than a page; the
141
+ * engine then continues it on the next one, or refuses with
142
+ * `content-too-large`, and never clips it.
58
143
  */
59
144
  interface TableRow {
60
145
  readonly kind: 'detail' | 'groupHeader' | 'groupFooter' | 'total';
@@ -74,14 +159,28 @@ interface TableRow {
74
159
  * style, or one of its conditional styles that held for this row.
75
160
  */
76
161
  readonly cellStyles?: readonly (TextStyle | null)[];
162
+ /**
163
+ * On a `groupHeader` alone: how many of its group's first rows it stands
164
+ * on its page with, from 2 to `MAX_KEEP_WITH_ROWS` and never more than
165
+ * the detail rows under it -- the count its group states, or the group's
166
+ * rows where it has fewer (0059). Absent, it is kept with its first row.
167
+ * An engine keeps it with as many of them as fit on a page under the
168
+ * repeated header, and with its first row where no more do.
169
+ */
170
+ readonly keepWithRows?: number;
77
171
  }
78
172
  interface Table {
79
173
  readonly kind: 'table';
80
174
  readonly id: string;
81
175
  readonly columns: readonly TableColumn[];
82
- /** The one header row, repeated at the top of every page the table spans. */
83
- readonly header: readonly string[];
84
- /** The header row's style; absent, the renderer's. */
176
+ /**
177
+ * The one header row, repeated at the top of every page the table spans;
178
+ * absent where every column the table shows is titled with nothing, or
179
+ * with white space alone: the table then has no header row, and prints
180
+ * no band of nothing above its rows on any page (0078).
181
+ */
182
+ readonly header?: readonly string[];
183
+ /** The header row's style; absent, the renderer's, and absent with the header. */
85
184
  readonly headerStyle?: TextStyle;
86
185
  readonly rows: readonly TableRow[];
87
186
  /** Printed under the header, in place of detail rows, when there are none. Group and total rows still print. */
@@ -95,7 +194,7 @@ interface Table {
95
194
  */
96
195
  interface ImageAsset {
97
196
  readonly id: string;
98
- readonly mediaType: AssetMediaType;
197
+ readonly mediaType: AssetMediaType$1;
99
198
  readonly bytes: Uint8Array;
100
199
  }
101
200
  /**
@@ -238,7 +337,8 @@ interface Section {
238
337
  /** Points, on every side. */
239
338
  readonly padding?: number;
240
339
  }
241
- type Block = Paragraph | Table | Image | QrCode | EpcQrCode | Rule | Rectangle | Spacer | PageBreak | KeepTogether | Columns | Section;
340
+ /** Every block a region holds; a chart's types are `chart-document.ts`'s. */
341
+ type Block = Paragraph | Table | Image | QrCode | EpcQrCode | Chart | Rule | Rectangle | Spacer | PageBreak | KeepTogether | Columns | Section;
242
342
  interface PageSetup {
243
343
  readonly size: PageSizeName;
244
344
  readonly orientation: Orientation;
@@ -312,7 +412,8 @@ interface QrBill {
312
412
  * under another name. Only a final render writes one: a preview is not the
313
413
  * invoice. An engine encodes the XML as UTF-8 and changes nothing of it.
314
414
  */
315
- interface EInvoiceFile {
415
+ interface FacturXFile {
416
+ readonly kind: 'facturX';
316
417
  /** The CII XML, with its declaration: the invoice itself. */
317
418
  readonly xml: string;
318
419
  /** The embedded file's name: `factur-x.xml`. */
@@ -321,6 +422,49 @@ interface EInvoiceFile {
321
422
  /** `EN 16931`. */
322
423
  readonly conformanceLevel: string;
323
424
  }
425
+ /**
426
+ * An XRechnung (0038): its XML, the invoice itself, which a host takes from
427
+ * the resolved document and sends -- to a portal, by email or over Peppol,
428
+ * as its buyer asks -- and which no PDF embeds; and what it is, its syntax,
429
+ * the specification identifier it opens with (BT-24) and the XRechnung
430
+ * version that names, report-spec's `XRECHNUNG`. An engine draws the page
431
+ * as a plain PDF labelled on every page as the copy, and refuses a file of
432
+ * another syntax, guideline or version as `unsupported`.
433
+ */
434
+ interface XRechnungFile {
435
+ readonly kind: 'xrechnung';
436
+ /** The CII XML, with its declaration: the invoice itself. */
437
+ readonly xml: string;
438
+ readonly syntax: XRechnungTerms$1['syntax'];
439
+ /** BT-24, as the XML holds it. */
440
+ readonly guideline: string;
441
+ readonly version: XRechnungVersion$1;
442
+ }
443
+ /** The e-invoice of a final render, by its kind: a Factur-X file a PDF/A-3b embeds, or an XRechnung's XML a host sends. */
444
+ type EInvoiceFile = FacturXFile | XRechnungFile;
445
+ /**
446
+ * One face of a host's font, resolved to the bytes the renderer embeds
447
+ * (0043): its asset id, for a refusal to name; the digest the report
448
+ * pinned, which the renderer names the embedded face by and caches its
449
+ * glyphs under; and the bytes the host's lookup handed over, which
450
+ * report-spec's `readFont` has read. Never a media type -- every face is a
451
+ * TrueType font.
452
+ */
453
+ interface FontAsset {
454
+ readonly id: string;
455
+ /** `sha256:` and 64 lower-case hex digits: the digest the report pinned the face by. */
456
+ readonly digest: string;
457
+ readonly bytes: Uint8Array;
458
+ }
459
+ /** The faces of one font token a report maps: `normal` always, the rest where the report prints text in them, each resolved to its bytes. */
460
+ interface ResolvedFaces {
461
+ readonly normal: FontAsset;
462
+ readonly bold?: FontAsset;
463
+ readonly italic?: FontAsset;
464
+ readonly boldItalic?: FontAsset;
465
+ }
466
+ /** The faces each font token a report maps prints in; a token left out prints in the renderer's own face. */
467
+ type ResolvedFonts = { readonly [F in FontFamily$1]?: ResolvedFaces; };
324
468
  interface ResolvedDocument {
325
469
  readonly info: {
326
470
  readonly title: string;
@@ -328,7 +472,15 @@ interface ResolvedDocument {
328
472
  readonly creationDate: string;
329
473
  };
330
474
  readonly page: PageSetup;
331
- /** Repeated on every page, at the top of the printable area. */
475
+ /**
476
+ * Page 1's own header, which page 1 prints at the top of the printable
477
+ * area in the page header's place (0060); an empty list is none, and page
478
+ * 1's body then starts at the top margin. Absent, page 1 prints the page
479
+ * header, as every page does. It holds no page field: report-spec refuses
480
+ * one in it, and the renderer draws it before the pages are counted.
481
+ */
482
+ readonly firstPageHeader?: readonly Block[];
483
+ /** Repeated at the top of the printable area on every page, or on every page but the first where the document has `firstPageHeader`. */
332
484
  readonly pageHeader: readonly Block[];
333
485
  /** Repeated on every page, at the bottom of the printable area. */
334
486
  readonly pageFooter: readonly Block[];
@@ -343,12 +495,15 @@ interface ResolvedDocument {
343
495
  readonly paymentPart?: QrBill;
344
496
  /** The e-invoice the PDF embeds, in a final render of a report that is one; absent, the PDF carries none. */
345
497
  readonly eInvoice?: EInvoiceFile;
498
+ /** The host fonts each font token prints in, resolved to their bytes; absent, every token prints in the renderer's own face (0043). */
499
+ readonly fonts?: ResolvedFonts;
346
500
  }
347
501
  export declare const REFUSAL_CODES: readonly ["too-many-pages", "content-too-large", "invalid-asset", "cancelled", "unsupported"];
348
502
  type RefusalCode = (typeof REFUSAL_CODES)[number];
349
503
  /**
350
- * Why an engine produced no PDF. An engine refuses rather than truncates: a
351
- * report that cannot be printed whole is not printed, and the caller is told
504
+ * Why an engine produced no file: the PDF renderer no PDF, the Word writer
505
+ * no Word file (0068). An engine refuses rather than truncates: a report
506
+ * that cannot be printed, or written, whole is not, and the caller is told
352
507
  * what stopped it. `subject` names the asset, table or block concerned, when
353
508
  * the refusal is about one.
354
509
  */
@@ -357,9 +512,267 @@ export declare class RenderRefusal extends Error {
357
512
  readonly subject: string | undefined;
358
513
  constructor(code: RefusalCode, message: string, subject?: string);
359
514
  }
360
- //#endregion
361
- //#region src/data-errors.d.ts
362
- export declare const DATA_ERROR_CODES: readonly ["wrong-type", "string-too-long", "ill-formed-string", "invalid-integer", "unsafe-integer", "decimal-as-number", "invalid-decimal", "decimal-scale", "invalid-date", "invalid-datetime", "invalid-instant", "invalid-image", "not-data", "unknown-property", "missing-dataset", "undeclared-dataset", "missing-field", "unexpected-null", "undeclared-field", "too-many-rows", "incomplete", "completeness-mismatch", "invalid-completeness", "invalid-consistency", "missing-parameter", "undeclared-parameter", "too-many-errors"];
515
+ /**
516
+ * A QR code's symbol (ISO/IEC 18004), and what refuses one: decided here
517
+ * once, below every engine, so that the PDF renderer and the Word writer
518
+ * draw one symbol of a code and refuse the same codes in the same words
519
+ * (0074). An engine draws the symbol it is handed, and decides nothing of
520
+ * it.
521
+ *
522
+ * uqr encodes the text as UTF-8 in byte mode -- or as digits or
523
+ * upper-case alphanumerics, when that is all it holds -- in the smallest
524
+ * version that holds it at the level asked, and never raises the level to
525
+ * fill a version. An engine encodes a code once, when it checks the
526
+ * document, and draws that symbol, so that what is refused and what is
527
+ * drawn are one decision (0020).
528
+ *
529
+ * The square a code stands in is its `size`, its quiet zone inside it:
530
+ * four modules on every side, white, the symbol between them, so a
531
+ * module is the size over the symbol's modules and eight.
532
+ */
533
+ /** ISO/IEC 18004's quiet zone: four modules of white on every side of the symbol. */
534
+ export declare const QR_QUIET_ZONE = 4;
535
+ /**
536
+ * The smallest module drawn: 0.4 mm, 1.13 pt. ISO/IEC 18004 leaves the
537
+ * module's size to the application; SIX's Swiss Implementation Guidelines
538
+ * for the QR-bill, version 2.3, section 6.3, require at least 0.4 mm when
539
+ * printing, and that is taken here as what a printer prints and a phone's
540
+ * camera reads reliably. A square too small for its text at that module is
541
+ * refused, naming the size it needs, never drawn finer. It is a borrowed
542
+ * minimum: the same guidelines draw their largest code finer (0020).
543
+ */
544
+ export declare const QR_MIN_MODULE: number;
545
+ /**
546
+ * The most characters any QR code holds: 7089 digits, version 40 at level
547
+ * L (ISO/IEC 18004, table 7). A character is a code point, as a reader
548
+ * counts one: an emoji is one, though JavaScript holds it in two code
549
+ * units. Longer text fits no version in any mode, and is refused before it
550
+ * is encoded, which takes time and memory with the length of the text;
551
+ * within it, the encoder decides by the bytes the text takes.
552
+ */
553
+ export declare const QR_MAX_CHARACTERS = 7089;
554
+ /** A code's symbol, without its quiet zone: rows of modules, `true` for dark, as many rows as modules in each. */
555
+ interface QrSymbol {
556
+ readonly modules: readonly (readonly boolean[])[];
557
+ }
558
+ /** The version `symbol` is, from its modules a side (ISO/IEC 18004: 4 a version and 17). */
559
+ export declare function qrSymbolVersion(symbol: QrSymbol): number;
560
+ /**
561
+ * `code`'s symbol where it stands `width` points wide, or the refusal
562
+ * that says why it is not drawn: a square of no size, a level or text no
563
+ * encoder can draw, as `unsupported`; a square wider than where it
564
+ * stands, text no version holds, or a square too small for the version
565
+ * that holds it, as `content-too-large`. Each names the code by its id.
566
+ */
567
+ export declare function qrSymbol(code: QrCode, width: number): QrSymbol;
568
+ /**
569
+ * The most characters a Swiss QR Code holds, its line feeds included: 997
570
+ * (IG 6.2), which is what version 25 holds at level M in byte mode. A
571
+ * payload of more is refused before it is encoded.
572
+ */
573
+ export declare const SWISS_QR_MAX_CHARACTERS = 997;
574
+ /**
575
+ * A QR-bill's Swiss QR Code (IG 6), or the refusal that says why it is not
576
+ * drawn: its payload as UTF-8 at level M (6.1), in the smallest version that
577
+ * holds it (6.4), and never past version 25 (6.2). A payload of more than
578
+ * 997 characters is refused unencoded; one whose UTF-8 is more than version
579
+ * 25 holds, once the encoder finds none does. Every refusal names the
580
+ * payment part, and none quotes the payload: it holds names and accounts.
581
+ *
582
+ * SIX prints the code at 46 mm whatever its version, so a module is 46 mm
583
+ * over the symbol's modules, 0.393 mm at version 25: finer than the 0.4 mm
584
+ * a `qrCode` is held to, which is SIX's own figure for print (6.3). SIX's
585
+ * size is drawn, not the floor (0020's generic minimum does not apply).
586
+ */
587
+ export declare function swissSymbol(payload: unknown): QrSymbol;
588
+ /**
589
+ * What refuses a QR-bill's payment part before an engine lays its slip
590
+ * out, and its Swiss QR Code, encoded once: decided here, below every
591
+ * engine, so that the PDF renderer and the Word writer refuse the same
592
+ * bills in the same words and draw one symbol of a bill's code (0075, as
593
+ * 0074 did for a code).
594
+ *
595
+ * The runtime hands an engine a bill SIX's rules have accepted, every
596
+ * text as the slip prints it (`QrBill`); an engine formats nothing, and
597
+ * decides none of SIX's rules again. What is refused here is what no
598
+ * engine draws whole, or would draw as some other slip: a kind of payment
599
+ * part nobody knows, a page the slip has no place on, text that is not
600
+ * text, an amount or currency SIX does not print, more lines than a slip
601
+ * prints, a value longer than any SIX allows, and a code larger than SIX
602
+ * allows (`swissSymbol`). Where one of those is SIX's rule -- the page,
603
+ * the currencies, the amounts, the longest value -- it is report-spec's,
604
+ * so that what the editor accepts and what an engine draws cannot part.
605
+ *
606
+ * One thing is an engine's to say, since only it knows the face it
607
+ * draws in: whether that face draws a text (`BillUndrawn`). Every
608
+ * refusal names the payment part and the field, and none quotes a value:
609
+ * a bill holds names, addresses and accounts.
610
+ */
611
+ /** The two faces a slip prints in: its values, and its titles and headings. */
612
+ type BillFace = 'normal' | 'bold';
613
+ /** A bill an engine draws, and its code's symbol. */
614
+ interface CheckedBill {
615
+ readonly bill: QrBill;
616
+ readonly symbol: QrSymbol;
617
+ }
618
+ /**
619
+ * What an engine says of a text its face does not draw whole: the rest of
620
+ * the sentence that begins with the field's name -- "prints U+5C71, which
621
+ * ..." -- or undefined where it draws every character of it.
622
+ */
623
+ type BillUndrawn = (text: string, face: BillFace) => string | undefined;
624
+ /**
625
+ * Refuses `page` for a slip by report-spec's rule, the one the editor
626
+ * refuses it by (`qrBillPageBreak`): a page that is not A4 in portrait,
627
+ * which has no foot the slip spans, and one whose top margin, with `above`
628
+ * printed under it, reaches into the slip, which no layout can undo.
629
+ */
630
+ export declare function refuseBillPage(page: PageSetup, above?: number): void;
631
+ /** Refuses what no engine draws of `bill` on `page`, the top margin alone before anything above the slip is measured, and encodes its code. */
632
+ export declare function checkQrBill(bill: QrBill, page: PageSetup, undrawn: BillUndrawn): CheckedBill;
633
+ /**
634
+ * The face each heading of a slip prints in, which an engine's glyphs
635
+ * and widths are held to: `separate` regular, the rest bold. A table
636
+ * over every heading, so that one added to the document's
637
+ * `QrBillHeadings` without its face does not compile, rather than going
638
+ * unchecked.
639
+ */
640
+ export declare const BILL_HEADING_FACES: { readonly [K in keyof QrBillHeadings]-?: BillFace; };
641
+ /** The receipt is 62 mm wide, and the payment part starts there (IG 3.3). */
642
+ export declare const SLIP_RECEIPT_WIDTH: number;
643
+ /**
644
+ * "Separate before paying in", above the line along the slip's top, outside
645
+ * the payment part, which a slip may print instead of a scissors symbol
646
+ * (IG 3.7, SG 4): 8 pt, the payment part's heading size, centred over the
647
+ * slip, its baseline 3 pt above the line. SIX gives neither.
648
+ */
649
+ export declare const SLIP_INSTRUCTION: {
650
+ readonly size: 8;
651
+ readonly gap: 3;
652
+ };
653
+ /** The lines the slip is cut along (IG 3.7): solid, half a point. SIX gives no weight. */
654
+ export declare const SLIP_SEPARATION = 0.5;
655
+ /** A blank field's corner marks: 3 mm arms, 0.75 pt (IG 3.5.3, SG 7). */
656
+ export declare const SLIP_CORNER: {
657
+ readonly arm: number;
658
+ readonly weight: 0.75;
659
+ };
660
+ /** Between a debtor's heading's line and its blank field. */
661
+ export declare const SLIP_FIELD_GAP = 2;
662
+ /** The titles, "Receipt" and "Payment part": 11 pt bold (IG 3.5.1, 3.6.1). */
663
+ export declare const SLIP_TITLE = 11;
664
+ /** A part's text: headings bold and 2 pt smaller than their values, every line `pitch` below the one before (IG 3.4, SG 15). */
665
+ interface SlipLettering {
666
+ readonly heading: number;
667
+ readonly value: number;
668
+ readonly pitch: number;
669
+ }
670
+ /** A part of the slip: where each of its sections starts, and the room its information has. */
671
+ interface SlipPart {
672
+ readonly name: string;
673
+ readonly lettering: SlipLettering;
674
+ /** Where its title stands, and which heading it prints: "Receipt" or "Payment part". */
675
+ readonly title: {
676
+ readonly x: number;
677
+ readonly top: number;
678
+ readonly heading: 'receipt' | 'paymentPart';
679
+ };
680
+ /** Whether it prints the additional information: the payment part does, the receipt never (IG 3.6.2). */
681
+ readonly additionalInformation: boolean;
682
+ readonly information: {
683
+ readonly x: number;
684
+ readonly top: number;
685
+ readonly width: number;
686
+ readonly height: number;
687
+ readonly millimetres: number;
688
+ };
689
+ /** The amount section: its headings' top, and how far the amount stands in from the currency. */
690
+ readonly amount: {
691
+ readonly x: number;
692
+ readonly top: number;
693
+ readonly indent: number;
694
+ readonly pitch: number;
695
+ };
696
+ /** The blank amount field: its box, and whether its top is the amount's line rather than the section's. */
697
+ readonly amountField: {
698
+ readonly x: number;
699
+ readonly width: number;
700
+ readonly height: number;
701
+ readonly onAmountLine: boolean;
702
+ };
703
+ readonly debtorField: {
704
+ readonly width: number;
705
+ readonly height: number;
706
+ };
707
+ }
708
+ /** The receipt, 62 by 105 mm (SG 6): 5 mm margins, its title, 56 mm of information, 14 of amount, 18 of acceptance point. */
709
+ export declare const SLIP_RECEIPT: SlipPart;
710
+ /** The payment part, 148 by 105 mm (SG 6): the code's 46 mm and the amount's 22 mm beside 87 by 85 mm of information. */
711
+ export declare const SLIP_PAYMENT_PART: SlipPart;
712
+ /** The Swiss QR Code's place: 5 mm in, below the title section and 5 mm of quiet zone (IG 3.5.2, SG 6). */
713
+ export declare const SLIP_CODE: {
714
+ readonly x: number;
715
+ readonly top: number;
716
+ };
717
+ /** The acceptance point, right-aligned to the receipt's text at the top of its section (IG 3.6.4, SG 6). */
718
+ export declare const SLIP_ACCEPTANCE: {
719
+ readonly right: number;
720
+ readonly top: number;
721
+ };
722
+ /** A block of a part's information: a heading over its values, or over a blank field for the payer's hand. */
723
+ type SlipBlock = {
724
+ readonly heading: string;
725
+ readonly values: readonly string[];
726
+ } | {
727
+ readonly heading: string;
728
+ readonly field: SlipPart['debtorField'];
729
+ };
730
+ /** The blocks a part's information holds, in SIX's order (IG 3.5.4, 3.6.2): the additional information in the payment part alone. */
731
+ export declare function slipBlocks(bill: QrBill, part: SlipPart): SlipBlock[];
732
+ /** A Swiss QR Code's side, without a quiet zone, whatever its version (IG 6.4): its modules are this over theirs. */
733
+ export declare const SWISS_CODE_SIZE: number;
734
+ /**
735
+ * The Swiss cross over the code's centre (IG 6.4.2), in millimetres: SIX's
736
+ * logo, as schoero's generator draws it, is a white square of 7 mm, a black
737
+ * square of 6 mm on it, and a white cross on that, its arms 7/6 mm wide and
738
+ * 35/9 mm from end to end. manuelbl's draws the same black square and cross
739
+ * on modules it clears, rather than on a white square.
740
+ */
741
+ export declare const SWISS_CROSS: {
742
+ readonly white: 7;
743
+ readonly black: 6;
744
+ readonly arm: number;
745
+ readonly span: number;
746
+ };
747
+ /**
748
+ * An EPC QR code's symbol (EPC069-12 v3.1), and what refuses one: decided
749
+ * here once, below every engine, as a QR code's is (`qr-symbol.ts`, 0074).
750
+ * Its payload as UTF-8 at level M, in a symbol of version 13 at most,
751
+ * which an engine encodes once, when it checks the document.
752
+ *
753
+ * Without a caption it is a QR code's symbol, in a square with a quiet
754
+ * zone of four modules inside it, held to the 0.4 mm floor. With
755
+ * Austria's caption it is the PSA's (PSA v3.0 5), by report-spec's
756
+ * `epc-print.ts`, the one place those rules are decided: modules of 15 to
757
+ * 20 mil, and a symbol as tall as the caption beside it. In a square the
758
+ * author sized, the version that just holds a payload may have modules
759
+ * over 20 mil: the symbol is the least version that prints there
760
+ * (`epcLeastVersion`), a larger symbol of the same payload at the same
761
+ * level.
762
+ *
763
+ * Every refusal names the code by its id, and none quotes the payload: it
764
+ * holds a name and an account.
765
+ */
766
+ /**
767
+ * `code`'s symbol where it stands `width` points wide, or the refusal
768
+ * that says why it is not drawn: a square of no size, a caption no engine
769
+ * knows, or a payload that is not text, as `unsupported`; a square wider
770
+ * than where it stands, a payload past 331 bytes, refused unencoded when
771
+ * it is longer than that in characters, or modules the square cannot
772
+ * print, as `content-too-large`.
773
+ */
774
+ export declare function epcSymbol(code: EpcQrCode, width: number): QrSymbol;
775
+ export declare const DATA_ERROR_CODES: readonly ["wrong-type", "string-too-long", "ill-formed-string", "invalid-integer", "unsafe-integer", "decimal-as-number", "invalid-decimal", "decimal-scale", "invalid-date", "invalid-datetime", "invalid-instant", "invalid-image", "not-data", "unknown-property", "missing-dataset", "undeclared-dataset", "missing-field", "unexpected-null", "undeclared-field", "too-many-rows", "incomplete", "completeness-mismatch", "invalid-completeness", "invalid-consistency", "invalid-source", "labels-locale-differs", "missing-parameter", "undeclared-parameter", "too-many-errors"];
363
776
  type DataErrorCode = (typeof DATA_ERROR_CODES)[number];
364
777
  interface DataError {
365
778
  /** A JSON Pointer into the data or the parameter values: `/detail/17/amount`, `/from`. */
@@ -374,8 +787,46 @@ interface DataError {
374
787
  * cut short, and the check stops reading.
375
788
  */
376
789
  export declare const MAX_DATA_ERRORS = 100;
377
- //#endregion
378
- //#region src/values.d.ts
790
+ /** Who handed the data over: a formancy form's submissions, or Formancy Data's forms. */
791
+ export declare const SOURCE_PROVIDERS: readonly ["formancy-form", "formancy-data"];
792
+ type SourceProvider = (typeof SOURCE_PROVIDERS)[number];
793
+ /** One submission the data was read from, and the version of the form that collected it. */
794
+ interface FormSubmission {
795
+ /** The submission's id, as the host that keeps it names it; formancy's server makes a UUID. */
796
+ readonly id: string;
797
+ /** The form's id, as the version that collected the submission writes it: a version may change it. */
798
+ readonly form: string;
799
+ /** `schemaHash` of the exact form version the submission answered: 64 lower-case hex digits. */
800
+ readonly formHash: string;
801
+ }
802
+ /** Data read from a formancy form's submissions. */
803
+ interface FormSource {
804
+ readonly provider: 'formancy-form';
805
+ /** Each submission the data was read from, once, in the order the provider read them; at least one. */
806
+ readonly submissions: readonly FormSubmission[];
807
+ /**
808
+ * The locale a choice's labels were read in, where it is not the
809
+ * report's own, written as a report writes its locale; absent where
810
+ * they were read in the report's own (0063). A render refuses labels
811
+ * read in another locale than its own.
812
+ */
813
+ readonly locale?: string;
814
+ }
815
+ /** Data read from Formancy Data: the published form each of the report's datasets was read from, by its id. */
816
+ interface FormancyDataSource {
817
+ readonly provider: 'formancy-data';
818
+ readonly forms: { readonly [R in DatasetRole]?: string; };
819
+ }
820
+ /** Where a report's data came from. Data a host captured itself may name none. */
821
+ type DataSource = FormSource | FormancyDataSource;
822
+ /**
823
+ * Whether `value` is a submission's id as a source names one: what the form
824
+ * bridge holds an id to before it reads a submission, so that the two
825
+ * cannot read an id differently (0042).
826
+ */
827
+ export declare function isSubmissionId(value: unknown): value is string;
828
+ /** What `isSubmissionId` accepts, in the words a refusal says it: the form bridge says them when it refuses an id, so the two cannot describe one rule two ways. */
829
+ export declare const SUBMISSION_ID_SYNTAX = "letters, digits, '.', '_' and '-', starting with a letter or a digit, at most 128 characters";
379
830
  /**
380
831
  * The longest string a value may be, in UTF-16 code units. Not chosen: it is
381
832
  * the longest string `@formancy/expressions` lets an expression be handed
@@ -425,8 +876,6 @@ type ValueRead<T> = {
425
876
  * whether the field may hold it.
426
877
  */
427
878
  export declare function readValue<T extends FieldType>(type: T, raw: unknown, scale?: number): ValueRead<FieldValues[T]>;
428
- //#endregion
429
- //#region src/data.d.ts
430
879
  /**
431
880
  * How consistent the provider's capture is (plan 13.2): captured by the
432
881
  * host, read in one database snapshot, or explicitly neither -- the label
@@ -467,6 +916,8 @@ interface ReportData {
467
916
  readonly detail?: readonly Readonly<Record<string, unknown>>[];
468
917
  readonly completeness: Completeness;
469
918
  readonly consistency: Consistency;
919
+ /** Where the data came from, held to the syntax of identifiers (0041); absent where the provider names none. */
920
+ readonly source?: DataSource;
470
921
  }
471
922
  /**
472
923
  * One record, checked: each declared field's value as its type holds it, or
@@ -485,17 +936,27 @@ interface CheckedData {
485
936
  readonly detail: readonly CheckedRecord[];
486
937
  readonly completeness: Completeness;
487
938
  readonly consistency: Consistency;
939
+ /** The source the data named, as a frozen copy; absent where it named none. */
940
+ readonly source?: DataSource;
488
941
  }
489
942
  type DataCheck = {
490
943
  readonly ok: true;
491
- readonly data: CheckedData; /** What a preview lacks; always empty in a final render, which refuses it. */
492
- readonly warnings: readonly DataError[];
944
+ readonly data: CheckedData;
945
+ /** What a preview lacks; always empty in a final render, which refuses it. */ readonly warnings: readonly DataError[];
493
946
  } | {
494
947
  readonly ok: false;
495
948
  readonly errors: readonly DataError[];
496
949
  };
497
950
  interface DataCheckOptions {
498
951
  readonly mode: DataMode;
952
+ /**
953
+ * The locale the report's own words are written in, where `report` is
954
+ * one written in another of its languages, as a render in a
955
+ * translation's locale checks the report it prints (0063): form data
956
+ * that names no locale had its labels read in it. `report.locale` when
957
+ * absent.
958
+ */
959
+ readonly reportLocale?: string;
499
960
  }
500
961
  /**
501
962
  * `data` held to `report`'s dataset contracts, or every reason it is
@@ -503,8 +964,6 @@ interface DataCheckOptions {
503
964
  * Any mode but `preview` is held as final: the stricter of the two.
504
965
  */
505
966
  export declare function checkData(report: ReportDefinition$1, data: ReportData, options: DataCheckOptions): DataCheck;
506
- //#endregion
507
- //#region src/parameters.d.ts
508
967
  /** The parameters' values by id, each read as its type or null. It has no prototype, so a parameter named `constructor` is its own value. */
509
968
  type CheckedParameters = {
510
969
  readonly [parameter: string]: CheckedValue | null;
@@ -522,8 +981,6 @@ type ParameterCheck = {
522
981
  * a JSON Pointer into `values`: `/copies`.
523
982
  */
524
983
  export declare function checkParameters(report: ReportDefinition$1, values: Readonly<Record<string, unknown>>): ParameterCheck;
525
- //#endregion
526
- //#region src/decimal.d.ts
527
984
  /**
528
985
  * `value` rounded as `rounding` declares, at exactly its scale. A negative
529
986
  * value that rounds to nothing is zero, never minus zero. Throws a
@@ -543,8 +1000,6 @@ export declare function maxDecimal(values: Iterable<Decimal>): Decimal | null;
543
1000
  * over no values (0007).
544
1001
  */
545
1002
  export declare function averageDecimals(values: Iterable<Decimal>, rounding: Rounding): Decimal | null;
546
- //#endregion
547
- //#region src/format.d.ts
548
1003
  /** The types a value printed can have: every field type but an image, which is drawn. */
549
1004
  type PrintableType = Exclude<FieldType, 'image'>;
550
1005
  /** A value with its type, as the runtime holds it (`values.ts`). */
@@ -552,7 +1007,7 @@ type TypedValue = { readonly [T in PrintableType]: {
552
1007
  readonly type: T;
553
1008
  readonly value: FieldValues[T];
554
1009
  }; }[PrintableType];
555
- export declare const FORMAT_ERROR_CODES: readonly ["unsupported-locale", "unsupported-time-zone", "format-type-mismatch", "no-currency", "invalid-currency", "number-too-large"];
1010
+ export declare const FORMAT_ERROR_CODES: readonly ["unsupported-locale", "unsupported-time-zone", "format-type-mismatch", "no-currency", "invalid-currency", "number-too-large", "percent-rounds-again"];
556
1011
  /**
557
1012
  * The most integer digits a number or currency format prints: 308. A double
558
1013
  * holds up to about 1.8 × 10^308, and ECMA-402's ToIntlMathematicalValue
@@ -588,6 +1043,8 @@ interface Formatter {
588
1043
  readonly timeZone: string;
589
1044
  /** `value` as `format` shows it, or as it prints plainly without one. */
590
1045
  format(value: TypedValue | null, format: Format | undefined, scope?: CurrencyScope): Formatted;
1046
+ /** `fraction` as the locale writes a percentage at `places`: 0.125 at 1 is 12.5%. The fraction is already rounded to `places + 2` places, so Intl shifts its digits and never rounds. */
1047
+ percent(fraction: Decimal, places: number): Formatted;
591
1048
  }
592
1049
  /**
593
1050
  * A value printed with no format: as the format writes it. Exact digits
@@ -609,8 +1066,6 @@ export declare function createFormatter(context: FormatContext): {
609
1066
  readonly code: FormatErrorCode;
610
1067
  readonly message: string;
611
1068
  };
612
- //#endregion
613
- //#region src/sort-group.d.ts
614
1069
  /** One key rows are ordered by: a detail field, its type, and its direction. */
615
1070
  interface OrderKey {
616
1071
  readonly field: string;
@@ -654,10 +1109,15 @@ export declare function groupRows(rows: readonly OrderedRow[], by: {
654
1109
  * contract lacks -- which report-spec refuses.
655
1110
  */
656
1111
  export declare function orderKeys(report: ReportDefinition$1, table: TableComponent): OrderKey[];
657
- /** `detail` -- the report's checked detail rows -- in `table`'s order, and in its groups when it has one. */
658
- export declare function orderTable(report: ReportDefinition$1, table: TableComponent, detail: readonly CheckedRecord[]): OrderedTable;
659
- //#endregion
660
- //#region src/evaluate.d.ts
1112
+ /**
1113
+ * `detail` -- the report's checked detail rows -- in `table`'s order, and in
1114
+ * its groups when it has one. Given `selected`, the rows a table's
1115
+ * condition selected, in the data's order (0062), those alone, each still
1116
+ * at its index in `detail`: a total over a group reads a row's value by
1117
+ * that index, and an error names the row by it. Ties keep the data's order
1118
+ * among them.
1119
+ */
1120
+ export declare function orderTable(report: ReportDefinition$1, table: TableComponent, detail: readonly CheckedRecord[], selected?: readonly OrderedRow[]): OrderedTable;
661
1121
  /**
662
1122
  * Steps one evaluation may take: upstream's default for a formancy form's
663
1123
  * expression (`DEFAULT_BUDGET`). A report expression reads single values, so
@@ -730,22 +1190,25 @@ interface ReportExpressions {
730
1190
  }
731
1191
  type ExpressionsPreparation = {
732
1192
  readonly ok: true;
1193
+ /** The report the expressions are of: the one prepared, written in the render's locale (report-spec's `reportIn`, 0063), with no translations. */
1194
+ readonly report: ReportDefinition$1;
733
1195
  readonly expressions: ReportExpressions;
734
1196
  } | {
735
1197
  readonly ok: false;
736
1198
  readonly diagnostics: readonly Diagnostic[];
737
1199
  };
738
1200
  /**
739
- * `report`'s expressions compiled for one render, or the diagnostics that
740
- * refuse it: every error `diagnose` gives, which the editor shows too.
741
- * `report` is one the validator accepts. The evaluations of one render
742
- * share one budget, so a render prepares its own.
1201
+ * `report`'s expressions compiled for one render in `locale`, or the
1202
+ * diagnostics that refuse it: every error `diagnose` gives, which the
1203
+ * editor shows too, that names no language or names `locale` (0063). What
1204
+ * is compiled is `report` written in `locale`, which the render prints.
1205
+ * `report` is one the validator accepts, and `locale` the report's own or
1206
+ * one it declares, as `printLocale` holds it. The evaluations of one
1207
+ * render share one budget, so a render prepares its own.
743
1208
  */
744
- export declare function prepareExpressions(report: ReportDefinition$1): ExpressionsPreparation;
745
- //#endregion
746
- //#region src/resolve-errors.d.ts
1209
+ export declare function prepareExpressions(report: ReportDefinition$1, locale?: string): ExpressionsPreparation;
747
1210
  /** What lowering a report can find wrong besides what each earlier stage finds. */
748
- export declare const RESOLVE_ERROR_CODES: readonly ["invalid-creation-date", "missing-asset", "invalid-asset", "asset-lookup-failed", "rounding-not-decimal", "aggregate-value-type", "no-qr-value", "empty-qr-code", "invalid-qr-bill", "invalid-epc-qr-code", "invalid-e-invoice", "e-invoice-preview", "too-many-errors"];
1211
+ export declare const RESOLVE_ERROR_CODES: readonly ["invalid-creation-date", "undeclared-locale", "missing-asset", "invalid-asset", "asset-lookup-failed", "rounding-not-decimal", "aggregate-value-type", "no-qr-value", "empty-qr-code", "invalid-qr-bill", "invalid-epc-qr-code", "invalid-e-invoice", "e-invoice-preview", "no-e-invoice-copy", "chart-too-many-categories", "chart-negative-share", "too-many-errors"];
749
1212
  type ResolveErrorCode = (typeof RESOLVE_ERROR_CODES)[number];
750
1213
  /** Where in the report an error is, when it is in a component, a table column or a row. */
751
1214
  interface Place {
@@ -788,8 +1251,6 @@ type RuntimeError = ({
788
1251
  readonly message: string;
789
1252
  } & Place);
790
1253
  type RuntimeStage = RuntimeError['stage'];
791
- //#endregion
792
- //#region src/render-context.d.ts
793
1254
  /** An approved asset, named as report-spec names one: by id, pinned by digest. */
794
1255
  interface ImageRef {
795
1256
  readonly asset: string;
@@ -802,28 +1263,135 @@ interface ImageBytes {
802
1263
  }
803
1264
  /**
804
1265
  * The host's lookup of an approved asset's bytes by its id and digest, or
805
- * undefined when it has none. Never an address: the runtime fetches nothing.
1266
+ * undefined when it has none. Never an address: the runtime fetches
1267
+ * nothing. One lookup answers for every asset a report names -- an image it
1268
+ * draws, or a font it prints in (0043) -- by the id and digest the report
1269
+ * pinned.
1270
+ */
1271
+ type AssetResolver = (ref: ImageRef) => ImageBytes | undefined;
1272
+ /** @deprecated The resolver's former name, kept for a release; use `AssetResolver`, which answers for fonts too. */
1273
+ type ImageResolver = AssetResolver;
1274
+ /**
1275
+ * The most categories a chart groups its rows into: 200, chosen as a bound
1276
+ * on one chart's work, totalling every series at every category. How many
1277
+ * a box draws legibly is the renderer's to say, and so is how many charts
1278
+ * a render draws together: the renderer's `MAX_CHART_DRAWING` (0058) weighs
1279
+ * a render's charts and refuses them past it.
1280
+ *
1281
+ * What the costliest of eight chart forms tried costs a render, at one
1282
+ * packing, measured on 2026-11-15 on a Mac (Apple M2) under Node 22.23.4,
1283
+ * ECharts 6.1.0, with the machine at a load average of about 5 from other
1284
+ * work: three charts to an A4 landscape page, zero margins, each as wide
1285
+ * as the page and a third of its height, eight series where it has them,
1286
+ * value labels off, and `renderPdf` run seven times to each page after a
1287
+ * warm-up. Each form is the largest `drawChart` does not refuse: a line
1288
+ * chart of 8 series and the full 200 categories, whose empty labels are no
1289
+ * word, took a median of 586 ms (549 to 849) against 4.6 ms for the same
1290
+ * page without charts; the same chart with one-letter labels, refused past
1291
+ * 123 categories, 430 ms; the most categories a bar chart draws, 186 of
1292
+ * one series, 77 ms. The bound stays, for one chart's work; how many
1293
+ * charts a render draws, and so what a page costs, is the renderer's
1294
+ * `MAX_CHART_DRAWING`, which refuses that page of three 8 × 200 lines at
1295
+ * its third chart, at 5,016 units, and admits two. The renderer's word
1296
+ * checks took under 1 ms of any page.
1297
+ */
1298
+ export declare const MAX_CHART_CATEGORIES = 200;
1299
+ /** The places of a percentage a pie's share prints at: 12.5 %. */
1300
+ export declare const SHARE_PLACES = 1;
1301
+ /** Intervals an axis may hold: six labels down it, chosen as what a reader takes in at a glance. */
1302
+ export declare const MAX_TICK_INTERVALS = 5;
1303
+ /**
1304
+ * The label of a copy of an e-invoice (0077): what every page of a final
1305
+ * render says where a host asked for the copy and not the invoice
1306
+ * (`ResolveOptions.eInvoice`). A copy is what a Word file is written of:
1307
+ * a file a person may change is no invoice, so its every page says that
1308
+ * it is a copy, that it is not the invoice, and what the invoice is --
1309
+ * the PDF that embeds its XML, of a Factur-X, or its XML, of an
1310
+ * XRechnung. It carries no XML itself.
1311
+ *
1312
+ * The words are the runtime's, in the language the render prints in
1313
+ * (0063): the label is the one thing that tells a reader what the page
1314
+ * is, and in a language the page does not speak it tells them nothing.
1315
+ * So a copy in a language no label is written in is refused, never
1316
+ * labelled in another. It says "this document", not "this Word file":
1317
+ * the copy is a resolved document, and whatever is made of it is no
1318
+ * invoice. A preview's label and an XRechnung's PDF's stay English, as
1319
+ * they were (0038).
1320
+ *
1321
+ * One decision, here: the runtime writes the label, and an engine reads
1322
+ * it with `readCopyLabel` and decides no word of it.
806
1323
  */
807
- type ImageResolver = (ref: ImageRef) => ImageBytes | undefined;
808
- //#endregion
809
- //#region src/resolve.d.ts
1324
+ /** The languages a copy is labelled in: those the starters print in. A locale's language is its first subtag. */
1325
+ export declare const E_INVOICE_COPY_LANGUAGES: readonly ["de", "en", "es", "fr", "it", "nl"];
1326
+ type EInvoiceCopyLanguage = (typeof E_INVOICE_COPY_LANGUAGES)[number];
1327
+ type Kind = EInvoiceFile['kind'];
1328
+ /** What every page of a copy says, by the e-invoice's kind and the render's language. */
1329
+ export declare const E_INVOICE_COPY_LABELS: Readonly<Record<Kind, Readonly<Record<EInvoiceCopyLanguage, string>>>>;
1330
+ /** A copy's label as an engine finds it: its kind, its language, and the paragraph the runtime writes, frozen. */
1331
+ interface Known {
1332
+ readonly kind: Kind;
1333
+ readonly language: EInvoiceCopyLanguage;
1334
+ readonly paragraph: Paragraph;
1335
+ }
1336
+ /**
1337
+ * The paragraph a copy of an e-invoice of `kind` is labelled with in a
1338
+ * render that prints in `locale`, as the runtime writes it; undefined
1339
+ * where no label is written in that locale's language. Frozen, and the
1340
+ * same object each time: a document carries a paragraph of its own.
1341
+ */
1342
+ export declare function eInvoiceCopyParagraph(kind: Kind, locale: string): Paragraph | undefined;
1343
+ /** The label a header opens with: of which copy, and whether it stands as the runtime writes it. */
1344
+ interface CopyLabel extends Known {
1345
+ /** Whether the header's paragraph is the runtime's, style and all: the words in white, at one point or light are found, and are not as written. */
1346
+ readonly asWritten: boolean;
1347
+ }
1348
+ /**
1349
+ * The copy's label `header` opens with, or undefined where it opens with
1350
+ * none: a paragraph of one run whose text is a label's, whatever its
1351
+ * style, as a preview's label is read (0057). `asWritten` says whether
1352
+ * the paragraph is the runtime's whole -- its size, bold and its colour,
1353
+ * and nothing else -- which an engine that writes a copy holds it to:
1354
+ * the words in white say nothing to a reader. A label among other runs,
1355
+ * or below another block, heads nothing and is not found.
1356
+ */
1357
+ export declare function readCopyLabel(header: readonly Block[]): CopyLabel | undefined;
810
1358
  interface ResolveOptions {
811
1359
  /** A final render prints the report; a preview shows a sample and says what it lacks. */
812
1360
  readonly mode: DataMode;
813
1361
  /** The values a person supplied, by parameter id; defaults apply to those left out. */
814
1362
  readonly parameters?: Readonly<Record<string, unknown>>;
815
- /** The host's lookup of approved assets' bytes; a report that draws an image is refused without one. */
816
- readonly images?: ImageResolver;
1363
+ /** The host's lookup of approved assets' bytes; a report that draws an image or maps a font is refused without one (0043). */
1364
+ readonly images?: AssetResolver;
817
1365
  /** An ISO 8601 instant with its zone, fixed by the caller, so that the same inputs print the same PDF. */
818
1366
  readonly creationDate: string;
819
1367
  /** The IANA zone instants are shown in, named by the host: UTC when absent, never the machine's. */
820
1368
  readonly timeZone?: string;
1369
+ /**
1370
+ * The locale the render prints in: the report's own when absent, or one
1371
+ * its translations declare, exactly; any other is refused as
1372
+ * `undeclared-locale` (0063). It decides every word the report prints,
1373
+ * every value's format, the order of rows and groups, the slip's
1374
+ * headings and the labels form data must have been read in.
1375
+ */
1376
+ readonly locale?: string;
1377
+ /**
1378
+ * `'copy'` resolves a final render of an e-invoice as its copy (0077):
1379
+ * every header opens with the copy's label, in the render's language,
1380
+ * and the document carries no XML. The invoice's terms are held and its
1381
+ * XML written as for the invoice, so a copy is of an invoice that
1382
+ * exists. Absent, the render is the invoice. It says nothing of a
1383
+ * report that carries no e-invoice; of a preview, in a language no
1384
+ * label is written in, or as any other value it is refused,
1385
+ * `no-e-invoice-copy`.
1386
+ */
1387
+ readonly eInvoice?: 'copy';
821
1388
  }
822
1389
  /** What a document was resolved from, to keep beside the PDF (plan 14). Nothing in it is the data's. */
823
1390
  interface RenderManifest {
824
- /** report-spec's hash of the report as validated. */
1391
+ /** report-spec's hash of the report as validated, its translations and all. */
825
1392
  readonly reportHash: string;
826
1393
  readonly reportSpecVersion: ReportDefinition$1['reportSpecVersion'];
1394
+ /** The locale the render printed in: the report's own, or the translation's it named (0063). */
827
1395
  readonly locale: string;
828
1396
  readonly timeZone: string;
829
1397
  readonly mode: DataMode;
@@ -831,20 +1399,44 @@ interface RenderManifest {
831
1399
  readonly completeness: Completeness;
832
1400
  /** Each parameter's value as the format writes one -- an exact number or a date as a string, a boolean -- or null. */
833
1401
  readonly parameters: Readonly<Record<string, string | boolean | null>>;
1402
+ /**
1403
+ * Where the data came from, as its provider named it and the check held
1404
+ * it: each submission of a formancy form with its form's id and its
1405
+ * version's schemaHash, or Formancy Data's forms (0041). Held to the
1406
+ * syntax of identifiers and to no key but its shape's; what fits that
1407
+ * syntax passes, whatever it means. Absent where the data named no
1408
+ * source.
1409
+ */
1410
+ readonly source?: DataSource;
1411
+ /** `'copy'` where the document is the copy of the report's e-invoice a host asked for, and not the invoice (0077); absent otherwise. */
1412
+ readonly eInvoice?: 'copy';
834
1413
  }
835
1414
  type Resolution = {
836
1415
  readonly ok: true;
837
1416
  readonly document: ResolvedDocument;
838
- readonly manifest: RenderManifest; /** What a preview lacks; empty in a final render, which refuses it. */
839
- readonly warnings: readonly RuntimeError[];
1417
+ readonly manifest: RenderManifest;
1418
+ /** What a preview lacks; empty in a final render, which refuses it. */ readonly warnings: readonly RuntimeError[];
840
1419
  } | {
841
1420
  readonly ok: false;
842
1421
  readonly errors: readonly RuntimeError[];
843
1422
  };
844
- /** What every page of a preview that lacks data says, at the top of its page header. */
1423
+ /** What every page of a preview that lacks data says, at the top of its page header, and of page 1's own where it has one. */
845
1424
  export declare const PREVIEW_LABEL = "Preview of incomplete data: not a final report";
846
1425
  /** What every page of a preview of an e-invoice says when it lacks nothing else: it writes no XML, and is not the invoice. */
847
1426
  export declare const E_INVOICE_PREVIEW_LABEL = "Preview: not an e-invoice, and not a final report";
1427
+ /** What every page of a final render of an XRechnung says: the invoice is the XML the document carries, which a host sends, and the PDF drawn of the page is a copy (0038). */
1428
+ export declare const XRECHNUNG_COPY_LABEL = "Copy of an XRechnung: the invoice is its XML, and this PDF is not the invoice";
1429
+ /**
1430
+ * The paragraph that opens every page's header of a final render of an
1431
+ * XRechnung, as the runtime writes it: `XRECHNUNG_COPY_LABEL` in the
1432
+ * labels' style. The renderer refuses an XRechnung's document whose page
1433
+ * header, or page 1's own where it has one (0060), does not open with it,
1434
+ * style and all, since the text in white or at one point would say nothing
1435
+ * to a reader (0038). Frozen, so that what
1436
+ * the renderer holds a copy to is not a host's to change; each document
1437
+ * carries a paragraph of its own.
1438
+ */
1439
+ export declare const XRECHNUNG_COPY_PARAGRAPH: Paragraph;
848
1440
  /**
849
1441
  * `report` resolved against `data`: the document to render and its
850
1442
  * manifest, or every reason it is refused, up to a bound. Nothing is read
@@ -852,22 +1444,25 @@ export declare const E_INVOICE_PREVIEW_LABEL = "Preview: not an e-invoice, and n
852
1444
  * nothing in the result is shared with them.
853
1445
  */
854
1446
  export declare function resolveReport(report: ReportDefinition$1, data: ReportData, options: ResolveOptions): Resolution;
855
- //#endregion
856
- //#region src/report-check.d.ts
857
1447
  type ReportCheck = {
858
- readonly ok: true; /** The copy validation read. */
1448
+ readonly ok: true;
1449
+ /** The copy validation read, translations and all: what the manifest's hash names. */
859
1450
  readonly report: ReportDefinition$1;
1451
+ /** That copy written in the render's locale, with no translations (0063): what the render prints, the copy itself less its translations in its own locale. */
1452
+ readonly printed: ReportDefinition$1;
860
1453
  readonly expressions: ReportExpressions;
861
1454
  } | {
862
1455
  readonly ok: false;
863
1456
  readonly errors: readonly RuntimeError[];
864
1457
  };
865
1458
  /**
866
- * `report` validated and its expressions compiled for one render, or every
867
- * reason it is refused: each structural error, or, for a report that is
868
- * structurally valid, each diagnostic of severity error.
1459
+ * `report` validated and its expressions compiled for one render in
1460
+ * `locale`, the report's own where absent, or every reason it is refused:
1461
+ * each structural error; a locale the report is not written in
1462
+ * (`undeclared-locale`); or, for a report that is structurally valid,
1463
+ * each diagnostic of severity error that names no language or that
1464
+ * locale (0063).
869
1465
  */
870
- export declare function checkReport(report: unknown): ReportCheck;
871
- //#endregion
872
- export { type Block, type CheckedData, type CheckedParameters, type CheckedRecord, type CheckedSvg, type CheckedValue, type CleanSvg, type ColumnSlot, type Columns, type Completeness, type ConditionEvaluation, type Consistency, type CurrencyScope, type DataCheck, type DataCheckOptions, type DataError, type DataErrorCode, type DataMode, type EInvoiceFile, EPC_CAPTION, EPC_CAPTION_MODULE, EPC_FRAME, EPC_MAX_BYTES, EPC_MAX_VERSION, type EpcCaption, type EpcQrCode, type Evaluation, type EvaluationError, type EvaluationErrorCode, type ExpressionsPreparation, FACTUR_X, FACTUR_X_PROFILES, type FacturXProfileTerms, type FieldValues, type FormatContext, type FormatErrorCode, type Formatted, type Formatter, IMAGE_REFUSAL_CODES, type Image, type ImageAsset, type ImageBytes, type ImageRef, type ImageRefusal, type ImageRefusalCode, type ImageResolver, type ImageValue, type Inline, type JpegHeader, type KeepTogether, MAX_ASSET_BYTES, MAX_ASSET_SIDE, MAX_QR_BILL_ADDITIONAL_INFORMATION, MAX_SVG_BYTES, MAX_SVG_COORDINATE, MAX_SVG_DEPTH, MAX_SVG_GROUPS, MAX_SVG_SEGMENTS, type OrderKey, type OrderedRow, type OrderedTable, type PageBreak, type PageSetup, type Paragraph, type ParameterCheck, type PngHeader, type PrintableType, QR_BILL_CURRENCIES, QR_BILL_SIZE, QR_BILL_TOP, type QrBill, type QrBillHeadings, type QrBillPageBreak, type QrCode, type RasterHeader, type Rectangle, type RefusalCode, type RenderManifest, type ReportCheck, type ReportData, type ReportDefinition, type ReportExpressions, type Resolution, type ResolveErrorCode, type ResolveOptions, type ResolvedDocument, type RowGroup, type Rule, type RuntimeError, type RuntimeStage, SVG_ELEMENTS, SVG_REFUSAL_CODES, type Section, type Spacer, type SvgExtent, type SvgRefusal, type SvgRefusalCode, type SvgRemoval, type SvgRemovalKind, type SvgViewBox, type Table, type TableColumn, type TableRow, type TextStyle, type TypedValue, type ValueErrorCode, type ValueRead, checkQrBillAmount, checkSvg, cleanSvg, epcCaptionBreak, epcLeastVersion, epcModule, imageHeader, qrBillPageBreak, qrSymbolModules, sniffImage };
1466
+ export declare function checkReport(report: unknown, locale?: string): ReportCheck;
1467
+ export { type AnyAssetMediaType, type AssetMediaType, type AssetResolver, type AxisChart, BASELINE_SHIFTS, BIDI_CONTROLS, type BaselineShift, type BillFace, type BillUndrawn, type Block, type CharacterRefusal, type Chart, type ChartLegendEntry, type ChartSeriesValues, type ChartValue, type CheckedBill, type CheckedData, type CheckedParameters, type CheckedRecord, type CheckedSvg, type CheckedValue, type CleanSvg, type ColumnSlot, type Columns, type Completeness, type ConditionEvaluation, type Consistency, type CopyLabel, type CurrencyScope, type DataCheck, type DataCheckOptions, type DataError, type DataErrorCode, type DataMode, type DataSource, type EInvoiceCopyLanguage, type EInvoiceFile, EPC_CAPTION, EPC_CAPTION_MODULE, EPC_FRAME, EPC_MAX_BYTES, EPC_MAX_VERSION, type EpcCaption, type EpcQrCode, type Evaluation, type EvaluationError, type EvaluationErrorCode, type ExpressionsPreparation, FACTUR_X, FACTUR_X_PROFILES, FONT_EMBEDDING_REFUSALS, FONT_FACE_KEYS, FONT_FORMATS, FONT_MEDIA_TYPES, FONT_REFUSAL_CODES, type FacturXFile, type FacturXProfileTerms, type FieldValues, type Font, type FontAsset, type FontCharacters, type FontEmbedding, type FontEmbeddingRefusal, type FontFaceKey, type FontFaces, type FontFamily, type FontFormat, type FontMap, type FontMediaType, type FontMetrics, type FontNames, type FontRefusal, type FontRefusalCode, type FontStyle, type FormSource, type FormSubmission, type FormancyDataSource, type FormatContext, type FormatErrorCode, type Formatted, type Formatter, IMAGE_REFUSAL_CODES, type Image, type ImageAsset, type ImageBytes, type ImageRef, type ImageRefusal, type ImageRefusalCode, type ImageResolver, type ImageValue, type Inline, type JpegHeader, type KeepTogether, MAX_ASSET_BYTES, MAX_ASSET_SIDE, MAX_CHART_SERIES, MAX_FONT_BYTES, MAX_FONT_CHARACTERS, MAX_FONT_LINE, MAX_FONT_SIZE, MAX_KEEP_WITH_ROWS, MAX_QR_BILL_ADDITIONAL_INFORMATION, MAX_SCALE, MAX_SVG_BYTES, MAX_SVG_COORDINATE, MAX_SVG_DEPTH, MAX_SVG_GROUPS, MAX_SVG_SEGMENTS, MIN_FONT_LINE, MIN_FONT_SIZE, type OrderKey, type OrderedRow, type OrderedTable, PRINTED_BLOCKS, type PageBreak, type PageSetup, type Paragraph, type ParameterCheck, type PieChart, type PngHeader, type PrintableType, type PrintedBlock, QR_BILL_CURRENCIES, QR_BILL_SIZE, QR_BILL_TOP, type QrBill, type QrBillHeadings, type QrBillPageBreak, type QrCode, type QrSymbol, type RasterHeader, type Rectangle, type RefusalCode, type RenderManifest, type ReportCheck, type ReportData, type ReportDefinition, type ReportExpressions, type Resolution, type ResolveErrorCode, type ResolveOptions, type ResolvedDocument, type ResolvedFaces, type ResolvedFonts, type RowGroup, type Rule, type RuntimeError, type RuntimeStage, SVG_ELEMENTS, SVG_REFUSAL_CODES, type Section, type SlipBlock, type SlipLettering, type SlipPart, type SourceProvider, type Spacer, type SvgExtent, type SvgRefusal, type SvgRefusalCode, type SvgRemoval, type SvgRemovalKind, type SvgViewBox, type Table, type TableColumn, type TableRow, type TextStyle, type TypedValue, UNICODE_VERSION, type ValueErrorCode, type ValueRead, XRECHNUNG, XRECHNUNG_VERSIONS, type XRechnungFile, type XRechnungTerms, type XRechnungVersion, assetDigest, characterMap, checkQrBillAmount, checkSvg, cleanSvg, epcCaptionBreak, epcLeastVersion, epcModule, faceKey, imageHeader, isFontMediaType, qrBillPageBreak, qrSymbolModules, readFont, refusedCharacter, sniffImage };
873
1468
  //# sourceMappingURL=index.d.mts.map