@tiqian/protocol 0.0.0-stage.1 → 0.1.0-alpha.10

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,251 @@
1
+ // Generated by the reflaxe TypeScript target. Do not edit.
2
+ import { UnicodeNumber } from "./../core/UnicodeNumber.js";
3
+ import { UnicodeScriptEvidenceClassifier } from "./../core/UnicodeScriptEvidenceClassifier.js";
4
+ import { UnicodeWordCharacter } from "./../core/UnicodeWordCharacter.js";
5
+ import { FontRoleContext } from "./../font/FontRoleContext.js";
6
+ import { ContextualQuoteRoleResolver } from "./ContextualQuoteRoleResolver.js";
7
+ import { SortedTable, readUnit } from "../../../runtime.js";
8
+ export class QuotePair {
9
+ openIndex;
10
+ closeIndex;
11
+ quoteType;
12
+ constructor(openIndex, closeIndex, quoteType) {
13
+ this.openIndex = openIndex;
14
+ this.closeIndex = closeIndex;
15
+ this.quoteType = quoteType;
16
+ }
17
+ toString() {
18
+ return `QuotePair(openIndex=${this.openIndex}, closeIndex=${this.closeIndex}, quoteType=${this.quoteType.kind})`;
19
+ }
20
+ }
21
+ export function QuotePairquoteTypeOrder(v) {
22
+ if (v.kind === "Double")
23
+ return 0;
24
+ if (v.kind === "Single")
25
+ return 1;
26
+ return 0;
27
+ }
28
+ export function compareQuotePair(a, b) {
29
+ if (a === b)
30
+ return 0;
31
+ if (a.openIndex !== b.openIndex)
32
+ return a.openIndex - b.openIndex;
33
+ if (a.closeIndex !== b.closeIndex)
34
+ return a.closeIndex - b.closeIndex;
35
+ if (QuotePairquoteTypeOrder(a.quoteType) !== QuotePairquoteTypeOrder(b.quoteType))
36
+ return QuotePairquoteTypeOrder(a.quoteType) - QuotePairquoteTypeOrder(b.quoteType);
37
+ return 0;
38
+ }
39
+ export class QuoteRoleDecision {
40
+ index;
41
+ role;
42
+ source;
43
+ reason;
44
+ constructor(index, role, source, reason) {
45
+ this.index = index;
46
+ this.role = role;
47
+ this.source = source;
48
+ this.reason = reason;
49
+ }
50
+ toString() {
51
+ return `QuoteRoleDecision(index=${this.index}, role=${this.role.kind}, source=${this.source}, reason=${this.reason})`;
52
+ }
53
+ }
54
+ export function QuoteRoleDecisionroleOrder(v) {
55
+ if (v.kind === "CjkText")
56
+ return 0;
57
+ if (v.kind === "CjkPunctuation")
58
+ return 1;
59
+ if (v.kind === "LatinText")
60
+ return 2;
61
+ if (v.kind === "Symbol")
62
+ return 3;
63
+ if (v.kind === "Emoji")
64
+ return 4;
65
+ if (v.kind === "Unknown")
66
+ return 5;
67
+ return 0;
68
+ }
69
+ export function compareQuoteRoleDecision(a, b) {
70
+ if (a === b)
71
+ return 0;
72
+ if (a.index !== b.index)
73
+ return a.index - b.index;
74
+ if (QuoteRoleDecisionroleOrder(a.role) !== QuoteRoleDecisionroleOrder(b.role))
75
+ return QuoteRoleDecisionroleOrder(a.role) - QuoteRoleDecisionroleOrder(b.role);
76
+ if (a.source !== b.source)
77
+ return a.source < b.source ? -1 : 1;
78
+ if (a.reason !== b.reason)
79
+ return a.reason < b.reason ? -1 : 1;
80
+ return 0;
81
+ }
82
+ export class QuotePairAnalyzer {
83
+ constructor() {
84
+ }
85
+ analyze(text) {
86
+ const stack = [];
87
+ const pairs = [];
88
+ let index = 0;
89
+ while (index < text.length) {
90
+ const c = (Number.isNaN(text.charCodeAt(index)) ? null : text.charCodeAt(index));
91
+ if (c === 8220) {
92
+ stack.push({ index, type: QuoteType.Double });
93
+ }
94
+ else {
95
+ if (c === 8216) {
96
+ stack.push({ index, type: QuoteType.Single });
97
+ }
98
+ else {
99
+ if (c === 8221) {
100
+ if (stack.length > 0 && stack[stack.length - 1].type.kind === "Double") {
101
+ const match = stack.pop();
102
+ pairs.push(new QuotePair(match.index, index, QuoteType.Double));
103
+ }
104
+ }
105
+ else {
106
+ if (c === 8217) {
107
+ if (!QuotePairAnalyzer.isNonCjkInWordApostrophe(text, index) && stack.length > 0 && stack[stack.length - 1].type.kind === "Single") {
108
+ const match2 = stack.pop();
109
+ pairs.push(new QuotePair(match2.index, index, QuoteType.Single));
110
+ }
111
+ }
112
+ }
113
+ }
114
+ }
115
+ index++;
116
+ }
117
+ return pairs;
118
+ }
119
+ classifyPairs(text, pairs, context) {
120
+ context = context ?? null;
121
+ return QuotePairAnalyzer.mapDecisions(this.classifyQuoteRoles(text, pairs, context));
122
+ }
123
+ classifyPairsWithClassifier(text, pairs, _fontRoleClassifier, context) {
124
+ context = context ?? null;
125
+ return this.classifyPairs(text, pairs, context);
126
+ }
127
+ classifyQuoteRoles(text, pairs, context) {
128
+ context = context ?? null;
129
+ return new ContextualQuoteRoleResolver(text, pairs, ((context === null ? new FontRoleContext("zh-Hans", null) : context))).resolve();
130
+ }
131
+ classifyQuoteRolesWithClassifier(text, pairs, _fontRoleClassifier, context) {
132
+ context = context ?? null;
133
+ return this.classifyQuoteRoles(text, pairs, context);
134
+ }
135
+ static mapDecisions(decisions) {
136
+ const out = SortedTable.mapBuilder(SortedTable.compareInts);
137
+ for (let pipeline_index = 0, count = decisions.length; pipeline_index < count; pipeline_index += 1) {
138
+ const d = decisions[pipeline_index];
139
+ out.put(d.index, d.role);
140
+ }
141
+ return out.build();
142
+ }
143
+ static isNonCjkInWordApostrophe(text, index) {
144
+ const before = QuotePairAnalyzer.codePointBefore(text, index);
145
+ if (before === null) {
146
+ return false;
147
+ }
148
+ const after = QuotePairAnalyzer.codePointAtOrNull(text, index + 1);
149
+ if (after === null) {
150
+ return false;
151
+ }
152
+ return QuotePairAnalyzer.isNonCjkWordCharacter((before)) && QuotePairAnalyzer.isNonCjkWordCharacter((after)) && (QuotePairAnalyzer.isNonCjkNonNumericWordCharacter((before)) || QuotePairAnalyzer.isNonCjkNonNumericWordCharacter((after)));
153
+ }
154
+ static isDigitBoundClosingQuote(text, index) {
155
+ return ((Number.isNaN(text.charCodeAt(index)) ? null : text.charCodeAt(index)) === 8217 || (Number.isNaN(text.charCodeAt(index)) ? null : text.charCodeAt(index)) === 8221) && QuotePairAnalyzer.codePointBefore(text, index) !== null && UnicodeNumber.contains((QuotePairAnalyzer.codePointBefore(text, index)));
156
+ }
157
+ static isNonCjkWordInternalQuotePair(text, pair) {
158
+ const before = QuotePairAnalyzer.codePointBefore(text, pair.openIndex);
159
+ const after = QuotePairAnalyzer.codePointAtOrNull(text, pair.closeIndex + 1);
160
+ if (before === null || after === null || !QuotePairAnalyzer.isNonCjkNonNumericWordCharacter((before)) || !QuotePairAnalyzer.isNonCjkNonNumericWordCharacter((after))) {
161
+ return false;
162
+ }
163
+ let index = pair.openIndex + 1;
164
+ while (index < pair.closeIndex) {
165
+ const cp = QuotePairAnalyzer.codePointAtOrNull(text, index);
166
+ if (cp === null || !QuotePairAnalyzer.isNonCjkWordCharacter((cp))) {
167
+ return false;
168
+ }
169
+ index += (cp > 65535 ? 2 : 1);
170
+ }
171
+ return true;
172
+ }
173
+ static isNonCjkWordCharacter(cp) {
174
+ return UnicodeWordCharacter.contains(cp) && UnicodeScriptEvidenceClassifier.classify(cp).kind !== "EastAsian";
175
+ }
176
+ static isNonCjkNonNumericWordCharacter(cp) {
177
+ return QuotePairAnalyzer.isNonCjkWordCharacter(cp) && !UnicodeNumber.contains(cp) && !QuotePairAnalyzer.isFullwidthEastAsianWidth(cp);
178
+ }
179
+ static isFullwidthEastAsianWidth(cp) {
180
+ return cp === 12288 || cp >= 65281 && cp <= 65376 || cp >= 65504 && cp <= 65510;
181
+ }
182
+ static codePointBefore(text, index) {
183
+ if (index <= 0) {
184
+ return null;
185
+ }
186
+ const low = readUnit(text, index - 1);
187
+ if (low < 56320 || low > 57343 || index < 2) {
188
+ return low;
189
+ }
190
+ const high = readUnit(text, index - 2);
191
+ if (high < 55296 || high > 56319) {
192
+ return low;
193
+ }
194
+ return 65536 + (high - 55296 << 10) + (low - 56320);
195
+ }
196
+ static codePointAtOrNull(text, index) {
197
+ if (index < 0 || index >= text.length) {
198
+ return null;
199
+ }
200
+ const high = (Number.isNaN(text.charCodeAt(index)) ? null : text.charCodeAt(index));
201
+ if (high < 55296 || high > 56319 || index + 1 >= text.length) {
202
+ return high;
203
+ }
204
+ const low = readUnit(text, index + 1);
205
+ if (low < 56320 || low > 57343) {
206
+ return high;
207
+ }
208
+ return 65536 + (high - 55296 << 10) + (low - 56320);
209
+ }
210
+ }
211
+ export class QuotePairAwareFontRoleClassifier {
212
+ delegate;
213
+ quoteRoles;
214
+ constructor(delegate, quoteRoles) {
215
+ this.delegate = delegate;
216
+ this.quoteRoles = quoteRoles;
217
+ }
218
+ classify(text, range, context) {
219
+ context = context ?? null;
220
+ const role = this.quoteRoles.get(range.start);
221
+ return (role === null ? this.delegate.classify(text, range, context) : role);
222
+ }
223
+ static withContextualQuoteRoles(base, text, context) {
224
+ context = context ?? null;
225
+ const analyzer = new QuotePairAnalyzer();
226
+ const decisions = analyzer.classifyQuoteRoles(text, analyzer.analyze(text), context);
227
+ const count2 = decisions.length;
228
+ if (count2 === 0) {
229
+ return base;
230
+ }
231
+ const roles = SortedTable.mapBuilder(SortedTable.compareInts);
232
+ for (let pipeline_index = 0; pipeline_index < count2; pipeline_index += 1) {
233
+ const decision = decisions[pipeline_index];
234
+ roles.put(decision.index, decision.role);
235
+ }
236
+ return new QuotePairAwareFontRoleClassifier(base, roles.build());
237
+ }
238
+ }
239
+ export const QuoteType = Object.freeze({
240
+ Double: Object.freeze({ kind: "Double" }),
241
+ Single: Object.freeze({ kind: "Single" })
242
+ });
243
+ export function compareQuoteType(a, b) {
244
+ if (a === b)
245
+ return 0;
246
+ if (a.kind === "Double")
247
+ return 0 - (b.kind === "Double" ? 0 : 0);
248
+ if (a.kind === "Single")
249
+ return 1 - (b.kind === "Single" ? 1 : 0);
250
+ return 0;
251
+ }
@@ -0,0 +1,20 @@
1
+ export interface Allowed {
2
+ readonly kind: "Allowed";
3
+ }
4
+ export interface Forbidden {
5
+ readonly kind: "Forbidden";
6
+ }
7
+ export interface Required {
8
+ readonly kind: "Required";
9
+ }
10
+ export interface Problematic {
11
+ readonly kind: "Problematic";
12
+ }
13
+ export type BreakKind = Allowed | Forbidden | Required | Problematic;
14
+ export declare const BreakKind: Readonly<{
15
+ Allowed: Readonly<Allowed>;
16
+ Forbidden: Readonly<Forbidden>;
17
+ Required: Readonly<Required>;
18
+ Problematic: Readonly<Problematic>;
19
+ }>;
20
+ export declare function compareBreakKind(a: BreakKind, b: BreakKind): number;
@@ -0,0 +1,20 @@
1
+ // Generated by the reflaxe TypeScript target. Do not edit.
2
+ export const BreakKind = Object.freeze({
3
+ Allowed: Object.freeze({ kind: "Allowed" }),
4
+ Forbidden: Object.freeze({ kind: "Forbidden" }),
5
+ Required: Object.freeze({ kind: "Required" }),
6
+ Problematic: Object.freeze({ kind: "Problematic" })
7
+ });
8
+ export function compareBreakKind(a, b) {
9
+ if (a === b)
10
+ return 0;
11
+ if (a.kind === "Allowed")
12
+ return 0 - (b.kind === "Allowed" ? 0 : 0);
13
+ if (a.kind === "Forbidden")
14
+ return 1 - (b.kind === "Forbidden" ? 1 : 0);
15
+ if (a.kind === "Required")
16
+ return 2 - (b.kind === "Required" ? 2 : 0);
17
+ if (a.kind === "Problematic")
18
+ return 3 - (b.kind === "Problematic" ? 3 : 0);
19
+ return 0;
20
+ }
@@ -0,0 +1,55 @@
1
+ import { type EncodeResult } from "./EncodeResult.js";
2
+ import { type WireValue } from "./WireValue.js";
3
+ export declare class Canonical {
4
+ static digest(data: Uint8Array): Uint8Array;
5
+ static encode(input: WireValue, kind: number): EncodeResult;
6
+ static member(input: WireValue, name: string): WireValue;
7
+ private static memberOfFields;
8
+ private static canonicalF64;
9
+ private static numberMember;
10
+ private static numberField;
11
+ private static listMember;
12
+ private static isWireNull;
13
+ private static isWireArr;
14
+ private static isWireObj;
15
+ private static arrOf;
16
+ private static arrOfNullable;
17
+ private static objFields;
18
+ private static isBadShape;
19
+ private static shapeItems;
20
+ private static encodeSemantics;
21
+ private static encodeTextSpans;
22
+ private static encodeInlineBoxes;
23
+ private static familiesPresent;
24
+ private static familiesOf;
25
+ private static familiesFromList;
26
+ private static italicPresent;
27
+ private static italicValueOf;
28
+ private static isWireBool;
29
+ private static boolOf;
30
+ private static encodeAttributes;
31
+ private static encodeObjectAttributes;
32
+ }
33
+ export declare class Writer {
34
+ private readonly buf;
35
+ constructor();
36
+ begin(kind: number): void;
37
+ private writeMagic;
38
+ u8(value: number): void;
39
+ u32(value: number): void;
40
+ f64(value: number): void;
41
+ private emitBits;
42
+ str(value: string): void;
43
+ finish(): Uint8Array;
44
+ }
45
+ export interface LAbsent {
46
+ readonly kind: "LAbsent";
47
+ }
48
+ export interface LArr {
49
+ readonly kind: "LArr";
50
+ readonly items: WireValue[];
51
+ }
52
+ export interface LBad {
53
+ readonly kind: "LBad";
54
+ }
55
+ export type ListShape = LAbsent | LArr | LBad;