@prismicio/cli 0.0.1 → 0.0.2-alpha.xru-fix-npx-install-warnings.2
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.
- package/dist/acorn-CCr8VihG.js +3019 -0
- package/dist/acorn-CCr8VihG.js.map +1 -0
- package/dist/angular-B-6Sdz-P.js +2737 -0
- package/dist/angular-B-6Sdz-P.js.map +1 -0
- package/dist/babel-DSSzU6fH.js +7175 -0
- package/dist/babel-DSSzU6fH.js.map +1 -0
- package/dist/cli-NVpkXC9F.js +150015 -0
- package/dist/cli-NVpkXC9F.js.map +1 -0
- package/dist/cli.js +3 -144
- package/dist/cli.js.map +1 -1
- package/dist/estree-DHLJIae3.js +4486 -0
- package/dist/estree-DHLJIae3.js.map +1 -0
- package/dist/flow-DVd4L7fO.js +27426 -0
- package/dist/flow-DVd4L7fO.js.map +1 -0
- package/dist/glimmer-ffe_QHPj.js +2696 -0
- package/dist/glimmer-ffe_QHPj.js.map +1 -0
- package/dist/graphql-Cx6A4xbM.js +1241 -0
- package/dist/graphql-Cx6A4xbM.js.map +1 -0
- package/dist/html-Cp0WeaDh.js +2794 -0
- package/dist/html-Cp0WeaDh.js.map +1 -0
- package/dist/index-CAoPVwid.js +397 -0
- package/dist/index-CAoPVwid.js.map +1 -0
- package/dist/index-CqzxeUkd.js +835 -0
- package/dist/index-CqzxeUkd.js.map +1 -0
- package/dist/index-D3Z7xY3-.js +323 -0
- package/dist/index-D3Z7xY3-.js.map +1 -0
- package/dist/index-D80unpFN.js +3003 -0
- package/dist/index-D80unpFN.js.map +1 -0
- package/dist/index-DA8FlEll.js +35 -0
- package/dist/index-DA8FlEll.js.map +1 -0
- package/dist/index-DVTRroeB.js +189 -0
- package/dist/index-DVTRroeB.js.map +1 -0
- package/dist/index.js +2 -2
- package/dist/markdown-B2nQpAgl.js +3380 -0
- package/dist/markdown-B2nQpAgl.js.map +1 -0
- package/dist/meriyah-oMgd23nK.js +2640 -0
- package/dist/meriyah-oMgd23nK.js.map +1 -0
- package/dist/multipart-parser-jkRZKgYV.js +354 -0
- package/dist/multipart-parser-jkRZKgYV.js.map +1 -0
- package/dist/postcss-4okJ6bzF.js +4943 -0
- package/dist/postcss-4okJ6bzF.js.map +1 -0
- package/dist/typescript-eHDX_fq8.js +12974 -0
- package/dist/typescript-eHDX_fq8.js.map +1 -0
- package/dist/yaml-CoPGVzvb.js +4165 -0
- package/dist/yaml-CoPGVzvb.js.map +1 -0
- package/package.json +16 -17
- package/src/utils/sentry.ts +2 -0
- package/dist/_node_modules/meow/build/dependencies.js +0 -9040
- package/dist/_node_modules/meow/build/dependencies.js.map +0 -1
- package/dist/_node_modules/meow/build/index.js +0 -80
- package/dist/_node_modules/meow/build/index.js.map +0 -1
- package/dist/_node_modules/meow/build/options.js +0 -86
- package/dist/_node_modules/meow/build/options.js.map +0 -1
- package/dist/_node_modules/meow/build/parser.js +0 -61
- package/dist/_node_modules/meow/build/parser.js.map +0 -1
- package/dist/_node_modules/meow/build/utils.js +0 -8
- package/dist/_node_modules/meow/build/utils.js.map +0 -1
- package/dist/_node_modules/meow/build/validate.js +0 -102
- package/dist/_node_modules/meow/build/validate.js.map +0 -1
- package/dist/commands/init.js +0 -34
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/sync.js +0 -32
- package/dist/commands/sync.js.map +0 -1
- package/dist/core/auth.js +0 -72
- package/dist/core/auth.js.map +0 -1
- package/dist/core/customType.js +0 -43
- package/dist/core/customType.js.map +0 -1
- package/dist/core/framework.js +0 -128
- package/dist/core/framework.js.map +0 -1
- package/dist/core/project.js +0 -92
- package/dist/core/project.js.map +0 -1
- package/dist/core/repository.js +0 -33
- package/dist/core/repository.js.map +0 -1
- package/dist/core/slices.js +0 -47
- package/dist/core/slices.js.map +0 -1
- package/dist/core/version.js +0 -27
- package/dist/core/version.js.map +0 -1
- package/dist/packages/cli/package.json.js +0 -63
- package/dist/packages/cli/package.json.js.map +0 -1
- package/dist/utils/error.js +0 -18
- package/dist/utils/error.js.map +0 -1
- package/dist/utils/listr.js +0 -12
- package/dist/utils/listr.js.map +0 -1
- package/dist/utils/output.js +0 -34
- package/dist/utils/output.js.map +0 -1
- package/dist/utils/package.js +0 -20
- package/dist/utils/package.js.map +0 -1
- package/dist/utils/sentry.js +0 -62
- package/dist/utils/sentry.js.map +0 -1
- package/dist/utils/telemetry.js +0 -42
- package/dist/utils/telemetry.js.map +0 -1
|
@@ -0,0 +1,4486 @@
|
|
|
1
|
+
var fa = Object.defineProperty;
|
|
2
|
+
var _n = (e, t) => {
|
|
3
|
+
for (var r in t) fa(e, r, { get: t[r], enumerable: true });
|
|
4
|
+
};
|
|
5
|
+
var pa = {};
|
|
6
|
+
_n(pa, { languages: () => Qm, options: () => aa, printers: () => Km });
|
|
7
|
+
var $s = [{ name: "JavaScript", type: "programming", aceMode: "javascript", extensions: [".js", "._js", ".bones", ".cjs", ".es", ".es6", ".gs", ".jake", ".javascript", ".jsb", ".jscad", ".jsfl", ".jslib", ".jsm", ".jspre", ".jss", ".mjs", ".njs", ".pac", ".sjs", ".ssjs", ".xsjs", ".xsjslib", ".start.frag", ".end.frag", ".wxs"], filenames: ["Jakefile", "start.frag", "end.frag"], tmScope: "source.js", aliases: ["js", "node"], codemirrorMode: "javascript", codemirrorMimeType: "text/javascript", interpreters: ["chakra", "d8", "gjs", "js", "node", "nodejs", "qjs", "rhino", "v8", "v8-shell", "zx"], parsers: ["babel", "acorn", "espree", "meriyah", "babel-flow", "babel-ts", "flow", "typescript"], vscodeLanguageIds: ["javascript", "mongo"], linguistLanguageId: 183 }, { name: "Flow", type: "programming", aceMode: "javascript", extensions: [".js.flow"], filenames: [], tmScope: "source.js", aliases: [], codemirrorMode: "javascript", codemirrorMimeType: "text/javascript", interpreters: ["chakra", "d8", "gjs", "js", "node", "nodejs", "qjs", "rhino", "v8", "v8-shell"], parsers: ["flow", "babel-flow"], vscodeLanguageIds: ["javascript"], linguistLanguageId: 183 }, { name: "JSX", type: "programming", aceMode: "javascript", extensions: [".jsx"], filenames: void 0, tmScope: "source.js.jsx", aliases: void 0, codemirrorMode: "jsx", codemirrorMimeType: "text/jsx", interpreters: void 0, parsers: ["babel", "babel-flow", "babel-ts", "flow", "typescript", "espree", "meriyah"], vscodeLanguageIds: ["javascriptreact"], group: "JavaScript", linguistLanguageId: 183 }, { name: "TypeScript", type: "programming", aceMode: "typescript", extensions: [".ts", ".cts", ".mts"], tmScope: "source.ts", aliases: ["ts"], codemirrorMode: "javascript", codemirrorMimeType: "application/typescript", interpreters: ["bun", "deno", "ts-node", "tsx"], parsers: ["typescript", "babel-ts"], vscodeLanguageIds: ["typescript"], linguistLanguageId: 378 }, { name: "TSX", type: "programming", aceMode: "tsx", extensions: [".tsx"], tmScope: "source.tsx", codemirrorMode: "jsx", codemirrorMimeType: "text/typescript-jsx", group: "TypeScript", parsers: ["typescript", "babel-ts"], vscodeLanguageIds: ["typescriptreact"], linguistLanguageId: 94901924 }];
|
|
8
|
+
var Ys = {};
|
|
9
|
+
_n(Ys, { canAttachComment: () => Qi, embed: () => yu, features: () => Ym, getVisitorKeys: () => Lr, handleComments: () => ms, hasPrettierIgnore: () => Qt, insertPragma: () => bu, isBlockComment: () => ee, isGap: () => Zi, massageAstNode: () => gi, print: () => qs, printComment: () => rs, printPrettierIgnored: () => qs, willPrintOwnComments: () => zi });
|
|
10
|
+
var Jt = (e, t) => (r, n, ...s) => r | 1 && n == null ? void 0 : (t.call(n) ?? n[e]).apply(n, s);
|
|
11
|
+
var ya = String.prototype.replaceAll ?? function(e, t) {
|
|
12
|
+
return e.global ? this.replace(e, t) : this.split(e).join(t);
|
|
13
|
+
}, Ea = Jt("replaceAll", function() {
|
|
14
|
+
if (typeof this == "string") return ya;
|
|
15
|
+
}), G = Ea;
|
|
16
|
+
function Fa(e) {
|
|
17
|
+
return this[e < 0 ? this.length + e : e];
|
|
18
|
+
}
|
|
19
|
+
var da = Jt("at", function() {
|
|
20
|
+
if (Array.isArray(this) || typeof this == "string") return Fa;
|
|
21
|
+
}), _ = da;
|
|
22
|
+
function Ca(e) {
|
|
23
|
+
return e !== null && typeof e == "object";
|
|
24
|
+
}
|
|
25
|
+
var Ks = Ca;
|
|
26
|
+
function* Aa(e, t) {
|
|
27
|
+
let { getVisitorKeys: r, filter: n = () => true } = t, s = (i) => Ks(i) && n(i);
|
|
28
|
+
for (let i of r(e)) {
|
|
29
|
+
let u = e[i];
|
|
30
|
+
if (Array.isArray(u)) for (let o of u) s(o) && (yield o);
|
|
31
|
+
else s(u) && (yield u);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function* Ta(e, t) {
|
|
35
|
+
let r = [e];
|
|
36
|
+
for (let n = 0; n < r.length; n++) {
|
|
37
|
+
let s = r[n];
|
|
38
|
+
for (let i of Aa(s, t)) yield i, r.push(i);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function Qs(e, { getVisitorKeys: t, predicate: r }) {
|
|
42
|
+
for (let n of Ta(e, { getVisitorKeys: t })) if (r(n)) return true;
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
var zs = () => /[#*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\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](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\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]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\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])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\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-\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]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\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(?:[\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-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\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-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\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\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\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]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\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]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\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]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\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]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\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]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\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\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\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]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\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]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\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]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\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]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\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]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\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\uDD3C-\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-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\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\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\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]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\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]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\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]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\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]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\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]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\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;
|
|
46
|
+
function Nn(e) {
|
|
47
|
+
return e === 12288 || e >= 65281 && e <= 65376 || e >= 65504 && e <= 65510;
|
|
48
|
+
}
|
|
49
|
+
function vn(e) {
|
|
50
|
+
return e >= 4352 && e <= 4447 || e === 8986 || e === 8987 || e === 9001 || e === 9002 || e >= 9193 && e <= 9196 || e === 9200 || e === 9203 || e === 9725 || e === 9726 || e === 9748 || e === 9749 || e >= 9776 && e <= 9783 || e >= 9800 && e <= 9811 || e === 9855 || e >= 9866 && e <= 9871 || e === 9875 || e === 9889 || e === 9898 || e === 9899 || e === 9917 || e === 9918 || e === 9924 || e === 9925 || e === 9934 || e === 9940 || e === 9962 || e === 9970 || e === 9971 || e === 9973 || e === 9978 || e === 9981 || e === 9989 || e === 9994 || e === 9995 || e === 10024 || e === 10060 || e === 10062 || e >= 10067 && e <= 10069 || e === 10071 || e >= 10133 && e <= 10135 || e === 10160 || e === 10175 || e === 11035 || e === 11036 || e === 11088 || e === 11093 || e >= 11904 && e <= 11929 || e >= 11931 && e <= 12019 || e >= 12032 && e <= 12245 || e >= 12272 && e <= 12287 || e >= 12289 && e <= 12350 || e >= 12353 && e <= 12438 || e >= 12441 && e <= 12543 || e >= 12549 && e <= 12591 || e >= 12593 && e <= 12686 || e >= 12688 && e <= 12773 || e >= 12783 && e <= 12830 || e >= 12832 && e <= 12871 || e >= 12880 && e <= 42124 || e >= 42128 && e <= 42182 || e >= 43360 && e <= 43388 || e >= 44032 && e <= 55203 || e >= 63744 && e <= 64255 || e >= 65040 && e <= 65049 || e >= 65072 && e <= 65106 || e >= 65108 && e <= 65126 || e >= 65128 && e <= 65131 || e >= 94176 && e <= 94180 || e >= 94192 && e <= 94198 || e >= 94208 && e <= 101589 || e >= 101631 && e <= 101662 || e >= 101760 && e <= 101874 || e >= 110576 && e <= 110579 || e >= 110581 && e <= 110587 || e === 110589 || e === 110590 || e >= 110592 && e <= 110882 || e === 110898 || e >= 110928 && e <= 110930 || e === 110933 || e >= 110948 && e <= 110951 || e >= 110960 && e <= 111355 || e >= 119552 && e <= 119638 || e >= 119648 && e <= 119670 || e === 126980 || e === 127183 || e === 127374 || e >= 127377 && e <= 127386 || e >= 127488 && e <= 127490 || e >= 127504 && e <= 127547 || e >= 127552 && e <= 127560 || e === 127568 || e === 127569 || e >= 127584 && e <= 127589 || e >= 127744 && e <= 127776 || e >= 127789 && e <= 127797 || e >= 127799 && e <= 127868 || e >= 127870 && e <= 127891 || e >= 127904 && e <= 127946 || e >= 127951 && e <= 127955 || e >= 127968 && e <= 127984 || e === 127988 || e >= 127992 && e <= 128062 || e === 128064 || e >= 128066 && e <= 128252 || e >= 128255 && e <= 128317 || e >= 128331 && e <= 128334 || e >= 128336 && e <= 128359 || e === 128378 || e === 128405 || e === 128406 || e === 128420 || e >= 128507 && e <= 128591 || e >= 128640 && e <= 128709 || e === 128716 || e >= 128720 && e <= 128722 || e >= 128725 && e <= 128728 || e >= 128732 && e <= 128735 || e === 128747 || e === 128748 || e >= 128756 && e <= 128764 || e >= 128992 && e <= 129003 || e === 129008 || e >= 129292 && e <= 129338 || e >= 129340 && e <= 129349 || e >= 129351 && e <= 129535 || e >= 129648 && e <= 129660 || e >= 129664 && e <= 129674 || e >= 129678 && e <= 129734 || e === 129736 || e >= 129741 && e <= 129756 || e >= 129759 && e <= 129770 || e >= 129775 && e <= 129784 || e >= 131072 && e <= 196605 || e >= 196608 && e <= 262141;
|
|
51
|
+
}
|
|
52
|
+
var Zs = "©®‼⁉™ℹ↔↕↖↗↘↙↩↪⌨⏏⏱⏲⏸⏹⏺▪▫▶◀◻◼☀☁☂☃☄☎☑☘☝☠☢☣☦☪☮☯☸☹☺♀♂♟♠♣♥♦♨♻♾⚒⚔⚕⚖⚗⚙⚛⚜⚠⚧⚰⚱⛈⛏⛑⛓⛩⛱⛷⛸⛹✂✈✉✌✍✏✒✔✖✝✡✳✴❄❇❣❤➡⤴⤵⬅⬆⬇";
|
|
53
|
+
var xa = /[^\x20-\x7F]/u, ga = new Set(Zs);
|
|
54
|
+
function ha(e) {
|
|
55
|
+
if (!e) return 0;
|
|
56
|
+
if (!xa.test(e)) return e.length;
|
|
57
|
+
e = e.replace(zs(), (r) => ga.has(r) ? " " : " ");
|
|
58
|
+
let t = 0;
|
|
59
|
+
for (let r of e) {
|
|
60
|
+
let n = r.codePointAt(0);
|
|
61
|
+
n <= 31 || n >= 127 && n <= 159 || n >= 768 && n <= 879 || n >= 65024 && n <= 65039 || (t += Nn(n) || vn(n) ? 2 : 1);
|
|
62
|
+
}
|
|
63
|
+
return t;
|
|
64
|
+
}
|
|
65
|
+
var it = ha;
|
|
66
|
+
function Pr(e) {
|
|
67
|
+
return (t, r, n) => {
|
|
68
|
+
let s = !!n?.backwards;
|
|
69
|
+
if (r === false) return false;
|
|
70
|
+
let { length: i } = t, u = r;
|
|
71
|
+
for (; u >= 0 && u < i; ) {
|
|
72
|
+
let o = t.charAt(u);
|
|
73
|
+
if (e instanceof RegExp) {
|
|
74
|
+
if (!e.test(o)) return u;
|
|
75
|
+
} else if (!e.includes(o)) return u;
|
|
76
|
+
s ? u-- : u++;
|
|
77
|
+
}
|
|
78
|
+
return u === -1 || u === i ? u : false;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
var Qe = Pr(" "), ei = Pr(",; "), ti = Pr(/[^\n\r]/u);
|
|
82
|
+
var ri = (e) => e === `
|
|
83
|
+
` || e === "\r" || e === "\u2028" || e === "\u2029";
|
|
84
|
+
function Sa(e, t, r) {
|
|
85
|
+
let n = !!r?.backwards;
|
|
86
|
+
if (t === false) return false;
|
|
87
|
+
let s = e.charAt(t);
|
|
88
|
+
if (n) {
|
|
89
|
+
if (e.charAt(t - 1) === "\r" && s === `
|
|
90
|
+
`) return t - 2;
|
|
91
|
+
if (ri(s)) return t - 1;
|
|
92
|
+
} else {
|
|
93
|
+
if (s === "\r" && e.charAt(t + 1) === `
|
|
94
|
+
`) return t + 2;
|
|
95
|
+
if (ri(s)) return t + 1;
|
|
96
|
+
}
|
|
97
|
+
return t;
|
|
98
|
+
}
|
|
99
|
+
var ze = Sa;
|
|
100
|
+
function Ba(e, t, r = {}) {
|
|
101
|
+
let n = Qe(e, r.backwards ? t - 1 : t, r), s = ze(e, n, r);
|
|
102
|
+
return n !== s;
|
|
103
|
+
}
|
|
104
|
+
var Q = Ba;
|
|
105
|
+
function ba(e, t) {
|
|
106
|
+
if (t === false) return false;
|
|
107
|
+
if (e.charAt(t) === "/" && e.charAt(t + 1) === "*") {
|
|
108
|
+
for (let r = t + 2; r < e.length; ++r) if (e.charAt(r) === "*" && e.charAt(r + 1) === "/") return r + 2;
|
|
109
|
+
}
|
|
110
|
+
return t;
|
|
111
|
+
}
|
|
112
|
+
var Gt = ba;
|
|
113
|
+
function Pa(e, t) {
|
|
114
|
+
return t === false ? false : e.charAt(t) === "/" && e.charAt(t + 1) === "/" ? ti(e, t) : t;
|
|
115
|
+
}
|
|
116
|
+
var Wt = Pa;
|
|
117
|
+
function ka(e, t) {
|
|
118
|
+
let r = null, n = t;
|
|
119
|
+
for (; n !== r; ) r = n, n = ei(e, n), n = Gt(e, n), n = Qe(e, n);
|
|
120
|
+
return n = Wt(e, n), n = ze(e, n), n !== false && Q(e, n);
|
|
121
|
+
}
|
|
122
|
+
var qt = ka;
|
|
123
|
+
function Ia(e) {
|
|
124
|
+
return Array.isArray(e) && e.length > 0;
|
|
125
|
+
}
|
|
126
|
+
var j = Ia;
|
|
127
|
+
var La = () => {
|
|
128
|
+
}, Pe = La;
|
|
129
|
+
function Oa(e, t) {
|
|
130
|
+
let r = t === true || t === "'" ? "'" : '"', n = r === "'" ? '"' : "'", s = 0, i = 0;
|
|
131
|
+
for (let u of e) u === r ? s++ : u === n && i++;
|
|
132
|
+
return s > i ? n : r;
|
|
133
|
+
}
|
|
134
|
+
var kr = Oa;
|
|
135
|
+
var wa = /\\?(?<quote>["'])/gu;
|
|
136
|
+
function Ma(e, t) {
|
|
137
|
+
return t + G(0, e, wa, (r, n) => (n === t ? "\\" : "") + n) + t;
|
|
138
|
+
}
|
|
139
|
+
var ni = Ma;
|
|
140
|
+
function _a(e, t) {
|
|
141
|
+
let r = e.slice(1, -1), n = t.parser === "json" || t.parser === "jsonc" || t.parser === "json5" && t.quoteProps === "preserve" && !t.singleQuote ? '"' : t.__isInHtmlAttribute ? "'" : kr(r, t.singleQuote);
|
|
142
|
+
return e.charAt(0) === n ? e : ni(r, n);
|
|
143
|
+
}
|
|
144
|
+
var ut = _a;
|
|
145
|
+
var si = (e) => Number.isInteger(e) && e >= 0;
|
|
146
|
+
function L(e) {
|
|
147
|
+
let t = e.range?.[0] ?? e.start, r = (e.declaration?.decorators ?? e.decorators)?.[0];
|
|
148
|
+
return r ? Math.min(L(r), t) : t;
|
|
149
|
+
}
|
|
150
|
+
function k(e) {
|
|
151
|
+
return e.range?.[1] ?? e.end;
|
|
152
|
+
}
|
|
153
|
+
function St(e, t) {
|
|
154
|
+
let r = L(e);
|
|
155
|
+
return si(r) && r === L(t);
|
|
156
|
+
}
|
|
157
|
+
function Na(e, t) {
|
|
158
|
+
let r = k(e);
|
|
159
|
+
return si(r) && r === k(t);
|
|
160
|
+
}
|
|
161
|
+
function ii(e, t) {
|
|
162
|
+
return St(e, t) && Na(e, t);
|
|
163
|
+
}
|
|
164
|
+
var cr = null;
|
|
165
|
+
function lr(e) {
|
|
166
|
+
if (cr !== null && typeof cr.property) {
|
|
167
|
+
let t = cr;
|
|
168
|
+
return cr = lr.prototype = null, t;
|
|
169
|
+
}
|
|
170
|
+
return cr = lr.prototype = e ?? /* @__PURE__ */ Object.create(null), new lr();
|
|
171
|
+
}
|
|
172
|
+
var va = 10;
|
|
173
|
+
for (let e = 0; e <= va; e++) lr();
|
|
174
|
+
function Rn(e) {
|
|
175
|
+
return lr(e);
|
|
176
|
+
}
|
|
177
|
+
function ja(e, t = "type") {
|
|
178
|
+
Rn(e);
|
|
179
|
+
function r(n) {
|
|
180
|
+
let s = n[t], i = e[s];
|
|
181
|
+
if (!Array.isArray(i)) throw Object.assign(new Error(`Missing visitor keys for '${s}'.`), { node: n });
|
|
182
|
+
return i;
|
|
183
|
+
}
|
|
184
|
+
return r;
|
|
185
|
+
}
|
|
186
|
+
var Ir = ja;
|
|
187
|
+
var ui = { AccessorProperty: ["decorators", "key", "typeAnnotation", "value"], AnyTypeAnnotation: [], ArgumentPlaceholder: [], ArrayExpression: ["elements"], ArrayPattern: ["elements", "typeAnnotation", "decorators"], ArrayTypeAnnotation: ["elementType"], ArrowFunctionExpression: ["typeParameters", "params", "predicate", "returnType", "body"], AsConstExpression: ["expression"], AsExpression: ["expression", "typeAnnotation"], AssignmentExpression: ["left", "right"], AssignmentPattern: ["left", "right", "decorators", "typeAnnotation"], AwaitExpression: ["argument"], BigIntLiteral: [], BigIntLiteralTypeAnnotation: [], BigIntTypeAnnotation: [], BinaryExpression: ["left", "right"], BindExpression: ["object", "callee"], BlockStatement: ["directives", "body"], BooleanLiteral: [], BooleanLiteralTypeAnnotation: [], BooleanTypeAnnotation: [], BreakStatement: ["label"], CallExpression: ["callee", "typeArguments", "arguments"], CatchClause: ["param", "body"], ChainExpression: ["expression"], ClassAccessorProperty: ["decorators", "key", "typeAnnotation", "value"], ClassBody: ["body"], ClassDeclaration: ["decorators", "id", "typeParameters", "superClass", "superTypeArguments", "mixins", "implements", "body", "superTypeParameters"], ClassExpression: ["decorators", "id", "typeParameters", "superClass", "superTypeArguments", "mixins", "implements", "body", "superTypeParameters"], ClassImplements: ["id", "typeParameters"], ClassMethod: ["decorators", "key", "typeParameters", "params", "returnType", "body"], ClassPrivateMethod: ["decorators", "key", "typeParameters", "params", "returnType", "body"], ClassPrivateProperty: ["decorators", "variance", "key", "typeAnnotation", "value"], ClassProperty: ["decorators", "variance", "key", "typeAnnotation", "value"], ComponentDeclaration: ["id", "params", "body", "typeParameters", "rendersType"], ComponentParameter: ["name", "local"], ComponentTypeAnnotation: ["params", "rest", "typeParameters", "rendersType"], ComponentTypeParameter: ["name", "typeAnnotation"], ConditionalExpression: ["test", "consequent", "alternate"], ConditionalTypeAnnotation: ["checkType", "extendsType", "trueType", "falseType"], ContinueStatement: ["label"], DebuggerStatement: [], DeclareClass: ["id", "typeParameters", "extends", "mixins", "implements", "body"], DeclareComponent: ["id", "params", "rest", "typeParameters", "rendersType"], DeclaredPredicate: ["value"], DeclareEnum: ["id", "body"], DeclareExportAllDeclaration: ["source", "attributes"], DeclareExportDeclaration: ["declaration", "specifiers", "source", "attributes"], DeclareFunction: ["id", "predicate"], DeclareHook: ["id"], DeclareInterface: ["id", "typeParameters", "extends", "body"], DeclareModule: ["id", "body"], DeclareModuleExports: ["typeAnnotation"], DeclareNamespace: ["id", "body"], DeclareOpaqueType: ["id", "typeParameters", "supertype", "lowerBound", "upperBound"], DeclareTypeAlias: ["id", "typeParameters", "right"], DeclareVariable: ["id"], Decorator: ["expression"], Directive: ["value"], DirectiveLiteral: [], DoExpression: ["body"], DoWhileStatement: ["body", "test"], EmptyStatement: [], EmptyTypeAnnotation: [], EnumBigIntBody: ["members"], EnumBigIntMember: ["id", "init"], EnumBooleanBody: ["members"], EnumBooleanMember: ["id", "init"], EnumDeclaration: ["id", "body"], EnumDefaultedMember: ["id"], EnumNumberBody: ["members"], EnumNumberMember: ["id", "init"], EnumStringBody: ["members"], EnumStringMember: ["id", "init"], EnumSymbolBody: ["members"], ExistsTypeAnnotation: [], ExperimentalRestProperty: ["argument"], ExperimentalSpreadProperty: ["argument"], ExportAllDeclaration: ["source", "attributes", "exported"], ExportDefaultDeclaration: ["declaration"], ExportDefaultSpecifier: ["exported"], ExportNamedDeclaration: ["declaration", "specifiers", "source", "attributes"], ExportNamespaceSpecifier: ["exported"], ExportSpecifier: ["local", "exported"], ExpressionStatement: ["expression"], File: ["program"], ForInStatement: ["left", "right", "body"], ForOfStatement: ["left", "right", "body"], ForStatement: ["init", "test", "update", "body"], FunctionDeclaration: ["id", "typeParameters", "params", "predicate", "returnType", "body"], FunctionExpression: ["id", "typeParameters", "params", "predicate", "returnType", "body"], FunctionTypeAnnotation: ["typeParameters", "this", "params", "rest", "returnType"], FunctionTypeParam: ["name", "typeAnnotation"], GenericTypeAnnotation: ["id", "typeParameters"], HookDeclaration: ["id", "params", "body", "typeParameters", "returnType"], HookTypeAnnotation: ["params", "returnType", "rest", "typeParameters"], Identifier: ["typeAnnotation", "decorators"], IfStatement: ["test", "consequent", "alternate"], ImportAttribute: ["key", "value"], ImportDeclaration: ["specifiers", "source", "attributes"], ImportDefaultSpecifier: ["local"], ImportExpression: ["source", "options"], ImportNamespaceSpecifier: ["local"], ImportSpecifier: ["imported", "local"], IndexedAccessType: ["objectType", "indexType"], InferredPredicate: [], InferTypeAnnotation: ["typeParameter"], InterfaceDeclaration: ["id", "typeParameters", "extends", "body"], InterfaceExtends: ["id", "typeParameters"], InterfaceTypeAnnotation: ["extends", "body"], InterpreterDirective: [], IntersectionTypeAnnotation: ["types"], JsExpressionRoot: ["node"], JsonRoot: ["node"], JSXAttribute: ["name", "value"], JSXClosingElement: ["name"], JSXClosingFragment: [], JSXElement: ["openingElement", "children", "closingElement"], JSXEmptyExpression: [], JSXExpressionContainer: ["expression"], JSXFragment: ["openingFragment", "children", "closingFragment"], JSXIdentifier: [], JSXMemberExpression: ["object", "property"], JSXNamespacedName: ["namespace", "name"], JSXOpeningElement: ["name", "typeArguments", "attributes"], JSXOpeningFragment: [], JSXSpreadAttribute: ["argument"], JSXSpreadChild: ["expression"], JSXText: [], KeyofTypeAnnotation: ["argument"], LabeledStatement: ["label", "body"], Literal: [], LogicalExpression: ["left", "right"], MatchArrayPattern: ["elements", "rest"], MatchAsPattern: ["pattern", "target"], MatchBindingPattern: ["id"], MatchExpression: ["argument", "cases"], MatchExpressionCase: ["pattern", "body", "guard"], MatchIdentifierPattern: ["id"], MatchLiteralPattern: ["literal"], MatchMemberPattern: ["base", "property"], MatchObjectPattern: ["properties", "rest"], MatchObjectPatternProperty: ["key", "pattern"], MatchOrPattern: ["patterns"], MatchRestPattern: ["argument"], MatchStatement: ["argument", "cases"], MatchStatementCase: ["pattern", "body", "guard"], MatchUnaryPattern: ["argument"], MatchWildcardPattern: [], MemberExpression: ["object", "property"], MetaProperty: ["meta", "property"], MethodDefinition: ["decorators", "key", "value"], MixedTypeAnnotation: [], ModuleExpression: ["body"], NeverTypeAnnotation: [], NewExpression: ["callee", "typeArguments", "arguments"], NGChainedExpression: ["expressions"], NGEmptyExpression: [], NGMicrosyntax: ["body"], NGMicrosyntaxAs: ["key", "alias"], NGMicrosyntaxExpression: ["expression", "alias"], NGMicrosyntaxKey: [], NGMicrosyntaxKeyedExpression: ["key", "expression"], NGMicrosyntaxLet: ["key", "value"], NGPipeExpression: ["left", "right", "arguments"], NGRoot: ["node"], NullableTypeAnnotation: ["typeAnnotation"], NullLiteral: [], NullLiteralTypeAnnotation: [], NumberLiteralTypeAnnotation: [], NumberTypeAnnotation: [], NumericLiteral: [], ObjectExpression: ["properties"], ObjectMethod: ["decorators", "key", "typeParameters", "params", "returnType", "body"], ObjectPattern: ["decorators", "properties", "typeAnnotation"], ObjectProperty: ["decorators", "key", "value"], ObjectTypeAnnotation: ["properties", "indexers", "callProperties", "internalSlots"], ObjectTypeCallProperty: ["value"], ObjectTypeIndexer: ["variance", "id", "key", "value"], ObjectTypeInternalSlot: ["id", "value"], ObjectTypeMappedTypeProperty: ["keyTparam", "propType", "sourceType", "variance"], ObjectTypeProperty: ["key", "value", "variance"], ObjectTypeSpreadProperty: ["argument"], OpaqueType: ["id", "typeParameters", "supertype", "impltype", "lowerBound", "upperBound"], OptionalCallExpression: ["callee", "typeArguments", "arguments"], OptionalIndexedAccessType: ["objectType", "indexType"], OptionalMemberExpression: ["object", "property"], ParenthesizedExpression: ["expression"], PipelineBareFunction: ["callee"], PipelinePrimaryTopicReference: [], PipelineTopicExpression: ["expression"], Placeholder: [], PrivateIdentifier: [], PrivateName: ["id"], Program: ["directives", "body"], Property: ["key", "value"], PropertyDefinition: ["decorators", "key", "typeAnnotation", "value", "variance"], QualifiedTypeIdentifier: ["qualification", "id"], QualifiedTypeofIdentifier: ["qualification", "id"], RegExpLiteral: [], RestElement: ["argument", "typeAnnotation", "decorators"], ReturnStatement: ["argument"], SatisfiesExpression: ["expression", "typeAnnotation"], SequenceExpression: ["expressions"], SpreadElement: ["argument"], StaticBlock: ["body"], StringLiteral: [], StringLiteralTypeAnnotation: [], StringTypeAnnotation: [], Super: [], SwitchCase: ["test", "consequent"], SwitchStatement: ["discriminant", "cases"], SymbolTypeAnnotation: [], TaggedTemplateExpression: ["tag", "typeArguments", "quasi"], TemplateElement: [], TemplateLiteral: ["quasis", "expressions"], ThisExpression: [], ThisTypeAnnotation: [], ThrowStatement: ["argument"], TopicReference: [], TryStatement: ["block", "handler", "finalizer"], TSAbstractAccessorProperty: ["decorators", "key", "typeAnnotation"], TSAbstractKeyword: [], TSAbstractMethodDefinition: ["key", "value"], TSAbstractPropertyDefinition: ["decorators", "key", "typeAnnotation"], TSAnyKeyword: [], TSArrayType: ["elementType"], TSAsExpression: ["expression", "typeAnnotation"], TSAsyncKeyword: [], TSBigIntKeyword: [], TSBooleanKeyword: [], TSCallSignatureDeclaration: ["typeParameters", "params", "returnType"], TSClassImplements: ["expression", "typeArguments"], TSConditionalType: ["checkType", "extendsType", "trueType", "falseType"], TSConstructorType: ["typeParameters", "params", "returnType"], TSConstructSignatureDeclaration: ["typeParameters", "params", "returnType"], TSDeclareFunction: ["id", "typeParameters", "params", "returnType", "body"], TSDeclareKeyword: [], TSDeclareMethod: ["decorators", "key", "typeParameters", "params", "returnType"], TSEmptyBodyFunctionExpression: ["id", "typeParameters", "params", "returnType"], TSEnumBody: ["members"], TSEnumDeclaration: ["id", "body"], TSEnumMember: ["id", "initializer"], TSExportAssignment: ["expression"], TSExportKeyword: [], TSExternalModuleReference: ["expression"], TSFunctionType: ["typeParameters", "params", "returnType"], TSImportEqualsDeclaration: ["id", "moduleReference"], TSImportType: ["options", "qualifier", "typeArguments", "source"], TSIndexedAccessType: ["objectType", "indexType"], TSIndexSignature: ["parameters", "typeAnnotation"], TSInferType: ["typeParameter"], TSInstantiationExpression: ["expression", "typeArguments"], TSInterfaceBody: ["body"], TSInterfaceDeclaration: ["id", "typeParameters", "extends", "body"], TSInterfaceHeritage: ["expression", "typeArguments"], TSIntersectionType: ["types"], TSIntrinsicKeyword: [], TSJSDocAllType: [], TSJSDocNonNullableType: ["typeAnnotation"], TSJSDocNullableType: ["typeAnnotation"], TSJSDocUnknownType: [], TSLiteralType: ["literal"], TSMappedType: ["key", "constraint", "nameType", "typeAnnotation"], TSMethodSignature: ["key", "typeParameters", "params", "returnType"], TSModuleBlock: ["body"], TSModuleDeclaration: ["id", "body"], TSNamedTupleMember: ["label", "elementType"], TSNamespaceExportDeclaration: ["id"], TSNeverKeyword: [], TSNonNullExpression: ["expression"], TSNullKeyword: [], TSNumberKeyword: [], TSObjectKeyword: [], TSOptionalType: ["typeAnnotation"], TSParameterProperty: ["parameter", "decorators"], TSParenthesizedType: ["typeAnnotation"], TSPrivateKeyword: [], TSPropertySignature: ["key", "typeAnnotation"], TSProtectedKeyword: [], TSPublicKeyword: [], TSQualifiedName: ["left", "right"], TSReadonlyKeyword: [], TSRestType: ["typeAnnotation"], TSSatisfiesExpression: ["expression", "typeAnnotation"], TSStaticKeyword: [], TSStringKeyword: [], TSSymbolKeyword: [], TSTemplateLiteralType: ["quasis", "types"], TSThisType: [], TSTupleType: ["elementTypes"], TSTypeAliasDeclaration: ["id", "typeParameters", "typeAnnotation"], TSTypeAnnotation: ["typeAnnotation"], TSTypeAssertion: ["typeAnnotation", "expression"], TSTypeLiteral: ["members"], TSTypeOperator: ["typeAnnotation"], TSTypeParameter: ["name", "constraint", "default"], TSTypeParameterDeclaration: ["params"], TSTypeParameterInstantiation: ["params"], TSTypePredicate: ["parameterName", "typeAnnotation"], TSTypeQuery: ["exprName", "typeArguments"], TSTypeReference: ["typeName", "typeArguments"], TSUndefinedKeyword: [], TSUnionType: ["types"], TSUnknownKeyword: [], TSVoidKeyword: [], TupleTypeAnnotation: ["types", "elementTypes"], TupleTypeLabeledElement: ["label", "elementType", "variance"], TupleTypeSpreadElement: ["label", "typeAnnotation"], TypeAlias: ["id", "typeParameters", "right"], TypeAnnotation: ["typeAnnotation"], TypeCastExpression: ["expression", "typeAnnotation"], TypeofTypeAnnotation: ["argument", "typeArguments"], TypeOperator: ["typeAnnotation"], TypeParameter: ["bound", "default", "variance"], TypeParameterDeclaration: ["params"], TypeParameterInstantiation: ["params"], TypePredicate: ["parameterName", "typeAnnotation"], UnaryExpression: ["argument"], UndefinedTypeAnnotation: [], UnionTypeAnnotation: ["types"], UnknownTypeAnnotation: [], UpdateExpression: ["argument"], V8IntrinsicIdentifier: [], VariableDeclaration: ["declarations"], VariableDeclarator: ["id", "init"], Variance: [], VoidPattern: [], VoidTypeAnnotation: [], WhileStatement: ["test", "body"], WithStatement: ["object", "body"], YieldExpression: ["argument"] };
|
|
188
|
+
var Ra = Ir(ui), Lr = Ra;
|
|
189
|
+
function Ja(e) {
|
|
190
|
+
let t = new Set(e);
|
|
191
|
+
return (r) => t.has(r?.type);
|
|
192
|
+
}
|
|
193
|
+
var b = Ja;
|
|
194
|
+
function Ga(e) {
|
|
195
|
+
return e.extra?.raw ?? e.raw;
|
|
196
|
+
}
|
|
197
|
+
var pe = Ga;
|
|
198
|
+
var Wa = b(["Block", "CommentBlock", "MultiLine"]), ee = Wa;
|
|
199
|
+
var qa = b(["AnyTypeAnnotation", "ThisTypeAnnotation", "NumberTypeAnnotation", "VoidTypeAnnotation", "BooleanTypeAnnotation", "BigIntTypeAnnotation", "SymbolTypeAnnotation", "StringTypeAnnotation", "NeverTypeAnnotation", "UndefinedTypeAnnotation", "UnknownTypeAnnotation", "EmptyTypeAnnotation", "MixedTypeAnnotation"]), Or = qa;
|
|
200
|
+
var Ya = b(["Line", "CommentLine", "SingleLine", "HashbangComment", "HTMLOpen", "HTMLClose", "Hashbang", "InterpreterDirective"]), Ct = Ya;
|
|
201
|
+
function Ua(e, t) {
|
|
202
|
+
let r = t.split(".");
|
|
203
|
+
for (let n = r.length - 1; n >= 0; n--) {
|
|
204
|
+
let s = r[n];
|
|
205
|
+
if (n === 0) return e.type === "Identifier" && e.name === s;
|
|
206
|
+
if (n === 1 && e.type === "MetaProperty" && e.property.type === "Identifier" && e.property.name === s) {
|
|
207
|
+
e = e.meta;
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
if (e.type === "MemberExpression" && !e.optional && !e.computed && e.property.type === "Identifier" && e.property.name === s) {
|
|
211
|
+
e = e.object;
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
return false;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
function Ha(e, t) {
|
|
218
|
+
return t.some((r) => Ua(e, r));
|
|
219
|
+
}
|
|
220
|
+
var Bt = Ha;
|
|
221
|
+
function Xa({ type: e }) {
|
|
222
|
+
return e.startsWith("TS") && e.endsWith("Keyword");
|
|
223
|
+
}
|
|
224
|
+
var wr = Xa;
|
|
225
|
+
function Va({ node: e, parent: t }) {
|
|
226
|
+
return e?.type !== "EmptyStatement" ? false : t.type === "IfStatement" ? t.consequent === e || t.alternate === e : t.type === "DoWhileStatement" || t.type === "ForInStatement" || t.type === "ForOfStatement" || t.type === "ForStatement" || t.type === "LabeledStatement" || t.type === "WithStatement" || t.type === "WhileStatement" ? t.body === e : false;
|
|
227
|
+
}
|
|
228
|
+
var bt = Va;
|
|
229
|
+
function Dr(e, t) {
|
|
230
|
+
return t(e) || Qs(e, { getVisitorKeys: Lr, predicate: t });
|
|
231
|
+
}
|
|
232
|
+
function Ut(e) {
|
|
233
|
+
return e.type === "AssignmentExpression" || e.type === "BinaryExpression" || e.type === "LogicalExpression" || e.type === "NGPipeExpression" || e.type === "ConditionalExpression" || M(e) || R(e) || e.type === "SequenceExpression" || e.type === "TaggedTemplateExpression" || e.type === "BindExpression" || e.type === "UpdateExpression" && !e.prefix || Ae(e) || e.type === "TSNonNullExpression" || e.type === "ChainExpression";
|
|
234
|
+
}
|
|
235
|
+
function pi(e) {
|
|
236
|
+
return e.expressions ? e.expressions[0] : e.left ?? e.test ?? e.callee ?? e.object ?? e.tag ?? e.argument ?? e.expression;
|
|
237
|
+
}
|
|
238
|
+
function _r(e) {
|
|
239
|
+
if (e.expressions) return ["expressions", 0];
|
|
240
|
+
if (e.left) return ["left"];
|
|
241
|
+
if (e.test) return ["test"];
|
|
242
|
+
if (e.object) return ["object"];
|
|
243
|
+
if (e.callee) return ["callee"];
|
|
244
|
+
if (e.tag) return ["tag"];
|
|
245
|
+
if (e.argument) return ["argument"];
|
|
246
|
+
if (e.expression) return ["expression"];
|
|
247
|
+
throw new Error("Unexpected node has no left side.");
|
|
248
|
+
}
|
|
249
|
+
var ci = b(["ExportDefaultDeclaration", "DeclareExportDeclaration", "ExportNamedDeclaration", "ExportAllDeclaration", "DeclareExportAllDeclaration"]), W = b(["ArrayExpression"]), ie = b(["ObjectExpression"]);
|
|
250
|
+
function li(e) {
|
|
251
|
+
return e.type === "LogicalExpression" && e.operator === "??";
|
|
252
|
+
}
|
|
253
|
+
function de(e) {
|
|
254
|
+
return e.type === "NumericLiteral" || e.type === "Literal" && typeof e.value == "number";
|
|
255
|
+
}
|
|
256
|
+
function mi(e) {
|
|
257
|
+
return e.type === "BooleanLiteral" || e.type === "Literal" && typeof e.value == "boolean";
|
|
258
|
+
}
|
|
259
|
+
function Yn(e) {
|
|
260
|
+
return e.type === "UnaryExpression" && (e.operator === "+" || e.operator === "-") && de(e.argument);
|
|
261
|
+
}
|
|
262
|
+
function X(e) {
|
|
263
|
+
return !!(e && (e.type === "StringLiteral" || e.type === "Literal" && typeof e.value == "string"));
|
|
264
|
+
}
|
|
265
|
+
function Un(e) {
|
|
266
|
+
return e.type === "RegExpLiteral" || e.type === "Literal" && !!e.regex;
|
|
267
|
+
}
|
|
268
|
+
var Nr = b(["Literal", "BooleanLiteral", "BigIntLiteral", "DirectiveLiteral", "NullLiteral", "NumericLiteral", "RegExpLiteral", "StringLiteral"]), $a = b(["Identifier", "ThisExpression", "Super", "PrivateName", "PrivateIdentifier"]), We = b(["ObjectTypeAnnotation", "TSTypeLiteral", "TSMappedType"]), Yt = b(["FunctionExpression", "ArrowFunctionExpression"]);
|
|
269
|
+
function Ka(e) {
|
|
270
|
+
return e.type === "FunctionExpression" || e.type === "ArrowFunctionExpression" && e.body.type === "BlockStatement";
|
|
271
|
+
}
|
|
272
|
+
function Jn(e) {
|
|
273
|
+
return M(e) && e.callee.type === "Identifier" && ["async", "inject", "fakeAsync", "waitForAsync"].includes(e.callee.name);
|
|
274
|
+
}
|
|
275
|
+
var q = b(["JSXElement", "JSXFragment"]);
|
|
276
|
+
function lt(e) {
|
|
277
|
+
return e.method && e.kind === "init" || e.kind === "get" || e.kind === "set";
|
|
278
|
+
}
|
|
279
|
+
function vr(e) {
|
|
280
|
+
return (e.type === "ObjectTypeProperty" || e.type === "ObjectTypeInternalSlot") && !e.static && !e.method && e.kind !== "get" && e.kind !== "set" && e.value.type === "FunctionTypeAnnotation";
|
|
281
|
+
}
|
|
282
|
+
function Di(e) {
|
|
283
|
+
return (e.type === "TypeAnnotation" || e.type === "TSTypeAnnotation") && e.typeAnnotation.type === "FunctionTypeAnnotation" && !e.static && !St(e, e.typeAnnotation);
|
|
284
|
+
}
|
|
285
|
+
var xe = b(["BinaryExpression", "LogicalExpression", "NGPipeExpression"]);
|
|
286
|
+
function At(e) {
|
|
287
|
+
return R(e) || e.type === "BindExpression" && !!e.object;
|
|
288
|
+
}
|
|
289
|
+
var Qa = b(["TSThisType", "NullLiteralTypeAnnotation", "BooleanLiteralTypeAnnotation", "StringLiteralTypeAnnotation", "BigIntLiteralTypeAnnotation", "NumberLiteralTypeAnnotation", "TSLiteralType", "TSTemplateLiteralType"]);
|
|
290
|
+
function Ht(e) {
|
|
291
|
+
return wr(e) || Or(e) || Qa(e) || e.type === "GenericTypeAnnotation" && !e.typeParameters || e.type === "TSTypeReference" && !e.typeArguments;
|
|
292
|
+
}
|
|
293
|
+
function za(e) {
|
|
294
|
+
return e.type === "Identifier" && (e.name === "beforeEach" || e.name === "beforeAll" || e.name === "afterEach" || e.name === "afterAll");
|
|
295
|
+
}
|
|
296
|
+
var Za = ["it", "it.only", "it.skip", "describe", "describe.only", "describe.skip", "test", "test.only", "test.skip", "test.fixme", "test.step", "test.describe", "test.describe.only", "test.describe.skip", "test.describe.fixme", "test.describe.parallel", "test.describe.parallel.only", "test.describe.serial", "test.describe.serial.only", "skip", "xit", "xdescribe", "xtest", "fit", "fdescribe", "ftest"];
|
|
297
|
+
function ep(e) {
|
|
298
|
+
return Bt(e, Za);
|
|
299
|
+
}
|
|
300
|
+
function Pt(e, t) {
|
|
301
|
+
if (e?.type !== "CallExpression" || e.optional) return false;
|
|
302
|
+
let r = ce(e);
|
|
303
|
+
if (r.length === 1) {
|
|
304
|
+
if (Jn(e) && Pt(t)) return Yt(r[0]);
|
|
305
|
+
if (za(e.callee)) return Jn(r[0]);
|
|
306
|
+
} else if ((r.length === 2 || r.length === 3) && (r[0].type === "TemplateLiteral" || X(r[0])) && ep(e.callee)) return r[2] && !de(r[2]) ? false : (r.length === 2 ? Yt(r[1]) : Ka(r[1]) && K(r[1]).length <= 1) || Jn(r[1]);
|
|
307
|
+
return false;
|
|
308
|
+
}
|
|
309
|
+
var fi = (e) => (t) => (t?.type === "ChainExpression" && (t = t.expression), e(t)), M = fi(b(["CallExpression", "OptionalCallExpression"])), R = fi(b(["MemberExpression", "OptionalMemberExpression"]));
|
|
310
|
+
function Hn(e, t = 5) {
|
|
311
|
+
return yi(e, t) <= t;
|
|
312
|
+
}
|
|
313
|
+
function yi(e, t) {
|
|
314
|
+
let r = 0;
|
|
315
|
+
for (let n in e) {
|
|
316
|
+
let s = e[n];
|
|
317
|
+
if (s && typeof s == "object" && typeof s.type == "string" && (r++, r += yi(s, t - r)), r > t) return r;
|
|
318
|
+
}
|
|
319
|
+
return r;
|
|
320
|
+
}
|
|
321
|
+
var tp = 0.25;
|
|
322
|
+
function fr(e, t) {
|
|
323
|
+
let { printWidth: r } = t;
|
|
324
|
+
if (C(e)) return false;
|
|
325
|
+
let n = r * tp;
|
|
326
|
+
if (e.type === "ThisExpression" || e.type === "Identifier" && e.name.length <= n || Yn(e) && !C(e.argument)) return true;
|
|
327
|
+
let s = e.type === "Literal" && "regex" in e && e.regex.pattern || e.type === "RegExpLiteral" && e.pattern;
|
|
328
|
+
return s ? s.length <= n : X(e) ? ut(pe(e), t).length <= n : e.type === "TemplateLiteral" ? e.expressions.length === 0 && e.quasis[0].value.raw.length <= n && !e.quasis[0].value.raw.includes(`
|
|
329
|
+
`) : e.type === "UnaryExpression" ? fr(e.argument, { printWidth: r }) : e.type === "CallExpression" && e.arguments.length === 0 && e.callee.type === "Identifier" ? e.callee.name.length <= n - 2 : Nr(e);
|
|
330
|
+
}
|
|
331
|
+
function Ce(e, t) {
|
|
332
|
+
return q(t) ? It(t) : C(t, T.Leading, (r) => Q(e, k(r)));
|
|
333
|
+
}
|
|
334
|
+
function oi(e) {
|
|
335
|
+
return e.quasis.some((t) => t.value.raw.includes(`
|
|
336
|
+
`));
|
|
337
|
+
}
|
|
338
|
+
function jr(e, t) {
|
|
339
|
+
return (e.type === "TemplateLiteral" && oi(e) || e.type === "TaggedTemplateExpression" && oi(e.quasi)) && !Q(t, L(e), { backwards: true });
|
|
340
|
+
}
|
|
341
|
+
function Rr(e) {
|
|
342
|
+
if (!C(e)) return false;
|
|
343
|
+
let t = _(0, Ze(e, T.Dangling), -1);
|
|
344
|
+
return t && !ee(t);
|
|
345
|
+
}
|
|
346
|
+
function Ei(e) {
|
|
347
|
+
if (e.length <= 1) return false;
|
|
348
|
+
let t = 0;
|
|
349
|
+
for (let r of e) if (Yt(r)) {
|
|
350
|
+
if (t += 1, t > 1) return true;
|
|
351
|
+
} else if (M(r)) {
|
|
352
|
+
for (let n of ce(r)) if (Yt(n)) return true;
|
|
353
|
+
}
|
|
354
|
+
return false;
|
|
355
|
+
}
|
|
356
|
+
function Jr(e) {
|
|
357
|
+
let { node: t, parent: r, key: n } = e;
|
|
358
|
+
return n === "callee" && M(t) && M(r) && r.arguments.length > 0 && t.arguments.length > r.arguments.length;
|
|
359
|
+
}
|
|
360
|
+
var rp = /* @__PURE__ */ new Set(["!", "-", "+", "~"]);
|
|
361
|
+
function je(e, t = 2) {
|
|
362
|
+
if (t <= 0) return false;
|
|
363
|
+
if (e.type === "ChainExpression" || e.type === "TSNonNullExpression") return je(e.expression, t);
|
|
364
|
+
let r = (n) => je(n, t - 1);
|
|
365
|
+
if (Un(e)) return it(e.pattern ?? e.regex.pattern) <= 5;
|
|
366
|
+
if (Nr(e) || $a(e) || e.type === "ArgumentPlaceholder") return true;
|
|
367
|
+
if (e.type === "TemplateLiteral") return e.quasis.every((n) => !n.value.raw.includes(`
|
|
368
|
+
`)) && e.expressions.every(r);
|
|
369
|
+
if (ie(e)) return e.properties.every((n) => !n.computed && (n.shorthand || n.value && r(n.value)));
|
|
370
|
+
if (W(e)) return e.elements.every((n) => n === null || r(n));
|
|
371
|
+
if (mt(e)) {
|
|
372
|
+
if (e.type === "ImportExpression" || je(e.callee, t)) {
|
|
373
|
+
let n = ce(e);
|
|
374
|
+
return n.length <= t && n.every(r);
|
|
375
|
+
}
|
|
376
|
+
return false;
|
|
377
|
+
}
|
|
378
|
+
return R(e) ? je(e.object, t) && je(e.property, t) : e.type === "UnaryExpression" && rp.has(e.operator) || e.type === "UpdateExpression" ? je(e.argument, t) : false;
|
|
379
|
+
}
|
|
380
|
+
function ue(e, t = "es5") {
|
|
381
|
+
return e.trailingComma === "es5" && t === "es5" || e.trailingComma === "all" && (t === "all" || t === "es5");
|
|
382
|
+
}
|
|
383
|
+
function fe(e, t) {
|
|
384
|
+
switch (e.type) {
|
|
385
|
+
case "BinaryExpression":
|
|
386
|
+
case "LogicalExpression":
|
|
387
|
+
case "AssignmentExpression":
|
|
388
|
+
case "NGPipeExpression":
|
|
389
|
+
return fe(e.left, t);
|
|
390
|
+
case "MemberExpression":
|
|
391
|
+
case "OptionalMemberExpression":
|
|
392
|
+
return fe(e.object, t);
|
|
393
|
+
case "TaggedTemplateExpression":
|
|
394
|
+
return e.tag.type === "FunctionExpression" ? false : fe(e.tag, t);
|
|
395
|
+
case "CallExpression":
|
|
396
|
+
case "OptionalCallExpression":
|
|
397
|
+
return e.callee.type === "FunctionExpression" ? false : fe(e.callee, t);
|
|
398
|
+
case "ConditionalExpression":
|
|
399
|
+
return fe(e.test, t);
|
|
400
|
+
case "UpdateExpression":
|
|
401
|
+
return !e.prefix && fe(e.argument, t);
|
|
402
|
+
case "BindExpression":
|
|
403
|
+
return e.object && fe(e.object, t);
|
|
404
|
+
case "SequenceExpression":
|
|
405
|
+
return fe(e.expressions[0], t);
|
|
406
|
+
case "ChainExpression":
|
|
407
|
+
case "TSSatisfiesExpression":
|
|
408
|
+
case "TSAsExpression":
|
|
409
|
+
case "TSNonNullExpression":
|
|
410
|
+
case "AsExpression":
|
|
411
|
+
case "AsConstExpression":
|
|
412
|
+
case "SatisfiesExpression":
|
|
413
|
+
return fe(e.expression, t);
|
|
414
|
+
default:
|
|
415
|
+
return t(e);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
var ai = { "==": true, "!=": true, "===": true, "!==": true }, Mr = { "*": true, "/": true, "%": true }, qn = { ">>": true, ">>>": true, "<<": true };
|
|
419
|
+
function yr(e, t) {
|
|
420
|
+
return !(mr(t) !== mr(e) || e === "**" || ai[e] && ai[t] || t === "%" && Mr[e] || e === "%" && Mr[t] || t !== e && Mr[t] && Mr[e] || qn[e] && qn[t]);
|
|
421
|
+
}
|
|
422
|
+
var np = new Map([["|>"], ["??"], ["||"], ["&&"], ["|"], ["^"], ["&"], ["==", "===", "!=", "!=="], ["<", ">", "<=", ">=", "in", "instanceof"], [">>", "<<", ">>>"], ["+", "-"], ["*", "/", "%"], ["**"]].flatMap((e, t) => e.map((r) => [r, t])));
|
|
423
|
+
function mr(e) {
|
|
424
|
+
return np.get(e);
|
|
425
|
+
}
|
|
426
|
+
function Fi(e) {
|
|
427
|
+
return !!qn[e] || e === "|" || e === "^" || e === "&";
|
|
428
|
+
}
|
|
429
|
+
function di(e) {
|
|
430
|
+
if (e.rest) return true;
|
|
431
|
+
let t = K(e);
|
|
432
|
+
return _(0, t, -1)?.type === "RestElement";
|
|
433
|
+
}
|
|
434
|
+
var Gn = /* @__PURE__ */ new WeakMap();
|
|
435
|
+
function K(e) {
|
|
436
|
+
if (Gn.has(e)) return Gn.get(e);
|
|
437
|
+
let t = [];
|
|
438
|
+
return e.this && t.push(e.this), t.push(...e.params), e.rest && t.push(e.rest), Gn.set(e, t), t;
|
|
439
|
+
}
|
|
440
|
+
function Ci(e, t) {
|
|
441
|
+
let { node: r } = e, n = 0, s = () => t(e, n++);
|
|
442
|
+
r.this && e.call(s, "this"), e.each(s, "params"), r.rest && e.call(s, "rest");
|
|
443
|
+
}
|
|
444
|
+
var Wn = /* @__PURE__ */ new WeakMap();
|
|
445
|
+
function ce(e) {
|
|
446
|
+
if (Wn.has(e)) return Wn.get(e);
|
|
447
|
+
if (e.type === "ChainExpression") return ce(e.expression);
|
|
448
|
+
let t;
|
|
449
|
+
return e.type === "ImportExpression" || e.type === "TSImportType" ? (t = [e.source], e.options && t.push(e.options)) : e.type === "TSExternalModuleReference" ? t = [e.expression] : t = e.arguments, Wn.set(e, t), t;
|
|
450
|
+
}
|
|
451
|
+
function Xt(e, t) {
|
|
452
|
+
let { node: r } = e;
|
|
453
|
+
if (r.type === "ChainExpression") return e.call(() => Xt(e, t), "expression");
|
|
454
|
+
r.type === "ImportExpression" || r.type === "TSImportType" ? (e.call(() => t(e, 0), "source"), r.options && e.call(() => t(e, 1), "options")) : r.type === "TSExternalModuleReference" ? e.call(() => t(e, 0), "expression") : e.each(t, "arguments");
|
|
455
|
+
}
|
|
456
|
+
function Xn(e, t) {
|
|
457
|
+
let r = [];
|
|
458
|
+
if (e.type === "ChainExpression" && (e = e.expression, r.push("expression")), e.type === "ImportExpression" || e.type === "TSImportType") {
|
|
459
|
+
if (t === 0 || t === (e.options ? -2 : -1)) return [...r, "source"];
|
|
460
|
+
if (e.options && (t === 1 || t === -1)) return [...r, "options"];
|
|
461
|
+
throw new RangeError("Invalid argument index");
|
|
462
|
+
} else if (e.type === "TSExternalModuleReference") {
|
|
463
|
+
if (t === 0 || t === -1) return [...r, "expression"];
|
|
464
|
+
} else if (t < 0 && (t = e.arguments.length + t), t >= 0 && t < e.arguments.length) return [...r, "arguments", t];
|
|
465
|
+
throw new RangeError("Invalid argument index");
|
|
466
|
+
}
|
|
467
|
+
function kt(e) {
|
|
468
|
+
return e.value.trim() === "prettier-ignore" && !e.unignore;
|
|
469
|
+
}
|
|
470
|
+
function It(e) {
|
|
471
|
+
return e?.prettierIgnore || C(e, T.PrettierIgnore);
|
|
472
|
+
}
|
|
473
|
+
var T = { Leading: 2, Trailing: 4, Dangling: 8, Block: 16, Line: 32, PrettierIgnore: 64, First: 128, Last: 256 }, Ai = (e, t) => {
|
|
474
|
+
if (typeof e == "function" && (t = e, e = 0), e || t) return (r, n, s) => !(e & T.Leading && !r.leading || e & T.Trailing && !r.trailing || e & T.Dangling && (r.leading || r.trailing) || e & T.Block && !ee(r) || e & T.Line && !Ct(r) || e & T.First && n !== 0 || e & T.Last && n !== s.length - 1 || e & T.PrettierIgnore && !kt(r) || t && !t(r));
|
|
475
|
+
};
|
|
476
|
+
function C(e, t, r) {
|
|
477
|
+
if (!j(e?.comments)) return false;
|
|
478
|
+
let n = Ai(t, r);
|
|
479
|
+
return n ? e.comments.some(n) : true;
|
|
480
|
+
}
|
|
481
|
+
function Ze(e, t, r) {
|
|
482
|
+
if (!Array.isArray(e?.comments)) return [];
|
|
483
|
+
let n = Ai(t, r);
|
|
484
|
+
return n ? e.comments.filter(n) : e.comments;
|
|
485
|
+
}
|
|
486
|
+
var oe = (e, { originalText: t }) => qt(t, k(e));
|
|
487
|
+
function mt(e) {
|
|
488
|
+
return M(e) || e.type === "NewExpression" || e.type === "ImportExpression";
|
|
489
|
+
}
|
|
490
|
+
function ke(e) {
|
|
491
|
+
return e && (e.type === "ObjectProperty" || e.type === "Property" && !lt(e));
|
|
492
|
+
}
|
|
493
|
+
var Ae = b(["TSAsExpression", "TSSatisfiesExpression", "AsExpression", "AsConstExpression", "SatisfiesExpression"]), Ie = b(["TSUnionType", "UnionTypeAnnotation"]), Lt = b(["TSIntersectionType", "IntersectionTypeAnnotation"]), qe = b(["TSConditionalType", "ConditionalTypeAnnotation"]), Ti = (e) => e?.type === "TSAsExpression" && e.typeAnnotation.type === "TSTypeReference" && e.typeAnnotation.typeName.type === "Identifier" && e.typeAnnotation.typeName.name === "const", Er = b(["TSTypeAliasDeclaration", "TypeAlias"]);
|
|
494
|
+
var sp = /* @__PURE__ */ new Set(["range", "raw", "comments", "leadingComments", "trailingComments", "innerComments", "extra", "start", "end", "loc", "flags", "errors", "tokens"]), Vt = (e) => {
|
|
495
|
+
for (let t of e.quasis) delete t.value;
|
|
496
|
+
};
|
|
497
|
+
function xi(e, t, r) {
|
|
498
|
+
if (e.type === "Program" && delete t.sourceType, (e.type === "BigIntLiteral" || e.type === "Literal") && e.bigint && (t.bigint = e.bigint.toLowerCase()), e.type === "EmptyStatement" && !bt({ node: e, parent: r }) || e.type === "JSXText" || e.type === "JSXExpressionContainer" && (e.expression.type === "Literal" || e.expression.type === "StringLiteral") && e.expression.value === " ") return null;
|
|
499
|
+
if ((e.type === "Property" || e.type === "ObjectProperty" || e.type === "MethodDefinition" || e.type === "ClassProperty" || e.type === "ClassMethod" || e.type === "PropertyDefinition" || e.type === "TSDeclareMethod" || e.type === "TSPropertySignature" || e.type === "ObjectTypeProperty" || e.type === "ImportAttribute") && e.key && !e.computed) {
|
|
500
|
+
let { key: s } = e;
|
|
501
|
+
X(s) || de(s) ? t.key = String(s.value) : s.type === "Identifier" && (t.key = s.name);
|
|
502
|
+
}
|
|
503
|
+
if (e.type === "JSXElement" && e.openingElement.name.name === "style" && e.openingElement.attributes.some((s) => s.type === "JSXAttribute" && s.name.name === "jsx")) for (let { type: s, expression: i } of t.children) s === "JSXExpressionContainer" && i.type === "TemplateLiteral" && Vt(i);
|
|
504
|
+
e.type === "JSXAttribute" && e.name.name === "css" && e.value.type === "JSXExpressionContainer" && e.value.expression.type === "TemplateLiteral" && Vt(t.value.expression), e.type === "JSXAttribute" && e.value?.type === "Literal" && /["']|"|'/u.test(e.value.value) && (t.value.value = G(0, e.value.value, /["']|"|'/gu, '"'));
|
|
505
|
+
let n = e.expression || e.callee;
|
|
506
|
+
if (e.type === "Decorator" && n.type === "CallExpression" && n.callee.name === "Component" && n.arguments.length === 1) {
|
|
507
|
+
let s = e.expression.arguments[0].properties;
|
|
508
|
+
for (let [i, u] of t.expression.arguments[0].properties.entries()) switch (s[i].key.name) {
|
|
509
|
+
case "styles":
|
|
510
|
+
W(u.value) && Vt(u.value.elements[0]);
|
|
511
|
+
break;
|
|
512
|
+
case "template":
|
|
513
|
+
u.value.type === "TemplateLiteral" && Vt(u.value);
|
|
514
|
+
break;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
e.type === "TaggedTemplateExpression" && (e.tag.type === "MemberExpression" || e.tag.type === "Identifier" && (e.tag.name === "gql" || e.tag.name === "graphql" || e.tag.name === "css" || e.tag.name === "md" || e.tag.name === "markdown" || e.tag.name === "html") || e.tag.type === "CallExpression") && Vt(t.quasi), e.type === "TemplateLiteral" && Vt(t), e.type === "ChainExpression" && e.expression.type === "TSNonNullExpression" && (t.type = "TSNonNullExpression", t.expression.type = "ChainExpression");
|
|
518
|
+
}
|
|
519
|
+
xi.ignoredProperties = sp;
|
|
520
|
+
var gi = xi;
|
|
521
|
+
var Ye = "string", Se = "array", et = "cursor", Ue = "indent", He = "align", tt = "trim", ye = "group", Le = "fill", Be = "if-break", Xe = "indent-if-break", Ve = "line-suffix", Re = "line-suffix-boundary", le = "line", be = "label", Oe = "break-parent", Gr = /* @__PURE__ */ new Set([et, Ue, He, tt, ye, Le, Be, Xe, Ve, Re, le, be, Oe]);
|
|
522
|
+
function ip(e) {
|
|
523
|
+
if (typeof e == "string") return Ye;
|
|
524
|
+
if (Array.isArray(e)) return Se;
|
|
525
|
+
if (!e) return;
|
|
526
|
+
let { type: t } = e;
|
|
527
|
+
if (Gr.has(t)) return t;
|
|
528
|
+
}
|
|
529
|
+
var Je = ip;
|
|
530
|
+
var up = (e) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(e);
|
|
531
|
+
function op(e) {
|
|
532
|
+
let t = e === null ? "null" : typeof e;
|
|
533
|
+
if (t !== "string" && t !== "object") return `Unexpected doc '${t}',
|
|
534
|
+
Expected it to be 'string' or 'object'.`;
|
|
535
|
+
if (Je(e)) throw new Error("doc is valid.");
|
|
536
|
+
let r = Object.prototype.toString.call(e);
|
|
537
|
+
if (r !== "[object Object]") return `Unexpected doc '${r}'.`;
|
|
538
|
+
let n = up([...Gr].map((s) => `'${s}'`));
|
|
539
|
+
return `Unexpected doc.type '${e.type}'.
|
|
540
|
+
Expected it to be ${n}.`;
|
|
541
|
+
}
|
|
542
|
+
var Vn = class extends Error {
|
|
543
|
+
name = "InvalidDocError";
|
|
544
|
+
constructor(t) {
|
|
545
|
+
super(op(t)), this.doc = t;
|
|
546
|
+
}
|
|
547
|
+
}, Tt = Vn;
|
|
548
|
+
var hi = {};
|
|
549
|
+
function ap(e, t, r, n) {
|
|
550
|
+
let s = [e];
|
|
551
|
+
for (; s.length > 0; ) {
|
|
552
|
+
let i = s.pop();
|
|
553
|
+
if (i === hi) {
|
|
554
|
+
r(s.pop());
|
|
555
|
+
continue;
|
|
556
|
+
}
|
|
557
|
+
r && s.push(i, hi);
|
|
558
|
+
let u = Je(i);
|
|
559
|
+
if (!u) throw new Tt(i);
|
|
560
|
+
if (t?.(i) !== false) switch (u) {
|
|
561
|
+
case Se:
|
|
562
|
+
case Le: {
|
|
563
|
+
let o = u === Se ? i : i.parts;
|
|
564
|
+
for (let a = o.length, p = a - 1; p >= 0; --p) s.push(o[p]);
|
|
565
|
+
break;
|
|
566
|
+
}
|
|
567
|
+
case Be:
|
|
568
|
+
s.push(i.flatContents, i.breakContents);
|
|
569
|
+
break;
|
|
570
|
+
case ye:
|
|
571
|
+
if (n && i.expandedStates) for (let o = i.expandedStates.length, a = o - 1; a >= 0; --a) s.push(i.expandedStates[a]);
|
|
572
|
+
else s.push(i.contents);
|
|
573
|
+
break;
|
|
574
|
+
case He:
|
|
575
|
+
case Ue:
|
|
576
|
+
case Xe:
|
|
577
|
+
case be:
|
|
578
|
+
case Ve:
|
|
579
|
+
s.push(i.contents);
|
|
580
|
+
break;
|
|
581
|
+
case Ye:
|
|
582
|
+
case et:
|
|
583
|
+
case tt:
|
|
584
|
+
case Re:
|
|
585
|
+
case le:
|
|
586
|
+
case Oe:
|
|
587
|
+
break;
|
|
588
|
+
default:
|
|
589
|
+
throw new Tt(i);
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
var Wr = ap;
|
|
594
|
+
function Dt(e, t) {
|
|
595
|
+
if (typeof e == "string") return t(e);
|
|
596
|
+
let r = /* @__PURE__ */ new Map();
|
|
597
|
+
return n(e);
|
|
598
|
+
function n(i) {
|
|
599
|
+
if (r.has(i)) return r.get(i);
|
|
600
|
+
let u = s(i);
|
|
601
|
+
return r.set(i, u), u;
|
|
602
|
+
}
|
|
603
|
+
function s(i) {
|
|
604
|
+
switch (Je(i)) {
|
|
605
|
+
case Se:
|
|
606
|
+
return t(i.map(n));
|
|
607
|
+
case Le:
|
|
608
|
+
return t({ ...i, parts: i.parts.map(n) });
|
|
609
|
+
case Be:
|
|
610
|
+
return t({ ...i, breakContents: n(i.breakContents), flatContents: n(i.flatContents) });
|
|
611
|
+
case ye: {
|
|
612
|
+
let { expandedStates: u, contents: o } = i;
|
|
613
|
+
return u ? (u = u.map(n), o = u[0]) : o = n(o), t({ ...i, contents: o, expandedStates: u });
|
|
614
|
+
}
|
|
615
|
+
case He:
|
|
616
|
+
case Ue:
|
|
617
|
+
case Xe:
|
|
618
|
+
case be:
|
|
619
|
+
case Ve:
|
|
620
|
+
return t({ ...i, contents: n(i.contents) });
|
|
621
|
+
case Ye:
|
|
622
|
+
case et:
|
|
623
|
+
case tt:
|
|
624
|
+
case Re:
|
|
625
|
+
case le:
|
|
626
|
+
case Oe:
|
|
627
|
+
return t(i);
|
|
628
|
+
default:
|
|
629
|
+
throw new Tt(i);
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
function Bi(e, t, r) {
|
|
634
|
+
let n = r, s = false;
|
|
635
|
+
function i(u) {
|
|
636
|
+
if (s) return false;
|
|
637
|
+
let o = t(u);
|
|
638
|
+
o !== void 0 && (s = true, n = o);
|
|
639
|
+
}
|
|
640
|
+
return Wr(e, i), n;
|
|
641
|
+
}
|
|
642
|
+
function pp(e) {
|
|
643
|
+
if (e.type === ye && e.break || e.type === le && e.hard || e.type === Oe) return true;
|
|
644
|
+
}
|
|
645
|
+
function se(e) {
|
|
646
|
+
return Bi(e, pp, false);
|
|
647
|
+
}
|
|
648
|
+
function Si(e) {
|
|
649
|
+
if (e.length > 0) {
|
|
650
|
+
let t = _(0, e, -1);
|
|
651
|
+
!t.expandedStates && !t.break && (t.break = "propagated");
|
|
652
|
+
}
|
|
653
|
+
return null;
|
|
654
|
+
}
|
|
655
|
+
function bi(e) {
|
|
656
|
+
let t = /* @__PURE__ */ new Set(), r = [];
|
|
657
|
+
function n(i) {
|
|
658
|
+
if (i.type === Oe && Si(r), i.type === ye) {
|
|
659
|
+
if (r.push(i), t.has(i)) return false;
|
|
660
|
+
t.add(i);
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
function s(i) {
|
|
664
|
+
i.type === ye && r.pop().break && Si(r);
|
|
665
|
+
}
|
|
666
|
+
Wr(e, n, s, true);
|
|
667
|
+
}
|
|
668
|
+
function cp(e) {
|
|
669
|
+
return e.type === le && !e.hard ? e.soft ? "" : " " : e.type === Be ? e.flatContents : e;
|
|
670
|
+
}
|
|
671
|
+
function Ot(e) {
|
|
672
|
+
return Dt(e, cp);
|
|
673
|
+
}
|
|
674
|
+
function lp(e) {
|
|
675
|
+
switch (Je(e)) {
|
|
676
|
+
case Le:
|
|
677
|
+
if (e.parts.every((t) => t === "")) return "";
|
|
678
|
+
break;
|
|
679
|
+
case ye:
|
|
680
|
+
if (!e.contents && !e.id && !e.break && !e.expandedStates) return "";
|
|
681
|
+
if (e.contents.type === ye && e.contents.id === e.id && e.contents.break === e.break && e.contents.expandedStates === e.expandedStates) return e.contents;
|
|
682
|
+
break;
|
|
683
|
+
case He:
|
|
684
|
+
case Ue:
|
|
685
|
+
case Xe:
|
|
686
|
+
case Ve:
|
|
687
|
+
if (!e.contents) return "";
|
|
688
|
+
break;
|
|
689
|
+
case Be:
|
|
690
|
+
if (!e.flatContents && !e.breakContents) return "";
|
|
691
|
+
break;
|
|
692
|
+
case Se: {
|
|
693
|
+
let t = [];
|
|
694
|
+
for (let r of e) {
|
|
695
|
+
if (!r) continue;
|
|
696
|
+
let [n, ...s] = Array.isArray(r) ? r : [r];
|
|
697
|
+
typeof n == "string" && typeof _(0, t, -1) == "string" ? t[t.length - 1] += n : t.push(n), t.push(...s);
|
|
698
|
+
}
|
|
699
|
+
return t.length === 0 ? "" : t.length === 1 ? t[0] : t;
|
|
700
|
+
}
|
|
701
|
+
case Ye:
|
|
702
|
+
case et:
|
|
703
|
+
case tt:
|
|
704
|
+
case Re:
|
|
705
|
+
case le:
|
|
706
|
+
case be:
|
|
707
|
+
case Oe:
|
|
708
|
+
break;
|
|
709
|
+
default:
|
|
710
|
+
throw new Tt(e);
|
|
711
|
+
}
|
|
712
|
+
return e;
|
|
713
|
+
}
|
|
714
|
+
function $t(e) {
|
|
715
|
+
return Dt(e, (t) => lp(t));
|
|
716
|
+
}
|
|
717
|
+
function Ge(e, t = qr) {
|
|
718
|
+
return Dt(e, (r) => typeof r == "string" ? I(t, r.split(`
|
|
719
|
+
`)) : r);
|
|
720
|
+
}
|
|
721
|
+
function mp(e) {
|
|
722
|
+
if (e.type === le) return true;
|
|
723
|
+
}
|
|
724
|
+
function Pi(e) {
|
|
725
|
+
return Bi(e, mp, false);
|
|
726
|
+
}
|
|
727
|
+
function Fr(e, t) {
|
|
728
|
+
return e.type === be ? { ...e, contents: t(e.contents) } : t(e);
|
|
729
|
+
}
|
|
730
|
+
function ki(e) {
|
|
731
|
+
let t = true;
|
|
732
|
+
return Wr(e, (r) => {
|
|
733
|
+
switch (Je(r)) {
|
|
734
|
+
case Ye:
|
|
735
|
+
if (r === "") break;
|
|
736
|
+
case tt:
|
|
737
|
+
case Re:
|
|
738
|
+
case le:
|
|
739
|
+
case Oe:
|
|
740
|
+
return t = false, false;
|
|
741
|
+
}
|
|
742
|
+
}), t;
|
|
743
|
+
}
|
|
744
|
+
var Yr = Pe;
|
|
745
|
+
function m(e) {
|
|
746
|
+
return { type: Ue, contents: e };
|
|
747
|
+
}
|
|
748
|
+
function ge(e, t) {
|
|
749
|
+
return { type: He, contents: t, n: e };
|
|
750
|
+
}
|
|
751
|
+
function Oi(e) {
|
|
752
|
+
return ge(Number.NEGATIVE_INFINITY, e);
|
|
753
|
+
}
|
|
754
|
+
function Ur(e) {
|
|
755
|
+
return ge(-1, e);
|
|
756
|
+
}
|
|
757
|
+
function wi(e, t, r) {
|
|
758
|
+
let n = e;
|
|
759
|
+
if (t > 0) {
|
|
760
|
+
for (let s = 0; s < Math.floor(t / r); ++s) n = m(n);
|
|
761
|
+
n = ge(t % r, n), n = ge(Number.NEGATIVE_INFINITY, n);
|
|
762
|
+
}
|
|
763
|
+
return n;
|
|
764
|
+
}
|
|
765
|
+
var Te = { type: Oe };
|
|
766
|
+
var dr = { type: et };
|
|
767
|
+
function Hr(e) {
|
|
768
|
+
return { type: Le, parts: e };
|
|
769
|
+
}
|
|
770
|
+
function c(e, t = {}) {
|
|
771
|
+
return Yr(t.expandedStates), { type: ye, id: t.id, contents: e, break: !!t.shouldBreak, expandedStates: t.expandedStates };
|
|
772
|
+
}
|
|
773
|
+
function rt(e, t) {
|
|
774
|
+
return c(e[0], { ...t, expandedStates: e });
|
|
775
|
+
}
|
|
776
|
+
function B(e, t = "", r = {}) {
|
|
777
|
+
return { type: Be, breakContents: e, flatContents: t, groupId: r.groupId };
|
|
778
|
+
}
|
|
779
|
+
function ft(e, t) {
|
|
780
|
+
return { type: Xe, contents: e, groupId: t.groupId, negate: t.negate };
|
|
781
|
+
}
|
|
782
|
+
function I(e, t) {
|
|
783
|
+
let r = [];
|
|
784
|
+
for (let n = 0; n < t.length; n++) n !== 0 && r.push(e), r.push(t[n]);
|
|
785
|
+
return r;
|
|
786
|
+
}
|
|
787
|
+
function ot(e, t) {
|
|
788
|
+
return e ? { type: be, label: e, contents: t } : t;
|
|
789
|
+
}
|
|
790
|
+
var A = { type: le }, f = { type: le, soft: true }, $n = { type: le, hard: true }, y = [$n, Te], Dp = { type: le, hard: true, literal: true }, qr = [Dp, Te];
|
|
791
|
+
function Kn(e) {
|
|
792
|
+
return { type: Ve, contents: e };
|
|
793
|
+
}
|
|
794
|
+
var we = { type: Re };
|
|
795
|
+
function Mi(e) {
|
|
796
|
+
switch (e) {
|
|
797
|
+
case "cr":
|
|
798
|
+
return "\r";
|
|
799
|
+
case "crlf":
|
|
800
|
+
return `\r
|
|
801
|
+
`;
|
|
802
|
+
default:
|
|
803
|
+
return `
|
|
804
|
+
`;
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
var fp = { type: 0 }, yp = { type: 1 }, Qn = { value: "", length: 0, queue: [], get root() {
|
|
808
|
+
return Qn;
|
|
809
|
+
} };
|
|
810
|
+
function _i(e, t, r) {
|
|
811
|
+
let n = t.type === 1 ? e.queue.slice(0, -1) : [...e.queue, t], s = "", i = 0, u = 0, o = 0;
|
|
812
|
+
for (let F of n) switch (F.type) {
|
|
813
|
+
case 0:
|
|
814
|
+
D(), r.useTabs ? a(1) : p(r.tabWidth);
|
|
815
|
+
break;
|
|
816
|
+
case 3: {
|
|
817
|
+
let { string: P } = F;
|
|
818
|
+
D(), s += P, i += P.length;
|
|
819
|
+
break;
|
|
820
|
+
}
|
|
821
|
+
case 2: {
|
|
822
|
+
let { width: P } = F;
|
|
823
|
+
u += 1, o += P;
|
|
824
|
+
break;
|
|
825
|
+
}
|
|
826
|
+
default:
|
|
827
|
+
throw new Error(`Unexpected indent comment '${F.type}'.`);
|
|
828
|
+
}
|
|
829
|
+
return E(), { ...e, value: s, length: i, queue: n };
|
|
830
|
+
function a(F) {
|
|
831
|
+
s += " ".repeat(F), i += r.tabWidth * F;
|
|
832
|
+
}
|
|
833
|
+
function p(F) {
|
|
834
|
+
s += " ".repeat(F), i += F;
|
|
835
|
+
}
|
|
836
|
+
function D() {
|
|
837
|
+
r.useTabs ? l() : E();
|
|
838
|
+
}
|
|
839
|
+
function l() {
|
|
840
|
+
u > 0 && a(u), d();
|
|
841
|
+
}
|
|
842
|
+
function E() {
|
|
843
|
+
o > 0 && p(o), d();
|
|
844
|
+
}
|
|
845
|
+
function d() {
|
|
846
|
+
u = 0, o = 0;
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
function Ni(e, t, r) {
|
|
850
|
+
if (!t) return e;
|
|
851
|
+
if (t.type === "root") return { ...e, root: e };
|
|
852
|
+
if (t === Number.NEGATIVE_INFINITY) return e.root;
|
|
853
|
+
let n;
|
|
854
|
+
return typeof t == "number" ? t < 0 ? n = yp : n = { type: 2, width: t } : n = { type: 3, string: t }, _i(e, n, r);
|
|
855
|
+
}
|
|
856
|
+
function vi(e, t) {
|
|
857
|
+
return _i(e, fp, t);
|
|
858
|
+
}
|
|
859
|
+
function Ep(e) {
|
|
860
|
+
let t = 0;
|
|
861
|
+
for (let r = e.length - 1; r >= 0; r--) {
|
|
862
|
+
let n = e[r];
|
|
863
|
+
if (n === " " || n === " ") t++;
|
|
864
|
+
else break;
|
|
865
|
+
}
|
|
866
|
+
return t;
|
|
867
|
+
}
|
|
868
|
+
function zn(e) {
|
|
869
|
+
let t = Ep(e);
|
|
870
|
+
return { text: t === 0 ? e : e.slice(0, e.length - t), count: t };
|
|
871
|
+
}
|
|
872
|
+
var Me = Symbol("MODE_BREAK"), at = Symbol("MODE_FLAT"), Zn = Symbol("DOC_FILL_PRINTED_LENGTH");
|
|
873
|
+
function Xr(e, t, r, n, s, i) {
|
|
874
|
+
if (r === Number.POSITIVE_INFINITY) return true;
|
|
875
|
+
let u = t.length, o = false, a = [e], p = "";
|
|
876
|
+
for (; r >= 0; ) {
|
|
877
|
+
if (a.length === 0) {
|
|
878
|
+
if (u === 0) return true;
|
|
879
|
+
a.push(t[--u]);
|
|
880
|
+
continue;
|
|
881
|
+
}
|
|
882
|
+
let { mode: D, doc: l } = a.pop(), E = Je(l);
|
|
883
|
+
switch (E) {
|
|
884
|
+
case Ye:
|
|
885
|
+
l && (o && (p += " ", r -= 1, o = false), p += l, r -= it(l));
|
|
886
|
+
break;
|
|
887
|
+
case Se:
|
|
888
|
+
case Le: {
|
|
889
|
+
let d = E === Se ? l : l.parts, F = l[Zn] ?? 0;
|
|
890
|
+
for (let P = d.length - 1; P >= F; P--) a.push({ mode: D, doc: d[P] });
|
|
891
|
+
break;
|
|
892
|
+
}
|
|
893
|
+
case Ue:
|
|
894
|
+
case He:
|
|
895
|
+
case Xe:
|
|
896
|
+
case be:
|
|
897
|
+
a.push({ mode: D, doc: l.contents });
|
|
898
|
+
break;
|
|
899
|
+
case tt: {
|
|
900
|
+
let { text: d, count: F } = zn(p);
|
|
901
|
+
p = d, r += F;
|
|
902
|
+
break;
|
|
903
|
+
}
|
|
904
|
+
case ye: {
|
|
905
|
+
if (i && l.break) return false;
|
|
906
|
+
let d = l.break ? Me : D, F = l.expandedStates && d === Me ? _(0, l.expandedStates, -1) : l.contents;
|
|
907
|
+
a.push({ mode: d, doc: F });
|
|
908
|
+
break;
|
|
909
|
+
}
|
|
910
|
+
case Be: {
|
|
911
|
+
let F = (l.groupId ? s[l.groupId] || at : D) === Me ? l.breakContents : l.flatContents;
|
|
912
|
+
F && a.push({ mode: D, doc: F });
|
|
913
|
+
break;
|
|
914
|
+
}
|
|
915
|
+
case le:
|
|
916
|
+
if (D === Me || l.hard) return true;
|
|
917
|
+
l.soft || (o = true);
|
|
918
|
+
break;
|
|
919
|
+
case Ve:
|
|
920
|
+
n = true;
|
|
921
|
+
break;
|
|
922
|
+
case Re:
|
|
923
|
+
if (n) return false;
|
|
924
|
+
break;
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
return false;
|
|
928
|
+
}
|
|
929
|
+
function es(e, t) {
|
|
930
|
+
let r = /* @__PURE__ */ Object.create(null), n = t.printWidth, s = Mi(t.endOfLine), i = 0, u = [{ indent: Qn, mode: Me, doc: e }], o = "", a = false, p = [], D = [], l = [], E = [], d = 0;
|
|
931
|
+
for (bi(e); u.length > 0; ) {
|
|
932
|
+
let { indent: g, mode: x, doc: h } = u.pop();
|
|
933
|
+
switch (Je(h)) {
|
|
934
|
+
case Ye: {
|
|
935
|
+
let N = s !== `
|
|
936
|
+
` ? G(0, h, `
|
|
937
|
+
`, s) : h;
|
|
938
|
+
N && (o += N, u.length > 0 && (i += it(N)));
|
|
939
|
+
break;
|
|
940
|
+
}
|
|
941
|
+
case Se:
|
|
942
|
+
for (let N = h.length - 1; N >= 0; N--) u.push({ indent: g, mode: x, doc: h[N] });
|
|
943
|
+
break;
|
|
944
|
+
case et:
|
|
945
|
+
if (D.length >= 2) throw new Error("There are too many 'cursor' in doc.");
|
|
946
|
+
D.push(d + o.length);
|
|
947
|
+
break;
|
|
948
|
+
case Ue:
|
|
949
|
+
u.push({ indent: vi(g, t), mode: x, doc: h.contents });
|
|
950
|
+
break;
|
|
951
|
+
case He:
|
|
952
|
+
u.push({ indent: Ni(g, h.n, t), mode: x, doc: h.contents });
|
|
953
|
+
break;
|
|
954
|
+
case tt:
|
|
955
|
+
O();
|
|
956
|
+
break;
|
|
957
|
+
case ye:
|
|
958
|
+
switch (x) {
|
|
959
|
+
case at:
|
|
960
|
+
if (!a) {
|
|
961
|
+
u.push({ indent: g, mode: h.break ? Me : at, doc: h.contents });
|
|
962
|
+
break;
|
|
963
|
+
}
|
|
964
|
+
case Me: {
|
|
965
|
+
a = false;
|
|
966
|
+
let N = { indent: g, mode: at, doc: h.contents }, Y = n - i, De = p.length > 0;
|
|
967
|
+
if (!h.break && Xr(N, u, Y, De, r)) u.push(N);
|
|
968
|
+
else if (h.expandedStates) {
|
|
969
|
+
let Fe = _(0, h.expandedStates, -1);
|
|
970
|
+
if (h.break) {
|
|
971
|
+
u.push({ indent: g, mode: Me, doc: Fe });
|
|
972
|
+
break;
|
|
973
|
+
} else for (let J = 1; J < h.expandedStates.length + 1; J++) if (J >= h.expandedStates.length) {
|
|
974
|
+
u.push({ indent: g, mode: Me, doc: Fe });
|
|
975
|
+
break;
|
|
976
|
+
} else {
|
|
977
|
+
let Z = h.expandedStates[J], H = { indent: g, mode: at, doc: Z };
|
|
978
|
+
if (Xr(H, u, Y, De, r)) {
|
|
979
|
+
u.push(H);
|
|
980
|
+
break;
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
} else u.push({ indent: g, mode: Me, doc: h.contents });
|
|
984
|
+
break;
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
h.id && (r[h.id] = _(0, u, -1).mode);
|
|
988
|
+
break;
|
|
989
|
+
case Le: {
|
|
990
|
+
let N = n - i, Y = h[Zn] ?? 0, { parts: De } = h, Fe = De.length - Y;
|
|
991
|
+
if (Fe === 0) break;
|
|
992
|
+
let J = De[Y + 0], Z = De[Y + 1], H = { indent: g, mode: at, doc: J }, nt = { indent: g, mode: Me, doc: J }, w = Xr(H, [], N, p.length > 0, r, true);
|
|
993
|
+
if (Fe === 1) {
|
|
994
|
+
w ? u.push(H) : u.push(nt);
|
|
995
|
+
break;
|
|
996
|
+
}
|
|
997
|
+
let ne = { indent: g, mode: at, doc: Z }, ae = { indent: g, mode: Me, doc: Z };
|
|
998
|
+
if (Fe === 2) {
|
|
999
|
+
w ? u.push(ne, H) : u.push(ae, nt);
|
|
1000
|
+
break;
|
|
1001
|
+
}
|
|
1002
|
+
let st = De[Y + 2], ht = { indent: g, mode: x, doc: { ...h, [Zn]: Y + 2 } }, Sr = Xr({ indent: g, mode: at, doc: [J, Z, st] }, [], N, p.length > 0, r, true);
|
|
1003
|
+
u.push(ht), Sr ? u.push(ne, H) : w ? u.push(ae, H) : u.push(ae, nt);
|
|
1004
|
+
break;
|
|
1005
|
+
}
|
|
1006
|
+
case Be:
|
|
1007
|
+
case Xe: {
|
|
1008
|
+
let N = h.groupId ? r[h.groupId] : x;
|
|
1009
|
+
if (N === Me) {
|
|
1010
|
+
let Y = h.type === Be ? h.breakContents : h.negate ? h.contents : m(h.contents);
|
|
1011
|
+
Y && u.push({ indent: g, mode: x, doc: Y });
|
|
1012
|
+
}
|
|
1013
|
+
if (N === at) {
|
|
1014
|
+
let Y = h.type === Be ? h.flatContents : h.negate ? m(h.contents) : h.contents;
|
|
1015
|
+
Y && u.push({ indent: g, mode: x, doc: Y });
|
|
1016
|
+
}
|
|
1017
|
+
break;
|
|
1018
|
+
}
|
|
1019
|
+
case Ve:
|
|
1020
|
+
p.push({ indent: g, mode: x, doc: h.contents });
|
|
1021
|
+
break;
|
|
1022
|
+
case Re:
|
|
1023
|
+
p.length > 0 && u.push({ indent: g, mode: x, doc: $n });
|
|
1024
|
+
break;
|
|
1025
|
+
case le:
|
|
1026
|
+
switch (x) {
|
|
1027
|
+
case at:
|
|
1028
|
+
if (h.hard) a = true;
|
|
1029
|
+
else {
|
|
1030
|
+
h.soft || (o += " ", i += 1);
|
|
1031
|
+
break;
|
|
1032
|
+
}
|
|
1033
|
+
case Me:
|
|
1034
|
+
if (p.length > 0) {
|
|
1035
|
+
u.push({ indent: g, mode: x, doc: h }, ...p.reverse()), p.length = 0;
|
|
1036
|
+
break;
|
|
1037
|
+
}
|
|
1038
|
+
h.literal ? (o += s, i = 0, g.root && (g.root.value && (o += g.root.value), i = g.root.length)) : (O(), o += s + g.value, i = g.length);
|
|
1039
|
+
break;
|
|
1040
|
+
}
|
|
1041
|
+
break;
|
|
1042
|
+
case be:
|
|
1043
|
+
u.push({ indent: g, mode: x, doc: h.contents });
|
|
1044
|
+
break;
|
|
1045
|
+
case Oe:
|
|
1046
|
+
break;
|
|
1047
|
+
default:
|
|
1048
|
+
throw new Tt(h);
|
|
1049
|
+
}
|
|
1050
|
+
u.length === 0 && p.length > 0 && (u.push(...p.reverse()), p.length = 0);
|
|
1051
|
+
}
|
|
1052
|
+
let F = l.join("") + o, P = [...E, ...D];
|
|
1053
|
+
if (P.length !== 2) return { formatted: F };
|
|
1054
|
+
let S = P[0];
|
|
1055
|
+
return { formatted: F, cursorNodeStart: S, cursorNodeText: F.slice(S, _(0, P, -1)) };
|
|
1056
|
+
function O() {
|
|
1057
|
+
let { text: g, count: x } = zn(o);
|
|
1058
|
+
g && (l.push(g), d += g.length), o = "", i -= x, D.length > 0 && (E.push(...D.map((h) => Math.min(h, d))), D.length = 0);
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
function Fp(e) {
|
|
1062
|
+
if (!ee(e)) return false;
|
|
1063
|
+
let t = `*${e.value}*`.split(`
|
|
1064
|
+
`);
|
|
1065
|
+
return t.length > 1 && t.every((r) => r.trimStart()[0] === "*");
|
|
1066
|
+
}
|
|
1067
|
+
var ts = /* @__PURE__ */ new WeakMap();
|
|
1068
|
+
function dp(e) {
|
|
1069
|
+
return ts.has(e) || ts.set(e, Fp(e)), ts.get(e);
|
|
1070
|
+
}
|
|
1071
|
+
var ji = dp;
|
|
1072
|
+
function rs(e, t) {
|
|
1073
|
+
let r = e.node;
|
|
1074
|
+
if (Ct(r)) return t.originalText.slice(L(r), k(r)).trimEnd();
|
|
1075
|
+
if (ji(r)) return Cp(r);
|
|
1076
|
+
if (ee(r)) return ["/*", Ge(r.value), "*/"];
|
|
1077
|
+
throw new Error("Not a comment: " + JSON.stringify(r));
|
|
1078
|
+
}
|
|
1079
|
+
function Cp(e) {
|
|
1080
|
+
let t = e.value.split(`
|
|
1081
|
+
`);
|
|
1082
|
+
return ["/*", I(y, t.map((r, n) => n === 0 ? r.trimEnd() : " " + (n < t.length - 1 ? r.trim() : r.trimStart()))), "*/"];
|
|
1083
|
+
}
|
|
1084
|
+
function Ap(e) {
|
|
1085
|
+
let t = e.type || e.kind || "(unknown type)", r = String(e.name || e.id && (typeof e.id == "object" ? e.id.name : e.id) || e.key && (typeof e.key == "object" ? e.key.name : e.key) || e.value && (typeof e.value == "object" ? "" : String(e.value)) || e.operator || "");
|
|
1086
|
+
return r.length > 20 && (r = r.slice(0, 19) + "…"), t + (r ? " " + r : "");
|
|
1087
|
+
}
|
|
1088
|
+
function ns(e, t) {
|
|
1089
|
+
(e.comments ?? (e.comments = [])).push(t), t.printed = false, t.nodeDescription = Ap(e);
|
|
1090
|
+
}
|
|
1091
|
+
function te(e, t) {
|
|
1092
|
+
t.leading = true, t.trailing = false, ns(e, t);
|
|
1093
|
+
}
|
|
1094
|
+
function _e(e, t, r) {
|
|
1095
|
+
t.leading = false, t.trailing = false, r && (t.marker = r), ns(e, t);
|
|
1096
|
+
}
|
|
1097
|
+
function V(e, t) {
|
|
1098
|
+
t.leading = false, t.trailing = true, ns(e, t);
|
|
1099
|
+
}
|
|
1100
|
+
function Tp(e, t) {
|
|
1101
|
+
let r = null, n = t;
|
|
1102
|
+
for (; n !== r; ) r = n, n = Qe(e, n), n = Gt(e, n), n = Wt(e, n), n = ze(e, n);
|
|
1103
|
+
return n;
|
|
1104
|
+
}
|
|
1105
|
+
var pt = Tp;
|
|
1106
|
+
function xp(e, t) {
|
|
1107
|
+
let r = pt(e, t);
|
|
1108
|
+
return r === false ? "" : e.charAt(r);
|
|
1109
|
+
}
|
|
1110
|
+
var Ne = xp;
|
|
1111
|
+
function gp(e, t, r) {
|
|
1112
|
+
for (let n = t; n < r; ++n) if (e.charAt(n) === `
|
|
1113
|
+
`) return true;
|
|
1114
|
+
return false;
|
|
1115
|
+
}
|
|
1116
|
+
var re = gp;
|
|
1117
|
+
var ss = /* @__PURE__ */ new WeakMap();
|
|
1118
|
+
function hp(e) {
|
|
1119
|
+
return ss.has(e) || ss.set(e, ee(e) && e.value[0] === "*" && /@(?:type|satisfies)\b/u.test(e.value)), ss.get(e);
|
|
1120
|
+
}
|
|
1121
|
+
var Vr = hp;
|
|
1122
|
+
var us = (e, t) => Ct(e) || !re(t, L(e), k(e));
|
|
1123
|
+
function Sp(e) {
|
|
1124
|
+
return [Xi, Ji, Yi, Np, kp, os, as, Ri, Gi, Gp, jp, Rp, cs, Hi, Wp, Wi, Ui, ps, Ip, $p, Vi, ls].some((t) => t(e));
|
|
1125
|
+
}
|
|
1126
|
+
function Bp(e) {
|
|
1127
|
+
return [Pp, Yi, Ji, Hi, os, as, Ri, Gi, Ui, vp, Jp, cs, Up, ps, Xp, Vp, Kp, Vi, zp, Qp, ls].some((t) => t(e));
|
|
1128
|
+
}
|
|
1129
|
+
function bp(e) {
|
|
1130
|
+
return [Xi, os, as, _p, Wi, cs, Mp, wp, ps, Hp, ls].some((t) => t(e));
|
|
1131
|
+
}
|
|
1132
|
+
function wt(e, t) {
|
|
1133
|
+
let r = (e.body || e.properties).find(({ type: n }) => n !== "EmptyStatement");
|
|
1134
|
+
r ? te(r, t) : _e(e, t);
|
|
1135
|
+
}
|
|
1136
|
+
function is(e, t) {
|
|
1137
|
+
e.type === "BlockStatement" ? wt(e, t) : te(e, t);
|
|
1138
|
+
}
|
|
1139
|
+
function Pp({ comment: e, followingNode: t }) {
|
|
1140
|
+
return t && Vr(e) ? (te(t, e), true) : false;
|
|
1141
|
+
}
|
|
1142
|
+
function os({ comment: e, precedingNode: t, enclosingNode: r, followingNode: n, text: s }) {
|
|
1143
|
+
if (r?.type !== "IfStatement" || !n) return false;
|
|
1144
|
+
if (Ne(s, k(e)) === ")") return V(t, e), true;
|
|
1145
|
+
if (n.type === "BlockStatement" && n === r.consequent && L(e) >= k(t) && k(e) <= L(n)) return te(n, e), true;
|
|
1146
|
+
if (t === r.consequent && n === r.alternate) {
|
|
1147
|
+
let u = pt(s, k(r.consequent));
|
|
1148
|
+
if (n.type === "BlockStatement" && L(e) >= u && k(e) <= L(n)) return te(n, e), true;
|
|
1149
|
+
if (L(e) < u || r.alternate.type === "BlockStatement") return t.type === "BlockStatement" ? (V(t, e), true) : us(e, s) && !re(s, L(t), L(e)) ? (V(t, e), true) : (_e(r, e), true);
|
|
1150
|
+
}
|
|
1151
|
+
return n.type === "BlockStatement" ? (wt(n, e), true) : n.type === "IfStatement" ? (is(n.consequent, e), true) : r.consequent === n ? (te(n, e), true) : false;
|
|
1152
|
+
}
|
|
1153
|
+
function as({ comment: e, precedingNode: t, enclosingNode: r, followingNode: n, text: s }) {
|
|
1154
|
+
return r?.type !== "WhileStatement" || !n ? false : Ne(s, k(e)) === ")" ? (V(t, e), true) : n.type === "BlockStatement" ? (wt(n, e), true) : r.body === n ? (te(n, e), true) : false;
|
|
1155
|
+
}
|
|
1156
|
+
function Ri({ comment: e, precedingNode: t, enclosingNode: r, followingNode: n }) {
|
|
1157
|
+
return r?.type !== "TryStatement" && r?.type !== "CatchClause" || !n ? false : r.type === "CatchClause" && t ? (V(t, e), true) : n.type === "BlockStatement" ? (wt(n, e), true) : n.type === "TryStatement" ? (is(n.finalizer, e), true) : n.type === "CatchClause" ? (is(n.body, e), true) : false;
|
|
1158
|
+
}
|
|
1159
|
+
function kp({ comment: e, enclosingNode: t, followingNode: r }) {
|
|
1160
|
+
return R(t) && r?.type === "Identifier" ? (te(t, e), true) : false;
|
|
1161
|
+
}
|
|
1162
|
+
function Ip({ comment: e, enclosingNode: t, followingNode: r, options: n }) {
|
|
1163
|
+
return !n.experimentalTernaries || !(t?.type === "ConditionalExpression" || qe(t)) ? false : r?.type === "ConditionalExpression" || qe(r) ? (_e(t, e), true) : false;
|
|
1164
|
+
}
|
|
1165
|
+
function Ji({ comment: e, precedingNode: t, enclosingNode: r, followingNode: n, text: s, options: i }) {
|
|
1166
|
+
let u = t && !re(s, k(t), L(e));
|
|
1167
|
+
return (!t || !u) && (r?.type === "ConditionalExpression" || qe(r)) && n ? i.experimentalTernaries && r.alternate === n && !(ee(e) && !re(i.originalText, L(e), k(e))) ? (_e(r, e), true) : (te(n, e), true) : false;
|
|
1168
|
+
}
|
|
1169
|
+
var Lp = b(["ClassDeclaration", "ClassExpression", "DeclareClass", "DeclareInterface", "InterfaceDeclaration", "TSInterfaceDeclaration"]);
|
|
1170
|
+
function Gi({ comment: e, precedingNode: t, enclosingNode: r, followingNode: n }) {
|
|
1171
|
+
if (Lp(r)) {
|
|
1172
|
+
if (j(r.decorators) && n?.type !== "Decorator") return V(_(0, r.decorators, -1), e), true;
|
|
1173
|
+
if (r.body && n === r.body) return wt(r.body, e), true;
|
|
1174
|
+
if (n) {
|
|
1175
|
+
if (r.superClass && n === r.superClass && t && (t === r.id || t === r.typeParameters)) return V(t, e), true;
|
|
1176
|
+
for (let s of ["implements", "extends", "mixins"]) if (r[s] && n === r[s][0]) return t && (t === r.id || t === r.typeParameters || t === r.superClass) ? V(t, e) : _e(r, e, s), true;
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
return false;
|
|
1180
|
+
}
|
|
1181
|
+
var Op = b(["ClassMethod", "ClassProperty", "PropertyDefinition", "TSAbstractPropertyDefinition", "TSAbstractMethodDefinition", "TSDeclareMethod", "MethodDefinition", "ClassAccessorProperty", "AccessorProperty", "TSAbstractAccessorProperty", "TSParameterProperty"]);
|
|
1182
|
+
function Wi({ comment: e, precedingNode: t, enclosingNode: r, text: n }) {
|
|
1183
|
+
return r && t && Ne(n, k(e)) === "(" && (r.type === "Property" || r.type === "TSDeclareMethod" || r.type === "TSAbstractMethodDefinition") && t.type === "Identifier" && r.key === t && Ne(n, k(t)) !== ":" ? (V(t, e), true) : t?.type === "Decorator" && Op(r) && (Ct(e) || e.placement === "ownLine") ? (V(t, e), true) : false;
|
|
1184
|
+
}
|
|
1185
|
+
var qi = b(["FunctionDeclaration", "FunctionExpression", "ClassMethod", "MethodDefinition", "ObjectMethod"]);
|
|
1186
|
+
function wp({ comment: e, precedingNode: t, enclosingNode: r, text: n }) {
|
|
1187
|
+
return Ne(n, k(e)) !== "(" ? false : t && qi(r) ? (V(t, e), true) : false;
|
|
1188
|
+
}
|
|
1189
|
+
function Mp({ comment: e, enclosingNode: t, text: r }) {
|
|
1190
|
+
if (t?.type !== "ArrowFunctionExpression") return false;
|
|
1191
|
+
let n = pt(r, k(e));
|
|
1192
|
+
return n !== false && r.slice(n, n + 2) === "=>" ? (_e(t, e), true) : false;
|
|
1193
|
+
}
|
|
1194
|
+
function _p({ comment: e, enclosingNode: t, text: r }) {
|
|
1195
|
+
return Ne(r, k(e)) !== ")" ? false : t && ($i(t) && K(t).length === 0 || mt(t) && ce(t).length === 0) ? (_e(t, e), true) : (t?.type === "MethodDefinition" || t?.type === "TSAbstractMethodDefinition") && K(t.value).length === 0 ? (_e(t.value, e), true) : false;
|
|
1196
|
+
}
|
|
1197
|
+
function Np({ comment: e, precedingNode: t, enclosingNode: r, followingNode: n, text: s }) {
|
|
1198
|
+
return t?.type === "ComponentTypeParameter" && (r?.type === "DeclareComponent" || r?.type === "ComponentTypeAnnotation") && n?.type !== "ComponentTypeParameter" ? (V(t, e), true) : (t?.type === "ComponentParameter" || t?.type === "RestElement") && r?.type === "ComponentDeclaration" && Ne(s, k(e)) === ")" ? (V(t, e), true) : false;
|
|
1199
|
+
}
|
|
1200
|
+
function Yi({ comment: e, precedingNode: t, enclosingNode: r, followingNode: n, text: s }) {
|
|
1201
|
+
return t?.type === "FunctionTypeParam" && r?.type === "FunctionTypeAnnotation" && n?.type !== "FunctionTypeParam" ? (V(t, e), true) : (t?.type === "Identifier" || t?.type === "AssignmentPattern" || t?.type === "ObjectPattern" || t?.type === "ArrayPattern" || t?.type === "RestElement" || t?.type === "TSParameterProperty") && $i(r) && Ne(s, k(e)) === ")" ? (V(t, e), true) : !ee(e) && n?.type === "BlockStatement" && qi(r) && (r.type === "MethodDefinition" ? r.value.body : r.body) === n && pt(s, k(e)) === L(n) ? (wt(n, e), true) : false;
|
|
1202
|
+
}
|
|
1203
|
+
function Ui({ comment: e, enclosingNode: t }) {
|
|
1204
|
+
return t?.type === "LabeledStatement" ? (te(t, e), true) : false;
|
|
1205
|
+
}
|
|
1206
|
+
function ps({ comment: e, enclosingNode: t }) {
|
|
1207
|
+
return (t?.type === "ContinueStatement" || t?.type === "BreakStatement") && !t.label ? (V(t, e), true) : false;
|
|
1208
|
+
}
|
|
1209
|
+
function vp({ comment: e, precedingNode: t, enclosingNode: r }) {
|
|
1210
|
+
return M(r) && t && r.callee === t && r.arguments.length > 0 ? (te(r.arguments[0], e), true) : false;
|
|
1211
|
+
}
|
|
1212
|
+
function jp({ comment: e, precedingNode: t, enclosingNode: r, followingNode: n }) {
|
|
1213
|
+
return Ie(r) ? (kt(e) && (n.prettierIgnore = true, e.unignore = true), t ? (V(t, e), true) : false) : (Ie(n) && kt(e) && (n.types[0].prettierIgnore = true, e.unignore = true), false);
|
|
1214
|
+
}
|
|
1215
|
+
function Rp({ comment: e, precedingNode: t, enclosingNode: r, followingNode: n }) {
|
|
1216
|
+
return r && r.type === "MatchOrPattern" ? (kt(e) && (n.prettierIgnore = true, e.unignore = true), t ? (V(t, e), true) : false) : (n && n.type === "MatchOrPattern" && kt(e) && (n.types[0].prettierIgnore = true, e.unignore = true), false);
|
|
1217
|
+
}
|
|
1218
|
+
function Jp({ comment: e, enclosingNode: t }) {
|
|
1219
|
+
return ke(t) ? (te(t, e), true) : false;
|
|
1220
|
+
}
|
|
1221
|
+
function cs({ comment: e, enclosingNode: t, ast: r, isLastComment: n }) {
|
|
1222
|
+
return r?.body?.length === 0 ? (n ? _e(r, e) : te(r, e), true) : t?.type === "Program" && t.body.length === 0 && !j(t.directives) ? (n ? _e(t, e) : te(t, e), true) : false;
|
|
1223
|
+
}
|
|
1224
|
+
function Gp({ comment: e, enclosingNode: t, followingNode: r }) {
|
|
1225
|
+
return (t?.type === "ForInStatement" || t?.type === "ForOfStatement") && r !== t.body ? (te(t, e), true) : false;
|
|
1226
|
+
}
|
|
1227
|
+
function Hi({ comment: e, precedingNode: t, enclosingNode: r, text: n }) {
|
|
1228
|
+
if (r?.type === "ImportSpecifier" || r?.type === "ExportSpecifier") return te(r, e), true;
|
|
1229
|
+
let s = t?.type === "ImportSpecifier" && r?.type === "ImportDeclaration", i = t?.type === "ExportSpecifier" && r?.type === "ExportNamedDeclaration";
|
|
1230
|
+
return (s || i) && Q(n, k(e)) ? (V(t, e), true) : false;
|
|
1231
|
+
}
|
|
1232
|
+
function Wp({ comment: e, enclosingNode: t }) {
|
|
1233
|
+
return t?.type === "AssignmentPattern" ? (te(t, e), true) : false;
|
|
1234
|
+
}
|
|
1235
|
+
var qp = b(["VariableDeclarator", "AssignmentExpression", "TypeAlias", "TSTypeAliasDeclaration"]), Yp = b(["ObjectExpression", "ArrayExpression", "TemplateLiteral", "TaggedTemplateExpression", "ObjectTypeAnnotation", "TSTypeLiteral"]);
|
|
1236
|
+
function Up({ comment: e, enclosingNode: t, followingNode: r }) {
|
|
1237
|
+
return qp(t) && r && (Yp(r) || ee(e)) ? (te(r, e), true) : false;
|
|
1238
|
+
}
|
|
1239
|
+
function Hp({ comment: e, enclosingNode: t, precedingNode: r, followingNode: n, text: s }) {
|
|
1240
|
+
return !n && (t?.type === "TSMethodSignature" || t?.type === "TSDeclareFunction" || t?.type === "TSAbstractMethodDefinition") && (!r || r !== t.returnType) && Ne(s, k(e)) === ";" ? (V(t, e), true) : false;
|
|
1241
|
+
}
|
|
1242
|
+
function Xi({ comment: e, enclosingNode: t, followingNode: r }) {
|
|
1243
|
+
if (kt(e) && t?.type === "TSMappedType" && r === t.key) return t.prettierIgnore = true, e.unignore = true, true;
|
|
1244
|
+
}
|
|
1245
|
+
function Vi({ comment: e, precedingNode: t, enclosingNode: r }) {
|
|
1246
|
+
if (r?.type === "TSMappedType" && !t) return _e(r, e), true;
|
|
1247
|
+
}
|
|
1248
|
+
function Xp({ comment: e, enclosingNode: t, followingNode: r }) {
|
|
1249
|
+
return !t || t.type !== "SwitchCase" || t.test || !r || r !== t.consequent[0] ? false : (r.type === "BlockStatement" && Ct(e) ? wt(r, e) : _e(t, e), true);
|
|
1250
|
+
}
|
|
1251
|
+
function Vp({ comment: e, precedingNode: t, enclosingNode: r, followingNode: n }) {
|
|
1252
|
+
return Ie(t) && ((r.type === "TSArrayType" || r.type === "ArrayTypeAnnotation") && !n || Lt(r)) ? (V(_(0, t.types, -1), e), true) : false;
|
|
1253
|
+
}
|
|
1254
|
+
function $p({ comment: e, enclosingNode: t, precedingNode: r, followingNode: n }) {
|
|
1255
|
+
if ((t?.type === "ObjectPattern" || t?.type === "ArrayPattern") && n?.type === "TSTypeAnnotation") return r ? V(r, e) : _e(t, e), true;
|
|
1256
|
+
}
|
|
1257
|
+
function Kp({ comment: e, precedingNode: t, enclosingNode: r, followingNode: n, text: s }) {
|
|
1258
|
+
return !n && r?.type === "UnaryExpression" && (t?.type === "LogicalExpression" || t?.type === "BinaryExpression") && re(s, L(r.argument), L(t.right)) && us(e, s) && !re(s, L(t.right), L(e)) ? (V(t.right, e), true) : false;
|
|
1259
|
+
}
|
|
1260
|
+
function Qp({ enclosingNode: e, followingNode: t, comment: r }) {
|
|
1261
|
+
if (e && (e.type === "TSPropertySignature" || e.type === "ObjectTypeProperty") && (Ie(t) || Lt(t))) return te(t, r), true;
|
|
1262
|
+
}
|
|
1263
|
+
function ls({ enclosingNode: e, precedingNode: t, followingNode: r, comment: n, text: s }) {
|
|
1264
|
+
if (Ae(e) && t === e.expression && !us(n, s)) return r ? te(r, n) : V(e, n), true;
|
|
1265
|
+
}
|
|
1266
|
+
function zp({ comment: e, enclosingNode: t, followingNode: r, precedingNode: n }) {
|
|
1267
|
+
return t && r && n && t.type === "ArrowFunctionExpression" && t.returnType === n && (n.type === "TSTypeAnnotation" || n.type === "TypeAnnotation") ? (te(r, e), true) : false;
|
|
1268
|
+
}
|
|
1269
|
+
var $i = b(["ArrowFunctionExpression", "FunctionExpression", "FunctionDeclaration", "ObjectMethod", "ClassMethod", "TSDeclareFunction", "TSCallSignatureDeclaration", "TSConstructSignatureDeclaration", "TSMethodSignature", "TSConstructorType", "TSFunctionType", "TSDeclareMethod"]), Zp = { endOfLine: Bp, ownLine: Sp, remaining: bp }, ms = Zp;
|
|
1270
|
+
var ec = b(["File", "TemplateElement", "TSEmptyBodyFunctionExpression", "ChainExpression"]), tc = (e, [t]) => t?.type === "ComponentParameter" && t.shorthand && t.name === e && t.local !== t.name || t?.type === "MatchObjectPatternProperty" && t.shorthand && t.key === e && t.value !== t.key || t?.type === "ObjectProperty" && t.shorthand && t.key === e && t.value !== t.key || t?.type === "Property" && t.shorthand && t.key === e && !lt(t) && t.value !== t.key, rc = (e, [t]) => !!(e.type === "FunctionExpression" && t.type === "MethodDefinition" && t.value === e && K(e).length === 0 && !e.returnType && !j(e.typeParameters) && e.body), Ki = (e, [t]) => t?.typeAnnotation === e && Ti(t), nc = (e, [t, ...r]) => Ki(e, [t]) || t?.typeName === e && Ki(t, r);
|
|
1271
|
+
function Qi(e, t) {
|
|
1272
|
+
return ec(e) || tc(e, t) || rc(e, t) ? false : e.type === "EmptyStatement" ? bt({ node: e, parent: t[0] }) : !(nc(e, t) || e.type === "TSTypeAnnotation" && t[0].type === "TSPropertySignature");
|
|
1273
|
+
}
|
|
1274
|
+
var sc = b(["ClassDeclaration", "ClassExpression", "DeclareClass", "DeclareInterface", "InterfaceDeclaration", "TSInterfaceDeclaration"]);
|
|
1275
|
+
function zi(e) {
|
|
1276
|
+
let { key: t, parent: r } = e;
|
|
1277
|
+
if (t === "types" && Ie(r) || t === "argument" && r.type === "JSXSpreadAttribute" || t === "expression" && r.type === "JSXSpreadChild" || t === "superClass" && (r.type === "ClassDeclaration" || r.type === "ClassExpression") || (t === "id" || t === "typeParameters") && sc(r) || t === "patterns" && r.type === "MatchOrPattern") return true;
|
|
1278
|
+
let { node: n } = e;
|
|
1279
|
+
return It(n) ? false : q(n) || Ie(n);
|
|
1280
|
+
}
|
|
1281
|
+
function Zi(e, { parser: t }) {
|
|
1282
|
+
if (t === "flow" || t === "hermes" || t === "babel-flow") return e = G(0, e, /[\s(]/gu, ""), e === "" || e === "/*" || e === "/*::";
|
|
1283
|
+
}
|
|
1284
|
+
function ic(e, t, r = 0) {
|
|
1285
|
+
let n = 0;
|
|
1286
|
+
for (let s = r; s < e.length; ++s) e[s] === " " ? n = n + t - n % t : n++;
|
|
1287
|
+
return n;
|
|
1288
|
+
}
|
|
1289
|
+
var eu = ic;
|
|
1290
|
+
function uc(e, t) {
|
|
1291
|
+
let r = e.lastIndexOf(`
|
|
1292
|
+
`);
|
|
1293
|
+
return r === -1 ? 0 : eu(e.slice(r + 1).match(/^[\t ]*/u)[0], t);
|
|
1294
|
+
}
|
|
1295
|
+
var tu = uc;
|
|
1296
|
+
function $r(e, t, r) {
|
|
1297
|
+
let { node: n } = e;
|
|
1298
|
+
if (n.type === "TemplateLiteral" && pc(e)) {
|
|
1299
|
+
let p = oc(e, t, r);
|
|
1300
|
+
if (p) return p;
|
|
1301
|
+
}
|
|
1302
|
+
let i = "expressions";
|
|
1303
|
+
n.type === "TSTemplateLiteralType" && (i = "types");
|
|
1304
|
+
let u = [], o = e.map(r, i);
|
|
1305
|
+
u.push(we, "`");
|
|
1306
|
+
let a = 0;
|
|
1307
|
+
return e.each(({ index: p, node: D }) => {
|
|
1308
|
+
if (u.push(r()), D.tail) return;
|
|
1309
|
+
let { tabWidth: l } = t, E = D.value.raw, d = E.includes(`
|
|
1310
|
+
`) ? tu(E, l) : a;
|
|
1311
|
+
a = d;
|
|
1312
|
+
let F = o[p], P = n[i][p], S = re(t.originalText, k(D), L(n.quasis[p + 1]));
|
|
1313
|
+
if (!S) {
|
|
1314
|
+
let g = es(F, { ...t, printWidth: Number.POSITIVE_INFINITY }).formatted;
|
|
1315
|
+
g.includes(`
|
|
1316
|
+
`) ? S = true : F = g;
|
|
1317
|
+
}
|
|
1318
|
+
S && (C(P) || P.type === "Identifier" || R(P) || P.type === "ConditionalExpression" || P.type === "SequenceExpression" || Ae(P) || xe(P)) && (F = [m([f, F]), f]);
|
|
1319
|
+
let O = d === 0 && E.endsWith(`
|
|
1320
|
+
`) ? ge(Number.NEGATIVE_INFINITY, F) : wi(F, d, l);
|
|
1321
|
+
u.push(c(["${", O, we, "}"]));
|
|
1322
|
+
}, "quasis"), u.push("`"), u;
|
|
1323
|
+
}
|
|
1324
|
+
function ru(e, t, r) {
|
|
1325
|
+
let n = r("quasi"), { node: s } = e, i = "", u = Ze(s.quasi, T.Leading)[0];
|
|
1326
|
+
return u && (re(t.originalText, k(s.typeArguments ?? s.tag), L(u)) ? i = f : i = " "), ot(n.label && { tagged: true, ...n.label }, [r("tag"), r("typeArguments"), i, we, n]);
|
|
1327
|
+
}
|
|
1328
|
+
function oc(e, t, r) {
|
|
1329
|
+
let { node: n } = e, s = n.quasis[0].value.raw.trim().split(/\s*\|\s*/u);
|
|
1330
|
+
if (s.length > 1 || s.some((i) => i.length > 0)) {
|
|
1331
|
+
t.__inJestEach = true;
|
|
1332
|
+
let i = e.map(r, "expressions");
|
|
1333
|
+
t.__inJestEach = false;
|
|
1334
|
+
let u = i.map((l) => "${" + es(l, { ...t, printWidth: Number.POSITIVE_INFINITY, endOfLine: "lf" }).formatted + "}"), o = [{ hasLineBreak: false, cells: [] }];
|
|
1335
|
+
for (let l = 1; l < n.quasis.length; l++) {
|
|
1336
|
+
let E = _(0, o, -1), d = u[l - 1];
|
|
1337
|
+
E.cells.push(d), d.includes(`
|
|
1338
|
+
`) && (E.hasLineBreak = true), n.quasis[l].value.raw.includes(`
|
|
1339
|
+
`) && o.push({ hasLineBreak: false, cells: [] });
|
|
1340
|
+
}
|
|
1341
|
+
let a = Math.max(s.length, ...o.map((l) => l.cells.length)), p = Array.from({ length: a }).fill(0), D = [{ cells: s }, ...o.filter((l) => l.cells.length > 0)];
|
|
1342
|
+
for (let { cells: l } of D.filter((E) => !E.hasLineBreak)) for (let [E, d] of l.entries()) p[E] = Math.max(p[E], it(d));
|
|
1343
|
+
return [we, "`", m([y, I(y, D.map((l) => I(" | ", l.cells.map((E, d) => l.hasLineBreak ? E : E + " ".repeat(p[d] - it(E))))))]), y, "`"];
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
function ac(e, t) {
|
|
1347
|
+
let { node: r } = e, n = t();
|
|
1348
|
+
return C(r) && (n = c([m([f, n]), f])), ["${", n, we, "}"];
|
|
1349
|
+
}
|
|
1350
|
+
function Kt(e, t) {
|
|
1351
|
+
return e.map(() => ac(e, t), "expressions");
|
|
1352
|
+
}
|
|
1353
|
+
function Kr(e, t) {
|
|
1354
|
+
return Dt(e, (r) => typeof r == "string" ? t ? G(0, r, /(\\*)`/gu, "$1$1\\`") : Ds(r) : r);
|
|
1355
|
+
}
|
|
1356
|
+
function Ds(e) {
|
|
1357
|
+
return G(0, e, /([\\`]|\$\{)/gu, "\\$1");
|
|
1358
|
+
}
|
|
1359
|
+
function pc({ node: e, parent: t }) {
|
|
1360
|
+
let r = /^[fx]?(?:describe|it|test)$/u;
|
|
1361
|
+
return t.type === "TaggedTemplateExpression" && t.quasi === e && t.tag.type === "MemberExpression" && t.tag.property.type === "Identifier" && t.tag.property.name === "each" && (t.tag.object.type === "Identifier" && r.test(t.tag.object.name) || t.tag.object.type === "MemberExpression" && t.tag.object.property.type === "Identifier" && (t.tag.object.property.name === "only" || t.tag.object.property.name === "skip") && t.tag.object.object.type === "Identifier" && r.test(t.tag.object.object.name));
|
|
1362
|
+
}
|
|
1363
|
+
var ys = [(e, t) => e.type === "ObjectExpression" && t === "properties", (e, t) => e.type === "CallExpression" && e.callee.type === "Identifier" && e.callee.name === "Component" && t === "arguments", (e, t) => e.type === "Decorator" && t === "expression"];
|
|
1364
|
+
function nu(e) {
|
|
1365
|
+
let t = (n) => n.type === "TemplateLiteral", r = (n, s) => ke(n) && !n.computed && n.key.type === "Identifier" && n.key.name === "styles" && s === "value";
|
|
1366
|
+
return e.match(t, (n, s) => W(n) && s === "elements", r, ...ys) || e.match(t, r, ...ys);
|
|
1367
|
+
}
|
|
1368
|
+
function Es(e) {
|
|
1369
|
+
return e.match((t) => t.type === "TemplateLiteral", (t, r) => ke(t) && !t.computed && t.key.type === "Identifier" && t.key.name === "template" && r === "value", ...ys);
|
|
1370
|
+
}
|
|
1371
|
+
function fs(e, t) {
|
|
1372
|
+
return C(e, T.Block | T.Leading, ({ value: r }) => r === ` ${t} `);
|
|
1373
|
+
}
|
|
1374
|
+
function Qr({ node: e, parent: t }, r) {
|
|
1375
|
+
return fs(e, r) || cc(t) && fs(t, r) || t.type === "ExpressionStatement" && fs(t, r);
|
|
1376
|
+
}
|
|
1377
|
+
function cc(e) {
|
|
1378
|
+
return e.type === "AsConstExpression" || e.type === "TSAsExpression" && e.typeAnnotation.type === "TSTypeReference" && e.typeAnnotation.typeName.type === "Identifier" && e.typeAnnotation.typeName.name === "const";
|
|
1379
|
+
}
|
|
1380
|
+
async function iu(e, t, r) {
|
|
1381
|
+
let { node: n } = r, s = "";
|
|
1382
|
+
for (let [a, p] of n.quasis.entries()) {
|
|
1383
|
+
let { raw: D } = p.value;
|
|
1384
|
+
a > 0 && (s += "@prettier-placeholder-" + (a - 1) + "-id"), s += D;
|
|
1385
|
+
}
|
|
1386
|
+
let i = await e(s, { parser: "scss" }), u = Kt(r, t), o = lc(i, u);
|
|
1387
|
+
if (!o) throw new Error("Couldn't insert all the expressions");
|
|
1388
|
+
return ["`", m([y, o]), f, "`"];
|
|
1389
|
+
}
|
|
1390
|
+
function lc(e, t) {
|
|
1391
|
+
if (!j(t)) return e;
|
|
1392
|
+
let r = 0, n = Dt($t(e), (s) => typeof s != "string" || !s.includes("@prettier-placeholder") ? s : s.split(/@prettier-placeholder-(\d+)-id/u).map((i, u) => u % 2 === 0 ? Ge(i) : (r++, t[i])));
|
|
1393
|
+
return t.length === r ? n : null;
|
|
1394
|
+
}
|
|
1395
|
+
function mc(e) {
|
|
1396
|
+
return e.match(void 0, (t, r) => r === "quasi" && t.type === "TaggedTemplateExpression" && Bt(t.tag, ["css", "css.global", "css.resolve"])) || e.match(void 0, (t, r) => r === "expression" && t.type === "JSXExpressionContainer", (t, r) => r === "children" && t.type === "JSXElement" && t.openingElement.name.type === "JSXIdentifier" && t.openingElement.name.name === "style" && t.openingElement.attributes.some((n) => n.type === "JSXAttribute" && n.name.type === "JSXIdentifier" && n.name.name === "jsx"));
|
|
1397
|
+
}
|
|
1398
|
+
function zr(e) {
|
|
1399
|
+
return e.type === "Identifier" && e.name === "styled";
|
|
1400
|
+
}
|
|
1401
|
+
function su(e) {
|
|
1402
|
+
return /^[A-Z]/u.test(e.object.name) && e.property.name === "extend";
|
|
1403
|
+
}
|
|
1404
|
+
function Dc({ parent: e }) {
|
|
1405
|
+
if (!e || e.type !== "TaggedTemplateExpression") return false;
|
|
1406
|
+
let t = e.tag.type === "ParenthesizedExpression" ? e.tag.expression : e.tag;
|
|
1407
|
+
switch (t.type) {
|
|
1408
|
+
case "MemberExpression":
|
|
1409
|
+
return zr(t.object) || su(t);
|
|
1410
|
+
case "CallExpression":
|
|
1411
|
+
return zr(t.callee) || t.callee.type === "MemberExpression" && (t.callee.object.type === "MemberExpression" && (zr(t.callee.object.object) || su(t.callee.object)) || t.callee.object.type === "CallExpression" && zr(t.callee.object.callee));
|
|
1412
|
+
case "Identifier":
|
|
1413
|
+
return t.name === "css";
|
|
1414
|
+
default:
|
|
1415
|
+
return false;
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
function fc({ parent: e, grandparent: t }) {
|
|
1419
|
+
return t?.type === "JSXAttribute" && e.type === "JSXExpressionContainer" && t.name.type === "JSXIdentifier" && t.name.name === "css";
|
|
1420
|
+
}
|
|
1421
|
+
var uu = (e) => mc(e) || Dc(e) || fc(e) || nu(e);
|
|
1422
|
+
async function ou(e, t, r) {
|
|
1423
|
+
let { node: n } = r, s = n.quasis.length, i = Kt(r, t), u = [];
|
|
1424
|
+
for (let o = 0; o < s; o++) {
|
|
1425
|
+
let a = n.quasis[o], p = o === 0, D = o === s - 1, l = a.value.cooked, E = l.split(`
|
|
1426
|
+
`), d = E.length, F = i[o], P = d > 2 && E[0].trim() === "" && E[1].trim() === "", S = d > 2 && E[d - 1].trim() === "" && E[d - 2].trim() === "", O = E.every((x) => /^\s*(?:#[^\n\r]*)?$/u.test(x));
|
|
1427
|
+
if (!D && /#[^\n\r]*$/u.test(E[d - 1])) return null;
|
|
1428
|
+
let g = null;
|
|
1429
|
+
O ? g = yc(E) : g = await e(l, { parser: "graphql" }), g ? (g = Kr(g, false), !p && P && u.push(""), u.push(g), !D && S && u.push("")) : !p && !D && P && u.push(""), F && u.push(F);
|
|
1430
|
+
}
|
|
1431
|
+
return ["`", m([y, I(y, u)]), y, "`"];
|
|
1432
|
+
}
|
|
1433
|
+
function yc(e) {
|
|
1434
|
+
let t = [], r = false, n = e.map((s) => s.trim());
|
|
1435
|
+
for (let [s, i] of n.entries()) i !== "" && (n[s - 1] === "" && r ? t.push([y, i]) : t.push(i), r = true);
|
|
1436
|
+
return t.length === 0 ? null : I(y, t);
|
|
1437
|
+
}
|
|
1438
|
+
function au({ node: e, parent: t }) {
|
|
1439
|
+
return Qr({ node: e, parent: t }, "GraphQL") || t && (t.type === "TaggedTemplateExpression" && (t.tag.type === "MemberExpression" && t.tag.object.name === "graphql" && t.tag.property.name === "experimental" || t.tag.type === "Identifier" && (t.tag.name === "gql" || t.tag.name === "graphql")) || t.type === "CallExpression" && t.callee.type === "Identifier" && t.callee.name === "graphql");
|
|
1440
|
+
}
|
|
1441
|
+
var Fs = 0;
|
|
1442
|
+
async function pu(e, t, r, n, s) {
|
|
1443
|
+
let { node: i } = n, u = Fs;
|
|
1444
|
+
Fs = Fs + 1 >>> 0;
|
|
1445
|
+
let o = (O) => `PRETTIER_HTML_PLACEHOLDER_${O}_${u}_IN_JS`, a = i.quasis.map((O, g, x) => g === x.length - 1 ? O.value.cooked : O.value.cooked + o(g)).join(""), p = Kt(n, r), D = new RegExp(o("(\\d+)"), "gu"), l = 0, E = await t(a, { parser: e, __onHtmlRoot(O) {
|
|
1446
|
+
l = O.children.length;
|
|
1447
|
+
} }), d = Dt(E, (O) => {
|
|
1448
|
+
if (typeof O != "string") return O;
|
|
1449
|
+
let g = [], x = O.split(D);
|
|
1450
|
+
for (let h = 0; h < x.length; h++) {
|
|
1451
|
+
let N = x[h];
|
|
1452
|
+
if (h % 2 === 0) {
|
|
1453
|
+
N && (N = Ds(N), s.__embeddedInHtml && (N = G(0, N, /<\/(?=script\b)/giu, "<\\/")), g.push(N));
|
|
1454
|
+
continue;
|
|
1455
|
+
}
|
|
1456
|
+
let Y = Number(N);
|
|
1457
|
+
g.push(p[Y]);
|
|
1458
|
+
}
|
|
1459
|
+
return g;
|
|
1460
|
+
}), F = /^\s/u.test(a) ? " " : "", P = /\s$/u.test(a) ? " " : "", S = s.htmlWhitespaceSensitivity === "ignore" ? y : F && P ? A : null;
|
|
1461
|
+
return S ? c(["`", m([S, c(d)]), S, "`"]) : ot({ hug: false }, c(["`", F, l > 1 ? m(c(d)) : c(d), P, "`"]));
|
|
1462
|
+
}
|
|
1463
|
+
function cu(e) {
|
|
1464
|
+
return Qr(e, "HTML") || e.match((t) => t.type === "TemplateLiteral", (t, r) => t.type === "TaggedTemplateExpression" && t.tag.type === "Identifier" && t.tag.name === "html" && r === "quasi");
|
|
1465
|
+
}
|
|
1466
|
+
var lu = pu.bind(void 0, "html"), mu = pu.bind(void 0, "angular");
|
|
1467
|
+
async function Du(e, t, r) {
|
|
1468
|
+
let { node: n } = r, s = G(0, n.quasis[0].value.raw, /((?:\\\\)*)\\`/gu, (a, p) => "\\".repeat(p.length / 2) + "`"), i = Ec(s), u = i !== "";
|
|
1469
|
+
u && (s = G(0, s, new RegExp(`^${i}`, "gmu"), ""));
|
|
1470
|
+
let o = Kr(await e(s, { parser: "markdown", __inJsTemplate: true }), true);
|
|
1471
|
+
return ["`", u ? m([f, o]) : [qr, Oi(o)], f, "`"];
|
|
1472
|
+
}
|
|
1473
|
+
function Ec(e) {
|
|
1474
|
+
let t = e.match(/^([^\S\n]*)\S/mu);
|
|
1475
|
+
return t === null ? "" : t[1];
|
|
1476
|
+
}
|
|
1477
|
+
function fu({ node: e, parent: t }) {
|
|
1478
|
+
return t?.type === "TaggedTemplateExpression" && e.quasis.length === 1 && t.tag.type === "Identifier" && (t.tag.name === "md" || t.tag.name === "markdown");
|
|
1479
|
+
}
|
|
1480
|
+
var Fc = [{ test: uu, print: iu }, { test: au, print: ou }, { test: cu, print: lu }, { test: Es, print: mu }, { test: fu, print: Du }].map(({ test: e, print: t }) => ({ test: e, print: Cc(t) }));
|
|
1481
|
+
function dc(e) {
|
|
1482
|
+
let { node: t } = e;
|
|
1483
|
+
if (t.type !== "TemplateLiteral" || Ac(t)) return;
|
|
1484
|
+
let r = Fc.find(({ test: n }) => n(e));
|
|
1485
|
+
if (r) return t.quasis.length === 1 && t.quasis[0].value.raw.trim() === "" ? "``" : r.print;
|
|
1486
|
+
}
|
|
1487
|
+
function Cc(e) {
|
|
1488
|
+
return async (...t) => {
|
|
1489
|
+
let r = await e(...t);
|
|
1490
|
+
return r && ot({ embed: true, ...r.label }, r);
|
|
1491
|
+
};
|
|
1492
|
+
}
|
|
1493
|
+
function Ac({ quasis: e }) {
|
|
1494
|
+
return e.some(({ value: { cooked: t } }) => t === null);
|
|
1495
|
+
}
|
|
1496
|
+
var yu = dc;
|
|
1497
|
+
var Tc = /\*\/$/, xc = /^\/\*\*?/, Cu = /^\s*(\/\*\*?(.|\r?\n)*?\*\/)/, gc = /(^|\s+)\/\/([^\n\r]*)/g, Eu = /^(\r?\n)+/, hc = /(?:^|\r?\n) *(@[^\n\r]*?) *\r?\n *(?![^\n\r@]*\/\/[^]*)([^\s@][^\n\r@]+?) *\r?\n/g, Fu = /(?:^|\r?\n) *@(\S+) *([^\n\r]*)/g, Sc = /(\r?\n|^) *\* ?/g, Au = [];
|
|
1498
|
+
function Tu(e) {
|
|
1499
|
+
let t = e.match(Cu);
|
|
1500
|
+
return t ? t[0].trimStart() : "";
|
|
1501
|
+
}
|
|
1502
|
+
function xu(e) {
|
|
1503
|
+
let r = e.match(Cu)?.[0];
|
|
1504
|
+
return r == null ? e : e.slice(r.length);
|
|
1505
|
+
}
|
|
1506
|
+
function gu(e) {
|
|
1507
|
+
e = G(0, e.replace(xc, "").replace(Tc, ""), Sc, "$1");
|
|
1508
|
+
let r = "";
|
|
1509
|
+
for (; r !== e; ) r = e, e = G(0, e, hc, `
|
|
1510
|
+
$1 $2
|
|
1511
|
+
`);
|
|
1512
|
+
e = e.replace(Eu, "").trimEnd();
|
|
1513
|
+
let n = /* @__PURE__ */ Object.create(null), s = G(0, e, Fu, "").replace(Eu, "").trimEnd(), i;
|
|
1514
|
+
for (; i = Fu.exec(e); ) {
|
|
1515
|
+
let u = G(0, i[2], gc, "");
|
|
1516
|
+
if (typeof n[i[1]] == "string" || Array.isArray(n[i[1]])) {
|
|
1517
|
+
let o = n[i[1]];
|
|
1518
|
+
n[i[1]] = [...Au, ...Array.isArray(o) ? o : [o], u];
|
|
1519
|
+
} else n[i[1]] = u;
|
|
1520
|
+
}
|
|
1521
|
+
return { comments: s, pragmas: n };
|
|
1522
|
+
}
|
|
1523
|
+
function hu({ comments: e = "", pragmas: t = {} }) {
|
|
1524
|
+
let u = Object.keys(t), o = u.flatMap((p) => du(p, t[p])).map((p) => ` * ${p}
|
|
1525
|
+
`).join("");
|
|
1526
|
+
if (!e) {
|
|
1527
|
+
if (u.length === 0) return "";
|
|
1528
|
+
if (u.length === 1 && !Array.isArray(t[u[0]])) {
|
|
1529
|
+
let p = t[u[0]];
|
|
1530
|
+
return `/** ${du(u[0], p)[0]} */`;
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
let a = e.split(`
|
|
1534
|
+
`).map((p) => ` * ${p}`).join(`
|
|
1535
|
+
`) + `
|
|
1536
|
+
`;
|
|
1537
|
+
return `/**
|
|
1538
|
+
` + (e ? a : "") + (e && u.length > 0 ? ` *
|
|
1539
|
+
` : "") + o + " */";
|
|
1540
|
+
}
|
|
1541
|
+
function du(e, t) {
|
|
1542
|
+
return [...Au, ...Array.isArray(t) ? t : [t]].map((r) => `@${e} ${r}`.trim());
|
|
1543
|
+
}
|
|
1544
|
+
var Su = "format";
|
|
1545
|
+
function Bc(e) {
|
|
1546
|
+
if (!e.startsWith("#!")) return "";
|
|
1547
|
+
let t = e.indexOf(`
|
|
1548
|
+
`);
|
|
1549
|
+
return t === -1 ? e : e.slice(0, t);
|
|
1550
|
+
}
|
|
1551
|
+
var Bu = Bc;
|
|
1552
|
+
function bc(e) {
|
|
1553
|
+
let t = Bu(e);
|
|
1554
|
+
t && (e = e.slice(t.length + 1));
|
|
1555
|
+
let r = Tu(e), { pragmas: n, comments: s } = gu(r);
|
|
1556
|
+
return { shebang: t, text: e, pragmas: n, comments: s };
|
|
1557
|
+
}
|
|
1558
|
+
function bu(e) {
|
|
1559
|
+
let { shebang: t, text: r, pragmas: n, comments: s } = bc(e), i = xu(r), u = hu({ pragmas: { [Su]: "", ...n }, comments: s.trimStart() });
|
|
1560
|
+
return (t ? `${t}
|
|
1561
|
+
` : "") + u + (i.startsWith(`
|
|
1562
|
+
`) ? `
|
|
1563
|
+
` : `
|
|
1564
|
+
|
|
1565
|
+
`) + i;
|
|
1566
|
+
}
|
|
1567
|
+
function ds(e, t) {
|
|
1568
|
+
if (e.isRoot) return false;
|
|
1569
|
+
let { node: r, key: n, parent: s } = e;
|
|
1570
|
+
if (t.__isInHtmlInterpolation && !t.bracketSpacing && Lc(r) && Cr(e)) return true;
|
|
1571
|
+
if (Pc(r)) return false;
|
|
1572
|
+
if (r.type === "Identifier") {
|
|
1573
|
+
if (r.extra?.parenthesized && /^PRETTIER_HTML_PLACEHOLDER_\d+_\d+_IN_JS$/u.test(r.name) || n === "left" && (r.name === "async" && !s.await || r.name === "let") && s.type === "ForOfStatement") return true;
|
|
1574
|
+
if (r.name === "let") {
|
|
1575
|
+
let i = e.findAncestor((u) => u.type === "ForOfStatement")?.left;
|
|
1576
|
+
if (i && fe(i, (u) => u === r)) return true;
|
|
1577
|
+
}
|
|
1578
|
+
if (n === "object" && r.name === "let" && s.type === "MemberExpression" && s.computed && !s.optional) {
|
|
1579
|
+
let i = e.findAncestor((o) => o.type === "ExpressionStatement" || o.type === "ForStatement" || o.type === "ForInStatement"), u = i ? i.type === "ExpressionStatement" ? i.expression : i.type === "ForStatement" ? i.init : i.left : void 0;
|
|
1580
|
+
if (u && fe(u, (o) => o === r)) return true;
|
|
1581
|
+
}
|
|
1582
|
+
if (n === "expression") switch (r.name) {
|
|
1583
|
+
case "await":
|
|
1584
|
+
case "interface":
|
|
1585
|
+
case "module":
|
|
1586
|
+
case "using":
|
|
1587
|
+
case "yield":
|
|
1588
|
+
case "let":
|
|
1589
|
+
case "component":
|
|
1590
|
+
case "hook":
|
|
1591
|
+
case "type": {
|
|
1592
|
+
let i = e.findAncestor((u) => !Ae(u));
|
|
1593
|
+
if (i !== s && i.type === "ExpressionStatement") return true;
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
return false;
|
|
1597
|
+
}
|
|
1598
|
+
if (r.type === "ObjectExpression" || r.type === "FunctionExpression" || r.type === "ClassExpression" || r.type === "DoExpression") {
|
|
1599
|
+
let i = e.findAncestor((u) => u.type === "ExpressionStatement")?.expression;
|
|
1600
|
+
if (i && fe(i, (u) => u === r)) return true;
|
|
1601
|
+
}
|
|
1602
|
+
if (r.type === "ObjectExpression") {
|
|
1603
|
+
let i = e.findAncestor((u) => u.type === "ArrowFunctionExpression")?.body;
|
|
1604
|
+
if (i && i.type !== "SequenceExpression" && i.type !== "AssignmentExpression" && fe(i, (u) => u === r)) return true;
|
|
1605
|
+
}
|
|
1606
|
+
switch (s.type) {
|
|
1607
|
+
case "ParenthesizedExpression":
|
|
1608
|
+
return false;
|
|
1609
|
+
case "ClassDeclaration":
|
|
1610
|
+
case "ClassExpression":
|
|
1611
|
+
if (n === "superClass" && (r.type === "ArrowFunctionExpression" || r.type === "AssignmentExpression" || r.type === "AwaitExpression" || r.type === "BinaryExpression" || r.type === "ConditionalExpression" || r.type === "LogicalExpression" || r.type === "NewExpression" || r.type === "ObjectExpression" || r.type === "SequenceExpression" || r.type === "TaggedTemplateExpression" || r.type === "UnaryExpression" || r.type === "UpdateExpression" || r.type === "YieldExpression" || r.type === "TSNonNullExpression" || r.type === "ClassExpression" && j(r.decorators))) return true;
|
|
1612
|
+
break;
|
|
1613
|
+
case "ExportDefaultDeclaration":
|
|
1614
|
+
return Pu(e, t) || r.type === "SequenceExpression";
|
|
1615
|
+
case "Decorator":
|
|
1616
|
+
if (n === "expression" && !wc(r)) return true;
|
|
1617
|
+
break;
|
|
1618
|
+
case "TypeAnnotation":
|
|
1619
|
+
if (e.match(void 0, void 0, (i, u) => u === "returnType" && i.type === "ArrowFunctionExpression") && Ic(r)) return true;
|
|
1620
|
+
break;
|
|
1621
|
+
case "BinaryExpression":
|
|
1622
|
+
if (n === "left" && (s.operator === "in" || s.operator === "instanceof") && r.type === "UnaryExpression") return true;
|
|
1623
|
+
break;
|
|
1624
|
+
case "VariableDeclarator":
|
|
1625
|
+
if (n === "init" && e.match(void 0, void 0, (i, u) => u === "declarations" && i.type === "VariableDeclaration", (i, u) => u === "left" && i.type === "ForInStatement")) return true;
|
|
1626
|
+
break;
|
|
1627
|
+
}
|
|
1628
|
+
switch (r.type) {
|
|
1629
|
+
case "UpdateExpression":
|
|
1630
|
+
if (s.type === "UnaryExpression") return r.prefix && (r.operator === "++" && s.operator === "+" || r.operator === "--" && s.operator === "-");
|
|
1631
|
+
case "UnaryExpression":
|
|
1632
|
+
switch (s.type) {
|
|
1633
|
+
case "UnaryExpression":
|
|
1634
|
+
return r.operator === s.operator && (r.operator === "+" || r.operator === "-");
|
|
1635
|
+
case "BindExpression":
|
|
1636
|
+
return true;
|
|
1637
|
+
case "MemberExpression":
|
|
1638
|
+
case "OptionalMemberExpression":
|
|
1639
|
+
return n === "object";
|
|
1640
|
+
case "TaggedTemplateExpression":
|
|
1641
|
+
return true;
|
|
1642
|
+
case "NewExpression":
|
|
1643
|
+
case "CallExpression":
|
|
1644
|
+
case "OptionalCallExpression":
|
|
1645
|
+
return n === "callee";
|
|
1646
|
+
case "BinaryExpression":
|
|
1647
|
+
return n === "left" && s.operator === "**";
|
|
1648
|
+
case "TSNonNullExpression":
|
|
1649
|
+
return true;
|
|
1650
|
+
default:
|
|
1651
|
+
return false;
|
|
1652
|
+
}
|
|
1653
|
+
case "BinaryExpression":
|
|
1654
|
+
if (s.type === "UpdateExpression" || r.operator === "in" && kc(e)) return true;
|
|
1655
|
+
if (r.operator === "|>" && r.extra?.parenthesized) {
|
|
1656
|
+
let i = e.grandparent;
|
|
1657
|
+
if (i.type === "BinaryExpression" && i.operator === "|>") return true;
|
|
1658
|
+
}
|
|
1659
|
+
case "TSTypeAssertion":
|
|
1660
|
+
case "TSAsExpression":
|
|
1661
|
+
case "TSSatisfiesExpression":
|
|
1662
|
+
case "AsExpression":
|
|
1663
|
+
case "AsConstExpression":
|
|
1664
|
+
case "SatisfiesExpression":
|
|
1665
|
+
case "LogicalExpression":
|
|
1666
|
+
switch (s.type) {
|
|
1667
|
+
case "TSAsExpression":
|
|
1668
|
+
case "TSSatisfiesExpression":
|
|
1669
|
+
case "AsExpression":
|
|
1670
|
+
case "AsConstExpression":
|
|
1671
|
+
case "SatisfiesExpression":
|
|
1672
|
+
return !Ae(r);
|
|
1673
|
+
case "ConditionalExpression":
|
|
1674
|
+
return Ae(r) || li(r);
|
|
1675
|
+
case "CallExpression":
|
|
1676
|
+
case "NewExpression":
|
|
1677
|
+
case "OptionalCallExpression":
|
|
1678
|
+
return n === "callee";
|
|
1679
|
+
case "ClassExpression":
|
|
1680
|
+
case "ClassDeclaration":
|
|
1681
|
+
return n === "superClass";
|
|
1682
|
+
case "TSTypeAssertion":
|
|
1683
|
+
case "TaggedTemplateExpression":
|
|
1684
|
+
case "UnaryExpression":
|
|
1685
|
+
case "JSXSpreadAttribute":
|
|
1686
|
+
case "SpreadElement":
|
|
1687
|
+
case "BindExpression":
|
|
1688
|
+
case "AwaitExpression":
|
|
1689
|
+
case "TSNonNullExpression":
|
|
1690
|
+
case "UpdateExpression":
|
|
1691
|
+
return true;
|
|
1692
|
+
case "MemberExpression":
|
|
1693
|
+
case "OptionalMemberExpression":
|
|
1694
|
+
return n === "object";
|
|
1695
|
+
case "AssignmentExpression":
|
|
1696
|
+
case "AssignmentPattern":
|
|
1697
|
+
return n === "left" && (r.type === "TSTypeAssertion" || Ae(r));
|
|
1698
|
+
case "LogicalExpression":
|
|
1699
|
+
if (r.type === "LogicalExpression") return s.operator !== r.operator;
|
|
1700
|
+
case "BinaryExpression": {
|
|
1701
|
+
let { operator: i, type: u } = r;
|
|
1702
|
+
if (!i && u !== "TSTypeAssertion") return true;
|
|
1703
|
+
let o = mr(i), a = s.operator, p = mr(a);
|
|
1704
|
+
return !!(p > o || n === "right" && p === o || p === o && !yr(a, i) || p < o && i === "%" && (a === "+" || a === "-") || Fi(a));
|
|
1705
|
+
}
|
|
1706
|
+
default:
|
|
1707
|
+
return false;
|
|
1708
|
+
}
|
|
1709
|
+
case "SequenceExpression":
|
|
1710
|
+
return s.type !== "ForStatement";
|
|
1711
|
+
case "YieldExpression":
|
|
1712
|
+
if (s.type === "AwaitExpression" || s.type === "TSTypeAssertion") return true;
|
|
1713
|
+
case "AwaitExpression":
|
|
1714
|
+
switch (s.type) {
|
|
1715
|
+
case "TaggedTemplateExpression":
|
|
1716
|
+
case "UnaryExpression":
|
|
1717
|
+
case "LogicalExpression":
|
|
1718
|
+
case "SpreadElement":
|
|
1719
|
+
case "TSAsExpression":
|
|
1720
|
+
case "TSSatisfiesExpression":
|
|
1721
|
+
case "TSNonNullExpression":
|
|
1722
|
+
case "AsExpression":
|
|
1723
|
+
case "AsConstExpression":
|
|
1724
|
+
case "SatisfiesExpression":
|
|
1725
|
+
case "BindExpression":
|
|
1726
|
+
return true;
|
|
1727
|
+
case "MemberExpression":
|
|
1728
|
+
case "OptionalMemberExpression":
|
|
1729
|
+
return n === "object";
|
|
1730
|
+
case "NewExpression":
|
|
1731
|
+
case "CallExpression":
|
|
1732
|
+
case "OptionalCallExpression":
|
|
1733
|
+
return n === "callee";
|
|
1734
|
+
case "ConditionalExpression":
|
|
1735
|
+
return n === "test";
|
|
1736
|
+
case "BinaryExpression":
|
|
1737
|
+
return !(!r.argument && s.operator === "|>");
|
|
1738
|
+
default:
|
|
1739
|
+
return false;
|
|
1740
|
+
}
|
|
1741
|
+
case "TSFunctionType":
|
|
1742
|
+
if (e.match((i) => i.type === "TSFunctionType", (i, u) => u === "typeAnnotation" && i.type === "TSTypeAnnotation", (i, u) => u === "returnType" && i.type === "ArrowFunctionExpression")) return true;
|
|
1743
|
+
case "TSConditionalType":
|
|
1744
|
+
case "TSConstructorType":
|
|
1745
|
+
case "ConditionalTypeAnnotation":
|
|
1746
|
+
if (n === "extendsType" && qe(r) && s.type === r.type || n === "checkType" && qe(s)) return true;
|
|
1747
|
+
if (n === "extendsType" && s.type === "TSConditionalType") {
|
|
1748
|
+
let { typeAnnotation: i } = r.returnType || r.typeAnnotation;
|
|
1749
|
+
if (i.type === "TSTypePredicate" && i.typeAnnotation && (i = i.typeAnnotation.typeAnnotation), i.type === "TSInferType" && i.typeParameter.constraint) return true;
|
|
1750
|
+
}
|
|
1751
|
+
case "TSUnionType":
|
|
1752
|
+
case "TSIntersectionType":
|
|
1753
|
+
if ((Ie(s) || Lt(s)) && s.types.length > 1 && (!r.types || r.types.length > 1)) return true;
|
|
1754
|
+
case "TSInferType":
|
|
1755
|
+
if (r.type === "TSInferType") {
|
|
1756
|
+
if (s.type === "TSRestType") return false;
|
|
1757
|
+
if (n === "types" && (s.type === "TSUnionType" || s.type === "TSIntersectionType") && r.typeParameter.type === "TSTypeParameter" && r.typeParameter.constraint) return true;
|
|
1758
|
+
}
|
|
1759
|
+
case "TSTypeOperator":
|
|
1760
|
+
return s.type === "TSArrayType" || s.type === "TSOptionalType" || s.type === "TSRestType" || n === "objectType" && s.type === "TSIndexedAccessType" || s.type === "TSTypeOperator" || s.type === "TSTypeAnnotation" && e.grandparent.type.startsWith("TSJSDoc");
|
|
1761
|
+
case "TSTypeQuery":
|
|
1762
|
+
return n === "objectType" && s.type === "TSIndexedAccessType" || n === "elementType" && s.type === "TSArrayType";
|
|
1763
|
+
case "TypeOperator":
|
|
1764
|
+
return s.type === "ArrayTypeAnnotation" || s.type === "NullableTypeAnnotation" || n === "objectType" && (s.type === "IndexedAccessType" || s.type === "OptionalIndexedAccessType") || s.type === "TypeOperator";
|
|
1765
|
+
case "TypeofTypeAnnotation":
|
|
1766
|
+
return n === "objectType" && (s.type === "IndexedAccessType" || s.type === "OptionalIndexedAccessType") || n === "elementType" && s.type === "ArrayTypeAnnotation";
|
|
1767
|
+
case "ArrayTypeAnnotation":
|
|
1768
|
+
return s.type === "NullableTypeAnnotation";
|
|
1769
|
+
case "IntersectionTypeAnnotation":
|
|
1770
|
+
case "UnionTypeAnnotation":
|
|
1771
|
+
return s.type === "TypeOperator" || s.type === "KeyofTypeAnnotation" || s.type === "ArrayTypeAnnotation" || s.type === "NullableTypeAnnotation" || s.type === "IntersectionTypeAnnotation" || s.type === "UnionTypeAnnotation" || n === "objectType" && (s.type === "IndexedAccessType" || s.type === "OptionalIndexedAccessType");
|
|
1772
|
+
case "InferTypeAnnotation":
|
|
1773
|
+
case "NullableTypeAnnotation":
|
|
1774
|
+
return s.type === "ArrayTypeAnnotation" || n === "objectType" && (s.type === "IndexedAccessType" || s.type === "OptionalIndexedAccessType");
|
|
1775
|
+
case "ComponentTypeAnnotation":
|
|
1776
|
+
case "FunctionTypeAnnotation": {
|
|
1777
|
+
if (r.type === "ComponentTypeAnnotation" && (r.rendersType === null || r.rendersType === void 0)) return false;
|
|
1778
|
+
if (e.match(void 0, (u, o) => o === "typeAnnotation" && u.type === "TypeAnnotation", (u, o) => o === "returnType" && u.type === "ArrowFunctionExpression") || e.match(void 0, (u, o) => o === "typeAnnotation" && u.type === "TypePredicate", (u, o) => o === "typeAnnotation" && u.type === "TypeAnnotation", (u, o) => o === "returnType" && u.type === "ArrowFunctionExpression")) return true;
|
|
1779
|
+
let i = s.type === "NullableTypeAnnotation" ? e.grandparent : s;
|
|
1780
|
+
return i.type === "UnionTypeAnnotation" || i.type === "IntersectionTypeAnnotation" || i.type === "ArrayTypeAnnotation" || n === "objectType" && (i.type === "IndexedAccessType" || i.type === "OptionalIndexedAccessType") || n === "checkType" && s.type === "ConditionalTypeAnnotation" || n === "extendsType" && s.type === "ConditionalTypeAnnotation" && r.returnType?.type === "InferTypeAnnotation" && r.returnType?.typeParameter.bound || i.type === "NullableTypeAnnotation" || s.type === "FunctionTypeParam" && s.name === null && K(r).some((u) => u.typeAnnotation?.type === "NullableTypeAnnotation");
|
|
1781
|
+
}
|
|
1782
|
+
case "OptionalIndexedAccessType":
|
|
1783
|
+
return n === "objectType" && s.type === "IndexedAccessType";
|
|
1784
|
+
case "StringLiteral":
|
|
1785
|
+
case "NumericLiteral":
|
|
1786
|
+
case "Literal":
|
|
1787
|
+
if (typeof r.value == "string" && s.type === "ExpressionStatement" && typeof s.directive != "string") {
|
|
1788
|
+
let i = e.grandparent;
|
|
1789
|
+
return i.type === "Program" || i.type === "BlockStatement";
|
|
1790
|
+
}
|
|
1791
|
+
return n === "object" && R(s) && de(r);
|
|
1792
|
+
case "AssignmentExpression":
|
|
1793
|
+
return !((n === "init" || n === "update") && s.type === "ForStatement" || n === "expression" && r.left.type !== "ObjectPattern" && s.type === "ExpressionStatement" || n === "key" && s.type === "TSPropertySignature" || s.type === "AssignmentExpression" || n === "expressions" && s.type === "SequenceExpression" && e.match(void 0, void 0, (i, u) => (u === "init" || u === "update") && i.type === "ForStatement") || n === "value" && s.type === "Property" && e.match(void 0, void 0, (i, u) => u === "properties" && i.type === "ObjectPattern") || s.type === "NGChainedExpression" || n === "node" && s.type === "JsExpressionRoot");
|
|
1794
|
+
case "ConditionalExpression":
|
|
1795
|
+
switch (s.type) {
|
|
1796
|
+
case "TaggedTemplateExpression":
|
|
1797
|
+
case "UnaryExpression":
|
|
1798
|
+
case "SpreadElement":
|
|
1799
|
+
case "BinaryExpression":
|
|
1800
|
+
case "LogicalExpression":
|
|
1801
|
+
case "NGPipeExpression":
|
|
1802
|
+
case "ExportDefaultDeclaration":
|
|
1803
|
+
case "AwaitExpression":
|
|
1804
|
+
case "JSXSpreadAttribute":
|
|
1805
|
+
case "TSTypeAssertion":
|
|
1806
|
+
case "TypeCastExpression":
|
|
1807
|
+
case "TSAsExpression":
|
|
1808
|
+
case "TSSatisfiesExpression":
|
|
1809
|
+
case "AsExpression":
|
|
1810
|
+
case "AsConstExpression":
|
|
1811
|
+
case "SatisfiesExpression":
|
|
1812
|
+
case "TSNonNullExpression":
|
|
1813
|
+
return true;
|
|
1814
|
+
case "NewExpression":
|
|
1815
|
+
case "CallExpression":
|
|
1816
|
+
case "OptionalCallExpression":
|
|
1817
|
+
return n === "callee";
|
|
1818
|
+
case "ConditionalExpression":
|
|
1819
|
+
return t.experimentalTernaries ? false : n === "test";
|
|
1820
|
+
case "MemberExpression":
|
|
1821
|
+
case "OptionalMemberExpression":
|
|
1822
|
+
return n === "object";
|
|
1823
|
+
default:
|
|
1824
|
+
return false;
|
|
1825
|
+
}
|
|
1826
|
+
case "FunctionExpression":
|
|
1827
|
+
switch (s.type) {
|
|
1828
|
+
case "NewExpression":
|
|
1829
|
+
case "CallExpression":
|
|
1830
|
+
case "OptionalCallExpression":
|
|
1831
|
+
return n === "callee";
|
|
1832
|
+
case "TaggedTemplateExpression":
|
|
1833
|
+
return true;
|
|
1834
|
+
default:
|
|
1835
|
+
return false;
|
|
1836
|
+
}
|
|
1837
|
+
case "ArrowFunctionExpression":
|
|
1838
|
+
switch (s.type) {
|
|
1839
|
+
case "BinaryExpression":
|
|
1840
|
+
return s.operator !== "|>" || r.extra?.parenthesized;
|
|
1841
|
+
case "NewExpression":
|
|
1842
|
+
case "CallExpression":
|
|
1843
|
+
case "OptionalCallExpression":
|
|
1844
|
+
return n === "callee";
|
|
1845
|
+
case "MemberExpression":
|
|
1846
|
+
case "OptionalMemberExpression":
|
|
1847
|
+
return n === "object";
|
|
1848
|
+
case "TSAsExpression":
|
|
1849
|
+
case "TSSatisfiesExpression":
|
|
1850
|
+
case "AsExpression":
|
|
1851
|
+
case "AsConstExpression":
|
|
1852
|
+
case "SatisfiesExpression":
|
|
1853
|
+
case "TSNonNullExpression":
|
|
1854
|
+
case "BindExpression":
|
|
1855
|
+
case "TaggedTemplateExpression":
|
|
1856
|
+
case "UnaryExpression":
|
|
1857
|
+
case "LogicalExpression":
|
|
1858
|
+
case "AwaitExpression":
|
|
1859
|
+
case "TSTypeAssertion":
|
|
1860
|
+
case "MatchExpressionCase":
|
|
1861
|
+
return true;
|
|
1862
|
+
case "TSInstantiationExpression":
|
|
1863
|
+
return n === "expression";
|
|
1864
|
+
case "ConditionalExpression":
|
|
1865
|
+
return n === "test";
|
|
1866
|
+
default:
|
|
1867
|
+
return false;
|
|
1868
|
+
}
|
|
1869
|
+
case "ClassExpression":
|
|
1870
|
+
switch (s.type) {
|
|
1871
|
+
case "NewExpression":
|
|
1872
|
+
return n === "callee";
|
|
1873
|
+
default:
|
|
1874
|
+
return false;
|
|
1875
|
+
}
|
|
1876
|
+
case "OptionalMemberExpression":
|
|
1877
|
+
case "OptionalCallExpression":
|
|
1878
|
+
case "CallExpression":
|
|
1879
|
+
case "MemberExpression":
|
|
1880
|
+
if (Oc(e)) return true;
|
|
1881
|
+
case "TaggedTemplateExpression":
|
|
1882
|
+
case "TSNonNullExpression":
|
|
1883
|
+
if (n === "callee" && (s.type === "BindExpression" || s.type === "NewExpression")) {
|
|
1884
|
+
let i = r;
|
|
1885
|
+
for (; i; ) switch (i.type) {
|
|
1886
|
+
case "CallExpression":
|
|
1887
|
+
case "OptionalCallExpression":
|
|
1888
|
+
return true;
|
|
1889
|
+
case "MemberExpression":
|
|
1890
|
+
case "OptionalMemberExpression":
|
|
1891
|
+
case "BindExpression":
|
|
1892
|
+
i = i.object;
|
|
1893
|
+
break;
|
|
1894
|
+
case "TaggedTemplateExpression":
|
|
1895
|
+
i = i.tag;
|
|
1896
|
+
break;
|
|
1897
|
+
case "TSNonNullExpression":
|
|
1898
|
+
i = i.expression;
|
|
1899
|
+
break;
|
|
1900
|
+
default:
|
|
1901
|
+
return false;
|
|
1902
|
+
}
|
|
1903
|
+
}
|
|
1904
|
+
return false;
|
|
1905
|
+
case "BindExpression":
|
|
1906
|
+
return n === "callee" && (s.type === "BindExpression" || s.type === "NewExpression") || n === "object" && R(s);
|
|
1907
|
+
case "NGPipeExpression":
|
|
1908
|
+
return !(s.type === "NGRoot" || s.type === "NGMicrosyntaxExpression" || s.type === "ObjectProperty" && !r.extra?.parenthesized || W(s) || n === "arguments" && M(s) || n === "right" && s.type === "NGPipeExpression" || n === "property" && s.type === "MemberExpression" || s.type === "AssignmentExpression");
|
|
1909
|
+
case "JSXFragment":
|
|
1910
|
+
case "JSXElement":
|
|
1911
|
+
return n === "callee" || n === "left" && s.type === "BinaryExpression" && s.operator === "<" || !W(s) && s.type !== "ArrowFunctionExpression" && s.type !== "AssignmentExpression" && s.type !== "AssignmentPattern" && s.type !== "BinaryExpression" && s.type !== "NewExpression" && s.type !== "ConditionalExpression" && s.type !== "ExpressionStatement" && s.type !== "JsExpressionRoot" && s.type !== "JSXAttribute" && s.type !== "JSXElement" && s.type !== "JSXExpressionContainer" && s.type !== "JSXFragment" && s.type !== "LogicalExpression" && !M(s) && !ke(s) && s.type !== "ReturnStatement" && s.type !== "ThrowStatement" && s.type !== "TypeCastExpression" && s.type !== "VariableDeclarator" && s.type !== "YieldExpression" && s.type !== "MatchExpressionCase";
|
|
1912
|
+
case "TSInstantiationExpression":
|
|
1913
|
+
return n === "object" && R(s);
|
|
1914
|
+
case "MatchOrPattern":
|
|
1915
|
+
return s.type === "MatchAsPattern";
|
|
1916
|
+
}
|
|
1917
|
+
return false;
|
|
1918
|
+
}
|
|
1919
|
+
var Pc = b(["BlockStatement", "BreakStatement", "ComponentDeclaration", "ClassBody", "ClassDeclaration", "ClassMethod", "ClassProperty", "PropertyDefinition", "ClassPrivateProperty", "ContinueStatement", "DebuggerStatement", "DeclareComponent", "DeclareClass", "DeclareExportAllDeclaration", "DeclareExportDeclaration", "DeclareFunction", "DeclareHook", "DeclareInterface", "DeclareModule", "DeclareModuleExports", "DeclareNamespace", "DeclareVariable", "DeclareEnum", "DoWhileStatement", "EnumDeclaration", "ExportAllDeclaration", "ExportDefaultDeclaration", "ExportNamedDeclaration", "ExpressionStatement", "ForInStatement", "ForOfStatement", "ForStatement", "FunctionDeclaration", "HookDeclaration", "IfStatement", "ImportDeclaration", "InterfaceDeclaration", "LabeledStatement", "MethodDefinition", "ReturnStatement", "SwitchStatement", "ThrowStatement", "TryStatement", "TSDeclareFunction", "TSEnumDeclaration", "TSImportEqualsDeclaration", "TSInterfaceDeclaration", "TSModuleDeclaration", "TSNamespaceExportDeclaration", "TypeAlias", "VariableDeclaration", "WhileStatement", "WithStatement"]);
|
|
1920
|
+
function kc(e) {
|
|
1921
|
+
let t = 0, { node: r } = e;
|
|
1922
|
+
for (; r; ) {
|
|
1923
|
+
let n = e.getParentNode(t++);
|
|
1924
|
+
if (n?.type === "ForStatement" && n.init === r) return true;
|
|
1925
|
+
r = n;
|
|
1926
|
+
}
|
|
1927
|
+
return false;
|
|
1928
|
+
}
|
|
1929
|
+
function Ic(e) {
|
|
1930
|
+
return Dr(e, (t) => t.type === "ObjectTypeAnnotation" && Dr(t, (r) => r.type === "FunctionTypeAnnotation"));
|
|
1931
|
+
}
|
|
1932
|
+
function Lc(e) {
|
|
1933
|
+
return ie(e);
|
|
1934
|
+
}
|
|
1935
|
+
function Cr(e) {
|
|
1936
|
+
let { parent: t, key: r } = e;
|
|
1937
|
+
switch (t.type) {
|
|
1938
|
+
case "NGPipeExpression":
|
|
1939
|
+
if (r === "arguments" && e.isLast) return e.callParent(Cr);
|
|
1940
|
+
break;
|
|
1941
|
+
case "ObjectProperty":
|
|
1942
|
+
if (r === "value") return e.callParent(() => e.key === "properties" && e.isLast);
|
|
1943
|
+
break;
|
|
1944
|
+
case "BinaryExpression":
|
|
1945
|
+
case "LogicalExpression":
|
|
1946
|
+
if (r === "right") return e.callParent(Cr);
|
|
1947
|
+
break;
|
|
1948
|
+
case "ConditionalExpression":
|
|
1949
|
+
if (r === "alternate") return e.callParent(Cr);
|
|
1950
|
+
break;
|
|
1951
|
+
case "UnaryExpression":
|
|
1952
|
+
if (t.prefix) return e.callParent(Cr);
|
|
1953
|
+
break;
|
|
1954
|
+
}
|
|
1955
|
+
return false;
|
|
1956
|
+
}
|
|
1957
|
+
function Pu(e, t) {
|
|
1958
|
+
let { node: r, parent: n } = e;
|
|
1959
|
+
return r.type === "FunctionExpression" || r.type === "ClassExpression" ? n.type === "ExportDefaultDeclaration" || !ds(e, t) : !Ut(r) || n.type !== "ExportDefaultDeclaration" && ds(e, t) ? false : e.call(() => Pu(e, t), ..._r(r));
|
|
1960
|
+
}
|
|
1961
|
+
function Oc(e) {
|
|
1962
|
+
return !!(e.match(void 0, (t, r) => r === "expression" && t.type === "ChainExpression", (t, r) => r === "tag" && t.type === "TaggedTemplateExpression") || e.match((t) => t.type === "OptionalCallExpression" || t.type === "OptionalMemberExpression", (t, r) => r === "tag" && t.type === "TaggedTemplateExpression") || e.match((t) => t.type === "OptionalCallExpression" || t.type === "OptionalMemberExpression", (t, r) => r === "expression" && t.type === "TSNonNullExpression", (t, r) => r === "tag" && t.type === "TaggedTemplateExpression") || e.match(void 0, (t, r) => r === "expression" && t.type === "ChainExpression", (t, r) => r === "expression" && t.type === "TSNonNullExpression", (t, r) => r === "tag" && t.type === "TaggedTemplateExpression") || e.match(void 0, (t, r) => r === "expression" && t.type === "TSNonNullExpression", (t, r) => r === "expression" && t.type === "ChainExpression", (t, r) => r === "tag" && t.type === "TaggedTemplateExpression") || e.match((t) => t.type === "OptionalMemberExpression" || t.type === "OptionalCallExpression", (t, r) => r === "object" && t.type === "MemberExpression" || r === "callee" && (t.type === "CallExpression" || t.type === "NewExpression")) || e.match((t) => t.type === "OptionalMemberExpression" || t.type === "OptionalCallExpression", (t, r) => r === "expression" && t.type === "TSNonNullExpression", (t, r) => r === "object" && t.type === "MemberExpression" || r === "callee" && t.type === "CallExpression") || e.match((t) => t.type === "CallExpression" || t.type === "MemberExpression", (t, r) => r === "expression" && t.type === "ChainExpression") && (e.match(void 0, void 0, (t, r) => r === "callee" && (t.type === "CallExpression" && !t.optional || t.type === "NewExpression") || r === "object" && t.type === "MemberExpression" && !t.optional) || e.match(void 0, void 0, (t, r) => r === "expression" && t.type === "TSNonNullExpression", (t, r) => r === "object" && t.type === "MemberExpression" || r === "callee" && t.type === "CallExpression")) || e.match((t) => t.type === "CallExpression" || t.type === "MemberExpression", (t, r) => r === "expression" && t.type === "TSNonNullExpression", (t, r) => r === "expression" && t.type === "ChainExpression", (t, r) => r === "object" && t.type === "MemberExpression" || r === "callee" && t.type === "CallExpression"));
|
|
1963
|
+
}
|
|
1964
|
+
function Cs(e) {
|
|
1965
|
+
return e.type === "Identifier" ? true : R(e) ? !e.computed && !e.optional && e.property.type === "Identifier" && Cs(e.object) : false;
|
|
1966
|
+
}
|
|
1967
|
+
function wc(e) {
|
|
1968
|
+
return e.type === "ChainExpression" && (e = e.expression), Cs(e) || M(e) && !e.optional && Cs(e.callee);
|
|
1969
|
+
}
|
|
1970
|
+
var he = ds;
|
|
1971
|
+
function Mc(e, t) {
|
|
1972
|
+
let r = t - 1;
|
|
1973
|
+
r = Qe(e, r, { backwards: true }), r = ze(e, r, { backwards: true }), r = Qe(e, r, { backwards: true });
|
|
1974
|
+
let n = ze(e, r, { backwards: true });
|
|
1975
|
+
return r !== n;
|
|
1976
|
+
}
|
|
1977
|
+
var ku = Mc;
|
|
1978
|
+
var _c = () => true;
|
|
1979
|
+
function As(e, t) {
|
|
1980
|
+
let r = e.node;
|
|
1981
|
+
return r.printed = true, t.printer.printComment(e, t);
|
|
1982
|
+
}
|
|
1983
|
+
function Nc(e, t) {
|
|
1984
|
+
let r = e.node, n = [As(e, t)], { printer: s, originalText: i, locStart: u, locEnd: o } = t;
|
|
1985
|
+
if (s.isBlockComment?.(r)) {
|
|
1986
|
+
let D = Q(i, o(r)) ? Q(i, u(r), { backwards: true }) ? y : A : " ";
|
|
1987
|
+
n.push(D);
|
|
1988
|
+
} else n.push(y);
|
|
1989
|
+
let p = ze(i, Qe(i, o(r)));
|
|
1990
|
+
return p !== false && Q(i, p) && n.push(y), n;
|
|
1991
|
+
}
|
|
1992
|
+
function vc(e, t, r) {
|
|
1993
|
+
let n = e.node, s = As(e, t), { printer: i, originalText: u, locStart: o } = t, a = i.isBlockComment?.(n);
|
|
1994
|
+
if (r?.hasLineSuffix && !r?.isBlock || Q(u, o(n), { backwards: true })) {
|
|
1995
|
+
let p = ku(u, o(n));
|
|
1996
|
+
return { doc: Kn([y, p ? y : "", s]), isBlock: a, hasLineSuffix: true };
|
|
1997
|
+
}
|
|
1998
|
+
return !a || r?.hasLineSuffix ? { doc: [Kn([" ", s]), Te], isBlock: a, hasLineSuffix: true } : { doc: [" ", s], isBlock: a, hasLineSuffix: false };
|
|
1999
|
+
}
|
|
2000
|
+
function v(e, t, r = {}) {
|
|
2001
|
+
let { node: n } = e;
|
|
2002
|
+
if (!j(n?.comments)) return "";
|
|
2003
|
+
let { indent: s = false, marker: i, filter: u = _c } = r, o = [];
|
|
2004
|
+
if (e.each(({ node: p }) => {
|
|
2005
|
+
p.leading || p.trailing || p.marker !== i || !u(p) || o.push(As(e, t));
|
|
2006
|
+
}, "comments"), o.length === 0) return "";
|
|
2007
|
+
let a = I(y, o);
|
|
2008
|
+
return s ? m([y, a]) : a;
|
|
2009
|
+
}
|
|
2010
|
+
function Mt(e, t) {
|
|
2011
|
+
let r = e.node;
|
|
2012
|
+
if (!r) return {};
|
|
2013
|
+
let n = t[Symbol.for("printedComments")];
|
|
2014
|
+
if ((r.comments || []).filter((a) => !n.has(a)).length === 0) return { leading: "", trailing: "" };
|
|
2015
|
+
let i = [], u = [], o;
|
|
2016
|
+
return e.each(() => {
|
|
2017
|
+
let a = e.node;
|
|
2018
|
+
if (n?.has(a)) return;
|
|
2019
|
+
let { leading: p, trailing: D } = a;
|
|
2020
|
+
p ? i.push(Nc(e, t)) : D && (o = vc(e, t, o), u.push(o.doc));
|
|
2021
|
+
}, "comments"), { leading: i, trailing: u };
|
|
2022
|
+
}
|
|
2023
|
+
function me(e, t, r) {
|
|
2024
|
+
let { leading: n, trailing: s } = Mt(e, r);
|
|
2025
|
+
return !n && !s ? t : Fr(t, (i) => [n, i, s]);
|
|
2026
|
+
}
|
|
2027
|
+
var Ts = class extends Error {
|
|
2028
|
+
name = "UnexpectedNodeError";
|
|
2029
|
+
constructor(t, r, n = "type") {
|
|
2030
|
+
super(`Unexpected ${r} node ${n}: ${JSON.stringify(t[n])}.`), this.node = t;
|
|
2031
|
+
}
|
|
2032
|
+
}, $e = Ts;
|
|
2033
|
+
function xs(e) {
|
|
2034
|
+
if (typeof e != "string") throw new TypeError("Expected a string");
|
|
2035
|
+
return e.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
|
2036
|
+
}
|
|
2037
|
+
var gs = class {
|
|
2038
|
+
#e;
|
|
2039
|
+
constructor(t) {
|
|
2040
|
+
this.#e = new Set(t);
|
|
2041
|
+
}
|
|
2042
|
+
getLeadingWhitespaceCount(t) {
|
|
2043
|
+
let r = this.#e, n = 0;
|
|
2044
|
+
for (let s = 0; s < t.length && r.has(t.charAt(s)); s++) n++;
|
|
2045
|
+
return n;
|
|
2046
|
+
}
|
|
2047
|
+
getTrailingWhitespaceCount(t) {
|
|
2048
|
+
let r = this.#e, n = 0;
|
|
2049
|
+
for (let s = t.length - 1; s >= 0 && r.has(t.charAt(s)); s--) n++;
|
|
2050
|
+
return n;
|
|
2051
|
+
}
|
|
2052
|
+
getLeadingWhitespace(t) {
|
|
2053
|
+
let r = this.getLeadingWhitespaceCount(t);
|
|
2054
|
+
return t.slice(0, r);
|
|
2055
|
+
}
|
|
2056
|
+
getTrailingWhitespace(t) {
|
|
2057
|
+
let r = this.getTrailingWhitespaceCount(t);
|
|
2058
|
+
return t.slice(t.length - r);
|
|
2059
|
+
}
|
|
2060
|
+
hasLeadingWhitespace(t) {
|
|
2061
|
+
return this.#e.has(t.charAt(0));
|
|
2062
|
+
}
|
|
2063
|
+
hasTrailingWhitespace(t) {
|
|
2064
|
+
return this.#e.has(_(0, t, -1));
|
|
2065
|
+
}
|
|
2066
|
+
trimStart(t) {
|
|
2067
|
+
let r = this.getLeadingWhitespaceCount(t);
|
|
2068
|
+
return t.slice(r);
|
|
2069
|
+
}
|
|
2070
|
+
trimEnd(t) {
|
|
2071
|
+
let r = this.getTrailingWhitespaceCount(t);
|
|
2072
|
+
return t.slice(0, t.length - r);
|
|
2073
|
+
}
|
|
2074
|
+
trim(t) {
|
|
2075
|
+
return this.trimEnd(this.trimStart(t));
|
|
2076
|
+
}
|
|
2077
|
+
split(t, r = false) {
|
|
2078
|
+
let n = `[${xs([...this.#e].join(""))}]+`, s = new RegExp(r ? `(${n})` : n, "u");
|
|
2079
|
+
return t.split(s);
|
|
2080
|
+
}
|
|
2081
|
+
hasWhitespaceCharacter(t) {
|
|
2082
|
+
let r = this.#e;
|
|
2083
|
+
return Array.prototype.some.call(t, (n) => r.has(n));
|
|
2084
|
+
}
|
|
2085
|
+
hasNonWhitespaceCharacter(t) {
|
|
2086
|
+
let r = this.#e;
|
|
2087
|
+
return Array.prototype.some.call(t, (n) => !r.has(n));
|
|
2088
|
+
}
|
|
2089
|
+
isWhitespaceOnly(t) {
|
|
2090
|
+
let r = this.#e;
|
|
2091
|
+
return Array.prototype.every.call(t, (n) => r.has(n));
|
|
2092
|
+
}
|
|
2093
|
+
#t(t) {
|
|
2094
|
+
let r = Number.POSITIVE_INFINITY;
|
|
2095
|
+
for (let n of t.split(`
|
|
2096
|
+
`)) {
|
|
2097
|
+
if (n.length === 0) continue;
|
|
2098
|
+
let s = this.getLeadingWhitespaceCount(n);
|
|
2099
|
+
if (s === 0) return 0;
|
|
2100
|
+
n.length !== s && s < r && (r = s);
|
|
2101
|
+
}
|
|
2102
|
+
return r === Number.POSITIVE_INFINITY ? 0 : r;
|
|
2103
|
+
}
|
|
2104
|
+
dedentString(t) {
|
|
2105
|
+
let r = this.#t(t);
|
|
2106
|
+
return r === 0 ? t : t.split(`
|
|
2107
|
+
`).map((n) => n.slice(r)).join(`
|
|
2108
|
+
`);
|
|
2109
|
+
}
|
|
2110
|
+
}, Iu = gs;
|
|
2111
|
+
var Zr = new Iu(`
|
|
2112
|
+
\r `), hs = (e) => e === "" || e === A || e === y || e === f;
|
|
2113
|
+
function jc(e, t, r) {
|
|
2114
|
+
let { node: n } = e;
|
|
2115
|
+
if (n.type === "JSXElement" && Zc(n)) return [r("openingElement"), r("closingElement")];
|
|
2116
|
+
let s = n.type === "JSXElement" ? r("openingElement") : r("openingFragment"), i = n.type === "JSXElement" ? r("closingElement") : r("closingFragment");
|
|
2117
|
+
if (n.children.length === 1 && n.children[0].type === "JSXExpressionContainer" && (n.children[0].expression.type === "TemplateLiteral" || n.children[0].expression.type === "TaggedTemplateExpression")) return [s, ...e.map(r, "children"), i];
|
|
2118
|
+
n.children = n.children.map((x) => el(x) ? { type: "JSXText", value: " ", raw: " " } : x);
|
|
2119
|
+
let u = n.children.some(q), o = n.children.filter((x) => x.type === "JSXExpressionContainer").length > 1, a = n.type === "JSXElement" && n.openingElement.attributes.length > 1, p = se(s) || u || a || o, D = e.parent.rootMarker === "mdx", l = t.singleQuote ? "{' '}" : '{" "}', E = D ? A : B([l, f], " "), d = n.openingElement?.name?.name === "fbt", F = Rc(e, t, r, E, d), P = n.children.some((x) => Ar(x));
|
|
2120
|
+
for (let x = F.length - 2; x >= 0; x--) {
|
|
2121
|
+
let h = F[x] === "" && F[x + 1] === "", N = F[x] === y && F[x + 1] === "" && F[x + 2] === y, Y = (F[x] === f || F[x] === y) && F[x + 1] === "" && F[x + 2] === E, De = F[x] === E && F[x + 1] === "" && (F[x + 2] === f || F[x + 2] === y), Fe = F[x] === E && F[x + 1] === "" && F[x + 2] === E, J = F[x] === f && F[x + 1] === "" && F[x + 2] === y || F[x] === y && F[x + 1] === "" && F[x + 2] === f;
|
|
2122
|
+
N && P || h || Y || Fe || J ? F.splice(x, 2) : De && F.splice(x + 1, 2);
|
|
2123
|
+
}
|
|
2124
|
+
for (; F.length > 0 && hs(_(0, F, -1)); ) F.pop();
|
|
2125
|
+
for (; F.length > 1 && hs(F[0]) && hs(F[1]); ) F.shift(), F.shift();
|
|
2126
|
+
let S = [""];
|
|
2127
|
+
for (let [x, h] of F.entries()) {
|
|
2128
|
+
if (h === E) {
|
|
2129
|
+
if (x === 1 && ki(F[x - 1])) {
|
|
2130
|
+
if (F.length === 2) {
|
|
2131
|
+
S.push([S.pop(), l]);
|
|
2132
|
+
continue;
|
|
2133
|
+
}
|
|
2134
|
+
S.push([l, y], "");
|
|
2135
|
+
continue;
|
|
2136
|
+
} else if (x === F.length - 1) {
|
|
2137
|
+
S.push([S.pop(), l]);
|
|
2138
|
+
continue;
|
|
2139
|
+
} else if (F[x - 1] === "" && F[x - 2] === y) {
|
|
2140
|
+
S.push([S.pop(), l]);
|
|
2141
|
+
continue;
|
|
2142
|
+
}
|
|
2143
|
+
}
|
|
2144
|
+
x % 2 === 0 ? S.push([S.pop(), h]) : S.push(h, ""), se(h) && (p = true);
|
|
2145
|
+
}
|
|
2146
|
+
let O = P ? Hr(S) : c(S, { shouldBreak: true });
|
|
2147
|
+
if (t.cursorNode?.type === "JSXText" && n.children.includes(t.cursorNode) ? O = [dr, O, dr] : t.nodeBeforeCursor?.type === "JSXText" && n.children.includes(t.nodeBeforeCursor) ? O = [dr, O] : t.nodeAfterCursor?.type === "JSXText" && n.children.includes(t.nodeAfterCursor) && (O = [O, dr]), D) return O;
|
|
2148
|
+
let g = c([s, m([y, O]), y, i]);
|
|
2149
|
+
return p ? g : rt([c([s, ...F, i]), g]);
|
|
2150
|
+
}
|
|
2151
|
+
function Rc(e, t, r, n, s) {
|
|
2152
|
+
let i = "", u = [i];
|
|
2153
|
+
function o(p) {
|
|
2154
|
+
i = p, u.push([u.pop(), p]);
|
|
2155
|
+
}
|
|
2156
|
+
function a(p) {
|
|
2157
|
+
p !== "" && (i = p, u.push(p, ""));
|
|
2158
|
+
}
|
|
2159
|
+
return e.each(({ node: p, next: D }) => {
|
|
2160
|
+
if (p.type === "JSXText") {
|
|
2161
|
+
let l = pe(p);
|
|
2162
|
+
if (Ar(p)) {
|
|
2163
|
+
let E = Zr.split(l, true);
|
|
2164
|
+
E[0] === "" && (E.shift(), /\n/u.test(E[0]) ? a(Ou(s, E[1], p, D)) : a(n), E.shift());
|
|
2165
|
+
let d;
|
|
2166
|
+
if (_(0, E, -1) === "" && (E.pop(), d = E.pop()), E.length === 0) return;
|
|
2167
|
+
for (let [F, P] of E.entries()) F % 2 === 1 ? a(A) : o(P);
|
|
2168
|
+
d !== void 0 ? /\n/u.test(d) ? a(Ou(s, i, p, D)) : a(n) : a(Lu(s, i, p, D));
|
|
2169
|
+
} else /\n/u.test(l) ? l.match(/\n/gu).length > 1 && a(y) : a(n);
|
|
2170
|
+
} else {
|
|
2171
|
+
let l = r();
|
|
2172
|
+
if (o(l), D && Ar(D)) {
|
|
2173
|
+
let d = Zr.trim(pe(D)), [F] = Zr.split(d);
|
|
2174
|
+
a(Lu(s, F, p, D));
|
|
2175
|
+
} else a(y);
|
|
2176
|
+
}
|
|
2177
|
+
}, "children"), u;
|
|
2178
|
+
}
|
|
2179
|
+
function Lu(e, t, r, n) {
|
|
2180
|
+
return e ? "" : r.type === "JSXElement" && !r.closingElement || n?.type === "JSXElement" && !n.closingElement ? t.length === 1 ? f : y : f;
|
|
2181
|
+
}
|
|
2182
|
+
function Ou(e, t, r, n) {
|
|
2183
|
+
return e ? y : t.length === 1 ? r.type === "JSXElement" && !r.closingElement || n?.type === "JSXElement" && !n.closingElement ? y : f : y;
|
|
2184
|
+
}
|
|
2185
|
+
var Jc = b(["ArrayExpression", "JSXAttribute", "JSXElement", "JSXExpressionContainer", "JSXFragment", "ExpressionStatement", "NewExpression", "CallExpression", "OptionalCallExpression", "ConditionalExpression", "JsExpressionRoot", "MatchExpressionCase"]);
|
|
2186
|
+
function Gc(e, t, r) {
|
|
2187
|
+
let { parent: n } = e;
|
|
2188
|
+
if (Jc(n)) return t;
|
|
2189
|
+
let s = Wc(e), i = he(e, r);
|
|
2190
|
+
return c([i ? "" : B("("), m([f, t]), f, i ? "" : B(")")], { shouldBreak: s });
|
|
2191
|
+
}
|
|
2192
|
+
function Wc(e) {
|
|
2193
|
+
return e.match(void 0, (t, r) => r === "body" && t.type === "ArrowFunctionExpression", (t, r) => r === "arguments" && M(t)) && (e.match(void 0, void 0, void 0, (t, r) => r === "expression" && t.type === "JSXExpressionContainer") || e.match(void 0, void 0, void 0, (t, r) => r === "expression" && t.type === "ChainExpression", (t, r) => r === "expression" && t.type === "JSXExpressionContainer"));
|
|
2194
|
+
}
|
|
2195
|
+
function qc(e, t, r) {
|
|
2196
|
+
let { node: n } = e, s = [r("name")];
|
|
2197
|
+
if (n.value) {
|
|
2198
|
+
let i;
|
|
2199
|
+
if (X(n.value)) {
|
|
2200
|
+
let u = pe(n.value), o = G(0, G(0, u.slice(1, -1), "'", "'"), """, '"'), a = kr(o, t.jsxSingleQuote);
|
|
2201
|
+
o = a === '"' ? G(0, o, '"', """) : G(0, o, "'", "'"), i = e.call(() => me(e, Ge(a + o + a), t), "value");
|
|
2202
|
+
} else i = r("value");
|
|
2203
|
+
s.push("=", i);
|
|
2204
|
+
}
|
|
2205
|
+
return s;
|
|
2206
|
+
}
|
|
2207
|
+
function Yc(e, t, r) {
|
|
2208
|
+
let { node: n } = e, s = (i, u) => i.type === "JSXEmptyExpression" || !C(i) && (W(i) || ie(i) || i.type === "ArrowFunctionExpression" || i.type === "AwaitExpression" && (s(i.argument, i) || i.argument.type === "JSXElement") || M(i) || i.type === "ChainExpression" && M(i.expression) || i.type === "FunctionExpression" || i.type === "TemplateLiteral" || i.type === "TaggedTemplateExpression" || i.type === "DoExpression" || q(u) && (i.type === "ConditionalExpression" || xe(i)));
|
|
2209
|
+
return s(n.expression, e.parent) ? c(["{", r("expression"), we, "}"]) : c(["{", m([f, r("expression")]), f, we, "}"]);
|
|
2210
|
+
}
|
|
2211
|
+
function Uc(e, t, r) {
|
|
2212
|
+
let { node: n } = e, s = C(n.name) || C(n.typeArguments);
|
|
2213
|
+
if (n.selfClosing && n.attributes.length === 0 && !s) return ["<", r("name"), r("typeArguments"), " />"];
|
|
2214
|
+
if (n.attributes?.length === 1 && X(n.attributes[0].value) && !n.attributes[0].value.value.includes(`
|
|
2215
|
+
`) && !s && !C(n.attributes[0])) return c(["<", r("name"), r("typeArguments"), " ", ...e.map(r, "attributes"), n.selfClosing ? " />" : ">"]);
|
|
2216
|
+
let i = n.attributes?.some((o) => X(o.value) && o.value.value.includes(`
|
|
2217
|
+
`)), u = t.singleAttributePerLine && n.attributes.length > 1 ? y : A;
|
|
2218
|
+
return c(["<", r("name"), r("typeArguments"), m(e.map(() => [u, r()], "attributes")), ...Hc(n, t, s)], { shouldBreak: i });
|
|
2219
|
+
}
|
|
2220
|
+
function Hc(e, t, r) {
|
|
2221
|
+
return e.selfClosing ? [A, "/>"] : Xc(e, t, r) ? [">"] : [f, ">"];
|
|
2222
|
+
}
|
|
2223
|
+
function Xc(e, t, r) {
|
|
2224
|
+
let n = e.attributes.length > 0 && C(_(0, e.attributes, -1), T.Trailing);
|
|
2225
|
+
return e.attributes.length === 0 && !r || (t.bracketSameLine || t.jsxBracketSameLine) && (!r || e.attributes.length > 0) && !n;
|
|
2226
|
+
}
|
|
2227
|
+
function Vc(e, t, r) {
|
|
2228
|
+
let { node: n } = e, s = ["</"], i = r("name");
|
|
2229
|
+
return C(n.name, T.Leading | T.Line) ? s.push(m([y, i]), y) : C(n.name, T.Leading | T.Block) ? s.push(" ", i) : s.push(i), s.push(">"), s;
|
|
2230
|
+
}
|
|
2231
|
+
function $c(e, t) {
|
|
2232
|
+
let { node: r } = e, n = C(r), s = C(r, T.Line), i = r.type === "JSXOpeningFragment";
|
|
2233
|
+
return [i ? "<" : "</", m([s ? y : n && !i ? " " : "", v(e, t)]), s ? y : "", ">"];
|
|
2234
|
+
}
|
|
2235
|
+
function Kc(e, t, r) {
|
|
2236
|
+
let n = me(e, jc(e, t, r), t);
|
|
2237
|
+
return Gc(e, n, t);
|
|
2238
|
+
}
|
|
2239
|
+
function Qc(e, t) {
|
|
2240
|
+
let { node: r } = e, n = C(r, T.Line);
|
|
2241
|
+
return [v(e, t, { indent: n }), n ? y : ""];
|
|
2242
|
+
}
|
|
2243
|
+
function zc(e, t, r) {
|
|
2244
|
+
let { node: n } = e;
|
|
2245
|
+
return ["{", e.call(({ node: s }) => {
|
|
2246
|
+
let i = ["...", r()];
|
|
2247
|
+
return C(s) ? [m([f, me(e, i, t)]), f] : i;
|
|
2248
|
+
}, n.type === "JSXSpreadAttribute" ? "argument" : "expression"), "}"];
|
|
2249
|
+
}
|
|
2250
|
+
function wu(e, t, r) {
|
|
2251
|
+
let { node: n } = e;
|
|
2252
|
+
if (n.type.startsWith("JSX")) switch (n.type) {
|
|
2253
|
+
case "JSXAttribute":
|
|
2254
|
+
return qc(e, t, r);
|
|
2255
|
+
case "JSXIdentifier":
|
|
2256
|
+
return n.name;
|
|
2257
|
+
case "JSXNamespacedName":
|
|
2258
|
+
return I(":", [r("namespace"), r("name")]);
|
|
2259
|
+
case "JSXMemberExpression":
|
|
2260
|
+
return I(".", [r("object"), r("property")]);
|
|
2261
|
+
case "JSXSpreadAttribute":
|
|
2262
|
+
case "JSXSpreadChild":
|
|
2263
|
+
return zc(e, t, r);
|
|
2264
|
+
case "JSXExpressionContainer":
|
|
2265
|
+
return Yc(e, t, r);
|
|
2266
|
+
case "JSXFragment":
|
|
2267
|
+
case "JSXElement":
|
|
2268
|
+
return Kc(e, t, r);
|
|
2269
|
+
case "JSXOpeningElement":
|
|
2270
|
+
return Uc(e, t, r);
|
|
2271
|
+
case "JSXClosingElement":
|
|
2272
|
+
return Vc(e, t, r);
|
|
2273
|
+
case "JSXOpeningFragment":
|
|
2274
|
+
case "JSXClosingFragment":
|
|
2275
|
+
return $c(e, t);
|
|
2276
|
+
case "JSXEmptyExpression":
|
|
2277
|
+
return Qc(e, t);
|
|
2278
|
+
case "JSXText":
|
|
2279
|
+
throw new Error("JSXText should be handled by JSXElement");
|
|
2280
|
+
default:
|
|
2281
|
+
throw new $e(n, "JSX");
|
|
2282
|
+
}
|
|
2283
|
+
}
|
|
2284
|
+
function Zc(e) {
|
|
2285
|
+
if (e.children.length === 0) return true;
|
|
2286
|
+
if (e.children.length > 1) return false;
|
|
2287
|
+
let t = e.children[0];
|
|
2288
|
+
return t.type === "JSXText" && !Ar(t);
|
|
2289
|
+
}
|
|
2290
|
+
function Ar(e) {
|
|
2291
|
+
return e.type === "JSXText" && (Zr.hasNonWhitespaceCharacter(pe(e)) || !/\n/u.test(pe(e)));
|
|
2292
|
+
}
|
|
2293
|
+
function el(e) {
|
|
2294
|
+
return e.type === "JSXExpressionContainer" && X(e.expression) && e.expression.value === " " && !C(e.expression);
|
|
2295
|
+
}
|
|
2296
|
+
function Mu(e) {
|
|
2297
|
+
let { node: t, parent: r } = e;
|
|
2298
|
+
if (!q(t) || !q(r)) return false;
|
|
2299
|
+
let { index: n, siblings: s } = e, i;
|
|
2300
|
+
for (let u = n; u > 0; u--) {
|
|
2301
|
+
let o = s[u - 1];
|
|
2302
|
+
if (!(o.type === "JSXText" && !Ar(o))) {
|
|
2303
|
+
i = o;
|
|
2304
|
+
break;
|
|
2305
|
+
}
|
|
2306
|
+
}
|
|
2307
|
+
return i?.type === "JSXExpressionContainer" && i.expression.type === "JSXEmptyExpression" && It(i.expression);
|
|
2308
|
+
}
|
|
2309
|
+
function tl(e) {
|
|
2310
|
+
return It(e.node) || Mu(e);
|
|
2311
|
+
}
|
|
2312
|
+
var Qt = tl;
|
|
2313
|
+
var rl = 0;
|
|
2314
|
+
function en(e, t, r) {
|
|
2315
|
+
let { node: n, parent: s, grandparent: i, key: u } = e, o = u !== "body" && (s.type === "IfStatement" || s.type === "WhileStatement" || s.type === "SwitchStatement" || s.type === "DoWhileStatement"), a = n.operator === "|>" && e.root.extra?.__isUsingHackPipeline, p = Ss(e, t, r, false, o);
|
|
2316
|
+
if (o) return p;
|
|
2317
|
+
if (a) return c(p);
|
|
2318
|
+
if (u === "callee" && (M(s) || s.type === "NewExpression") || s.type === "UnaryExpression" || R(s) && !s.computed) return c([m([f, ...p]), f]);
|
|
2319
|
+
let D = s.type === "ReturnStatement" || s.type === "ThrowStatement" || s.type === "JSXExpressionContainer" && i.type === "JSXAttribute" || n.operator !== "|" && s.type === "JsExpressionRoot" || n.type !== "NGPipeExpression" && (s.type === "NGRoot" && t.parser === "__ng_binding" || s.type === "NGMicrosyntaxExpression" && i.type === "NGMicrosyntax" && i.body.length === 1) || n === s.body && s.type === "ArrowFunctionExpression" || n !== s.body && s.type === "ForStatement" || s.type === "ConditionalExpression" && i.type !== "ReturnStatement" && i.type !== "ThrowStatement" && !M(i) && i.type !== "NewExpression" || s.type === "TemplateLiteral" || sl(e), l = s.type === "AssignmentExpression" || s.type === "VariableDeclarator" || s.type === "ClassProperty" || s.type === "PropertyDefinition" || s.type === "TSAbstractPropertyDefinition" || s.type === "ClassPrivateProperty" || ke(s), E = xe(n.left) && yr(n.operator, n.left.operator);
|
|
2320
|
+
if (D || zt(n) && !E || !zt(n) && l) return c(p);
|
|
2321
|
+
if (p.length === 0) return "";
|
|
2322
|
+
let d = q(n.right), F = p.findIndex((h) => typeof h != "string" && !Array.isArray(h) && h.type === ye), P = p.slice(0, F === -1 ? 1 : F + 1), S = p.slice(P.length, d ? -1 : void 0), O = Symbol("logicalChain-" + ++rl), g = c([...P, m(S)], { id: O });
|
|
2323
|
+
if (!d) return g;
|
|
2324
|
+
let x = _(0, p, -1);
|
|
2325
|
+
return c([g, ft(x, { groupId: O })]);
|
|
2326
|
+
}
|
|
2327
|
+
function Ss(e, t, r, n, s) {
|
|
2328
|
+
let { node: i } = e;
|
|
2329
|
+
if (!xe(i)) return [c(r())];
|
|
2330
|
+
let u = [];
|
|
2331
|
+
yr(i.operator, i.left.operator) ? u = e.call(() => Ss(e, t, r, true, s), "left") : u.push(c(r("left")));
|
|
2332
|
+
let o = zt(i), a = i.right.type === "ChainExpression" ? i.right.expression : i.right, p = (i.operator === "|>" || i.type === "NGPipeExpression" || nl(e, t)) && !Ce(t.originalText, a), l = !C(a, T.Leading, Vr) && Ce(t.originalText, a), E = i.type === "NGPipeExpression" ? "|" : i.operator, d = i.type === "NGPipeExpression" && i.arguments.length > 0 ? c(m([f, ": ", I([A, ": "], e.map(() => ge(2, c(r())), "arguments"))])) : "", F;
|
|
2333
|
+
if (o) F = [E, Ce(t.originalText, a) ? m([A, r("right"), d]) : [" ", r("right"), d]];
|
|
2334
|
+
else {
|
|
2335
|
+
let x = E === "|>" && e.root.extra?.__isUsingHackPipeline ? e.call(() => Ss(e, t, r, true, s), "right") : r("right");
|
|
2336
|
+
if (t.experimentalOperatorPosition === "start") {
|
|
2337
|
+
let h = "";
|
|
2338
|
+
if (l) switch (Je(x)) {
|
|
2339
|
+
case Se:
|
|
2340
|
+
h = x.splice(0, 1)[0];
|
|
2341
|
+
break;
|
|
2342
|
+
case be:
|
|
2343
|
+
h = x.contents.splice(0, 1)[0];
|
|
2344
|
+
break;
|
|
2345
|
+
}
|
|
2346
|
+
F = [A, h, E, " ", x, d];
|
|
2347
|
+
} else F = [p ? A : "", E, p ? " " : A, x, d];
|
|
2348
|
+
}
|
|
2349
|
+
let { parent: P } = e, S = C(i.left, T.Trailing | T.Line);
|
|
2350
|
+
if ((S || !(s && i.type === "LogicalExpression") && P.type !== i.type && i.left.type !== i.type && i.right.type !== i.type) && (F = c(F, { shouldBreak: S })), t.experimentalOperatorPosition === "start" ? u.push(o || l ? " " : "", F) : u.push(p ? "" : " ", F), n && C(i)) {
|
|
2351
|
+
let g = $t(me(e, u, t));
|
|
2352
|
+
return g.type === Le ? g.parts : Array.isArray(g) ? g : [g];
|
|
2353
|
+
}
|
|
2354
|
+
return u;
|
|
2355
|
+
}
|
|
2356
|
+
function zt(e) {
|
|
2357
|
+
return e.type !== "LogicalExpression" ? false : !!(ie(e.right) && e.right.properties.length > 0 || W(e.right) && e.right.elements.length > 0 || q(e.right));
|
|
2358
|
+
}
|
|
2359
|
+
var _u = (e) => e.type === "BinaryExpression" && e.operator === "|";
|
|
2360
|
+
function nl(e, t) {
|
|
2361
|
+
return (t.parser === "__vue_expression" || t.parser === "__vue_ts_expression") && _u(e.node) && !e.hasAncestor((r) => !_u(r) && r.type !== "JsExpressionRoot");
|
|
2362
|
+
}
|
|
2363
|
+
function sl(e) {
|
|
2364
|
+
if (e.key !== "arguments") return false;
|
|
2365
|
+
let { parent: t } = e;
|
|
2366
|
+
if (!(M(t) && !t.optional && t.arguments.length === 1)) return false;
|
|
2367
|
+
let { callee: r } = t;
|
|
2368
|
+
return r.type === "Identifier" && r.name === "Boolean";
|
|
2369
|
+
}
|
|
2370
|
+
function vu(e, t, r) {
|
|
2371
|
+
let { node: n } = e;
|
|
2372
|
+
if (n.type.startsWith("NG")) switch (n.type) {
|
|
2373
|
+
case "NGRoot":
|
|
2374
|
+
return r("node");
|
|
2375
|
+
case "NGPipeExpression":
|
|
2376
|
+
return en(e, t, r);
|
|
2377
|
+
case "NGChainedExpression":
|
|
2378
|
+
return c(I([";", A], e.map(() => ol(e) ? r() : ["(", r(), ")"], "expressions")));
|
|
2379
|
+
case "NGEmptyExpression":
|
|
2380
|
+
return "";
|
|
2381
|
+
case "NGMicrosyntax":
|
|
2382
|
+
return e.map(() => [e.isFirst ? "" : Nu(e) ? " " : [";", A], r()], "body");
|
|
2383
|
+
case "NGMicrosyntaxKey":
|
|
2384
|
+
return /^[$_a-z][\w$]*(?:-[$_a-z][\w$])*$/iu.test(n.name) ? n.name : JSON.stringify(n.name);
|
|
2385
|
+
case "NGMicrosyntaxExpression":
|
|
2386
|
+
return [r("expression"), n.alias === null ? "" : [" as ", r("alias")]];
|
|
2387
|
+
case "NGMicrosyntaxKeyedExpression": {
|
|
2388
|
+
let { index: s, parent: i } = e, u = Nu(e) || il(e) || (s === 1 && (n.key.name === "then" || n.key.name === "else" || n.key.name === "as") || s === 2 && (n.key.name === "else" && i.body[s - 1].type === "NGMicrosyntaxKeyedExpression" && i.body[s - 1].key.name === "then" || n.key.name === "track")) && i.body[0].type === "NGMicrosyntaxExpression";
|
|
2389
|
+
return [r("key"), u ? " " : ": ", r("expression")];
|
|
2390
|
+
}
|
|
2391
|
+
case "NGMicrosyntaxLet":
|
|
2392
|
+
return ["let ", r("key"), n.value === null ? "" : [" = ", r("value")]];
|
|
2393
|
+
case "NGMicrosyntaxAs":
|
|
2394
|
+
return [r("key"), " as ", r("alias")];
|
|
2395
|
+
default:
|
|
2396
|
+
throw new $e(n, "Angular");
|
|
2397
|
+
}
|
|
2398
|
+
}
|
|
2399
|
+
function Nu({ node: e, index: t }) {
|
|
2400
|
+
return e.type === "NGMicrosyntaxKeyedExpression" && e.key.name === "of" && t === 1;
|
|
2401
|
+
}
|
|
2402
|
+
function il(e) {
|
|
2403
|
+
let { node: t } = e;
|
|
2404
|
+
return e.parent.body[1].key.name === "of" && t.type === "NGMicrosyntaxKeyedExpression" && t.key.name === "track" && t.key.type === "NGMicrosyntaxKey";
|
|
2405
|
+
}
|
|
2406
|
+
var ul = b(["CallExpression", "OptionalCallExpression", "AssignmentExpression"]);
|
|
2407
|
+
function ol({ node: e }) {
|
|
2408
|
+
return Dr(e, ul);
|
|
2409
|
+
}
|
|
2410
|
+
function Bs(e, t, r) {
|
|
2411
|
+
let { node: n } = e;
|
|
2412
|
+
return c([I(A, e.map(r, "decorators")), Ju(n, t) ? y : A]);
|
|
2413
|
+
}
|
|
2414
|
+
function ju(e, t, r) {
|
|
2415
|
+
return Gu(e.node) ? [I(y, e.map(r, "declaration", "decorators")), y] : "";
|
|
2416
|
+
}
|
|
2417
|
+
function Ru(e, t, r) {
|
|
2418
|
+
let { node: n, parent: s } = e, { decorators: i } = n;
|
|
2419
|
+
if (!j(i) || Gu(s) || Qt(e)) return "";
|
|
2420
|
+
let u = n.type === "ClassExpression" || n.type === "ClassDeclaration" || Ju(n, t);
|
|
2421
|
+
return [e.key === "declaration" && ci(s) ? y : u ? Te : "", I(A, e.map(r, "decorators")), A];
|
|
2422
|
+
}
|
|
2423
|
+
function Ju(e, t) {
|
|
2424
|
+
return e.decorators.some((r) => Q(t.originalText, k(r)));
|
|
2425
|
+
}
|
|
2426
|
+
function Gu(e) {
|
|
2427
|
+
if (e.type !== "ExportDefaultDeclaration" && e.type !== "ExportNamedDeclaration" && e.type !== "DeclareExportDeclaration") return false;
|
|
2428
|
+
let t = e.declaration?.decorators;
|
|
2429
|
+
return j(t) && St(e, t[0]);
|
|
2430
|
+
}
|
|
2431
|
+
var yt = class extends Error {
|
|
2432
|
+
name = "ArgExpansionBailout";
|
|
2433
|
+
};
|
|
2434
|
+
function al(e, t, r) {
|
|
2435
|
+
let { node: n } = e, s = ce(n);
|
|
2436
|
+
if (s.length === 0) return ["(", v(e, t), ")"];
|
|
2437
|
+
let i = s.length - 1;
|
|
2438
|
+
if (ll(s)) {
|
|
2439
|
+
let l = ["("];
|
|
2440
|
+
return Xt(e, (E, d) => {
|
|
2441
|
+
l.push(r()), d !== i && l.push(", ");
|
|
2442
|
+
}), l.push(")"), l;
|
|
2443
|
+
}
|
|
2444
|
+
let u = false, o = [];
|
|
2445
|
+
Xt(e, ({ node: l }, E) => {
|
|
2446
|
+
let d = r();
|
|
2447
|
+
E === i || (oe(l, t) ? (u = true, d = [d, ",", y, y]) : d = [d, ",", A]), o.push(d);
|
|
2448
|
+
});
|
|
2449
|
+
let a = !t.parser.startsWith("__ng_") && n.type !== "ImportExpression" && n.type !== "TSImportType" && n.type !== "TSExternalModuleReference" && ue(t, "all") ? "," : "";
|
|
2450
|
+
function p() {
|
|
2451
|
+
return c(["(", m([A, ...o]), a, A, ")"], { shouldBreak: true });
|
|
2452
|
+
}
|
|
2453
|
+
if (u || e.parent.type !== "Decorator" && Ei(s)) return p();
|
|
2454
|
+
if (cl(s)) {
|
|
2455
|
+
let l = o.slice(1);
|
|
2456
|
+
if (l.some(se)) return p();
|
|
2457
|
+
let E;
|
|
2458
|
+
try {
|
|
2459
|
+
E = r(Xn(n, 0), { expandFirstArg: true });
|
|
2460
|
+
} catch (d) {
|
|
2461
|
+
if (d instanceof yt) return p();
|
|
2462
|
+
throw d;
|
|
2463
|
+
}
|
|
2464
|
+
return se(E) ? [Te, rt([["(", c(E, { shouldBreak: true }), ", ", ...l, ")"], p()])] : rt([["(", E, ", ", ...l, ")"], ["(", c(E, { shouldBreak: true }), ", ", ...l, ")"], p()]);
|
|
2465
|
+
}
|
|
2466
|
+
if (pl(s, o, t)) {
|
|
2467
|
+
let l = o.slice(0, -1);
|
|
2468
|
+
if (l.some(se)) return p();
|
|
2469
|
+
let E;
|
|
2470
|
+
try {
|
|
2471
|
+
E = r(Xn(n, -1), { expandLastArg: true });
|
|
2472
|
+
} catch (d) {
|
|
2473
|
+
if (d instanceof yt) return p();
|
|
2474
|
+
throw d;
|
|
2475
|
+
}
|
|
2476
|
+
return se(E) ? [Te, rt([["(", ...l, c(E, { shouldBreak: true }), ")"], p()])] : rt([["(", ...l, E, ")"], ["(", ...l, c(E, { shouldBreak: true }), ")"], p()]);
|
|
2477
|
+
}
|
|
2478
|
+
let D = ["(", m([f, ...o]), B(a), f, ")"];
|
|
2479
|
+
return Jr(e) ? D : c(D, { shouldBreak: o.some(se) || u });
|
|
2480
|
+
}
|
|
2481
|
+
function Tr(e, t = false) {
|
|
2482
|
+
return ie(e) && (e.properties.length > 0 || C(e)) || W(e) && (e.elements.length > 0 || C(e)) || e.type === "TSTypeAssertion" && Tr(e.expression) || Ae(e) && Tr(e.expression) || e.type === "FunctionExpression" || e.type === "ArrowFunctionExpression" && (!e.returnType || !e.returnType.typeAnnotation || e.returnType.typeAnnotation.type !== "TSTypeReference" || ml(e.body)) && (e.body.type === "BlockStatement" || e.body.type === "ArrowFunctionExpression" && Tr(e.body, true) || ie(e.body) || W(e.body) || !t && (M(e.body) || e.body.type === "ConditionalExpression") || q(e.body)) || e.type === "DoExpression" || e.type === "ModuleExpression";
|
|
2483
|
+
}
|
|
2484
|
+
function pl(e, t, r) {
|
|
2485
|
+
let n = _(0, e, -1);
|
|
2486
|
+
if (e.length === 1) {
|
|
2487
|
+
let i = _(0, t, -1);
|
|
2488
|
+
if (i.label?.embed && i.label?.hug !== false) return true;
|
|
2489
|
+
}
|
|
2490
|
+
let s = _(0, e, -2);
|
|
2491
|
+
return !C(n, T.Leading) && !C(n, T.Trailing) && Tr(n) && (!s || s.type !== n.type) && (e.length !== 2 || s.type !== "ArrowFunctionExpression" || !W(n)) && !(e.length > 1 && bs(n, r));
|
|
2492
|
+
}
|
|
2493
|
+
function cl(e) {
|
|
2494
|
+
if (e.length !== 2) return false;
|
|
2495
|
+
let [t, r] = e;
|
|
2496
|
+
return t.type === "ModuleExpression" && Dl(r) ? true : !C(t) && (t.type === "FunctionExpression" || t.type === "ArrowFunctionExpression" && t.body.type === "BlockStatement") && r.type !== "FunctionExpression" && r.type !== "ArrowFunctionExpression" && r.type !== "ConditionalExpression" && qu(r) && !Tr(r);
|
|
2497
|
+
}
|
|
2498
|
+
function qu(e) {
|
|
2499
|
+
if (e.type === "ParenthesizedExpression") return qu(e.expression);
|
|
2500
|
+
if (Ae(e) || e.type === "TypeCastExpression") {
|
|
2501
|
+
let { typeAnnotation: t } = e;
|
|
2502
|
+
if (t.type === "TypeAnnotation" && (t = t.typeAnnotation), t.type === "TSArrayType" && (t = t.elementType, t.type === "TSArrayType" && (t = t.elementType)), t.type === "GenericTypeAnnotation" || t.type === "TSTypeReference") {
|
|
2503
|
+
let r = t.type === "GenericTypeAnnotation" ? t.typeParameters : t.typeArguments;
|
|
2504
|
+
r?.params.length === 1 && (t = r.params[0]);
|
|
2505
|
+
}
|
|
2506
|
+
return Ht(t) && je(e.expression, 1);
|
|
2507
|
+
}
|
|
2508
|
+
return mt(e) && ce(e).length > 1 ? false : xe(e) ? je(e.left, 1) && je(e.right, 1) : Un(e) || je(e);
|
|
2509
|
+
}
|
|
2510
|
+
function ll(e) {
|
|
2511
|
+
return e.length === 2 ? Wu(e, 0) : e.length === 3 ? e[0].type === "Identifier" && Wu(e, 1) : false;
|
|
2512
|
+
}
|
|
2513
|
+
function Wu(e, t) {
|
|
2514
|
+
let r = e[t], n = e[t + 1];
|
|
2515
|
+
return r.type === "ArrowFunctionExpression" && K(r).length === 0 && r.body.type === "BlockStatement" && n.type === "ArrayExpression" && !e.some((s) => C(s));
|
|
2516
|
+
}
|
|
2517
|
+
function ml(e) {
|
|
2518
|
+
return e.type === "BlockStatement" && (e.body.some((t) => t.type !== "EmptyStatement") || C(e, T.Dangling));
|
|
2519
|
+
}
|
|
2520
|
+
function Dl(e) {
|
|
2521
|
+
if (!(e.type === "ObjectExpression" && e.properties.length === 1)) return false;
|
|
2522
|
+
let [t] = e.properties;
|
|
2523
|
+
return ke(t) ? !t.computed && (t.key.type === "Identifier" && t.key.name === "type" || X(t.key) && t.key.value === "type") && X(t.value) && t.value.value === "module" : false;
|
|
2524
|
+
}
|
|
2525
|
+
var xr = al;
|
|
2526
|
+
var fl = (e) => ((e.type === "ChainExpression" || e.type === "TSNonNullExpression") && (e = e.expression), M(e) && ce(e).length > 0);
|
|
2527
|
+
function yl(e) {
|
|
2528
|
+
let { node: t, ancestors: r } = e;
|
|
2529
|
+
for (let n of r) {
|
|
2530
|
+
if (!(R(n) && n.object === t || n.type === "TSNonNullExpression" && n.expression === t)) return n.type === "NewExpression" && n.callee === t;
|
|
2531
|
+
t = n;
|
|
2532
|
+
}
|
|
2533
|
+
return false;
|
|
2534
|
+
}
|
|
2535
|
+
function Yu(e, t, r) {
|
|
2536
|
+
let n = r("object"), s = Ps(e, t, r), { node: i } = e, u = e.findAncestor((p) => !(R(p) || p.type === "TSNonNullExpression")), o = e.findAncestor((p) => !(p.type === "ChainExpression" || p.type === "TSNonNullExpression")), a = u.type === "BindExpression" || u.type === "AssignmentExpression" && u.left.type !== "Identifier" || yl(e) || i.computed || i.object.type === "Identifier" && i.property.type === "Identifier" && !R(o) || (o.type === "AssignmentExpression" || o.type === "VariableDeclarator") && (fl(i.object) || n.label?.memberChain);
|
|
2537
|
+
return ot(n.label, [n, a ? s : c(m([f, s]))]);
|
|
2538
|
+
}
|
|
2539
|
+
function Ps(e, t, r) {
|
|
2540
|
+
let n = r("property"), { node: s } = e, i = $(e);
|
|
2541
|
+
return s.computed ? !s.property || de(s.property) ? [i, "[", n, "]"] : c([i, "[", m([f, n]), f, "]"]) : [i, ".", n];
|
|
2542
|
+
}
|
|
2543
|
+
function Uu(e, t, r) {
|
|
2544
|
+
if (e.node.type === "ChainExpression") return e.call(() => Uu(e, t, r), "expression");
|
|
2545
|
+
let n = (e.parent.type === "ChainExpression" ? e.grandparent : e.parent).type === "ExpressionStatement", s = [];
|
|
2546
|
+
function i(w) {
|
|
2547
|
+
let { originalText: ne } = t, ae = pt(ne, k(w));
|
|
2548
|
+
return ne.charAt(ae) === ")" ? ae !== false && qt(ne, ae + 1) : oe(w, t);
|
|
2549
|
+
}
|
|
2550
|
+
function u() {
|
|
2551
|
+
let { node: w } = e;
|
|
2552
|
+
if (w.type === "ChainExpression") return e.call(u, "expression");
|
|
2553
|
+
if (M(w) && (At(w.callee) || M(w.callee))) {
|
|
2554
|
+
let ne = i(w);
|
|
2555
|
+
s.unshift({ node: w, hasTrailingEmptyLine: ne, printed: [me(e, [$(e), r("typeArguments"), xr(e, t, r)], t), ne ? y : ""] }), e.call(u, "callee");
|
|
2556
|
+
} else At(w) ? (s.unshift({ node: w, needsParens: he(e, t), printed: me(e, R(w) ? Ps(e, t, r) : tn(e, t, r), t) }), e.call(u, "object")) : w.type === "TSNonNullExpression" ? (s.unshift({ node: w, printed: me(e, "!", t) }), e.call(u, "expression")) : s.unshift({ node: w, printed: r() });
|
|
2557
|
+
}
|
|
2558
|
+
let { node: o } = e;
|
|
2559
|
+
s.unshift({ node: o, printed: [$(e), r("typeArguments"), xr(e, t, r)] }), o.callee && e.call(u, "callee");
|
|
2560
|
+
let a = [], p = [s[0]], D = 1;
|
|
2561
|
+
for (; D < s.length && (s[D].node.type === "TSNonNullExpression" || M(s[D].node) || R(s[D].node) && s[D].node.computed && de(s[D].node.property)); ++D) p.push(s[D]);
|
|
2562
|
+
if (!M(s[0].node)) for (; D + 1 < s.length && (At(s[D].node) && At(s[D + 1].node)); ++D) p.push(s[D]);
|
|
2563
|
+
a.push(p), p = [];
|
|
2564
|
+
let l = false;
|
|
2565
|
+
for (; D < s.length; ++D) {
|
|
2566
|
+
if (l && At(s[D].node)) {
|
|
2567
|
+
if (s[D].node.computed && de(s[D].node.property)) {
|
|
2568
|
+
p.push(s[D]);
|
|
2569
|
+
continue;
|
|
2570
|
+
}
|
|
2571
|
+
a.push(p), p = [], l = false;
|
|
2572
|
+
}
|
|
2573
|
+
(M(s[D].node) || s[D].node.type === "ImportExpression") && (l = true), p.push(s[D]), C(s[D].node, T.Trailing) && (a.push(p), p = [], l = false);
|
|
2574
|
+
}
|
|
2575
|
+
p.length > 0 && a.push(p);
|
|
2576
|
+
function E(w) {
|
|
2577
|
+
return /^[A-Z]|^[$_]+$/u.test(w);
|
|
2578
|
+
}
|
|
2579
|
+
function d(w) {
|
|
2580
|
+
return w.length <= t.tabWidth;
|
|
2581
|
+
}
|
|
2582
|
+
function F(w) {
|
|
2583
|
+
let ne = w[1][0]?.node.computed;
|
|
2584
|
+
if (w[0].length === 1) {
|
|
2585
|
+
let st = w[0][0].node;
|
|
2586
|
+
return st.type === "ThisExpression" || st.type === "Identifier" && (E(st.name) || n && d(st.name) || ne);
|
|
2587
|
+
}
|
|
2588
|
+
let ae = _(0, w[0], -1).node;
|
|
2589
|
+
return R(ae) && ae.property.type === "Identifier" && (E(ae.property.name) || ne);
|
|
2590
|
+
}
|
|
2591
|
+
let P = a.length >= 2 && !C(a[1][0].node) && F(a);
|
|
2592
|
+
function S(w) {
|
|
2593
|
+
let ne = w.map((ae) => ae.printed);
|
|
2594
|
+
return w.length > 0 && _(0, w, -1).needsParens ? ["(", ...ne, ")"] : ne;
|
|
2595
|
+
}
|
|
2596
|
+
function O(w) {
|
|
2597
|
+
return w.length === 0 ? "" : m([y, I(y, w.map(S))]);
|
|
2598
|
+
}
|
|
2599
|
+
let g = a.map(S), x = g, h = P ? 3 : 2, N = a.flat(), Y = N.slice(1, -1).some((w) => C(w.node, T.Leading)) || N.slice(0, -1).some((w) => C(w.node, T.Trailing)) || a[h] && C(a[h][0].node, T.Leading);
|
|
2600
|
+
if (a.length <= h && !Y && !a.some((w) => _(0, w, -1).hasTrailingEmptyLine)) return Jr(e) ? x : c(x);
|
|
2601
|
+
let De = _(0, a[P ? 1 : 0], -1).node, Fe = !M(De) && i(De), J = [S(a[0]), P ? a.slice(1, 2).map(S) : "", Fe ? y : "", O(a.slice(P ? 2 : 1))], Z = s.map(({ node: w }) => w).filter(M);
|
|
2602
|
+
function H() {
|
|
2603
|
+
let w = _(0, _(0, a, -1), -1).node, ne = _(0, g, -1);
|
|
2604
|
+
return M(w) && se(ne) && Z.slice(0, -1).some((ae) => ae.arguments.some(Yt));
|
|
2605
|
+
}
|
|
2606
|
+
let nt;
|
|
2607
|
+
return Y || Z.length > 2 && Z.some((w) => !w.arguments.every((ne) => je(ne))) || g.slice(0, -1).some(se) || H() ? nt = c(J) : nt = [se(x) || Fe ? Te : "", rt([x, J])], ot({ memberChain: true }, nt);
|
|
2608
|
+
}
|
|
2609
|
+
var Hu = Uu;
|
|
2610
|
+
function _t(e, t, r) {
|
|
2611
|
+
let { node: n } = e, s = n.type === "NewExpression", i = $(e), u = ce(n), o = n.type !== "TSImportType" && n.typeArguments ? r("typeArguments") : "", a = u.length === 1 && jr(u[0], t.originalText);
|
|
2612
|
+
if (a || Fl(e) || dl(e) || Pt(n, e.parent)) {
|
|
2613
|
+
let l = [];
|
|
2614
|
+
if (Xt(e, () => {
|
|
2615
|
+
l.push(r());
|
|
2616
|
+
}), !(a && l[0].label?.embed)) return [s ? "new " : "", Xu(e, r), i, o, "(", I(", ", l), ")"];
|
|
2617
|
+
}
|
|
2618
|
+
let p = n.type === "ImportExpression" || n.type === "TSImportType" || n.type === "TSExternalModuleReference";
|
|
2619
|
+
if (!p && !s && At(n.callee) && !e.call(() => he(e, t), "callee", ...n.callee.type === "ChainExpression" ? ["expression"] : [])) return Hu(e, t, r);
|
|
2620
|
+
let D = [s ? "new " : "", Xu(e, r), i, o, xr(e, t, r)];
|
|
2621
|
+
return p || M(n.callee) ? c(D) : D;
|
|
2622
|
+
}
|
|
2623
|
+
function Xu(e, t) {
|
|
2624
|
+
let { node: r } = e;
|
|
2625
|
+
return r.type === "ImportExpression" ? `import${r.phase ? `.${r.phase}` : ""}` : r.type === "TSImportType" ? "import" : r.type === "TSExternalModuleReference" ? "require" : t("callee");
|
|
2626
|
+
}
|
|
2627
|
+
var El = ["require", "require.resolve", "require.resolve.paths", "import.meta.resolve"];
|
|
2628
|
+
function Fl(e) {
|
|
2629
|
+
let { node: t } = e;
|
|
2630
|
+
if (!(t.type === "ImportExpression" || t.type === "TSImportType" || t.type === "TSExternalModuleReference" || t.type === "CallExpression" && !t.optional && Bt(t.callee, El))) return false;
|
|
2631
|
+
let r = ce(t);
|
|
2632
|
+
return r.length === 1 && X(r[0]) && !C(r[0]);
|
|
2633
|
+
}
|
|
2634
|
+
function dl(e) {
|
|
2635
|
+
let { node: t } = e;
|
|
2636
|
+
if (t.type !== "CallExpression" || t.optional || t.callee.type !== "Identifier") return false;
|
|
2637
|
+
let r = ce(t);
|
|
2638
|
+
return t.callee.name === "require" ? (r.length === 1 && X(r[0]) || r.length > 1) && !C(r[0]) : t.callee.name === "define" && e.parent.type === "ExpressionStatement" ? r.length === 1 || r.length === 2 && r[0].type === "ArrayExpression" || r.length === 3 && X(r[0]) && r[1].type === "ArrayExpression" : false;
|
|
2639
|
+
}
|
|
2640
|
+
function xt(e, t, r, n, s, i) {
|
|
2641
|
+
let u = Cl(e, t, r, n, i), o = i ? r(i, { assignmentLayout: u }) : "";
|
|
2642
|
+
switch (u) {
|
|
2643
|
+
case "break-after-operator":
|
|
2644
|
+
return c([c(n), s, c(m([A, o]))]);
|
|
2645
|
+
case "never-break-after-operator":
|
|
2646
|
+
return c([c(n), s, " ", o]);
|
|
2647
|
+
case "fluid": {
|
|
2648
|
+
let a = Symbol("assignment");
|
|
2649
|
+
return c([c(n), s, c(m(A), { id: a }), we, ft(o, { groupId: a })]);
|
|
2650
|
+
}
|
|
2651
|
+
case "break-lhs":
|
|
2652
|
+
return c([n, s, " ", c(o)]);
|
|
2653
|
+
case "chain":
|
|
2654
|
+
return [c(n), s, A, o];
|
|
2655
|
+
case "chain-tail":
|
|
2656
|
+
return [c(n), s, m([A, o])];
|
|
2657
|
+
case "chain-tail-arrow-chain":
|
|
2658
|
+
return [c(n), s, o];
|
|
2659
|
+
case "only-left":
|
|
2660
|
+
return n;
|
|
2661
|
+
}
|
|
2662
|
+
}
|
|
2663
|
+
function Ku(e, t, r) {
|
|
2664
|
+
let { node: n } = e;
|
|
2665
|
+
return xt(e, t, r, r("left"), [" ", n.operator], "right");
|
|
2666
|
+
}
|
|
2667
|
+
function Qu(e, t, r) {
|
|
2668
|
+
return xt(e, t, r, r("id"), " =", "init");
|
|
2669
|
+
}
|
|
2670
|
+
function Cl(e, t, r, n, s) {
|
|
2671
|
+
let { node: i } = e, u = i[s];
|
|
2672
|
+
if (!u) return "only-left";
|
|
2673
|
+
let o = !rn(u);
|
|
2674
|
+
if (e.match(rn, zu, (E) => !o || E.type !== "ExpressionStatement" && E.type !== "VariableDeclaration")) return o ? u.type === "ArrowFunctionExpression" && u.body.type === "ArrowFunctionExpression" ? "chain-tail-arrow-chain" : "chain-tail" : "chain";
|
|
2675
|
+
if (!o && rn(u.right) || Ce(t.originalText, u)) return "break-after-operator";
|
|
2676
|
+
if (i.type === "ImportAttribute" || u.type === "CallExpression" && u.callee.name === "require" || t.parser === "json5" || t.parser === "jsonc" || t.parser === "json") return "never-break-after-operator";
|
|
2677
|
+
let D = Pi(n);
|
|
2678
|
+
if (Tl(i) || hl(i) || ks(i) && D) return "break-lhs";
|
|
2679
|
+
let l = Sl(i, n, t);
|
|
2680
|
+
return e.call(() => Al(e, t, r, l), s) ? "break-after-operator" : xl(i) ? "break-lhs" : !D && (l || u.type === "TemplateLiteral" || u.type === "TaggedTemplateExpression" || mi(u) || de(u) || u.type === "ClassExpression") ? "never-break-after-operator" : "fluid";
|
|
2681
|
+
}
|
|
2682
|
+
function Al(e, t, r, n) {
|
|
2683
|
+
let s = e.node;
|
|
2684
|
+
if (xe(s) && !zt(s)) return true;
|
|
2685
|
+
switch (s.type) {
|
|
2686
|
+
case "StringLiteralTypeAnnotation":
|
|
2687
|
+
case "SequenceExpression":
|
|
2688
|
+
return true;
|
|
2689
|
+
case "TSConditionalType":
|
|
2690
|
+
case "ConditionalTypeAnnotation":
|
|
2691
|
+
if (!t.experimentalTernaries && !Pl(s)) break;
|
|
2692
|
+
return true;
|
|
2693
|
+
case "ConditionalExpression": {
|
|
2694
|
+
if (!t.experimentalTernaries) {
|
|
2695
|
+
let { test: p } = s;
|
|
2696
|
+
return xe(p) && !zt(p);
|
|
2697
|
+
}
|
|
2698
|
+
let { consequent: o, alternate: a } = s;
|
|
2699
|
+
return o.type === "ConditionalExpression" || a.type === "ConditionalExpression";
|
|
2700
|
+
}
|
|
2701
|
+
case "ClassExpression":
|
|
2702
|
+
return j(s.decorators);
|
|
2703
|
+
}
|
|
2704
|
+
if (n) return false;
|
|
2705
|
+
let i = s, u = [];
|
|
2706
|
+
for (; ; ) if (i.type === "UnaryExpression" || i.type === "AwaitExpression" || i.type === "YieldExpression" && i.argument !== null) i = i.argument, u.push("argument");
|
|
2707
|
+
else if (i.type === "TSNonNullExpression") i = i.expression, u.push("expression");
|
|
2708
|
+
else break;
|
|
2709
|
+
return !!(X(i) || e.call(() => Zu(e, t, r), ...u));
|
|
2710
|
+
}
|
|
2711
|
+
function Tl(e) {
|
|
2712
|
+
if (zu(e)) {
|
|
2713
|
+
let t = e.left || e.id;
|
|
2714
|
+
return t.type === "ObjectPattern" && t.properties.length > 2 && t.properties.some((r) => ke(r) && (!r.shorthand || r.value?.type === "AssignmentPattern"));
|
|
2715
|
+
}
|
|
2716
|
+
return false;
|
|
2717
|
+
}
|
|
2718
|
+
function rn(e) {
|
|
2719
|
+
return e.type === "AssignmentExpression";
|
|
2720
|
+
}
|
|
2721
|
+
function zu(e) {
|
|
2722
|
+
return rn(e) || e.type === "VariableDeclarator";
|
|
2723
|
+
}
|
|
2724
|
+
function xl(e) {
|
|
2725
|
+
let t = gl(e);
|
|
2726
|
+
if (j(t)) {
|
|
2727
|
+
let r = e.type === "TSTypeAliasDeclaration" ? "constraint" : "bound";
|
|
2728
|
+
if (t.length > 1 && t.some((n) => n[r] || n.default)) return true;
|
|
2729
|
+
}
|
|
2730
|
+
return false;
|
|
2731
|
+
}
|
|
2732
|
+
function gl(e) {
|
|
2733
|
+
if (Er(e)) return e.typeParameters?.params;
|
|
2734
|
+
}
|
|
2735
|
+
function hl(e) {
|
|
2736
|
+
if (e.type !== "VariableDeclarator") return false;
|
|
2737
|
+
let { typeAnnotation: t } = e.id;
|
|
2738
|
+
if (!t || !t.typeAnnotation) return false;
|
|
2739
|
+
let r = Vu(t.typeAnnotation);
|
|
2740
|
+
return j(r) && r.length > 1 && r.some((n) => j(Vu(n)) || n.type === "TSConditionalType");
|
|
2741
|
+
}
|
|
2742
|
+
function ks(e) {
|
|
2743
|
+
return e.type === "VariableDeclarator" && e.init?.type === "ArrowFunctionExpression";
|
|
2744
|
+
}
|
|
2745
|
+
function Vu(e) {
|
|
2746
|
+
let t;
|
|
2747
|
+
switch (e.type) {
|
|
2748
|
+
case "GenericTypeAnnotation":
|
|
2749
|
+
t = e.typeParameters;
|
|
2750
|
+
break;
|
|
2751
|
+
case "TSTypeReference":
|
|
2752
|
+
t = e.typeArguments;
|
|
2753
|
+
break;
|
|
2754
|
+
}
|
|
2755
|
+
return t?.params;
|
|
2756
|
+
}
|
|
2757
|
+
function Zu(e, t, r, n = false) {
|
|
2758
|
+
let { node: s } = e, i = () => Zu(e, t, r, true);
|
|
2759
|
+
if (s.type === "ChainExpression" || s.type === "TSNonNullExpression") return e.call(i, "expression");
|
|
2760
|
+
if (M(s)) {
|
|
2761
|
+
if (_t(e, t, r).label?.memberChain) return false;
|
|
2762
|
+
let o = ce(s);
|
|
2763
|
+
return !(o.length === 0 || o.length === 1 && fr(o[0], t)) || Bl(s, r) ? false : e.call(i, "callee");
|
|
2764
|
+
}
|
|
2765
|
+
return R(s) ? e.call(i, "object") : n && (s.type === "Identifier" || s.type === "ThisExpression");
|
|
2766
|
+
}
|
|
2767
|
+
function Sl(e, t, r) {
|
|
2768
|
+
return ke(e) ? (t = $t(t), typeof t == "string" && it(t) < r.tabWidth + 3) : false;
|
|
2769
|
+
}
|
|
2770
|
+
function Bl(e, t) {
|
|
2771
|
+
let r = bl(e);
|
|
2772
|
+
if (j(r)) {
|
|
2773
|
+
if (r.length > 1) return true;
|
|
2774
|
+
if (r.length === 1) {
|
|
2775
|
+
let s = r[0];
|
|
2776
|
+
if (Ie(s) || Lt(s) || s.type === "TSTypeLiteral" || s.type === "ObjectTypeAnnotation") return true;
|
|
2777
|
+
}
|
|
2778
|
+
let n = e.typeParameters ? "typeParameters" : "typeArguments";
|
|
2779
|
+
if (se(t(n))) return true;
|
|
2780
|
+
}
|
|
2781
|
+
return false;
|
|
2782
|
+
}
|
|
2783
|
+
function bl(e) {
|
|
2784
|
+
return (e.typeParameters ?? e.typeArguments)?.params;
|
|
2785
|
+
}
|
|
2786
|
+
function $u(e) {
|
|
2787
|
+
switch (e.type) {
|
|
2788
|
+
case "FunctionTypeAnnotation":
|
|
2789
|
+
case "GenericTypeAnnotation":
|
|
2790
|
+
case "TSFunctionType":
|
|
2791
|
+
return !!e.typeParameters;
|
|
2792
|
+
case "TSTypeReference":
|
|
2793
|
+
return !!e.typeArguments;
|
|
2794
|
+
default:
|
|
2795
|
+
return false;
|
|
2796
|
+
}
|
|
2797
|
+
}
|
|
2798
|
+
function Pl(e) {
|
|
2799
|
+
return $u(e.checkType) || $u(e.extendsType);
|
|
2800
|
+
}
|
|
2801
|
+
function kl(e) {
|
|
2802
|
+
let t = /* @__PURE__ */ new WeakMap();
|
|
2803
|
+
return function(r) {
|
|
2804
|
+
return t.has(r) || t.set(r, Symbol(e)), t.get(r);
|
|
2805
|
+
};
|
|
2806
|
+
}
|
|
2807
|
+
var eo = kl;
|
|
2808
|
+
function Ke(e, t, r, n, s) {
|
|
2809
|
+
let i = e.node, u = K(i), o = s && i.typeParameters ? r("typeParameters") : "";
|
|
2810
|
+
if (u.length === 0) return [o, "(", v(e, t, { filter: (F) => Ne(t.originalText, k(F)) === ")" }), ")"];
|
|
2811
|
+
let { parent: a } = e, p = Pt(a), D = to(i), l = [];
|
|
2812
|
+
if (Ci(e, (F, P) => {
|
|
2813
|
+
let S = P === u.length - 1;
|
|
2814
|
+
S && i.rest && l.push("..."), l.push(r()), !S && (l.push(","), p || D ? l.push(" ") : oe(u[P], t) ? l.push(y, y) : l.push(A));
|
|
2815
|
+
}), n && !Ll(e)) {
|
|
2816
|
+
if (se(o) || se(l)) throw new yt();
|
|
2817
|
+
return c([Ot(o), "(", Ot(l), ")"]);
|
|
2818
|
+
}
|
|
2819
|
+
let E = u.every((F) => !j(F.decorators));
|
|
2820
|
+
return D && E ? [o, "(", ...l, ")"] : p ? [o, "(", ...l, ")"] : (vr(a) || Di(a) || a.type === "TypeAlias" || a.type === "UnionTypeAnnotation" || a.type === "IntersectionTypeAnnotation" || a.type === "FunctionTypeAnnotation" && a.returnType === i) && u.length === 1 && u[0].name === null && i.this !== u[0] && u[0].typeAnnotation && i.typeParameters === null && Ht(u[0].typeAnnotation) && !i.rest ? t.arrowParens === "always" || i.type === "HookTypeAnnotation" ? ["(", ...l, ")"] : l : [o, "(", m([f, ...l]), B(!di(i) && ue(t, "all") ? "," : ""), f, ")"];
|
|
2821
|
+
}
|
|
2822
|
+
function to(e) {
|
|
2823
|
+
if (!e) return false;
|
|
2824
|
+
let t = K(e);
|
|
2825
|
+
if (t.length !== 1) return false;
|
|
2826
|
+
let [r] = t;
|
|
2827
|
+
return !C(r) && (r.type === "ObjectPattern" || r.type === "ArrayPattern" || r.type === "Identifier" && r.typeAnnotation && (r.typeAnnotation.type === "TypeAnnotation" || r.typeAnnotation.type === "TSTypeAnnotation") && We(r.typeAnnotation.typeAnnotation) || r.type === "FunctionTypeParam" && We(r.typeAnnotation) && r !== e.rest || r.type === "AssignmentPattern" && (r.left.type === "ObjectPattern" || r.left.type === "ArrayPattern") && (r.right.type === "Identifier" || ie(r.right) && r.right.properties.length === 0 || W(r.right) && r.right.elements.length === 0));
|
|
2828
|
+
}
|
|
2829
|
+
function Il(e) {
|
|
2830
|
+
let t;
|
|
2831
|
+
return e.returnType ? (t = e.returnType, t.typeAnnotation && (t = t.typeAnnotation)) : e.typeAnnotation && (t = e.typeAnnotation), t;
|
|
2832
|
+
}
|
|
2833
|
+
function ct(e, t) {
|
|
2834
|
+
let r = Il(e);
|
|
2835
|
+
if (!r) return false;
|
|
2836
|
+
let n = e.typeParameters?.params;
|
|
2837
|
+
if (n) {
|
|
2838
|
+
if (n.length > 1) return false;
|
|
2839
|
+
if (n.length === 1) {
|
|
2840
|
+
let s = n[0];
|
|
2841
|
+
if (s.constraint || s.default) return false;
|
|
2842
|
+
}
|
|
2843
|
+
}
|
|
2844
|
+
return K(e).length === 1 && (We(r) || se(t));
|
|
2845
|
+
}
|
|
2846
|
+
function Ll(e) {
|
|
2847
|
+
return e.match((t) => t.type === "ArrowFunctionExpression" && t.body.type === "BlockStatement", (t, r) => {
|
|
2848
|
+
if (t.type === "CallExpression" && r === "arguments" && t.arguments.length === 1 && t.callee.type === "CallExpression") {
|
|
2849
|
+
let n = t.callee.callee;
|
|
2850
|
+
return n.type === "Identifier" || n.type === "MemberExpression" && !n.computed && n.object.type === "Identifier" && n.property.type === "Identifier";
|
|
2851
|
+
}
|
|
2852
|
+
return false;
|
|
2853
|
+
}, (t, r) => t.type === "VariableDeclarator" && r === "init" || t.type === "ExportDefaultDeclaration" && r === "declaration" || t.type === "TSExportAssignment" && r === "expression" || t.type === "AssignmentExpression" && r === "right" && t.left.type === "MemberExpression" && t.left.object.type === "Identifier" && t.left.object.name === "module" && t.left.property.type === "Identifier" && t.left.property.name === "exports", (t) => t.type !== "VariableDeclaration" || t.kind === "const" && t.declarations.length === 1);
|
|
2854
|
+
}
|
|
2855
|
+
function ro(e) {
|
|
2856
|
+
let t = K(e);
|
|
2857
|
+
return t.length > 1 && t.some((r) => r.type === "TSParameterProperty");
|
|
2858
|
+
}
|
|
2859
|
+
function Nt(e, t) {
|
|
2860
|
+
return (t === "params" || t === "this" || t === "rest") && to(e);
|
|
2861
|
+
}
|
|
2862
|
+
var Ol = /^[\$A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC][\$0-9A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]*$/, wl = (e) => Ol.test(e), no = wl;
|
|
2863
|
+
function Ml(e) {
|
|
2864
|
+
return e.length === 1 ? e : e.toLowerCase().replace(/^([+-]?[\d.]+e)(?:\+|(-))?0*(?=\d)/u, "$1$2").replace(/^([+-]?[\d.]+)e[+-]?0+$/u, "$1").replace(/^([+-])?\./u, "$10.").replace(/(\.\d+?)0+(?=e|$)/u, "$1").replace(/\.(?=e|$)/u, "");
|
|
2865
|
+
}
|
|
2866
|
+
var Et = Ml;
|
|
2867
|
+
var nn = /* @__PURE__ */ new WeakMap();
|
|
2868
|
+
function io(e) {
|
|
2869
|
+
return /^(?:\d+|\d+\.\d+)$/u.test(e);
|
|
2870
|
+
}
|
|
2871
|
+
function so(e, t) {
|
|
2872
|
+
return t.parser === "json" || t.parser === "jsonc" || !X(e.key) || ut(pe(e.key), t).slice(1, -1) !== e.key.value ? false : !!(no(e.key.value) && !(t.parser === "babel-ts" && e.type === "ClassProperty" || (t.parser === "typescript" || t.parser === "oxc-ts") && e.type === "PropertyDefinition") || io(e.key.value) && String(Number(e.key.value)) === e.key.value && e.type !== "ImportAttribute" && (t.parser === "babel" || t.parser === "acorn" || t.parser === "oxc" || t.parser === "espree" || t.parser === "meriyah" || t.parser === "__babel_estree"));
|
|
2873
|
+
}
|
|
2874
|
+
function _l(e, t) {
|
|
2875
|
+
let { key: r } = e.node;
|
|
2876
|
+
return (r.type === "Identifier" || de(r) && io(Et(pe(r))) && String(r.value) === Et(pe(r)) && !(t.parser === "typescript" || t.parser === "babel-ts" || t.parser === "oxc-ts")) && (t.parser === "json" || t.parser === "jsonc" || t.quoteProps === "consistent" && nn.get(e.parent));
|
|
2877
|
+
}
|
|
2878
|
+
function Ft(e, t, r) {
|
|
2879
|
+
let { node: n } = e;
|
|
2880
|
+
if (n.computed) return ["[", r("key"), "]"];
|
|
2881
|
+
let { parent: s } = e, { key: i } = n;
|
|
2882
|
+
if (t.quoteProps === "consistent" && !nn.has(s)) {
|
|
2883
|
+
let u = e.siblings.some((o) => !o.computed && X(o.key) && !so(o, t));
|
|
2884
|
+
nn.set(s, u);
|
|
2885
|
+
}
|
|
2886
|
+
if (_l(e, t)) {
|
|
2887
|
+
let u = ut(JSON.stringify(i.type === "Identifier" ? i.name : i.value.toString()), t);
|
|
2888
|
+
return e.call(() => me(e, u, t), "key");
|
|
2889
|
+
}
|
|
2890
|
+
return so(n, t) && (t.quoteProps === "as-needed" || t.quoteProps === "consistent" && !nn.get(s)) ? e.call(() => me(e, /^\d/u.test(i.value) ? Et(i.value) : i.value, t), "key") : r("key");
|
|
2891
|
+
}
|
|
2892
|
+
function sn(e, t, r) {
|
|
2893
|
+
let { node: n } = e;
|
|
2894
|
+
return n.shorthand ? r("value") : xt(e, t, r, Ft(e, t, r), ":", "value");
|
|
2895
|
+
}
|
|
2896
|
+
var Nl = ({ node: e, key: t, parent: r }) => t === "value" && e.type === "FunctionExpression" && (r.type === "ObjectMethod" || r.type === "ClassMethod" || r.type === "ClassPrivateMethod" || r.type === "MethodDefinition" || r.type === "TSAbstractMethodDefinition" || r.type === "TSDeclareMethod" || r.type === "Property" && lt(r));
|
|
2897
|
+
function un(e, t, r, n) {
|
|
2898
|
+
if (Nl(e)) return on(e, t, r);
|
|
2899
|
+
let { node: s } = e, i = false;
|
|
2900
|
+
if ((s.type === "FunctionDeclaration" || s.type === "FunctionExpression") && n?.expandLastArg) {
|
|
2901
|
+
let { parent: D } = e;
|
|
2902
|
+
M(D) && (ce(D).length > 1 || K(s).every((l) => l.type === "Identifier" && !l.typeAnnotation)) && (i = true);
|
|
2903
|
+
}
|
|
2904
|
+
let u = [z(e), s.async ? "async " : "", `function${s.generator ? "*" : ""} `, s.id ? r("id") : ""], o = Ke(e, t, r, i), a = Zt(e, r), p = ct(s, a);
|
|
2905
|
+
return u.push(r("typeParameters"), c([p ? c(o) : o, a]), s.body ? " " : "", r("body")), t.semi && (s.declare || !s.body) && u.push(";"), u;
|
|
2906
|
+
}
|
|
2907
|
+
function gr(e, t, r) {
|
|
2908
|
+
let { node: n } = e, { kind: s } = n, i = n.value || n, u = [];
|
|
2909
|
+
return !s || s === "init" || s === "method" || s === "constructor" ? i.async && u.push("async ") : u.push(s, " "), i.generator && u.push("*"), u.push(Ft(e, t, r), n.optional ? "?" : "", n === i ? on(e, t, r) : r("value")), u;
|
|
2910
|
+
}
|
|
2911
|
+
function on(e, t, r) {
|
|
2912
|
+
let { node: n } = e, s = Ke(e, t, r), i = Zt(e, r), u = ro(n), o = ct(n, i), a = [r("typeParameters"), c([u ? c(s, { shouldBreak: true }) : o ? c(s) : s, i])];
|
|
2913
|
+
return n.body ? a.push(" ", r("body")) : a.push(t.semi ? ";" : ""), a;
|
|
2914
|
+
}
|
|
2915
|
+
function vl(e) {
|
|
2916
|
+
let t = K(e);
|
|
2917
|
+
return t.length === 1 && !e.typeParameters && !C(e, T.Dangling) && t[0].type === "Identifier" && !t[0].typeAnnotation && !C(t[0]) && !t[0].optional && !e.predicate && !e.returnType;
|
|
2918
|
+
}
|
|
2919
|
+
function an(e, t) {
|
|
2920
|
+
if (t.arrowParens === "always") return false;
|
|
2921
|
+
if (t.arrowParens === "avoid") {
|
|
2922
|
+
let { node: r } = e;
|
|
2923
|
+
return vl(r);
|
|
2924
|
+
}
|
|
2925
|
+
return false;
|
|
2926
|
+
}
|
|
2927
|
+
function Zt(e, t) {
|
|
2928
|
+
let { node: r } = e, s = [U(e, t, "returnType")];
|
|
2929
|
+
return r.predicate && s.push(t("predicate")), s;
|
|
2930
|
+
}
|
|
2931
|
+
function uo(e, t, r) {
|
|
2932
|
+
let { node: n } = e, s = [];
|
|
2933
|
+
if (n.argument) {
|
|
2934
|
+
let o = r("argument");
|
|
2935
|
+
jl(t, n.argument) ? o = ["(", m([y, o]), y, ")"] : (xe(n.argument) || t.experimentalTernaries && n.argument.type === "ConditionalExpression" && (n.argument.consequent.type === "ConditionalExpression" || n.argument.alternate.type === "ConditionalExpression")) && (o = c([B("("), m([f, o]), f, B(")")])), s.push(" ", o);
|
|
2936
|
+
}
|
|
2937
|
+
let i = C(n, T.Dangling), u = t.semi && i && C(n, T.Last | T.Line);
|
|
2938
|
+
return u && s.push(";"), i && s.push(" ", v(e, t)), !u && t.semi && s.push(";"), s;
|
|
2939
|
+
}
|
|
2940
|
+
function oo(e, t, r) {
|
|
2941
|
+
return ["return", uo(e, t, r)];
|
|
2942
|
+
}
|
|
2943
|
+
function ao(e, t, r) {
|
|
2944
|
+
return ["throw", uo(e, t, r)];
|
|
2945
|
+
}
|
|
2946
|
+
function jl(e, t) {
|
|
2947
|
+
if (Ce(e.originalText, t) || C(t, T.Leading, (r) => re(e.originalText, L(r), k(r))) && !q(t)) return true;
|
|
2948
|
+
if (Ut(t)) {
|
|
2949
|
+
let r = t, n;
|
|
2950
|
+
for (; n = pi(r); ) if (r = n, Ce(e.originalText, r)) return true;
|
|
2951
|
+
}
|
|
2952
|
+
return false;
|
|
2953
|
+
}
|
|
2954
|
+
function vt(e, t, r) {
|
|
2955
|
+
let { node: n } = e, s = [], i = n.type === "ObjectTypeAnnotation", u = !co(e), o = u ? A : y, [a, p] = i && n.exact ? ["{|", "|}"] : "{}", D;
|
|
2956
|
+
if (Rl(e, ({ node: l, next: E, isLast: d }) => {
|
|
2957
|
+
if (D ?? (D = l), s.push(r()), u && i) {
|
|
2958
|
+
let { parent: F } = e;
|
|
2959
|
+
F.inexact || !d ? s.push(",") : ue(t) && s.push(B(","));
|
|
2960
|
+
}
|
|
2961
|
+
!u && (Jl({ node: l, next: E }, t) || mo({ node: l, next: E }, t)) && s.push(";"), d || (s.push(o), oe(l, t) && s.push(y));
|
|
2962
|
+
}), C(n, T.Dangling) && s.push(v(e, t)), n.type === "ObjectTypeAnnotation" && n.inexact) {
|
|
2963
|
+
let l;
|
|
2964
|
+
C(n, T.Dangling) ? l = [C(n, T.Line) || Q(t.originalText, k(_(0, Ze(n), -1))) ? y : A, "..."] : l = [D ? A : "", "..."], s.push(l);
|
|
2965
|
+
}
|
|
2966
|
+
if (u) {
|
|
2967
|
+
let l = t.objectWrap === "preserve" && D && re(t.originalText, L(n), L(D)), E;
|
|
2968
|
+
if (s.length === 0) E = a + p;
|
|
2969
|
+
else {
|
|
2970
|
+
let d = t.bracketSpacing ? A : f;
|
|
2971
|
+
E = [a, m([d, ...s]), d, p];
|
|
2972
|
+
}
|
|
2973
|
+
return e.match(void 0, (d, F) => F === "typeAnnotation", (d, F) => F === "typeAnnotation", Nt) || e.match(void 0, (d, F) => d.type === "FunctionTypeParam" && F === "typeAnnotation", Nt) ? E : c(E, { shouldBreak: l });
|
|
2974
|
+
}
|
|
2975
|
+
return [a, s.length > 0 ? [m([y, s]), y] : "", p];
|
|
2976
|
+
}
|
|
2977
|
+
function co(e) {
|
|
2978
|
+
let { node: t } = e;
|
|
2979
|
+
if (t.type === "ObjectTypeAnnotation") {
|
|
2980
|
+
let { key: r, parent: n } = e;
|
|
2981
|
+
return r === "body" && (n.type === "InterfaceDeclaration" || n.type === "DeclareInterface" || n.type === "DeclareClass");
|
|
2982
|
+
}
|
|
2983
|
+
return t.type === "ClassBody" || t.type === "TSInterfaceBody";
|
|
2984
|
+
}
|
|
2985
|
+
function Rl(e, t) {
|
|
2986
|
+
let { node: r } = e;
|
|
2987
|
+
if (r.type === "ClassBody" || r.type === "TSInterfaceBody") {
|
|
2988
|
+
e.each(t, "body");
|
|
2989
|
+
return;
|
|
2990
|
+
}
|
|
2991
|
+
if (r.type === "TSTypeLiteral") {
|
|
2992
|
+
e.each(t, "members");
|
|
2993
|
+
return;
|
|
2994
|
+
}
|
|
2995
|
+
if (r.type === "ObjectTypeAnnotation") {
|
|
2996
|
+
let n = ["properties", "indexers", "callProperties", "internalSlots"].flatMap((s) => e.map(({ node: i, index: u }) => ({ node: i, loc: L(i), selector: [s, u] }), s)).sort((s, i) => s.loc - i.loc);
|
|
2997
|
+
for (let [s, { node: i, selector: u }] of n.entries()) e.call(() => t({ node: i, next: n[s + 1]?.node, isLast: s === n.length - 1 }), ...u);
|
|
2998
|
+
}
|
|
2999
|
+
}
|
|
3000
|
+
function ve(e, t) {
|
|
3001
|
+
let { parent: r } = e;
|
|
3002
|
+
return e.callParent(co) ? t.semi || r.type === "ObjectTypeAnnotation" ? ";" : "" : r.type === "TSTypeLiteral" ? e.isLast ? t.semi ? B(";") : "" : t.semi || mo({ node: e.node, next: e.next }, t) ? ";" : B("", ";") : "";
|
|
3003
|
+
}
|
|
3004
|
+
var po = b(["ClassProperty", "PropertyDefinition", "ClassPrivateProperty", "ClassAccessorProperty", "AccessorProperty", "TSAbstractPropertyDefinition", "TSAbstractAccessorProperty"]), lo = (e) => {
|
|
3005
|
+
if (e.computed || e.typeAnnotation) return false;
|
|
3006
|
+
let { type: t, name: r } = e.key;
|
|
3007
|
+
return t === "Identifier" && (r === "static" || r === "get" || r === "set");
|
|
3008
|
+
};
|
|
3009
|
+
function Jl({ node: e, next: t }, r) {
|
|
3010
|
+
if (r.semi || !po(e)) return false;
|
|
3011
|
+
if (!e.value && lo(e)) return true;
|
|
3012
|
+
if (!t || t.static || t.accessibility || t.readonly) return false;
|
|
3013
|
+
if (!t.computed) {
|
|
3014
|
+
let n = t.key?.name;
|
|
3015
|
+
if (n === "in" || n === "instanceof") return true;
|
|
3016
|
+
}
|
|
3017
|
+
if (po(t) && t.variance && !t.static && !t.declare) return true;
|
|
3018
|
+
switch (t.type) {
|
|
3019
|
+
case "ClassProperty":
|
|
3020
|
+
case "PropertyDefinition":
|
|
3021
|
+
case "TSAbstractPropertyDefinition":
|
|
3022
|
+
return t.computed;
|
|
3023
|
+
case "MethodDefinition":
|
|
3024
|
+
case "TSAbstractMethodDefinition":
|
|
3025
|
+
case "ClassMethod":
|
|
3026
|
+
case "ClassPrivateMethod": {
|
|
3027
|
+
if ((t.value ? t.value.async : t.async) || t.kind === "get" || t.kind === "set") return false;
|
|
3028
|
+
let s = t.value ? t.value.generator : t.generator;
|
|
3029
|
+
return !!(t.computed || s);
|
|
3030
|
+
}
|
|
3031
|
+
case "TSIndexSignature":
|
|
3032
|
+
return true;
|
|
3033
|
+
}
|
|
3034
|
+
return false;
|
|
3035
|
+
}
|
|
3036
|
+
var Gl = b(["TSPropertySignature"]);
|
|
3037
|
+
function mo({ node: e, next: t }, r) {
|
|
3038
|
+
if (r.semi || !Gl(e)) return false;
|
|
3039
|
+
if (lo(e)) return true;
|
|
3040
|
+
if (!t) return false;
|
|
3041
|
+
switch (t.type) {
|
|
3042
|
+
case "TSCallSignatureDeclaration":
|
|
3043
|
+
return true;
|
|
3044
|
+
}
|
|
3045
|
+
return false;
|
|
3046
|
+
}
|
|
3047
|
+
var Wl = eo("heritageGroup"), ql = b(["TSInterfaceDeclaration", "DeclareInterface", "InterfaceDeclaration", "InterfaceTypeAnnotation"]);
|
|
3048
|
+
function er(e, t, r) {
|
|
3049
|
+
let { node: n } = e, s = ql(n), i = [z(e), tr(e), s ? "interface" : "class"], u = fo(e), o = [], a = [];
|
|
3050
|
+
if (n.type !== "InterfaceTypeAnnotation") {
|
|
3051
|
+
n.id && o.push(" ");
|
|
3052
|
+
for (let D of ["id", "typeParameters"]) if (n[D]) {
|
|
3053
|
+
let { leading: l, trailing: E } = e.call(() => Mt(e, t), D);
|
|
3054
|
+
o.push(l, r(D), m(E));
|
|
3055
|
+
}
|
|
3056
|
+
}
|
|
3057
|
+
if (n.superClass) {
|
|
3058
|
+
let D = [Hl(e, t, r), r(n.superTypeArguments ? "superTypeArguments" : "superTypeParameters")], l = e.call(() => ["extends ", me(e, D, t)], "superClass");
|
|
3059
|
+
u ? a.push(A, c(l)) : a.push(" ", l);
|
|
3060
|
+
} else a.push(Ls(e, t, r, "extends"));
|
|
3061
|
+
a.push(Ls(e, t, r, "mixins"), Ls(e, t, r, "implements"));
|
|
3062
|
+
let p;
|
|
3063
|
+
return u ? (p = Wl(n), i.push(c([...o, m(a)], { id: p }))) : i.push(...o, ...a), !s && u && Yl(n.body) ? i.push(B(y, " ", { groupId: p })) : i.push(" "), i.push(r("body")), i;
|
|
3064
|
+
}
|
|
3065
|
+
function Yl(e) {
|
|
3066
|
+
return e.type === "ObjectTypeAnnotation" ? ["properties", "indexers", "callProperties", "internalSlots"].some((t) => j(e[t])) : j(e.body);
|
|
3067
|
+
}
|
|
3068
|
+
function Do(e) {
|
|
3069
|
+
let t = e.superClass ? 1 : 0;
|
|
3070
|
+
for (let r of ["extends", "mixins", "implements"]) if (Array.isArray(e[r]) && (t += e[r].length), t > 1) return true;
|
|
3071
|
+
return t > 1;
|
|
3072
|
+
}
|
|
3073
|
+
function Ul(e) {
|
|
3074
|
+
let { node: t } = e;
|
|
3075
|
+
if (C(t.id, T.Trailing) || C(t.typeParameters, T.Trailing) || C(t.superClass) || Do(t)) return true;
|
|
3076
|
+
if (t.superClass) return e.parent.type === "AssignmentExpression" ? false : !(t.superTypeArguments ?? t.superTypeParameters) && R(t.superClass);
|
|
3077
|
+
let r = t.extends?.[0] ?? t.mixins?.[0] ?? t.implements?.[0];
|
|
3078
|
+
return r ? r.type === "InterfaceExtends" && r.id.type === "QualifiedTypeIdentifier" && !r.typeParameters || (r.type === "TSClassImplements" || r.type === "TSInterfaceHeritage") && R(r.expression) && !r.typeArguments : false;
|
|
3079
|
+
}
|
|
3080
|
+
var Is = /* @__PURE__ */ new WeakMap();
|
|
3081
|
+
function fo(e) {
|
|
3082
|
+
let { node: t } = e;
|
|
3083
|
+
return Is.has(t) || Is.set(t, Ul(e)), Is.get(t);
|
|
3084
|
+
}
|
|
3085
|
+
function Ls(e, t, r, n) {
|
|
3086
|
+
let { node: s } = e;
|
|
3087
|
+
if (!j(s[n])) return "";
|
|
3088
|
+
let i = v(e, t, { marker: n }), u = I([",", A], e.map(r, n));
|
|
3089
|
+
if (!Do(s)) {
|
|
3090
|
+
let o = [`${n} `, i, u];
|
|
3091
|
+
return fo(e) ? [A, c(o)] : [" ", o];
|
|
3092
|
+
}
|
|
3093
|
+
return [A, i, i && y, n, c(m([A, u]))];
|
|
3094
|
+
}
|
|
3095
|
+
function Hl(e, t, r) {
|
|
3096
|
+
let n = r("superClass"), { parent: s } = e;
|
|
3097
|
+
return s.type === "AssignmentExpression" ? c(B(["(", m([f, n]), f, ")"], n)) : n;
|
|
3098
|
+
}
|
|
3099
|
+
function pn(e, t, r) {
|
|
3100
|
+
let { node: n } = e, s = [];
|
|
3101
|
+
return j(n.decorators) && s.push(Bs(e, t, r)), s.push(rr(n)), n.static && s.push("static "), s.push(tr(e)), n.override && s.push("override "), s.push(gr(e, t, r)), s;
|
|
3102
|
+
}
|
|
3103
|
+
function cn(e, t, r) {
|
|
3104
|
+
let { node: n } = e, s = [];
|
|
3105
|
+
j(n.decorators) && s.push(Bs(e, t, r)), s.push(z(e), rr(n)), n.static && s.push("static "), s.push(tr(e)), n.override && s.push("override "), n.readonly && s.push("readonly "), n.variance && s.push(r("variance")), (n.type === "ClassAccessorProperty" || n.type === "AccessorProperty" || n.type === "TSAbstractAccessorProperty") && s.push("accessor "), s.push(Ft(e, t, r), $(e), ln(e), U(e, r));
|
|
3106
|
+
let i = n.type === "TSAbstractPropertyDefinition" || n.type === "TSAbstractAccessorProperty";
|
|
3107
|
+
return [xt(e, t, r, s, " =", i ? void 0 : "value"), t.semi ? ";" : ""];
|
|
3108
|
+
}
|
|
3109
|
+
var Xl = b(["VoidTypeAnnotation", "TSVoidKeyword", "NullLiteralTypeAnnotation", "TSNullKeyword"]), Vl = b(["ObjectTypeAnnotation", "TSTypeLiteral", "GenericTypeAnnotation", "TSTypeReference"]);
|
|
3110
|
+
function $l(e) {
|
|
3111
|
+
let { types: t } = e;
|
|
3112
|
+
if (t.some((n) => C(n))) return false;
|
|
3113
|
+
let r = t.find((n) => Vl(n));
|
|
3114
|
+
return r ? t.every((n) => n === r || Xl(n)) : false;
|
|
3115
|
+
}
|
|
3116
|
+
function Os(e) {
|
|
3117
|
+
return Ht(e) || We(e) ? true : Ie(e) ? $l(e) : false;
|
|
3118
|
+
}
|
|
3119
|
+
function yo(e, t, r) {
|
|
3120
|
+
let { node: n } = e, s = [z(e), "opaque type ", r("id"), r("typeParameters")];
|
|
3121
|
+
if (n.supertype && s.push(": ", r("supertype")), n.lowerBound || n.upperBound) {
|
|
3122
|
+
let i = [];
|
|
3123
|
+
n.lowerBound && i.push(m([A, "super ", r("lowerBound")])), n.upperBound && i.push(m([A, "extends ", r("upperBound")])), s.push(c(i));
|
|
3124
|
+
}
|
|
3125
|
+
return n.impltype && s.push(" = ", r("impltype")), s.push(t.semi ? ";" : ""), s;
|
|
3126
|
+
}
|
|
3127
|
+
function mn(e, t, r) {
|
|
3128
|
+
let { node: n } = e, s = [z(e), "type ", r("id"), r("typeParameters")], i = n.type === "TSTypeAliasDeclaration" ? "typeAnnotation" : "right";
|
|
3129
|
+
return [xt(e, t, r, s, " =", i), t.semi ? ";" : ""];
|
|
3130
|
+
}
|
|
3131
|
+
function Dn(e, t, r) {
|
|
3132
|
+
let n = false;
|
|
3133
|
+
return c(e.map(({ isFirst: s, previous: i, node: u, index: o }) => {
|
|
3134
|
+
let a = r();
|
|
3135
|
+
if (s) return a;
|
|
3136
|
+
let p = We(u), D = We(i);
|
|
3137
|
+
return D && p ? [" & ", n ? m(a) : a] : !D && !p || Ce(t.originalText, u) ? t.experimentalOperatorPosition === "start" ? m([A, "& ", a]) : m([" &", A, a]) : (o > 1 && (n = true), [" & ", o > 1 ? m(a) : a]);
|
|
3138
|
+
}, "types"));
|
|
3139
|
+
}
|
|
3140
|
+
function fn(e, t, r) {
|
|
3141
|
+
let { node: n } = e, { parent: s } = e, i = s.type !== "TypeParameterInstantiation" && (!qe(s) || !t.experimentalTernaries) && s.type !== "TSTypeParameterInstantiation" && s.type !== "GenericTypeAnnotation" && s.type !== "TSTypeReference" && s.type !== "TSTypeAssertion" && s.type !== "TupleTypeAnnotation" && s.type !== "TSTupleType" && !(s.type === "FunctionTypeParam" && !s.name && e.grandparent.this !== s) && !((Er(s) || s.type === "VariableDeclarator") && Ce(t.originalText, n)) && !(Er(s) && C(s.id, T.Trailing | T.Line)), u = Os(n), o = e.map(() => {
|
|
3142
|
+
let d = r();
|
|
3143
|
+
return u || (d = ge(2, d)), me(e, d, t);
|
|
3144
|
+
}, "types"), { leading: a, trailing: p } = Mt(e, t);
|
|
3145
|
+
if (u) return [a, I(" | ", o), p];
|
|
3146
|
+
let D = i && !Ce(t.originalText, n), l = [B([D ? A : "", "| "]), I([A, "| "], o)];
|
|
3147
|
+
if (he(e, t)) return [a, c([m(l), f]), p];
|
|
3148
|
+
let E = [a, c(l)];
|
|
3149
|
+
return (s.type === "TupleTypeAnnotation" || s.type === "TSTupleType") && s[s.type === "TupleTypeAnnotation" && s.types ? "types" : "elementTypes"].length > 1 ? [c([m([B(["(", f]), E]), f, B(")")]), p] : [c(i ? m(E) : E), p];
|
|
3150
|
+
}
|
|
3151
|
+
function Kl(e) {
|
|
3152
|
+
let { node: t, parent: r } = e;
|
|
3153
|
+
return t.type === "FunctionTypeAnnotation" && (vr(r) || !((r.type === "ObjectTypeProperty" || r.type === "ObjectTypeInternalSlot") && !r.variance && !r.optional && St(r, t) || r.type === "ObjectTypeCallProperty" || e.getParentNode(2)?.type === "DeclareFunction"));
|
|
3154
|
+
}
|
|
3155
|
+
function yn(e, t, r) {
|
|
3156
|
+
let { node: n } = e, s = [tr(e)];
|
|
3157
|
+
(n.type === "TSConstructorType" || n.type === "TSConstructSignatureDeclaration") && s.push("new ");
|
|
3158
|
+
let i = Ke(e, t, r, false, true), u = [];
|
|
3159
|
+
return n.type === "FunctionTypeAnnotation" ? u.push(Kl(e) ? " => " : ": ", r("returnType")) : u.push(U(e, r, "returnType")), ct(n, u) && (i = c(i)), s.push(i, u), [c(s), n.type === "TSConstructSignatureDeclaration" || n.type === "TSCallSignatureDeclaration" ? ve(e, t) : ""];
|
|
3160
|
+
}
|
|
3161
|
+
function En(e, t, r) {
|
|
3162
|
+
return [r("objectType"), $(e), "[", r("indexType"), "]"];
|
|
3163
|
+
}
|
|
3164
|
+
function Fn(e, t, r) {
|
|
3165
|
+
return ["infer ", r("typeParameter")];
|
|
3166
|
+
}
|
|
3167
|
+
function ws(e, t, r) {
|
|
3168
|
+
let { node: n } = e;
|
|
3169
|
+
return [n.postfix ? "" : r, U(e, t), n.postfix ? r : ""];
|
|
3170
|
+
}
|
|
3171
|
+
function dn(e, t, r) {
|
|
3172
|
+
let { node: n } = e;
|
|
3173
|
+
return ["...", ...n.type === "TupleTypeSpreadElement" && n.label ? [r("label"), ": "] : [], r("typeAnnotation")];
|
|
3174
|
+
}
|
|
3175
|
+
function Cn(e, t, r) {
|
|
3176
|
+
let { node: n } = e;
|
|
3177
|
+
return [n.variance ? r("variance") : "", r("label"), n.optional ? "?" : "", ": ", r("elementType")];
|
|
3178
|
+
}
|
|
3179
|
+
var Ql = /* @__PURE__ */ new WeakSet();
|
|
3180
|
+
function U(e, t, r = "typeAnnotation") {
|
|
3181
|
+
let { node: { [r]: n } } = e;
|
|
3182
|
+
if (!n) return "";
|
|
3183
|
+
let s = false;
|
|
3184
|
+
if (n.type === "TSTypeAnnotation" || n.type === "TypeAnnotation") {
|
|
3185
|
+
let i = e.call(Eo, r);
|
|
3186
|
+
(i === "=>" || i === ":" && C(n, T.Leading)) && (s = true), Ql.add(n);
|
|
3187
|
+
}
|
|
3188
|
+
return s ? [" ", t(r)] : t(r);
|
|
3189
|
+
}
|
|
3190
|
+
var Eo = (e) => e.match((t) => t.type === "TSTypeAnnotation", (t, r) => (r === "returnType" || r === "typeAnnotation") && (t.type === "TSFunctionType" || t.type === "TSConstructorType")) ? "=>" : e.match((t) => t.type === "TSTypeAnnotation", (t, r) => r === "typeAnnotation" && (t.type === "TSJSDocNullableType" || t.type === "TSJSDocNonNullableType" || t.type === "TSTypePredicate")) || e.match((t) => t.type === "TypeAnnotation", (t, r) => r === "typeAnnotation" && t.type === "Identifier", (t, r) => r === "id" && t.type === "DeclareFunction") || e.match((t) => t.type === "TypeAnnotation", (t, r) => r === "typeAnnotation" && t.type === "Identifier", (t, r) => r === "id" && t.type === "DeclareHook") || e.match((t) => t.type === "TypeAnnotation", (t, r) => r === "bound" && t.type === "TypeParameter" && t.usesExtendsBound) ? "" : ":";
|
|
3191
|
+
function An(e, t, r) {
|
|
3192
|
+
let n = Eo(e);
|
|
3193
|
+
return n ? [n, " ", r("typeAnnotation")] : r("typeAnnotation");
|
|
3194
|
+
}
|
|
3195
|
+
function Tn(e) {
|
|
3196
|
+
return [e("elementType"), "[]"];
|
|
3197
|
+
}
|
|
3198
|
+
function xn({ node: e }, t) {
|
|
3199
|
+
let r = e.type === "TSTypeQuery" ? "exprName" : "argument";
|
|
3200
|
+
return ["typeof ", t(r), t("typeArguments")];
|
|
3201
|
+
}
|
|
3202
|
+
function gn(e, t) {
|
|
3203
|
+
let { node: r } = e;
|
|
3204
|
+
return [r.type === "TSTypePredicate" && r.asserts ? "asserts " : r.type === "TypePredicate" && r.kind ? `${r.kind} ` : "", t("parameterName"), r.typeAnnotation ? [" is ", U(e, t)] : ""];
|
|
3205
|
+
}
|
|
3206
|
+
function $(e) {
|
|
3207
|
+
let { node: t } = e;
|
|
3208
|
+
return !t.optional || t.type === "Identifier" && t === e.parent.key ? "" : M(t) || R(t) && t.computed || t.type === "OptionalIndexedAccessType" ? "?." : "?";
|
|
3209
|
+
}
|
|
3210
|
+
function ln(e) {
|
|
3211
|
+
return e.node.definite || e.match(void 0, (t, r) => r === "id" && t.type === "VariableDeclarator" && t.definite) ? "!" : "";
|
|
3212
|
+
}
|
|
3213
|
+
var zl = b(["DeclareClass", "DeclareComponent", "DeclareFunction", "DeclareHook", "DeclareVariable", "DeclareExportDeclaration", "DeclareExportAllDeclaration", "DeclareOpaqueType", "DeclareTypeAlias", "DeclareEnum", "DeclareInterface"]);
|
|
3214
|
+
function z(e) {
|
|
3215
|
+
let { node: t } = e;
|
|
3216
|
+
return t.declare || zl(t) && e.parent.type !== "DeclareExportDeclaration" ? "declare " : "";
|
|
3217
|
+
}
|
|
3218
|
+
var Zl = b(["TSAbstractMethodDefinition", "TSAbstractPropertyDefinition", "TSAbstractAccessorProperty"]);
|
|
3219
|
+
function tr({ node: e }) {
|
|
3220
|
+
return e.abstract || Zl(e) ? "abstract " : "";
|
|
3221
|
+
}
|
|
3222
|
+
function tn(e, t, r) {
|
|
3223
|
+
return ["::", r("callee")];
|
|
3224
|
+
}
|
|
3225
|
+
function dt(e, t, r) {
|
|
3226
|
+
return e.type === "EmptyStatement" ? C(e, T.Leading) ? [" ", t] : t : e.type === "BlockStatement" || r ? [" ", t] : m([A, t]);
|
|
3227
|
+
}
|
|
3228
|
+
function hn(e, t) {
|
|
3229
|
+
return ["...", t("argument"), U(e, t)];
|
|
3230
|
+
}
|
|
3231
|
+
function rr(e) {
|
|
3232
|
+
return e.accessibility ? e.accessibility + " " : "";
|
|
3233
|
+
}
|
|
3234
|
+
function em(e, t, r, n) {
|
|
3235
|
+
let { node: s } = e, i = s.inexact ? "..." : "";
|
|
3236
|
+
return C(s, T.Dangling) ? c([r, i, v(e, t, { indent: true }), f, n]) : [r, i, n];
|
|
3237
|
+
}
|
|
3238
|
+
function nr(e, t, r) {
|
|
3239
|
+
let { node: n } = e, s = [], i = "[", u = "]", o = n.type === "TupleTypeAnnotation" && n.types ? "types" : n.type === "TSTupleType" || n.type === "TupleTypeAnnotation" ? "elementTypes" : "elements", a = n[o];
|
|
3240
|
+
if (a.length === 0) s.push(em(e, t, i, u));
|
|
3241
|
+
else {
|
|
3242
|
+
let p = _(0, a, -1), D = p?.type !== "RestElement" && !n.inexact, l = p === null, E = Symbol("array"), d = !t.__inJestEach && a.length > 1 && a.every((S, O, g) => {
|
|
3243
|
+
let x = S?.type;
|
|
3244
|
+
if (!W(S) && !ie(S)) return false;
|
|
3245
|
+
let h = g[O + 1];
|
|
3246
|
+
if (h && x !== h.type) return false;
|
|
3247
|
+
let N = W(S) ? "elements" : "properties";
|
|
3248
|
+
return S[N] && S[N].length > 1;
|
|
3249
|
+
}), F = bs(n, t), P = D ? l ? "," : ue(t) ? F ? B(",", "", { groupId: E }) : B(",") : "" : "";
|
|
3250
|
+
s.push(c([i, m([f, F ? rm(e, t, r, P) : [tm(e, t, r, o, n.inexact), P], v(e, t)]), f, u], { shouldBreak: d, id: E }));
|
|
3251
|
+
}
|
|
3252
|
+
return s.push($(e), U(e, r)), s;
|
|
3253
|
+
}
|
|
3254
|
+
function bs(e, t) {
|
|
3255
|
+
return W(e) && e.elements.length > 0 && e.elements.every((r) => r && (de(r) || Yn(r) && !C(r.argument)) && !C(r, T.Trailing | T.Line, (n) => !Q(t.originalText, L(n), { backwards: true })));
|
|
3256
|
+
}
|
|
3257
|
+
function Fo({ node: e }, { originalText: t }) {
|
|
3258
|
+
let r = k(e);
|
|
3259
|
+
if (r === L(e)) return false;
|
|
3260
|
+
let { length: n } = t;
|
|
3261
|
+
for (; r < n && t[r] !== ","; ) r = Gt(t, Wt(t, r + 1));
|
|
3262
|
+
return qt(t, r);
|
|
3263
|
+
}
|
|
3264
|
+
function tm(e, t, r, n, s) {
|
|
3265
|
+
let i = [];
|
|
3266
|
+
return e.each(({ node: u, isLast: o }) => {
|
|
3267
|
+
i.push(u ? c(r()) : ""), (!o || s) && i.push([",", A, u && Fo(e, t) ? f : ""]);
|
|
3268
|
+
}, n), s && i.push("..."), i;
|
|
3269
|
+
}
|
|
3270
|
+
function rm(e, t, r, n) {
|
|
3271
|
+
let s = [];
|
|
3272
|
+
return e.each(({ isLast: i, next: u }) => {
|
|
3273
|
+
s.push([r(), i ? n : ","]), i || s.push(Fo(e, t) ? [y, y] : C(u, T.Leading | T.Line) ? y : A);
|
|
3274
|
+
}, "elements"), Hr(s);
|
|
3275
|
+
}
|
|
3276
|
+
var Ms = /* @__PURE__ */ new WeakMap();
|
|
3277
|
+
function Co(e) {
|
|
3278
|
+
return Ms.has(e) || Ms.set(e, e.type === "ConditionalExpression" && !fe(e, (t) => t.type === "ObjectExpression")), Ms.get(e);
|
|
3279
|
+
}
|
|
3280
|
+
var nm = (e) => e.type === "SequenceExpression";
|
|
3281
|
+
function Ao(e, t, r, n = {}) {
|
|
3282
|
+
let s = [], i, u = [], o = false, a = !n.expandLastArg && e.node.body.type === "ArrowFunctionExpression", p;
|
|
3283
|
+
(function O() {
|
|
3284
|
+
let { node: g } = e, x = sm(e, t, r, n);
|
|
3285
|
+
if (s.length === 0) s.push(x);
|
|
3286
|
+
else {
|
|
3287
|
+
let { leading: h, trailing: N } = Mt(e, t);
|
|
3288
|
+
s.push([h, x]), u.unshift(N);
|
|
3289
|
+
}
|
|
3290
|
+
a && (o || (o = g.returnType && K(g).length > 0 || g.typeParameters || K(g).some((h) => h.type !== "Identifier"))), !a || g.body.type !== "ArrowFunctionExpression" ? (i = r("body", n), p = g.body) : e.call(O, "body");
|
|
3291
|
+
})();
|
|
3292
|
+
let D = !Ce(t.originalText, p) && (nm(p) || im(p, i, t) || !o && Co(p)), l = e.key === "callee" && mt(e.parent), E = Symbol("arrow-chain"), d = um(e, n, { signatureDocs: s, shouldBreak: o }), F = false, P = false, S = false;
|
|
3293
|
+
return a && (l || n.assignmentLayout) && (P = true, S = !C(e.node, T.Leading & T.Line), F = n.assignmentLayout === "chain-tail-arrow-chain" || l && !D), i = om(e, t, n, { bodyDoc: i, bodyComments: u, functionBody: p, shouldPutBodyOnSameLine: D }), c([c(P ? m([S ? f : "", d]) : d, { shouldBreak: F, id: E }), " =>", a ? ft(i, { groupId: E }) : c(i), a && l ? B(f, "", { groupId: E }) : ""]);
|
|
3294
|
+
}
|
|
3295
|
+
function sm(e, t, r, n) {
|
|
3296
|
+
let { node: s } = e, i = [];
|
|
3297
|
+
if (s.async && i.push("async "), an(e, t)) i.push(r(["params", 0]));
|
|
3298
|
+
else {
|
|
3299
|
+
let o = n.expandLastArg || n.expandFirstArg, a = Zt(e, r);
|
|
3300
|
+
if (o) {
|
|
3301
|
+
if (se(a)) throw new yt();
|
|
3302
|
+
a = c(Ot(a));
|
|
3303
|
+
}
|
|
3304
|
+
i.push(c([Ke(e, t, r, o, true), a]));
|
|
3305
|
+
}
|
|
3306
|
+
let u = v(e, t, { filter(o) {
|
|
3307
|
+
let a = pt(t.originalText, k(o));
|
|
3308
|
+
return a !== false && t.originalText.slice(a, a + 2) === "=>";
|
|
3309
|
+
} });
|
|
3310
|
+
return u && i.push(" ", u), i;
|
|
3311
|
+
}
|
|
3312
|
+
function im(e, t, r) {
|
|
3313
|
+
return W(e) || ie(e) || e.type === "ArrowFunctionExpression" || e.type === "DoExpression" || e.type === "BlockStatement" || q(e) || t.label?.hug !== false && (t.label?.embed || jr(e, r.originalText));
|
|
3314
|
+
}
|
|
3315
|
+
function um(e, t, { signatureDocs: r, shouldBreak: n }) {
|
|
3316
|
+
if (r.length === 1) return r[0];
|
|
3317
|
+
let { parent: s, key: i } = e;
|
|
3318
|
+
return i !== "callee" && mt(s) || xe(s) ? c([r[0], " =>", m([A, I([" =>", A], r.slice(1))])], { shouldBreak: n }) : i === "callee" && mt(s) || t.assignmentLayout ? c(I([" =>", A], r), { shouldBreak: n }) : c(m(I([" =>", A], r)), { shouldBreak: n });
|
|
3319
|
+
}
|
|
3320
|
+
function om(e, t, r, { bodyDoc: n, bodyComments: s, functionBody: i, shouldPutBodyOnSameLine: u }) {
|
|
3321
|
+
let { node: o, parent: a } = e, p = r.expandLastArg && ue(t, "all") ? B(",") : "", D = (r.expandLastArg || a.type === "JSXExpressionContainer") && !C(o) ? f : "";
|
|
3322
|
+
return u && Co(i) ? [" ", c([B("", "("), m([f, n]), B("", ")"), p, D]), s] : u ? [" ", n, s] : [m([A, n, s]), p, D];
|
|
3323
|
+
}
|
|
3324
|
+
var am = Array.prototype.findLast ?? function(e) {
|
|
3325
|
+
for (let t = this.length - 1; t >= 0; t--) {
|
|
3326
|
+
let r = this[t];
|
|
3327
|
+
if (e(r, t, this)) return r;
|
|
3328
|
+
}
|
|
3329
|
+
}, pm = Jt("findLast", function() {
|
|
3330
|
+
if (Array.isArray(this)) return am;
|
|
3331
|
+
}), To = pm;
|
|
3332
|
+
function hr(e, t, r, n) {
|
|
3333
|
+
let { node: s } = e, i = [], u = To(0, s[n], (o) => o.type !== "EmptyStatement");
|
|
3334
|
+
return e.each(({ node: o }) => {
|
|
3335
|
+
o.type !== "EmptyStatement" && (i.push(r()), o !== u && (i.push(y), oe(o, t) && i.push(y)));
|
|
3336
|
+
}, n), i;
|
|
3337
|
+
}
|
|
3338
|
+
function Sn(e, t, r) {
|
|
3339
|
+
let n = cm(e, t, r), { node: s, parent: i } = e;
|
|
3340
|
+
if (s.type === "Program" && i?.type !== "ModuleExpression") return n ? [n, y] : "";
|
|
3341
|
+
let u = [];
|
|
3342
|
+
if (s.type === "StaticBlock" && u.push("static "), u.push("{"), n) u.push(m([y, n]), y);
|
|
3343
|
+
else {
|
|
3344
|
+
let o = e.grandparent;
|
|
3345
|
+
i.type === "ArrowFunctionExpression" || i.type === "FunctionExpression" || i.type === "FunctionDeclaration" || i.type === "ComponentDeclaration" || i.type === "HookDeclaration" || i.type === "ObjectMethod" || i.type === "ClassMethod" || i.type === "ClassPrivateMethod" || i.type === "ForStatement" || i.type === "WhileStatement" || i.type === "DoWhileStatement" || i.type === "DoExpression" || i.type === "ModuleExpression" || i.type === "CatchClause" && !o.finalizer || i.type === "TSModuleDeclaration" || i.type === "MatchStatementCase" || s.type === "StaticBlock" || u.push(y);
|
|
3346
|
+
}
|
|
3347
|
+
return u.push("}"), u;
|
|
3348
|
+
}
|
|
3349
|
+
function cm(e, t, r) {
|
|
3350
|
+
let { node: n } = e, s = j(n.directives), i = n.body.some((a) => a.type !== "EmptyStatement"), u = C(n, T.Dangling);
|
|
3351
|
+
if (!s && !i && !u) return "";
|
|
3352
|
+
let o = [];
|
|
3353
|
+
return s && (o.push(hr(e, t, r, "directives")), (i || u) && (o.push(y), oe(_(0, n.directives, -1), t) && o.push(y))), i && o.push(hr(e, t, r, "body")), u && o.push(v(e, t)), o;
|
|
3354
|
+
}
|
|
3355
|
+
var lm = b(["TSAsExpression", "TSTypeAssertion", "TSNonNullExpression", "TSInstantiationExpression", "TSSatisfiesExpression"]);
|
|
3356
|
+
function _s(e) {
|
|
3357
|
+
return lm(e) ? _s(e.expression) : e;
|
|
3358
|
+
}
|
|
3359
|
+
var xo = b(["FunctionExpression", "ArrowFunctionExpression"]);
|
|
3360
|
+
function go(e) {
|
|
3361
|
+
return e.type === "MemberExpression" || e.type === "OptionalMemberExpression" || e.type === "Identifier" && e.name !== "undefined";
|
|
3362
|
+
}
|
|
3363
|
+
function ho(e, t) {
|
|
3364
|
+
if (t.semi || vs(e, t) || Rs(e, t) || js(e, t)) return false;
|
|
3365
|
+
let { node: r, key: n, parent: s } = e;
|
|
3366
|
+
return !!(r.type === "ExpressionStatement" && (n === "body" && (s.type === "Program" || s.type === "BlockStatement" || s.type === "StaticBlock" || s.type === "TSModuleBlock") || n === "consequent" && s.type === "SwitchCase") && e.call(() => So(e, t), "expression"));
|
|
3367
|
+
}
|
|
3368
|
+
function So(e, t) {
|
|
3369
|
+
let { node: r } = e;
|
|
3370
|
+
switch (r.type) {
|
|
3371
|
+
case "ParenthesizedExpression":
|
|
3372
|
+
case "TypeCastExpression":
|
|
3373
|
+
case "ArrayExpression":
|
|
3374
|
+
case "ArrayPattern":
|
|
3375
|
+
case "TemplateLiteral":
|
|
3376
|
+
case "TemplateElement":
|
|
3377
|
+
case "RegExpLiteral":
|
|
3378
|
+
return true;
|
|
3379
|
+
case "ArrowFunctionExpression":
|
|
3380
|
+
if (!an(e, t)) return true;
|
|
3381
|
+
break;
|
|
3382
|
+
case "UnaryExpression": {
|
|
3383
|
+
let { prefix: n, operator: s } = r;
|
|
3384
|
+
if (n && (s === "+" || s === "-")) return true;
|
|
3385
|
+
break;
|
|
3386
|
+
}
|
|
3387
|
+
case "BindExpression":
|
|
3388
|
+
if (!r.object) return true;
|
|
3389
|
+
break;
|
|
3390
|
+
case "Literal":
|
|
3391
|
+
if (r.regex) return true;
|
|
3392
|
+
break;
|
|
3393
|
+
default:
|
|
3394
|
+
if (q(r)) return true;
|
|
3395
|
+
}
|
|
3396
|
+
return he(e, t) ? true : Ut(r) ? e.call(() => So(e, t), ..._r(r)) : false;
|
|
3397
|
+
}
|
|
3398
|
+
var Ns = ({ node: e, parent: t }) => e.type === "ExpressionStatement" && t.type === "Program" && t.body.length === 1 && (Array.isArray(t.directives) && t.directives.length === 0 || !t.directives);
|
|
3399
|
+
function vs(e, t) {
|
|
3400
|
+
return (t.parentParser === "markdown" || t.parentParser === "mdx") && Ns(e) && q(e.node.expression);
|
|
3401
|
+
}
|
|
3402
|
+
function js(e, t) {
|
|
3403
|
+
return t.__isHtmlInlineEventHandler && Ns(e);
|
|
3404
|
+
}
|
|
3405
|
+
function Rs(e, t) {
|
|
3406
|
+
return (t.parser === "__vue_event_binding" || t.parser === "__vue_ts_event_binding") && Ns(e);
|
|
3407
|
+
}
|
|
3408
|
+
function mm(e, t) {
|
|
3409
|
+
if (Rs(e, t)) {
|
|
3410
|
+
let r = _s(e.node.expression);
|
|
3411
|
+
return xo(r) || go(r);
|
|
3412
|
+
}
|
|
3413
|
+
return !(!t.semi || vs(e, t) || js(e, t));
|
|
3414
|
+
}
|
|
3415
|
+
function Bo(e, t, r) {
|
|
3416
|
+
return [r("expression"), mm(e, t) ? ";" : ""];
|
|
3417
|
+
}
|
|
3418
|
+
function bo(e, t, r) {
|
|
3419
|
+
if (t.__isVueBindings || t.__isVueForBindingLeft) {
|
|
3420
|
+
let n = e.map(r, "program", "body", 0, "params");
|
|
3421
|
+
if (n.length === 1) return n[0];
|
|
3422
|
+
let s = I([",", A], n);
|
|
3423
|
+
return t.__isVueForBindingLeft ? ["(", m([f, c(s)]), f, ")"] : s;
|
|
3424
|
+
}
|
|
3425
|
+
if (t.__isEmbeddedTypescriptGenericParameters) {
|
|
3426
|
+
let n = e.map(r, "program", "body", 0, "typeParameters", "params");
|
|
3427
|
+
return I([",", A], n);
|
|
3428
|
+
}
|
|
3429
|
+
}
|
|
3430
|
+
function Io(e, t) {
|
|
3431
|
+
let { node: r } = e;
|
|
3432
|
+
switch (r.type) {
|
|
3433
|
+
case "RegExpLiteral":
|
|
3434
|
+
return Po(r);
|
|
3435
|
+
case "BigIntLiteral":
|
|
3436
|
+
return Bn(r.extra.raw);
|
|
3437
|
+
case "NumericLiteral":
|
|
3438
|
+
return Et(r.extra.raw);
|
|
3439
|
+
case "StringLiteral":
|
|
3440
|
+
return Ge(ut(r.extra.raw, t));
|
|
3441
|
+
case "NullLiteral":
|
|
3442
|
+
return "null";
|
|
3443
|
+
case "BooleanLiteral":
|
|
3444
|
+
return String(r.value);
|
|
3445
|
+
case "DirectiveLiteral":
|
|
3446
|
+
return ko(r.extra.raw, t);
|
|
3447
|
+
case "Literal": {
|
|
3448
|
+
if (r.regex) return Po(r.regex);
|
|
3449
|
+
if (r.bigint) return Bn(r.raw);
|
|
3450
|
+
let { value: n } = r;
|
|
3451
|
+
return typeof n == "number" ? Et(r.raw) : typeof n == "string" ? Dm(e) ? ko(r.raw, t) : Ge(ut(r.raw, t)) : String(n);
|
|
3452
|
+
}
|
|
3453
|
+
}
|
|
3454
|
+
}
|
|
3455
|
+
function Dm(e) {
|
|
3456
|
+
if (e.key !== "expression") return;
|
|
3457
|
+
let { parent: t } = e;
|
|
3458
|
+
return t.type === "ExpressionStatement" && typeof t.directive == "string";
|
|
3459
|
+
}
|
|
3460
|
+
function Bn(e) {
|
|
3461
|
+
return e.toLowerCase();
|
|
3462
|
+
}
|
|
3463
|
+
function Po({ pattern: e, flags: t }) {
|
|
3464
|
+
return t = [...t].sort().join(""), `/${e}/${t}`;
|
|
3465
|
+
}
|
|
3466
|
+
function ko(e, t) {
|
|
3467
|
+
let r = e.slice(1, -1);
|
|
3468
|
+
if (r.includes('"') || r.includes("'")) return e;
|
|
3469
|
+
let n = t.singleQuote ? "'" : '"';
|
|
3470
|
+
return n + r + n;
|
|
3471
|
+
}
|
|
3472
|
+
function fm(e, t, r) {
|
|
3473
|
+
let n = e.originalText.slice(t, r);
|
|
3474
|
+
for (let s of e[Symbol.for("comments")]) {
|
|
3475
|
+
let i = L(s);
|
|
3476
|
+
if (i > r) break;
|
|
3477
|
+
let u = k(s);
|
|
3478
|
+
if (u < t) continue;
|
|
3479
|
+
let o = i - t, a = u - t;
|
|
3480
|
+
n = n.slice(0, o) + G(0, n.slice(o, a), /[^\n]/gu, " ") + n.slice(a);
|
|
3481
|
+
}
|
|
3482
|
+
return n;
|
|
3483
|
+
}
|
|
3484
|
+
var jt = fm;
|
|
3485
|
+
var Lo = b(["ImportDeclaration", "ExportDefaultDeclaration", "ExportNamedDeclaration", "ExportAllDeclaration", "DeclareExportDeclaration", "DeclareExportAllDeclaration"]), ym = b(["EnumBooleanBody", "EnumNumberBody", "EnumBigIntBody", "EnumStringBody", "EnumSymbolBody"]);
|
|
3486
|
+
function sr(e, t, r) {
|
|
3487
|
+
let { node: n, parent: s } = e, i = ym(n), u = n.type === "TSEnumBody" || i, o = Lo(n), a = i && n.hasUnknownMembers, p = u ? "members" : o ? "attributes" : "properties", D = n[p], l = u || n.type === "ObjectPattern" && s.type !== "FunctionDeclaration" && s.type !== "FunctionExpression" && s.type !== "ArrowFunctionExpression" && s.type !== "ObjectMethod" && s.type !== "ClassMethod" && s.type !== "ClassPrivateMethod" && s.type !== "AssignmentPattern" && s.type !== "CatchClause" && n.properties.some((S) => S.value && (S.value.type === "ObjectPattern" || S.value.type === "ArrayPattern")) || n.type !== "ObjectPattern" && t.objectWrap === "preserve" && D.length > 0 && Em(n, D[0], t), E = [], d = e.map(({ node: S }) => {
|
|
3488
|
+
let O = [...E, c(r())];
|
|
3489
|
+
return E = [",", A], oe(S, t) && E.push(y), O;
|
|
3490
|
+
}, p);
|
|
3491
|
+
if (a) {
|
|
3492
|
+
let S;
|
|
3493
|
+
if (C(n, T.Dangling)) {
|
|
3494
|
+
let O = C(n, T.Line);
|
|
3495
|
+
S = [v(e, t), O || Q(t.originalText, k(_(0, Ze(n), -1))) ? y : A, "..."];
|
|
3496
|
+
} else S = ["..."];
|
|
3497
|
+
d.push([...E, ...S]);
|
|
3498
|
+
}
|
|
3499
|
+
let F = !(a || _(0, D, -1)?.type === "RestElement"), P;
|
|
3500
|
+
if (d.length === 0) {
|
|
3501
|
+
if (!C(n, T.Dangling)) return ["{}", U(e, r)];
|
|
3502
|
+
P = c(["{", v(e, t, { indent: true }), f, "}", $(e), U(e, r)]);
|
|
3503
|
+
} else {
|
|
3504
|
+
let S = t.bracketSpacing ? A : f;
|
|
3505
|
+
P = ["{", m([S, ...d]), B(F && ue(t) ? "," : ""), S, "}", $(e), U(e, r)];
|
|
3506
|
+
}
|
|
3507
|
+
return e.match((S) => S.type === "ObjectPattern" && !j(S.decorators), Nt) || We(n) && (e.match(void 0, (S, O) => O === "typeAnnotation", (S, O) => O === "typeAnnotation", Nt) || e.match(void 0, (S, O) => S.type === "FunctionTypeParam" && O === "typeAnnotation", Nt)) || !l && e.match((S) => S.type === "ObjectPattern", (S) => S.type === "AssignmentExpression" || S.type === "VariableDeclarator") ? P : c(P, { shouldBreak: l });
|
|
3508
|
+
}
|
|
3509
|
+
function Em(e, t, r) {
|
|
3510
|
+
let n = r.originalText, s = L(e), i = L(t);
|
|
3511
|
+
if (Lo(e)) {
|
|
3512
|
+
let u = L(e), o = jt(r, u, i);
|
|
3513
|
+
s = u + o.lastIndexOf("{");
|
|
3514
|
+
}
|
|
3515
|
+
return re(n, s, i);
|
|
3516
|
+
}
|
|
3517
|
+
function Oo(e, t, r) {
|
|
3518
|
+
let { node: n } = e;
|
|
3519
|
+
return ["import", n.phase ? ` ${n.phase}` : "", Gs(n), _o(e, t, r), Mo(e, t, r), vo(e, t, r), t.semi ? ";" : ""];
|
|
3520
|
+
}
|
|
3521
|
+
var wo = (e) => e.type === "ExportDefaultDeclaration" || e.type === "DeclareExportDeclaration" && e.default;
|
|
3522
|
+
function bn(e, t, r) {
|
|
3523
|
+
let { node: n } = e, s = [ju(e, t, r), z(e), "export", wo(n) ? " default" : ""], { declaration: i, exported: u } = n;
|
|
3524
|
+
return C(n, T.Dangling) && (s.push(" ", v(e, t)), Rr(n) && s.push(y)), i ? s.push(" ", r("declaration")) : (s.push(Cm(n)), n.type === "ExportAllDeclaration" || n.type === "DeclareExportAllDeclaration" ? (s.push(" *"), u && s.push(" as ", r("exported"))) : s.push(_o(e, t, r)), s.push(Mo(e, t, r), vo(e, t, r))), s.push(dm(n, t)), s;
|
|
3525
|
+
}
|
|
3526
|
+
var Fm = b(["ClassDeclaration", "ComponentDeclaration", "FunctionDeclaration", "TSInterfaceDeclaration", "DeclareClass", "DeclareComponent", "DeclareFunction", "DeclareHook", "HookDeclaration", "TSDeclareFunction", "EnumDeclaration"]);
|
|
3527
|
+
function dm(e, t) {
|
|
3528
|
+
return t.semi && (!e.declaration || wo(e) && !Fm(e.declaration)) ? ";" : "";
|
|
3529
|
+
}
|
|
3530
|
+
function Js(e, t = true) {
|
|
3531
|
+
return e && e !== "value" ? `${t ? " " : ""}${e}${t ? "" : " "}` : "";
|
|
3532
|
+
}
|
|
3533
|
+
function Gs(e, t) {
|
|
3534
|
+
return Js(e.importKind, t);
|
|
3535
|
+
}
|
|
3536
|
+
function Cm(e) {
|
|
3537
|
+
return Js(e.exportKind);
|
|
3538
|
+
}
|
|
3539
|
+
function Mo(e, t, r) {
|
|
3540
|
+
let { node: n } = e;
|
|
3541
|
+
return n.source ? [No(n, t) ? " from" : "", " ", r("source")] : "";
|
|
3542
|
+
}
|
|
3543
|
+
function _o(e, t, r) {
|
|
3544
|
+
let { node: n } = e;
|
|
3545
|
+
if (!No(n, t)) return "";
|
|
3546
|
+
let s = [" "];
|
|
3547
|
+
if (j(n.specifiers)) {
|
|
3548
|
+
let i = [], u = [];
|
|
3549
|
+
e.each(() => {
|
|
3550
|
+
let o = e.node.type;
|
|
3551
|
+
if (o === "ExportNamespaceSpecifier" || o === "ExportDefaultSpecifier" || o === "ImportNamespaceSpecifier" || o === "ImportDefaultSpecifier") i.push(r());
|
|
3552
|
+
else if (o === "ExportSpecifier" || o === "ImportSpecifier") u.push(r());
|
|
3553
|
+
else throw new $e(n, "specifier");
|
|
3554
|
+
}, "specifiers"), s.push(I(", ", i)), u.length > 0 && (i.length > 0 && s.push(", "), u.length > 1 || i.length > 0 || n.specifiers.some((a) => C(a)) ? s.push(c(["{", m([t.bracketSpacing ? A : f, I([",", A], u)]), B(ue(t) ? "," : ""), t.bracketSpacing ? A : f, "}"])) : s.push(["{", t.bracketSpacing ? " " : "", ...u, t.bracketSpacing ? " " : "", "}"]));
|
|
3555
|
+
} else s.push("{}");
|
|
3556
|
+
return s;
|
|
3557
|
+
}
|
|
3558
|
+
function No(e, t) {
|
|
3559
|
+
return e.type !== "ImportDeclaration" || j(e.specifiers) || e.importKind === "type" ? true : jt(t, L(e), L(e.source)).trimEnd().endsWith("from");
|
|
3560
|
+
}
|
|
3561
|
+
function Am(e, t) {
|
|
3562
|
+
if (e.extra?.deprecatedAssertSyntax) return "assert";
|
|
3563
|
+
let r = jt(t, k(e.source), e.attributes?.[0] ? L(e.attributes[0]) : k(e)).trimStart();
|
|
3564
|
+
return r.startsWith("assert") ? "assert" : r.startsWith("with") || j(e.attributes) ? "with" : void 0;
|
|
3565
|
+
}
|
|
3566
|
+
var Tm = (e) => {
|
|
3567
|
+
let { attributes: t } = e;
|
|
3568
|
+
if (t.length !== 1) return false;
|
|
3569
|
+
let [r] = t, { type: n, key: s, value: i } = r;
|
|
3570
|
+
return n === "ImportAttribute" && (s.type === "Identifier" && s.name === "type" || X(s) && s.value === "type") && X(i) && !C(r) && !C(s) && !C(i);
|
|
3571
|
+
};
|
|
3572
|
+
function vo(e, t, r) {
|
|
3573
|
+
let { node: n } = e;
|
|
3574
|
+
if (!n.source) return "";
|
|
3575
|
+
let s = Am(n, t);
|
|
3576
|
+
if (!s) return "";
|
|
3577
|
+
let i = sr(e, t, r);
|
|
3578
|
+
return Tm(n) && (i = Ot(i)), [` ${s} `, i];
|
|
3579
|
+
}
|
|
3580
|
+
function jo(e, t, r) {
|
|
3581
|
+
let { node: n } = e, { type: s } = n, i = s.startsWith("Import"), u = i ? "imported" : "local", o = i ? "local" : "exported", a = n[u], p = n[o], D = "", l = "";
|
|
3582
|
+
return s === "ExportNamespaceSpecifier" || s === "ImportNamespaceSpecifier" ? D = "*" : a && (D = r(u)), p && !xm(n) && (l = r(o)), [Js(s === "ImportSpecifier" ? n.importKind : n.exportKind, false), D, D && l ? " as " : "", l];
|
|
3583
|
+
}
|
|
3584
|
+
function xm(e) {
|
|
3585
|
+
if (e.type !== "ImportSpecifier" && e.type !== "ExportSpecifier") return false;
|
|
3586
|
+
let { local: t, [e.type === "ImportSpecifier" ? "imported" : "exported"]: r } = e;
|
|
3587
|
+
if (t.type !== r.type || !ii(t, r)) return false;
|
|
3588
|
+
if (X(t)) return t.value === r.value && pe(t) === pe(r);
|
|
3589
|
+
switch (t.type) {
|
|
3590
|
+
case "Identifier":
|
|
3591
|
+
return t.name === r.name;
|
|
3592
|
+
default:
|
|
3593
|
+
return false;
|
|
3594
|
+
}
|
|
3595
|
+
}
|
|
3596
|
+
function gm(e) {
|
|
3597
|
+
let t = [e];
|
|
3598
|
+
for (let r = 0; r < t.length; r++) {
|
|
3599
|
+
let n = t[r];
|
|
3600
|
+
for (let s of ["test", "consequent", "alternate"]) {
|
|
3601
|
+
let i = n[s];
|
|
3602
|
+
if (q(i)) return true;
|
|
3603
|
+
i.type === "ConditionalExpression" && t.push(i);
|
|
3604
|
+
}
|
|
3605
|
+
}
|
|
3606
|
+
return false;
|
|
3607
|
+
}
|
|
3608
|
+
function hm(e, t, r) {
|
|
3609
|
+
let { node: n } = e, s = n.type === "ConditionalExpression", i = s ? "alternate" : "falseType", { parent: u } = e, o = s ? r("test") : [r("checkType"), " ", "extends", " ", r("extendsType")];
|
|
3610
|
+
return u.type === n.type && u[i] === n ? ge(2, o) : o;
|
|
3611
|
+
}
|
|
3612
|
+
var Sm = /* @__PURE__ */ new Map([["AssignmentExpression", "right"], ["VariableDeclarator", "init"], ["ReturnStatement", "argument"], ["ThrowStatement", "argument"], ["UnaryExpression", "argument"], ["YieldExpression", "argument"], ["AwaitExpression", "argument"]]);
|
|
3613
|
+
function Bm(e) {
|
|
3614
|
+
let { node: t } = e;
|
|
3615
|
+
if (t.type !== "ConditionalExpression") return false;
|
|
3616
|
+
let r, n = t;
|
|
3617
|
+
for (let s = 0; !r; s++) {
|
|
3618
|
+
let i = e.getParentNode(s);
|
|
3619
|
+
if (i.type === "ChainExpression" && i.expression === n || M(i) && i.callee === n || R(i) && i.object === n || i.type === "TSNonNullExpression" && i.expression === n) {
|
|
3620
|
+
n = i;
|
|
3621
|
+
continue;
|
|
3622
|
+
}
|
|
3623
|
+
i.type === "NewExpression" && i.callee === n || Ae(i) && i.expression === n ? (r = e.getParentNode(s + 1), n = i) : r = i;
|
|
3624
|
+
}
|
|
3625
|
+
return n === t ? false : r[Sm.get(r.type)] === n;
|
|
3626
|
+
}
|
|
3627
|
+
function Ro(e, t, r) {
|
|
3628
|
+
let { node: n } = e, s = n.type === "ConditionalExpression", i = s ? "consequent" : "trueType", u = s ? "alternate" : "falseType", o = s ? ["test"] : ["checkType", "extendsType"], a = n[i], p = n[u], D = [], l = false, { parent: E } = e, d = E.type === n.type && o.some((J) => E[J] === n), F = E.type === n.type && !d, P, S, O = 0;
|
|
3629
|
+
do
|
|
3630
|
+
S = P || n, P = e.getParentNode(O), O++;
|
|
3631
|
+
while (P && P.type === n.type && o.every((J) => P[J] !== S));
|
|
3632
|
+
let g = P || E, x = S;
|
|
3633
|
+
if (s && (q(n[o[0]]) || q(a) || q(p) || gm(x))) {
|
|
3634
|
+
l = true, F = true;
|
|
3635
|
+
let J = (H) => [B("("), m([f, H]), f, B(")")], Z = (H) => H.type === "NullLiteral" || H.type === "Literal" && H.value === null || H.type === "Identifier" && H.name === "undefined";
|
|
3636
|
+
D.push(" ? ", Z(a) ? r(i) : J(r(i)), " : ", p.type === n.type || Z(p) ? r(u) : J(r(u)));
|
|
3637
|
+
} else {
|
|
3638
|
+
let J = (H) => t.useTabs ? m(r(H)) : ge(2, r(H)), Z = [A, "? ", a.type === n.type ? B("", "(") : "", J(i), a.type === n.type ? B("", ")") : "", A, ": ", J(u)];
|
|
3639
|
+
D.push(E.type !== n.type || E[u] === n || d ? Z : t.useTabs ? Ur(m(Z)) : ge(Math.max(0, t.tabWidth - 2), Z));
|
|
3640
|
+
}
|
|
3641
|
+
let h = [i, u, ...o].some((J) => C(n[J], (Z) => ee(Z) && re(t.originalText, L(Z), k(Z)))), N = (J) => E === g ? c(J, { shouldBreak: h }) : h ? [J, Te] : J, Y = !l && (R(E) || E.type === "NGPipeExpression" && E.left === n) && !E.computed, De = Bm(e), Fe = N([hm(e, t, r), F ? D : m(D), s && Y && !De ? f : ""]);
|
|
3642
|
+
return d || De ? c([m([f, Fe]), f]) : Fe;
|
|
3643
|
+
}
|
|
3644
|
+
function bm(e, t) {
|
|
3645
|
+
return (R(t) || t.type === "NGPipeExpression" && t.left === e) && !t.computed;
|
|
3646
|
+
}
|
|
3647
|
+
function Pm(e, t, r, n) {
|
|
3648
|
+
return [...e.map((i) => Ze(i)), Ze(t), Ze(r)].flat().some((i) => ee(i) && re(n.originalText, L(i), k(i)));
|
|
3649
|
+
}
|
|
3650
|
+
var km = /* @__PURE__ */ new Map([["AssignmentExpression", "right"], ["VariableDeclarator", "init"], ["ReturnStatement", "argument"], ["ThrowStatement", "argument"], ["UnaryExpression", "argument"], ["YieldExpression", "argument"], ["AwaitExpression", "argument"]]);
|
|
3651
|
+
function Im(e) {
|
|
3652
|
+
let { node: t } = e;
|
|
3653
|
+
if (t.type !== "ConditionalExpression") return false;
|
|
3654
|
+
let r, n = t;
|
|
3655
|
+
for (let s = 0; !r; s++) {
|
|
3656
|
+
let i = e.getParentNode(s);
|
|
3657
|
+
if (i.type === "ChainExpression" && i.expression === n || M(i) && i.callee === n || R(i) && i.object === n || i.type === "TSNonNullExpression" && i.expression === n) {
|
|
3658
|
+
n = i;
|
|
3659
|
+
continue;
|
|
3660
|
+
}
|
|
3661
|
+
i.type === "NewExpression" && i.callee === n || Ae(i) && i.expression === n ? (r = e.getParentNode(s + 1), n = i) : r = i;
|
|
3662
|
+
}
|
|
3663
|
+
return n === t ? false : r[km.get(r.type)] === n;
|
|
3664
|
+
}
|
|
3665
|
+
var Ws = (e) => [B("("), m([f, e]), f, B(")")];
|
|
3666
|
+
function ir(e, t, r, n) {
|
|
3667
|
+
if (!t.experimentalTernaries) return Ro(e, t, r);
|
|
3668
|
+
let { node: s } = e, i = s.type === "ConditionalExpression", u = qe(s), o = i ? "consequent" : "trueType", a = i ? "alternate" : "falseType", p = i ? ["test"] : ["checkType", "extendsType"], D = s[o], l = s[a], E = p.map((pr) => s[pr]), { parent: d } = e, F = d.type === s.type, P = F && p.some((pr) => d[pr] === s), S = F && d[a] === s, O = D.type === s.type, g = l.type === s.type, x = g || S, h = t.tabWidth > 2 || t.useTabs, N, Y, De = 0;
|
|
3669
|
+
do
|
|
3670
|
+
Y = N || s, N = e.getParentNode(De), De++;
|
|
3671
|
+
while (N && N.type === s.type && p.every((pr) => N[pr] !== Y));
|
|
3672
|
+
let Fe = N || d, J = n && n.assignmentLayout && n.assignmentLayout !== "break-after-operator" && (d.type === "AssignmentExpression" || d.type === "VariableDeclarator" || d.type === "ClassProperty" || d.type === "PropertyDefinition" || d.type === "ClassPrivateProperty" || d.type === "ObjectProperty" || d.type === "Property"), Z = (d.type === "ReturnStatement" || d.type === "ThrowStatement") && !(O || g), H = i && Fe.type === "JSXExpressionContainer" && e.grandparent.type !== "JSXAttribute", nt = Im(e), w = bm(s, d), ne = u && he(e, t), ae = h ? t.useTabs ? " " : " ".repeat(t.tabWidth - 1) : "", st = Pm(E, D, l, t) || O || g, ht = !x && !F && !u && (H ? D.type === "NullLiteral" || D.type === "Literal" && D.value === null : fr(D, t) && Hn(s.test, 3)), wn = x || S || u && !F || F && i && Hn(s.test, 1) || ht, Sr = [];
|
|
3673
|
+
!O && C(D, T.Dangling) && e.call(() => {
|
|
3674
|
+
Sr.push(v(e, t), y);
|
|
3675
|
+
}, "consequent");
|
|
3676
|
+
let or = [];
|
|
3677
|
+
C(s.test, T.Dangling) && e.call(() => {
|
|
3678
|
+
or.push(v(e, t));
|
|
3679
|
+
}, "test"), !g && C(l, T.Dangling) && e.call(() => {
|
|
3680
|
+
or.push(v(e, t));
|
|
3681
|
+
}, "alternate"), C(s, T.Dangling) && or.push(v(e, t));
|
|
3682
|
+
let Hs = Symbol("test"), ca = Symbol("consequent"), Br = Symbol("test-and-consequent"), la = i ? [Ws(r("test")), s.test.type === "ConditionalExpression" ? Te : ""] : [r("checkType"), " ", "extends", " ", qe(s.extendsType) || s.extendsType.type === "TSMappedType" ? r("extendsType") : c(Ws(r("extendsType")))], Xs = c([la, " ?"], { id: Hs }), ma = r(o), br = m([O || H && (q(D) || F || x) ? y : A, Sr, ma]), Da = wn ? c([Xs, x ? br : B(br, c(br, { id: ca }), { groupId: Hs })], { id: Br }) : [Xs, br], Mn = r(a), Vs = ht ? B(Mn, Ur(Ws(Mn)), { groupId: Br }) : Mn, ar = [Da, or.length > 0 ? [m([y, or]), y] : g ? y : ht ? B(A, " ", { groupId: Br }) : A, ":", g ? " " : h ? wn ? B(ae, B(x || ht ? " " : ae, " "), { groupId: Br }) : B(ae, " ") : " ", g ? Vs : c([m(Vs), H && !ht ? f : ""]), w && !nt ? f : "", st ? Te : ""];
|
|
3683
|
+
return J && !st ? c(m([f, c(ar)])) : J || Z ? c(m(ar)) : nt || u && P ? c([m([f, ar]), ne ? f : ""]) : d === Fe ? c(ar) : ar;
|
|
3684
|
+
}
|
|
3685
|
+
function Jo(e, t, r, n) {
|
|
3686
|
+
let { node: s } = e;
|
|
3687
|
+
if (Nr(s)) return Io(e, t);
|
|
3688
|
+
switch (s.type) {
|
|
3689
|
+
case "JsExpressionRoot":
|
|
3690
|
+
return r("node");
|
|
3691
|
+
case "JsonRoot":
|
|
3692
|
+
return [v(e, t), r("node"), y];
|
|
3693
|
+
case "File":
|
|
3694
|
+
return bo(e, t, r) ?? r("program");
|
|
3695
|
+
case "ExpressionStatement":
|
|
3696
|
+
return Bo(e, t, r);
|
|
3697
|
+
case "ChainExpression":
|
|
3698
|
+
return r("expression");
|
|
3699
|
+
case "ParenthesizedExpression":
|
|
3700
|
+
return !C(s.expression) && (ie(s.expression) || W(s.expression)) ? ["(", r("expression"), ")"] : c(["(", m([f, r("expression")]), f, ")"]);
|
|
3701
|
+
case "AssignmentExpression":
|
|
3702
|
+
return Ku(e, t, r);
|
|
3703
|
+
case "VariableDeclarator":
|
|
3704
|
+
return Qu(e, t, r);
|
|
3705
|
+
case "BinaryExpression":
|
|
3706
|
+
case "LogicalExpression":
|
|
3707
|
+
return en(e, t, r);
|
|
3708
|
+
case "AssignmentPattern":
|
|
3709
|
+
return [r("left"), " = ", r("right")];
|
|
3710
|
+
case "OptionalMemberExpression":
|
|
3711
|
+
case "MemberExpression":
|
|
3712
|
+
return Yu(e, t, r);
|
|
3713
|
+
case "MetaProperty":
|
|
3714
|
+
return [r("meta"), ".", r("property")];
|
|
3715
|
+
case "BindExpression":
|
|
3716
|
+
return [r("object"), c(m([f, tn(e, t, r)]))];
|
|
3717
|
+
case "Identifier":
|
|
3718
|
+
return [s.name, $(e), ln(e), U(e, r)];
|
|
3719
|
+
case "V8IntrinsicIdentifier":
|
|
3720
|
+
return ["%", s.name];
|
|
3721
|
+
case "SpreadElement":
|
|
3722
|
+
case "SpreadElementPattern":
|
|
3723
|
+
case "SpreadPropertyPattern":
|
|
3724
|
+
case "RestElement":
|
|
3725
|
+
return hn(e, r);
|
|
3726
|
+
case "FunctionDeclaration":
|
|
3727
|
+
case "FunctionExpression":
|
|
3728
|
+
return un(e, t, r, n);
|
|
3729
|
+
case "ArrowFunctionExpression":
|
|
3730
|
+
return Ao(e, t, r, n);
|
|
3731
|
+
case "YieldExpression":
|
|
3732
|
+
return [`yield${s.delegate ? "*" : ""}`, s.argument ? [" ", r("argument")] : ""];
|
|
3733
|
+
case "AwaitExpression": {
|
|
3734
|
+
let i = ["await"];
|
|
3735
|
+
if (s.argument) {
|
|
3736
|
+
i.push(" ", r("argument"));
|
|
3737
|
+
let { parent: u } = e;
|
|
3738
|
+
if (M(u) && u.callee === s || R(u) && u.object === s) {
|
|
3739
|
+
i = [m([f, ...i]), f];
|
|
3740
|
+
let o = e.findAncestor((a) => a.type === "AwaitExpression" || a.type === "BlockStatement");
|
|
3741
|
+
if (o?.type !== "AwaitExpression" || !fe(o.argument, (a) => a === s)) return c(i);
|
|
3742
|
+
}
|
|
3743
|
+
}
|
|
3744
|
+
return i;
|
|
3745
|
+
}
|
|
3746
|
+
case "ExportDefaultDeclaration":
|
|
3747
|
+
case "ExportNamedDeclaration":
|
|
3748
|
+
case "ExportAllDeclaration":
|
|
3749
|
+
return bn(e, t, r);
|
|
3750
|
+
case "ImportDeclaration":
|
|
3751
|
+
return Oo(e, t, r);
|
|
3752
|
+
case "ImportSpecifier":
|
|
3753
|
+
case "ExportSpecifier":
|
|
3754
|
+
case "ImportNamespaceSpecifier":
|
|
3755
|
+
case "ExportNamespaceSpecifier":
|
|
3756
|
+
case "ImportDefaultSpecifier":
|
|
3757
|
+
case "ExportDefaultSpecifier":
|
|
3758
|
+
return jo(e, t, r);
|
|
3759
|
+
case "ImportAttribute":
|
|
3760
|
+
return sn(e, t, r);
|
|
3761
|
+
case "Program":
|
|
3762
|
+
case "BlockStatement":
|
|
3763
|
+
case "StaticBlock":
|
|
3764
|
+
return Sn(e, t, r);
|
|
3765
|
+
case "ClassBody":
|
|
3766
|
+
return vt(e, t, r);
|
|
3767
|
+
case "ThrowStatement":
|
|
3768
|
+
return ao(e, t, r);
|
|
3769
|
+
case "ReturnStatement":
|
|
3770
|
+
return oo(e, t, r);
|
|
3771
|
+
case "NewExpression":
|
|
3772
|
+
case "ImportExpression":
|
|
3773
|
+
case "OptionalCallExpression":
|
|
3774
|
+
case "CallExpression":
|
|
3775
|
+
return _t(e, t, r);
|
|
3776
|
+
case "ObjectExpression":
|
|
3777
|
+
case "ObjectPattern":
|
|
3778
|
+
return sr(e, t, r);
|
|
3779
|
+
case "Property":
|
|
3780
|
+
return lt(s) ? gr(e, t, r) : sn(e, t, r);
|
|
3781
|
+
case "ObjectProperty":
|
|
3782
|
+
return sn(e, t, r);
|
|
3783
|
+
case "ObjectMethod":
|
|
3784
|
+
return gr(e, t, r);
|
|
3785
|
+
case "Decorator":
|
|
3786
|
+
return ["@", r("expression")];
|
|
3787
|
+
case "ArrayExpression":
|
|
3788
|
+
case "ArrayPattern":
|
|
3789
|
+
return nr(e, t, r);
|
|
3790
|
+
case "SequenceExpression": {
|
|
3791
|
+
let { parent: i } = e;
|
|
3792
|
+
if (i.type === "ExpressionStatement" || i.type === "ForStatement") {
|
|
3793
|
+
let o = [];
|
|
3794
|
+
return e.each(({ isFirst: a }) => {
|
|
3795
|
+
a ? o.push(r()) : o.push(",", m([A, r()]));
|
|
3796
|
+
}, "expressions"), c(o);
|
|
3797
|
+
}
|
|
3798
|
+
let u = I([",", A], e.map(r, "expressions"));
|
|
3799
|
+
return (i.type === "ReturnStatement" || i.type === "ThrowStatement") && e.key === "argument" || i.type === "ArrowFunctionExpression" && e.key === "body" ? c(B([m([f, u]), f], u)) : c(u);
|
|
3800
|
+
}
|
|
3801
|
+
case "ThisExpression":
|
|
3802
|
+
return "this";
|
|
3803
|
+
case "Super":
|
|
3804
|
+
return "super";
|
|
3805
|
+
case "Directive":
|
|
3806
|
+
return [r("value"), t.semi ? ";" : ""];
|
|
3807
|
+
case "UnaryExpression": {
|
|
3808
|
+
let i = [s.operator];
|
|
3809
|
+
return /[a-z]$/u.test(s.operator) && i.push(" "), C(s.argument) ? i.push(c(["(", m([f, r("argument")]), f, ")"])) : i.push(r("argument")), i;
|
|
3810
|
+
}
|
|
3811
|
+
case "UpdateExpression":
|
|
3812
|
+
return [s.prefix ? s.operator : "", r("argument"), s.prefix ? "" : s.operator];
|
|
3813
|
+
case "ConditionalExpression":
|
|
3814
|
+
return ir(e, t, r, n);
|
|
3815
|
+
case "VariableDeclaration": {
|
|
3816
|
+
let i = e.map(r, "declarations"), u = e.parent, o = u.type === "ForStatement" || u.type === "ForInStatement" || u.type === "ForOfStatement", a = s.declarations.some((D) => D.init), p;
|
|
3817
|
+
return i.length === 1 && !C(s.declarations[0]) ? p = i[0] : i.length > 0 && (p = m(i[0])), c([z(e), s.kind, p ? [" ", p] : "", m(i.slice(1).map((D) => [",", a && !o ? y : A, D])), t.semi && !(o && u.body !== s) ? ";" : ""]);
|
|
3818
|
+
}
|
|
3819
|
+
case "WithStatement":
|
|
3820
|
+
return c(["with (", r("object"), ")", dt(s.body, r("body"))]);
|
|
3821
|
+
case "IfStatement": {
|
|
3822
|
+
let i = dt(s.consequent, r("consequent")), o = [c(["if (", c([m([f, r("test")]), f]), ")", i])];
|
|
3823
|
+
if (s.alternate) {
|
|
3824
|
+
let a = C(s.consequent, T.Trailing | T.Line) || Rr(s), p = s.consequent.type === "BlockStatement" && !a;
|
|
3825
|
+
o.push(p ? " " : y), C(s, T.Dangling) && o.push(v(e, t), a ? y : " "), o.push("else", c(dt(s.alternate, r("alternate"), s.alternate.type === "IfStatement")));
|
|
3826
|
+
}
|
|
3827
|
+
return o;
|
|
3828
|
+
}
|
|
3829
|
+
case "ForStatement": {
|
|
3830
|
+
let i = dt(s.body, r("body")), u = v(e, t), o = u ? [u, f] : "";
|
|
3831
|
+
return !s.init && !s.test && !s.update ? [o, c(["for (;;)", i])] : [o, c(["for (", c([m([f, r("init"), ";", A, r("test"), ";", s.update ? [A, r("update")] : B("", A)]), f]), ")", i])];
|
|
3832
|
+
}
|
|
3833
|
+
case "WhileStatement":
|
|
3834
|
+
return c(["while (", c([m([f, r("test")]), f]), ")", dt(s.body, r("body"))]);
|
|
3835
|
+
case "ForInStatement":
|
|
3836
|
+
return c(["for (", r("left"), " in ", r("right"), ")", dt(s.body, r("body"))]);
|
|
3837
|
+
case "ForOfStatement":
|
|
3838
|
+
return c(["for", s.await ? " await" : "", " (", r("left"), " of ", r("right"), ")", dt(s.body, r("body"))]);
|
|
3839
|
+
case "DoWhileStatement": {
|
|
3840
|
+
let i = dt(s.body, r("body"));
|
|
3841
|
+
return [c(["do", i]), s.body.type === "BlockStatement" ? " " : y, "while (", c([m([f, r("test")]), f]), ")", t.semi ? ";" : ""];
|
|
3842
|
+
}
|
|
3843
|
+
case "DoExpression":
|
|
3844
|
+
return [s.async ? "async " : "", "do ", r("body")];
|
|
3845
|
+
case "BreakStatement":
|
|
3846
|
+
case "ContinueStatement":
|
|
3847
|
+
return [s.type === "BreakStatement" ? "break" : "continue", s.label ? [" ", r("label")] : "", t.semi ? ";" : ""];
|
|
3848
|
+
case "LabeledStatement":
|
|
3849
|
+
return [r("label"), `:${s.body.type === "EmptyStatement" && !C(s.body, T.Leading) ? "" : " "}`, r("body")];
|
|
3850
|
+
case "TryStatement":
|
|
3851
|
+
return ["try ", r("block"), s.handler ? [" ", r("handler")] : "", s.finalizer ? [" finally ", r("finalizer")] : ""];
|
|
3852
|
+
case "CatchClause":
|
|
3853
|
+
if (s.param) {
|
|
3854
|
+
let i = C(s.param, (o) => !ee(o) || o.leading && Q(t.originalText, k(o)) || o.trailing && Q(t.originalText, L(o), { backwards: true })), u = r("param");
|
|
3855
|
+
return ["catch ", i ? ["(", m([f, u]), f, ") "] : ["(", u, ") "], r("body")];
|
|
3856
|
+
}
|
|
3857
|
+
return ["catch ", r("body")];
|
|
3858
|
+
case "SwitchStatement":
|
|
3859
|
+
return [c(["switch (", m([f, r("discriminant")]), f, ")"]), " {", s.cases.length > 0 ? m([y, I(y, e.map(({ node: i, isLast: u }) => [r(), !u && oe(i, t) ? y : ""], "cases"))]) : "", y, "}"];
|
|
3860
|
+
case "SwitchCase": {
|
|
3861
|
+
let i = [];
|
|
3862
|
+
s.test ? i.push("case ", r("test"), ":") : i.push("default:"), C(s, T.Dangling) && i.push(" ", v(e, t));
|
|
3863
|
+
let u = s.consequent.filter((o) => o.type !== "EmptyStatement");
|
|
3864
|
+
if (u.length > 0) {
|
|
3865
|
+
let o = hr(e, t, r, "consequent");
|
|
3866
|
+
i.push(u.length === 1 && u[0].type === "BlockStatement" ? [" ", o] : m([y, o]));
|
|
3867
|
+
}
|
|
3868
|
+
return i;
|
|
3869
|
+
}
|
|
3870
|
+
case "DebuggerStatement":
|
|
3871
|
+
return ["debugger", t.semi ? ";" : ""];
|
|
3872
|
+
case "ClassDeclaration":
|
|
3873
|
+
case "ClassExpression":
|
|
3874
|
+
return er(e, t, r);
|
|
3875
|
+
case "ClassMethod":
|
|
3876
|
+
case "ClassPrivateMethod":
|
|
3877
|
+
case "MethodDefinition":
|
|
3878
|
+
return pn(e, t, r);
|
|
3879
|
+
case "ClassProperty":
|
|
3880
|
+
case "PropertyDefinition":
|
|
3881
|
+
case "ClassPrivateProperty":
|
|
3882
|
+
case "ClassAccessorProperty":
|
|
3883
|
+
case "AccessorProperty":
|
|
3884
|
+
return cn(e, t, r);
|
|
3885
|
+
case "TemplateElement":
|
|
3886
|
+
return Ge(s.value.raw);
|
|
3887
|
+
case "TemplateLiteral":
|
|
3888
|
+
return $r(e, t, r);
|
|
3889
|
+
case "TaggedTemplateExpression":
|
|
3890
|
+
return ru(e, t, r);
|
|
3891
|
+
case "PrivateIdentifier":
|
|
3892
|
+
return ["#", s.name];
|
|
3893
|
+
case "PrivateName":
|
|
3894
|
+
return ["#", r("id")];
|
|
3895
|
+
case "TopicReference":
|
|
3896
|
+
return "%";
|
|
3897
|
+
case "ArgumentPlaceholder":
|
|
3898
|
+
return "?";
|
|
3899
|
+
case "ModuleExpression":
|
|
3900
|
+
return ["module ", r("body")];
|
|
3901
|
+
case "VoidPattern":
|
|
3902
|
+
return "void";
|
|
3903
|
+
case "EmptyStatement":
|
|
3904
|
+
if (bt(e)) return ";";
|
|
3905
|
+
case "InterpreterDirective":
|
|
3906
|
+
default:
|
|
3907
|
+
throw new $e(s, "ESTree");
|
|
3908
|
+
}
|
|
3909
|
+
}
|
|
3910
|
+
var Lm = b(["SatisfiesExpression", "TSSatisfiesExpression"]);
|
|
3911
|
+
function Pn(e, t, r) {
|
|
3912
|
+
let { parent: n, node: s, key: i } = e, o = s.type === "AsConstExpression" ? "const" : r("typeAnnotation"), a = [r("expression"), " ", Lm(s) ? "satisfies" : "as", " ", o];
|
|
3913
|
+
return i === "callee" && M(n) || i === "object" && R(n) ? c([m([f, ...a]), f]) : a;
|
|
3914
|
+
}
|
|
3915
|
+
function Go(e, t, r) {
|
|
3916
|
+
let { node: n } = e, s = [z(e), "component"];
|
|
3917
|
+
n.id && s.push(" ", r("id")), s.push(r("typeParameters"));
|
|
3918
|
+
let i = Om(e, t, r);
|
|
3919
|
+
return n.rendersType ? s.push(c([i, " ", r("rendersType")])) : s.push(c([i])), n.body && s.push(" ", r("body")), t.semi && n.type === "DeclareComponent" && s.push(";"), s;
|
|
3920
|
+
}
|
|
3921
|
+
function Om(e, t, r) {
|
|
3922
|
+
let { node: n } = e, s = n.params;
|
|
3923
|
+
if (n.rest && (s = [...s, n.rest]), s.length === 0) return ["(", v(e, t, { filter: (u) => Ne(t.originalText, k(u)) === ")" }), ")"];
|
|
3924
|
+
let i = [];
|
|
3925
|
+
return Mm(e, (u, o) => {
|
|
3926
|
+
let a = o === s.length - 1;
|
|
3927
|
+
a && n.rest && i.push("..."), i.push(r()), !a && (i.push(","), oe(s[o], t) ? i.push(y, y) : i.push(A));
|
|
3928
|
+
}), ["(", m([f, ...i]), B(ue(t, "all") && !wm(n, s) ? "," : ""), f, ")"];
|
|
3929
|
+
}
|
|
3930
|
+
function wm(e, t) {
|
|
3931
|
+
return e.rest || _(0, t, -1)?.type === "RestElement";
|
|
3932
|
+
}
|
|
3933
|
+
function Mm(e, t) {
|
|
3934
|
+
let { node: r } = e, n = 0, s = (i) => t(i, n++);
|
|
3935
|
+
e.each(s, "params"), r.rest && e.call(s, "rest");
|
|
3936
|
+
}
|
|
3937
|
+
function Wo(e, t, r) {
|
|
3938
|
+
let { node: n } = e;
|
|
3939
|
+
return n.shorthand ? r("local") : [r("name"), " as ", r("local")];
|
|
3940
|
+
}
|
|
3941
|
+
function qo(e, t, r) {
|
|
3942
|
+
let { node: n } = e, s = [];
|
|
3943
|
+
return n.name && s.push(r("name"), n.optional ? "?: " : ": "), s.push(r("typeAnnotation")), s;
|
|
3944
|
+
}
|
|
3945
|
+
function kn(e, t, r) {
|
|
3946
|
+
return sr(e, t, r);
|
|
3947
|
+
}
|
|
3948
|
+
function In(e, t) {
|
|
3949
|
+
let { node: r } = e, n = t("id");
|
|
3950
|
+
r.computed && (n = ["[", n, "]"]);
|
|
3951
|
+
let s = "";
|
|
3952
|
+
return r.initializer && (s = t("initializer")), r.init && (s = t("init")), s ? [n, " = ", s] : n;
|
|
3953
|
+
}
|
|
3954
|
+
function Ln(e, t) {
|
|
3955
|
+
let { node: r } = e;
|
|
3956
|
+
return [z(e), r.const ? "const " : "", "enum ", t("id"), " ", t("body")];
|
|
3957
|
+
}
|
|
3958
|
+
function Uo(e, t, r) {
|
|
3959
|
+
let { node: n } = e, s = ["hook"];
|
|
3960
|
+
n.id && s.push(" ", r("id"));
|
|
3961
|
+
let i = Ke(e, t, r, false, true), u = Zt(e, r), o = ct(n, u);
|
|
3962
|
+
return s.push(c([o ? c(i) : i, u]), n.body ? " " : "", r("body")), s;
|
|
3963
|
+
}
|
|
3964
|
+
function Ho(e, t, r) {
|
|
3965
|
+
let { node: n } = e, s = [z(e), "hook"];
|
|
3966
|
+
return n.id && s.push(" ", r("id")), t.semi && s.push(";"), s;
|
|
3967
|
+
}
|
|
3968
|
+
function Yo(e) {
|
|
3969
|
+
let { node: t } = e;
|
|
3970
|
+
return t.type === "HookTypeAnnotation" && e.getParentNode(2)?.type === "DeclareHook";
|
|
3971
|
+
}
|
|
3972
|
+
function Xo(e, t, r) {
|
|
3973
|
+
let { node: n } = e, s = Ke(e, t, r, false, true), i = [Yo(e) ? ": " : " => ", r("returnType")];
|
|
3974
|
+
return c([Yo(e) ? "" : "hook ", ct(n, i) ? c(s) : s, i]);
|
|
3975
|
+
}
|
|
3976
|
+
function _m(e) {
|
|
3977
|
+
switch (e) {
|
|
3978
|
+
case null:
|
|
3979
|
+
return "";
|
|
3980
|
+
case "PlusOptional":
|
|
3981
|
+
return "+?";
|
|
3982
|
+
case "MinusOptional":
|
|
3983
|
+
return "-?";
|
|
3984
|
+
case "Optional":
|
|
3985
|
+
return "?";
|
|
3986
|
+
}
|
|
3987
|
+
}
|
|
3988
|
+
function $o(e, t, r) {
|
|
3989
|
+
let { node: n } = e;
|
|
3990
|
+
return [c([n.variance ? r("variance") : "", "[", m([r("keyTparam"), " in ", r("sourceType")]), "]", _m(n.optional), ": ", r("propType")]), ve(e, t)];
|
|
3991
|
+
}
|
|
3992
|
+
function Vo(e, t) {
|
|
3993
|
+
return e === "+" || e === "-" ? e + t : t;
|
|
3994
|
+
}
|
|
3995
|
+
function Ko(e, t, r) {
|
|
3996
|
+
let { node: n } = e, s = false;
|
|
3997
|
+
if (t.objectWrap === "preserve") {
|
|
3998
|
+
let i = L(n), u = jt(t, i + 1, L(n.key)), o = i + 1 + u.search(/\S/u);
|
|
3999
|
+
re(t.originalText, i, o) && (s = true);
|
|
4000
|
+
}
|
|
4001
|
+
return c(["{", m([t.bracketSpacing ? A : f, C(n, T.Dangling) ? c([v(e, t), y]) : "", c([n.readonly ? [Vo(n.readonly, "readonly"), " "] : "", "[", r("key"), " in ", r("constraint"), n.nameType ? [" as ", r("nameType")] : "", "]", n.optional ? Vo(n.optional, "?") : "", n.typeAnnotation ? ": " : "", r("typeAnnotation")]), t.semi ? B(";") : ""]), t.bracketSpacing ? A : f, "}"], { shouldBreak: s });
|
|
4002
|
+
}
|
|
4003
|
+
function Qo(e, t, r) {
|
|
4004
|
+
let { node: n } = e;
|
|
4005
|
+
return [c(["match (", m([f, r("argument")]), f, ")"]), " {", n.cases.length > 0 ? m([y, I(y, e.map(({ node: s, isLast: i }) => [r(), !i && oe(s, t) ? y : ""], "cases"))]) : "", y, "}"];
|
|
4006
|
+
}
|
|
4007
|
+
function zo(e, t, r) {
|
|
4008
|
+
let { node: n } = e, s = C(n, T.Dangling) ? [" ", v(e, t)] : [], i = n.type === "MatchStatementCase" ? [" ", r("body")] : m([A, r("body"), ","]);
|
|
4009
|
+
return [r("pattern"), n.guard ? c([m([A, "if (", r("guard"), ")"])]) : "", c([" =>", s, i])];
|
|
4010
|
+
}
|
|
4011
|
+
function Zo(e, t, r) {
|
|
4012
|
+
let { node: n } = e;
|
|
4013
|
+
switch (n.type) {
|
|
4014
|
+
case "MatchOrPattern":
|
|
4015
|
+
return jm(e, t, r);
|
|
4016
|
+
case "MatchAsPattern":
|
|
4017
|
+
return [r("pattern"), " as ", r("target")];
|
|
4018
|
+
case "MatchWildcardPattern":
|
|
4019
|
+
return ["_"];
|
|
4020
|
+
case "MatchLiteralPattern":
|
|
4021
|
+
return r("literal");
|
|
4022
|
+
case "MatchUnaryPattern":
|
|
4023
|
+
return [n.operator, r("argument")];
|
|
4024
|
+
case "MatchIdentifierPattern":
|
|
4025
|
+
return r("id");
|
|
4026
|
+
case "MatchMemberPattern": {
|
|
4027
|
+
let s = n.property.type === "Identifier" ? [".", r("property")] : ["[", m([f, r("property")]), f, "]"];
|
|
4028
|
+
return c([r("base"), s]);
|
|
4029
|
+
}
|
|
4030
|
+
case "MatchBindingPattern":
|
|
4031
|
+
return [n.kind, " ", r("id")];
|
|
4032
|
+
case "MatchObjectPattern": {
|
|
4033
|
+
let s = e.map(r, "properties");
|
|
4034
|
+
return n.rest && s.push(r("rest")), c(["{", m([f, I([",", A], s)]), n.rest ? "" : B(","), f, "}"]);
|
|
4035
|
+
}
|
|
4036
|
+
case "MatchArrayPattern": {
|
|
4037
|
+
let s = e.map(r, "elements");
|
|
4038
|
+
return n.rest && s.push(r("rest")), c(["[", m([f, I([",", A], s)]), n.rest ? "" : B(","), f, "]"]);
|
|
4039
|
+
}
|
|
4040
|
+
case "MatchObjectPatternProperty":
|
|
4041
|
+
return n.shorthand ? r("pattern") : c([r("key"), ":", m([A, r("pattern")])]);
|
|
4042
|
+
case "MatchRestPattern": {
|
|
4043
|
+
let s = ["..."];
|
|
4044
|
+
return n.argument && s.push(r("argument")), s;
|
|
4045
|
+
}
|
|
4046
|
+
}
|
|
4047
|
+
}
|
|
4048
|
+
var ea = b(["MatchWildcardPattern", "MatchLiteralPattern", "MatchUnaryPattern", "MatchIdentifierPattern"]);
|
|
4049
|
+
function Nm(e) {
|
|
4050
|
+
let { patterns: t } = e;
|
|
4051
|
+
if (t.some((n) => C(n))) return false;
|
|
4052
|
+
let r = t.find((n) => n.type === "MatchObjectPattern");
|
|
4053
|
+
return r ? t.every((n) => n === r || ea(n)) : false;
|
|
4054
|
+
}
|
|
4055
|
+
function vm(e) {
|
|
4056
|
+
return ea(e) || e.type === "MatchObjectPattern" ? true : e.type === "MatchOrPattern" ? Nm(e) : false;
|
|
4057
|
+
}
|
|
4058
|
+
function jm(e, t, r) {
|
|
4059
|
+
let { node: n } = e, { parent: s } = e, i = s.type !== "MatchStatementCase" && s.type !== "MatchExpressionCase" && s.type !== "MatchArrayPattern" && s.type !== "MatchObjectPatternProperty" && !Ce(t.originalText, n), u = vm(n), o = e.map(() => {
|
|
4060
|
+
let p = r();
|
|
4061
|
+
return u || (p = ge(2, p)), me(e, p, t);
|
|
4062
|
+
}, "patterns");
|
|
4063
|
+
if (u) return I(" | ", o);
|
|
4064
|
+
let a = [B(["| "]), I([A, "| "], o)];
|
|
4065
|
+
return he(e, t) ? c([m([B([f]), a]), f]) : s.type === "MatchArrayPattern" && s.elements.length > 1 ? c([m([B(["(", f]), a]), f, B(")")]) : c(i ? m(a) : a);
|
|
4066
|
+
}
|
|
4067
|
+
function Rm(e, t, r) {
|
|
4068
|
+
let { node: n } = e;
|
|
4069
|
+
return K(n).length === 1 && n.type.startsWith("TS") && !n[r][0].constraint && e.parent.type === "ArrowFunctionExpression" && !(t.filepath && /\.ts$/u.test(t.filepath));
|
|
4070
|
+
}
|
|
4071
|
+
function Rt(e, t, r, n) {
|
|
4072
|
+
let { node: s } = e;
|
|
4073
|
+
if (!s[n]) return "";
|
|
4074
|
+
if (!Array.isArray(s[n])) return r(n);
|
|
4075
|
+
let i = Pt(e.grandparent), u = e.match((p) => !(p[n].length === 1 && We(p[n][0])), void 0, (p, D) => D === "typeAnnotation", (p) => p.type === "Identifier", ks);
|
|
4076
|
+
if (s[n].length === 0 || !u && (i || s[n].length === 1 && (s[n][0].type === "NullableTypeAnnotation" || Os(s[n][0])))) return ["<", I(", ", e.map(r, n)), Jm(e, t), ">"];
|
|
4077
|
+
let a = s.type === "TSTypeParameterInstantiation" ? "" : Rm(e, t, n) ? "," : ue(t) ? B(",") : "";
|
|
4078
|
+
return c(["<", m([f, I([",", A], e.map(r, n))]), a, f, ">"]);
|
|
4079
|
+
}
|
|
4080
|
+
function Jm(e, t) {
|
|
4081
|
+
let { node: r } = e;
|
|
4082
|
+
if (!C(r, T.Dangling)) return "";
|
|
4083
|
+
let n = !C(r, T.Line), s = v(e, t, { indent: !n });
|
|
4084
|
+
return n ? s : [s, y];
|
|
4085
|
+
}
|
|
4086
|
+
function On(e, t, r) {
|
|
4087
|
+
let { node: n } = e, s = [n.const ? "const " : ""], i = n.type === "TSTypeParameter" ? r("name") : n.name;
|
|
4088
|
+
if (n.variance && s.push(r("variance")), n.in && s.push("in "), n.out && s.push("out "), s.push(i), n.bound && (n.usesExtendsBound && s.push(" extends "), s.push(U(e, r, "bound"))), n.constraint) {
|
|
4089
|
+
let u = Symbol("constraint");
|
|
4090
|
+
s.push(" extends", c(m(A), { id: u }), we, ft(r("constraint"), { groupId: u }));
|
|
4091
|
+
}
|
|
4092
|
+
if (n.default) {
|
|
4093
|
+
let u = Symbol("default");
|
|
4094
|
+
s.push(" =", c(m(A), { id: u }), we, ft(r("default"), { groupId: u }));
|
|
4095
|
+
}
|
|
4096
|
+
return c(s);
|
|
4097
|
+
}
|
|
4098
|
+
function ta(e, t, r) {
|
|
4099
|
+
let { node: n } = e;
|
|
4100
|
+
if (Or(n)) return n.type.slice(0, -14).toLowerCase();
|
|
4101
|
+
switch (n.type) {
|
|
4102
|
+
case "ComponentDeclaration":
|
|
4103
|
+
case "DeclareComponent":
|
|
4104
|
+
case "ComponentTypeAnnotation":
|
|
4105
|
+
return Go(e, t, r);
|
|
4106
|
+
case "ComponentParameter":
|
|
4107
|
+
return Wo(e, t, r);
|
|
4108
|
+
case "ComponentTypeParameter":
|
|
4109
|
+
return qo(e, t, r);
|
|
4110
|
+
case "HookDeclaration":
|
|
4111
|
+
return Uo(e, t, r);
|
|
4112
|
+
case "DeclareHook":
|
|
4113
|
+
return Ho(e, t, r);
|
|
4114
|
+
case "HookTypeAnnotation":
|
|
4115
|
+
return Xo(e, t, r);
|
|
4116
|
+
case "DeclareFunction":
|
|
4117
|
+
return [z(e), "function ", r("id"), r("predicate"), t.semi ? ";" : ""];
|
|
4118
|
+
case "DeclareModule":
|
|
4119
|
+
return ["declare module ", r("id"), " ", r("body")];
|
|
4120
|
+
case "DeclareModuleExports":
|
|
4121
|
+
return ["declare module.exports", U(e, r), t.semi ? ";" : ""];
|
|
4122
|
+
case "DeclareNamespace":
|
|
4123
|
+
return ["declare namespace ", r("id"), " ", r("body")];
|
|
4124
|
+
case "DeclareVariable":
|
|
4125
|
+
return [z(e), n.kind ?? "var", " ", r("id"), t.semi ? ";" : ""];
|
|
4126
|
+
case "DeclareExportDeclaration":
|
|
4127
|
+
case "DeclareExportAllDeclaration":
|
|
4128
|
+
return bn(e, t, r);
|
|
4129
|
+
case "DeclareOpaqueType":
|
|
4130
|
+
case "OpaqueType":
|
|
4131
|
+
return yo(e, t, r);
|
|
4132
|
+
case "DeclareTypeAlias":
|
|
4133
|
+
case "TypeAlias":
|
|
4134
|
+
return mn(e, t, r);
|
|
4135
|
+
case "IntersectionTypeAnnotation":
|
|
4136
|
+
return Dn(e, t, r);
|
|
4137
|
+
case "UnionTypeAnnotation":
|
|
4138
|
+
return fn(e, t, r);
|
|
4139
|
+
case "ConditionalTypeAnnotation":
|
|
4140
|
+
return ir(e, t, r);
|
|
4141
|
+
case "InferTypeAnnotation":
|
|
4142
|
+
return Fn(e, t, r);
|
|
4143
|
+
case "FunctionTypeAnnotation":
|
|
4144
|
+
return yn(e, t, r);
|
|
4145
|
+
case "TupleTypeAnnotation":
|
|
4146
|
+
return nr(e, t, r);
|
|
4147
|
+
case "TupleTypeLabeledElement":
|
|
4148
|
+
return Cn(e, t, r);
|
|
4149
|
+
case "TupleTypeSpreadElement":
|
|
4150
|
+
return dn(e, t, r);
|
|
4151
|
+
case "GenericTypeAnnotation":
|
|
4152
|
+
return [r("id"), Rt(e, t, r, "typeParameters")];
|
|
4153
|
+
case "IndexedAccessType":
|
|
4154
|
+
case "OptionalIndexedAccessType":
|
|
4155
|
+
return En(e, t, r);
|
|
4156
|
+
case "TypeAnnotation":
|
|
4157
|
+
return An(e, t, r);
|
|
4158
|
+
case "TypeParameter":
|
|
4159
|
+
return On(e, t, r);
|
|
4160
|
+
case "TypeofTypeAnnotation":
|
|
4161
|
+
return xn(e, r);
|
|
4162
|
+
case "ExistsTypeAnnotation":
|
|
4163
|
+
return "*";
|
|
4164
|
+
case "ArrayTypeAnnotation":
|
|
4165
|
+
return Tn(r);
|
|
4166
|
+
case "DeclareEnum":
|
|
4167
|
+
case "EnumDeclaration":
|
|
4168
|
+
return Ln(e, r);
|
|
4169
|
+
case "EnumBooleanBody":
|
|
4170
|
+
case "EnumNumberBody":
|
|
4171
|
+
case "EnumBigIntBody":
|
|
4172
|
+
case "EnumStringBody":
|
|
4173
|
+
case "EnumSymbolBody":
|
|
4174
|
+
return [n.type === "EnumSymbolBody" || n.explicitType ? `of ${n.type.slice(4, -4).toLowerCase()} ` : "", kn(e, t, r)];
|
|
4175
|
+
case "EnumBooleanMember":
|
|
4176
|
+
case "EnumNumberMember":
|
|
4177
|
+
case "EnumBigIntMember":
|
|
4178
|
+
case "EnumStringMember":
|
|
4179
|
+
case "EnumDefaultedMember":
|
|
4180
|
+
return In(e, r);
|
|
4181
|
+
case "FunctionTypeParam": {
|
|
4182
|
+
let s = n.name ? r("name") : e.parent.this === n ? "this" : "";
|
|
4183
|
+
return [s, $(e), s ? ": " : "", r("typeAnnotation")];
|
|
4184
|
+
}
|
|
4185
|
+
case "DeclareClass":
|
|
4186
|
+
case "DeclareInterface":
|
|
4187
|
+
case "InterfaceDeclaration":
|
|
4188
|
+
case "InterfaceTypeAnnotation":
|
|
4189
|
+
return er(e, t, r);
|
|
4190
|
+
case "ObjectTypeAnnotation":
|
|
4191
|
+
return vt(e, t, r);
|
|
4192
|
+
case "ClassImplements":
|
|
4193
|
+
case "InterfaceExtends":
|
|
4194
|
+
return [r("id"), r("typeParameters")];
|
|
4195
|
+
case "NullableTypeAnnotation":
|
|
4196
|
+
return ["?", r("typeAnnotation")];
|
|
4197
|
+
case "Variance": {
|
|
4198
|
+
let { kind: s } = n;
|
|
4199
|
+
return s === "plus" ? "+" : "-";
|
|
4200
|
+
}
|
|
4201
|
+
case "KeyofTypeAnnotation":
|
|
4202
|
+
return ["keyof ", r("argument")];
|
|
4203
|
+
case "ObjectTypeCallProperty":
|
|
4204
|
+
return [n.static ? "static " : "", r("value"), ve(e, t)];
|
|
4205
|
+
case "ObjectTypeMappedTypeProperty":
|
|
4206
|
+
return $o(e, t, r);
|
|
4207
|
+
case "ObjectTypeIndexer":
|
|
4208
|
+
return [n.static ? "static " : "", n.variance ? r("variance") : "", "[", r("id"), n.id ? ": " : "", r("key"), "]: ", r("value"), ve(e, t)];
|
|
4209
|
+
case "ObjectTypeProperty": {
|
|
4210
|
+
let s = "";
|
|
4211
|
+
return n.proto ? s = "proto " : n.static && (s = "static "), [s, n.kind !== "init" ? n.kind + " " : "", n.variance ? r("variance") : "", Ft(e, t, r), $(e), lt(n) ? "" : ": ", r("value"), ve(e, t)];
|
|
4212
|
+
}
|
|
4213
|
+
case "ObjectTypeInternalSlot":
|
|
4214
|
+
return [n.static ? "static " : "", "[[", r("id"), "]]", $(e), n.method ? "" : ": ", r("value"), ve(e, t)];
|
|
4215
|
+
case "ObjectTypeSpreadProperty":
|
|
4216
|
+
return hn(e, r);
|
|
4217
|
+
case "QualifiedTypeofIdentifier":
|
|
4218
|
+
case "QualifiedTypeIdentifier":
|
|
4219
|
+
return [r("qualification"), ".", r("id")];
|
|
4220
|
+
case "NullLiteralTypeAnnotation":
|
|
4221
|
+
return "null";
|
|
4222
|
+
case "BooleanLiteralTypeAnnotation":
|
|
4223
|
+
return String(n.value);
|
|
4224
|
+
case "StringLiteralTypeAnnotation":
|
|
4225
|
+
return Ge(ut(pe(n), t));
|
|
4226
|
+
case "NumberLiteralTypeAnnotation":
|
|
4227
|
+
return Et(pe(n));
|
|
4228
|
+
case "BigIntLiteralTypeAnnotation":
|
|
4229
|
+
return Bn(pe(n));
|
|
4230
|
+
case "TypeCastExpression":
|
|
4231
|
+
return ["(", r("expression"), U(e, r), ")"];
|
|
4232
|
+
case "TypePredicate":
|
|
4233
|
+
return gn(e, r);
|
|
4234
|
+
case "TypeOperator":
|
|
4235
|
+
return [n.operator, " ", r("typeAnnotation")];
|
|
4236
|
+
case "TypeParameterDeclaration":
|
|
4237
|
+
case "TypeParameterInstantiation":
|
|
4238
|
+
return Rt(e, t, r, "params");
|
|
4239
|
+
case "InferredPredicate":
|
|
4240
|
+
case "DeclaredPredicate":
|
|
4241
|
+
return [e.key === "predicate" && e.parent.type !== "DeclareFunction" && !e.parent.returnType ? ": " : " ", "%checks", ...n.type === "DeclaredPredicate" ? ["(", r("value"), ")"] : []];
|
|
4242
|
+
case "AsExpression":
|
|
4243
|
+
case "AsConstExpression":
|
|
4244
|
+
case "SatisfiesExpression":
|
|
4245
|
+
return Pn(e, t, r);
|
|
4246
|
+
case "MatchExpression":
|
|
4247
|
+
case "MatchStatement":
|
|
4248
|
+
return Qo(e, t, r);
|
|
4249
|
+
case "MatchExpressionCase":
|
|
4250
|
+
case "MatchStatementCase":
|
|
4251
|
+
return zo(e, t, r);
|
|
4252
|
+
case "MatchOrPattern":
|
|
4253
|
+
case "MatchAsPattern":
|
|
4254
|
+
case "MatchWildcardPattern":
|
|
4255
|
+
case "MatchLiteralPattern":
|
|
4256
|
+
case "MatchUnaryPattern":
|
|
4257
|
+
case "MatchIdentifierPattern":
|
|
4258
|
+
case "MatchMemberPattern":
|
|
4259
|
+
case "MatchBindingPattern":
|
|
4260
|
+
case "MatchObjectPattern":
|
|
4261
|
+
case "MatchObjectPatternProperty":
|
|
4262
|
+
case "MatchRestPattern":
|
|
4263
|
+
case "MatchArrayPattern":
|
|
4264
|
+
return Zo(e, t, r);
|
|
4265
|
+
}
|
|
4266
|
+
}
|
|
4267
|
+
function ra(e, t, r) {
|
|
4268
|
+
let { node: n } = e;
|
|
4269
|
+
if (n.type.startsWith("TS")) {
|
|
4270
|
+
if (wr(n)) return n.type.slice(2, -7).toLowerCase();
|
|
4271
|
+
switch (n.type) {
|
|
4272
|
+
case "TSThisType":
|
|
4273
|
+
return "this";
|
|
4274
|
+
case "TSTypeAssertion": {
|
|
4275
|
+
let s = !(W(n.expression) || ie(n.expression)), i = c(["<", m([f, r("typeAnnotation")]), f, ">"]), u = [B("("), m([f, r("expression")]), f, B(")")];
|
|
4276
|
+
return s ? rt([[i, r("expression")], [i, c(u, { shouldBreak: true })], [i, r("expression")]]) : c([i, r("expression")]);
|
|
4277
|
+
}
|
|
4278
|
+
case "TSDeclareFunction":
|
|
4279
|
+
return un(e, t, r);
|
|
4280
|
+
case "TSExportAssignment":
|
|
4281
|
+
return ["export = ", r("expression"), t.semi ? ";" : ""];
|
|
4282
|
+
case "TSModuleBlock":
|
|
4283
|
+
return Sn(e, t, r);
|
|
4284
|
+
case "TSInterfaceBody":
|
|
4285
|
+
case "TSTypeLiteral":
|
|
4286
|
+
return vt(e, t, r);
|
|
4287
|
+
case "TSTypeAliasDeclaration":
|
|
4288
|
+
return mn(e, t, r);
|
|
4289
|
+
case "TSQualifiedName":
|
|
4290
|
+
return [r("left"), ".", r("right")];
|
|
4291
|
+
case "TSAbstractMethodDefinition":
|
|
4292
|
+
case "TSDeclareMethod":
|
|
4293
|
+
return pn(e, t, r);
|
|
4294
|
+
case "TSAbstractAccessorProperty":
|
|
4295
|
+
case "TSAbstractPropertyDefinition":
|
|
4296
|
+
return cn(e, t, r);
|
|
4297
|
+
case "TSInterfaceHeritage":
|
|
4298
|
+
case "TSClassImplements":
|
|
4299
|
+
case "TSInstantiationExpression":
|
|
4300
|
+
return [r("expression"), r("typeArguments")];
|
|
4301
|
+
case "TSTemplateLiteralType":
|
|
4302
|
+
return $r(e, t, r);
|
|
4303
|
+
case "TSNamedTupleMember":
|
|
4304
|
+
return Cn(e, t, r);
|
|
4305
|
+
case "TSRestType":
|
|
4306
|
+
return dn(e, t, r);
|
|
4307
|
+
case "TSOptionalType":
|
|
4308
|
+
return [r("typeAnnotation"), "?"];
|
|
4309
|
+
case "TSInterfaceDeclaration":
|
|
4310
|
+
return er(e, t, r);
|
|
4311
|
+
case "TSTypeParameterDeclaration":
|
|
4312
|
+
case "TSTypeParameterInstantiation":
|
|
4313
|
+
return Rt(e, t, r, "params");
|
|
4314
|
+
case "TSTypeParameter":
|
|
4315
|
+
return On(e, t, r);
|
|
4316
|
+
case "TSAsExpression":
|
|
4317
|
+
case "TSSatisfiesExpression":
|
|
4318
|
+
return Pn(e, t, r);
|
|
4319
|
+
case "TSArrayType":
|
|
4320
|
+
return Tn(r);
|
|
4321
|
+
case "TSPropertySignature":
|
|
4322
|
+
return [n.readonly ? "readonly " : "", Ft(e, t, r), $(e), U(e, r), ve(e, t)];
|
|
4323
|
+
case "TSParameterProperty":
|
|
4324
|
+
return [rr(n), n.static ? "static " : "", n.override ? "override " : "", n.readonly ? "readonly " : "", r("parameter")];
|
|
4325
|
+
case "TSTypeQuery":
|
|
4326
|
+
return xn(e, r);
|
|
4327
|
+
case "TSIndexSignature": {
|
|
4328
|
+
let s = n.parameters.length > 1 ? B(ue(t) ? "," : "") : "", i = c([m([f, I([", ", f], e.map(r, "parameters"))]), s, f]);
|
|
4329
|
+
return [e.key === "body" && e.parent.type === "ClassBody" && n.static ? "static " : "", n.readonly ? "readonly " : "", "[", n.parameters ? i : "", "]", U(e, r), ve(e, t)];
|
|
4330
|
+
}
|
|
4331
|
+
case "TSTypePredicate":
|
|
4332
|
+
return gn(e, r);
|
|
4333
|
+
case "TSNonNullExpression":
|
|
4334
|
+
return [r("expression"), "!"];
|
|
4335
|
+
case "TSImportType":
|
|
4336
|
+
return [_t(e, t, r), n.qualifier ? [".", r("qualifier")] : "", Rt(e, t, r, "typeArguments")];
|
|
4337
|
+
case "TSLiteralType":
|
|
4338
|
+
return r("literal");
|
|
4339
|
+
case "TSIndexedAccessType":
|
|
4340
|
+
return En(e, t, r);
|
|
4341
|
+
case "TSTypeOperator":
|
|
4342
|
+
return [n.operator, " ", r("typeAnnotation")];
|
|
4343
|
+
case "TSMappedType":
|
|
4344
|
+
return Ko(e, t, r);
|
|
4345
|
+
case "TSMethodSignature": {
|
|
4346
|
+
let s = [], i = n.kind && n.kind !== "method" ? `${n.kind} ` : "";
|
|
4347
|
+
s.push(rr(n), i, n.computed ? "[" : "", r("key"), n.computed ? "]" : "", $(e));
|
|
4348
|
+
let u = Ke(e, t, r, false, true), o = U(e, r, "returnType"), a = ct(n, o);
|
|
4349
|
+
return s.push(a ? c(u) : u), n.returnType && s.push(c(o)), [c(s), ve(e, t)];
|
|
4350
|
+
}
|
|
4351
|
+
case "TSNamespaceExportDeclaration":
|
|
4352
|
+
return ["export as namespace ", r("id"), t.semi ? ";" : ""];
|
|
4353
|
+
case "TSEnumDeclaration":
|
|
4354
|
+
return Ln(e, r);
|
|
4355
|
+
case "TSEnumBody":
|
|
4356
|
+
return kn(e, t, r);
|
|
4357
|
+
case "TSEnumMember":
|
|
4358
|
+
return In(e, r);
|
|
4359
|
+
case "TSImportEqualsDeclaration":
|
|
4360
|
+
return ["import ", Gs(n, false), r("id"), " = ", r("moduleReference"), t.semi ? ";" : ""];
|
|
4361
|
+
case "TSExternalModuleReference":
|
|
4362
|
+
return _t(e, t, r);
|
|
4363
|
+
case "TSModuleDeclaration":
|
|
4364
|
+
return [z(e), n.kind === "global" ? "" : `${n.kind} `, r("id"), n.body ? [" ", c(r("body"))] : t.semi ? ";" : ""];
|
|
4365
|
+
case "TSConditionalType":
|
|
4366
|
+
return ir(e, t, r);
|
|
4367
|
+
case "TSInferType":
|
|
4368
|
+
return Fn(e, t, r);
|
|
4369
|
+
case "TSIntersectionType":
|
|
4370
|
+
return Dn(e, t, r);
|
|
4371
|
+
case "TSUnionType":
|
|
4372
|
+
return fn(e, t, r);
|
|
4373
|
+
case "TSFunctionType":
|
|
4374
|
+
case "TSCallSignatureDeclaration":
|
|
4375
|
+
case "TSConstructorType":
|
|
4376
|
+
case "TSConstructSignatureDeclaration":
|
|
4377
|
+
return yn(e, t, r);
|
|
4378
|
+
case "TSTupleType":
|
|
4379
|
+
return nr(e, t, r);
|
|
4380
|
+
case "TSTypeReference":
|
|
4381
|
+
return [r("typeName"), Rt(e, t, r, "typeArguments")];
|
|
4382
|
+
case "TSTypeAnnotation":
|
|
4383
|
+
return An(e, t, r);
|
|
4384
|
+
case "TSEmptyBodyFunctionExpression":
|
|
4385
|
+
return on(e, t, r);
|
|
4386
|
+
case "TSJSDocAllType":
|
|
4387
|
+
return "*";
|
|
4388
|
+
case "TSJSDocUnknownType":
|
|
4389
|
+
return "?";
|
|
4390
|
+
case "TSJSDocNullableType":
|
|
4391
|
+
return ws(e, r, "?");
|
|
4392
|
+
case "TSJSDocNonNullableType":
|
|
4393
|
+
return ws(e, r, "!");
|
|
4394
|
+
case "TSParenthesizedType":
|
|
4395
|
+
default:
|
|
4396
|
+
throw new $e(n, "TypeScript");
|
|
4397
|
+
}
|
|
4398
|
+
}
|
|
4399
|
+
}
|
|
4400
|
+
function Gm(e, t, r, n) {
|
|
4401
|
+
for (let s of [vu, wu, ta, ra, Jo]) {
|
|
4402
|
+
let i = s(e, t, r, n);
|
|
4403
|
+
if (i !== void 0) return i;
|
|
4404
|
+
}
|
|
4405
|
+
}
|
|
4406
|
+
var Wm = b(["ClassMethod", "ClassPrivateMethod", "ClassProperty", "ClassAccessorProperty", "AccessorProperty", "TSAbstractAccessorProperty", "PropertyDefinition", "TSAbstractPropertyDefinition", "ClassPrivateProperty", "MethodDefinition", "TSAbstractMethodDefinition", "TSDeclareMethod"]);
|
|
4407
|
+
function qm(e, t, r, n) {
|
|
4408
|
+
e.isRoot && t.__onHtmlBindingRoot?.(e.node, t);
|
|
4409
|
+
let { node: s } = e, i = Qt(e) ? t.originalText.slice(L(s), k(s)) : Gm(e, t, r, n);
|
|
4410
|
+
if (!i) return "";
|
|
4411
|
+
if (Wm(s)) return i;
|
|
4412
|
+
let u = j(s.decorators), o = Ru(e, t, r), a = s.type === "ClassExpression";
|
|
4413
|
+
if (u && !a) return Fr(i, (l) => c([o, l]));
|
|
4414
|
+
let p = he(e, t), D = ho(e, t);
|
|
4415
|
+
return !o && !p && !D ? i : Fr(i, (l) => [D ? ";" : "", p ? "(" : "", p && a && u ? [m([A, o, l]), A] : [o, l], p ? ")" : ""]);
|
|
4416
|
+
}
|
|
4417
|
+
var qs = qm;
|
|
4418
|
+
var Ym = { experimental_avoidAstMutation: true };
|
|
4419
|
+
var na = [{ name: "JSON.stringify", type: "data", aceMode: "json", extensions: [".importmap"], filenames: ["package.json", "package-lock.json", "composer.json"], tmScope: "source.json", aliases: ["geojson", "jsonl", "sarif", "topojson"], codemirrorMode: "javascript", codemirrorMimeType: "application/json", parsers: ["json-stringify"], vscodeLanguageIds: ["json"], linguistLanguageId: 174 }, { name: "JSON", type: "data", aceMode: "json", extensions: [".json", ".4DForm", ".4DProject", ".avsc", ".geojson", ".gltf", ".har", ".ice", ".JSON-tmLanguage", ".json.example", ".mcmeta", ".sarif", ".tact", ".tfstate", ".tfstate.backup", ".topojson", ".webapp", ".webmanifest", ".yy", ".yyp"], filenames: [".all-contributorsrc", ".arcconfig", ".auto-changelog", ".c8rc", ".htmlhintrc", ".imgbotconfig", ".nycrc", ".tern-config", ".tern-project", ".watchmanconfig", ".babelrc", ".jscsrc", ".jshintrc", ".jslintrc", ".swcrc"], tmScope: "source.json", aliases: ["geojson", "jsonl", "sarif", "topojson"], codemirrorMode: "javascript", codemirrorMimeType: "application/json", parsers: ["json"], vscodeLanguageIds: ["json"], linguistLanguageId: 174 }, { name: "JSON with Comments", type: "data", aceMode: "javascript", extensions: [".jsonc", ".code-snippets", ".code-workspace", ".sublime-build", ".sublime-color-scheme", ".sublime-commands", ".sublime-completions", ".sublime-keymap", ".sublime-macro", ".sublime-menu", ".sublime-mousemap", ".sublime-project", ".sublime-settings", ".sublime-theme", ".sublime-workspace", ".sublime_metrics", ".sublime_session"], filenames: [], tmScope: "source.json.comments", aliases: ["jsonc"], codemirrorMode: "javascript", codemirrorMimeType: "text/javascript", group: "JSON", parsers: ["jsonc"], vscodeLanguageIds: ["jsonc"], linguistLanguageId: 423 }, { name: "JSON5", type: "data", aceMode: "json5", extensions: [".json5"], tmScope: "source.js", codemirrorMode: "javascript", codemirrorMimeType: "application/json", parsers: ["json5"], vscodeLanguageIds: ["json5"], linguistLanguageId: 175 }];
|
|
4420
|
+
var Us = {};
|
|
4421
|
+
_n(Us, { getVisitorKeys: () => ia, massageAstNode: () => oa, print: () => Xm });
|
|
4422
|
+
var Um = { JsonRoot: ["node"], ArrayExpression: ["elements"], ObjectExpression: ["properties"], ObjectProperty: ["key", "value"], UnaryExpression: ["argument"], NullLiteral: [], BooleanLiteral: [], StringLiteral: [], NumericLiteral: [], Identifier: [], TemplateLiteral: ["quasis"], TemplateElement: [] }, sa = Um;
|
|
4423
|
+
var Hm = Ir(sa), ia = Hm;
|
|
4424
|
+
function Xm(e, t, r) {
|
|
4425
|
+
let { node: n } = e;
|
|
4426
|
+
switch (n.type) {
|
|
4427
|
+
case "JsonRoot":
|
|
4428
|
+
return [r("node"), y];
|
|
4429
|
+
case "ArrayExpression": {
|
|
4430
|
+
if (n.elements.length === 0) return "[]";
|
|
4431
|
+
let s = e.map(() => e.node === null ? "null" : r(), "elements");
|
|
4432
|
+
return ["[", m([y, I([",", y], s)]), y, "]"];
|
|
4433
|
+
}
|
|
4434
|
+
case "ObjectExpression":
|
|
4435
|
+
return n.properties.length === 0 ? "{}" : ["{", m([y, I([",", y], e.map(r, "properties"))]), y, "}"];
|
|
4436
|
+
case "ObjectProperty":
|
|
4437
|
+
return [r("key"), ": ", r("value")];
|
|
4438
|
+
case "UnaryExpression":
|
|
4439
|
+
return [n.operator === "+" ? "" : n.operator, r("argument")];
|
|
4440
|
+
case "NullLiteral":
|
|
4441
|
+
return "null";
|
|
4442
|
+
case "BooleanLiteral":
|
|
4443
|
+
return n.value ? "true" : "false";
|
|
4444
|
+
case "StringLiteral":
|
|
4445
|
+
return JSON.stringify(n.value);
|
|
4446
|
+
case "NumericLiteral":
|
|
4447
|
+
return ua(e) ? JSON.stringify(String(n.value)) : JSON.stringify(n.value);
|
|
4448
|
+
case "Identifier":
|
|
4449
|
+
return ua(e) ? JSON.stringify(n.name) : n.name;
|
|
4450
|
+
case "TemplateLiteral":
|
|
4451
|
+
return r(["quasis", 0]);
|
|
4452
|
+
case "TemplateElement":
|
|
4453
|
+
return JSON.stringify(n.value.cooked);
|
|
4454
|
+
default:
|
|
4455
|
+
throw new $e(n, "JSON");
|
|
4456
|
+
}
|
|
4457
|
+
}
|
|
4458
|
+
function ua(e) {
|
|
4459
|
+
return e.key === "key" && e.parent.type === "ObjectProperty";
|
|
4460
|
+
}
|
|
4461
|
+
var Vm = /* @__PURE__ */ new Set(["start", "end", "extra", "loc", "comments", "leadingComments", "trailingComments", "innerComments", "errors", "range", "tokens"]);
|
|
4462
|
+
function oa(e, t) {
|
|
4463
|
+
let { type: r } = e;
|
|
4464
|
+
if (r === "ObjectProperty") {
|
|
4465
|
+
let { key: n } = e;
|
|
4466
|
+
n.type === "Identifier" ? t.key = { type: "StringLiteral", value: n.name } : n.type === "NumericLiteral" && (t.key = { type: "StringLiteral", value: String(n.value) });
|
|
4467
|
+
return;
|
|
4468
|
+
}
|
|
4469
|
+
if (r === "UnaryExpression" && e.operator === "+") return t.argument;
|
|
4470
|
+
if (r === "ArrayExpression") {
|
|
4471
|
+
for (let [n, s] of e.elements.entries()) s === null && t.elements.splice(n, 0, { type: "NullLiteral" });
|
|
4472
|
+
return;
|
|
4473
|
+
}
|
|
4474
|
+
if (r === "TemplateLiteral") return { type: "StringLiteral", value: e.quasis[0].value.cooked };
|
|
4475
|
+
}
|
|
4476
|
+
oa.ignoredProperties = Vm;
|
|
4477
|
+
var ur = { bracketSpacing: { category: "Common", type: "boolean", default: true, description: "Print spaces between brackets.", oppositeDescription: "Do not print spaces between brackets." }, objectWrap: { category: "Common", type: "choice", default: "preserve", description: "How to wrap object literals.", choices: [{ value: "preserve", description: "Keep as multi-line, if there is a newline between the opening brace and first property." }, { value: "collapse", description: "Fit to a single line when possible." }] }, singleQuote: { category: "Common", type: "boolean", default: false, description: "Use single quotes instead of double quotes." }, bracketSameLine: { category: "Common", type: "boolean", default: false, description: "Put > of opening tags on the last line instead of on a new line." }, singleAttributePerLine: { category: "Common", type: "boolean", default: false, description: "Enforce single attribute per line in HTML, Vue and JSX." } };
|
|
4478
|
+
var gt = "JavaScript", $m = { arrowParens: { category: gt, type: "choice", default: "always", description: "Include parentheses around a sole arrow function parameter.", choices: [{ value: "always", description: "Always include parens. Example: `(x) => x`" }, { value: "avoid", description: "Omit parens when possible. Example: `x => x`" }] }, bracketSameLine: ur.bracketSameLine, objectWrap: ur.objectWrap, bracketSpacing: ur.bracketSpacing, jsxBracketSameLine: { category: gt, type: "boolean", description: "Put > on the last line instead of at a new line.", deprecated: "2.4.0" }, semi: { category: gt, type: "boolean", default: true, description: "Print semicolons.", oppositeDescription: "Do not print semicolons, except at the beginning of lines which may need them." }, experimentalOperatorPosition: { category: gt, type: "choice", default: "end", description: "Where to print operators when binary expressions wrap lines.", choices: [{ value: "start", description: "Print operators at the start of new lines." }, { value: "end", description: "Print operators at the end of previous lines." }] }, experimentalTernaries: { category: gt, type: "boolean", default: false, description: "Use curious ternaries, with the question mark after the condition.", oppositeDescription: "Default behavior of ternaries; keep question marks on the same line as the consequent." }, singleQuote: ur.singleQuote, jsxSingleQuote: { category: gt, type: "boolean", default: false, description: "Use single quotes in JSX." }, quoteProps: { category: gt, type: "choice", default: "as-needed", description: "Change when properties in objects are quoted.", choices: [{ value: "as-needed", description: "Only add quotes around object properties where required." }, { value: "consistent", description: "If at least one property in an object requires quotes, quote all properties." }, { value: "preserve", description: "Respect the input use of quotes in object properties." }] }, trailingComma: { category: gt, type: "choice", default: "all", description: "Print trailing commas wherever possible when multi-line.", choices: [{ value: "all", description: "Trailing commas wherever possible (including function arguments)." }, { value: "es5", description: "Trailing commas where valid in ES5 (objects, arrays, etc.)" }, { value: "none", description: "No trailing commas." }] }, singleAttributePerLine: ur.singleAttributePerLine }, aa = $m;
|
|
4479
|
+
var Km = { estree: Ys, "estree-json": Us }, Qm = [...$s, ...na];
|
|
4480
|
+
export {
|
|
4481
|
+
pa as default,
|
|
4482
|
+
Qm as languages,
|
|
4483
|
+
aa as options,
|
|
4484
|
+
Km as printers
|
|
4485
|
+
};
|
|
4486
|
+
//# sourceMappingURL=estree-DHLJIae3.js.map
|