@tiqian/protocol 0.0.0-stage → 0.1.0-alpha.9

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 (228) hide show
  1. package/dist/haxe/crypto/Sha256.d.ts +19 -0
  2. package/dist/haxe/crypto/Sha256.js +194 -0
  3. package/dist/org/tiqian/clreq/AdjustmentStylePolicy.d.ts +11 -0
  4. package/dist/org/tiqian/clreq/AdjustmentStylePolicy.js +21 -0
  5. package/dist/org/tiqian/clreq/AutoSpaceMode.d.ts +16 -0
  6. package/dist/org/tiqian/clreq/AutoSpaceMode.js +17 -0
  7. package/dist/org/tiqian/clreq/AutoSpacePolicy.d.ts +13 -0
  8. package/dist/org/tiqian/clreq/AutoSpacePolicy.js +23 -0
  9. package/dist/org/tiqian/clreq/BopomofoReading.d.ts +12 -0
  10. package/dist/org/tiqian/clreq/BopomofoReading.js +86 -0
  11. package/dist/org/tiqian/clreq/BopomofoTone.d.ts +28 -0
  12. package/dist/org/tiqian/clreq/BopomofoTone.js +26 -0
  13. package/dist/org/tiqian/clreq/CjkPunctuationGlyphPolicy.d.ts +16 -0
  14. package/dist/org/tiqian/clreq/CjkPunctuationGlyphPolicy.js +17 -0
  15. package/dist/org/tiqian/clreq/ClreqProfile.d.ts +27 -0
  16. package/dist/org/tiqian/clreq/ClreqProfile.js +58 -0
  17. package/dist/org/tiqian/clreq/ClreqRegion.d.ts +20 -0
  18. package/dist/org/tiqian/clreq/ClreqRegion.js +20 -0
  19. package/dist/org/tiqian/clreq/ClreqStrictness.d.ts +16 -0
  20. package/dist/org/tiqian/clreq/ClreqStrictness.js +17 -0
  21. package/dist/org/tiqian/clreq/GlueSide.d.ts +16 -0
  22. package/dist/org/tiqian/clreq/GlueSide.js +17 -0
  23. package/dist/org/tiqian/clreq/HangingPunctuationStyle.d.ts +12 -0
  24. package/dist/org/tiqian/clreq/HangingPunctuationStyle.js +14 -0
  25. package/dist/org/tiqian/clreq/InteriorPunctuationStyle.d.ts +12 -0
  26. package/dist/org/tiqian/clreq/InteriorPunctuationStyle.js +14 -0
  27. package/dist/org/tiqian/clreq/KinsokuLevel.d.ts +20 -0
  28. package/dist/org/tiqian/clreq/KinsokuLevel.js +20 -0
  29. package/dist/org/tiqian/clreq/KinsokuMode.d.ts +14 -0
  30. package/dist/org/tiqian/clreq/KinsokuMode.js +2 -0
  31. package/dist/org/tiqian/clreq/KinsokuModes.d.ts +11 -0
  32. package/dist/org/tiqian/clreq/KinsokuModes.js +71 -0
  33. package/dist/org/tiqian/clreq/LineAdjustmentStrategy.d.ts +16 -0
  34. package/dist/org/tiqian/clreq/LineAdjustmentStrategy.js +17 -0
  35. package/dist/org/tiqian/clreq/LineEndPunctuationStyle.d.ts +12 -0
  36. package/dist/org/tiqian/clreq/LineEndPunctuationStyle.js +14 -0
  37. package/dist/org/tiqian/clreq/PunctuationClass.d.ts +44 -0
  38. package/dist/org/tiqian/clreq/PunctuationClass.js +38 -0
  39. package/dist/org/tiqian/clreq/PunctuationGluePlacement.d.ts +12 -0
  40. package/dist/org/tiqian/clreq/PunctuationGluePlacement.js +14 -0
  41. package/dist/org/tiqian/clreq/PunctuationGluePlacements.d.ts +9 -0
  42. package/dist/org/tiqian/clreq/PunctuationGluePlacements.js +49 -0
  43. package/dist/org/tiqian/clreq/PunctuationWidthPolicy.d.ts +8 -0
  44. package/dist/org/tiqian/clreq/PunctuationWidthPolicy.js +16 -0
  45. package/dist/org/tiqian/clreq/ResolvedKinsoku.d.ts +12 -0
  46. package/dist/org/tiqian/clreq/ResolvedKinsoku.js +43 -0
  47. package/dist/org/tiqian/core/Cluster.d.ts +13 -0
  48. package/dist/org/tiqian/core/Cluster.js +24 -0
  49. package/dist/org/tiqian/core/EastAsianSpacingData.d.ts +4 -0
  50. package/dist/org/tiqian/core/EastAsianSpacingData.js +399 -0
  51. package/dist/org/tiqian/core/EastAsianSpacingEdges.d.ts +8 -0
  52. package/dist/org/tiqian/core/EastAsianSpacingEdges.js +14 -0
  53. package/dist/org/tiqian/core/EastAsianSpacingValue.d.ts +20 -0
  54. package/dist/org/tiqian/core/EastAsianSpacingValue.js +20 -0
  55. package/dist/org/tiqian/core/Ic.d.ts +7 -0
  56. package/dist/org/tiqian/core/Ic.js +17 -0
  57. package/dist/org/tiqian/core/IllegalStateException.d.ts +4 -0
  58. package/dist/org/tiqian/core/IllegalStateException.js +8 -0
  59. package/dist/org/tiqian/core/IntRange.d.ts +12 -0
  60. package/dist/org/tiqian/core/IntRange.js +30 -0
  61. package/dist/org/tiqian/core/LineEndReason.d.ts +16 -0
  62. package/dist/org/tiqian/core/LineEndReason.js +17 -0
  63. package/dist/org/tiqian/core/SourceBoundaryBias.d.ts +16 -0
  64. package/dist/org/tiqian/core/SourceBoundaryBias.js +17 -0
  65. package/dist/org/tiqian/core/SourceInteractionBoundaries.d.ts +29 -0
  66. package/dist/org/tiqian/core/SourceInteractionBoundaries.js +193 -0
  67. package/dist/org/tiqian/core/TextRange.d.ts +11 -0
  68. package/dist/org/tiqian/core/TextRange.js +40 -0
  69. package/dist/org/tiqian/core/TextRangeError.d.ts +11 -0
  70. package/dist/org/tiqian/core/TextRangeError.js +2 -0
  71. package/dist/org/tiqian/core/TiqianIllegalArgumentException.d.ts +6 -0
  72. package/dist/org/tiqian/core/TiqianIllegalArgumentException.js +21 -0
  73. package/dist/org/tiqian/core/TiqianNoSuchElementException.d.ts +10 -0
  74. package/dist/org/tiqian/core/TiqianNoSuchElementException.js +16 -0
  75. package/dist/org/tiqian/core/UnicodeCombiningMarkData.d.ts +3 -0
  76. package/dist/org/tiqian/core/UnicodeCombiningMarkData.js +109 -0
  77. package/dist/org/tiqian/core/UnicodeEastAsianSpacing.d.ts +16 -0
  78. package/dist/org/tiqian/core/UnicodeEastAsianSpacing.js +88 -0
  79. package/dist/org/tiqian/core/UnicodeEmojiModifierBaseData.d.ts +3 -0
  80. package/dist/org/tiqian/core/UnicodeEmojiModifierBaseData.js +35 -0
  81. package/dist/org/tiqian/core/UnicodeExtendedPictographicData.d.ts +3 -0
  82. package/dist/org/tiqian/core/UnicodeExtendedPictographicData.js +64 -0
  83. package/dist/org/tiqian/core/UnicodeNumber.d.ts +3 -0
  84. package/dist/org/tiqian/core/UnicodeNumber.js +14 -0
  85. package/dist/org/tiqian/core/UnicodeNumberData.d.ts +3 -0
  86. package/dist/org/tiqian/core/UnicodeNumberData.js +64 -0
  87. package/dist/org/tiqian/core/UnicodeScriptEvidence.d.ts +16 -0
  88. package/dist/org/tiqian/core/UnicodeScriptEvidence.js +17 -0
  89. package/dist/org/tiqian/core/UnicodeScriptEvidenceClassifier.d.ts +7 -0
  90. package/dist/org/tiqian/core/UnicodeScriptEvidenceClassifier.js +17 -0
  91. package/dist/org/tiqian/core/UnicodeScriptEvidenceData.d.ts +4 -0
  92. package/dist/org/tiqian/core/UnicodeScriptEvidenceData.js +295 -0
  93. package/dist/org/tiqian/core/UnicodeWordCharacter.d.ts +6 -0
  94. package/dist/org/tiqian/core/UnicodeWordCharacter.js +17 -0
  95. package/dist/org/tiqian/core/UnicodeWordCharacterData.d.ts +3 -0
  96. package/dist/org/tiqian/core/UnicodeWordCharacterData.js +234 -0
  97. package/dist/org/tiqian/font/FontRole.d.ts +28 -0
  98. package/dist/org/tiqian/font/FontRole.js +26 -0
  99. package/dist/org/tiqian/font/FontRoleContext.d.ts +13 -0
  100. package/dist/org/tiqian/font/FontRoleContext.js +28 -0
  101. package/dist/org/tiqian/layout/ContextualQuoteRoleResolver.d.ts +51 -0
  102. package/dist/org/tiqian/layout/ContextualQuoteRoleResolver.js +305 -0
  103. package/dist/org/tiqian/layout/LineOptimization.d.ts +124 -0
  104. package/dist/org/tiqian/layout/LineOptimization.js +298 -0
  105. package/dist/org/tiqian/layout/ProgressiveBreakDecisions.d.ts +86 -0
  106. package/dist/org/tiqian/layout/ProgressiveBreakDecisions.js +415 -0
  107. package/dist/org/tiqian/layout/ProgressiveBreakTierPriority.d.ts +5 -0
  108. package/dist/org/tiqian/layout/ProgressiveBreakTierPriority.js +33 -0
  109. package/dist/org/tiqian/layout/QuotePairAnalyzer.d.ts +63 -0
  110. package/dist/org/tiqian/layout/QuotePairAnalyzer.js +251 -0
  111. package/dist/org/tiqian/linebreak/BreakKind.d.ts +20 -0
  112. package/dist/org/tiqian/linebreak/BreakKind.js +20 -0
  113. package/dist/org/tiqian/protocol/Canonical.d.ts +55 -0
  114. package/dist/org/tiqian/protocol/Canonical.js +471 -0
  115. package/dist/org/tiqian/protocol/DecorationInput.d.ts +6 -0
  116. package/dist/org/tiqian/protocol/DecorationInput.js +12 -0
  117. package/dist/org/tiqian/protocol/EncodeResult.d.ts +9 -0
  118. package/dist/org/tiqian/protocol/EncodeResult.js +2 -0
  119. package/dist/org/tiqian/protocol/FaceInfo.d.ts +13 -0
  120. package/dist/org/tiqian/protocol/FaceInfo.js +2 -0
  121. package/dist/org/tiqian/protocol/FontContract.d.ts +25 -0
  122. package/dist/org/tiqian/protocol/FontContract.js +317 -0
  123. package/dist/org/tiqian/protocol/FontFaceRecord.d.ts +6 -0
  124. package/dist/org/tiqian/protocol/FontFaceRecord.js +2 -0
  125. package/dist/org/tiqian/protocol/FontFaceSpec.d.ts +11 -0
  126. package/dist/org/tiqian/protocol/FontFaceSpec.js +2 -0
  127. package/dist/org/tiqian/protocol/FontWeightSpec.d.ts +10 -0
  128. package/dist/org/tiqian/protocol/FontWeightSpec.js +2 -0
  129. package/dist/org/tiqian/protocol/InlineBoxInput.d.ts +7 -0
  130. package/dist/org/tiqian/protocol/InlineBoxInput.js +2 -0
  131. package/dist/org/tiqian/protocol/InlineObjectInput.d.ts +7 -0
  132. package/dist/org/tiqian/protocol/InlineObjectInput.js +2 -0
  133. package/dist/org/tiqian/protocol/JsCoerce.d.ts +19 -0
  134. package/dist/org/tiqian/protocol/JsCoerce.js +394 -0
  135. package/dist/org/tiqian/protocol/LayoutAttribute.d.ts +5 -0
  136. package/dist/org/tiqian/protocol/LayoutAttribute.js +10 -0
  137. package/dist/org/tiqian/protocol/LayoutFloatShape.d.ts +14 -0
  138. package/dist/org/tiqian/protocol/LayoutFloatShape.js +2 -0
  139. package/dist/org/tiqian/protocol/LayoutTree.d.ts +23 -0
  140. package/dist/org/tiqian/protocol/LayoutTree.js +2 -0
  141. package/dist/org/tiqian/protocol/LayoutVertex.d.ts +4 -0
  142. package/dist/org/tiqian/protocol/LayoutVertex.js +2 -0
  143. package/dist/org/tiqian/protocol/LineBreakSpanInput.d.ts +6 -0
  144. package/dist/org/tiqian/protocol/LineBreakSpanInput.js +12 -0
  145. package/dist/org/tiqian/protocol/MetricEntry.d.ts +11 -0
  146. package/dist/org/tiqian/protocol/MetricEntry.js +21 -0
  147. package/dist/org/tiqian/protocol/NamedError.d.ts +88 -0
  148. package/dist/org/tiqian/protocol/NamedError.js +71 -0
  149. package/dist/org/tiqian/protocol/NamedErrorNames.d.ts +5 -0
  150. package/dist/org/tiqian/protocol/NamedErrorNames.js +53 -0
  151. package/dist/org/tiqian/protocol/ParagraphRequest.d.ts +25 -0
  152. package/dist/org/tiqian/protocol/ParagraphRequest.js +2 -0
  153. package/dist/org/tiqian/protocol/ParagraphRequestChecks.d.ts +8 -0
  154. package/dist/org/tiqian/protocol/ParagraphRequestChecks.js +145 -0
  155. package/dist/org/tiqian/protocol/ParagraphRequestException.d.ts +6 -0
  156. package/dist/org/tiqian/protocol/ParagraphRequestException.js +55 -0
  157. package/dist/org/tiqian/protocol/ParagraphRequestFields.d.ts +3 -0
  158. package/dist/org/tiqian/protocol/ParagraphRequestFields.js +4 -0
  159. package/dist/org/tiqian/protocol/Plan.d.ts +101 -0
  160. package/dist/org/tiqian/protocol/Plan.js +10 -0
  161. package/dist/org/tiqian/protocol/PlanEndReason.d.ts +16 -0
  162. package/dist/org/tiqian/protocol/PlanEndReason.js +17 -0
  163. package/dist/org/tiqian/protocol/PlanJsonNumber.d.ts +43 -0
  164. package/dist/org/tiqian/protocol/PlanJsonNumber.js +362 -0
  165. package/dist/org/tiqian/protocol/PlanSchema.d.ts +4 -0
  166. package/dist/org/tiqian/protocol/PlanSchema.js +5 -0
  167. package/dist/org/tiqian/protocol/PlanStyleDelta.d.ts +5 -0
  168. package/dist/org/tiqian/protocol/PlanStyleDelta.js +2 -0
  169. package/dist/org/tiqian/protocol/Revision.d.ts +11 -0
  170. package/dist/org/tiqian/protocol/Revision.js +12 -0
  171. package/dist/org/tiqian/protocol/SessionFaceSpec.d.ts +5 -0
  172. package/dist/org/tiqian/protocol/SessionFaceSpec.js +2 -0
  173. package/dist/org/tiqian/protocol/SnapshotTableBinary.d.ts +55 -0
  174. package/dist/org/tiqian/protocol/SnapshotTableBinary.js +657 -0
  175. package/dist/org/tiqian/protocol/SnapshotTypography.d.ts +14 -0
  176. package/dist/org/tiqian/protocol/SnapshotTypography.js +2 -0
  177. package/dist/org/tiqian/protocol/StyleRow.d.ts +8 -0
  178. package/dist/org/tiqian/protocol/StyleRow.js +15 -0
  179. package/dist/org/tiqian/protocol/TableData.d.ts +25 -0
  180. package/dist/org/tiqian/protocol/TableData.js +45 -0
  181. package/dist/org/tiqian/protocol/TableInput.d.ts +13 -0
  182. package/dist/org/tiqian/protocol/TableInput.js +21 -0
  183. package/dist/org/tiqian/protocol/TableMetricRow.d.ts +9 -0
  184. package/dist/org/tiqian/protocol/TableMetricRow.js +17 -0
  185. package/dist/org/tiqian/protocol/TableProbe.d.ts +11 -0
  186. package/dist/org/tiqian/protocol/TableProbe.js +21 -0
  187. package/dist/org/tiqian/protocol/TextSpanInput.d.ts +9 -0
  188. package/dist/org/tiqian/protocol/TextSpanInput.js +2 -0
  189. package/dist/org/tiqian/protocol/ValueRow.d.ts +4 -0
  190. package/dist/org/tiqian/protocol/ValueRow.js +7 -0
  191. package/dist/org/tiqian/protocol/WireField.d.ts +5 -0
  192. package/dist/org/tiqian/protocol/WireField.js +2 -0
  193. package/dist/org/tiqian/protocol/WireValue.d.ts +25 -0
  194. package/dist/org/tiqian/protocol/WireValue.js +2 -0
  195. package/dist/org/tiqian/test/TestHelpers.d.ts +5 -0
  196. package/dist/org/tiqian/test/TestHelpers.js +27 -0
  197. package/dist/org/tiqian/test/trace/TestTrace.d.ts +6 -0
  198. package/dist/org/tiqian/test/trace/TestTrace.js +8 -0
  199. package/dist/org/tiqian/test/trace/TestTracePlatform.d.ts +6 -0
  200. package/dist/org/tiqian/test/trace/TestTracePlatform.js +78 -0
  201. package/dist/org/tiqian/test/trace/TestTraceRecorder.d.ts +9 -0
  202. package/dist/org/tiqian/test/trace/TestTraceRecorder.js +36 -0
  203. package/dist/org/tiqian/test/trace/TestTraceRender.d.ts +47 -0
  204. package/dist/org/tiqian/test/trace/TestTraceRender.js +690 -0
  205. package/dist/org/tiqian/test/trace/TestTraceStore.d.ts +18 -0
  206. package/dist/org/tiqian/test/trace/TestTraceStore.js +149 -0
  207. package/dist/org/tiqian/test/trace/TraceAssertionError.d.ts +5 -0
  208. package/dist/org/tiqian/test/trace/TraceAssertionError.js +2 -0
  209. package/dist/org/tiqian/test/trace/TraceAssertionException.d.ts +6 -0
  210. package/dist/org/tiqian/test/trace/TraceAssertionException.js +16 -0
  211. package/dist/org/tiqian/test/trace/TraceField.d.ts +5 -0
  212. package/dist/org/tiqian/test/trace/TraceField.js +10 -0
  213. package/dist/org/tiqian/test/trace/TraceFormat.d.ts +21 -0
  214. package/dist/org/tiqian/test/trace/TraceFormat.js +184 -0
  215. package/dist/org/tiqian/test/trace/TracedAssertions.d.ts +78 -0
  216. package/dist/org/tiqian/test/trace/TracedAssertions.js +749 -0
  217. package/dist/runtime.d.ts +96 -0
  218. package/dist/runtime.js +1612 -0
  219. package/dist/std/FsError.d.ts +48 -0
  220. package/dist/std/FsError.js +2 -0
  221. package/dist/std/FsException.d.ts +6 -0
  222. package/dist/std/FsException.js +45 -0
  223. package/dist/std/UStringException.d.ts +6 -0
  224. package/dist/std/UStringException.js +21 -0
  225. package/dist/std/UStringFault.d.ts +9 -0
  226. package/dist/std/UStringFault.js +2 -0
  227. package/package.json +26 -4
  228. package/README.md +0 -3
