@visulima/string 1.2.2 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/LICENSE.md +1 -1
  3. package/README.md +46 -0
  4. package/dist/case/camel-case.cjs +1 -59
  5. package/dist/case/camel-case.d.cts +2 -2
  6. package/dist/case/camel-case.d.mts +2 -2
  7. package/dist/case/camel-case.d.ts +2 -2
  8. package/dist/case/camel-case.mjs +1 -57
  9. package/dist/case/capital-case.cjs +1 -51
  10. package/dist/case/capital-case.d.cts +2 -2
  11. package/dist/case/capital-case.d.mts +2 -2
  12. package/dist/case/capital-case.d.ts +2 -2
  13. package/dist/case/capital-case.mjs +1 -49
  14. package/dist/case/constant-case.cjs +1 -11
  15. package/dist/case/constant-case.d.cts +2 -2
  16. package/dist/case/constant-case.d.mts +2 -2
  17. package/dist/case/constant-case.d.ts +2 -2
  18. package/dist/case/constant-case.mjs +1 -9
  19. package/dist/case/dot-case.cjs +1 -11
  20. package/dist/case/dot-case.d.cts +2 -2
  21. package/dist/case/dot-case.d.mts +2 -2
  22. package/dist/case/dot-case.d.ts +2 -2
  23. package/dist/case/dot-case.mjs +1 -9
  24. package/dist/case/flat-case.cjs +1 -11
  25. package/dist/case/flat-case.d.cts +2 -2
  26. package/dist/case/flat-case.d.mts +2 -2
  27. package/dist/case/flat-case.d.ts +2 -2
  28. package/dist/case/flat-case.mjs +1 -9
  29. package/dist/case/flip-case.cjs +1 -61
  30. package/dist/case/flip-case.d.cts +4 -3
  31. package/dist/case/flip-case.d.mts +4 -3
  32. package/dist/case/flip-case.d.ts +4 -3
  33. package/dist/case/flip-case.mjs +1 -57
  34. package/dist/case/identify-case.cjs +1 -69
  35. package/dist/case/identify-case.d.cts +2 -2
  36. package/dist/case/identify-case.d.mts +2 -2
  37. package/dist/case/identify-case.d.ts +2 -2
  38. package/dist/case/identify-case.mjs +1 -67
  39. package/dist/case/index.cjs +1 -47
  40. package/dist/case/index.d.cts +2 -2
  41. package/dist/case/index.d.mts +2 -2
  42. package/dist/case/index.d.ts +2 -2
  43. package/dist/case/index.mjs +1 -20
  44. package/dist/case/kebab-case.cjs +1 -61
  45. package/dist/case/kebab-case.d.cts +4 -3
  46. package/dist/case/kebab-case.d.mts +4 -3
  47. package/dist/case/kebab-case.d.ts +4 -3
  48. package/dist/case/kebab-case.mjs +1 -57
  49. package/dist/case/lower-first.cjs +1 -13
  50. package/dist/case/lower-first.d.cts +2 -2
  51. package/dist/case/lower-first.d.mts +2 -2
  52. package/dist/case/lower-first.d.ts +2 -2
  53. package/dist/case/lower-first.mjs +1 -11
  54. package/dist/case/no-case.cjs +1 -11
  55. package/dist/case/no-case.d.cts +2 -2
  56. package/dist/case/no-case.d.mts +2 -2
  57. package/dist/case/no-case.d.ts +2 -2
  58. package/dist/case/no-case.mjs +1 -9
  59. package/dist/case/pascal-case.cjs +1 -52
  60. package/dist/case/pascal-case.d.cts +2 -2
  61. package/dist/case/pascal-case.d.mts +2 -2
  62. package/dist/case/pascal-case.d.ts +2 -2
  63. package/dist/case/pascal-case.mjs +1 -50
  64. package/dist/case/pascal-snake-case.cjs +1 -32
  65. package/dist/case/pascal-snake-case.d.cts +2 -2
  66. package/dist/case/pascal-snake-case.d.mts +2 -2
  67. package/dist/case/pascal-snake-case.d.ts +2 -2
  68. package/dist/case/pascal-snake-case.mjs +1 -30
  69. package/dist/case/path-case.cjs +1 -11
  70. package/dist/case/path-case.d.cts +2 -2
  71. package/dist/case/path-case.d.mts +2 -2
  72. package/dist/case/path-case.d.ts +2 -2
  73. package/dist/case/path-case.mjs +1 -9
  74. package/dist/case/sentence-case.cjs +1 -58
  75. package/dist/case/sentence-case.d.cts +2 -2
  76. package/dist/case/sentence-case.d.mts +2 -2
  77. package/dist/case/sentence-case.d.ts +2 -2
  78. package/dist/case/sentence-case.mjs +1 -56
  79. package/dist/case/snake-case.cjs +1 -11
  80. package/dist/case/snake-case.d.cts +2 -2
  81. package/dist/case/snake-case.d.mts +2 -2
  82. package/dist/case/snake-case.d.ts +2 -2
  83. package/dist/case/snake-case.mjs +1 -9
  84. package/dist/case/split-by-case.cjs +1 -641
  85. package/dist/case/split-by-case.d.cts +4 -3
  86. package/dist/case/split-by-case.d.mts +4 -3
  87. package/dist/case/split-by-case.d.ts +4 -3
  88. package/dist/case/split-by-case.mjs +1 -637
  89. package/dist/case/title-case.cjs +1 -47
  90. package/dist/case/title-case.d.cts +2 -2
  91. package/dist/case/title-case.d.mts +2 -2
  92. package/dist/case/title-case.d.ts +2 -2
  93. package/dist/case/title-case.mjs +1 -45
  94. package/dist/case/train-case.cjs +1 -44
  95. package/dist/case/train-case.d.cts +2 -2
  96. package/dist/case/train-case.d.mts +2 -2
  97. package/dist/case/train-case.d.ts +2 -2
  98. package/dist/case/train-case.mjs +1 -42
  99. package/dist/case/upper-first.cjs +1 -13
  100. package/dist/case/upper-first.d.cts +2 -2
  101. package/dist/case/upper-first.d.mts +2 -2
  102. package/dist/case/upper-first.d.ts +2 -2
  103. package/dist/case/upper-first.mjs +1 -11
  104. package/dist/get-string-truncated-width.cjs +1 -422
  105. package/dist/get-string-truncated-width.d.cts +2 -1
  106. package/dist/get-string-truncated-width.d.mts +2 -1
  107. package/dist/get-string-truncated-width.d.ts +2 -1
  108. package/dist/get-string-truncated-width.mjs +1 -418
  109. package/dist/get-string-width.cjs +1 -11
  110. package/dist/get-string-width.d.cts +2 -1
  111. package/dist/get-string-width.d.mts +2 -1
  112. package/dist/get-string-width.d.ts +2 -1
  113. package/dist/get-string-width.mjs +1 -7
  114. package/dist/index.cjs +1 -66
  115. package/dist/index.d.cts +15 -5
  116. package/dist/index.d.mts +15 -5
  117. package/dist/index.d.ts +15 -5
  118. package/dist/index.mjs +1 -29
  119. package/dist/native-string-types.d.cts +1 -1
  120. package/dist/native-string-types.d.mts +1 -1
  121. package/dist/native-string-types.d.ts +1 -1
  122. package/dist/outdent.cjs +1 -125
  123. package/dist/outdent.d.cts +2 -1
  124. package/dist/outdent.d.mts +2 -1
  125. package/dist/outdent.d.ts +2 -1
  126. package/dist/outdent.mjs +1 -121
  127. package/dist/packem_shared/LRUCache-Bjo6gsbC.mjs +1 -0
  128. package/dist/packem_shared/LRUCache-TYqfUYE5.cjs +1 -0
  129. package/dist/packem_shared/WrapMode-BL2dnSc8.cjs +8 -0
  130. package/dist/packem_shared/WrapMode-DxH5g69E.mjs +8 -0
  131. package/dist/packem_shared/alignText-BCKbnqhC.mjs +2 -0
  132. package/dist/packem_shared/alignText-CLZJuPP6.cjs +2 -0
  133. package/dist/packem_shared/constants-Cd17VNEv.mjs +1 -0
  134. package/dist/packem_shared/constants-D3K8u3G8.cjs +1 -0
  135. package/dist/packem_shared/generate-cache-key-BZf0GiMs.cjs +1 -0
  136. package/dist/packem_shared/generate-cache-key-DPByFaMH.mjs +1 -0
  137. package/dist/packem_shared/joinSegments-CDHNMXsF.cjs +1 -0
  138. package/dist/packem_shared/joinSegments-H7QJ7rwJ.mjs +1 -0
  139. package/dist/packem_shared/normalize-german-eszett-4k1qRtEP.mjs +1 -0
  140. package/dist/packem_shared/normalize-german-eszett-Bop4wOp9.cjs +1 -0
  141. package/dist/packem_shared/replaceString-Ce8TI_-L.cjs +1 -0
  142. package/dist/packem_shared/replaceString-D7R-5VFX.mjs +1 -0
  143. package/dist/packem_shared/slugify-B1vlQQO1.mjs +1 -0
  144. package/dist/packem_shared/slugify-CH3GI7E5.cjs +1 -0
  145. package/dist/packem_shared/transliterate-BXaP38Sh.mjs +5 -0
  146. package/dist/packem_shared/transliterate-CToQ-aeM.cjs +5 -0
  147. package/dist/packem_shared/{types-DmfKbIaI.d.ts → types-BSdIWVzn.d.cts} +2 -1
  148. package/dist/packem_shared/{types-DmfKbIaI.d.cts → types-BSdIWVzn.d.mts} +2 -1
  149. package/dist/packem_shared/{types-DmfKbIaI.d.mts → types-BSdIWVzn.d.ts} +2 -1
  150. package/dist/packem_shared/{types-DcGtApe2.d.ts → types-BfGNLD2K.d.ts} +1 -1
  151. package/dist/packem_shared/{types-C5Pk8B8Q.d.cts → types-DrtiqNkK.d.cts} +1 -1
  152. package/dist/packem_shared/{types-_jqW_ZOt.d.mts → types-mlwFVBiS.d.mts} +1 -1
  153. package/dist/slice.cjs +1 -419
  154. package/dist/slice.d.cts +2 -1
  155. package/dist/slice.d.mts +2 -1
  156. package/dist/slice.d.ts +2 -1
  157. package/dist/slice.mjs +1 -415
  158. package/dist/test/utils.cjs +13 -74
  159. package/dist/test/utils.d.cts +2 -1
  160. package/dist/test/utils.d.mts +2 -1
  161. package/dist/test/utils.d.ts +2 -1
  162. package/dist/test/utils.mjs +14 -69
  163. package/dist/test/vitest.cjs +1 -11
  164. package/dist/test/vitest.d.cts +2 -1
  165. package/dist/test/vitest.d.mts +2 -1
  166. package/dist/test/vitest.d.ts +2 -1
  167. package/dist/test/vitest.mjs +1 -7
  168. package/dist/truncate.cjs +1 -101
  169. package/dist/truncate.d.cts +2 -1
  170. package/dist/truncate.d.mts +2 -1
  171. package/dist/truncate.d.ts +2 -1
  172. package/dist/truncate.mjs +1 -97
  173. package/dist/utils.cjs +1 -65
  174. package/dist/utils.d.cts +1 -1
  175. package/dist/utils.d.mts +1 -1
  176. package/dist/utils.d.ts +1 -1
  177. package/dist/utils.mjs +1 -56
  178. package/package.json +9 -6
  179. package/dist/packem_shared/LRUCache-Crb-m7cw.cjs +0 -53
  180. package/dist/packem_shared/LRUCache-udNErhWw.mjs +0 -51
  181. package/dist/packem_shared/WrapMode-B-WBY1mj.mjs +0 -545
  182. package/dist/packem_shared/WrapMode-Dsqu9BaX.cjs +0 -550
  183. package/dist/packem_shared/constants-CKuHriHc.cjs +0 -151
  184. package/dist/packem_shared/constants-CsGLUb4U.mjs +0 -100
  185. package/dist/packem_shared/generate-cache-key-D8f1auDB.cjs +0 -10
  186. package/dist/packem_shared/generate-cache-key-YSju5pj2.mjs +0 -8
  187. package/dist/packem_shared/joinSegments-B_7bxy5J.cjs +0 -48
  188. package/dist/packem_shared/joinSegments-BovQ2h_P.mjs +0 -46
  189. package/dist/packem_shared/normalize-german-eszett-DJK0S2qj.cjs +0 -11
  190. package/dist/packem_shared/normalize-german-eszett-fpJ4lZL6.mjs +0 -9
  191. package/dist/packem_shared/replaceString-C7Dp5vAg.mjs +0 -200
  192. package/dist/packem_shared/replaceString-iYo1cDfZ.cjs +0 -202
  193. package/dist/packem_shared/slugify-DhE59J2A.mjs +0 -48
  194. package/dist/packem_shared/slugify-jh6PftAT.cjs +0 -50
  195. package/dist/packem_shared/transliterate-BEci5RC8.cjs +0 -47782
  196. package/dist/packem_shared/transliterate-DwSldp0o.mjs +0 -47780
