LineBreak.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517
  1. /* @flow */
  2. 'use strict';
  3. Object.defineProperty(exports, "__esModule", { value: true });
  4. exports.LineBreaker = exports.inlineBreakOpportunities = exports.lineBreakAtIndex = exports.codePointsToCharacterClasses = exports.UnicodeTrie = exports.BREAK_ALLOWED = exports.BREAK_NOT_ALLOWED = exports.BREAK_MANDATORY = exports.classes = exports.LETTER_NUMBER_MODIFIER = void 0;
  5. var Trie_1 = require("./Trie");
  6. var linebreak_trie_1 = require("./linebreak-trie");
  7. var Util_1 = require("./Util");
  8. exports.LETTER_NUMBER_MODIFIER = 50;
  9. // Non-tailorable Line Breaking Classes
  10. var BK = 1; // Cause a line break (after)
  11. var CR = 2; // Cause a line break (after), except between CR and LF
  12. var LF = 3; // Cause a line break (after)
  13. var CM = 4; // Prohibit a line break between the character and the preceding character
  14. var NL = 5; // Cause a line break (after)
  15. var SG = 6; // Do not occur in well-formed text
  16. var WJ = 7; // Prohibit line breaks before and after
  17. var ZW = 8; // Provide a break opportunity
  18. var GL = 9; // Prohibit line breaks before and after
  19. var SP = 10; // Enable indirect line breaks
  20. var ZWJ = 11; // Prohibit line breaks within joiner sequences
  21. // Break Opportunities
  22. var B2 = 12; // Provide a line break opportunity before and after the character
  23. var BA = 13; // Generally provide a line break opportunity after the character
  24. var BB = 14; // Generally provide a line break opportunity before the character
  25. var HY = 15; // Provide a line break opportunity after the character, except in numeric context
  26. var CB = 16; // Provide a line break opportunity contingent on additional information
  27. // Characters Prohibiting Certain Breaks
  28. var CL = 17; // Prohibit line breaks before
  29. var CP = 18; // Prohibit line breaks before
  30. var EX = 19; // Prohibit line breaks before
  31. var IN = 20; // Allow only indirect line breaks between pairs
  32. var NS = 21; // Allow only indirect line breaks before
  33. var OP = 22; // Prohibit line breaks after
  34. var QU = 23; // Act like they are both opening and closing
  35. // Numeric Context
  36. var IS = 24; // Prevent breaks after any and before numeric
  37. var NU = 25; // Form numeric expressions for line breaking purposes
  38. var PO = 26; // Do not break following a numeric expression
  39. var PR = 27; // Do not break in front of a numeric expression
  40. var SY = 28; // Prevent a break before; and allow a break after
  41. // Other Characters
  42. var AI = 29; // Act like AL when the resolvedEAW is N; otherwise; act as ID
  43. var AL = 30; // Are alphabetic characters or symbols that are used with alphabetic characters
  44. var CJ = 31; // Treat as NS or ID for strict or normal breaking.
  45. var EB = 32; // Do not break from following Emoji Modifier
  46. var EM = 33; // Do not break from preceding Emoji Base
  47. var H2 = 34; // Form Korean syllable blocks
  48. var H3 = 35; // Form Korean syllable blocks
  49. var HL = 36; // Do not break around a following hyphen; otherwise act as Alphabetic
  50. var ID = 37; // Break before or after; except in some numeric context
  51. var JL = 38; // Form Korean syllable blocks
  52. var JV = 39; // Form Korean syllable blocks
  53. var JT = 40; // Form Korean syllable blocks
  54. var RI = 41; // Keep pairs together. For pairs; break before and after other classes
  55. var SA = 42; // Provide a line break opportunity contingent on additional, language-specific context analysis
  56. var XX = 43; // Have as yet unknown line breaking behavior or unassigned code positions
  57. var ea_OP = [0x2329, 0xff08];
  58. exports.classes = {
  59. BK: BK,
  60. CR: CR,
  61. LF: LF,
  62. CM: CM,
  63. NL: NL,
  64. SG: SG,
  65. WJ: WJ,
  66. ZW: ZW,
  67. GL: GL,
  68. SP: SP,
  69. ZWJ: ZWJ,
  70. B2: B2,
  71. BA: BA,
  72. BB: BB,
  73. HY: HY,
  74. CB: CB,
  75. CL: CL,
  76. CP: CP,
  77. EX: EX,
  78. IN: IN,
  79. NS: NS,
  80. OP: OP,
  81. QU: QU,
  82. IS: IS,
  83. NU: NU,
  84. PO: PO,
  85. PR: PR,
  86. SY: SY,
  87. AI: AI,
  88. AL: AL,
  89. CJ: CJ,
  90. EB: EB,
  91. EM: EM,
  92. H2: H2,
  93. H3: H3,
  94. HL: HL,
  95. ID: ID,
  96. JL: JL,
  97. JV: JV,
  98. JT: JT,
  99. RI: RI,
  100. SA: SA,
  101. XX: XX,
  102. };
  103. exports.BREAK_MANDATORY = '!';
  104. exports.BREAK_NOT_ALLOWED = '×';
  105. exports.BREAK_ALLOWED = '÷';
  106. exports.UnicodeTrie = Trie_1.createTrieFromBase64(linebreak_trie_1.base64);
  107. var ALPHABETICS = [AL, HL];
  108. var HARD_LINE_BREAKS = [BK, CR, LF, NL];
  109. var SPACE = [SP, ZW];
  110. var PREFIX_POSTFIX = [PR, PO];
  111. var LINE_BREAKS = HARD_LINE_BREAKS.concat(SPACE);
  112. var KOREAN_SYLLABLE_BLOCK = [JL, JV, JT, H2, H3];
  113. var HYPHEN = [HY, BA];
  114. var codePointsToCharacterClasses = function (codePoints, lineBreak) {
  115. if (lineBreak === void 0) { lineBreak = 'strict'; }
  116. var types = [];
  117. var indices = [];
  118. var categories = [];
  119. codePoints.forEach(function (codePoint, index) {
  120. var classType = exports.UnicodeTrie.get(codePoint);
  121. if (classType > exports.LETTER_NUMBER_MODIFIER) {
  122. categories.push(true);
  123. classType -= exports.LETTER_NUMBER_MODIFIER;
  124. }
  125. else {
  126. categories.push(false);
  127. }
  128. if (['normal', 'auto', 'loose'].indexOf(lineBreak) !== -1) {
  129. // U+2010, – U+2013, 〜 U+301C, ゠ U+30A0
  130. if ([0x2010, 0x2013, 0x301c, 0x30a0].indexOf(codePoint) !== -1) {
  131. indices.push(index);
  132. return types.push(CB);
  133. }
  134. }
  135. if (classType === CM || classType === ZWJ) {
  136. // LB10 Treat any remaining combining mark or ZWJ as AL.
  137. if (index === 0) {
  138. indices.push(index);
  139. return types.push(AL);
  140. }
  141. // LB9 Do not break a combining character sequence; treat it as if it has the line breaking class of
  142. // the base character in all of the following rules. Treat ZWJ as if it were CM.
  143. var prev = types[index - 1];
  144. if (LINE_BREAKS.indexOf(prev) === -1) {
  145. indices.push(indices[index - 1]);
  146. return types.push(prev);
  147. }
  148. indices.push(index);
  149. return types.push(AL);
  150. }
  151. indices.push(index);
  152. if (classType === CJ) {
  153. return types.push(lineBreak === 'strict' ? NS : ID);
  154. }
  155. if (classType === SA) {
  156. return types.push(AL);
  157. }
  158. if (classType === AI) {
  159. return types.push(AL);
  160. }
  161. // For supplementary characters, a useful default is to treat characters in the range 10000..1FFFD as AL
  162. // and characters in the ranges 20000..2FFFD and 30000..3FFFD as ID, until the implementation can be revised
  163. // to take into account the actual line breaking properties for these characters.
  164. if (classType === XX) {
  165. if ((codePoint >= 0x20000 && codePoint <= 0x2fffd) || (codePoint >= 0x30000 && codePoint <= 0x3fffd)) {
  166. return types.push(ID);
  167. }
  168. else {
  169. return types.push(AL);
  170. }
  171. }
  172. types.push(classType);
  173. });
  174. return [indices, types, categories];
  175. };
  176. exports.codePointsToCharacterClasses = codePointsToCharacterClasses;
  177. var isAdjacentWithSpaceIgnored = function (a, b, currentIndex, classTypes) {
  178. var current = classTypes[currentIndex];
  179. if (Array.isArray(a) ? a.indexOf(current) !== -1 : a === current) {
  180. var i = currentIndex;
  181. while (i <= classTypes.length) {
  182. i++;
  183. var next = classTypes[i];
  184. if (next === b) {
  185. return true;
  186. }
  187. if (next !== SP) {
  188. break;
  189. }
  190. }
  191. }
  192. if (current === SP) {
  193. var i = currentIndex;
  194. while (i > 0) {
  195. i--;
  196. var prev = classTypes[i];
  197. if (Array.isArray(a) ? a.indexOf(prev) !== -1 : a === prev) {
  198. var n = currentIndex;
  199. while (n <= classTypes.length) {
  200. n++;
  201. var next = classTypes[n];
  202. if (next === b) {
  203. return true;
  204. }
  205. if (next !== SP) {
  206. break;
  207. }
  208. }
  209. }
  210. if (prev !== SP) {
  211. break;
  212. }
  213. }
  214. }
  215. return false;
  216. };
  217. var previousNonSpaceClassType = function (currentIndex, classTypes) {
  218. var i = currentIndex;
  219. while (i >= 0) {
  220. var type = classTypes[i];
  221. if (type === SP) {
  222. i--;
  223. }
  224. else {
  225. return type;
  226. }
  227. }
  228. return 0;
  229. };
  230. var _lineBreakAtIndex = function (codePoints, classTypes, indicies, index, forbiddenBreaks) {
  231. if (indicies[index] === 0) {
  232. return exports.BREAK_NOT_ALLOWED;
  233. }
  234. var currentIndex = index - 1;
  235. if (Array.isArray(forbiddenBreaks) && forbiddenBreaks[currentIndex] === true) {
  236. return exports.BREAK_NOT_ALLOWED;
  237. }
  238. var beforeIndex = currentIndex - 1;
  239. var afterIndex = currentIndex + 1;
  240. var current = classTypes[currentIndex];
  241. // LB4 Always break after hard line breaks.
  242. // LB5 Treat CR followed by LF, as well as CR, LF, and NL as hard line breaks.
  243. var before = beforeIndex >= 0 ? classTypes[beforeIndex] : 0;
  244. var next = classTypes[afterIndex];
  245. if (current === CR && next === LF) {
  246. return exports.BREAK_NOT_ALLOWED;
  247. }
  248. if (HARD_LINE_BREAKS.indexOf(current) !== -1) {
  249. return exports.BREAK_MANDATORY;
  250. }
  251. // LB6 Do not break before hard line breaks.
  252. if (HARD_LINE_BREAKS.indexOf(next) !== -1) {
  253. return exports.BREAK_NOT_ALLOWED;
  254. }
  255. // LB7 Do not break before spaces or zero width space.
  256. if (SPACE.indexOf(next) !== -1) {
  257. return exports.BREAK_NOT_ALLOWED;
  258. }
  259. // LB8 Break before any character following a zero-width space, even if one or more spaces intervene.
  260. if (previousNonSpaceClassType(currentIndex, classTypes) === ZW) {
  261. return exports.BREAK_ALLOWED;
  262. }
  263. // LB8a Do not break after a zero width joiner.
  264. if (exports.UnicodeTrie.get(codePoints[currentIndex]) === ZWJ) {
  265. return exports.BREAK_NOT_ALLOWED;
  266. }
  267. // zwj emojis
  268. if ((current === EB || current === EM) && exports.UnicodeTrie.get(codePoints[afterIndex]) === ZWJ) {
  269. return exports.BREAK_NOT_ALLOWED;
  270. }
  271. // LB11 Do not break before or after Word joiner and related characters.
  272. if (current === WJ || next === WJ) {
  273. return exports.BREAK_NOT_ALLOWED;
  274. }
  275. // LB12 Do not break after NBSP and related characters.
  276. if (current === GL) {
  277. return exports.BREAK_NOT_ALLOWED;
  278. }
  279. // LB12a Do not break before NBSP and related characters, except after spaces and hyphens.
  280. if ([SP, BA, HY].indexOf(current) === -1 && next === GL) {
  281. return exports.BREAK_NOT_ALLOWED;
  282. }
  283. // LB13 Do not break before ‘]’ or ‘!’ or ‘;’ or ‘/’, even after spaces.
  284. if ([CL, CP, EX, IS, SY].indexOf(next) !== -1) {
  285. return exports.BREAK_NOT_ALLOWED;
  286. }
  287. // LB14 Do not break after ‘[’, even after spaces.
  288. if (previousNonSpaceClassType(currentIndex, classTypes) === OP) {
  289. return exports.BREAK_NOT_ALLOWED;
  290. }
  291. // LB15 Do not break within ‘”[’, even with intervening spaces.
  292. if (isAdjacentWithSpaceIgnored(QU, OP, currentIndex, classTypes)) {
  293. return exports.BREAK_NOT_ALLOWED;
  294. }
  295. // LB16 Do not break between closing punctuation and a nonstarter (lb=NS), even with intervening spaces.
  296. if (isAdjacentWithSpaceIgnored([CL, CP], NS, currentIndex, classTypes)) {
  297. return exports.BREAK_NOT_ALLOWED;
  298. }
  299. // LB17 Do not break within ‘——’, even with intervening spaces.
  300. if (isAdjacentWithSpaceIgnored(B2, B2, currentIndex, classTypes)) {
  301. return exports.BREAK_NOT_ALLOWED;
  302. }
  303. // LB18 Break after spaces.
  304. if (current === SP) {
  305. return exports.BREAK_ALLOWED;
  306. }
  307. // LB19 Do not break before or after quotation marks, such as ‘ ” ’.
  308. if (current === QU || next === QU) {
  309. return exports.BREAK_NOT_ALLOWED;
  310. }
  311. // LB20 Break before and after unresolved CB.
  312. if (next === CB || current === CB) {
  313. return exports.BREAK_ALLOWED;
  314. }
  315. // LB21 Do not break before hyphen-minus, other hyphens, fixed-width spaces, small kana, and other non-starters, or after acute accents.
  316. if ([BA, HY, NS].indexOf(next) !== -1 || current === BB) {
  317. return exports.BREAK_NOT_ALLOWED;
  318. }
  319. // LB21a Don't break after Hebrew + Hyphen.
  320. if (before === HL && HYPHEN.indexOf(current) !== -1) {
  321. return exports.BREAK_NOT_ALLOWED;
  322. }
  323. // LB21b Don’t break between Solidus and Hebrew letters.
  324. if (current === SY && next === HL) {
  325. return exports.BREAK_NOT_ALLOWED;
  326. }
  327. // LB22 Do not break before ellipsis.
  328. if (next === IN) {
  329. return exports.BREAK_NOT_ALLOWED;
  330. }
  331. // LB23 Do not break between digits and letters.
  332. if ((ALPHABETICS.indexOf(next) !== -1 && current === NU) || (ALPHABETICS.indexOf(current) !== -1 && next === NU)) {
  333. return exports.BREAK_NOT_ALLOWED;
  334. }
  335. // LB23a Do not break between numeric prefixes and ideographs, or between ideographs and numeric postfixes.
  336. if ((current === PR && [ID, EB, EM].indexOf(next) !== -1) ||
  337. ([ID, EB, EM].indexOf(current) !== -1 && next === PO)) {
  338. return exports.BREAK_NOT_ALLOWED;
  339. }
  340. // LB24 Do not break between numeric prefix/postfix and letters, or between letters and prefix/postfix.
  341. if ((ALPHABETICS.indexOf(current) !== -1 && PREFIX_POSTFIX.indexOf(next) !== -1) ||
  342. (PREFIX_POSTFIX.indexOf(current) !== -1 && ALPHABETICS.indexOf(next) !== -1)) {
  343. return exports.BREAK_NOT_ALLOWED;
  344. }
  345. // LB25 Do not break between the following pairs of classes relevant to numbers:
  346. if (
  347. // (PR | PO) × ( OP | HY )? NU
  348. ([PR, PO].indexOf(current) !== -1 &&
  349. (next === NU || ([OP, HY].indexOf(next) !== -1 && classTypes[afterIndex + 1] === NU))) ||
  350. // ( OP | HY ) × NU
  351. ([OP, HY].indexOf(current) !== -1 && next === NU) ||
  352. // NU × (NU | SY | IS)
  353. (current === NU && [NU, SY, IS].indexOf(next) !== -1)) {
  354. return exports.BREAK_NOT_ALLOWED;
  355. }
  356. // NU (NU | SY | IS)* × (NU | SY | IS | CL | CP)
  357. if ([NU, SY, IS, CL, CP].indexOf(next) !== -1) {
  358. var prevIndex = currentIndex;
  359. while (prevIndex >= 0) {
  360. var type = classTypes[prevIndex];
  361. if (type === NU) {
  362. return exports.BREAK_NOT_ALLOWED;
  363. }
  364. else if ([SY, IS].indexOf(type) !== -1) {
  365. prevIndex--;
  366. }
  367. else {
  368. break;
  369. }
  370. }
  371. }
  372. // NU (NU | SY | IS)* (CL | CP)? × (PO | PR))
  373. if ([PR, PO].indexOf(next) !== -1) {
  374. var prevIndex = [CL, CP].indexOf(current) !== -1 ? beforeIndex : currentIndex;
  375. while (prevIndex >= 0) {
  376. var type = classTypes[prevIndex];
  377. if (type === NU) {
  378. return exports.BREAK_NOT_ALLOWED;
  379. }
  380. else if ([SY, IS].indexOf(type) !== -1) {
  381. prevIndex--;
  382. }
  383. else {
  384. break;
  385. }
  386. }
  387. }
  388. // LB26 Do not break a Korean syllable.
  389. if ((JL === current && [JL, JV, H2, H3].indexOf(next) !== -1) ||
  390. ([JV, H2].indexOf(current) !== -1 && [JV, JT].indexOf(next) !== -1) ||
  391. ([JT, H3].indexOf(current) !== -1 && next === JT)) {
  392. return exports.BREAK_NOT_ALLOWED;
  393. }
  394. // LB27 Treat a Korean Syllable Block the same as ID.
  395. if ((KOREAN_SYLLABLE_BLOCK.indexOf(current) !== -1 && [IN, PO].indexOf(next) !== -1) ||
  396. (KOREAN_SYLLABLE_BLOCK.indexOf(next) !== -1 && current === PR)) {
  397. return exports.BREAK_NOT_ALLOWED;
  398. }
  399. // LB28 Do not break between alphabetics (“at”).
  400. if (ALPHABETICS.indexOf(current) !== -1 && ALPHABETICS.indexOf(next) !== -1) {
  401. return exports.BREAK_NOT_ALLOWED;
  402. }
  403. // LB29 Do not break between numeric punctuation and alphabetics (“e.g.”).
  404. if (current === IS && ALPHABETICS.indexOf(next) !== -1) {
  405. return exports.BREAK_NOT_ALLOWED;
  406. }
  407. // LB30 Do not break between letters, numbers, or ordinary symbols and opening or closing parentheses.
  408. if ((ALPHABETICS.concat(NU).indexOf(current) !== -1 &&
  409. next === OP &&
  410. ea_OP.indexOf(codePoints[afterIndex]) === -1) ||
  411. (ALPHABETICS.concat(NU).indexOf(next) !== -1 && current === CP)) {
  412. return exports.BREAK_NOT_ALLOWED;
  413. }
  414. // LB30a Break between two regional indicator symbols if and only if there are an even number of regional
  415. // indicators preceding the position of the break.
  416. if (current === RI && next === RI) {
  417. var i = indicies[currentIndex];
  418. var count = 1;
  419. while (i > 0) {
  420. i--;
  421. if (classTypes[i] === RI) {
  422. count++;
  423. }
  424. else {
  425. break;
  426. }
  427. }
  428. if (count % 2 !== 0) {
  429. return exports.BREAK_NOT_ALLOWED;
  430. }
  431. }
  432. // LB30b Do not break between an emoji base and an emoji modifier.
  433. if (current === EB && next === EM) {
  434. return exports.BREAK_NOT_ALLOWED;
  435. }
  436. return exports.BREAK_ALLOWED;
  437. };
  438. var lineBreakAtIndex = function (codePoints, index) {
  439. // LB2 Never break at the start of text.
  440. if (index === 0) {
  441. return exports.BREAK_NOT_ALLOWED;
  442. }
  443. // LB3 Always break at the end of text.
  444. if (index >= codePoints.length) {
  445. return exports.BREAK_MANDATORY;
  446. }
  447. var _a = exports.codePointsToCharacterClasses(codePoints), indices = _a[0], classTypes = _a[1];
  448. return _lineBreakAtIndex(codePoints, classTypes, indices, index);
  449. };
  450. exports.lineBreakAtIndex = lineBreakAtIndex;
  451. var cssFormattedClasses = function (codePoints, options) {
  452. if (!options) {
  453. options = { lineBreak: 'normal', wordBreak: 'normal' };
  454. }
  455. var _a = exports.codePointsToCharacterClasses(codePoints, options.lineBreak), indicies = _a[0], classTypes = _a[1], isLetterNumber = _a[2];
  456. if (options.wordBreak === 'break-all' || options.wordBreak === 'break-word') {
  457. classTypes = classTypes.map(function (type) { return ([NU, AL, SA].indexOf(type) !== -1 ? ID : type); });
  458. }
  459. var forbiddenBreakpoints = options.wordBreak === 'keep-all'
  460. ? isLetterNumber.map(function (letterNumber, i) {
  461. return letterNumber && codePoints[i] >= 0x4e00 && codePoints[i] <= 0x9fff;
  462. })
  463. : undefined;
  464. return [indicies, classTypes, forbiddenBreakpoints];
  465. };
  466. var inlineBreakOpportunities = function (str, options) {
  467. var codePoints = Util_1.toCodePoints(str);
  468. var output = exports.BREAK_NOT_ALLOWED;
  469. var _a = cssFormattedClasses(codePoints, options), indicies = _a[0], classTypes = _a[1], forbiddenBreakpoints = _a[2];
  470. codePoints.forEach(function (codePoint, i) {
  471. output +=
  472. Util_1.fromCodePoint(codePoint) +
  473. (i >= codePoints.length - 1
  474. ? exports.BREAK_MANDATORY
  475. : _lineBreakAtIndex(codePoints, classTypes, indicies, i + 1, forbiddenBreakpoints));
  476. });
  477. return output;
  478. };
  479. exports.inlineBreakOpportunities = inlineBreakOpportunities;
  480. var Break = /** @class */ (function () {
  481. function Break(codePoints, lineBreak, start, end) {
  482. this.codePoints = codePoints;
  483. this.required = lineBreak === exports.BREAK_MANDATORY;
  484. this.start = start;
  485. this.end = end;
  486. }
  487. Break.prototype.slice = function () {
  488. return Util_1.fromCodePoint.apply(void 0, this.codePoints.slice(this.start, this.end));
  489. };
  490. return Break;
  491. }());
  492. var LineBreaker = function (str, options) {
  493. var codePoints = Util_1.toCodePoints(str);
  494. var _a = cssFormattedClasses(codePoints, options), indicies = _a[0], classTypes = _a[1], forbiddenBreakpoints = _a[2];
  495. var length = codePoints.length;
  496. var lastEnd = 0;
  497. var nextIndex = 0;
  498. return {
  499. next: function () {
  500. if (nextIndex >= length) {
  501. return { done: true, value: null };
  502. }
  503. var lineBreak = exports.BREAK_NOT_ALLOWED;
  504. while (nextIndex < length &&
  505. (lineBreak = _lineBreakAtIndex(codePoints, classTypes, indicies, ++nextIndex, forbiddenBreakpoints)) ===
  506. exports.BREAK_NOT_ALLOWED) { }
  507. if (lineBreak !== exports.BREAK_NOT_ALLOWED || nextIndex === length) {
  508. var value = new Break(codePoints, lineBreak, lastEnd, nextIndex);
  509. lastEnd = nextIndex;
  510. return { value: value, done: false };
  511. }
  512. return { done: true, value: null };
  513. },
  514. };
  515. };
  516. exports.LineBreaker = LineBreaker;
  517. //# sourceMappingURL=LineBreak.js.map