UNPKG

prettier-plugin-pegjs

Version:

A Prettier plugin for formatting Pegjs and Peggy-js grammars

980 lines 218 kB
var Hn = Object.defineProperty; var Jn = (i, d, r) => d in i ? Hn(i, d, { enumerable: !0, configurable: !0, writable: !0, value: r }) : i[d] = r; var YD = (i, d, r) => (Jn(i, typeof d != "symbol" ? d + "" : d, r), r); var wn = { exports: {} }; (function(i, d) { (function(r) { function C() { var S = r(); return S.default || S; } i.exports = C(); })(function() { var r = Object.create, C = Object.defineProperty, S = Object.getOwnPropertyDescriptor, y = Object.getOwnPropertyNames, w = Object.getPrototypeOf, O = Object.prototype.hasOwnProperty, W = (u, D) => () => (u && (D = u(u = 0)), D), P = (u, D) => () => (D || u((D = { exports: {} }).exports, D), D.exports), j = (u, D) => { for (var n in D) C(u, n, { get: D[n], enumerable: !0 }); }, G = (u, D, n, a) => { if (D && typeof D == "object" || typeof D == "function") for (let o of y(D)) !O.call(u, o) && o !== n && C(u, o, { get: () => D[o], enumerable: !(a = S(D, o)) || a.enumerable }); return u; }, M = (u, D, n) => (n = u != null ? r(w(u)) : {}, G(D || !u || !u.__esModule ? C(n, "default", { value: u, enumerable: !0 }) : n, u)), X = (u) => G(C({}, "__esModule", { value: !0 }), u), I = (u, D, n) => { if (!D.has(u)) throw TypeError("Cannot " + n); }, Q = (u, D, n) => { if (D.has(u)) throw TypeError("Cannot add the same private member more than once"); D instanceof WeakSet ? D.add(u) : D.set(u, n); }, Z = (u, D, n) => (I(u, D, "access private method"), n), Iu = P((u) => { Object.defineProperty(u, "__esModule", { value: !0 }), u.default = D; function D() { } D.prototype = { diff: function(o, F) { var f = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, E = f.callback; typeof f == "function" && (E = f, f = {}), this.options = f; var A = this; function g(z) { return E ? (setTimeout(function() { E(void 0, z); }, 0), !0) : z; } o = this.castInput(o), F = this.castInput(F), o = this.removeEmpty(this.tokenize(o)), F = this.removeEmpty(this.tokenize(F)); var m = F.length, x = o.length, h = 1, k = m + x; f.maxEditLength && (k = Math.min(k, f.maxEditLength)); var $ = [{ newPos: -1, components: [] }], N = this.extractCommon($[0], F, o, 0); if ($[0].newPos + 1 >= m && N + 1 >= x) return g([{ value: this.join(F), count: F.length }]); function L() { for (var z = -1 * h; z <= h; z += 2) { var V = void 0, Y = $[z - 1], J = $[z + 1], Fu = (J ? J.newPos : 0) - z; Y && ($[z - 1] = void 0); var iu = Y && Y.newPos + 1 < m, Au = J && 0 <= Fu && Fu < x; if (!iu && !Au) { $[z] = void 0; continue; } if (!iu || Au && Y.newPos < J.newPos ? (V = a(J), A.pushComponent(V.components, void 0, !0)) : (V = Y, V.newPos++, A.pushComponent(V.components, !0, void 0)), Fu = A.extractCommon(V, F, o, z), V.newPos + 1 >= m && Fu + 1 >= x) return g(n(A, V.components, F, o, A.useLongestToken)); $[z] = V; } h++; } if (E) (function z() { setTimeout(function() { if (h > k) return E(); L() || z(); }, 0); })(); else for (; h <= k; ) { var q = L(); if (q) return q; } }, pushComponent: function(o, F, f) { var E = o[o.length - 1]; E && E.added === F && E.removed === f ? o[o.length - 1] = { count: E.count + 1, added: F, removed: f } : o.push({ count: 1, added: F, removed: f }); }, extractCommon: function(o, F, f, E) { for (var A = F.length, g = f.length, m = o.newPos, x = m - E, h = 0; m + 1 < A && x + 1 < g && this.equals(F[m + 1], f[x + 1]); ) m++, x++, h++; return h && o.components.push({ count: h }), o.newPos = m, x; }, equals: function(o, F) { return this.options.comparator ? this.options.comparator(o, F) : o === F || this.options.ignoreCase && o.toLowerCase() === F.toLowerCase(); }, removeEmpty: function(o) { for (var F = [], f = 0; f < o.length; f++) o[f] && F.push(o[f]); return F; }, castInput: function(o) { return o; }, tokenize: function(o) { return o.split(""); }, join: function(o) { return o.join(""); } }; function n(o, F, f, E, A) { for (var g = 0, m = F.length, x = 0, h = 0; g < m; g++) { var k = F[g]; if (k.removed) { if (k.value = o.join(E.slice(h, h + k.count)), h += k.count, g && F[g - 1].added) { var $ = F[g - 1]; F[g - 1] = F[g], F[g] = $; } } else { if (!k.added && A) { var N = f.slice(x, x + k.count); N = N.map(function(q, z) { var V = E[h + z]; return V.length > q.length ? V : q; }), k.value = o.join(N); } else k.value = o.join(f.slice(x, x + k.count)); x += k.count, k.added || (h += k.count); } } var L = F[m - 1]; return m > 1 && typeof L.value == "string" && (L.added || L.removed) && o.equals("", L.value) && (F[m - 2].value += L.value, F.pop()), F; } function a(o) { return { newPos: o.newPos, components: o.components.slice(0) }; } }), bu = P((u) => { Object.defineProperty(u, "__esModule", { value: !0 }), u.diffArrays = o, u.arrayDiff = void 0; var D = n(Iu()); function n(F) { return F && F.__esModule ? F : { default: F }; } var a = new D.default(); u.arrayDiff = a, a.tokenize = function(F) { return F.slice(); }, a.join = a.removeEmpty = function(F) { return F; }; function o(F, f, E) { return a.diff(F, f, E); } }), nu = P((u, D) => { var n = new Proxy(String, { get: () => n }); D.exports = n; }), $u = {}; j($u, { default: () => Ae, shouldHighlight: () => wu }); var wu, Ae, pe = W(() => { wu = () => !1, Ae = String; }), Be = P((u) => { Object.defineProperty(u, "__esModule", { value: !0 }), u.codeFrameColumns = m, u.default = x; var D = (pe(), X($u)), n = nu(), a = n, o; function F(h) { return h ? (o != null || (o = new a.constructor({ enabled: !0, level: 1 })), o) : a; } var f = !1; function E(h) { return { gutter: h.grey, marker: h.red.bold, message: h.red.bold }; } var A = /\r\n|[\n\r\u2028\u2029]/; function g(h, k, $) { let N = Object.assign({ column: 0, line: -1 }, h.start), L = Object.assign({}, N, h.end), { linesAbove: q = 2, linesBelow: z = 3 } = $ || {}, V = N.line, Y = N.column, J = L.line, Fu = L.column, iu = Math.max(V - (q + 1), 0), Au = Math.min(k.length, J + z); V === -1 && (iu = 0), J === -1 && (Au = k.length); let Wu = J - V, lu = {}; if (Wu) for (let Pu = 0; Pu <= Wu; Pu++) { let zu = Pu + V; if (!Y) lu[zu] = !0; else if (Pu === 0) { let Se = k[zu - 1].length; lu[zu] = [Y, Se - Y + 1]; } else if (Pu === Wu) lu[zu] = [0, Fu]; else { let Se = k[zu - Pu].length; lu[zu] = [0, Se]; } } else Y === Fu ? Y ? lu[V] = [Y, 0] : lu[V] = !0 : lu[V] = [Y, Fu - Y]; return { start: iu, end: Au, markerLines: lu }; } function m(h, k, $ = {}) { let N = ($.highlightCode || $.forceColor) && (0, D.shouldHighlight)($), L = F($.forceColor), q = E(L), z = (lu, Pu) => N ? lu(Pu) : Pu, V = h.split(A), { start: Y, end: J, markerLines: Fu } = g(k, V, $), iu = k.start && typeof k.start.column == "number", Au = String(J).length, Wu = (N ? (0, D.default)(h, $) : h).split(A, J).slice(Y, J).map((lu, Pu) => { let zu = Y + 1 + Pu, Se = ` ${` ${zu}`.slice(-Au)} |`, o0 = Fu[zu], Vn = !Fu[zu + 1]; if (o0) { let cn = ""; if (Array.isArray(o0)) { let Gn = lu.slice(0, Math.max(o0[0] - 1, 0)).replace(/[^\t]/g, " "), Yn = o0[1] || 1; cn = [` `, z(q.gutter, Se.replace(/\d/g, " ")), " ", Gn, z(q.marker, "^").repeat(Yn)].join(""), Vn && $.message && (cn += " " + z(q.message, $.message)); } return [z(q.marker, ">"), z(q.gutter, Se), lu.length > 0 ? ` ${lu}` : "", cn].join(""); } else return ` ${z(q.gutter, Se)}${lu.length > 0 ? ` ${lu}` : ""}`; }).join(` `); return $.message && !iu && (Wu = `${" ".repeat(Au + 1)}${$.message} ${Wu}`), N ? L.reset(Wu) : Wu; } function x(h, k, $, N = {}) { if (!f) { f = !0; let L = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`."; { let q = new Error(L); q.name = "DeprecationWarning", console.warn(new Error(L)); } } return $ = Math.max($, 0), m(h, { start: { column: $, line: k } }, N); } }), je = {}; j(je, { __debug: () => Un, check: () => T, doc: () => sD, format: () => v, formatWithCursor: () => p, getSupportInfo: () => ne, util: () => a0, version: () => l }); var ZD = (u, D, n, a) => { if (!(u && D == null)) return D.replaceAll ? D.replaceAll(n, a) : n.global ? D.replace(n, a) : D.split(n).join(a); }, de = ZD, E0 = M(bu(), 1), Gu = "string", ku = "array", Yu = "cursor", xu = "indent", Su = "align", Bu = "trim", K = "group", fu = "fill", cu = "if-break", Du = "indent-if-break", _u = "line-suffix", Ou = "line-suffix-boundary", eu = "line", Cu = "label", au = "break-parent", QD = /* @__PURE__ */ new Set([Yu, xu, Su, Bu, K, fu, cu, Du, _u, Ou, eu, Cu, au]); function A0(u) { if (typeof u == "string") return Gu; if (Array.isArray(u)) return ku; if (!u) return; let { type: D } = u; if (QD.has(D)) return D; } var ju = A0, p0 = (u) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(u); function B0(u) { let D = u === null ? "null" : typeof u; if (D !== "string" && D !== "object") return `Unexpected doc '${D}', Expected it to be 'string' or 'object'.`; if (ju(u)) throw new Error("doc is valid."); let n = Object.prototype.toString.call(u); if (n !== "[object Object]") return `Unexpected doc '${n}'.`; let a = p0([...QD].map((o) => `'${o}'`)); return `Unexpected doc.type '${u.type}'. Expected it to be ${a}.`; } var d0 = class extends Error { constructor(D) { super(B0(D)); YD(this, "name", "InvalidDocError"); this.doc = D; } }, Zu = d0, ur = {}; function g0(u, D, n, a) { let o = [u]; for (; o.length > 0; ) { let F = o.pop(); if (F === ur) { n(o.pop()); continue; } n && o.push(F, ur); let f = ju(F); if (!f) throw new Zu(F); if ((D == null ? void 0 : D(F)) !== !1) switch (f) { case ku: case fu: { let E = f === ku ? F : F.parts; for (let A = E.length, g = A - 1; g >= 0; --g) o.push(E[g]); break; } case cu: o.push(F.flatContents, F.breakContents); break; case K: if (a && F.expandedStates) for (let E = F.expandedStates.length, A = E - 1; A >= 0; --A) o.push(F.expandedStates[A]); else o.push(F.contents); break; case Su: case xu: case Du: case Cu: case _u: o.push(F.contents); break; case Gu: case Yu: case Bu: case Ou: case eu: case au: break; default: throw new Zu(F); } } } var fD = g0, h0 = () => { }, er = h0; function ge(u) { return { type: xu, contents: u }; } function Qu(u, D) { return { type: Su, contents: D, n: u }; } function cD(u, D = {}) { return er(D.expandedStates), { type: K, id: D.id, contents: u, break: !!D.shouldBreak, expandedStates: D.expandedStates }; } function v0(u) { return Qu(Number.NEGATIVE_INFINITY, u); } function m0(u) { return Qu({ type: "root" }, u); } function y0(u) { return Qu(-1, u); } function Le(u, D) { return cD(u[0], { ...D, expandedStates: u }); } function Dr(u) { return { type: fu, parts: u }; } function b0(u, D = "", n = {}) { return { type: cu, breakContents: u, flatContents: D, groupId: n.groupId }; } function $0(u, D) { return { type: Du, contents: u, groupId: D.groupId, negate: D.negate }; } function CD(u) { return { type: _u, contents: u }; } var w0 = { type: Ou }, Me = { type: au }, k0 = { type: Bu }, ED = { type: eu, hard: !0 }, rr = { type: eu, hard: !0, literal: !0 }, tr = { type: eu }, x0 = { type: eu, soft: !0 }, hu = [ED, Me], he = [rr, Me], Re = { type: Yu }; function AD(u, D) { let n = []; for (let a = 0; a < D.length; a++) a !== 0 && n.push(u), n.push(D[a]); return n; } function nr(u, D, n) { let a = u; if (D > 0) { for (let o = 0; o < Math.floor(D / n); ++o) a = ge(a); a = Qu(D % n, a), a = Qu(Number.NEGATIVE_INFINITY, a); } return a; } function S0(u, D) { return u ? { type: Cu, label: u, contents: D } : D; } var ar = (u, D, n) => { if (!(u && D == null)) return Array.isArray(D) || typeof D == "string" ? D[n < 0 ? D.length + n : n] : D.at(n); }, uu = ar; function ir(u) { let D = u.indexOf("\r"); return D >= 0 ? u.charAt(D + 1) === ` ` ? "crlf" : "cr" : "lf"; } function pD(u) { switch (u) { case "cr": return "\r"; case "crlf": return `\r `; default: return ` `; } } function sr(u, D) { let n; switch (D) { case ` `: n = /\n/g; break; case "\r": n = /\r/g; break; case `\r `: n = /\r\n/g; break; default: throw new Error(`Unexpected "eol" ${JSON.stringify(D)}.`); } let a = u.match(n); return a ? a.length : 0; } function _0(u) { return de(!1, u, /\r\n?/g, ` `); } var or = () => /[#*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, O0 = { eastAsianWidth(u) { var D = u.charCodeAt(0), n = u.length == 2 ? u.charCodeAt(1) : 0, a = D; return 55296 <= D && D <= 56319 && 56320 <= n && n <= 57343 && (D &= 1023, n &= 1023, a = D << 10 | n, a += 65536), a == 12288 || 65281 <= a && a <= 65376 || 65504 <= a && a <= 65510 ? "F" : 4352 <= a && a <= 4447 || 4515 <= a && a <= 4519 || 4602 <= a && a <= 4607 || 9001 <= a && a <= 9002 || 11904 <= a && a <= 11929 || 11931 <= a && a <= 12019 || 12032 <= a && a <= 12245 || 12272 <= a && a <= 12283 || 12289 <= a && a <= 12350 || 12353 <= a && a <= 12438 || 12441 <= a && a <= 12543 || 12549 <= a && a <= 12589 || 12593 <= a && a <= 12686 || 12688 <= a && a <= 12730 || 12736 <= a && a <= 12771 || 12784 <= a && a <= 12830 || 12832 <= a && a <= 12871 || 12880 <= a && a <= 13054 || 13056 <= a && a <= 19903 || 19968 <= a && a <= 42124 || 42128 <= a && a <= 42182 || 43360 <= a && a <= 43388 || 44032 <= a && a <= 55203 || 55216 <= a && a <= 55238 || 55243 <= a && a <= 55291 || 63744 <= a && a <= 64255 || 65040 <= a && a <= 65049 || 65072 <= a && a <= 65106 || 65108 <= a && a <= 65126 || 65128 <= a && a <= 65131 || 110592 <= a && a <= 110593 || 127488 <= a && a <= 127490 || 127504 <= a && a <= 127546 || 127552 <= a && a <= 127560 || 127568 <= a && a <= 127569 || 131072 <= a && a <= 194367 || 177984 <= a && a <= 196605 || 196608 <= a && a <= 262141 ? "W" : "N"; } }, N0 = /[^\x20-\x7F]/; function P0(u) { if (!u) return 0; if (!N0.test(u)) return u.length; u = u.replace(or(), " "); let D = 0; for (let n of u) { let a = n.codePointAt(0); if (a <= 31 || a >= 127 && a <= 159 || a >= 768 && a <= 879) continue; let o = O0.eastAsianWidth(n); D += o === "F" || o === "W" ? 2 : 1; } return D; } var BD = P0, Fr = (u) => { if (Array.isArray(u)) return u; if (u.type !== fu) throw new Error(`Expect doc to be 'array' or '${fu}'.`); return u.parts; }; function We(u, D) { if (typeof u == "string") return D(u); let n = /* @__PURE__ */ new Map(); return a(u); function a(F) { if (n.has(F)) return n.get(F); let f = o(F); return n.set(F, f), f; } function o(F) { switch (ju(F)) { case ku: return D(F.map(a)); case fu: return D({ ...F, parts: F.parts.map(a) }); case cu: return D({ ...F, breakContents: a(F.breakContents), flatContents: a(F.flatContents) }); case K: { let { expandedStates: f, contents: E } = F; return f ? (f = f.map(a), E = f[0]) : E = a(E), D({ ...F, contents: E, expandedStates: f }); } case Su: case xu: case Du: case Cu: case _u: return D({ ...F, contents: a(F.contents) }); case Gu: case Yu: case Bu: case Ou: case eu: case au: return D(F); default: throw new Zu(F); } } } function dD(u, D, n) { let a = n, o = !1; function F(f) { if (o) return !1; let E = D(f); E !== void 0 && (o = !0, a = E); } return fD(u, F), a; } function T0(u) { if (u.type === K && u.break || u.type === eu && u.hard || u.type === au) return !0; } function I0(u) { return dD(u, T0, !1); } function lr(u) { if (u.length > 0) { let D = uu(!1, u, -1); !D.expandedStates && !D.break && (D.break = "propagated"); } return null; } function j0(u) { let D = /* @__PURE__ */ new Set(), n = []; function a(F) { if (F.type === au && lr(n), F.type === K) { if (n.push(F), D.has(F)) return !1; D.add(F); } } function o(F) { F.type === K && n.pop().break && lr(n); } fD(u, a, o, !0); } function L0(u) { return u.type === eu && !u.hard ? u.soft ? "" : " " : u.type === cu ? u.flatContents : u; } function M0(u) { return We(u, L0); } function fr(u) { for (u = [...u]; u.length >= 2 && uu(!1, u, -2).type === eu && uu(!1, u, -1).type === au; ) u.length -= 2; if (u.length > 0) { let D = ve(uu(!1, u, -1)); u[u.length - 1] = D; } return u; } function ve(u) { switch (ju(u)) { case Su: case xu: case Du: case K: case _u: case Cu: { let D = ve(u.contents); return { ...u, contents: D }; } case cu: return { ...u, breakContents: ve(u.breakContents), flatContents: ve(u.flatContents) }; case fu: return { ...u, parts: fr(u.parts) }; case ku: return fr(u); case Gu: return u.replace(/[\n\r]*$/, ""); case Yu: case Bu: case Ou: case eu: case au: break; default: throw new Zu(u); } return u; } function cr(u) { return ve(W0(u)); } function R0(u) { switch (ju(u)) { case fu: if (u.parts.every((D) => D === "")) return ""; break; case K: if (!u.contents && !u.id && !u.break && !u.expandedStates) return ""; if (u.contents.type === K && u.contents.id === u.id && u.contents.break === u.break && u.contents.expandedStates === u.expandedStates) return u.contents; break; case Su: case xu: case Du: case _u: if (!u.contents) return ""; break; case cu: if (!u.flatContents && !u.breakContents) return ""; break; case ku: { let D = []; for (let n of u) { if (!n) continue; let [a, ...o] = Array.isArray(n) ? n : [n]; typeof a == "string" && typeof uu(!1, D, -1) == "string" ? D[D.length - 1] += a : D.push(a), D.push(...o); } return D.length === 0 ? "" : D.length === 1 ? D[0] : D; } case Gu: case Yu: case Bu: case Ou: case eu: case Cu: case au: break; default: throw new Zu(u); } return u; } function W0(u) { return We(u, (D) => R0(D)); } function z0(u, D = he) { return We(u, (n) => typeof n == "string" ? AD(D, n.split(` `)) : n); } function q0(u) { if (u.type === eu) return !0; } function Cr(u) { return dD(u, q0, !1); } function Hu(u, D) { return u.type === Cu ? { ...u, contents: D(u.contents) } : D(u); } var su = Symbol("MODE_BREAK"), vu = Symbol("MODE_FLAT"), me = Symbol("cursor"); function mu() { return { value: "", length: 0, queue: [] }; } function U0(u, D) { return gD(u, { type: "indent" }, D); } function V0(u, D, n) { return D === Number.NEGATIVE_INFINITY ? u.root || mu() : D < 0 ? gD(u, { type: "dedent" }, n) : D ? D.type === "root" ? { ...u, root: u } : gD(u, { type: typeof D == "string" ? "stringAlign" : "numberAlign", n: D }, n) : u; } function gD(u, D, n) { let a = D.type === "dedent" ? u.queue.slice(0, -1) : [...u.queue, D], o = "", F = 0, f = 0, E = 0; for (let $ of a) switch ($.type) { case "indent": m(), n.useTabs ? A(1) : g(n.tabWidth); break; case "stringAlign": m(), o += $.n, F += $.n.length; break; case "numberAlign": f += 1, E += $.n; break; default: throw new Error(`Unexpected type '${$.type}'`); } return h(), { ...u, value: o, length: F, queue: a }; function A($) { o += " ".repeat($), F += n.tabWidth * $; } function g($) { o += " ".repeat($), F += $; } function m() { n.useTabs ? x() : h(); } function x() { f > 0 && A(f), k(); } function h() { E > 0 && g(E), k(); } function k() { f = 0, E = 0; } } function ze(u) { let D = 0, n = 0, a = u.length; u: for (; a--; ) { let o = u[a]; if (o === me) { n++; continue; } for (let F = o.length - 1; F >= 0; F--) { let f = o[F]; if (f === " " || f === " ") D++; else { u[a] = o.slice(0, F + 1); break u; } } } if (D > 0 || n > 0) for (u.length = a + 1; n-- > 0; ) u.push(me); return D; } function qe(u, D, n, a, o, F) { if (n === Number.POSITIVE_INFINITY) return !0; let f = D.length, E = [u], A = []; for (; n >= 0; ) { if (E.length === 0) { if (f === 0) return !0; E.push(D[--f]); continue; } let { mode: g, doc: m } = E.pop(); switch (ju(m)) { case Gu: A.push(m), n -= BD(m); break; case ku: case fu: { let x = Fr(m); for (let h = x.length - 1; h >= 0; h--) E.push({ mode: g, doc: x[h] }); break; } case xu: case Su: case Du: case Cu: E.push({ mode: g, doc: m.contents }); break; case Bu: n += ze(A); break; case K: { if (F && m.break) return !1; let x = m.break ? su : g, h = m.expandedStates && x === su ? uu(!1, m.expandedStates, -1) : m.contents; E.push({ mode: x, doc: h }); break; } case cu: { let x = (m.groupId ? o[m.groupId] || vu : g) === su ? m.breakContents : m.flatContents; x && E.push({ mode: g, doc: x }); break; } case eu: if (g === su || m.hard) return !0; m.soft || (A.push(" "), n--); break; case _u: a = !0; break; case Ou: if (a) return !1; break; } } return !1; } function Ju(u, D) { let n = {}, a = D.printWidth, o = pD(D.endOfLine), F = 0, f = [{ ind: mu(), mode: su, doc: u }], E = [], A = !1, g = [], m = 0; for (j0(u); f.length > 0; ) { let { ind: h, mode: k, doc: $ } = f.pop(); switch (ju($)) { case Gu: { let N = o !== ` ` ? de(!1, $, ` `, o) : $; E.push(N), f.length > 0 && (F += BD(N)); break; } case ku: for (let N = $.length - 1; N >= 0; N--) f.push({ ind: h, mode: k, doc: $[N] }); break; case Yu: if (m >= 2) throw new Error("There are too many 'cursor' in doc."); E.push(me), m++; break; case xu: f.push({ ind: U0(h, D), mode: k, doc: $.contents }); break; case Su: f.push({ ind: V0(h, $.n, D), mode: k, doc: $.contents }); break; case Bu: F -= ze(E); break; case K: switch (k) { case vu: if (!A) { f.push({ ind: h, mode: $.break ? su : vu, doc: $.contents }); break; } case su: { A = !1; let N = { ind: h, mode: vu, doc: $.contents }, L = a - F, q = g.length > 0; if (!$.break && qe(N, f, L, q, n)) f.push(N); else if ($.expandedStates) { let z = uu(!1, $.expandedStates, -1); if ($.break) { f.push({ ind: h, mode: su, doc: z }); break; } else for (let V = 1; V < $.expandedStates.length + 1; V++) if (V >= $.expandedStates.length) { f.push({ ind: h, mode: su, doc: z }); break; } else { let Y = $.expandedStates[V], J = { ind: h, mode: vu, doc: Y }; if (qe(J, f, L, q, n)) { f.push(J); break; } } } else f.push({ ind: h, mode: su, doc: $.contents }); break; } } $.id && (n[$.id] = uu(!1, f, -1).mode); break; case fu: { let N = a - F, { parts: L } = $; if (L.length === 0) break; let [q, z] = L, V = { ind: h, mode: vu, doc: q }, Y = { ind: h, mode: su, doc: q }, J = qe(V, [], N, g.length > 0, n, !0); if (L.length === 1) { J ? f.push(V) : f.push(Y); break; } let Fu = { ind: h, mode: vu, doc: z }, iu = { ind: h, mode: su, doc: z }; if (L.length === 2) { J ? f.push(Fu, V) : f.push(iu, Y); break; } L.splice(0, 2); let Au = { ind: h, mode: k, doc: Dr(L) }, Wu = L[0]; qe({ ind: h, mode: vu, doc: [q, z, Wu] }, [], N, g.length > 0, n, !0) ? f.push(Au, Fu, V) : J ? f.push(Au, iu, V) : f.push(Au, iu, Y); break; } case cu: case Du: { let N = $.groupId ? n[$.groupId] : k; if (N === su) { let L = $.type === cu ? $.breakContents : $.negate ? $.contents : ge($.contents); L && f.push({ ind: h, mode: k, doc: L }); } if (N === vu) { let L = $.type === cu ? $.flatContents : $.negate ? ge($.contents) : $.contents; L && f.push({ ind: h, mode: k, doc: L }); } break; } case _u: g.push({ ind: h, mode: k, doc: $.contents }); break; case Ou: g.length > 0 && f.push({ ind: h, mode: k, doc: ED }); break; case eu: switch (k) { case vu: if ($.hard) A = !0; else { $.soft || (E.push(" "), F += 1); break; } case su: if (g.length > 0) { f.push({ ind: h, mode: k, doc: $ }, ...g.reverse()), g.length = 0; break; } $.literal ? h.root ? (E.push(o, h.root.value), F = h.root.length) : (E.push(o), F = 0) : (F -= ze(E), E.push(o + h.value), F = h.length); break; } break; case Cu: f.push({ ind: h, mode: k, doc: $.contents }); break; case au: break; default: throw new Zu($); } f.length === 0 && g.length > 0 && (f.push(...g.reverse()), g.length = 0); } let x = E.indexOf(me); if (x !== -1) { let h = E.indexOf(me, x + 1), k = E.slice(0, x).join(""), $ = E.slice(x + 1, h).join(""), N = E.slice(h + 1).join(""); return { formatted: k + $ + N, cursorNodeStart: k.length, cursorNodeText: $ }; } return { formatted: E.join("") }; } function du(u) { var D; if (!u) return ""; if (Array.isArray(u)) { let n = []; for (let a of u) if (Array.isArray(a)) n.push(...du(a)); else { let o = du(a); o !== "" && n.push(o); } return n; } return u.type === cu ? { ...u, breakContents: du(u.breakContents), flatContents: du(u.flatContents) } : u.type === K ? { ...u, contents: du(u.contents), expandedStates: (D = u.expandedStates) == null ? void 0 : D.map(du) } : u.type === fu ? { type: "fill", parts: u.parts.map(du) } : u.contents ? { ...u, contents: du(u.contents) } : u; } function G0(u) { let D = /* @__PURE__ */ Object.create(null), n = /* @__PURE__ */ new Set(); return a(du(u)); function a(F, f, E) { var A, g; if (typeof F == "string") return JSON.stringify(F); if (Array.isArray(F)) { let m = F.map(a).filter(Boolean); return m.length === 1 ? m[0] : `[${m.join(", ")}]`; } if (F.type === eu) { let m = ((A = E == null ? void 0 : E[f + 1]) == null ? void 0 : A.type) === au; return F.literal ? m ? "literalline" : "literallineWithoutBreakParent" : F.hard ? m ? "hardline" : "hardlineWithoutBreakParent" : F.soft ? "softline" : "line"; } if (F.type === au) return ((g = E == null ? void 0 : E[f - 1]) == null ? void 0 : g.type) === eu && E[f - 1].hard ? void 0 : "breakParent"; if (F.type === Bu) return "trim"; if (F.type === xu) return "indent(" + a(F.contents) + ")"; if (F.type === Su) return F.n === Number.NEGATIVE_INFINITY ? "dedentToRoot(" + a(F.contents) + ")" : F.n < 0 ? "dedent(" + a(F.contents) + ")" : F.n.type === "root" ? "markAsRoot(" + a(F.contents) + ")" : "align(" + JSON.stringify(F.n) + ", " + a(F.contents) + ")"; if (F.type === cu) return "ifBreak(" + a(F.breakContents) + (F.flatContents ? ", " + a(F.flatContents) : "") + (F.groupId ? (F.flatContents ? "" : ', ""') + `, { groupId: ${o(F.groupId)} }` : "") + ")"; if (F.type === Du) { let m = []; F.negate && m.push("negate: true"), F.groupId && m.push(`groupId: ${o(F.groupId)}`); let x = m.length > 0 ? `, { ${m.join(", ")} }` : ""; return `indentIfBreak(${a(F.contents)}${x})`; } if (F.type === K) { let m = []; F.break && F.break !== "propagated" && m.push("shouldBreak: true"), F.id && m.push(`id: ${o(F.id)}`); let x = m.length > 0 ? `, { ${m.join(", ")} }` : ""; return F.expandedStates ? `conditionalGroup([${F.expandedStates.map((h) => a(h)).join(",")}]${x})` : `group(${a(F.contents)}${x})`; } if (F.type === fu) return `fill([${F.parts.map((m) => a(m)).join(", ")}])`; if (F.type === _u) return "lineSuffix(" + a(F.contents) + ")"; if (F.type === Ou) return "lineSuffixBoundary"; if (F.type === Cu) return `label(${JSON.stringify(F.label)}, ${a(F.contents)})`; throw new Error("Unknown doc type " + F.type); } function o(F) { if (typeof F != "symbol") return JSON.stringify(String(F)); if (F in D) return D[F]; let f = F.description || "symbol"; for (let E = 0; ; E++) { let A = f + (E > 0 ? ` #${E}` : ""); if (!n.has(A)) return n.add(A), D[F] = `Symbol.for(${JSON.stringify(A)})`; } } } function Y0(u, D, n = 0) { let a = 0; for (let o = n; o < u.length; ++o) u[o] === " " ? a = a + D - a % D : a++; return a; } var hD = Y0, vD = class extends Error { constructor() { super(...arguments); YD(this, "name", "ConfigError"); } }, Er = class extends Error { constructor() { super(...arguments); YD(this, "name", "UndefinedParserError"); } }, H0 = { cursorOffset: { category: "Special", type: "int", default: -1, range: { start: -1, end: 1 / 0, step: 1 }, description: `Print (to stderr) where a cursor at the given position would move to after formatting. This option cannot be used with --range-start and --range-end.`, cliCategory: "Editor" }, endOfLine: { category: "Global", type: "choice", default: "lf", description: "Which end of line characters to apply.", choices: [{ value: "lf", description: "Line Feed only (\\n), common on Linux and macOS as well as inside git repos" }, { value: "crlf", description: "Carriage Return + Line Feed characters (\\r\\n), common on Windows" }, { value: "cr", description: "Carriage Return character only (\\r), used very rarely" }, { value: "auto", description: `Maintain existing (mixed values within one file are normalised by looking at what's used after the first line)` }] }, filepath: { category: "Special", type: "path", description: "Specify the input filepath. This will be used to do parser inference.", cliName: "stdin-filepath", cliCategory: "Other", cliDescription: "Path to the file to pretend that stdin comes from." }, insertPragma: { category: "Special", type: "boolean", default: !1, description: "Insert @format pragma into file's first docblock comment.", cliCategory: "Other" }, parser: { category: "Global", type: "choice", default: void 0, description: "Which parser to use.", exception: (u) => typeof u == "string" || typeof u == "function", choices: [{ value: "flow", description: "Flow" }, { value: "babel", description: "JavaScript" }, { value: "babel-flow", description: "Flow" }, { value: "babel-ts", description: "TypeScript" }, { value: "typescript", description: "TypeScript" }, { value: "acorn", description: "JavaScript" }, { value: "espree", description: "JavaScript" }, { value: "meriyah", description: "JavaScript" }, { value: "css", description: "CSS" }, { value: "less", description: "Less" }, { value: "scss", description: "SCSS" }, { value: "json", description: "JSON" }, { value: "json5", description: "JSON5" }, { value: "json-stringify", description: "JSON.stringify" }, { value: "graphql", description: "GraphQL" }, { value: "markdown", description: "Markdown" }, { value: "mdx", description: "MDX" }, { value: "vue", description: "Vue" }, { value: "yaml", description: "YAML" }, { value: "glimmer", description: "Ember / Handlebars" }, { value: "html", description: "HTML" }, { value: "angular", description: "Angular" }, { value: "lwc", description: "Lightning Web Components" }] }, plugins: { type: "path", array: !0, default: [{ value: [] }], category: "Global", description: "Add a plugin. Multiple plugins can be passed as separate `--plugin`s.", exception: (u) => typeof u == "string" || typeof u == "object", cliName: "plugin", cliCategory: "Config" }, printWidth: { category: "Global", type: "int", default: 80, description: "The line length where Prettier will try wrap.", range: { start: 0, end: 1 / 0, step: 1 } }, rangeEnd: { category: "Special", type: "int", default: 1 / 0, range: { start: 0, end: 1 / 0, step: 1 }, description: `Format code ending at a given character offset (exclusive). The range will extend forwards to the end of the selected statement. This option cannot be used with --cursor-offset.`, cliCategory: "Editor" }, rangeStart: { category: "Special", type: "int", default: 0, range: { start: 0, end: 1 / 0, step: 1 }, description: `Format code starting at a given character offset. The range will extend backwards to the start of the first line containing the selected statement. This optio