@@ -0,0 +1,690 @@
1
+ // Generated by the reflaxe TypeScript target. Do not edit.
2
+ import { TraceFormat } from "./TraceFormat.js";
3
+ import { UStringException } from "./../../../../std/UStringException.js";
4
+ import { StringTools, floatToI32, formatFloatRuntime, readUnit } from "../../../../runtime.js";
5
+ export class TestTraceRender {
6
+ static MAX_OPERAND_CHARS = 240;
7
+ static HEX = "0123456789abcdef";
8
+ static MAX_SIGNIFICANT_DIGITS = 9;
9
+ static escapeOperand(value) {
10
+ return TestTraceRender.cap(TestTraceRender.escape(value));
11
+ }
12
+ static renderString(value) {
13
+ return TestTraceRender.cap(`'${TestTraceRender.escape(value)}'`);
14
+ }
15
+ static renderInt(value) {
16
+ return TestTraceRender.cap(TraceFormat.i(value));
17
+ }
18
+ static renderLong(value) {
19
+ return TestTraceRender.cap(TraceFormat.valueLong(value));
20
+ }
21
+ static renderFloat(value) {
22
+ return TestTraceRender.cap(TraceFormat.fd(value, 6));
23
+ }
24
+ static floatText(value) {
25
+ const negative = value < 0;
26
+ const v = Math.abs(value);
27
+ if (v === 0) {
28
+ return (negative ? "-0.0" : "0.0");
29
+ }
30
+ const shape = TestTraceRender.decimalShape(v);
31
+ if (shape === null) {
32
+ return (negative ? "-" : "") + formatFloatRuntime(v);
33
+ }
34
+ const digits = shape.digits;
35
+ const width = digits.length;
36
+ const position = shape.position;
37
+ const targetBits = floatToI32(v);
38
+ let p = 1;
39
+ while (p <= 9) {
40
+ const exp = position - p;
41
+ const base = (p >= width ? TestTraceRender.decimalInt(digits) * TestTraceRender.pow10Int(p - width) : TestTraceRender.decimalInt(digits.substring(0, p)));
42
+ const frac = TestTraceRender.fractionAfter(digits, p, shape.extended);
43
+ let best = -1;
44
+ let bestDist = Infinity;
45
+ let c = base - 1;
46
+ while (c <= base + 2) {
47
+ if (c >= 1) {
48
+ const candidateText = String(c) + "e" + String(exp);
49
+ const cand = ((s) => { let a = 0, z = s.length; while (a < z) {
50
+ const c = s.charCodeAt(a);
51
+ if (c === 32 || (c >= 9 && c <= 13)) {
52
+ a++;
53
+ }
54
+ else {
55
+ break;
56
+ }
57
+ } while (z > a) {
58
+ const c = s.charCodeAt(z - 1);
59
+ if (c === 32 || (c >= 9 && c <= 13)) {
60
+ z--;
61
+ }
62
+ else {
63
+ break;
64
+ }
65
+ } let i = a; const c0 = s.charCodeAt(i); if (c0 === 43 || c0 === 45) {
66
+ i++;
67
+ } let before = 0; while (i < z) {
68
+ const c = s.charCodeAt(i);
69
+ if (c >= 48 && c <= 57) {
70
+ i++;
71
+ before++;
72
+ }
73
+ else {
74
+ break;
75
+ }
76
+ } let after = 0; if (i < z && s.charCodeAt(i) === 46) {
77
+ i++;
78
+ while (i < z) {
79
+ const c = s.charCodeAt(i);
80
+ if (c >= 48 && c <= 57) {
81
+ i++;
82
+ after++;
83
+ }
84
+ else {
85
+ break;
86
+ }
87
+ }
88
+ } let ok = before > 0 || after > 0; if (ok && i < z) {
89
+ const e = s.charCodeAt(i);
90
+ if (e === 101 || e === 69) {
91
+ i++;
92
+ const c1 = s.charCodeAt(i);
93
+ if (c1 === 43 || c1 === 45) {
94
+ i++;
95
+ }
96
+ let m = 0;
97
+ while (i < z) {
98
+ const c = s.charCodeAt(i);
99
+ if (c >= 48 && c <= 57) {
100
+ i++;
101
+ m++;
102
+ }
103
+ else {
104
+ break;
105
+ }
106
+ }
107
+ ok = m > 0;
108
+ }
109
+ else {
110
+ ok = false;
111
+ }
112
+ } return ok && i === z ? Number.parseFloat(s.substring(a, z)) : Number.NaN; })(candidateText);
113
+ if (floatToI32(cand) === targetBits) {
114
+ const dist = Math.abs(c - base - frac);
115
+ if (dist < bestDist || dist === bestDist && c % 2 === 0) {
116
+ best = c;
117
+ bestDist = dist;
118
+ }
119
+ }
120
+ }
121
+ c += 1;
122
+ }
123
+ if (best >= 0) {
124
+ return TestTraceRender.floatTextRender(best, position - 1, p, negative);
125
+ }
126
+ p += 1;
127
+ }
128
+ return (negative ? "-" : "") + formatFloatRuntime(v);
129
+ }
130
+ static decimalInt(digits) {
131
+ let value = 0;
132
+ let index = 0;
133
+ while (index < digits.length) {
134
+ value = value * 10 + (Number.isNaN(digits.charCodeAt(index)) ? null : digits.charCodeAt(index)) - 48;
135
+ index += 1;
136
+ }
137
+ return value;
138
+ }
139
+ static pow10Int(exponent) {
140
+ let value = 1;
141
+ for (let index = 0; index < exponent; index += 1) {
142
+ value *= 10;
143
+ }
144
+ return value;
145
+ }
146
+ static fractionAfter(digits, p, extended) {
147
+ if (p >= digits.length) {
148
+ return 0.0;
149
+ }
150
+ const frac = ((s) => { let a = 0, z = s.length; while (a < z) {
151
+ const c = s.charCodeAt(a);
152
+ if (c === 32 || (c >= 9 && c <= 13)) {
153
+ a++;
154
+ }
155
+ else {
156
+ break;
157
+ }
158
+ } while (z > a) {
159
+ const c = s.charCodeAt(z - 1);
160
+ if (c === 32 || (c >= 9 && c <= 13)) {
161
+ z--;
162
+ }
163
+ else {
164
+ break;
165
+ }
166
+ } let i = a; const c0 = s.charCodeAt(i); if (c0 === 43 || c0 === 45) {
167
+ i++;
168
+ } let before = 0; while (i < z) {
169
+ const c = s.charCodeAt(i);
170
+ if (c >= 48 && c <= 57) {
171
+ i++;
172
+ before++;
173
+ }
174
+ else {
175
+ break;
176
+ }
177
+ } let after = 0; if (i < z && s.charCodeAt(i) === 46) {
178
+ i++;
179
+ while (i < z) {
180
+ const c = s.charCodeAt(i);
181
+ if (c >= 48 && c <= 57) {
182
+ i++;
183
+ after++;
184
+ }
185
+ else {
186
+ break;
187
+ }
188
+ }
189
+ } let ok = before > 0 || after > 0; if (ok && i < z) {
190
+ const e = s.charCodeAt(i);
191
+ if (e === 101 || e === 69) {
192
+ i++;
193
+ const c1 = s.charCodeAt(i);
194
+ if (c1 === 43 || c1 === 45) {
195
+ i++;
196
+ }
197
+ let m = 0;
198
+ while (i < z) {
199
+ const c = s.charCodeAt(i);
200
+ if (c >= 48 && c <= 57) {
201
+ i++;
202
+ m++;
203
+ }
204
+ else {
205
+ break;
206
+ }
207
+ }
208
+ ok = m > 0;
209
+ }
210
+ else {
211
+ ok = false;
212
+ }
213
+ } return ok && i === z ? Number.parseFloat(s.substring(a, z)) : Number.NaN; })(`0.${digits.substring(p)}`);
214
+ if (extended && frac === 0.5) {
215
+ return 0.75;
216
+ }
217
+ return frac;
218
+ }
219
+ static decimalShape(v) {
220
+ if (!Number.isFinite(v)) {
221
+ return null;
222
+ }
223
+ const plain = TestTraceRender.expandScientific(formatFloatRuntime(v));
224
+ let point = plain.length;
225
+ let index = 0;
226
+ while (index < plain.length) {
227
+ if ((Number.isNaN(plain.charCodeAt(index)) ? null : plain.charCodeAt(index)) === 46) {
228
+ point = index;
229
+ break;
230
+ }
231
+ index += 1;
232
+ }
233
+ const all = plain.substring(0, point) + plain.substring(point + 1);
234
+ let first = 0;
235
+ while (first < all.length && (Number.isNaN(all.charCodeAt(first)) ? null : all.charCodeAt(first)) === 48) {
236
+ first += 1;
237
+ }
238
+ if (first === all.length) {
239
+ return null;
240
+ }
241
+ let last = all.length;
242
+ while (last > first + 1 && readUnit(all, last - 1) === 48) {
243
+ last -= 1;
244
+ }
245
+ let digits = "";
246
+ let extended = false;
247
+ let cursor = first;
248
+ while (cursor < last) {
249
+ if (digits.length < TestTraceRender.MAX_SIGNIFICANT_DIGITS) {
250
+ digits += all.substring(cursor, cursor + 1);
251
+ }
252
+ else {
253
+ if ((Number.isNaN(all.charCodeAt(cursor)) ? null : all.charCodeAt(cursor)) !== 48) {
254
+ extended = true;
255
+ }
256
+ }
257
+ cursor += 1;
258
+ }
259
+ return new DecimalShape(digits, point - first, extended);
260
+ }
261
+ static floatTextRender(c, e, p, negative) {
262
+ let s = String(c);
263
+ if (s.length < p) {
264
+ s = StringTools.lpad(s, "0", p);
265
+ }
266
+ const pointAfter = e + 1;
267
+ let out = [];
268
+ if (negative) {
269
+ const tail = out.length > 0 ? out[out.length - 1].charCodeAt(out[out.length - 1].length - 1) : NaN;
270
+ if (tail >= 55296 && tail <= 56319) {
271
+ throw new UStringException({ kind: "UnpairedSurrogate", unit: tail });
272
+ }
273
+ out.push("-");
274
+ }
275
+ if (pointAfter <= 0) {
276
+ const tail2 = out.length > 0 ? out[out.length - 1].charCodeAt(out[out.length - 1].length - 1) : NaN;
277
+ if (tail2 >= 55296 && tail2 <= 56319) {
278
+ throw new UStringException({ kind: "UnpairedSurrogate", unit: tail2 });
279
+ }
280
+ out.push("0.");
281
+ for (let k = 0; k < -pointAfter; k += 1) {
282
+ const tail3 = out.length > 0 ? out[out.length - 1].charCodeAt(out[out.length - 1].length - 1) : NaN;
283
+ if (tail3 >= 55296 && tail3 <= 56319) {
284
+ throw new UStringException({ kind: "UnpairedSurrogate", unit: tail3 });
285
+ }
286
+ out.push("0");
287
+ }
288
+ const tail4 = out.length > 0 ? out[out.length - 1].charCodeAt(out[out.length - 1].length - 1) : NaN;
289
+ if (tail4 >= 55296 && tail4 <= 56319 && s.length > 0 && !(s.charCodeAt(0) >= 56320 && s.charCodeAt(0) <= 57343)) {
290
+ throw new UStringException({ kind: "UnpairedSurrogate", unit: tail4 });
291
+ }
292
+ if (s.length > 0) {
293
+ out.push(s);
294
+ }
295
+ }
296
+ else {
297
+ if (pointAfter >= p) {
298
+ const tail5 = out.length > 0 ? out[out.length - 1].charCodeAt(out[out.length - 1].length - 1) : NaN;
299
+ if (tail5 >= 55296 && tail5 <= 56319 && s.length > 0 && !(s.charCodeAt(0) >= 56320 && s.charCodeAt(0) <= 57343)) {
300
+ throw new UStringException({ kind: "UnpairedSurrogate", unit: tail5 });
301
+ }
302
+ if (s.length > 0) {
303
+ out.push(s);
304
+ }
305
+ for (let k2 = p; k2 < pointAfter; k2 += 1) {
306
+ const tail6 = out.length > 0 ? out[out.length - 1].charCodeAt(out[out.length - 1].length - 1) : NaN;
307
+ if (tail6 >= 55296 && tail6 <= 56319) {
308
+ throw new UStringException({ kind: "UnpairedSurrogate", unit: tail6 });
309
+ }
310
+ out.push("0");
311
+ }
312
+ const tail7 = out.length > 0 ? out[out.length - 1].charCodeAt(out[out.length - 1].length - 1) : NaN;
313
+ if (tail7 >= 55296 && tail7 <= 56319) {
314
+ throw new UStringException({ kind: "UnpairedSurrogate", unit: tail7 });
315
+ }
316
+ out.push(".0");
317
+ }
318
+ else {
319
+ const tail8 = out.length > 0 ? out[out.length - 1].charCodeAt(out[out.length - 1].length - 1) : NaN;
320
+ if (tail8 >= 55296 && tail8 <= 56319 && s.substring(0, pointAfter).length > 0 && !(s.substring(0, pointAfter).charCodeAt(0) >= 56320 && s.substring(0, pointAfter).charCodeAt(0) <= 57343)) {
321
+ throw new UStringException({ kind: "UnpairedSurrogate", unit: tail8 });
322
+ }
323
+ if (s.substring(0, pointAfter).length > 0) {
324
+ out.push(s.substring(0, pointAfter));
325
+ }
326
+ const tail9 = out.length > 0 ? out[out.length - 1].charCodeAt(out[out.length - 1].length - 1) : NaN;
327
+ if (tail9 >= 55296 && tail9 <= 56319) {
328
+ throw new UStringException({ kind: "UnpairedSurrogate", unit: tail9 });
329
+ }
330
+ out.push(".");
331
+ const tail10 = out.length > 0 ? out[out.length - 1].charCodeAt(out[out.length - 1].length - 1) : NaN;
332
+ if (tail10 >= 55296 && tail10 <= 56319 && s.substring(pointAfter).length > 0 && !(s.substring(pointAfter).charCodeAt(0) >= 56320 && s.substring(pointAfter).charCodeAt(0) <= 57343)) {
333
+ throw new UStringException({ kind: "UnpairedSurrogate", unit: tail10 });
334
+ }
335
+ if (s.substring(pointAfter).length > 0) {
336
+ out.push(s.substring(pointAfter));
337
+ }
338
+ }
339
+ }
340
+ const tail11 = out.length > 0 ? out[out.length - 1].charCodeAt(out[out.length - 1].length - 1) : NaN;
341
+ if (tail11 >= 55296 && tail11 <= 56319) {
342
+ throw new UStringException({ kind: "UnpairedSurrogate", unit: tail11 });
343
+ }
344
+ return out.join("");
345
+ }
346
+ static renderBool(value) {
347
+ return TestTraceRender.cap(TraceFormat.valueBool(value));
348
+ }
349
+ static renderNull() {
350
+ return "-";
351
+ }
352
+ static renderIntArray(values) {
353
+ let output = [];
354
+ const tail12 = output.length > 0 ? output[output.length - 1].charCodeAt(output[output.length - 1].length - 1) : NaN;
355
+ if (tail12 >= 55296 && tail12 <= 56319) {
356
+ throw new UStringException({ kind: "UnpairedSurrogate", unit: tail12 });
357
+ }
358
+ output.push("[");
359
+ let index = 0;
360
+ while (index < values.length) {
361
+ if (index > 0) {
362
+ const tail13 = output.length > 0 ? output[output.length - 1].charCodeAt(output[output.length - 1].length - 1) : NaN;
363
+ if (tail13 >= 55296 && tail13 <= 56319) {
364
+ throw new UStringException({ kind: "UnpairedSurrogate", unit: tail13 });
365
+ }
366
+ output.push(", ");
367
+ }
368
+ const tail14 = output.length > 0 ? output[output.length - 1].charCodeAt(output[output.length - 1].length - 1) : NaN;
369
+ if (tail14 >= 55296 && tail14 <= 56319 && TestTraceRender.renderInt(values[index]).length > 0 && !(TestTraceRender.renderInt(values[index]).charCodeAt(0) >= 56320 && TestTraceRender.renderInt(values[index]).charCodeAt(0) <= 57343)) {
370
+ throw new UStringException({ kind: "UnpairedSurrogate", unit: tail14 });
371
+ }
372
+ if (TestTraceRender.renderInt(values[index]).length > 0) {
373
+ output.push(TestTraceRender.renderInt(values[index]));
374
+ }
375
+ index += 1;
376
+ }
377
+ const tail15 = output.length > 0 ? output[output.length - 1].charCodeAt(output[output.length - 1].length - 1) : NaN;
378
+ if (tail15 >= 55296 && tail15 <= 56319) {
379
+ throw new UStringException({ kind: "UnpairedSurrogate", unit: tail15 });
380
+ }
381
+ output.push("]");
382
+ const tail16 = output.length > 0 ? output[output.length - 1].charCodeAt(output[output.length - 1].length - 1) : NaN;
383
+ if (tail16 >= 55296 && tail16 <= 56319) {
384
+ throw new UStringException({ kind: "UnpairedSurrogate", unit: tail16 });
385
+ }
386
+ const text = output.join("");
387
+ return TestTraceRender.cap(text);
388
+ }
389
+ static renderStringArray(values) {
390
+ let output = [];
391
+ const tail17 = output.length > 0 ? output[output.length - 1].charCodeAt(output[output.length - 1].length - 1) : NaN;
392
+ if (tail17 >= 55296 && tail17 <= 56319) {
393
+ throw new UStringException({ kind: "UnpairedSurrogate", unit: tail17 });
394
+ }
395
+ output.push("[");
396
+ let index = 0;
397
+ while (index < values.length) {
398
+ if (index > 0) {
399
+ const tail18 = output.length > 0 ? output[output.length - 1].charCodeAt(output[output.length - 1].length - 1) : NaN;
400
+ if (tail18 >= 55296 && tail18 <= 56319) {
401
+ throw new UStringException({ kind: "UnpairedSurrogate", unit: tail18 });
402
+ }
403
+ output.push(", ");
404
+ }
405
+ const tail19 = output.length > 0 ? output[output.length - 1].charCodeAt(output[output.length - 1].length - 1) : NaN;
406
+ if (tail19 >= 55296 && tail19 <= 56319 && TestTraceRender.renderString(values[index]).length > 0 && !(TestTraceRender.renderString(values[index]).charCodeAt(0) >= 56320 && TestTraceRender.renderString(values[index]).charCodeAt(0) <= 57343)) {
407
+ throw new UStringException({ kind: "UnpairedSurrogate", unit: tail19 });
408
+ }
409
+ if (TestTraceRender.renderString(values[index]).length > 0) {
410
+ output.push(TestTraceRender.renderString(values[index]));
411
+ }
412
+ index += 1;
413
+ }
414
+ const tail20 = output.length > 0 ? output[output.length - 1].charCodeAt(output[output.length - 1].length - 1) : NaN;
415
+ if (tail20 >= 55296 && tail20 <= 56319) {
416
+ throw new UStringException({ kind: "UnpairedSurrogate", unit: tail20 });
417
+ }
418
+ output.push("]");
419
+ const tail21 = output.length > 0 ? output[output.length - 1].charCodeAt(output[output.length - 1].length - 1) : NaN;
420
+ if (tail21 >= 55296 && tail21 <= 56319) {
421
+ throw new UStringException({ kind: "UnpairedSurrogate", unit: tail21 });
422
+ }
423
+ const text = output.join("");
424
+ return TestTraceRender.cap(text);
425
+ }
426
+ static legacyListText(parts) {
427
+ return `[${parts.join(", ")}]`;
428
+ }
429
+ static canonicalNumbers(value) {
430
+ return TestTraceRender.stripWholeFraction(TestTraceRender.expandScientific(value));
431
+ }
432
+ static cap(value) {
433
+ const canonical = TestTraceRender.canonicalNumbers(value);
434
+ if (canonical.length <= TestTraceRender.MAX_OPERAND_CHARS) {
435
+ return canonical;
436
+ }
437
+ return canonical.substring(0, TestTraceRender.MAX_OPERAND_CHARS) + "~" + canonical.length + "#" + TestTraceRender.fnv1a(canonical);
438
+ }
439
+ static escape(value) {
440
+ let output = "";
441
+ let index = 0;
442
+ while (index < value.length) {
443
+ const codeUnit = (Number.isNaN(value.charCodeAt(index)) ? null : value.charCodeAt(index));
444
+ if (codeUnit === 0) {
445
+ output += "\\u0000";
446
+ }
447
+ else {
448
+ output += TraceFormat.escapeText(value.substring(index, index + 1));
449
+ }
450
+ index += 1;
451
+ }
452
+ return output;
453
+ }
454
+ static expandScientific(value) {
455
+ let output = [];
456
+ let copied = 0;
457
+ let index = 0;
458
+ while (index < value.length) {
459
+ const codeUnit = (Number.isNaN(value.charCodeAt(index)) ? null : value.charCodeAt(index));
460
+ if (codeUnit !== 69 && codeUnit !== 101) {
461
+ index += 1;
462
+ continue;
463
+ }
464
+ const match = TestTraceRender.scientificMatch(value, index, copied);
465
+ if (match === null) {
466
+ index += 1;
467
+ continue;
468
+ }
469
+ const tail22 = output.length > 0 ? output[output.length - 1].charCodeAt(output[output.length - 1].length - 1) : NaN;
470
+ if (tail22 >= 55296 && tail22 <= 56319 && value.substring(copied, match.start).length > 0 && !(value.substring(copied, match.start).charCodeAt(0) >= 56320 && value.substring(copied, match.start).charCodeAt(0) <= 57343)) {
471
+ throw new UStringException({ kind: "UnpairedSurrogate", unit: tail22 });
472
+ }
473
+ if (value.substring(copied, match.start).length > 0) {
474
+ output.push(value.substring(copied, match.start));
475
+ }
476
+ const tail23 = output.length > 0 ? output[output.length - 1].charCodeAt(output[output.length - 1].length - 1) : NaN;
477
+ if (tail23 >= 55296 && tail23 <= 56319 && TestTraceRender.expandMantissa(value.substring(match.start, match.mantissaEnd), match.exponent).length > 0 && !(TestTraceRender.expandMantissa(value.substring(match.start, match.mantissaEnd), match.exponent).charCodeAt(0) >= 56320 && TestTraceRender.expandMantissa(value.substring(match.start, match.mantissaEnd), match.exponent).charCodeAt(0) <= 57343)) {
478
+ throw new UStringException({ kind: "UnpairedSurrogate", unit: tail23 });
479
+ }
480
+ if (TestTraceRender.expandMantissa(value.substring(match.start, match.mantissaEnd), match.exponent).length > 0) {
481
+ output.push(TestTraceRender.expandMantissa(value.substring(match.start, match.mantissaEnd), match.exponent));
482
+ }
483
+ copied = match.end;
484
+ index = match.end;
485
+ }
486
+ const tail24 = output.length > 0 ? output[output.length - 1].charCodeAt(output[output.length - 1].length - 1) : NaN;
487
+ if (tail24 >= 55296 && tail24 <= 56319 && value.substring(copied, value.length).length > 0 && !(value.substring(copied, value.length).charCodeAt(0) >= 56320 && value.substring(copied, value.length).charCodeAt(0) <= 57343)) {
488
+ throw new UStringException({ kind: "UnpairedSurrogate", unit: tail24 });
489
+ }
490
+ if (value.substring(copied, value.length).length > 0) {
491
+ output.push(value.substring(copied, value.length));
492
+ }
493
+ const tail25 = output.length > 0 ? output[output.length - 1].charCodeAt(output[output.length - 1].length - 1) : NaN;
494
+ if (tail25 >= 55296 && tail25 <= 56319) {
495
+ throw new UStringException({ kind: "UnpairedSurrogate", unit: tail25 });
496
+ }
497
+ return output.join("");
498
+ }
499
+ static stripWholeFraction(value) {
500
+ let output = [];
501
+ let index = 0;
502
+ while (index < value.length) {
503
+ if ((Number.isNaN(value.charCodeAt(index)) ? null : value.charCodeAt(index)) === 46 && index > 0 && TestTraceRender.isDigit(readUnit(value, index - 1))) {
504
+ let cursor = index + 1;
505
+ while (cursor < value.length && (Number.isNaN(value.charCodeAt(cursor)) ? null : value.charCodeAt(cursor)) === 48) {
506
+ cursor += 1;
507
+ }
508
+ if (cursor > index + 1 && (cursor === value.length || !TestTraceRender.isDigit((Number.isNaN(value.charCodeAt(cursor)) ? null : value.charCodeAt(cursor))) && (Number.isNaN(value.charCodeAt(cursor)) ? null : value.charCodeAt(cursor)) !== 46)) {
509
+ index = cursor;
510
+ continue;
511
+ }
512
+ }
513
+ const tail26 = output.length > 0 ? output[output.length - 1].charCodeAt(output[output.length - 1].length - 1) : NaN;
514
+ if (tail26 >= 55296 && tail26 <= 56319 && value.substring(index, index + 1).length > 0 && !(value.substring(index, index + 1).charCodeAt(0) >= 56320 && value.substring(index, index + 1).charCodeAt(0) <= 57343)) {
515
+ throw new UStringException({ kind: "UnpairedSurrogate", unit: tail26 });
516
+ }
517
+ if (value.substring(index, index + 1).length > 0) {
518
+ output.push(value.substring(index, index + 1));
519
+ }
520
+ index += 1;
521
+ }
522
+ const tail27 = output.length > 0 ? output[output.length - 1].charCodeAt(output[output.length - 1].length - 1) : NaN;
523
+ if (tail27 >= 55296 && tail27 <= 56319) {
524
+ throw new UStringException({ kind: "UnpairedSurrogate", unit: tail27 });
525
+ }
526
+ return output.join("");
527
+ }
528
+ static scientificMatch(s, eIndex, floor) {
529
+ let i = eIndex + 1;
530
+ if (i < s.length && ((Number.isNaN(s.charCodeAt(i)) ? null : s.charCodeAt(i)) === 43 || (Number.isNaN(s.charCodeAt(i)) ? null : s.charCodeAt(i)) === 45)) {
531
+ i += 1;
532
+ }
533
+ const digitsStart = i;
534
+ while (i < s.length && TestTraceRender.isDigit((Number.isNaN(s.charCodeAt(i)) ? null : s.charCodeAt(i)))) {
535
+ i += 1;
536
+ }
537
+ if (i - digitsStart > 3) {
538
+ return null;
539
+ }
540
+ if (i === digitsStart) {
541
+ return null;
542
+ }
543
+ const end = i;
544
+ const exponent = TestTraceRender.parseExponent(s, eIndex + 1, end);
545
+ const last = eIndex - 1;
546
+ if (last < floor || !TestTraceRender.isDigit((Number.isNaN(s.charCodeAt(last)) ? null : s.charCodeAt(last)))) {
547
+ return null;
548
+ }
549
+ let runStart = last;
550
+ while (runStart > floor && TestTraceRender.isDigit(readUnit(s, runStart - 1))) {
551
+ runStart -= 1;
552
+ }
553
+ let lead = -1;
554
+ if (runStart > floor + 1 && readUnit(s, runStart - 1) === 46 && TestTraceRender.isDigit(readUnit(s, runStart - 2))) {
555
+ lead = runStart - 2;
556
+ }
557
+ else {
558
+ if (runStart !== last) {
559
+ return null;
560
+ }
561
+ lead = last;
562
+ }
563
+ if (lead > 0 && readUnit(s, lead - 1) === 45 && lead - 1 >= floor) {
564
+ const beforeMinus = lead >= 2 && (TestTraceRender.isDigit(readUnit(s, lead - 2)) || readUnit(s, lead - 2) === 46);
565
+ if (!beforeMinus) {
566
+ return new ScientificMatch(lead - 1, eIndex, end, exponent);
567
+ }
568
+ return new ScientificMatch(lead, eIndex, end, exponent);
569
+ }
570
+ const beforeDigit = lead > 0 && (TestTraceRender.isDigit(readUnit(s, lead - 1)) || readUnit(s, lead - 1) === 46);
571
+ if (!beforeDigit) {
572
+ return new ScientificMatch(lead, eIndex, end, exponent);
573
+ }
574
+ return null;
575
+ }
576
+ static parseExponent(s, from, to) {
577
+ let index = from;
578
+ let negative = false;
579
+ if (index < to && ((Number.isNaN(s.charCodeAt(index)) ? null : s.charCodeAt(index)) === 43 || (Number.isNaN(s.charCodeAt(index)) ? null : s.charCodeAt(index)) === 45)) {
580
+ negative = (Number.isNaN(s.charCodeAt(index)) ? null : s.charCodeAt(index)) === 45;
581
+ index += 1;
582
+ }
583
+ let value = 0;
584
+ while (index < to) {
585
+ value = value * 10 + (Number.isNaN(s.charCodeAt(index)) ? null : s.charCodeAt(index)) - 48;
586
+ index += 1;
587
+ }
588
+ return (negative ? -value : value);
589
+ }
590
+ static expandMantissa(mantissa, exponent) {
591
+ let sign = "";
592
+ let value = mantissa;
593
+ if (value.length > 0 && (Number.isNaN(value.charCodeAt(0)) ? null : value.charCodeAt(0)) === 45) {
594
+ sign = "-";
595
+ value = value.substring(1);
596
+ }
597
+ let dotIndex = -1;
598
+ let index = 0;
599
+ while (index < value.length) {
600
+ if ((Number.isNaN(value.charCodeAt(index)) ? null : value.charCodeAt(index)) === 46) {
601
+ dotIndex = index;
602
+ break;
603
+ }
604
+ index += 1;
605
+ }
606
+ let digits = (dotIndex < 0 ? value : value.substring(0, dotIndex) + value.substring(dotIndex + 1));
607
+ while (digits.length > 1 && readUnit(digits, digits.length - 1) === 48) {
608
+ digits = digits.substring(0, digits.length - 1);
609
+ }
610
+ if (exponent > 400 || exponent < -400) {
611
+ return sign + value;
612
+ }
613
+ const decimalPosition = (dotIndex < 0 ? value.length : dotIndex) + exponent;
614
+ if (decimalPosition <= 0) {
615
+ return sign + "0." + TestTraceRender.zeroes(-decimalPosition) + digits;
616
+ }
617
+ if (decimalPosition >= digits.length) {
618
+ return sign + digits + TestTraceRender.zeroes(decimalPosition - digits.length);
619
+ }
620
+ return sign + digits.substring(0, decimalPosition) + "." + digits.substring(decimalPosition);
621
+ }
622
+ static zeroes(count) {
623
+ let output = [];
624
+ for (let index = 0; index < count; index += 1) {
625
+ const tail28 = output.length > 0 ? output[output.length - 1].charCodeAt(output[output.length - 1].length - 1) : NaN;
626
+ if (tail28 >= 55296 && tail28 <= 56319) {
627
+ throw new UStringException({ kind: "UnpairedSurrogate", unit: tail28 });
628
+ }
629
+ output.push("0");
630
+ }
631
+ const tail29 = output.length > 0 ? output[output.length - 1].charCodeAt(output[output.length - 1].length - 1) : NaN;
632
+ if (tail29 >= 55296 && tail29 <= 56319) {
633
+ throw new UStringException({ kind: "UnpairedSurrogate", unit: tail29 });
634
+ }
635
+ return output.join("");
636
+ }
637
+ static isDigit(codeUnit) {
638
+ return codeUnit >= 48 && codeUnit <= 57;
639
+ }
640
+ static fnv1a(value) {
641
+ let hash = -2128831035;
642
+ let index = 0;
643
+ while (index < value.length) {
644
+ hash = hash ^ (Number.isNaN(value.charCodeAt(index)) ? null : value.charCodeAt(index));
645
+ hash = TestTraceRender.multiplyFNVPrime(hash);
646
+ index += 1;
647
+ }
648
+ const first = (hash >>> 24) & 255;
649
+ const second = (hash >>> 16) & 255;
650
+ const third = (hash >>> 8) & 255;
651
+ const fourth = hash & 255;
652
+ let output = TestTraceRender.hexByte(first) + TestTraceRender.hexByte(second) + TestTraceRender.hexByte(third) + TestTraceRender.hexByte(fourth);
653
+ while (output.length > 1 && (Number.isNaN(output.charCodeAt(0)) ? null : output.charCodeAt(0)) === 48) {
654
+ output = output.substring(1);
655
+ }
656
+ return output;
657
+ }
658
+ static multiplyFNVPrime(value) {
659
+ const low = value & 65535;
660
+ const high = (value >>> 16) & 65535;
661
+ const lowProduct = low * 403;
662
+ const highProduct = high * 403 + low * 256 + Math.trunc(lowProduct / 65536);
663
+ return ((highProduct & 65535) << 16) | lowProduct & 65535;
664
+ }
665
+ static hexByte(value) {
666
+ return TestTraceRender.HEX.substring((value >>> 4) & 15, ((value >>> 4) & 15) + 1) + TestTraceRender.HEX.substring(value & 15, (value & 15) + 1);
667
+ }
668
+ }
669
+ export class DecimalShape {
670
+ digits;
671
+ position;
672
+ extended;
673
+ constructor(digits, position, extended) {
674
+ this.digits = digits;
675
+ this.position = position;
676
+ this.extended = extended;
677
+ }
678
+ }
679
+ export class ScientificMatch {
680
+ start;
681
+ mantissaEnd;
682
+ end;
683
+ exponent;
684
+ constructor(start, mantissaEnd, end, exponent) {
685
+ this.start = start;
686
+ this.mantissaEnd = mantissaEnd;
687
+ this.end = end;
688
+ this.exponent = exponent;
689
+ }
690
+ }