@@ -1,418 +1 @@
1
- import { c as RE_ANSI, N as RE_CONTROL, j as RE_EMOJI } from './packem_shared/constants-CsGLUb4U.mjs';
2
-
3
- var __defProp$2 = Object.defineProperty;
4
- var __name$2 = (target, value) => __defProp$2(target, "name", { value, configurable: true });
5
- function isAmbiguous(x) {
6
- return x === 161 || x === 164 || x === 167 || x === 168 || x === 170 || x === 173 || x === 174 || x >= 176 && x <= 180 || x >= 182 && x <= 186 || x >= 188 && x <= 191 || x === 198 || x === 208 || x === 215 || x === 216 || x >= 222 && x <= 225 || x === 230 || x >= 232 && x <= 234 || x === 236 || x === 237 || x === 240 || x === 242 || x === 243 || x >= 247 && x <= 250 || x === 252 || x === 254 || x === 257 || x === 273 || x === 275 || x === 283 || x === 294 || x === 295 || x === 299 || x >= 305 && x <= 307 || x === 312 || x >= 319 && x <= 322 || x === 324 || x >= 328 && x <= 331 || x === 333 || x === 338 || x === 339 || x === 358 || x === 359 || x === 363 || x === 462 || x === 464 || x === 466 || x === 468 || x === 470 || x === 472 || x === 474 || x === 476 || x === 593 || x === 609 || x === 708 || x === 711 || x >= 713 && x <= 715 || x === 717 || x === 720 || x >= 728 && x <= 731 || x === 733 || x === 735 || x >= 768 && x <= 879 || x >= 913 && x <= 929 || x >= 931 && x <= 937 || x >= 945 && x <= 961 || x >= 963 && x <= 969 || x === 1025 || x >= 1040 && x <= 1103 || x === 1105 || x === 8208 || x >= 8211 && x <= 8214 || x === 8216 || x === 8217 || x === 8220 || x === 8221 || x >= 8224 && x <= 8226 || x >= 8228 && x <= 8231 || x === 8240 || x === 8242 || x === 8243 || x === 8245 || x === 8251 || x === 8254 || x === 8308 || x === 8319 || x >= 8321 && x <= 8324 || x === 8364 || x === 8451 || x === 8453 || x === 8457 || x === 8467 || x === 8470 || x === 8481 || x === 8482 || x === 8486 || x === 8491 || x === 8531 || x === 8532 || x >= 8539 && x <= 8542 || x >= 8544 && x <= 8555 || x >= 8560 && x <= 8569 || x === 8585 || x >= 8592 && x <= 8601 || x === 8632 || x === 8633 || x === 8658 || x === 8660 || x === 8679 || x === 8704 || x === 8706 || x === 8707 || x === 8711 || x === 8712 || x === 8715 || x === 8719 || x === 8721 || x === 8725 || x === 8730 || x >= 8733 && x <= 8736 || x === 8739 || x === 8741 || x >= 8743 && x <= 8748 || x === 8750 || x >= 8756 && x <= 8759 || x === 8764 || x === 8765 || x === 8776 || x === 8780 || x === 8786 || x === 8800 || x === 8801 || x >= 8804 && x <= 8807 || x === 8810 || x === 8811 || x === 8814 || x === 8815 || x === 8834 || x === 8835 || x === 8838 || x === 8839 || x === 8853 || x === 8857 || x === 8869 || x === 8895 || x === 8978 || x >= 9312 && x <= 9449 || x >= 9451 && x <= 9547 || x >= 9552 && x <= 9587 || x >= 9600 && x <= 9615 || x >= 9618 && x <= 9621 || x === 9632 || x === 9633 || x >= 9635 && x <= 9641 || x === 9650 || x === 9651 || x === 9654 || x === 9655 || x === 9660 || x === 9661 || x === 9664 || x === 9665 || x >= 9670 && x <= 9672 || x === 9675 || x >= 9678 && x <= 9681 || x >= 9698 && x <= 9701 || x === 9711 || x === 9733 || x === 9734 || x === 9737 || x === 9742 || x === 9743 || x === 9756 || x === 9758 || x === 9792 || x === 9794 || x === 9824 || x === 9825 || x >= 9827 && x <= 9829 || x >= 9831 && x <= 9834 || x === 9836 || x === 9837 || x === 9839 || x === 9886 || x === 9887 || x === 9919 || x >= 9926 && x <= 9933 || x >= 9935 && x <= 9939 || x >= 9941 && x <= 9953 || x === 9955 || x === 9960 || x === 9961 || x >= 9963 && x <= 9969 || x === 9972 || x >= 9974 && x <= 9977 || x === 9979 || x === 9980 || x === 9982 || x === 9983 || x === 10045 || x >= 10102 && x <= 10111 || x >= 11094 && x <= 11097 || x >= 12872 && x <= 12879 || x >= 57344 && x <= 63743 || x >= 65024 && x <= 65039 || x === 65533 || x >= 127232 && x <= 127242 || x >= 127248 && x <= 127277 || x >= 127280 && x <= 127337 || x >= 127344 && x <= 127373 || x === 127375 || x === 127376 || x >= 127387 && x <= 127404 || x >= 917760 && x <= 917999 || x >= 983040 && x <= 1048573 || x >= 1048576 && x <= 1114109;
7
- }
8
- __name$2(isAmbiguous, "isAmbiguous");
9
- function isFullWidth(x) {
10
- return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
11
- }
12
- __name$2(isFullWidth, "isFullWidth");
13
- function isWide(x) {
14
- return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9776 && x <= 9783 || x >= 9800 && x <= 9811 || x === 9855 || x >= 9866 && x <= 9871 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12773 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x === 94192 || x === 94193 || x >= 94208 && x <= 100343 || x >= 100352 && x <= 101589 || x >= 101631 && x <= 101640 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x >= 119552 && x <= 119638 || x >= 119648 && x <= 119670 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128727 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129673 || x >= 129679 && x <= 129734 || x >= 129742 && x <= 129756 || x >= 129759 && x <= 129769 || x >= 129776 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
15
- }
16
- __name$2(isWide, "isWide");
17
- function getCategory(x) {
18
- if (isAmbiguous(x)) return "ambiguous";
19
- if (isFullWidth(x)) return "fullwidth";
20
- if (x === 8361 || x >= 65377 && x <= 65470 || x >= 65474 && x <= 65479 || x >= 65482 && x <= 65487 || x >= 65490 && x <= 65495 || x >= 65498 && x <= 65500 || x >= 65512 && x <= 65518) {
21
- return "halfwidth";
22
- }
23
- if (x >= 32 && x <= 126 || x === 162 || x === 163 || x === 165 || x === 166 || x === 172 || x === 175 || x >= 10214 && x <= 10221 || x === 10629 || x === 10630) {
24
- return "narrow";
25
- }
26
- if (isWide(x)) return "wide";
27
- return "neutral";
28
- }
29
- __name$2(getCategory, "getCategory");
30
-
31
- var __defProp$1 = Object.defineProperty;
32
- var __name$1 = (target, value) => __defProp$1(target, "name", { value, configurable: true });
33
- function validate(codePoint) {
34
- if (!Number.isSafeInteger(codePoint)) {
35
- throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
36
- }
37
- }
38
- __name$1(validate, "validate");
39
- function eastAsianWidthType(codePoint) {
40
- validate(codePoint);
41
- return getCategory(codePoint);
42
- }
43
- __name$1(eastAsianWidthType, "eastAsianWidthType");
44
- function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
45
- validate(codePoint);
46
- if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) {
47
- return 2;
48
- }
49
- return 1;
50
- }
51
- __name$1(eastAsianWidth, "eastAsianWidth");
52
-
53
- var __defProp = Object.defineProperty;
54
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
55
- const charWidthCache = /* @__PURE__ */ new Map();
56
- const RE_LATIN_CHARS = /(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y;
57
- const getCharType = /* @__PURE__ */ __name((codePoint) => {
58
- if (codePoint >= 32 && codePoint <= 126) {
59
- return "latin";
60
- }
61
- if (codePoint === 8203 || codePoint === 8204 || codePoint === 8205 || codePoint === 8288) {
62
- return "zero";
63
- }
64
- if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
65
- return "control";
66
- }
67
- if (codePoint >= 160 && codePoint <= 255) {
68
- return "latin";
69
- }
70
- if (codePoint >= 9472 && codePoint <= 9599) {
71
- return "latin";
72
- }
73
- if (codePoint >= 4352 && codePoint <= 4607 || // Hangul Jamo
74
- codePoint >= 11904 && codePoint <= 40959 || // CJK & radicals
75
- codePoint >= 44032 && codePoint <= 55215 || // Hangul Syllables
76
- codePoint >= 63744 && codePoint <= 64255 || // CJK Compatibility Ideographs
77
- codePoint >= 65280 && codePoint <= 65519 && !(codePoint >= 65377 && codePoint <= 65439) || // Full-width Forms (excluding half-width katakana)
78
- codePoint >= 12352 && codePoint <= 12543) {
79
- return "wide";
80
- }
81
- if (codePoint === 8230) {
82
- return "latin";
83
- }
84
- return "other";
85
- }, "getCharType");
86
- const getCachedCharWidth = /* @__PURE__ */ __name((codePoint, config) => {
87
- const highBits = Math.floor(codePoint / 65536);
88
- const lowBits = codePoint % 65536;
89
- let lowMap = charWidthCache.get(highBits);
90
- if (!lowMap) {
91
- lowMap = /* @__PURE__ */ new Map();
92
- charWidthCache.set(highBits, lowMap);
93
- }
94
- if (lowMap.has(lowBits)) {
95
- return lowMap.get(lowBits);
96
- }
97
- let width;
98
- if (getCharType(codePoint) === "latin") {
99
- width = config.width.regular;
100
- } else if (getCharType(codePoint) === "control") {
101
- width = config.width.control;
102
- } else if (getCharType(codePoint) === "wide") {
103
- width = config.width.wide;
104
- } else {
105
- const eaw = eastAsianWidthType(codePoint);
106
- switch (eaw) {
107
- case "fullwidth": {
108
- width = config.width.fullWidth;
109
- break;
110
- }
111
- case "wide": {
112
- width = config.width.wide;
113
- break;
114
- }
115
- case "ambiguous": {
116
- width = config.width.ambiguousIsNarrow ? config.width.regular : config.width.wide;
117
- break;
118
- }
119
- default: {
120
- width = config.width.regular;
121
- }
122
- }
123
- }
124
- lowMap.set(lowBits, width);
125
- return width;
126
- }, "getCachedCharWidth");
127
- const isCombiningCharacter = /* @__PURE__ */ __name((codePoint) => {
128
- if (codePoint >= 768 && codePoint <= 879 || // Combining Diacritical Marks
129
- codePoint >= 6832 && codePoint <= 6911 || // Combining Diacritical Marks Extended
130
- codePoint >= 7616 && codePoint <= 7679 || // Combining Diacritical Marks Supplement
131
- codePoint >= 8400 && codePoint <= 8447 || // Combining Diacritical Marks for Symbols
132
- codePoint >= 65056 && codePoint <= 65071) {
133
- return true;
134
- }
135
- if (codePoint >= 917760 && codePoint <= 917999 || // Variation Selectors Supplement
136
- codePoint >= 65024 && codePoint <= 65039) {
137
- return true;
138
- }
139
- if (codePoint >= 3633 && codePoint <= 3642 || // Thai vowel marks and tone marks
140
- codePoint >= 3655 && codePoint <= 3662 || // Thai diacritics
141
- codePoint >= 3761 && codePoint <= 3769 || // Lao vowel marks
142
- codePoint >= 3771 && codePoint <= 3772 || // Lao vowel signs
143
- codePoint >= 3784 && codePoint <= 3789) {
144
- return true;
145
- }
146
- if (codePoint >= 2304 && codePoint <= 2307 || // Devanagari signs
147
- codePoint >= 2362 && codePoint <= 2383 || // Devanagari vowel signs and virama
148
- codePoint >= 2385 && codePoint <= 2391 || // Devanagari stress marks
149
- codePoint >= 2402 && codePoint <= 2403 || // Devanagari vowel signs
150
- codePoint >= 2433 && codePoint <= 2435 || // Bengali signs
151
- codePoint >= 2492 && codePoint <= 2500 || // Bengali vowel signs
152
- codePoint >= 2509 && codePoint <= 2509 || // Bengali virama
153
- codePoint >= 2561 && codePoint <= 2563 || // Gurmukhi signs
154
- codePoint >= 2620 && codePoint <= 2637) {
155
- return true;
156
- }
157
- if (codePoint >= 1611 && codePoint <= 1631 || // Arabic diacritics
158
- codePoint >= 1648 && codePoint <= 1648 || // Arabic letter superscript alef
159
- codePoint >= 1750 && codePoint <= 1773 || // Arabic small high signs
160
- codePoint >= 2276 && codePoint <= 2302) {
161
- return true;
162
- }
163
- if (codePoint >= 1425 && codePoint <= 1469 || // Hebrew points
164
- codePoint >= 1471 && codePoint <= 1471 || // Hebrew point rafe
165
- codePoint >= 1473 && codePoint <= 1474 || // Hebrew points
166
- codePoint >= 1476 && codePoint <= 1477 || // Hebrew marks
167
- codePoint >= 1479 && codePoint <= 1479) {
168
- return true;
169
- }
170
- if (codePoint >= 3893 && codePoint <= 3893 || // Tibetan mark nada
171
- codePoint >= 3895 && codePoint <= 3895 || // Tibetan mark nada
172
- codePoint >= 3897 && codePoint <= 3897 || // Tibetan mark tsa phru
173
- codePoint >= 3953 && codePoint <= 3966 || // Tibetan vowel signs
174
- codePoint >= 3968 && codePoint <= 3972 || // Tibetan vowel signs and virama
175
- codePoint >= 3974 && codePoint <= 3975) {
176
- return true;
177
- }
178
- return codePoint >= 768 && codePoint <= 777 || // Combining diacritical marks used in Vietnamese
179
- codePoint >= 803 && codePoint <= 803;
180
- }, "isCombiningCharacter");
181
- const getStringTruncatedWidth = /* @__PURE__ */ __name((input, options = {}) => {
182
- if (!input || input.length === 0) {
183
- return { ellipsed: false, index: 0, truncated: false, width: 0 };
184
- }
185
- const config = {
186
- truncation: {
187
- countAnsiEscapeCodes: options.countAnsiEscapeCodes ?? false,
188
- ellipsis: options.ellipsis ?? "",
189
- ellipsisWidth: options.ellipsisWidth ?? (options.ellipsis ? getStringTruncatedWidth(options.ellipsis, {
190
- ...options,
191
- ellipsis: "",
192
- ellipsisWidth: 0,
193
- limit: Number.POSITIVE_INFINITY
194
- }).width : 0),
195
- limit: options.limit ?? Number.POSITIVE_INFINITY
196
- },
197
- width: {
198
- ambiguousIsNarrow: options.ambiguousIsNarrow ?? false,
199
- ansi: options.ansiWidth ?? 0,
200
- control: options.controlWidth ?? 0,
201
- emoji: options.emojiWidth ?? 2,
202
- fullWidth: options.fullWidth ?? 2,
203
- halfWidth: options.halfWidth ?? 1,
204
- regular: options.regularWidth ?? 1,
205
- tab: options.tabWidth ?? 8,
206
- wide: options.wideWidth ?? 2
207
- }
208
- };
209
- const truncationLimit = Math.max(0, config.truncation.limit - config.truncation.ellipsisWidth);
210
- const { length } = input;
211
- const useCaching = length > 1e4;
212
- let index = 0;
213
- let width = 0;
214
- let truncationIndex = length;
215
- let truncationEnabled = false;
216
- const hasAnsi = input.includes("\x1B") || input.includes("›");
217
- while (index < length) {
218
- if (hasAnsi && (input[index] === "\x1B" || input[index] === "›")) {
219
- if (input.startsWith("\x1B]8;;", index)) {
220
- const BELL = "\x07";
221
- const OSC8_CLOSER = "\x1B]8;;" + BELL;
222
- const OSC8_CLOSER_LEN = OSC8_CLOSER.length;
223
- const endOfParametersIndex = input.indexOf(BELL, index + 5);
224
- if (endOfParametersIndex === -1) ; else {
225
- const startOfCloserIndex = input.indexOf(OSC8_CLOSER, endOfParametersIndex + 1);
226
- if (startOfCloserIndex === -1) ; else {
227
- const endOfSequenceIndex = startOfCloserIndex + OSC8_CLOSER_LEN;
228
- const linkText = input.slice(endOfParametersIndex + 1, startOfCloserIndex);
229
- const strippedLinkText = linkText.replace(RE_ANSI, "");
230
- const linkTextWidthResult = getStringTruncatedWidth(strippedLinkText, {
231
- ambiguousIsNarrow: config.width.ambiguousIsNarrow,
232
- ansiWidth: config.width.ansi,
233
- controlWidth: config.width.control,
234
- countAnsiEscapeCodes: false,
235
- // Never count ANSI in link text width
236
- ellipsis: config.truncation.ellipsis,
237
- ellipsisWidth: config.truncation.ellipsisWidth,
238
- emojiWidth: config.width.emoji,
239
- fullWidth: config.width.fullWidth,
240
- halfWidth: config.width.halfWidth,
241
- limit: Math.max(0, truncationLimit - width),
242
- regularWidth: config.width.regular,
243
- tabWidth: config.width.tab,
244
- wideWidth: config.width.wide
245
- });
246
- const textWidth = linkTextWidthResult.width;
247
- if (linkTextWidthResult.truncated) {
248
- truncationEnabled = true;
249
- truncationIndex = Math.min(truncationIndex, index);
250
- } else if (width + textWidth > truncationLimit) {
251
- truncationIndex = Math.min(truncationIndex, index);
252
- truncationEnabled = true;
253
- if (width + textWidth > config.truncation.limit) {
254
- break;
255
- }
256
- }
257
- width += textWidth;
258
- index = endOfSequenceIndex;
259
- if (truncationEnabled && width >= config.truncation.limit) {
260
- break;
261
- }
262
- continue;
263
- }
264
- }
265
- }
266
- RE_ANSI.lastIndex = index;
267
- if (RE_ANSI.test(input)) {
268
- const ansiLength = RE_ANSI.lastIndex - index;
269
- const ansiWidth = config.truncation.countAnsiEscapeCodes ? ansiLength : config.width.ansi;
270
- if (width + ansiWidth > truncationLimit) {
271
- truncationIndex = Math.min(truncationIndex, index);
272
- if (width + ansiWidth > config.truncation.limit) {
273
- truncationEnabled = true;
274
- break;
275
- }
276
- }
277
- width += ansiWidth;
278
- index = RE_ANSI.lastIndex;
279
- continue;
280
- }
281
- }
282
- const charCode = input.codePointAt(index);
283
- if (charCode === 8203 || charCode === 65279 || charCode >= 8288 && charCode <= 8292) {
284
- index++;
285
- continue;
286
- }
287
- if (charCode === 9) {
288
- if (width + config.width.tab > truncationLimit) {
289
- truncationIndex = Math.min(truncationIndex, index);
290
- if (width + config.width.tab > config.truncation.limit) {
291
- truncationEnabled = true;
292
- break;
293
- }
294
- }
295
- width += config.width.tab;
296
- index++;
297
- continue;
298
- }
299
- RE_LATIN_CHARS.lastIndex = index;
300
- if (RE_LATIN_CHARS.test(input)) {
301
- const latinLength = RE_LATIN_CHARS.lastIndex - index;
302
- const latinWidth = latinLength * config.width.regular;
303
- if (width + latinWidth > truncationLimit) {
304
- const charsToLimit = Math.floor((truncationLimit - width) / config.width.regular);
305
- truncationIndex = Math.min(truncationIndex, index + charsToLimit);
306
- if (width + latinWidth > config.truncation.limit) {
307
- truncationEnabled = true;
308
- break;
309
- }
310
- }
311
- width += latinWidth;
312
- index = RE_LATIN_CHARS.lastIndex;
313
- continue;
314
- }
315
- if (charCode <= 31 || charCode >= 127 && charCode <= 159) {
316
- RE_CONTROL.lastIndex = index;
317
- if (RE_CONTROL.test(input)) {
318
- const controlLength = RE_CONTROL.lastIndex - index;
319
- const controlWidth = controlLength * config.width.control;
320
- if (width + controlWidth > truncationLimit) {
321
- truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / config.width.control));
322
- if (width + controlWidth > config.truncation.limit) {
323
- truncationEnabled = true;
324
- break;
325
- }
326
- }
327
- width += controlWidth;
328
- index = RE_CONTROL.lastIndex;
329
- continue;
330
- }
331
- }
332
- RE_EMOJI.lastIndex = index;
333
- if (RE_EMOJI.test(input)) {
334
- if (width + config.width.emoji > truncationLimit) {
335
- truncationIndex = Math.min(truncationIndex, index);
336
- if (width + config.width.emoji > config.truncation.limit) {
337
- truncationEnabled = true;
338
- break;
339
- }
340
- }
341
- width += config.width.emoji;
342
- index = RE_EMOJI.lastIndex;
343
- continue;
344
- }
345
- const codePoint = input.codePointAt(index) ?? 0;
346
- if (isCombiningCharacter(codePoint)) {
347
- index += codePoint > 65535 ? 2 : 1;
348
- continue;
349
- }
350
- let charWidth;
351
- if (useCaching) {
352
- charWidth = getCachedCharWidth(codePoint, config);
353
- } else {
354
- const charType = getCharType(codePoint);
355
- switch (charType) {
356
- case "latin": {
357
- charWidth = config.width.regular;
358
- break;
359
- }
360
- case "control": {
361
- charWidth = config.width.control;
362
- break;
363
- }
364
- case "wide": {
365
- charWidth = config.width.wide;
366
- break;
367
- }
368
- case "zero": {
369
- charWidth = 0;
370
- break;
371
- }
372
- default: {
373
- const eaw = eastAsianWidthType(codePoint);
374
- switch (eaw) {
375
- case "fullwidth": {
376
- charWidth = config.width.fullWidth;
377
- break;
378
- }
379
- case "wide": {
380
- charWidth = config.width.wide;
381
- break;
382
- }
383
- case "ambiguous": {
384
- charWidth = config.width.ambiguousIsNarrow ? config.width.regular : config.width.wide;
385
- break;
386
- }
387
- default: {
388
- charWidth = config.width.regular;
389
- }
390
- }
391
- }
392
- }
393
- }
394
- if (width + charWidth > truncationLimit) {
395
- truncationIndex = Math.min(truncationIndex, index);
396
- if (width + charWidth > config.truncation.limit) {
397
- truncationEnabled = true;
398
- break;
399
- }
400
- }
401
- width += charWidth;
402
- index += codePoint > 65535 ? 2 : 1;
403
- }
404
- let finalWidth = width;
405
- let ellipsed = false;
406
- if (truncationEnabled && config.truncation.limit >= config.truncation.ellipsisWidth) {
407
- finalWidth = config.truncation.limit;
408
- ellipsed = true;
409
- }
410
- return {
411
- ellipsed,
412
- index: truncationEnabled ? truncationIndex : length,
413
- truncated: truncationEnabled,
414
- width: finalWidth
415
- };
416
- }, "getStringTruncatedWidth");
417
-
418
- export { getStringTruncatedWidth };
1
+ var Y=Object.defineProperty;var c=(i,a)=>Y(i,"name",{value:a,configurable:!0});import{c as b,N as g,j}from"./packem_shared/constants-Cd17VNEv.mjs";var J=Object.defineProperty,I=c((i,a)=>J(i,"name",{value:a,configurable:!0}),"E");function T(i){return i===161||i===164||i===167||i===168||i===170||i===173||i===174||i>=176&&i<=180||i>=182&&i<=186||i>=188&&i<=191||i===198||i===208||i===215||i===216||i>=222&&i<=225||i===230||i>=232&&i<=234||i===236||i===237||i===240||i===242||i===243||i>=247&&i<=250||i===252||i===254||i===257||i===273||i===275||i===283||i===294||i===295||i===299||i>=305&&i<=307||i===312||i>=319&&i<=322||i===324||i>=328&&i<=331||i===333||i===338||i===339||i===358||i===359||i===363||i===462||i===464||i===466||i===468||i===470||i===472||i===474||i===476||i===593||i===609||i===708||i===711||i>=713&&i<=715||i===717||i===720||i>=728&&i<=731||i===733||i===735||i>=768&&i<=879||i>=913&&i<=929||i>=931&&i<=937||i>=945&&i<=961||i>=963&&i<=969||i===1025||i>=1040&&i<=1103||i===1105||i===8208||i>=8211&&i<=8214||i===8216||i===8217||i===8220||i===8221||i>=8224&&i<=8226||i>=8228&&i<=8231||i===8240||i===8242||i===8243||i===8245||i===8251||i===8254||i===8308||i===8319||i>=8321&&i<=8324||i===8364||i===8451||i===8453||i===8457||i===8467||i===8470||i===8481||i===8482||i===8486||i===8491||i===8531||i===8532||i>=8539&&i<=8542||i>=8544&&i<=8555||i>=8560&&i<=8569||i===8585||i>=8592&&i<=8601||i===8632||i===8633||i===8658||i===8660||i===8679||i===8704||i===8706||i===8707||i===8711||i===8712||i===8715||i===8719||i===8721||i===8725||i===8730||i>=8733&&i<=8736||i===8739||i===8741||i>=8743&&i<=8748||i===8750||i>=8756&&i<=8759||i===8764||i===8765||i===8776||i===8780||i===8786||i===8800||i===8801||i>=8804&&i<=8807||i===8810||i===8811||i===8814||i===8815||i===8834||i===8835||i===8838||i===8839||i===8853||i===8857||i===8869||i===8895||i===8978||i>=9312&&i<=9449||i>=9451&&i<=9547||i>=9552&&i<=9587||i>=9600&&i<=9615||i>=9618&&i<=9621||i===9632||i===9633||i>=9635&&i<=9641||i===9650||i===9651||i===9654||i===9655||i===9660||i===9661||i===9664||i===9665||i>=9670&&i<=9672||i===9675||i>=9678&&i<=9681||i>=9698&&i<=9701||i===9711||i===9733||i===9734||i===9737||i===9742||i===9743||i===9756||i===9758||i===9792||i===9794||i===9824||i===9825||i>=9827&&i<=9829||i>=9831&&i<=9834||i===9836||i===9837||i===9839||i===9886||i===9887||i===9919||i>=9926&&i<=9933||i>=9935&&i<=9939||i>=9941&&i<=9953||i===9955||i===9960||i===9961||i>=9963&&i<=9969||i===9972||i>=9974&&i<=9977||i===9979||i===9980||i===9982||i===9983||i===10045||i>=10102&&i<=10111||i>=11094&&i<=11097||i>=12872&&i<=12879||i>=57344&&i<=63743||i>=65024&&i<=65039||i===65533||i>=127232&&i<=127242||i>=127248&&i<=127277||i>=127280&&i<=127337||i>=127344&&i<=127373||i===127375||i===127376||i>=127387&&i<=127404||i>=917760&&i<=917999||i>=983040&&i<=1048573||i>=1048576&&i<=1114109}c(T,"A");I(T,"isAmbiguous");function x(i){return i===12288||i>=65281&&i<=65376||i>=65504&&i<=65510}c(x,"B$1");I(x,"isFullWidth");function k(i){return i>=4352&&i<=4447||i===8986||i===8987||i===9001||i===9002||i>=9193&&i<=9196||i===9200||i===9203||i===9725||i===9726||i===9748||i===9749||i>=9776&&i<=9783||i>=9800&&i<=9811||i===9855||i>=9866&&i<=9871||i===9875||i===9889||i===9898||i===9899||i===9917||i===9918||i===9924||i===9925||i===9934||i===9940||i===9962||i===9970||i===9971||i===9973||i===9978||i===9981||i===9989||i===9994||i===9995||i===10024||i===10060||i===10062||i>=10067&&i<=10069||i===10071||i>=10133&&i<=10135||i===10160||i===10175||i===11035||i===11036||i===11088||i===11093||i>=11904&&i<=11929||i>=11931&&i<=12019||i>=12032&&i<=12245||i>=12272&&i<=12287||i>=12289&&i<=12350||i>=12353&&i<=12438||i>=12441&&i<=12543||i>=12549&&i<=12591||i>=12593&&i<=12686||i>=12688&&i<=12773||i>=12783&&i<=12830||i>=12832&&i<=12871||i>=12880&&i<=42124||i>=42128&&i<=42182||i>=43360&&i<=43388||i>=44032&&i<=55203||i>=63744&&i<=64255||i>=65040&&i<=65049||i>=65072&&i<=65106||i>=65108&&i<=65126||i>=65128&&i<=65131||i>=94176&&i<=94180||i===94192||i===94193||i>=94208&&i<=100343||i>=100352&&i<=101589||i>=101631&&i<=101640||i>=110576&&i<=110579||i>=110581&&i<=110587||i===110589||i===110590||i>=110592&&i<=110882||i===110898||i>=110928&&i<=110930||i===110933||i>=110948&&i<=110951||i>=110960&&i<=111355||i>=119552&&i<=119638||i>=119648&&i<=119670||i===126980||i===127183||i===127374||i>=127377&&i<=127386||i>=127488&&i<=127490||i>=127504&&i<=127547||i>=127552&&i<=127560||i===127568||i===127569||i>=127584&&i<=127589||i>=127744&&i<=127776||i>=127789&&i<=127797||i>=127799&&i<=127868||i>=127870&&i<=127891||i>=127904&&i<=127946||i>=127951&&i<=127955||i>=127968&&i<=127984||i===127988||i>=127992&&i<=128062||i===128064||i>=128066&&i<=128252||i>=128255&&i<=128317||i>=128331&&i<=128334||i>=128336&&i<=128359||i===128378||i===128405||i===128406||i===128420||i>=128507&&i<=128591||i>=128640&&i<=128709||i===128716||i>=128720&&i<=128722||i>=128725&&i<=128727||i>=128732&&i<=128735||i===128747||i===128748||i>=128756&&i<=128764||i>=128992&&i<=129003||i===129008||i>=129292&&i<=129338||i>=129340&&i<=129349||i>=129351&&i<=129535||i>=129648&&i<=129660||i>=129664&&i<=129673||i>=129679&&i<=129734||i>=129742&&i<=129756||i>=129759&&i<=129769||i>=129776&&i<=129784||i>=131072&&i<=196605||i>=196608&&i<=262141}c(k,"C");I(k,"isWide");function R(i){return T(i)?"ambiguous":x(i)?"fullwidth":i===8361||i>=65377&&i<=65470||i>=65474&&i<=65479||i>=65482&&i<=65487||i>=65490&&i<=65495||i>=65498&&i<=65500||i>=65512&&i<=65518?"halfwidth":i>=32&&i<=126||i===162||i===163||i===165||i===166||i===172||i===175||i>=10214&&i<=10221||i===10629||i===10630?"narrow":k(i)?"wide":"neutral"}c(R,"t$1");I(R,"getCategory");var q=Object.defineProperty,N=c((i,a)=>q(i,"name",{value:a,configurable:!0}),"t");function y(i){if(!Number.isSafeInteger(i))throw new TypeError(`Expected a code point, got \`${typeof i}\`.`)}c(y,"a");N(y,"validate");function O(i){return y(i),R(i)}c(O,"eastAsianWidthType");N(O,"eastAsianWidthType");function D(i,{ambiguousAsWide:a=!1}={}){return y(i),x(i)||k(i)||a&&T(i)?2:1}c(D,"eastAsianWidth");N(D,"eastAsianWidth");N(i=>!(x(i)||k(i)),"_isNarrowWidth");var G=Object.defineProperty,M=c((i,a)=>G(i,"name",{value:a,configurable:!0}),"d");const _=new Map,W=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,p=M(i=>i>=32&&i<=126?"latin":i===8203||i===8204||i===8205||i===8288?"zero":i<=31||i>=127&&i<=159?"control":i>=160&&i<=255||i>=9472&&i<=9599?"latin":i>=4352&&i<=4607||i>=11904&&i<=40959||i>=44032&&i<=55215||i>=63744&&i<=64255||i>=65280&&i<=65519&&!(i>=65377&&i<=65439)||i>=12352&&i<=12543?"wide":i===8230?"latin":"other","getCharType"),H=M((i,a)=>{const e=Math.floor(i/65536),l=i%65536;let u=_.get(e);if(u||(u=new Map,_.set(e,u)),u.has(l))return u.get(l);let h;if(p(i)==="latin")h=a.width.regular;else if(p(i)==="control")h=a.width.control;else if(p(i)==="wide")h=a.width.wide;else switch(O(i)){case"fullwidth":{h=a.width.fullWidth;break}case"wide":{h=a.width.wide;break}case"ambiguous":{h=a.width.ambiguousIsNarrow?a.width.regular:a.width.wide;break}default:h=a.width.regular}return u.set(l,h),h},"getCachedCharWidth"),K=M(i=>i>=768&&i<=879||i>=6832&&i<=6911||i>=7616&&i<=7679||i>=8400&&i<=8447||i>=65056&&i<=65071||i>=917760&&i<=917999||i>=65024&&i<=65039||i>=3633&&i<=3642||i>=3655&&i<=3662||i>=3761&&i<=3769||i>=3771&&i<=3772||i>=3784&&i<=3789||i>=2304&&i<=2307||i>=2362&&i<=2383||i>=2385&&i<=2391||i>=2402&&i<=2403||i>=2433&&i<=2435||i>=2492&&i<=2500||i>=2509&&i<=2509||i>=2561&&i<=2563||i>=2620&&i<=2637||i>=1611&&i<=1631||i>=1648&&i<=1648||i>=1750&&i<=1773||i>=2276&&i<=2302||i>=1425&&i<=1469||i>=1471&&i<=1471||i>=1473&&i<=1474||i>=1476&&i<=1477||i>=1479&&i<=1479||i>=3893&&i<=3893||i>=3895&&i<=3895||i>=3897&&i<=3897||i>=3953&&i<=3966||i>=3968&&i<=3972||i>=3974&&i<=3975?!0:i>=768&&i<=777||i>=803&&i<=803,"isCombiningCharacter"),B=M((i,a={})=>{if(!i||i.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const e={truncation:{countAnsiEscapeCodes:a.countAnsiEscapeCodes??!1,ellipsis:a.ellipsis??"",ellipsisWidth:a.ellipsisWidth??(a.ellipsis?B(a.ellipsis,{...a,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:a.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:a.ambiguousIsNarrow??!1,ansi:a.ansiWidth??0,control:a.controlWidth??0,emoji:a.emojiWidth??2,fullWidth:a.fullWidth??2,halfWidth:a.halfWidth??1,regular:a.regularWidth??1,tab:a.tabWidth??8,wide:a.wideWidth??2}},l=Math.max(0,e.truncation.limit-e.truncation.ellipsisWidth),{length:u}=i,h=u>1e4;let t=0,n=0,r=u,s=!1;const $=i.includes("\x1B")||i.includes("›");for(;t<u;){if($&&(i[t]==="\x1B"||i[t]==="›")){if(i.startsWith("\x1B]8;;",t)){const o="\x07",f="\x1B]8;;"+o,z=f.length,A=i.indexOf(o,t+5);if(A!==-1){const E=i.indexOf(f,A+1);if(E!==-1){const L=E+z,V=i.slice(A+1,E).replace(b,""),S=B(V,{ambiguousIsNarrow:e.width.ambiguousIsNarrow,ansiWidth:e.width.ansi,controlWidth:e.width.control,countAnsiEscapeCodes:!1,ellipsis:e.truncation.ellipsis,ellipsisWidth:e.truncation.ellipsisWidth,emojiWidth:e.width.emoji,fullWidth:e.width.fullWidth,halfWidth:e.width.halfWidth,limit:Math.max(0,l-n),regularWidth:e.width.regular,tabWidth:e.width.tab,wideWidth:e.width.wide}),C=S.width;if(S.truncated)s=!0,r=Math.min(r,t);else if(n+C>l&&(r=Math.min(r,t),s=!0,n+C>e.truncation.limit))break;if(n+=C,t=L,s&&n>=e.truncation.limit)break;continue}}}if(b.lastIndex=t,b.test(i)){const o=b.lastIndex-t,f=e.truncation.countAnsiEscapeCodes?o:e.width.ansi;if(n+f>l&&(r=Math.min(r,t),n+f>e.truncation.limit)){s=!0;break}n+=f,t=b.lastIndex;continue}}const w=i.codePointAt(t);if(w===8203||w===65279||w>=8288&&w<=8292){t++;continue}if(w===9){if(n+e.width.tab>l&&(r=Math.min(r,t),n+e.width.tab>e.truncation.limit)){s=!0;break}n+=e.width.tab,t++;continue}if(W.lastIndex=t,W.test(i)){const o=(W.lastIndex-t)*e.width.regular;if(n+o>l){const f=Math.floor((l-n)/e.width.regular);if(r=Math.min(r,t+f),n+o>e.truncation.limit){s=!0;break}}n+=o,t=W.lastIndex;continue}if((w<=31||w>=127&&w<=159)&&(g.lastIndex=t,g.test(i))){const o=(g.lastIndex-t)*e.width.control;if(n+o>l&&(r=Math.min(r,t+Math.floor((l-n)/e.width.control)),n+o>e.truncation.limit)){s=!0;break}n+=o,t=g.lastIndex;continue}if(j.lastIndex=t,j.test(i)){if(n+e.width.emoji>l&&(r=Math.min(r,t),n+e.width.emoji>e.truncation.limit)){s=!0;break}n+=e.width.emoji,t=j.lastIndex;continue}const m=i.codePointAt(t)??0;if(K(m)){t+=m>65535?2:1;continue}let d;if(h)d=H(m,e);else switch(p(m)){case"latin":{d=e.width.regular;break}case"control":{d=e.width.control;break}case"wide":{d=e.width.wide;break}case"zero":{d=0;break}default:switch(O(m)){case"fullwidth":{d=e.width.fullWidth;break}case"wide":{d=e.width.wide;break}case"ambiguous":{d=e.width.ambiguousIsNarrow?e.width.regular:e.width.wide;break}default:d=e.width.regular}}if(n+d>l&&(r=Math.min(r,t),n+d>e.truncation.limit)){s=!0;break}n+=d,t+=m>65535?2:1}let v=n,P=!1;return s&&e.truncation.limit>=e.truncation.ellipsisWidth&&(v=e.truncation.limit,P=!0),{ellipsed:P,index:s?r:u,truncated:s,width:v}},"getStringTruncatedWidth");export{B as getStringTruncatedWidth};
@@ -1,11 +1 @@
1
- 'use strict';
2
-
3
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
4
-
5
- const getStringTruncatedWidth = require('./get-string-truncated-width.cjs');
6
-
7
- var __defProp = Object.defineProperty;
8
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
- const getStringWidth = /* @__PURE__ */ __name((input, options = {}) => getStringTruncatedWidth.getStringTruncatedWidth(input, { ...options, ellipsis: "", ellipsisWidth: 0, limit: Number.POSITIVE_INFINITY }).width, "getStringWidth");
10
-
11
- exports.getStringWidth = getStringWidth;
1
+ "use strict";var r=Object.defineProperty;var i=(e,t)=>r(e,"name",{value:t,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("./get-string-truncated-width.cjs");var d=Object.defineProperty,g=i((e,t)=>d(e,"name",{value:t,configurable:!0}),"r");const u=g((e,t={})=>n.getStringTruncatedWidth(e,{...t,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,"getStringWidth");exports.getStringWidth=u;
@@ -3,4 +3,5 @@ import { StringTruncatedWidthOptions } from './get-string-truncated-width.cjs';
3
3
  type StringWidthOptions = Omit<StringTruncatedWidthOptions, "ellipsis" | "ellipsisWidth" | "limit">;
4
4
  declare const getStringWidth: (input: string, options?: StringWidthOptions) => number;
5
5
 
6
- export { type StringWidthOptions, getStringWidth };
6
+ export { getStringWidth };
7
+ export type { StringWidthOptions };
@@ -3,4 +3,5 @@ import { StringTruncatedWidthOptions } from './get-string-truncated-width.mjs';
3
3
  type StringWidthOptions = Omit<StringTruncatedWidthOptions, "ellipsis" | "ellipsisWidth" | "limit">;
4
4
  declare const getStringWidth: (input: string, options?: StringWidthOptions) => number;
5
5
 
6
- export { type StringWidthOptions, getStringWidth };
6
+ export { getStringWidth };
7
+ export type { StringWidthOptions };
@@ -3,4 +3,5 @@ import { StringTruncatedWidthOptions } from './get-string-truncated-width.js';
3
3
  type StringWidthOptions = Omit<StringTruncatedWidthOptions, "ellipsis" | "ellipsisWidth" | "limit">;
4
4
  declare const getStringWidth: (input: string, options?: StringWidthOptions) => number;
5
5
 
6
- export { type StringWidthOptions, getStringWidth };
6
+ export { getStringWidth };
7
+ export type { StringWidthOptions };
@@ -1,7 +1 @@
1
- import { getStringTruncatedWidth } from './get-string-truncated-width.mjs';
2
-
3
- var __defProp = Object.defineProperty;
4
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
- const getStringWidth = /* @__PURE__ */ __name((input, options = {}) => getStringTruncatedWidth(input, { ...options, ellipsis: "", ellipsisWidth: 0, limit: Number.POSITIVE_INFINITY }).width, "getStringWidth");
6
-
7
- export { getStringWidth };
1
+ var r=Object.defineProperty;var e=(t,i)=>r(t,"name",{value:i,configurable:!0});import{getStringTruncatedWidth as n}from"./get-string-truncated-width.mjs";var d=Object.defineProperty,g=e((t,i)=>d(t,"name",{value:i,configurable:!0}),"r");const o=g((t,i={})=>n(t,{...i,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,"getStringWidth");export{o as getStringWidth};
package/dist/index.cjs CHANGED
@@ -1,66 +1 @@
1
- 'use strict';
2
-
3
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
4
-
5
- const case_camelCase = require('./case/camel-case.cjs');
6
- const case_capitalCase = require('./case/capital-case.cjs');
7
- const case_constantCase = require('./case/constant-case.cjs');
8
- const case_dotCase = require('./case/dot-case.cjs');
9
- const case_flatCase = require('./case/flat-case.cjs');
10
- const case_flipCase = require('./case/flip-case.cjs');
11
- const case_identifyCase = require('./case/identify-case.cjs');
12
- const case_kebabCase = require('./case/kebab-case.cjs');
13
- const case_lowerFirst = require('./case/lower-first.cjs');
14
- const case_noCase = require('./case/no-case.cjs');
15
- const case_pascalCase = require('./case/pascal-case.cjs');
16
- const case_pascalSnakeCase = require('./case/pascal-snake-case.cjs');
17
- const case_pathCase = require('./case/path-case.cjs');
18
- const case_sentenceCase = require('./case/sentence-case.cjs');
19
- const case_snakeCase = require('./case/snake-case.cjs');
20
- const case_splitByCase = require('./case/split-by-case.cjs');
21
- const case_titleCase = require('./case/title-case.cjs');
22
- const case_trainCase = require('./case/train-case.cjs');
23
- const case_upperFirst = require('./case/upper-first.cjs');
24
- const joinSegments = require('./packem_shared/joinSegments-B_7bxy5J.cjs');
25
- const getStringTruncatedWidth = require('./get-string-truncated-width.cjs');
26
- const getStringWidth = require('./get-string-width.cjs');
27
- const outdent = require('./outdent.cjs');
28
- const replaceString = require('./packem_shared/replaceString-iYo1cDfZ.cjs');
29
- const slice = require('./slice.cjs');
30
- const slugify = require('./packem_shared/slugify-jh6PftAT.cjs');
31
- const transliterate = require('./packem_shared/transliterate-BEci5RC8.cjs');
32
- const truncate = require('./truncate.cjs');
33
- const WrapMode = require('./packem_shared/WrapMode-Dsqu9BaX.cjs');
34
-
35
-
36
-
37
- exports.camelCase = case_camelCase;
38
- exports.capitalCase = case_capitalCase;
39
- exports.constantCase = case_constantCase;
40
- exports.dotCase = case_dotCase;
41
- exports.flatCase = case_flatCase;
42
- exports.flipCase = case_flipCase.flipCase;
43
- exports.identifyCase = case_identifyCase;
44
- exports.kebabCase = case_kebabCase.kebabCase;
45
- exports.lowerFirst = case_lowerFirst;
46
- exports.noCase = case_noCase;
47
- exports.pascalCase = case_pascalCase;
48
- exports.pascalSnakeCase = case_pascalSnakeCase;
49
- exports.pathCase = case_pathCase;
50
- exports.sentenceCase = case_sentenceCase;
51
- exports.snakeCase = case_snakeCase;
52
- exports.splitByCase = case_splitByCase.splitByCase;
53
- exports.titleCase = case_titleCase;
54
- exports.trainCase = case_trainCase;
55
- exports.upperFirst = case_upperFirst;
56
- exports.joinSegments = joinSegments;
57
- exports.getStringTruncatedWidth = getStringTruncatedWidth.getStringTruncatedWidth;
58
- exports.getStringWidth = getStringWidth.getStringWidth;
59
- exports.outdent = outdent.outdent;
60
- exports.replaceString = replaceString;
61
- exports.slice = slice.slice;
62
- exports.slugify = slugify;
63
- exports.transliterate = transliterate;
64
- exports.truncate = truncate.truncate;
65
- exports.WrapMode = WrapMode.WrapMode;
66
- exports.wordWrap = WrapMode.wordWrap;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("./packem_shared/alignText-CLZJuPP6.cjs"),r=require("./case/camel-case.cjs"),s=require("./case/capital-case.cjs"),t=require("./case/constant-case.cjs"),i=require("./case/dot-case.cjs"),u=require("./case/flat-case.cjs"),n=require("./case/flip-case.cjs"),c=require("./case/identify-case.cjs"),l=require("./case/kebab-case.cjs"),C=require("./case/lower-first.cjs"),q=require("./case/no-case.cjs"),p=require("./case/pascal-case.cjs"),d=require("./case/pascal-snake-case.cjs"),o=require("./case/path-case.cjs"),g=require("./case/sentence-case.cjs"),_=require("./case/snake-case.cjs"),S=require("./case/split-by-case.cjs"),W=require("./case/title-case.cjs"),f=require("./case/train-case.cjs"),b=require("./case/upper-first.cjs"),h=require("./packem_shared/joinSegments-CDHNMXsF.cjs"),y=require("./get-string-truncated-width.cjs"),k=require("./get-string-width.cjs"),T=require("./outdent.cjs"),m=require("./packem_shared/replaceString-Ce8TI_-L.cjs"),M=require("./slice.cjs"),w=require("./packem_shared/slugify-CH3GI7E5.cjs"),F=require("./packem_shared/transliterate-CToQ-aeM.cjs"),j=require("./truncate.cjs"),e=require("./packem_shared/WrapMode-BL2dnSc8.cjs");exports.alignText=a.alignText;exports.camelCase=r;exports.capitalCase=s;exports.constantCase=t;exports.dotCase=i;exports.flatCase=u;exports.flipCase=n.flipCase;exports.identifyCase=c;exports.kebabCase=l.kebabCase;exports.lowerFirst=C;exports.noCase=q;exports.pascalCase=p;exports.pascalSnakeCase=d;exports.pathCase=o;exports.sentenceCase=g;exports.snakeCase=_;exports.splitByCase=S.splitByCase;exports.titleCase=W;exports.trainCase=f;exports.upperFirst=b;exports.joinSegments=h;exports.getStringTruncatedWidth=y.getStringTruncatedWidth;exports.getStringWidth=k.getStringWidth;exports.outdent=T.outdent;exports.replaceString=m;exports.slice=M.slice;exports.slugify=w;exports.transliterate=F;exports.truncate=j.truncate;exports.WrapMode=e.WrapMode;exports.wordWrap=e.wordWrap;
package/dist/index.d.cts CHANGED
@@ -1,3 +1,5 @@
1
+ import { StringWidthOptions } from './get-string-width.cjs';
2
+ export { getStringWidth } from './get-string-width.cjs';
1
3
  export { default as camelCase } from './case/camel-case.cjs';
2
4
  export { default as capitalCase } from './case/capital-case.cjs';
3
5
  export { default as constantCase } from './case/constant-case.cjs';
@@ -16,18 +18,25 @@ export { default as snakeCase } from './case/snake-case.cjs';
16
18
  export { SplitOptions, splitByCase } from './case/split-by-case.cjs';
17
19
  export { default as titleCase } from './case/title-case.cjs';
18
20
  export { default as trainCase } from './case/train-case.cjs';
19
- export { a as CamelCase, b as CapitalCase, C as CaseOptions, c as ConstantCase, D as DotCase, F as FlatCase, d as FlipCase, I as IdentifyCase, K as KebabCase, L as LocaleOptions, e as LowerFirst, N as NoCase, P as PascalCase, f as PascalSnakeCase, g as PathCase, S as SentenceCase, h as SnakeCase, i as SplitByCase, T as TitleCase, j as TrainCase, U as UpperFirst } from './packem_shared/types-C5Pk8B8Q.cjs';
21
+ export { a as CamelCase, b as CapitalCase, C as CaseOptions, c as ConstantCase, D as DotCase, F as FlatCase, d as FlipCase, I as IdentifyCase, K as KebabCase, L as LocaleOptions, e as LowerFirst, N as NoCase, P as PascalCase, f as PascalSnakeCase, g as PathCase, S as SentenceCase, h as SnakeCase, i as SplitByCase, T as TitleCase, j as TrainCase, U as UpperFirst } from './packem_shared/types-DrtiqNkK.cjs';
20
22
  export { default as upperFirst } from './case/upper-first.cjs';
21
23
  export { joinSegments } from './case/index.cjs';
22
24
  export { StringTruncatedWidthOptions, StringTruncatedWidthResult, getStringTruncatedWidth } from './get-string-truncated-width.cjs';
23
- export { StringWidthOptions, getStringWidth } from './get-string-width.cjs';
24
25
  export { Outdent, Options as OutdentOptions, outdent } from './outdent.cjs';
25
- import { O as OptionReplaceArray, k as IntervalArray, l as SlugifyOptions, m as OptionsTransliterate } from './packem_shared/types-DmfKbIaI.cjs';
26
- export { A as All, n as Any, C as CharAt, o as Charmap, a as Concat, E as EndsWith, I as Includes, p as Interval, q as IsBooleanLiteral, r as IsNumberLiteral, j as IsStringLiteral, s as IsStringLiteralArray, J as Join, L as Length, M as Math, N as NodeLocale, t as OptionReplaceCombined, u as OptionReplaceObject, P as PadEnd, b as PadStart, v as Repeat, R as Replace, c as ReplaceAll, w as Reverse, S as Slice, d as Split, e as StartsWith, T as ToLowerCase, f as ToUpperCase, g as Trim, h as TrimEnd, i as TrimStart } from './packem_shared/types-DmfKbIaI.cjs';
26
+ import { O as OptionReplaceArray, k as IntervalArray, l as SlugifyOptions, m as OptionsTransliterate } from './packem_shared/types-BSdIWVzn.cjs';
27
+ export { A as All, n as Any, C as CharAt, o as Charmap, a as Concat, E as EndsWith, I as Includes, p as Interval, q as IsBooleanLiteral, r as IsNumberLiteral, j as IsStringLiteral, s as IsStringLiteralArray, J as Join, L as Length, M as Math, N as NodeLocale, t as OptionReplaceCombined, u as OptionReplaceObject, P as PadEnd, b as PadStart, v as Repeat, R as Replace, c as ReplaceAll, w as Reverse, S as Slice, d as Split, e as StartsWith, T as ToLowerCase, f as ToUpperCase, g as Trim, h as TrimEnd, i as TrimStart } from './packem_shared/types-BSdIWVzn.cjs';
27
28
  export { SliceOptions, slice } from './slice.cjs';
28
29
  export { TruncateOptions, truncate } from './truncate.cjs';
29
30
  import './packem_shared/lru-cache-B_t27XwI.cjs';
30
31
 
32
+ type AlignTextOptions = {
33
+ align?: "center" | "left" | "right";
34
+ pad?: string;
35
+ split?: string;
36
+ stringWidthOptions?: StringWidthOptions;
37
+ };
38
+ declare const alignText: (text: string[] | string, options?: AlignTextOptions) => string[] | string;
39
+
31
40
  declare const replaceString: (source: string, searches: OptionReplaceArray, ignoreRanges: IntervalArray) => string;
32
41
 
33
42
  declare const slugify: (input: string, options?: SlugifyOptions) => string;
@@ -47,4 +56,5 @@ interface WordWrapOptions {
47
56
  }
48
57
  declare const wordWrap: (string: string, options?: WordWrapOptions) => string;
49
58
 
50
- export { IntervalArray, OptionReplaceArray, OptionsTransliterate, SlugifyOptions, type WordWrapOptions, WrapMode, replaceString, slugify, transliterate, wordWrap };
59
+ export { IntervalArray, OptionReplaceArray, OptionsTransliterate, SlugifyOptions, StringWidthOptions, WrapMode, alignText, replaceString, slugify, transliterate, wordWrap };
60
+ export type { AlignTextOptions, WordWrapOptions };