index.cjs 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655
  1. "use strict";
  2. var __create = Object.create;
  3. var __defProp = Object.defineProperty;
  4. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  5. var __getOwnPropNames = Object.getOwnPropertyNames;
  6. var __getProtoOf = Object.getPrototypeOf;
  7. var __hasOwnProp = Object.prototype.hasOwnProperty;
  8. var __esm = (fn, res) => function __init() {
  9. return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
  10. };
  11. var __commonJS = (cb, mod) => function __require() {
  12. return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
  13. };
  14. var __export = (target, all) => {
  15. for (var name in all)
  16. __defProp(target, name, { get: all[name], enumerable: true });
  17. };
  18. var __copyProps = (to, from, except, desc) => {
  19. if (from && typeof from === "object" || typeof from === "function") {
  20. for (let key of __getOwnPropNames(from))
  21. if (!__hasOwnProp.call(to, key) && key !== except)
  22. __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  23. }
  24. return to;
  25. };
  26. var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  27. // If the importer is in node compatibility mode or this is not an ESM
  28. // file that has been converted to a CommonJS file using a Babel-
  29. // compatible transform (i.e. "__esModule" has not been set), then set
  30. // "default" to the CommonJS "module.exports" for node compatibility.
  31. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  32. mod
  33. ));
  34. var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  35. // src/utils/skip-inline-comment.js
  36. function skipInlineComment(text, startIndex) {
  37. if (startIndex === false) {
  38. return false;
  39. }
  40. if (text.charAt(startIndex) === "/" && text.charAt(startIndex + 1) === "*") {
  41. for (let i = startIndex + 2; i < text.length; ++i) {
  42. if (text.charAt(i) === "*" && text.charAt(i + 1) === "/") {
  43. return i + 2;
  44. }
  45. }
  46. }
  47. return startIndex;
  48. }
  49. var skip_inline_comment_default;
  50. var init_skip_inline_comment = __esm({
  51. "src/utils/skip-inline-comment.js"() {
  52. skip_inline_comment_default = skipInlineComment;
  53. }
  54. });
  55. // src/utils/skip-newline.js
  56. function skipNewline(text, startIndex, options) {
  57. const backwards = Boolean(options == null ? void 0 : options.backwards);
  58. if (startIndex === false) {
  59. return false;
  60. }
  61. const character = text.charAt(startIndex);
  62. if (backwards) {
  63. if (text.charAt(startIndex - 1) === "\r" && character === "\n") {
  64. return startIndex - 2;
  65. }
  66. if (character === "\n" || character === "\r" || character === "\u2028" || character === "\u2029") {
  67. return startIndex - 1;
  68. }
  69. } else {
  70. if (character === "\r" && text.charAt(startIndex + 1) === "\n") {
  71. return startIndex + 2;
  72. }
  73. if (character === "\n" || character === "\r" || character === "\u2028" || character === "\u2029") {
  74. return startIndex + 1;
  75. }
  76. }
  77. return startIndex;
  78. }
  79. var skip_newline_default;
  80. var init_skip_newline = __esm({
  81. "src/utils/skip-newline.js"() {
  82. skip_newline_default = skipNewline;
  83. }
  84. });
  85. // src/utils/skip.js
  86. function skip(characters) {
  87. return (text, startIndex, options) => {
  88. const backwards = Boolean(options == null ? void 0 : options.backwards);
  89. if (startIndex === false) {
  90. return false;
  91. }
  92. const { length } = text;
  93. let cursor = startIndex;
  94. while (cursor >= 0 && cursor < length) {
  95. const character = text.charAt(cursor);
  96. if (characters instanceof RegExp) {
  97. if (!characters.test(character)) {
  98. return cursor;
  99. }
  100. } else if (!characters.includes(character)) {
  101. return cursor;
  102. }
  103. backwards ? cursor-- : cursor++;
  104. }
  105. if (cursor === -1 || cursor === length) {
  106. return cursor;
  107. }
  108. return false;
  109. };
  110. }
  111. var skipWhitespace, skipSpaces, skipToLineEnd, skipEverythingButNewLine;
  112. var init_skip = __esm({
  113. "src/utils/skip.js"() {
  114. skipWhitespace = skip(/\s/);
  115. skipSpaces = skip(" ");
  116. skipToLineEnd = skip(",; ");
  117. skipEverythingButNewLine = skip(/[^\n\r]/);
  118. }
  119. });
  120. // src/utils/skip-trailing-comment.js
  121. function skipTrailingComment(text, startIndex) {
  122. if (startIndex === false) {
  123. return false;
  124. }
  125. if (text.charAt(startIndex) === "/" && text.charAt(startIndex + 1) === "/") {
  126. return skipEverythingButNewLine(text, startIndex);
  127. }
  128. return startIndex;
  129. }
  130. var skip_trailing_comment_default;
  131. var init_skip_trailing_comment = __esm({
  132. "src/utils/skip-trailing-comment.js"() {
  133. init_skip();
  134. skip_trailing_comment_default = skipTrailingComment;
  135. }
  136. });
  137. // src/utils/get-next-non-space-non-comment-character-index.js
  138. function getNextNonSpaceNonCommentCharacterIndex(text, startIndex) {
  139. let oldIdx = null;
  140. let nextIdx = startIndex;
  141. while (nextIdx !== oldIdx) {
  142. oldIdx = nextIdx;
  143. nextIdx = skipSpaces(text, nextIdx);
  144. nextIdx = skip_inline_comment_default(text, nextIdx);
  145. nextIdx = skip_trailing_comment_default(text, nextIdx);
  146. nextIdx = skip_newline_default(text, nextIdx);
  147. }
  148. return nextIdx;
  149. }
  150. var get_next_non_space_non_comment_character_index_default;
  151. var init_get_next_non_space_non_comment_character_index = __esm({
  152. "src/utils/get-next-non-space-non-comment-character-index.js"() {
  153. init_skip_inline_comment();
  154. init_skip_newline();
  155. init_skip_trailing_comment();
  156. init_skip();
  157. get_next_non_space_non_comment_character_index_default = getNextNonSpaceNonCommentCharacterIndex;
  158. }
  159. });
  160. // src/utils/is-previous-line-empty.js
  161. function isPreviousLineEmpty(text, startIndex) {
  162. let idx = startIndex - 1;
  163. idx = skipSpaces(text, idx, { backwards: true });
  164. idx = skip_newline_default(text, idx, { backwards: true });
  165. idx = skipSpaces(text, idx, { backwards: true });
  166. const idx2 = skip_newline_default(text, idx, { backwards: true });
  167. return idx !== idx2;
  168. }
  169. var is_previous_line_empty_default;
  170. var init_is_previous_line_empty = __esm({
  171. "src/utils/is-previous-line-empty.js"() {
  172. init_skip_newline();
  173. init_skip();
  174. is_previous_line_empty_default = isPreviousLineEmpty;
  175. }
  176. });
  177. // src/utils/has-newline.js
  178. function hasNewline(text, startIndex, options = {}) {
  179. const idx = skipSpaces(
  180. text,
  181. options.backwards ? startIndex - 1 : startIndex,
  182. options
  183. );
  184. const idx2 = skip_newline_default(text, idx, options);
  185. return idx !== idx2;
  186. }
  187. var has_newline_default;
  188. var init_has_newline = __esm({
  189. "src/utils/has-newline.js"() {
  190. init_skip();
  191. init_skip_newline();
  192. has_newline_default = hasNewline;
  193. }
  194. });
  195. // src/utils/is-next-line-empty.js
  196. function isNextLineEmpty(text, startIndex) {
  197. let oldIdx = null;
  198. let idx = startIndex;
  199. while (idx !== oldIdx) {
  200. oldIdx = idx;
  201. idx = skipToLineEnd(text, idx);
  202. idx = skip_inline_comment_default(text, idx);
  203. idx = skipSpaces(text, idx);
  204. }
  205. idx = skip_trailing_comment_default(text, idx);
  206. idx = skip_newline_default(text, idx);
  207. return idx !== false && has_newline_default(text, idx);
  208. }
  209. var is_next_line_empty_default;
  210. var init_is_next_line_empty = __esm({
  211. "src/utils/is-next-line-empty.js"() {
  212. init_skip_newline();
  213. init_skip();
  214. init_skip_inline_comment();
  215. init_skip_trailing_comment();
  216. init_has_newline();
  217. is_next_line_empty_default = isNextLineEmpty;
  218. }
  219. });
  220. // node_modules/escape-string-regexp/index.js
  221. function escapeStringRegexp(string) {
  222. if (typeof string !== "string") {
  223. throw new TypeError("Expected a string");
  224. }
  225. return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
  226. }
  227. var init_escape_string_regexp = __esm({
  228. "node_modules/escape-string-regexp/index.js"() {
  229. }
  230. });
  231. // src/utils/get-max-continuous-count.js
  232. function getMaxContinuousCount(text, searchString) {
  233. const results = text.match(
  234. new RegExp(`(${escapeStringRegexp(searchString)})+`, "g")
  235. );
  236. if (results === null) {
  237. return 0;
  238. }
  239. return results.reduce(
  240. (maxCount, result) => Math.max(maxCount, result.length / searchString.length),
  241. 0
  242. );
  243. }
  244. var get_max_continuous_count_default;
  245. var init_get_max_continuous_count = __esm({
  246. "src/utils/get-max-continuous-count.js"() {
  247. init_escape_string_regexp();
  248. get_max_continuous_count_default = getMaxContinuousCount;
  249. }
  250. });
  251. // node_modules/emoji-regex/index.mjs
  252. var emoji_regex_default;
  253. var init_emoji_regex = __esm({
  254. "node_modules/emoji-regex/index.mjs"() {
  255. emoji_regex_default = () => {
  256. return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26F9(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC3\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC08\uDC26](?:\u200D\u2B1B)?|[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC2\uDECE-\uDEDB\uDEE0-\uDEE8]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
  257. };
  258. }
  259. });
  260. // node_modules/eastasianwidth/eastasianwidth.js
  261. var eastasianwidth_default;
  262. var init_eastasianwidth = __esm({
  263. "node_modules/eastasianwidth/eastasianwidth.js"() {
  264. eastasianwidth_default = {
  265. eastAsianWidth(character) {
  266. var x = character.charCodeAt(0);
  267. var y = character.length == 2 ? character.charCodeAt(1) : 0;
  268. var codePoint = x;
  269. if (55296 <= x && x <= 56319 && 56320 <= y && y <= 57343) {
  270. x &= 1023;
  271. y &= 1023;
  272. codePoint = x << 10 | y;
  273. codePoint += 65536;
  274. }
  275. if (12288 == codePoint || 65281 <= codePoint && codePoint <= 65376 || 65504 <= codePoint && codePoint <= 65510) {
  276. return "F";
  277. }
  278. if (4352 <= codePoint && codePoint <= 4447 || 4515 <= codePoint && codePoint <= 4519 || 4602 <= codePoint && codePoint <= 4607 || 9001 <= codePoint && codePoint <= 9002 || 11904 <= codePoint && codePoint <= 11929 || 11931 <= codePoint && codePoint <= 12019 || 12032 <= codePoint && codePoint <= 12245 || 12272 <= codePoint && codePoint <= 12283 || 12289 <= codePoint && codePoint <= 12350 || 12353 <= codePoint && codePoint <= 12438 || 12441 <= codePoint && codePoint <= 12543 || 12549 <= codePoint && codePoint <= 12589 || 12593 <= codePoint && codePoint <= 12686 || 12688 <= codePoint && codePoint <= 12730 || 12736 <= codePoint && codePoint <= 12771 || 12784 <= codePoint && codePoint <= 12830 || 12832 <= codePoint && codePoint <= 12871 || 12880 <= codePoint && codePoint <= 13054 || 13056 <= codePoint && codePoint <= 19903 || 19968 <= codePoint && codePoint <= 42124 || 42128 <= codePoint && codePoint <= 42182 || 43360 <= codePoint && codePoint <= 43388 || 44032 <= codePoint && codePoint <= 55203 || 55216 <= codePoint && codePoint <= 55238 || 55243 <= codePoint && codePoint <= 55291 || 63744 <= codePoint && codePoint <= 64255 || 65040 <= codePoint && codePoint <= 65049 || 65072 <= codePoint && codePoint <= 65106 || 65108 <= codePoint && codePoint <= 65126 || 65128 <= codePoint && codePoint <= 65131 || 110592 <= codePoint && codePoint <= 110593 || 127488 <= codePoint && codePoint <= 127490 || 127504 <= codePoint && codePoint <= 127546 || 127552 <= codePoint && codePoint <= 127560 || 127568 <= codePoint && codePoint <= 127569 || 131072 <= codePoint && codePoint <= 194367 || 177984 <= codePoint && codePoint <= 196605 || 196608 <= codePoint && codePoint <= 262141) {
  279. return "W";
  280. }
  281. return "N";
  282. }
  283. };
  284. }
  285. });
  286. // src/utils/get-string-width.js
  287. function getStringWidth(text) {
  288. if (!text) {
  289. return 0;
  290. }
  291. if (!notAsciiRegex.test(text)) {
  292. return text.length;
  293. }
  294. text = text.replace(emoji_regex_default(), " ");
  295. let width = 0;
  296. for (const character of text) {
  297. const codePoint = character.codePointAt(0);
  298. if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
  299. continue;
  300. }
  301. if (codePoint >= 768 && codePoint <= 879) {
  302. continue;
  303. }
  304. const code = eastasianwidth_default.eastAsianWidth(character);
  305. width += code === "F" || code === "W" ? 2 : 1;
  306. }
  307. return width;
  308. }
  309. var notAsciiRegex, get_string_width_default;
  310. var init_get_string_width = __esm({
  311. "src/utils/get-string-width.js"() {
  312. init_emoji_regex();
  313. init_eastasianwidth();
  314. notAsciiRegex = /[^\x20-\x7F]/;
  315. get_string_width_default = getStringWidth;
  316. }
  317. });
  318. // src/utils/get-alignment-size.js
  319. function getAlignmentSize(text, tabWidth, startIndex = 0) {
  320. let size = 0;
  321. for (let i = startIndex; i < text.length; ++i) {
  322. if (text[i] === " ") {
  323. size = size + tabWidth - size % tabWidth;
  324. } else {
  325. size++;
  326. }
  327. }
  328. return size;
  329. }
  330. var get_alignment_size_default;
  331. var init_get_alignment_size = __esm({
  332. "src/utils/get-alignment-size.js"() {
  333. get_alignment_size_default = getAlignmentSize;
  334. }
  335. });
  336. // src/utils/get-indent-size.js
  337. function getIndentSize(value, tabWidth) {
  338. const lastNewlineIndex = value.lastIndexOf("\n");
  339. if (lastNewlineIndex === -1) {
  340. return 0;
  341. }
  342. return get_alignment_size_default(
  343. // All the leading whitespaces
  344. value.slice(lastNewlineIndex + 1).match(/^[\t ]*/)[0],
  345. tabWidth
  346. );
  347. }
  348. var get_indent_size_default;
  349. var init_get_indent_size = __esm({
  350. "src/utils/get-indent-size.js"() {
  351. init_get_alignment_size();
  352. get_indent_size_default = getIndentSize;
  353. }
  354. });
  355. // src/utils/has-newline-in-range.js
  356. function hasNewlineInRange(text, startIndex, endIndex) {
  357. for (let i = startIndex; i < endIndex; ++i) {
  358. if (text.charAt(i) === "\n") {
  359. return true;
  360. }
  361. }
  362. return false;
  363. }
  364. var has_newline_in_range_default;
  365. var init_has_newline_in_range = __esm({
  366. "src/utils/has-newline-in-range.js"() {
  367. has_newline_in_range_default = hasNewlineInRange;
  368. }
  369. });
  370. // src/utils/has-spaces.js
  371. function hasSpaces(text, startIndex, options = {}) {
  372. const idx = skipSpaces(
  373. text,
  374. options.backwards ? startIndex - 1 : startIndex,
  375. options
  376. );
  377. return idx !== startIndex;
  378. }
  379. var has_spaces_default;
  380. var init_has_spaces = __esm({
  381. "src/utils/has-spaces.js"() {
  382. init_skip();
  383. has_spaces_default = hasSpaces;
  384. }
  385. });
  386. // src/utils/get-next-non-space-non-comment-character.js
  387. function getNextNonSpaceNonCommentCharacter(text, startIndex) {
  388. const index = get_next_non_space_non_comment_character_index_default(text, startIndex);
  389. return index === false ? "" : text.charAt(index);
  390. }
  391. var get_next_non_space_non_comment_character_default;
  392. var init_get_next_non_space_non_comment_character = __esm({
  393. "src/utils/get-next-non-space-non-comment-character.js"() {
  394. init_get_next_non_space_non_comment_character_index();
  395. get_next_non_space_non_comment_character_default = getNextNonSpaceNonCommentCharacter;
  396. }
  397. });
  398. // scripts/build/shims/string-replace-all.js
  399. var stringReplaceAll, string_replace_all_default;
  400. var init_string_replace_all = __esm({
  401. "scripts/build/shims/string-replace-all.js"() {
  402. stringReplaceAll = (isOptionalObject, original, pattern, replacement) => {
  403. if (isOptionalObject && (original === void 0 || original === null)) {
  404. return;
  405. }
  406. if (original.replaceAll) {
  407. return original.replaceAll(pattern, replacement);
  408. }
  409. if (pattern.global) {
  410. return original.replace(pattern, replacement);
  411. }
  412. return original.split(pattern).join(replacement);
  413. };
  414. string_replace_all_default = stringReplaceAll;
  415. }
  416. });
  417. // src/utils/make-string.js
  418. function makeString(rawText, enclosingQuote, unescapeUnnecessaryEscapes) {
  419. const otherQuote = enclosingQuote === '"' ? "'" : '"';
  420. const regex = /\\(.)|(["'])/gs;
  421. const raw = string_replace_all_default(
  422. /* isOptionalObject*/
  423. false,
  424. rawText,
  425. regex,
  426. (match, escaped, quote) => {
  427. if (escaped === otherQuote) {
  428. return escaped;
  429. }
  430. if (quote === enclosingQuote) {
  431. return "\\" + quote;
  432. }
  433. if (quote) {
  434. return quote;
  435. }
  436. return unescapeUnnecessaryEscapes && /^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/.test(escaped) ? escaped : "\\" + escaped;
  437. }
  438. );
  439. return enclosingQuote + raw + enclosingQuote;
  440. }
  441. var make_string_default;
  442. var init_make_string = __esm({
  443. "src/utils/make-string.js"() {
  444. init_string_replace_all();
  445. make_string_default = makeString;
  446. }
  447. });
  448. // src/main/comments/utils.js
  449. function describeNodeForDebugging(node) {
  450. const nodeType = node.type || node.kind || "(unknown type)";
  451. let nodeName = String(
  452. node.name || node.id && (typeof node.id === "object" ? node.id.name : node.id) || node.key && (typeof node.key === "object" ? node.key.name : node.key) || node.value && (typeof node.value === "object" ? "" : String(node.value)) || node.operator || ""
  453. );
  454. if (nodeName.length > 20) {
  455. nodeName = nodeName.slice(0, 19) + "\u2026";
  456. }
  457. return nodeType + (nodeName ? " " + nodeName : "");
  458. }
  459. function addCommentHelper(node, comment) {
  460. const comments = node.comments ?? (node.comments = []);
  461. comments.push(comment);
  462. comment.printed = false;
  463. comment.nodeDescription = describeNodeForDebugging(node);
  464. }
  465. function addLeadingComment(node, comment) {
  466. comment.leading = true;
  467. comment.trailing = false;
  468. addCommentHelper(node, comment);
  469. }
  470. function addDanglingComment(node, comment, marker) {
  471. comment.leading = false;
  472. comment.trailing = false;
  473. if (marker) {
  474. comment.marker = marker;
  475. }
  476. addCommentHelper(node, comment);
  477. }
  478. function addTrailingComment(node, comment) {
  479. comment.leading = false;
  480. comment.trailing = true;
  481. addCommentHelper(node, comment);
  482. }
  483. var init_utils = __esm({
  484. "src/main/comments/utils.js"() {
  485. }
  486. });
  487. // src/utils/public.js
  488. var public_exports = {};
  489. __export(public_exports, {
  490. addDanglingComment: () => addDanglingComment,
  491. addLeadingComment: () => addLeadingComment,
  492. addTrailingComment: () => addTrailingComment,
  493. getAlignmentSize: () => get_alignment_size_default,
  494. getIndentSize: () => get_indent_size_default,
  495. getMaxContinuousCount: () => get_max_continuous_count_default,
  496. getNextNonSpaceNonCommentCharacter: () => get_next_non_space_non_comment_character_default,
  497. getNextNonSpaceNonCommentCharacterIndex: () => getNextNonSpaceNonCommentCharacterIndex2,
  498. getStringWidth: () => get_string_width_default,
  499. hasNewline: () => has_newline_default,
  500. hasNewlineInRange: () => has_newline_in_range_default,
  501. hasSpaces: () => has_spaces_default,
  502. isNextLineEmpty: () => isNextLineEmpty2,
  503. isNextLineEmptyAfterIndex: () => is_next_line_empty_default,
  504. isPreviousLineEmpty: () => isPreviousLineEmpty2,
  505. makeString: () => make_string_default,
  506. skip: () => skip,
  507. skipEverythingButNewLine: () => skipEverythingButNewLine,
  508. skipInlineComment: () => skip_inline_comment_default,
  509. skipNewline: () => skip_newline_default,
  510. skipSpaces: () => skipSpaces,
  511. skipToLineEnd: () => skipToLineEnd,
  512. skipTrailingComment: () => skip_trailing_comment_default,
  513. skipWhitespace: () => skipWhitespace
  514. });
  515. function legacyGetNextNonSpaceNonCommentCharacterIndex(text, node, locEnd) {
  516. return get_next_non_space_non_comment_character_index_default(
  517. text,
  518. locEnd(node)
  519. );
  520. }
  521. function getNextNonSpaceNonCommentCharacterIndex2(text, startIndex) {
  522. return arguments.length === 2 || typeof startIndex === "number" ? get_next_non_space_non_comment_character_index_default(text, startIndex) : (
  523. // @ts-expect-error -- expected
  524. // eslint-disable-next-line prefer-rest-params
  525. legacyGetNextNonSpaceNonCommentCharacterIndex(...arguments)
  526. );
  527. }
  528. function legacyIsPreviousLineEmpty(text, node, locStart) {
  529. return is_previous_line_empty_default(text, locStart(node));
  530. }
  531. function isPreviousLineEmpty2(text, startIndex) {
  532. return arguments.length === 2 || typeof startIndex === "number" ? is_previous_line_empty_default(text, startIndex) : (
  533. // @ts-expect-error -- expected
  534. // eslint-disable-next-line prefer-rest-params
  535. legacyIsPreviousLineEmpty(...arguments)
  536. );
  537. }
  538. function legacyIsNextLineEmpty(text, node, locEnd) {
  539. return is_next_line_empty_default(text, locEnd(node));
  540. }
  541. function isNextLineEmpty2(text, startIndex) {
  542. return arguments.length === 2 || typeof startIndex === "number" ? is_next_line_empty_default(text, startIndex) : (
  543. // @ts-expect-error -- expected
  544. // eslint-disable-next-line prefer-rest-params
  545. legacyIsNextLineEmpty(...arguments)
  546. );
  547. }
  548. var init_public = __esm({
  549. "src/utils/public.js"() {
  550. init_get_next_non_space_non_comment_character_index();
  551. init_is_previous_line_empty();
  552. init_is_next_line_empty();
  553. init_get_max_continuous_count();
  554. init_get_string_width();
  555. init_get_alignment_size();
  556. init_get_indent_size();
  557. init_skip_newline();
  558. init_skip_inline_comment();
  559. init_skip_trailing_comment();
  560. init_has_newline();
  561. init_has_newline_in_range();
  562. init_has_spaces();
  563. init_get_next_non_space_non_comment_character();
  564. init_make_string();
  565. init_skip();
  566. init_utils();
  567. }
  568. });
  569. // src/main/version.evaluate.cjs
  570. var require_version_evaluate = __commonJS({
  571. "src/main/version.evaluate.cjs"(exports2, module2) {
  572. module2.exports = "3.0.0";
  573. }
  574. });
  575. // src/index.cjs
  576. var prettierPromise = import("./index.mjs");
  577. var functionNames = [
  578. "formatWithCursor",
  579. "format",
  580. "check",
  581. "resolveConfig",
  582. "resolveConfigFile",
  583. "clearConfigCache",
  584. "getFileInfo",
  585. "getSupportInfo"
  586. ];
  587. var prettier = /* @__PURE__ */ Object.create(null);
  588. for (const name of functionNames) {
  589. prettier[name] = async (...args) => {
  590. const prettier2 = await prettierPromise;
  591. return prettier2[name](...args);
  592. };
  593. }
  594. var debugApiFunctionNames = [
  595. "parse",
  596. "formatAST",
  597. "formatDoc",
  598. "printToDoc",
  599. "printDocToString"
  600. ];
  601. var debugApis = /* @__PURE__ */ Object.create(null);
  602. for (const name of debugApiFunctionNames) {
  603. debugApis[name] = async (...args) => {
  604. const prettier2 = await prettierPromise;
  605. return prettier2.__debug[name](...args);
  606. };
  607. }
  608. prettier.__debug = debugApis;
  609. if (true) {
  610. prettier.util = (init_public(), __toCommonJS(public_exports));
  611. prettier.doc = require("./doc.js");
  612. } else {
  613. Object.defineProperties(prettier, {
  614. util: {
  615. get() {
  616. throw new Error(
  617. "prettier.util is not available in development CommonJS version"
  618. );
  619. }
  620. },
  621. doc: {
  622. get() {
  623. throw new Error(
  624. "prettier.doc is not available in development CommonJS version"
  625. );
  626. }
  627. }
  628. });
  629. }
  630. prettier.version = require_version_evaluate();
  631. module.exports = prettier;