@introspection-ai/recipes 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (222) hide show
  1. package/README.md +45 -58
  2. package/dist/{agent-tool.d.ts → agents.d.ts} +4 -1
  3. package/dist/agents.d.ts.map +1 -0
  4. package/dist/{agent-tool.js → agents.js} +1 -1
  5. package/dist/agents.js.map +1 -0
  6. package/dist/api/extensions.d.ts +3 -0
  7. package/dist/api/extensions.d.ts.map +1 -0
  8. package/dist/api/extensions.js +2 -0
  9. package/dist/api/extensions.js.map +1 -0
  10. package/dist/api/mcp.d.ts +4 -0
  11. package/dist/api/mcp.d.ts.map +1 -0
  12. package/dist/api/mcp.js +2 -0
  13. package/dist/api/mcp.js.map +1 -0
  14. package/dist/api/session.d.ts +3 -0
  15. package/dist/api/session.d.ts.map +1 -0
  16. package/dist/api/session.js +2 -0
  17. package/dist/api/session.js.map +1 -0
  18. package/dist/child-agent.d.ts +5 -4
  19. package/dist/child-agent.d.ts.map +1 -1
  20. package/dist/child-agent.js +26 -117
  21. package/dist/child-agent.js.map +1 -1
  22. package/dist/child-session.d.ts +23 -0
  23. package/dist/child-session.d.ts.map +1 -0
  24. package/dist/child-session.js +48 -0
  25. package/dist/child-session.js.map +1 -0
  26. package/dist/extensions.d.ts +29 -0
  27. package/dist/extensions.d.ts.map +1 -0
  28. package/dist/extensions.js +119 -0
  29. package/dist/extensions.js.map +1 -0
  30. package/dist/index.d.ts +4 -13
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +2 -13
  33. package/dist/index.js.map +1 -1
  34. package/dist/inspect.d.ts +38 -5
  35. package/dist/inspect.d.ts.map +1 -1
  36. package/dist/inspect.js +92 -41
  37. package/dist/inspect.js.map +1 -1
  38. package/dist/interactions.d.ts +18 -2
  39. package/dist/interactions.d.ts.map +1 -1
  40. package/dist/interactions.js +41 -10
  41. package/dist/interactions.js.map +1 -1
  42. package/dist/mcp-catalog.d.ts +1 -0
  43. package/dist/mcp-catalog.d.ts.map +1 -1
  44. package/dist/mcp-catalog.js +14 -6
  45. package/dist/mcp-catalog.js.map +1 -1
  46. package/dist/mcp-chunks/auth-command-ZLGYIEUY.js +273 -0
  47. package/dist/mcp-chunks/call-arguments-LU3W6D3K.js +13 -0
  48. package/dist/mcp-chunks/call-command-LKTKSYTH.js +612 -0
  49. package/dist/mcp-chunks/chunk-2U4BSDC4.js +3951 -0
  50. package/dist/mcp-chunks/chunk-2XL7MG7R.js +272 -0
  51. package/dist/mcp-chunks/chunk-3BJA27PY.js +2321 -0
  52. package/dist/mcp-chunks/chunk-4SQKWYFF.js +15 -0
  53. package/dist/mcp-chunks/chunk-5QOSCSQB.js +290 -0
  54. package/dist/mcp-chunks/chunk-6W5QFASN.js +77 -0
  55. package/dist/mcp-chunks/chunk-6XCZGU3G.js +1004 -0
  56. package/dist/mcp-chunks/chunk-7FHEBT5G.js +149 -0
  57. package/dist/mcp-chunks/chunk-7KA2VJVZ.js +114 -0
  58. package/dist/mcp-chunks/chunk-7UDVSOOF.js +138 -0
  59. package/dist/mcp-chunks/chunk-BNV3TPE4.js +66 -0
  60. package/dist/mcp-chunks/chunk-BTLAWHTA.js +129 -0
  61. package/dist/mcp-chunks/chunk-BV56DXPW.js +13 -0
  62. package/dist/mcp-chunks/chunk-BWHIA4PC.js +90 -0
  63. package/dist/mcp-chunks/chunk-BZIQOWE6.js +267 -0
  64. package/dist/mcp-chunks/chunk-D3MRAZ6H.js +16140 -0
  65. package/dist/mcp-chunks/chunk-DHBE7UBH.js +750 -0
  66. package/dist/mcp-chunks/chunk-E22DYOW5.js +251 -0
  67. package/dist/mcp-chunks/chunk-ECIVB7P4.js +139 -0
  68. package/dist/mcp-chunks/chunk-HKRJ6O36.js +1076 -0
  69. package/dist/mcp-chunks/chunk-IABRYROW.js +44 -0
  70. package/dist/mcp-chunks/chunk-J6LYIZXN.js +45 -0
  71. package/dist/mcp-chunks/chunk-L7NTQVYN.js +161 -0
  72. package/dist/mcp-chunks/chunk-LEZSACDE.js +141 -0
  73. package/dist/mcp-chunks/chunk-LKIBAYKU.js +208 -0
  74. package/dist/mcp-chunks/chunk-LNH5LAJD.js +152 -0
  75. package/dist/mcp-chunks/chunk-LQQEYD76.js +124 -0
  76. package/dist/mcp-chunks/chunk-LRKZP7DJ.js +47 -0
  77. package/dist/mcp-chunks/chunk-LS7PMWSR.js +109 -0
  78. package/dist/mcp-chunks/chunk-M3TPODXI.js +95 -0
  79. package/dist/mcp-chunks/chunk-MZ2NARG7.js +400 -0
  80. package/dist/mcp-chunks/chunk-N46NEFAF.js +45 -0
  81. package/dist/mcp-chunks/chunk-NNOEGEUZ.js +17273 -0
  82. package/dist/mcp-chunks/chunk-NRAJX5E4.js +69 -0
  83. package/dist/mcp-chunks/chunk-P3PSC54P.js +869 -0
  84. package/dist/mcp-chunks/chunk-PIIYJR44.js +6341 -0
  85. package/dist/mcp-chunks/chunk-PWYFKGKG.js +385 -0
  86. package/dist/mcp-chunks/chunk-SJCCBNZ4.js +45 -0
  87. package/dist/mcp-chunks/chunk-TATVT5IT.js +194 -0
  88. package/dist/mcp-chunks/chunk-TEUKFFQL.js +29 -0
  89. package/dist/mcp-chunks/chunk-UKYNQGNE.js +150 -0
  90. package/dist/mcp-chunks/chunk-UNKB4SBV.js +37 -0
  91. package/dist/mcp-chunks/chunk-WD6BOD24.js +138 -0
  92. package/dist/mcp-chunks/chunk-WQJZMCJN.js +73 -0
  93. package/dist/mcp-chunks/chunk-XANPGTLI.js +364 -0
  94. package/dist/mcp-chunks/chunk-XQK2JSW4.js +35 -0
  95. package/dist/mcp-chunks/chunk-YHQUTU6L.js +571 -0
  96. package/dist/mcp-chunks/chunk-YVZKMV5H.js +57 -0
  97. package/dist/mcp-chunks/cli-UV4QJZZM.js +929 -0
  98. package/dist/mcp-chunks/client-S7RQUG5U.js +13 -0
  99. package/dist/mcp-chunks/config-command-NLAGKID5.js +1101 -0
  100. package/dist/mcp-chunks/daemon-command-U242Z6VY.js +26 -0
  101. package/dist/mcp-chunks/dist-LK3SHAMX.js +6478 -0
  102. package/dist/mcp-chunks/emit-ts-command-VBXVXO6V.js +386 -0
  103. package/dist/mcp-chunks/generate-cli-runner-6CAZZA3P.js +1426 -0
  104. package/dist/mcp-chunks/inspect-cli-command-3ZORTOR7.js +111 -0
  105. package/dist/mcp-chunks/launch-YKRXHXJI.js +10 -0
  106. package/dist/mcp-chunks/lifecycle-XVKRHPH3.js +16 -0
  107. package/dist/mcp-chunks/list-command-2MEGGNFQ.js +4190 -0
  108. package/dist/mcp-chunks/output-utils-NKESLAJ6.js +12 -0
  109. package/dist/mcp-chunks/prompt-B1Yc1NPt-VGOTWJMN.js +918 -0
  110. package/dist/mcp-chunks/record-command-YXHTTTT5.js +17 -0
  111. package/dist/mcp-chunks/replay-command-25HJ6AQU.js +85 -0
  112. package/dist/mcp-chunks/resource-command-OO4NYF5C.js +97 -0
  113. package/dist/mcp-chunks/result-utils-MOHHLNM7.js +15 -0
  114. package/dist/mcp-chunks/runtime-5WJ3G25Y.js +33 -0
  115. package/dist/mcp-chunks/runtime-wrapper-RPWDIDBF.js +10 -0
  116. package/dist/mcp-chunks/serve-command-DHXJZMMN.js +3302 -0
  117. package/dist/mcp-chunks/timeouts-W2XWCCXR.js +18 -0
  118. package/dist/mcp-chunks/vault-command-PIYIUEZL.js +154 -0
  119. package/dist/mcp-daemon-client.d.ts +6 -1
  120. package/dist/mcp-daemon-client.d.ts.map +1 -1
  121. package/dist/mcp-daemon-client.js +119 -2
  122. package/dist/mcp-daemon-client.js.map +1 -1
  123. package/dist/mcp-daemon-protocol.d.ts +18 -1
  124. package/dist/mcp-daemon-protocol.d.ts.map +1 -1
  125. package/dist/mcp-daemon-protocol.js +31 -0
  126. package/dist/mcp-daemon-protocol.js.map +1 -1
  127. package/dist/mcp-daemon.js +169 -76602
  128. package/dist/mcp-daemon.js.map +1 -1
  129. package/dist/mcp-policy.d.ts +11 -0
  130. package/dist/mcp-policy.d.ts.map +1 -0
  131. package/dist/mcp-policy.js +27 -0
  132. package/dist/mcp-policy.js.map +1 -0
  133. package/dist/mcp-run-worker.js +38 -76540
  134. package/dist/mcp-tools.d.ts +39 -0
  135. package/dist/mcp-tools.d.ts.map +1 -0
  136. package/dist/mcp-tools.js +493 -0
  137. package/dist/mcp-tools.js.map +1 -0
  138. package/dist/mcp.d.ts +21 -9
  139. package/dist/mcp.d.ts.map +1 -1
  140. package/dist/mcp.js +101 -31
  141. package/dist/mcp.js.map +1 -1
  142. package/dist/model-binding.d.ts +39 -0
  143. package/dist/model-binding.d.ts.map +1 -0
  144. package/dist/model-binding.js +103 -0
  145. package/dist/model-binding.js.map +1 -0
  146. package/dist/pi-extension.d.ts +2 -22
  147. package/dist/pi-extension.d.ts.map +1 -1
  148. package/dist/pi-extension.js +296 -71
  149. package/dist/pi-extension.js.map +1 -1
  150. package/dist/recipe/resolve.d.ts +43 -20
  151. package/dist/recipe/resolve.d.ts.map +1 -1
  152. package/dist/recipe/resolve.js +215 -70
  153. package/dist/recipe/resolve.js.map +1 -1
  154. package/dist/recipe-agent.d.ts +24 -27
  155. package/dist/recipe-agent.d.ts.map +1 -1
  156. package/dist/recipe-agent.js +278 -230
  157. package/dist/recipe-agent.js.map +1 -1
  158. package/dist/recipe-check.d.ts +17 -0
  159. package/dist/recipe-check.d.ts.map +1 -0
  160. package/dist/recipe-check.js +258 -0
  161. package/dist/recipe-check.js.map +1 -0
  162. package/dist/recipe-extensions.d.ts.map +1 -1
  163. package/dist/recipe-extensions.js +0 -3
  164. package/dist/recipe-extensions.js.map +1 -1
  165. package/dist/recipe-model.d.ts +3 -1
  166. package/dist/recipe-model.d.ts.map +1 -1
  167. package/dist/recipe-model.js +15 -12
  168. package/dist/recipe-model.js.map +1 -1
  169. package/dist/recipe-package.d.ts +6 -28
  170. package/dist/recipe-package.d.ts.map +1 -1
  171. package/dist/recipe-package.js +248 -191
  172. package/dist/recipe-package.js.map +1 -1
  173. package/dist/recipe-skills.d.ts.map +1 -1
  174. package/dist/recipe-skills.js +42 -29
  175. package/dist/recipe-skills.js.map +1 -1
  176. package/dist/run-controller.d.ts +10 -9
  177. package/dist/run-controller.d.ts.map +1 -1
  178. package/dist/run-controller.js +28 -21
  179. package/dist/run-controller.js.map +1 -1
  180. package/dist/session.d.ts +40 -53
  181. package/dist/session.d.ts.map +1 -1
  182. package/dist/session.js +312 -173
  183. package/dist/session.js.map +1 -1
  184. package/dist/test-utils.d.ts +7 -7
  185. package/dist/test-utils.d.ts.map +1 -1
  186. package/dist/test-utils.js +32 -15
  187. package/dist/test-utils.js.map +1 -1
  188. package/docs/agent-composition.md +41 -35
  189. package/docs/host-api.md +201 -0
  190. package/docs/index.md +8 -14
  191. package/docs/interactions.md +12 -11
  192. package/docs/mcp-auth.md +6 -6
  193. package/docs/mcp-configuration.md +72 -24
  194. package/docs/pi-extension.md +39 -11
  195. package/docs/recipe-flow.md +9 -9
  196. package/docs/recipe-format.md +90 -41
  197. package/package.json +23 -17
  198. package/vendor/mcp-client/darwin-arm64/mcp-client +0 -0
  199. package/vendor/mcp-client/darwin-x64/mcp-client +0 -0
  200. package/vendor/mcp-client/linux-arm64/mcp-client +0 -0
  201. package/vendor/recipe-check/darwin-arm64/recipe-check +0 -0
  202. package/vendor/recipe-check/darwin-x64/recipe-check +0 -0
  203. package/vendor/recipe-check/linux-arm64/recipe-check +0 -0
  204. package/vendor/recipe-check/linux-x64/recipe-check +0 -0
  205. package/vendor/recipe-check/linux-x64-musl/recipe-check +0 -0
  206. package/vendor/recipe-check/win32-x64/recipe-check.exe +0 -0
  207. package/dist/agent-tool.d.ts.map +0 -1
  208. package/dist/agent-tool.js.map +0 -1
  209. package/dist/run.d.ts +0 -28
  210. package/dist/run.d.ts.map +0 -1
  211. package/dist/run.js +0 -84
  212. package/dist/run.js.map +0 -1
  213. package/dist/testing.d.ts +0 -25
  214. package/dist/testing.d.ts.map +0 -1
  215. package/dist/testing.js +0 -96
  216. package/dist/testing.js.map +0 -1
  217. package/docs/deployment-configuration.md +0 -65
  218. package/docs/migration.md +0 -70
  219. package/docs/python-bindings-release.md +0 -47
  220. package/docs/recipe-evals.md +0 -70
  221. package/docs/recipe-judges.md +0 -152
  222. package/docs/runtime-library.md +0 -171
@@ -0,0 +1,3951 @@
1
+ import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
+ import {
3
+ writeTextFileAtomic
4
+ } from "./chunk-2XL7MG7R.js";
5
+ import {
6
+ homeConfigCandidates,
7
+ listConfigLayerPaths,
8
+ pathExists,
9
+ pathExistsAsync,
10
+ resolveConfigPath
11
+ } from "./chunk-WQJZMCJN.js";
12
+ import {
13
+ expandHome,
14
+ resolveEnvPlaceholders
15
+ } from "./chunk-ECIVB7P4.js";
16
+ import {
17
+ resolveLifecycle
18
+ } from "./chunk-LS7PMWSR.js";
19
+ import {
20
+ external_exports
21
+ } from "./chunk-D3MRAZ6H.js";
22
+ import {
23
+ __commonJS,
24
+ __require,
25
+ __toESM
26
+ } from "./chunk-LRKZP7DJ.js";
27
+
28
+ // node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/parser.js
29
+ var require_parser = __commonJS({
30
+ "node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/parser.js"(exports2, module2) {
31
+ "use strict";
32
+ var ParserEND = 1114112;
33
+ var ParserError = class _ParserError extends Error {
34
+ /* istanbul ignore next */
35
+ constructor(msg, filename, linenumber) {
36
+ super("[ParserError] " + msg, filename, linenumber);
37
+ this.name = "ParserError";
38
+ this.code = "ParserError";
39
+ if (Error.captureStackTrace) Error.captureStackTrace(this, _ParserError);
40
+ }
41
+ };
42
+ var State = class {
43
+ constructor(parser) {
44
+ this.parser = parser;
45
+ this.buf = "";
46
+ this.returned = null;
47
+ this.result = null;
48
+ this.resultTable = null;
49
+ this.resultArr = null;
50
+ }
51
+ };
52
+ var Parser = class {
53
+ constructor() {
54
+ this.pos = 0;
55
+ this.col = 0;
56
+ this.line = 0;
57
+ this.obj = {};
58
+ this.ctx = this.obj;
59
+ this.stack = [];
60
+ this._buf = "";
61
+ this.char = null;
62
+ this.ii = 0;
63
+ this.state = new State(this.parseStart);
64
+ }
65
+ parse(str) {
66
+ if (str.length === 0 || str.length == null) return;
67
+ this._buf = String(str);
68
+ this.ii = -1;
69
+ this.char = -1;
70
+ let getNext;
71
+ while (getNext === false || this.nextChar()) {
72
+ getNext = this.runOne();
73
+ }
74
+ this._buf = null;
75
+ }
76
+ nextChar() {
77
+ if (this.char === 10) {
78
+ ++this.line;
79
+ this.col = -1;
80
+ }
81
+ ++this.ii;
82
+ this.char = this._buf.codePointAt(this.ii);
83
+ ++this.pos;
84
+ ++this.col;
85
+ return this.haveBuffer();
86
+ }
87
+ haveBuffer() {
88
+ return this.ii < this._buf.length;
89
+ }
90
+ runOne() {
91
+ return this.state.parser.call(this, this.state.returned);
92
+ }
93
+ finish() {
94
+ this.char = ParserEND;
95
+ let last;
96
+ do {
97
+ last = this.state.parser;
98
+ this.runOne();
99
+ } while (this.state.parser !== last);
100
+ this.ctx = null;
101
+ this.state = null;
102
+ this._buf = null;
103
+ return this.obj;
104
+ }
105
+ next(fn) {
106
+ if (typeof fn !== "function") throw new ParserError("Tried to set state to non-existent state: " + JSON.stringify(fn));
107
+ this.state.parser = fn;
108
+ }
109
+ goto(fn) {
110
+ this.next(fn);
111
+ return this.runOne();
112
+ }
113
+ call(fn, returnWith) {
114
+ if (returnWith) this.next(returnWith);
115
+ this.stack.push(this.state);
116
+ this.state = new State(fn);
117
+ }
118
+ callNow(fn, returnWith) {
119
+ this.call(fn, returnWith);
120
+ return this.runOne();
121
+ }
122
+ return(value) {
123
+ if (this.stack.length === 0) throw this.error(new ParserError("Stack underflow"));
124
+ if (value === void 0) value = this.state.buf;
125
+ this.state = this.stack.pop();
126
+ this.state.returned = value;
127
+ }
128
+ returnNow(value) {
129
+ this.return(value);
130
+ return this.runOne();
131
+ }
132
+ consume() {
133
+ if (this.char === ParserEND) throw this.error(new ParserError("Unexpected end-of-buffer"));
134
+ this.state.buf += this._buf[this.ii];
135
+ }
136
+ error(err) {
137
+ err.line = this.line;
138
+ err.col = this.col;
139
+ err.pos = this.pos;
140
+ return err;
141
+ }
142
+ /* istanbul ignore next */
143
+ parseStart() {
144
+ throw new ParserError("Must declare a parseStart method");
145
+ }
146
+ };
147
+ Parser.END = ParserEND;
148
+ Parser.Error = ParserError;
149
+ module2.exports = Parser;
150
+ }
151
+ });
152
+
153
+ // node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/create-datetime.js
154
+ var require_create_datetime = __commonJS({
155
+ "node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/create-datetime.js"(exports2, module2) {
156
+ "use strict";
157
+ module2.exports = (value) => {
158
+ const date = new Date(value);
159
+ if (isNaN(date)) {
160
+ throw new TypeError("Invalid Datetime");
161
+ } else {
162
+ return date;
163
+ }
164
+ };
165
+ }
166
+ });
167
+
168
+ // node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/format-num.js
169
+ var require_format_num = __commonJS({
170
+ "node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/format-num.js"(exports2, module2) {
171
+ "use strict";
172
+ module2.exports = (d, num) => {
173
+ num = String(num);
174
+ while (num.length < d) num = "0" + num;
175
+ return num;
176
+ };
177
+ }
178
+ });
179
+
180
+ // node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/create-datetime-float.js
181
+ var require_create_datetime_float = __commonJS({
182
+ "node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/create-datetime-float.js"(exports2, module2) {
183
+ "use strict";
184
+ var f = require_format_num();
185
+ var FloatingDateTime = class extends Date {
186
+ constructor(value) {
187
+ super(value + "Z");
188
+ this.isFloating = true;
189
+ }
190
+ toISOString() {
191
+ const date = `${this.getUTCFullYear()}-${f(2, this.getUTCMonth() + 1)}-${f(2, this.getUTCDate())}`;
192
+ const time = `${f(2, this.getUTCHours())}:${f(2, this.getUTCMinutes())}:${f(2, this.getUTCSeconds())}.${f(3, this.getUTCMilliseconds())}`;
193
+ return `${date}T${time}`;
194
+ }
195
+ };
196
+ module2.exports = (value) => {
197
+ const date = new FloatingDateTime(value);
198
+ if (isNaN(date)) {
199
+ throw new TypeError("Invalid Datetime");
200
+ } else {
201
+ return date;
202
+ }
203
+ };
204
+ }
205
+ });
206
+
207
+ // node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/create-date.js
208
+ var require_create_date = __commonJS({
209
+ "node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/create-date.js"(exports2, module2) {
210
+ "use strict";
211
+ var f = require_format_num();
212
+ var DateTime = global.Date;
213
+ var Date2 = class extends DateTime {
214
+ constructor(value) {
215
+ super(value);
216
+ this.isDate = true;
217
+ }
218
+ toISOString() {
219
+ return `${this.getUTCFullYear()}-${f(2, this.getUTCMonth() + 1)}-${f(2, this.getUTCDate())}`;
220
+ }
221
+ };
222
+ module2.exports = (value) => {
223
+ const date = new Date2(value);
224
+ if (isNaN(date)) {
225
+ throw new TypeError("Invalid Datetime");
226
+ } else {
227
+ return date;
228
+ }
229
+ };
230
+ }
231
+ });
232
+
233
+ // node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/create-time.js
234
+ var require_create_time = __commonJS({
235
+ "node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/create-time.js"(exports2, module2) {
236
+ "use strict";
237
+ var f = require_format_num();
238
+ var Time = class extends Date {
239
+ constructor(value) {
240
+ super(`0000-01-01T${value}Z`);
241
+ this.isTime = true;
242
+ }
243
+ toISOString() {
244
+ return `${f(2, this.getUTCHours())}:${f(2, this.getUTCMinutes())}:${f(2, this.getUTCSeconds())}.${f(3, this.getUTCMilliseconds())}`;
245
+ }
246
+ };
247
+ module2.exports = (value) => {
248
+ const date = new Time(value);
249
+ if (isNaN(date)) {
250
+ throw new TypeError("Invalid Datetime");
251
+ } else {
252
+ return date;
253
+ }
254
+ };
255
+ }
256
+ });
257
+
258
+ // node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/toml-parser.js
259
+ var require_toml_parser = __commonJS({
260
+ "node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/toml-parser.js"(exports, module) {
261
+ "use strict";
262
+ module.exports = makeParserClass(require_parser());
263
+ module.exports.makeParserClass = makeParserClass;
264
+ var TomlError = class _TomlError extends Error {
265
+ constructor(msg) {
266
+ super(msg);
267
+ this.name = "TomlError";
268
+ if (Error.captureStackTrace) Error.captureStackTrace(this, _TomlError);
269
+ this.fromTOML = true;
270
+ this.wrapped = null;
271
+ }
272
+ };
273
+ TomlError.wrap = (err) => {
274
+ const terr = new TomlError(err.message);
275
+ terr.code = err.code;
276
+ terr.wrapped = err;
277
+ return terr;
278
+ };
279
+ module.exports.TomlError = TomlError;
280
+ var createDateTime = require_create_datetime();
281
+ var createDateTimeFloat = require_create_datetime_float();
282
+ var createDate = require_create_date();
283
+ var createTime = require_create_time();
284
+ var CTRL_I = 9;
285
+ var CTRL_J = 10;
286
+ var CTRL_M = 13;
287
+ var CTRL_CHAR_BOUNDARY = 31;
288
+ var CHAR_SP = 32;
289
+ var CHAR_QUOT = 34;
290
+ var CHAR_NUM = 35;
291
+ var CHAR_APOS = 39;
292
+ var CHAR_PLUS = 43;
293
+ var CHAR_COMMA = 44;
294
+ var CHAR_HYPHEN = 45;
295
+ var CHAR_PERIOD = 46;
296
+ var CHAR_0 = 48;
297
+ var CHAR_1 = 49;
298
+ var CHAR_7 = 55;
299
+ var CHAR_9 = 57;
300
+ var CHAR_COLON = 58;
301
+ var CHAR_EQUALS = 61;
302
+ var CHAR_A = 65;
303
+ var CHAR_E = 69;
304
+ var CHAR_F = 70;
305
+ var CHAR_T = 84;
306
+ var CHAR_U = 85;
307
+ var CHAR_Z = 90;
308
+ var CHAR_LOWBAR = 95;
309
+ var CHAR_a = 97;
310
+ var CHAR_b = 98;
311
+ var CHAR_e = 101;
312
+ var CHAR_f = 102;
313
+ var CHAR_i = 105;
314
+ var CHAR_l = 108;
315
+ var CHAR_n = 110;
316
+ var CHAR_o = 111;
317
+ var CHAR_r = 114;
318
+ var CHAR_s = 115;
319
+ var CHAR_t = 116;
320
+ var CHAR_u = 117;
321
+ var CHAR_x = 120;
322
+ var CHAR_z = 122;
323
+ var CHAR_LCUB = 123;
324
+ var CHAR_RCUB = 125;
325
+ var CHAR_LSQB = 91;
326
+ var CHAR_BSOL = 92;
327
+ var CHAR_RSQB = 93;
328
+ var CHAR_DEL = 127;
329
+ var SURROGATE_FIRST = 55296;
330
+ var SURROGATE_LAST = 57343;
331
+ var escapes = {
332
+ [CHAR_b]: "\b",
333
+ [CHAR_t]: " ",
334
+ [CHAR_n]: "\n",
335
+ [CHAR_f]: "\f",
336
+ [CHAR_r]: "\r",
337
+ [CHAR_QUOT]: '"',
338
+ [CHAR_BSOL]: "\\"
339
+ };
340
+ function isDigit(cp) {
341
+ return cp >= CHAR_0 && cp <= CHAR_9;
342
+ }
343
+ function isHexit(cp) {
344
+ return cp >= CHAR_A && cp <= CHAR_F || cp >= CHAR_a && cp <= CHAR_f || cp >= CHAR_0 && cp <= CHAR_9;
345
+ }
346
+ function isBit(cp) {
347
+ return cp === CHAR_1 || cp === CHAR_0;
348
+ }
349
+ function isOctit(cp) {
350
+ return cp >= CHAR_0 && cp <= CHAR_7;
351
+ }
352
+ function isAlphaNumQuoteHyphen(cp) {
353
+ return cp >= CHAR_A && cp <= CHAR_Z || cp >= CHAR_a && cp <= CHAR_z || cp >= CHAR_0 && cp <= CHAR_9 || cp === CHAR_APOS || cp === CHAR_QUOT || cp === CHAR_LOWBAR || cp === CHAR_HYPHEN;
354
+ }
355
+ function isAlphaNumHyphen(cp) {
356
+ return cp >= CHAR_A && cp <= CHAR_Z || cp >= CHAR_a && cp <= CHAR_z || cp >= CHAR_0 && cp <= CHAR_9 || cp === CHAR_LOWBAR || cp === CHAR_HYPHEN;
357
+ }
358
+ var _type = /* @__PURE__ */ Symbol("type");
359
+ var _declared = /* @__PURE__ */ Symbol("declared");
360
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
361
+ var defineProperty = Object.defineProperty;
362
+ var descriptor = { configurable: true, enumerable: true, writable: true, value: void 0 };
363
+ function hasKey(obj, key) {
364
+ if (hasOwnProperty.call(obj, key)) return true;
365
+ if (key === "__proto__") defineProperty(obj, "__proto__", descriptor);
366
+ return false;
367
+ }
368
+ var INLINE_TABLE = /* @__PURE__ */ Symbol("inline-table");
369
+ function InlineTable() {
370
+ return Object.defineProperties({}, {
371
+ [_type]: { value: INLINE_TABLE }
372
+ });
373
+ }
374
+ function isInlineTable(obj) {
375
+ if (obj === null || typeof obj !== "object") return false;
376
+ return obj[_type] === INLINE_TABLE;
377
+ }
378
+ var TABLE = /* @__PURE__ */ Symbol("table");
379
+ function Table() {
380
+ return Object.defineProperties({}, {
381
+ [_type]: { value: TABLE },
382
+ [_declared]: { value: false, writable: true }
383
+ });
384
+ }
385
+ function isTable(obj) {
386
+ if (obj === null || typeof obj !== "object") return false;
387
+ return obj[_type] === TABLE;
388
+ }
389
+ var _contentType = /* @__PURE__ */ Symbol("content-type");
390
+ var INLINE_LIST = /* @__PURE__ */ Symbol("inline-list");
391
+ function InlineList(type) {
392
+ return Object.defineProperties([], {
393
+ [_type]: { value: INLINE_LIST },
394
+ [_contentType]: { value: type }
395
+ });
396
+ }
397
+ function isInlineList(obj) {
398
+ if (obj === null || typeof obj !== "object") return false;
399
+ return obj[_type] === INLINE_LIST;
400
+ }
401
+ var LIST = /* @__PURE__ */ Symbol("list");
402
+ function List() {
403
+ return Object.defineProperties([], {
404
+ [_type]: { value: LIST }
405
+ });
406
+ }
407
+ function isList(obj) {
408
+ if (obj === null || typeof obj !== "object") return false;
409
+ return obj[_type] === LIST;
410
+ }
411
+ var _custom;
412
+ try {
413
+ const utilInspect = eval("require('util').inspect");
414
+ _custom = utilInspect.custom;
415
+ } catch (_) {
416
+ }
417
+ var _inspect = _custom || "inspect";
418
+ var BoxedBigInt = class {
419
+ constructor(value) {
420
+ try {
421
+ this.value = global.BigInt.asIntN(64, value);
422
+ } catch (_) {
423
+ this.value = null;
424
+ }
425
+ Object.defineProperty(this, _type, { value: INTEGER });
426
+ }
427
+ isNaN() {
428
+ return this.value === null;
429
+ }
430
+ /* istanbul ignore next */
431
+ toString() {
432
+ return String(this.value);
433
+ }
434
+ /* istanbul ignore next */
435
+ [_inspect]() {
436
+ return `[BigInt: ${this.toString()}]}`;
437
+ }
438
+ valueOf() {
439
+ return this.value;
440
+ }
441
+ };
442
+ var INTEGER = /* @__PURE__ */ Symbol("integer");
443
+ function Integer(value) {
444
+ let num = Number(value);
445
+ if (Object.is(num, -0)) num = 0;
446
+ if (global.BigInt && !Number.isSafeInteger(num)) {
447
+ return new BoxedBigInt(value);
448
+ } else {
449
+ return Object.defineProperties(new Number(num), {
450
+ isNaN: { value: function() {
451
+ return isNaN(this);
452
+ } },
453
+ [_type]: { value: INTEGER },
454
+ [_inspect]: { value: () => `[Integer: ${value}]` }
455
+ });
456
+ }
457
+ }
458
+ function isInteger(obj) {
459
+ if (obj === null || typeof obj !== "object") return false;
460
+ return obj[_type] === INTEGER;
461
+ }
462
+ var FLOAT = /* @__PURE__ */ Symbol("float");
463
+ function Float(value) {
464
+ return Object.defineProperties(new Number(value), {
465
+ [_type]: { value: FLOAT },
466
+ [_inspect]: { value: () => `[Float: ${value}]` }
467
+ });
468
+ }
469
+ function isFloat(obj) {
470
+ if (obj === null || typeof obj !== "object") return false;
471
+ return obj[_type] === FLOAT;
472
+ }
473
+ function tomlType(value) {
474
+ const type = typeof value;
475
+ if (type === "object") {
476
+ if (value === null) return "null";
477
+ if (value instanceof Date) return "datetime";
478
+ if (_type in value) {
479
+ switch (value[_type]) {
480
+ case INLINE_TABLE:
481
+ return "inline-table";
482
+ case INLINE_LIST:
483
+ return "inline-list";
484
+ /* istanbul ignore next */
485
+ case TABLE:
486
+ return "table";
487
+ /* istanbul ignore next */
488
+ case LIST:
489
+ return "list";
490
+ case FLOAT:
491
+ return "float";
492
+ case INTEGER:
493
+ return "integer";
494
+ }
495
+ }
496
+ }
497
+ return type;
498
+ }
499
+ function makeParserClass(Parser) {
500
+ class TOMLParser extends Parser {
501
+ constructor() {
502
+ super();
503
+ this.ctx = this.obj = Table();
504
+ }
505
+ /* MATCH HELPER */
506
+ atEndOfWord() {
507
+ return this.char === CHAR_NUM || this.char === CTRL_I || this.char === CHAR_SP || this.atEndOfLine();
508
+ }
509
+ atEndOfLine() {
510
+ return this.char === Parser.END || this.char === CTRL_J || this.char === CTRL_M;
511
+ }
512
+ parseStart() {
513
+ if (this.char === Parser.END) {
514
+ return null;
515
+ } else if (this.char === CHAR_LSQB) {
516
+ return this.call(this.parseTableOrList);
517
+ } else if (this.char === CHAR_NUM) {
518
+ return this.call(this.parseComment);
519
+ } else if (this.char === CTRL_J || this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M) {
520
+ return null;
521
+ } else if (isAlphaNumQuoteHyphen(this.char)) {
522
+ return this.callNow(this.parseAssignStatement);
523
+ } else {
524
+ throw this.error(new TomlError(`Unknown character "${this.char}"`));
525
+ }
526
+ }
527
+ // HELPER, this strips any whitespace and comments to the end of the line
528
+ // then RETURNS. Last state in a production.
529
+ parseWhitespaceToEOL() {
530
+ if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M) {
531
+ return null;
532
+ } else if (this.char === CHAR_NUM) {
533
+ return this.goto(this.parseComment);
534
+ } else if (this.char === Parser.END || this.char === CTRL_J) {
535
+ return this.return();
536
+ } else {
537
+ throw this.error(new TomlError("Unexpected character, expected only whitespace or comments till end of line"));
538
+ }
539
+ }
540
+ /* ASSIGNMENT: key = value */
541
+ parseAssignStatement() {
542
+ return this.callNow(this.parseAssign, this.recordAssignStatement);
543
+ }
544
+ recordAssignStatement(kv) {
545
+ let target = this.ctx;
546
+ let finalKey = kv.key.pop();
547
+ for (let kw of kv.key) {
548
+ if (hasKey(target, kw) && (!isTable(target[kw]) || target[kw][_declared])) {
549
+ throw this.error(new TomlError("Can't redefine existing key"));
550
+ }
551
+ target = target[kw] = target[kw] || Table();
552
+ }
553
+ if (hasKey(target, finalKey)) {
554
+ throw this.error(new TomlError("Can't redefine existing key"));
555
+ }
556
+ if (isInteger(kv.value) || isFloat(kv.value)) {
557
+ target[finalKey] = kv.value.valueOf();
558
+ } else {
559
+ target[finalKey] = kv.value;
560
+ }
561
+ return this.goto(this.parseWhitespaceToEOL);
562
+ }
563
+ /* ASSSIGNMENT expression, key = value possibly inside an inline table */
564
+ parseAssign() {
565
+ return this.callNow(this.parseKeyword, this.recordAssignKeyword);
566
+ }
567
+ recordAssignKeyword(key) {
568
+ if (this.state.resultTable) {
569
+ this.state.resultTable.push(key);
570
+ } else {
571
+ this.state.resultTable = [key];
572
+ }
573
+ return this.goto(this.parseAssignKeywordPreDot);
574
+ }
575
+ parseAssignKeywordPreDot() {
576
+ if (this.char === CHAR_PERIOD) {
577
+ return this.next(this.parseAssignKeywordPostDot);
578
+ } else if (this.char !== CHAR_SP && this.char !== CTRL_I) {
579
+ return this.goto(this.parseAssignEqual);
580
+ }
581
+ }
582
+ parseAssignKeywordPostDot() {
583
+ if (this.char !== CHAR_SP && this.char !== CTRL_I) {
584
+ return this.callNow(this.parseKeyword, this.recordAssignKeyword);
585
+ }
586
+ }
587
+ parseAssignEqual() {
588
+ if (this.char === CHAR_EQUALS) {
589
+ return this.next(this.parseAssignPreValue);
590
+ } else {
591
+ throw this.error(new TomlError('Invalid character, expected "="'));
592
+ }
593
+ }
594
+ parseAssignPreValue() {
595
+ if (this.char === CHAR_SP || this.char === CTRL_I) {
596
+ return null;
597
+ } else {
598
+ return this.callNow(this.parseValue, this.recordAssignValue);
599
+ }
600
+ }
601
+ recordAssignValue(value) {
602
+ return this.returnNow({ key: this.state.resultTable, value });
603
+ }
604
+ /* COMMENTS: #...eol */
605
+ parseComment() {
606
+ do {
607
+ if (this.char === Parser.END || this.char === CTRL_J) {
608
+ return this.return();
609
+ }
610
+ } while (this.nextChar());
611
+ }
612
+ /* TABLES AND LISTS, [foo] and [[foo]] */
613
+ parseTableOrList() {
614
+ if (this.char === CHAR_LSQB) {
615
+ this.next(this.parseList);
616
+ } else {
617
+ return this.goto(this.parseTable);
618
+ }
619
+ }
620
+ /* TABLE [foo.bar.baz] */
621
+ parseTable() {
622
+ this.ctx = this.obj;
623
+ return this.goto(this.parseTableNext);
624
+ }
625
+ parseTableNext() {
626
+ if (this.char === CHAR_SP || this.char === CTRL_I) {
627
+ return null;
628
+ } else {
629
+ return this.callNow(this.parseKeyword, this.parseTableMore);
630
+ }
631
+ }
632
+ parseTableMore(keyword) {
633
+ if (this.char === CHAR_SP || this.char === CTRL_I) {
634
+ return null;
635
+ } else if (this.char === CHAR_RSQB) {
636
+ if (hasKey(this.ctx, keyword) && (!isTable(this.ctx[keyword]) || this.ctx[keyword][_declared])) {
637
+ throw this.error(new TomlError("Can't redefine existing key"));
638
+ } else {
639
+ this.ctx = this.ctx[keyword] = this.ctx[keyword] || Table();
640
+ this.ctx[_declared] = true;
641
+ }
642
+ return this.next(this.parseWhitespaceToEOL);
643
+ } else if (this.char === CHAR_PERIOD) {
644
+ if (!hasKey(this.ctx, keyword)) {
645
+ this.ctx = this.ctx[keyword] = Table();
646
+ } else if (isTable(this.ctx[keyword])) {
647
+ this.ctx = this.ctx[keyword];
648
+ } else if (isList(this.ctx[keyword])) {
649
+ this.ctx = this.ctx[keyword][this.ctx[keyword].length - 1];
650
+ } else {
651
+ throw this.error(new TomlError("Can't redefine existing key"));
652
+ }
653
+ return this.next(this.parseTableNext);
654
+ } else {
655
+ throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"));
656
+ }
657
+ }
658
+ /* LIST [[a.b.c]] */
659
+ parseList() {
660
+ this.ctx = this.obj;
661
+ return this.goto(this.parseListNext);
662
+ }
663
+ parseListNext() {
664
+ if (this.char === CHAR_SP || this.char === CTRL_I) {
665
+ return null;
666
+ } else {
667
+ return this.callNow(this.parseKeyword, this.parseListMore);
668
+ }
669
+ }
670
+ parseListMore(keyword) {
671
+ if (this.char === CHAR_SP || this.char === CTRL_I) {
672
+ return null;
673
+ } else if (this.char === CHAR_RSQB) {
674
+ if (!hasKey(this.ctx, keyword)) {
675
+ this.ctx[keyword] = List();
676
+ }
677
+ if (isInlineList(this.ctx[keyword])) {
678
+ throw this.error(new TomlError("Can't extend an inline array"));
679
+ } else if (isList(this.ctx[keyword])) {
680
+ const next = Table();
681
+ this.ctx[keyword].push(next);
682
+ this.ctx = next;
683
+ } else {
684
+ throw this.error(new TomlError("Can't redefine an existing key"));
685
+ }
686
+ return this.next(this.parseListEnd);
687
+ } else if (this.char === CHAR_PERIOD) {
688
+ if (!hasKey(this.ctx, keyword)) {
689
+ this.ctx = this.ctx[keyword] = Table();
690
+ } else if (isInlineList(this.ctx[keyword])) {
691
+ throw this.error(new TomlError("Can't extend an inline array"));
692
+ } else if (isInlineTable(this.ctx[keyword])) {
693
+ throw this.error(new TomlError("Can't extend an inline table"));
694
+ } else if (isList(this.ctx[keyword])) {
695
+ this.ctx = this.ctx[keyword][this.ctx[keyword].length - 1];
696
+ } else if (isTable(this.ctx[keyword])) {
697
+ this.ctx = this.ctx[keyword];
698
+ } else {
699
+ throw this.error(new TomlError("Can't redefine an existing key"));
700
+ }
701
+ return this.next(this.parseListNext);
702
+ } else {
703
+ throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"));
704
+ }
705
+ }
706
+ parseListEnd(keyword) {
707
+ if (this.char === CHAR_RSQB) {
708
+ return this.next(this.parseWhitespaceToEOL);
709
+ } else {
710
+ throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"));
711
+ }
712
+ }
713
+ /* VALUE string, number, boolean, inline list, inline object */
714
+ parseValue() {
715
+ if (this.char === Parser.END) {
716
+ throw this.error(new TomlError("Key without value"));
717
+ } else if (this.char === CHAR_QUOT) {
718
+ return this.next(this.parseDoubleString);
719
+ }
720
+ if (this.char === CHAR_APOS) {
721
+ return this.next(this.parseSingleString);
722
+ } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) {
723
+ return this.goto(this.parseNumberSign);
724
+ } else if (this.char === CHAR_i) {
725
+ return this.next(this.parseInf);
726
+ } else if (this.char === CHAR_n) {
727
+ return this.next(this.parseNan);
728
+ } else if (isDigit(this.char)) {
729
+ return this.goto(this.parseNumberOrDateTime);
730
+ } else if (this.char === CHAR_t || this.char === CHAR_f) {
731
+ return this.goto(this.parseBoolean);
732
+ } else if (this.char === CHAR_LSQB) {
733
+ return this.call(this.parseInlineList, this.recordValue);
734
+ } else if (this.char === CHAR_LCUB) {
735
+ return this.call(this.parseInlineTable, this.recordValue);
736
+ } else {
737
+ throw this.error(new TomlError("Unexpected character, expecting string, number, datetime, boolean, inline array or inline table"));
738
+ }
739
+ }
740
+ recordValue(value) {
741
+ return this.returnNow(value);
742
+ }
743
+ parseInf() {
744
+ if (this.char === CHAR_n) {
745
+ return this.next(this.parseInf2);
746
+ } else {
747
+ throw this.error(new TomlError('Unexpected character, expected "inf", "+inf" or "-inf"'));
748
+ }
749
+ }
750
+ parseInf2() {
751
+ if (this.char === CHAR_f) {
752
+ if (this.state.buf === "-") {
753
+ return this.return(-Infinity);
754
+ } else {
755
+ return this.return(Infinity);
756
+ }
757
+ } else {
758
+ throw this.error(new TomlError('Unexpected character, expected "inf", "+inf" or "-inf"'));
759
+ }
760
+ }
761
+ parseNan() {
762
+ if (this.char === CHAR_a) {
763
+ return this.next(this.parseNan2);
764
+ } else {
765
+ throw this.error(new TomlError('Unexpected character, expected "nan"'));
766
+ }
767
+ }
768
+ parseNan2() {
769
+ if (this.char === CHAR_n) {
770
+ return this.return(NaN);
771
+ } else {
772
+ throw this.error(new TomlError('Unexpected character, expected "nan"'));
773
+ }
774
+ }
775
+ /* KEYS, barewords or basic, literal, or dotted */
776
+ parseKeyword() {
777
+ if (this.char === CHAR_QUOT) {
778
+ return this.next(this.parseBasicString);
779
+ } else if (this.char === CHAR_APOS) {
780
+ return this.next(this.parseLiteralString);
781
+ } else {
782
+ return this.goto(this.parseBareKey);
783
+ }
784
+ }
785
+ /* KEYS: barewords */
786
+ parseBareKey() {
787
+ do {
788
+ if (this.char === Parser.END) {
789
+ throw this.error(new TomlError("Key ended without value"));
790
+ } else if (isAlphaNumHyphen(this.char)) {
791
+ this.consume();
792
+ } else if (this.state.buf.length === 0) {
793
+ throw this.error(new TomlError("Empty bare keys are not allowed"));
794
+ } else {
795
+ return this.returnNow();
796
+ }
797
+ } while (this.nextChar());
798
+ }
799
+ /* STRINGS, single quoted (literal) */
800
+ parseSingleString() {
801
+ if (this.char === CHAR_APOS) {
802
+ return this.next(this.parseLiteralMultiStringMaybe);
803
+ } else {
804
+ return this.goto(this.parseLiteralString);
805
+ }
806
+ }
807
+ parseLiteralString() {
808
+ do {
809
+ if (this.char === CHAR_APOS) {
810
+ return this.return();
811
+ } else if (this.atEndOfLine()) {
812
+ throw this.error(new TomlError("Unterminated string"));
813
+ } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I) {
814
+ throw this.errorControlCharInString();
815
+ } else {
816
+ this.consume();
817
+ }
818
+ } while (this.nextChar());
819
+ }
820
+ parseLiteralMultiStringMaybe() {
821
+ if (this.char === CHAR_APOS) {
822
+ return this.next(this.parseLiteralMultiString);
823
+ } else {
824
+ return this.returnNow();
825
+ }
826
+ }
827
+ parseLiteralMultiString() {
828
+ if (this.char === CTRL_M) {
829
+ return null;
830
+ } else if (this.char === CTRL_J) {
831
+ return this.next(this.parseLiteralMultiStringContent);
832
+ } else {
833
+ return this.goto(this.parseLiteralMultiStringContent);
834
+ }
835
+ }
836
+ parseLiteralMultiStringContent() {
837
+ do {
838
+ if (this.char === CHAR_APOS) {
839
+ return this.next(this.parseLiteralMultiEnd);
840
+ } else if (this.char === Parser.END) {
841
+ throw this.error(new TomlError("Unterminated multi-line string"));
842
+ } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I && this.char !== CTRL_J && this.char !== CTRL_M) {
843
+ throw this.errorControlCharInString();
844
+ } else {
845
+ this.consume();
846
+ }
847
+ } while (this.nextChar());
848
+ }
849
+ parseLiteralMultiEnd() {
850
+ if (this.char === CHAR_APOS) {
851
+ return this.next(this.parseLiteralMultiEnd2);
852
+ } else {
853
+ this.state.buf += "'";
854
+ return this.goto(this.parseLiteralMultiStringContent);
855
+ }
856
+ }
857
+ parseLiteralMultiEnd2() {
858
+ if (this.char === CHAR_APOS) {
859
+ return this.return();
860
+ } else {
861
+ this.state.buf += "''";
862
+ return this.goto(this.parseLiteralMultiStringContent);
863
+ }
864
+ }
865
+ /* STRINGS double quoted */
866
+ parseDoubleString() {
867
+ if (this.char === CHAR_QUOT) {
868
+ return this.next(this.parseMultiStringMaybe);
869
+ } else {
870
+ return this.goto(this.parseBasicString);
871
+ }
872
+ }
873
+ parseBasicString() {
874
+ do {
875
+ if (this.char === CHAR_BSOL) {
876
+ return this.call(this.parseEscape, this.recordEscapeReplacement);
877
+ } else if (this.char === CHAR_QUOT) {
878
+ return this.return();
879
+ } else if (this.atEndOfLine()) {
880
+ throw this.error(new TomlError("Unterminated string"));
881
+ } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I) {
882
+ throw this.errorControlCharInString();
883
+ } else {
884
+ this.consume();
885
+ }
886
+ } while (this.nextChar());
887
+ }
888
+ recordEscapeReplacement(replacement) {
889
+ this.state.buf += replacement;
890
+ return this.goto(this.parseBasicString);
891
+ }
892
+ parseMultiStringMaybe() {
893
+ if (this.char === CHAR_QUOT) {
894
+ return this.next(this.parseMultiString);
895
+ } else {
896
+ return this.returnNow();
897
+ }
898
+ }
899
+ parseMultiString() {
900
+ if (this.char === CTRL_M) {
901
+ return null;
902
+ } else if (this.char === CTRL_J) {
903
+ return this.next(this.parseMultiStringContent);
904
+ } else {
905
+ return this.goto(this.parseMultiStringContent);
906
+ }
907
+ }
908
+ parseMultiStringContent() {
909
+ do {
910
+ if (this.char === CHAR_BSOL) {
911
+ return this.call(this.parseMultiEscape, this.recordMultiEscapeReplacement);
912
+ } else if (this.char === CHAR_QUOT) {
913
+ return this.next(this.parseMultiEnd);
914
+ } else if (this.char === Parser.END) {
915
+ throw this.error(new TomlError("Unterminated multi-line string"));
916
+ } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I && this.char !== CTRL_J && this.char !== CTRL_M) {
917
+ throw this.errorControlCharInString();
918
+ } else {
919
+ this.consume();
920
+ }
921
+ } while (this.nextChar());
922
+ }
923
+ errorControlCharInString() {
924
+ let displayCode = "\\u00";
925
+ if (this.char < 16) {
926
+ displayCode += "0";
927
+ }
928
+ displayCode += this.char.toString(16);
929
+ return this.error(new TomlError(`Control characters (codes < 0x1f and 0x7f) are not allowed in strings, use ${displayCode} instead`));
930
+ }
931
+ recordMultiEscapeReplacement(replacement) {
932
+ this.state.buf += replacement;
933
+ return this.goto(this.parseMultiStringContent);
934
+ }
935
+ parseMultiEnd() {
936
+ if (this.char === CHAR_QUOT) {
937
+ return this.next(this.parseMultiEnd2);
938
+ } else {
939
+ this.state.buf += '"';
940
+ return this.goto(this.parseMultiStringContent);
941
+ }
942
+ }
943
+ parseMultiEnd2() {
944
+ if (this.char === CHAR_QUOT) {
945
+ return this.return();
946
+ } else {
947
+ this.state.buf += '""';
948
+ return this.goto(this.parseMultiStringContent);
949
+ }
950
+ }
951
+ parseMultiEscape() {
952
+ if (this.char === CTRL_M || this.char === CTRL_J) {
953
+ return this.next(this.parseMultiTrim);
954
+ } else if (this.char === CHAR_SP || this.char === CTRL_I) {
955
+ return this.next(this.parsePreMultiTrim);
956
+ } else {
957
+ return this.goto(this.parseEscape);
958
+ }
959
+ }
960
+ parsePreMultiTrim() {
961
+ if (this.char === CHAR_SP || this.char === CTRL_I) {
962
+ return null;
963
+ } else if (this.char === CTRL_M || this.char === CTRL_J) {
964
+ return this.next(this.parseMultiTrim);
965
+ } else {
966
+ throw this.error(new TomlError("Can't escape whitespace"));
967
+ }
968
+ }
969
+ parseMultiTrim() {
970
+ if (this.char === CTRL_J || this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M) {
971
+ return null;
972
+ } else {
973
+ return this.returnNow();
974
+ }
975
+ }
976
+ parseEscape() {
977
+ if (this.char in escapes) {
978
+ return this.return(escapes[this.char]);
979
+ } else if (this.char === CHAR_u) {
980
+ return this.call(this.parseSmallUnicode, this.parseUnicodeReturn);
981
+ } else if (this.char === CHAR_U) {
982
+ return this.call(this.parseLargeUnicode, this.parseUnicodeReturn);
983
+ } else {
984
+ throw this.error(new TomlError("Unknown escape character: " + this.char));
985
+ }
986
+ }
987
+ parseUnicodeReturn(char) {
988
+ try {
989
+ const codePoint = parseInt(char, 16);
990
+ if (codePoint >= SURROGATE_FIRST && codePoint <= SURROGATE_LAST) {
991
+ throw this.error(new TomlError("Invalid unicode, character in range 0xD800 - 0xDFFF is reserved"));
992
+ }
993
+ return this.returnNow(String.fromCodePoint(codePoint));
994
+ } catch (err) {
995
+ throw this.error(TomlError.wrap(err));
996
+ }
997
+ }
998
+ parseSmallUnicode() {
999
+ if (!isHexit(this.char)) {
1000
+ throw this.error(new TomlError("Invalid character in unicode sequence, expected hex"));
1001
+ } else {
1002
+ this.consume();
1003
+ if (this.state.buf.length >= 4) return this.return();
1004
+ }
1005
+ }
1006
+ parseLargeUnicode() {
1007
+ if (!isHexit(this.char)) {
1008
+ throw this.error(new TomlError("Invalid character in unicode sequence, expected hex"));
1009
+ } else {
1010
+ this.consume();
1011
+ if (this.state.buf.length >= 8) return this.return();
1012
+ }
1013
+ }
1014
+ /* NUMBERS */
1015
+ parseNumberSign() {
1016
+ this.consume();
1017
+ return this.next(this.parseMaybeSignedInfOrNan);
1018
+ }
1019
+ parseMaybeSignedInfOrNan() {
1020
+ if (this.char === CHAR_i) {
1021
+ return this.next(this.parseInf);
1022
+ } else if (this.char === CHAR_n) {
1023
+ return this.next(this.parseNan);
1024
+ } else {
1025
+ return this.callNow(this.parseNoUnder, this.parseNumberIntegerStart);
1026
+ }
1027
+ }
1028
+ parseNumberIntegerStart() {
1029
+ if (this.char === CHAR_0) {
1030
+ this.consume();
1031
+ return this.next(this.parseNumberIntegerExponentOrDecimal);
1032
+ } else {
1033
+ return this.goto(this.parseNumberInteger);
1034
+ }
1035
+ }
1036
+ parseNumberIntegerExponentOrDecimal() {
1037
+ if (this.char === CHAR_PERIOD) {
1038
+ this.consume();
1039
+ return this.call(this.parseNoUnder, this.parseNumberFloat);
1040
+ } else if (this.char === CHAR_E || this.char === CHAR_e) {
1041
+ this.consume();
1042
+ return this.next(this.parseNumberExponentSign);
1043
+ } else {
1044
+ return this.returnNow(Integer(this.state.buf));
1045
+ }
1046
+ }
1047
+ parseNumberInteger() {
1048
+ if (isDigit(this.char)) {
1049
+ this.consume();
1050
+ } else if (this.char === CHAR_LOWBAR) {
1051
+ return this.call(this.parseNoUnder);
1052
+ } else if (this.char === CHAR_E || this.char === CHAR_e) {
1053
+ this.consume();
1054
+ return this.next(this.parseNumberExponentSign);
1055
+ } else if (this.char === CHAR_PERIOD) {
1056
+ this.consume();
1057
+ return this.call(this.parseNoUnder, this.parseNumberFloat);
1058
+ } else {
1059
+ const result = Integer(this.state.buf);
1060
+ if (result.isNaN()) {
1061
+ throw this.error(new TomlError("Invalid number"));
1062
+ } else {
1063
+ return this.returnNow(result);
1064
+ }
1065
+ }
1066
+ }
1067
+ parseNoUnder() {
1068
+ if (this.char === CHAR_LOWBAR || this.char === CHAR_PERIOD || this.char === CHAR_E || this.char === CHAR_e) {
1069
+ throw this.error(new TomlError("Unexpected character, expected digit"));
1070
+ } else if (this.atEndOfWord()) {
1071
+ throw this.error(new TomlError("Incomplete number"));
1072
+ }
1073
+ return this.returnNow();
1074
+ }
1075
+ parseNoUnderHexOctBinLiteral() {
1076
+ if (this.char === CHAR_LOWBAR || this.char === CHAR_PERIOD) {
1077
+ throw this.error(new TomlError("Unexpected character, expected digit"));
1078
+ } else if (this.atEndOfWord()) {
1079
+ throw this.error(new TomlError("Incomplete number"));
1080
+ }
1081
+ return this.returnNow();
1082
+ }
1083
+ parseNumberFloat() {
1084
+ if (this.char === CHAR_LOWBAR) {
1085
+ return this.call(this.parseNoUnder, this.parseNumberFloat);
1086
+ } else if (isDigit(this.char)) {
1087
+ this.consume();
1088
+ } else if (this.char === CHAR_E || this.char === CHAR_e) {
1089
+ this.consume();
1090
+ return this.next(this.parseNumberExponentSign);
1091
+ } else {
1092
+ return this.returnNow(Float(this.state.buf));
1093
+ }
1094
+ }
1095
+ parseNumberExponentSign() {
1096
+ if (isDigit(this.char)) {
1097
+ return this.goto(this.parseNumberExponent);
1098
+ } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) {
1099
+ this.consume();
1100
+ this.call(this.parseNoUnder, this.parseNumberExponent);
1101
+ } else {
1102
+ throw this.error(new TomlError("Unexpected character, expected -, + or digit"));
1103
+ }
1104
+ }
1105
+ parseNumberExponent() {
1106
+ if (isDigit(this.char)) {
1107
+ this.consume();
1108
+ } else if (this.char === CHAR_LOWBAR) {
1109
+ return this.call(this.parseNoUnder);
1110
+ } else {
1111
+ return this.returnNow(Float(this.state.buf));
1112
+ }
1113
+ }
1114
+ /* NUMBERS or DATETIMES */
1115
+ parseNumberOrDateTime() {
1116
+ if (this.char === CHAR_0) {
1117
+ this.consume();
1118
+ return this.next(this.parseNumberBaseOrDateTime);
1119
+ } else {
1120
+ return this.goto(this.parseNumberOrDateTimeOnly);
1121
+ }
1122
+ }
1123
+ parseNumberOrDateTimeOnly() {
1124
+ if (this.char === CHAR_LOWBAR) {
1125
+ return this.call(this.parseNoUnder, this.parseNumberInteger);
1126
+ } else if (isDigit(this.char)) {
1127
+ this.consume();
1128
+ if (this.state.buf.length > 4) this.next(this.parseNumberInteger);
1129
+ } else if (this.char === CHAR_E || this.char === CHAR_e) {
1130
+ this.consume();
1131
+ return this.next(this.parseNumberExponentSign);
1132
+ } else if (this.char === CHAR_PERIOD) {
1133
+ this.consume();
1134
+ return this.call(this.parseNoUnder, this.parseNumberFloat);
1135
+ } else if (this.char === CHAR_HYPHEN) {
1136
+ return this.goto(this.parseDateTime);
1137
+ } else if (this.char === CHAR_COLON) {
1138
+ return this.goto(this.parseOnlyTimeHour);
1139
+ } else {
1140
+ return this.returnNow(Integer(this.state.buf));
1141
+ }
1142
+ }
1143
+ parseDateTimeOnly() {
1144
+ if (this.state.buf.length < 4) {
1145
+ if (isDigit(this.char)) {
1146
+ return this.consume();
1147
+ } else if (this.char === CHAR_COLON) {
1148
+ return this.goto(this.parseOnlyTimeHour);
1149
+ } else {
1150
+ throw this.error(new TomlError("Expected digit while parsing year part of a date"));
1151
+ }
1152
+ } else {
1153
+ if (this.char === CHAR_HYPHEN) {
1154
+ return this.goto(this.parseDateTime);
1155
+ } else {
1156
+ throw this.error(new TomlError("Expected hyphen (-) while parsing year part of date"));
1157
+ }
1158
+ }
1159
+ }
1160
+ parseNumberBaseOrDateTime() {
1161
+ if (this.char === CHAR_b) {
1162
+ this.consume();
1163
+ return this.call(this.parseNoUnderHexOctBinLiteral, this.parseIntegerBin);
1164
+ } else if (this.char === CHAR_o) {
1165
+ this.consume();
1166
+ return this.call(this.parseNoUnderHexOctBinLiteral, this.parseIntegerOct);
1167
+ } else if (this.char === CHAR_x) {
1168
+ this.consume();
1169
+ return this.call(this.parseNoUnderHexOctBinLiteral, this.parseIntegerHex);
1170
+ } else if (this.char === CHAR_PERIOD) {
1171
+ return this.goto(this.parseNumberInteger);
1172
+ } else if (isDigit(this.char)) {
1173
+ return this.goto(this.parseDateTimeOnly);
1174
+ } else {
1175
+ return this.returnNow(Integer(this.state.buf));
1176
+ }
1177
+ }
1178
+ parseIntegerHex() {
1179
+ if (isHexit(this.char)) {
1180
+ this.consume();
1181
+ } else if (this.char === CHAR_LOWBAR) {
1182
+ return this.call(this.parseNoUnderHexOctBinLiteral);
1183
+ } else {
1184
+ const result = Integer(this.state.buf);
1185
+ if (result.isNaN()) {
1186
+ throw this.error(new TomlError("Invalid number"));
1187
+ } else {
1188
+ return this.returnNow(result);
1189
+ }
1190
+ }
1191
+ }
1192
+ parseIntegerOct() {
1193
+ if (isOctit(this.char)) {
1194
+ this.consume();
1195
+ } else if (this.char === CHAR_LOWBAR) {
1196
+ return this.call(this.parseNoUnderHexOctBinLiteral);
1197
+ } else {
1198
+ const result = Integer(this.state.buf);
1199
+ if (result.isNaN()) {
1200
+ throw this.error(new TomlError("Invalid number"));
1201
+ } else {
1202
+ return this.returnNow(result);
1203
+ }
1204
+ }
1205
+ }
1206
+ parseIntegerBin() {
1207
+ if (isBit(this.char)) {
1208
+ this.consume();
1209
+ } else if (this.char === CHAR_LOWBAR) {
1210
+ return this.call(this.parseNoUnderHexOctBinLiteral);
1211
+ } else {
1212
+ const result = Integer(this.state.buf);
1213
+ if (result.isNaN()) {
1214
+ throw this.error(new TomlError("Invalid number"));
1215
+ } else {
1216
+ return this.returnNow(result);
1217
+ }
1218
+ }
1219
+ }
1220
+ /* DATETIME */
1221
+ parseDateTime() {
1222
+ if (this.state.buf.length < 4) {
1223
+ throw this.error(new TomlError("Years less than 1000 must be zero padded to four characters"));
1224
+ }
1225
+ this.state.result = this.state.buf;
1226
+ this.state.buf = "";
1227
+ return this.next(this.parseDateMonth);
1228
+ }
1229
+ parseDateMonth() {
1230
+ if (this.char === CHAR_HYPHEN) {
1231
+ if (this.state.buf.length < 2) {
1232
+ throw this.error(new TomlError("Months less than 10 must be zero padded to two characters"));
1233
+ }
1234
+ this.state.result += "-" + this.state.buf;
1235
+ this.state.buf = "";
1236
+ return this.next(this.parseDateDay);
1237
+ } else if (isDigit(this.char)) {
1238
+ this.consume();
1239
+ } else {
1240
+ throw this.error(new TomlError("Incomplete datetime"));
1241
+ }
1242
+ }
1243
+ parseDateDay() {
1244
+ if (this.char === CHAR_T || this.char === CHAR_SP) {
1245
+ if (this.state.buf.length < 2) {
1246
+ throw this.error(new TomlError("Days less than 10 must be zero padded to two characters"));
1247
+ }
1248
+ this.state.result += "-" + this.state.buf;
1249
+ this.state.buf = "";
1250
+ return this.next(this.parseStartTimeHour);
1251
+ } else if (this.atEndOfWord()) {
1252
+ return this.returnNow(createDate(this.state.result + "-" + this.state.buf));
1253
+ } else if (isDigit(this.char)) {
1254
+ this.consume();
1255
+ } else {
1256
+ throw this.error(new TomlError("Incomplete datetime"));
1257
+ }
1258
+ }
1259
+ parseStartTimeHour() {
1260
+ if (this.atEndOfWord()) {
1261
+ return this.returnNow(createDate(this.state.result));
1262
+ } else {
1263
+ return this.goto(this.parseTimeHour);
1264
+ }
1265
+ }
1266
+ parseTimeHour() {
1267
+ if (this.char === CHAR_COLON) {
1268
+ if (this.state.buf.length < 2) {
1269
+ throw this.error(new TomlError("Hours less than 10 must be zero padded to two characters"));
1270
+ }
1271
+ this.state.result += "T" + this.state.buf;
1272
+ this.state.buf = "";
1273
+ return this.next(this.parseTimeMin);
1274
+ } else if (isDigit(this.char)) {
1275
+ this.consume();
1276
+ } else {
1277
+ throw this.error(new TomlError("Incomplete datetime"));
1278
+ }
1279
+ }
1280
+ parseTimeMin() {
1281
+ if (this.state.buf.length < 2 && isDigit(this.char)) {
1282
+ this.consume();
1283
+ } else if (this.state.buf.length === 2 && this.char === CHAR_COLON) {
1284
+ this.state.result += ":" + this.state.buf;
1285
+ this.state.buf = "";
1286
+ return this.next(this.parseTimeSec);
1287
+ } else {
1288
+ throw this.error(new TomlError("Incomplete datetime"));
1289
+ }
1290
+ }
1291
+ parseTimeSec() {
1292
+ if (isDigit(this.char)) {
1293
+ this.consume();
1294
+ if (this.state.buf.length === 2) {
1295
+ this.state.result += ":" + this.state.buf;
1296
+ this.state.buf = "";
1297
+ return this.next(this.parseTimeZoneOrFraction);
1298
+ }
1299
+ } else {
1300
+ throw this.error(new TomlError("Incomplete datetime"));
1301
+ }
1302
+ }
1303
+ parseOnlyTimeHour() {
1304
+ if (this.char === CHAR_COLON) {
1305
+ if (this.state.buf.length < 2) {
1306
+ throw this.error(new TomlError("Hours less than 10 must be zero padded to two characters"));
1307
+ }
1308
+ this.state.result = this.state.buf;
1309
+ this.state.buf = "";
1310
+ return this.next(this.parseOnlyTimeMin);
1311
+ } else {
1312
+ throw this.error(new TomlError("Incomplete time"));
1313
+ }
1314
+ }
1315
+ parseOnlyTimeMin() {
1316
+ if (this.state.buf.length < 2 && isDigit(this.char)) {
1317
+ this.consume();
1318
+ } else if (this.state.buf.length === 2 && this.char === CHAR_COLON) {
1319
+ this.state.result += ":" + this.state.buf;
1320
+ this.state.buf = "";
1321
+ return this.next(this.parseOnlyTimeSec);
1322
+ } else {
1323
+ throw this.error(new TomlError("Incomplete time"));
1324
+ }
1325
+ }
1326
+ parseOnlyTimeSec() {
1327
+ if (isDigit(this.char)) {
1328
+ this.consume();
1329
+ if (this.state.buf.length === 2) {
1330
+ return this.next(this.parseOnlyTimeFractionMaybe);
1331
+ }
1332
+ } else {
1333
+ throw this.error(new TomlError("Incomplete time"));
1334
+ }
1335
+ }
1336
+ parseOnlyTimeFractionMaybe() {
1337
+ this.state.result += ":" + this.state.buf;
1338
+ if (this.char === CHAR_PERIOD) {
1339
+ this.state.buf = "";
1340
+ this.next(this.parseOnlyTimeFraction);
1341
+ } else {
1342
+ return this.return(createTime(this.state.result));
1343
+ }
1344
+ }
1345
+ parseOnlyTimeFraction() {
1346
+ if (isDigit(this.char)) {
1347
+ this.consume();
1348
+ } else if (this.atEndOfWord()) {
1349
+ if (this.state.buf.length === 0) throw this.error(new TomlError("Expected digit in milliseconds"));
1350
+ return this.returnNow(createTime(this.state.result + "." + this.state.buf));
1351
+ } else {
1352
+ throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"));
1353
+ }
1354
+ }
1355
+ parseTimeZoneOrFraction() {
1356
+ if (this.char === CHAR_PERIOD) {
1357
+ this.consume();
1358
+ this.next(this.parseDateTimeFraction);
1359
+ } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) {
1360
+ this.consume();
1361
+ this.next(this.parseTimeZoneHour);
1362
+ } else if (this.char === CHAR_Z) {
1363
+ this.consume();
1364
+ return this.return(createDateTime(this.state.result + this.state.buf));
1365
+ } else if (this.atEndOfWord()) {
1366
+ return this.returnNow(createDateTimeFloat(this.state.result + this.state.buf));
1367
+ } else {
1368
+ throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"));
1369
+ }
1370
+ }
1371
+ parseDateTimeFraction() {
1372
+ if (isDigit(this.char)) {
1373
+ this.consume();
1374
+ } else if (this.state.buf.length === 1) {
1375
+ throw this.error(new TomlError("Expected digit in milliseconds"));
1376
+ } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) {
1377
+ this.consume();
1378
+ this.next(this.parseTimeZoneHour);
1379
+ } else if (this.char === CHAR_Z) {
1380
+ this.consume();
1381
+ return this.return(createDateTime(this.state.result + this.state.buf));
1382
+ } else if (this.atEndOfWord()) {
1383
+ return this.returnNow(createDateTimeFloat(this.state.result + this.state.buf));
1384
+ } else {
1385
+ throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"));
1386
+ }
1387
+ }
1388
+ parseTimeZoneHour() {
1389
+ if (isDigit(this.char)) {
1390
+ this.consume();
1391
+ if (/\d\d$/.test(this.state.buf)) return this.next(this.parseTimeZoneSep);
1392
+ } else {
1393
+ throw this.error(new TomlError("Unexpected character in datetime, expected digit"));
1394
+ }
1395
+ }
1396
+ parseTimeZoneSep() {
1397
+ if (this.char === CHAR_COLON) {
1398
+ this.consume();
1399
+ this.next(this.parseTimeZoneMin);
1400
+ } else {
1401
+ throw this.error(new TomlError("Unexpected character in datetime, expected colon"));
1402
+ }
1403
+ }
1404
+ parseTimeZoneMin() {
1405
+ if (isDigit(this.char)) {
1406
+ this.consume();
1407
+ if (/\d\d$/.test(this.state.buf)) return this.return(createDateTime(this.state.result + this.state.buf));
1408
+ } else {
1409
+ throw this.error(new TomlError("Unexpected character in datetime, expected digit"));
1410
+ }
1411
+ }
1412
+ /* BOOLEAN */
1413
+ parseBoolean() {
1414
+ if (this.char === CHAR_t) {
1415
+ this.consume();
1416
+ return this.next(this.parseTrue_r);
1417
+ } else if (this.char === CHAR_f) {
1418
+ this.consume();
1419
+ return this.next(this.parseFalse_a);
1420
+ }
1421
+ }
1422
+ parseTrue_r() {
1423
+ if (this.char === CHAR_r) {
1424
+ this.consume();
1425
+ return this.next(this.parseTrue_u);
1426
+ } else {
1427
+ throw this.error(new TomlError("Invalid boolean, expected true or false"));
1428
+ }
1429
+ }
1430
+ parseTrue_u() {
1431
+ if (this.char === CHAR_u) {
1432
+ this.consume();
1433
+ return this.next(this.parseTrue_e);
1434
+ } else {
1435
+ throw this.error(new TomlError("Invalid boolean, expected true or false"));
1436
+ }
1437
+ }
1438
+ parseTrue_e() {
1439
+ if (this.char === CHAR_e) {
1440
+ return this.return(true);
1441
+ } else {
1442
+ throw this.error(new TomlError("Invalid boolean, expected true or false"));
1443
+ }
1444
+ }
1445
+ parseFalse_a() {
1446
+ if (this.char === CHAR_a) {
1447
+ this.consume();
1448
+ return this.next(this.parseFalse_l);
1449
+ } else {
1450
+ throw this.error(new TomlError("Invalid boolean, expected true or false"));
1451
+ }
1452
+ }
1453
+ parseFalse_l() {
1454
+ if (this.char === CHAR_l) {
1455
+ this.consume();
1456
+ return this.next(this.parseFalse_s);
1457
+ } else {
1458
+ throw this.error(new TomlError("Invalid boolean, expected true or false"));
1459
+ }
1460
+ }
1461
+ parseFalse_s() {
1462
+ if (this.char === CHAR_s) {
1463
+ this.consume();
1464
+ return this.next(this.parseFalse_e);
1465
+ } else {
1466
+ throw this.error(new TomlError("Invalid boolean, expected true or false"));
1467
+ }
1468
+ }
1469
+ parseFalse_e() {
1470
+ if (this.char === CHAR_e) {
1471
+ return this.return(false);
1472
+ } else {
1473
+ throw this.error(new TomlError("Invalid boolean, expected true or false"));
1474
+ }
1475
+ }
1476
+ /* INLINE LISTS */
1477
+ parseInlineList() {
1478
+ if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M || this.char === CTRL_J) {
1479
+ return null;
1480
+ } else if (this.char === Parser.END) {
1481
+ throw this.error(new TomlError("Unterminated inline array"));
1482
+ } else if (this.char === CHAR_NUM) {
1483
+ return this.call(this.parseComment);
1484
+ } else if (this.char === CHAR_RSQB) {
1485
+ return this.return(this.state.resultArr || InlineList());
1486
+ } else {
1487
+ return this.callNow(this.parseValue, this.recordInlineListValue);
1488
+ }
1489
+ }
1490
+ recordInlineListValue(value) {
1491
+ if (this.state.resultArr) {
1492
+ const listType = this.state.resultArr[_contentType];
1493
+ const valueType = tomlType(value);
1494
+ if (listType !== valueType) {
1495
+ throw this.error(new TomlError(`Inline lists must be a single type, not a mix of ${listType} and ${valueType}`));
1496
+ }
1497
+ } else {
1498
+ this.state.resultArr = InlineList(tomlType(value));
1499
+ }
1500
+ if (isFloat(value) || isInteger(value)) {
1501
+ this.state.resultArr.push(value.valueOf());
1502
+ } else {
1503
+ this.state.resultArr.push(value);
1504
+ }
1505
+ return this.goto(this.parseInlineListNext);
1506
+ }
1507
+ parseInlineListNext() {
1508
+ if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M || this.char === CTRL_J) {
1509
+ return null;
1510
+ } else if (this.char === CHAR_NUM) {
1511
+ return this.call(this.parseComment);
1512
+ } else if (this.char === CHAR_COMMA) {
1513
+ return this.next(this.parseInlineList);
1514
+ } else if (this.char === CHAR_RSQB) {
1515
+ return this.goto(this.parseInlineList);
1516
+ } else {
1517
+ throw this.error(new TomlError("Invalid character, expected whitespace, comma (,) or close bracket (])"));
1518
+ }
1519
+ }
1520
+ /* INLINE TABLE */
1521
+ parseInlineTable() {
1522
+ if (this.char === CHAR_SP || this.char === CTRL_I) {
1523
+ return null;
1524
+ } else if (this.char === Parser.END || this.char === CHAR_NUM || this.char === CTRL_J || this.char === CTRL_M) {
1525
+ throw this.error(new TomlError("Unterminated inline array"));
1526
+ } else if (this.char === CHAR_RCUB) {
1527
+ return this.return(this.state.resultTable || InlineTable());
1528
+ } else {
1529
+ if (!this.state.resultTable) this.state.resultTable = InlineTable();
1530
+ return this.callNow(this.parseAssign, this.recordInlineTableValue);
1531
+ }
1532
+ }
1533
+ recordInlineTableValue(kv) {
1534
+ let target = this.state.resultTable;
1535
+ let finalKey = kv.key.pop();
1536
+ for (let kw of kv.key) {
1537
+ if (hasKey(target, kw) && (!isTable(target[kw]) || target[kw][_declared])) {
1538
+ throw this.error(new TomlError("Can't redefine existing key"));
1539
+ }
1540
+ target = target[kw] = target[kw] || Table();
1541
+ }
1542
+ if (hasKey(target, finalKey)) {
1543
+ throw this.error(new TomlError("Can't redefine existing key"));
1544
+ }
1545
+ if (isInteger(kv.value) || isFloat(kv.value)) {
1546
+ target[finalKey] = kv.value.valueOf();
1547
+ } else {
1548
+ target[finalKey] = kv.value;
1549
+ }
1550
+ return this.goto(this.parseInlineTableNext);
1551
+ }
1552
+ parseInlineTableNext() {
1553
+ if (this.char === CHAR_SP || this.char === CTRL_I) {
1554
+ return null;
1555
+ } else if (this.char === Parser.END || this.char === CHAR_NUM || this.char === CTRL_J || this.char === CTRL_M) {
1556
+ throw this.error(new TomlError("Unterminated inline array"));
1557
+ } else if (this.char === CHAR_COMMA) {
1558
+ return this.next(this.parseInlineTable);
1559
+ } else if (this.char === CHAR_RCUB) {
1560
+ return this.goto(this.parseInlineTable);
1561
+ } else {
1562
+ throw this.error(new TomlError("Invalid character, expected whitespace, comma (,) or close bracket (])"));
1563
+ }
1564
+ }
1565
+ }
1566
+ return TOMLParser;
1567
+ }
1568
+ }
1569
+ });
1570
+
1571
+ // node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse-pretty-error.js
1572
+ var require_parse_pretty_error = __commonJS({
1573
+ "node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse-pretty-error.js"(exports2, module2) {
1574
+ "use strict";
1575
+ module2.exports = prettyError;
1576
+ function prettyError(err, buf) {
1577
+ if (err.pos == null || err.line == null) return err;
1578
+ let msg = err.message;
1579
+ msg += ` at row ${err.line + 1}, col ${err.col + 1}, pos ${err.pos}:
1580
+ `;
1581
+ if (buf && buf.split) {
1582
+ const lines = buf.split(/\n/);
1583
+ const lineNumWidth = String(Math.min(lines.length, err.line + 3)).length;
1584
+ let linePadding = " ";
1585
+ while (linePadding.length < lineNumWidth) linePadding += " ";
1586
+ for (let ii = Math.max(0, err.line - 1); ii < Math.min(lines.length, err.line + 2); ++ii) {
1587
+ let lineNum = String(ii + 1);
1588
+ if (lineNum.length < lineNumWidth) lineNum = " " + lineNum;
1589
+ if (err.line === ii) {
1590
+ msg += lineNum + "> " + lines[ii] + "\n";
1591
+ msg += linePadding + " ";
1592
+ for (let hh = 0; hh < err.col; ++hh) {
1593
+ msg += " ";
1594
+ }
1595
+ msg += "^\n";
1596
+ } else {
1597
+ msg += lineNum + ": " + lines[ii] + "\n";
1598
+ }
1599
+ }
1600
+ }
1601
+ err.message = msg + "\n";
1602
+ return err;
1603
+ }
1604
+ }
1605
+ });
1606
+
1607
+ // node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse-string.js
1608
+ var require_parse_string = __commonJS({
1609
+ "node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse-string.js"(exports2, module2) {
1610
+ "use strict";
1611
+ module2.exports = parseString;
1612
+ var TOMLParser = require_toml_parser();
1613
+ var prettyError = require_parse_pretty_error();
1614
+ function parseString(str) {
1615
+ if (global.Buffer && global.Buffer.isBuffer(str)) {
1616
+ str = str.toString("utf8");
1617
+ }
1618
+ const parser = new TOMLParser();
1619
+ try {
1620
+ parser.parse(str);
1621
+ return parser.finish();
1622
+ } catch (err) {
1623
+ throw prettyError(err, str);
1624
+ }
1625
+ }
1626
+ }
1627
+ });
1628
+
1629
+ // node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse-async.js
1630
+ var require_parse_async = __commonJS({
1631
+ "node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse-async.js"(exports2, module2) {
1632
+ "use strict";
1633
+ module2.exports = parseAsync;
1634
+ var TOMLParser = require_toml_parser();
1635
+ var prettyError = require_parse_pretty_error();
1636
+ function parseAsync(str, opts) {
1637
+ if (!opts) opts = {};
1638
+ const index = 0;
1639
+ const blocksize = opts.blocksize || 40960;
1640
+ const parser = new TOMLParser();
1641
+ return new Promise((resolve, reject) => {
1642
+ setImmediate(parseAsyncNext, index, blocksize, resolve, reject);
1643
+ });
1644
+ function parseAsyncNext(index2, blocksize2, resolve, reject) {
1645
+ if (index2 >= str.length) {
1646
+ try {
1647
+ return resolve(parser.finish());
1648
+ } catch (err) {
1649
+ return reject(prettyError(err, str));
1650
+ }
1651
+ }
1652
+ try {
1653
+ parser.parse(str.slice(index2, index2 + blocksize2));
1654
+ setImmediate(parseAsyncNext, index2 + blocksize2, blocksize2, resolve, reject);
1655
+ } catch (err) {
1656
+ reject(prettyError(err, str));
1657
+ }
1658
+ }
1659
+ }
1660
+ }
1661
+ });
1662
+
1663
+ // node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse-stream.js
1664
+ var require_parse_stream = __commonJS({
1665
+ "node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse-stream.js"(exports2, module2) {
1666
+ "use strict";
1667
+ module2.exports = parseStream;
1668
+ var stream = __require("stream");
1669
+ var TOMLParser = require_toml_parser();
1670
+ function parseStream(stm) {
1671
+ if (stm) {
1672
+ return parseReadable(stm);
1673
+ } else {
1674
+ return parseTransform(stm);
1675
+ }
1676
+ }
1677
+ function parseReadable(stm) {
1678
+ const parser = new TOMLParser();
1679
+ stm.setEncoding("utf8");
1680
+ return new Promise((resolve, reject) => {
1681
+ let readable;
1682
+ let ended = false;
1683
+ let errored = false;
1684
+ function finish() {
1685
+ ended = true;
1686
+ if (readable) return;
1687
+ try {
1688
+ resolve(parser.finish());
1689
+ } catch (err) {
1690
+ reject(err);
1691
+ }
1692
+ }
1693
+ function error(err) {
1694
+ errored = true;
1695
+ reject(err);
1696
+ }
1697
+ stm.once("end", finish);
1698
+ stm.once("error", error);
1699
+ readNext();
1700
+ function readNext() {
1701
+ readable = true;
1702
+ let data;
1703
+ while ((data = stm.read()) !== null) {
1704
+ try {
1705
+ parser.parse(data);
1706
+ } catch (err) {
1707
+ return error(err);
1708
+ }
1709
+ }
1710
+ readable = false;
1711
+ if (ended) return finish();
1712
+ if (errored) return;
1713
+ stm.once("readable", readNext);
1714
+ }
1715
+ });
1716
+ }
1717
+ function parseTransform() {
1718
+ const parser = new TOMLParser();
1719
+ return new stream.Transform({
1720
+ objectMode: true,
1721
+ transform(chunk, encoding, cb) {
1722
+ try {
1723
+ parser.parse(chunk.toString(encoding));
1724
+ } catch (err) {
1725
+ this.emit("error", err);
1726
+ }
1727
+ cb();
1728
+ },
1729
+ flush(cb) {
1730
+ try {
1731
+ this.push(parser.finish());
1732
+ } catch (err) {
1733
+ this.emit("error", err);
1734
+ }
1735
+ cb();
1736
+ }
1737
+ });
1738
+ }
1739
+ }
1740
+ });
1741
+
1742
+ // node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse.js
1743
+ var require_parse = __commonJS({
1744
+ "node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse.js"(exports2, module2) {
1745
+ "use strict";
1746
+ module2.exports = require_parse_string();
1747
+ module2.exports.async = require_parse_async();
1748
+ module2.exports.stream = require_parse_stream();
1749
+ module2.exports.prettyError = require_parse_pretty_error();
1750
+ }
1751
+ });
1752
+
1753
+ // node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/stringify.js
1754
+ var require_stringify = __commonJS({
1755
+ "node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/stringify.js"(exports2, module2) {
1756
+ "use strict";
1757
+ module2.exports = stringify;
1758
+ module2.exports.value = stringifyInline;
1759
+ function stringify(obj) {
1760
+ if (obj === null) throw typeError("null");
1761
+ if (obj === void 0) throw typeError("undefined");
1762
+ if (typeof obj !== "object") throw typeError(typeof obj);
1763
+ if (typeof obj.toJSON === "function") obj = obj.toJSON();
1764
+ if (obj == null) return null;
1765
+ const type = tomlType2(obj);
1766
+ if (type !== "table") throw typeError(type);
1767
+ return stringifyObject("", "", obj);
1768
+ }
1769
+ function typeError(type) {
1770
+ return new Error("Can only stringify objects, not " + type);
1771
+ }
1772
+ function arrayOneTypeError() {
1773
+ return new Error("Array values can't have mixed types");
1774
+ }
1775
+ function getInlineKeys(obj) {
1776
+ return Object.keys(obj).filter((key) => isInline(obj[key]));
1777
+ }
1778
+ function getComplexKeys(obj) {
1779
+ return Object.keys(obj).filter((key) => !isInline(obj[key]));
1780
+ }
1781
+ function toJSON(obj) {
1782
+ let nobj = Array.isArray(obj) ? [] : Object.prototype.hasOwnProperty.call(obj, "__proto__") ? { ["__proto__"]: void 0 } : {};
1783
+ for (let prop of Object.keys(obj)) {
1784
+ if (obj[prop] && typeof obj[prop].toJSON === "function" && !("toISOString" in obj[prop])) {
1785
+ nobj[prop] = obj[prop].toJSON();
1786
+ } else {
1787
+ nobj[prop] = obj[prop];
1788
+ }
1789
+ }
1790
+ return nobj;
1791
+ }
1792
+ function stringifyObject(prefix, indent, obj) {
1793
+ obj = toJSON(obj);
1794
+ var inlineKeys;
1795
+ var complexKeys;
1796
+ inlineKeys = getInlineKeys(obj);
1797
+ complexKeys = getComplexKeys(obj);
1798
+ var result = [];
1799
+ var inlineIndent = indent || "";
1800
+ inlineKeys.forEach((key) => {
1801
+ var type = tomlType2(obj[key]);
1802
+ if (type !== "undefined" && type !== "null") {
1803
+ result.push(inlineIndent + stringifyKey(key) + " = " + stringifyAnyInline(obj[key], true));
1804
+ }
1805
+ });
1806
+ if (result.length > 0) result.push("");
1807
+ var complexIndent = prefix && inlineKeys.length > 0 ? indent + " " : "";
1808
+ complexKeys.forEach((key) => {
1809
+ result.push(stringifyComplex(prefix, complexIndent, key, obj[key]));
1810
+ });
1811
+ return result.join("\n");
1812
+ }
1813
+ function isInline(value) {
1814
+ switch (tomlType2(value)) {
1815
+ case "undefined":
1816
+ case "null":
1817
+ case "integer":
1818
+ case "nan":
1819
+ case "float":
1820
+ case "boolean":
1821
+ case "string":
1822
+ case "datetime":
1823
+ return true;
1824
+ case "array":
1825
+ return value.length === 0 || tomlType2(value[0]) !== "table";
1826
+ case "table":
1827
+ return Object.keys(value).length === 0;
1828
+ /* istanbul ignore next */
1829
+ default:
1830
+ return false;
1831
+ }
1832
+ }
1833
+ function tomlType2(value) {
1834
+ if (value === void 0) {
1835
+ return "undefined";
1836
+ } else if (value === null) {
1837
+ return "null";
1838
+ } else if (typeof value === "bigint" || Number.isInteger(value) && !Object.is(value, -0)) {
1839
+ return "integer";
1840
+ } else if (typeof value === "number") {
1841
+ return "float";
1842
+ } else if (typeof value === "boolean") {
1843
+ return "boolean";
1844
+ } else if (typeof value === "string") {
1845
+ return "string";
1846
+ } else if ("toISOString" in value) {
1847
+ return isNaN(value) ? "undefined" : "datetime";
1848
+ } else if (Array.isArray(value)) {
1849
+ return "array";
1850
+ } else {
1851
+ return "table";
1852
+ }
1853
+ }
1854
+ function stringifyKey(key) {
1855
+ var keyStr = String(key);
1856
+ if (/^[-A-Za-z0-9_]+$/.test(keyStr)) {
1857
+ return keyStr;
1858
+ } else {
1859
+ return stringifyBasicString(keyStr);
1860
+ }
1861
+ }
1862
+ function stringifyBasicString(str) {
1863
+ return '"' + escapeString(str).replace(/"/g, '\\"') + '"';
1864
+ }
1865
+ function stringifyLiteralString(str) {
1866
+ return "'" + str + "'";
1867
+ }
1868
+ function numpad(num, str) {
1869
+ while (str.length < num) str = "0" + str;
1870
+ return str;
1871
+ }
1872
+ function escapeString(str) {
1873
+ return str.replace(/\\/g, "\\\\").replace(/[\b]/g, "\\b").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\f/g, "\\f").replace(/\r/g, "\\r").replace(/([\u0000-\u001f\u007f])/, (c) => "\\u" + numpad(4, c.codePointAt(0).toString(16)));
1874
+ }
1875
+ function stringifyMultilineString(str) {
1876
+ let escaped = str.split(/\n/).map((str2) => {
1877
+ return escapeString(str2).replace(/"(?="")/g, '\\"');
1878
+ }).join("\n");
1879
+ if (escaped.slice(-1) === '"') escaped += "\\\n";
1880
+ return '"""\n' + escaped + '"""';
1881
+ }
1882
+ function stringifyAnyInline(value, multilineOk) {
1883
+ let type = tomlType2(value);
1884
+ if (type === "string") {
1885
+ if (multilineOk && /\n/.test(value)) {
1886
+ type = "string-multiline";
1887
+ } else if (!/[\b\t\n\f\r']/.test(value) && /"/.test(value)) {
1888
+ type = "string-literal";
1889
+ }
1890
+ }
1891
+ return stringifyInline(value, type);
1892
+ }
1893
+ function stringifyInline(value, type) {
1894
+ if (!type) type = tomlType2(value);
1895
+ switch (type) {
1896
+ case "string-multiline":
1897
+ return stringifyMultilineString(value);
1898
+ case "string":
1899
+ return stringifyBasicString(value);
1900
+ case "string-literal":
1901
+ return stringifyLiteralString(value);
1902
+ case "integer":
1903
+ return stringifyInteger(value);
1904
+ case "float":
1905
+ return stringifyFloat(value);
1906
+ case "boolean":
1907
+ return stringifyBoolean(value);
1908
+ case "datetime":
1909
+ return stringifyDatetime(value);
1910
+ case "array":
1911
+ return stringifyInlineArray(value.filter((_) => tomlType2(_) !== "null" && tomlType2(_) !== "undefined" && tomlType2(_) !== "nan"));
1912
+ case "table":
1913
+ return stringifyInlineTable(value);
1914
+ /* istanbul ignore next */
1915
+ default:
1916
+ throw typeError(type);
1917
+ }
1918
+ }
1919
+ function stringifyInteger(value) {
1920
+ return String(value).replace(/\B(?=(\d{3})+(?!\d))/g, "_");
1921
+ }
1922
+ function stringifyFloat(value) {
1923
+ if (value === Infinity) {
1924
+ return "inf";
1925
+ } else if (value === -Infinity) {
1926
+ return "-inf";
1927
+ } else if (Object.is(value, NaN)) {
1928
+ return "nan";
1929
+ } else if (Object.is(value, -0)) {
1930
+ return "-0.0";
1931
+ }
1932
+ var chunks = String(value).split(".");
1933
+ var int = chunks[0];
1934
+ var dec = chunks[1] || 0;
1935
+ return stringifyInteger(int) + "." + dec;
1936
+ }
1937
+ function stringifyBoolean(value) {
1938
+ return String(value);
1939
+ }
1940
+ function stringifyDatetime(value) {
1941
+ return value.toISOString();
1942
+ }
1943
+ function isNumber(type) {
1944
+ return type === "float" || type === "integer";
1945
+ }
1946
+ function arrayType(values) {
1947
+ var contentType = tomlType2(values[0]);
1948
+ if (values.every((_) => tomlType2(_) === contentType)) return contentType;
1949
+ if (values.every((_) => isNumber(tomlType2(_)))) return "float";
1950
+ return "mixed";
1951
+ }
1952
+ function validateArray(values) {
1953
+ const type = arrayType(values);
1954
+ if (type === "mixed") {
1955
+ throw arrayOneTypeError();
1956
+ }
1957
+ return type;
1958
+ }
1959
+ function stringifyInlineArray(values) {
1960
+ values = toJSON(values);
1961
+ const type = validateArray(values);
1962
+ var result = "[";
1963
+ var stringified = values.map((_) => stringifyInline(_, type));
1964
+ if (stringified.join(", ").length > 60 || /\n/.test(stringified)) {
1965
+ result += "\n " + stringified.join(",\n ") + "\n";
1966
+ } else {
1967
+ result += " " + stringified.join(", ") + (stringified.length > 0 ? " " : "");
1968
+ }
1969
+ return result + "]";
1970
+ }
1971
+ function stringifyInlineTable(value) {
1972
+ value = toJSON(value);
1973
+ var result = [];
1974
+ Object.keys(value).forEach((key) => {
1975
+ result.push(stringifyKey(key) + " = " + stringifyAnyInline(value[key], false));
1976
+ });
1977
+ return "{ " + result.join(", ") + (result.length > 0 ? " " : "") + "}";
1978
+ }
1979
+ function stringifyComplex(prefix, indent, key, value) {
1980
+ var valueType = tomlType2(value);
1981
+ if (valueType === "array") {
1982
+ return stringifyArrayOfTables(prefix, indent, key, value);
1983
+ } else if (valueType === "table") {
1984
+ return stringifyComplexTable(prefix, indent, key, value);
1985
+ } else {
1986
+ throw typeError(valueType);
1987
+ }
1988
+ }
1989
+ function stringifyArrayOfTables(prefix, indent, key, values) {
1990
+ values = toJSON(values);
1991
+ validateArray(values);
1992
+ var firstValueType = tomlType2(values[0]);
1993
+ if (firstValueType !== "table") throw typeError(firstValueType);
1994
+ var fullKey = prefix + stringifyKey(key);
1995
+ var result = "";
1996
+ values.forEach((table) => {
1997
+ if (result.length > 0) result += "\n";
1998
+ result += indent + "[[" + fullKey + "]]\n";
1999
+ result += stringifyObject(fullKey + ".", indent, table);
2000
+ });
2001
+ return result;
2002
+ }
2003
+ function stringifyComplexTable(prefix, indent, key, value) {
2004
+ var fullKey = prefix + stringifyKey(key);
2005
+ var result = "";
2006
+ if (getInlineKeys(value).length > 0) {
2007
+ result += indent + "[" + fullKey + "]\n";
2008
+ }
2009
+ return result + stringifyObject(fullKey + ".", indent, value);
2010
+ }
2011
+ }
2012
+ });
2013
+
2014
+ // node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/toml.js
2015
+ var require_toml = __commonJS({
2016
+ "node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/toml.js"(exports2) {
2017
+ "use strict";
2018
+ exports2.parse = require_parse();
2019
+ exports2.stringify = require_stringify();
2020
+ }
2021
+ });
2022
+
2023
+ // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/config.js
2024
+ import path6 from "node:path";
2025
+
2026
+ // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/config/read-config.js
2027
+ import fs2 from "node:fs/promises";
2028
+ import path from "node:path";
2029
+
2030
+ // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/config-schema.js
2031
+ var ImportKindSchema = external_exports.enum(["cursor", "claude-code", "claude-desktop", "codex", "windsurf", "opencode", "vscode"]).describe("Supported editor/client configurations to import MCP servers from");
2032
+ var DEFAULT_IMPORTS = [
2033
+ "cursor",
2034
+ "claude-code",
2035
+ "claude-desktop",
2036
+ "codex",
2037
+ "windsurf",
2038
+ "opencode",
2039
+ "vscode"
2040
+ ];
2041
+ var RawLifecycleSchema = external_exports.union([
2042
+ external_exports.literal("keep-alive").describe("Keep the server connection alive"),
2043
+ external_exports.literal("ephemeral").describe("Connect only when needed"),
2044
+ external_exports.object({
2045
+ mode: external_exports.union([external_exports.literal("keep-alive"), external_exports.literal("ephemeral")]).describe("Connection lifecycle mode"),
2046
+ idleTimeoutMs: external_exports.number().int().positive().optional().describe("Idle timeout in milliseconds before disconnecting")
2047
+ })
2048
+ ]).describe("Server connection lifecycle: keep-alive maintains persistent connections, ephemeral connects on-demand");
2049
+ var ToolNamesSchema = external_exports.array(external_exports.string()).describe("Exact MCP tool names");
2050
+ var RawLoggingSchema = external_exports.object({
2051
+ daemon: external_exports.object({
2052
+ enabled: external_exports.boolean().optional().describe("Enable daemon logging for this server")
2053
+ }).optional().describe("Daemon-specific logging configuration")
2054
+ }).optional().describe("Logging configuration for the server");
2055
+ var RawHttpFetchSchema = external_exports.enum(["default", "node-http1"]).describe("HTTP fetch implementation for Streamable HTTP/SSE requests");
2056
+ var RawRefreshSchema = external_exports.object({
2057
+ tokenEndpoint: external_exports.string().optional().describe("OAuth token endpoint used to refresh access tokens"),
2058
+ token_endpoint: external_exports.string().optional().describe("OAuth token endpoint used to refresh access tokens"),
2059
+ clientIdEnv: external_exports.string().optional().describe("Environment variable containing the OAuth client id"),
2060
+ client_id_env: external_exports.string().optional().describe("Environment variable containing the OAuth client id"),
2061
+ clientSecretEnv: external_exports.string().optional().describe("Environment variable containing the OAuth client secret"),
2062
+ client_secret_env: external_exports.string().optional().describe("Environment variable containing the OAuth client secret"),
2063
+ clientAuthMethod: external_exports.string().optional().describe("OAuth token endpoint client auth method"),
2064
+ client_auth_method: external_exports.string().optional().describe("OAuth token endpoint client auth method"),
2065
+ refreshSkewSeconds: external_exports.number().int().nonnegative().optional().describe("Refresh before expiry by this many seconds"),
2066
+ refresh_skew_seconds: external_exports.number().int().nonnegative().optional().describe("Refresh before expiry by this many seconds"),
2067
+ accessTokenEnv: external_exports.string().optional().describe("STDIO env var that receives the refreshed access token"),
2068
+ access_token_env: external_exports.string().optional().describe("STDIO env var that receives the refreshed access token")
2069
+ }).describe("Refreshable bearer token settings");
2070
+ var RawEntrySchema = external_exports.object({
2071
+ description: external_exports.string().optional().describe("Human-readable description of the server"),
2072
+ baseUrl: external_exports.string().optional().describe("Base URL for HTTP/SSE transport (camelCase)"),
2073
+ base_url: external_exports.string().optional().describe("Base URL for HTTP/SSE transport (snake_case)"),
2074
+ url: external_exports.string().optional().describe("Server URL for HTTP/SSE transport"),
2075
+ serverUrl: external_exports.string().optional().describe("Server URL for HTTP/SSE transport (camelCase)"),
2076
+ server_url: external_exports.string().optional().describe("Server URL for HTTP/SSE transport (snake_case)"),
2077
+ command: external_exports.union([external_exports.string(), external_exports.array(external_exports.string())]).optional().describe("Command to spawn for stdio transport (string or array of arguments)"),
2078
+ executable: external_exports.string().optional().describe("Executable path for stdio transport"),
2079
+ args: external_exports.array(external_exports.string()).optional().describe("Arguments to pass to the stdio command"),
2080
+ cwd: external_exports.string().optional().describe("Working directory for stdio servers. A leading ~ is expanded to $HOME; relative paths resolve against the config file directory"),
2081
+ headers: external_exports.record(external_exports.string(), external_exports.string()).optional().describe("HTTP headers for requests. Supports ${VAR}, ${VAR:-fallback}, and $env:VAR placeholders"),
2082
+ env: external_exports.record(external_exports.string(), external_exports.string()).optional().describe("Environment variables for stdio commands. Supports ${VAR} and ${VAR:-fallback} placeholders"),
2083
+ auth: external_exports.string().optional().describe('Authentication method (e.g., "oauth")'),
2084
+ tokenCacheDir: external_exports.string().optional().describe("Directory for caching OAuth tokens (camelCase)"),
2085
+ token_cache_dir: external_exports.string().optional().describe("Directory for caching OAuth tokens (snake_case)"),
2086
+ clientName: external_exports.string().optional().describe("Client identifier for server telemetry (camelCase)"),
2087
+ client_name: external_exports.string().optional().describe("Client identifier for server telemetry (snake_case)"),
2088
+ oauthClientId: external_exports.string().optional().describe("Pre-registered OAuth client id (camelCase)"),
2089
+ oauth_client_id: external_exports.string().optional().describe("Pre-registered OAuth client id (snake_case)"),
2090
+ oauthClientSecret: external_exports.string().optional().describe("Pre-registered OAuth client secret (camelCase)"),
2091
+ oauth_client_secret: external_exports.string().optional().describe("Pre-registered OAuth client secret (snake_case)"),
2092
+ oauthClientSecretEnv: external_exports.string().optional().describe("Environment variable containing the OAuth client secret"),
2093
+ oauth_client_secret_env: external_exports.string().optional().describe("Environment variable containing the OAuth client secret"),
2094
+ oauthTokenEndpointAuthMethod: external_exports.string().optional().describe("OAuth token endpoint auth method, e.g. client_secret_post"),
2095
+ oauth_token_endpoint_auth_method: external_exports.string().optional().describe("OAuth token endpoint auth method, e.g. client_secret_post"),
2096
+ oauthRedirectUrl: external_exports.string().optional().describe("Custom OAuth redirect URL (camelCase)"),
2097
+ oauth_redirect_url: external_exports.string().optional().describe("Custom OAuth redirect URL (snake_case)"),
2098
+ oauthScope: external_exports.string().optional().describe("OAuth scope override (camelCase)"),
2099
+ oauth_scope: external_exports.string().optional().describe("OAuth scope override (snake_case)"),
2100
+ oauthCommand: external_exports.object({
2101
+ args: external_exports.array(external_exports.string()).describe("Arguments for the OAuth command")
2102
+ }).optional().describe("Custom OAuth command configuration for stdio servers (camelCase)"),
2103
+ oauth_command: external_exports.object({
2104
+ args: external_exports.array(external_exports.string()).describe("Arguments for the OAuth command")
2105
+ }).optional().describe("Custom OAuth command configuration for stdio servers (snake_case)"),
2106
+ bearerToken: external_exports.string().optional().describe("Static bearer token for authentication (camelCase)"),
2107
+ bearer_token: external_exports.string().optional().describe("Static bearer token for authentication (snake_case)"),
2108
+ bearerTokenEnv: external_exports.string().optional().describe("Environment variable name containing the bearer token (camelCase)"),
2109
+ bearer_token_env: external_exports.string().optional().describe("Environment variable name containing the bearer token (snake_case)"),
2110
+ refresh: RawRefreshSchema.optional(),
2111
+ httpFetch: RawHttpFetchSchema.optional().describe("HTTP fetch implementation for Streamable HTTP/SSE requests"),
2112
+ http_fetch: RawHttpFetchSchema.optional().describe("HTTP fetch implementation for Streamable HTTP/SSE requests"),
2113
+ lifecycle: RawLifecycleSchema.optional(),
2114
+ logging: RawLoggingSchema,
2115
+ allowedTools: ToolNamesSchema.optional().describe("Only these exact tool names are exposed (camelCase)"),
2116
+ allowed_tools: ToolNamesSchema.optional().describe("Only these exact tool names are exposed (snake_case)"),
2117
+ blockedTools: ToolNamesSchema.optional().describe("These exact tool names are hidden and blocked (camelCase)"),
2118
+ blocked_tools: ToolNamesSchema.optional().describe("These exact tool names are hidden and blocked (snake_case)")
2119
+ }).superRefine((entry, ctx) => {
2120
+ const hasAllowed = entry.allowedTools !== void 0 || entry.allowed_tools !== void 0;
2121
+ const hasBlocked = entry.blockedTools !== void 0 || entry.blocked_tools !== void 0;
2122
+ if (hasAllowed && hasBlocked) {
2123
+ ctx.addIssue({
2124
+ code: "custom",
2125
+ message: "Specify either allowedTools or blockedTools, not both.",
2126
+ path: ["allowedTools"]
2127
+ });
2128
+ }
2129
+ }).describe("MCP server definition supporting both HTTP/SSE and stdio transports");
2130
+ var RawConfigSchema = external_exports.object({
2131
+ mcpServers: external_exports.record(external_exports.string(), RawEntrySchema).describe("Map of server names to their configurations"),
2132
+ daemonIdleTimeoutMs: external_exports.number().int().positive().optional().describe("Idle timeout in milliseconds before shutting down an inactive daemon"),
2133
+ daemon_idle_timeout_ms: external_exports.number().int().positive().optional().describe("Idle timeout in milliseconds before shutting down an inactive daemon"),
2134
+ imports: external_exports.array(ImportKindSchema).optional().describe("Editor configurations to import servers from. Omit to use defaults, or set to [] to disable imports")
2135
+ }).describe("mcporter configuration file schema");
2136
+
2137
+ // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/config/imports/shared.js
2138
+ import fs from "node:fs/promises";
2139
+
2140
+ // node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/scanner.js
2141
+ function createScanner(text, ignoreTrivia = false) {
2142
+ const len = text.length;
2143
+ let pos = 0, value = "", tokenOffset = 0, token = 16, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0;
2144
+ function scanHexDigits(count, exact) {
2145
+ let digits = 0;
2146
+ let value2 = 0;
2147
+ while (digits < count || !exact) {
2148
+ let ch = text.charCodeAt(pos);
2149
+ if (ch >= 48 && ch <= 57) {
2150
+ value2 = value2 * 16 + ch - 48;
2151
+ } else if (ch >= 65 && ch <= 70) {
2152
+ value2 = value2 * 16 + ch - 65 + 10;
2153
+ } else if (ch >= 97 && ch <= 102) {
2154
+ value2 = value2 * 16 + ch - 97 + 10;
2155
+ } else {
2156
+ break;
2157
+ }
2158
+ pos++;
2159
+ digits++;
2160
+ }
2161
+ if (digits < count) {
2162
+ value2 = -1;
2163
+ }
2164
+ return value2;
2165
+ }
2166
+ function setPosition(newPosition) {
2167
+ pos = newPosition;
2168
+ value = "";
2169
+ tokenOffset = 0;
2170
+ token = 16;
2171
+ scanError = 0;
2172
+ }
2173
+ function scanNumber() {
2174
+ let start = pos;
2175
+ if (text.charCodeAt(pos) === 48) {
2176
+ pos++;
2177
+ } else {
2178
+ pos++;
2179
+ while (pos < text.length && isDigit2(text.charCodeAt(pos))) {
2180
+ pos++;
2181
+ }
2182
+ }
2183
+ if (pos < text.length && text.charCodeAt(pos) === 46) {
2184
+ pos++;
2185
+ if (pos < text.length && isDigit2(text.charCodeAt(pos))) {
2186
+ pos++;
2187
+ while (pos < text.length && isDigit2(text.charCodeAt(pos))) {
2188
+ pos++;
2189
+ }
2190
+ } else {
2191
+ scanError = 3;
2192
+ return text.substring(start, pos);
2193
+ }
2194
+ }
2195
+ let end = pos;
2196
+ if (pos < text.length && (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101)) {
2197
+ pos++;
2198
+ if (pos < text.length && text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45) {
2199
+ pos++;
2200
+ }
2201
+ if (pos < text.length && isDigit2(text.charCodeAt(pos))) {
2202
+ pos++;
2203
+ while (pos < text.length && isDigit2(text.charCodeAt(pos))) {
2204
+ pos++;
2205
+ }
2206
+ end = pos;
2207
+ } else {
2208
+ scanError = 3;
2209
+ }
2210
+ }
2211
+ return text.substring(start, end);
2212
+ }
2213
+ function scanString() {
2214
+ let result = "", start = pos;
2215
+ while (true) {
2216
+ if (pos >= len) {
2217
+ result += text.substring(start, pos);
2218
+ scanError = 2;
2219
+ break;
2220
+ }
2221
+ const ch = text.charCodeAt(pos);
2222
+ if (ch === 34) {
2223
+ result += text.substring(start, pos);
2224
+ pos++;
2225
+ break;
2226
+ }
2227
+ if (ch === 92) {
2228
+ result += text.substring(start, pos);
2229
+ pos++;
2230
+ if (pos >= len) {
2231
+ scanError = 2;
2232
+ break;
2233
+ }
2234
+ const ch2 = text.charCodeAt(pos++);
2235
+ switch (ch2) {
2236
+ case 34:
2237
+ result += '"';
2238
+ break;
2239
+ case 92:
2240
+ result += "\\";
2241
+ break;
2242
+ case 47:
2243
+ result += "/";
2244
+ break;
2245
+ case 98:
2246
+ result += "\b";
2247
+ break;
2248
+ case 102:
2249
+ result += "\f";
2250
+ break;
2251
+ case 110:
2252
+ result += "\n";
2253
+ break;
2254
+ case 114:
2255
+ result += "\r";
2256
+ break;
2257
+ case 116:
2258
+ result += " ";
2259
+ break;
2260
+ case 117:
2261
+ const ch3 = scanHexDigits(4, true);
2262
+ if (ch3 >= 0) {
2263
+ result += String.fromCharCode(ch3);
2264
+ } else {
2265
+ scanError = 4;
2266
+ }
2267
+ break;
2268
+ default:
2269
+ scanError = 5;
2270
+ }
2271
+ start = pos;
2272
+ continue;
2273
+ }
2274
+ if (ch >= 0 && ch <= 31) {
2275
+ if (isLineBreak(ch)) {
2276
+ result += text.substring(start, pos);
2277
+ scanError = 2;
2278
+ break;
2279
+ } else {
2280
+ scanError = 6;
2281
+ }
2282
+ }
2283
+ pos++;
2284
+ }
2285
+ return result;
2286
+ }
2287
+ function scanNext() {
2288
+ value = "";
2289
+ scanError = 0;
2290
+ tokenOffset = pos;
2291
+ lineStartOffset = lineNumber;
2292
+ prevTokenLineStartOffset = tokenLineStartOffset;
2293
+ if (pos >= len) {
2294
+ tokenOffset = len;
2295
+ return token = 17;
2296
+ }
2297
+ let code = text.charCodeAt(pos);
2298
+ if (isWhiteSpace(code)) {
2299
+ do {
2300
+ pos++;
2301
+ value += String.fromCharCode(code);
2302
+ code = text.charCodeAt(pos);
2303
+ } while (isWhiteSpace(code));
2304
+ return token = 15;
2305
+ }
2306
+ if (isLineBreak(code)) {
2307
+ pos++;
2308
+ value += String.fromCharCode(code);
2309
+ if (code === 13 && text.charCodeAt(pos) === 10) {
2310
+ pos++;
2311
+ value += "\n";
2312
+ }
2313
+ lineNumber++;
2314
+ tokenLineStartOffset = pos;
2315
+ return token = 14;
2316
+ }
2317
+ switch (code) {
2318
+ // tokens: []{}:,
2319
+ case 123:
2320
+ pos++;
2321
+ return token = 1;
2322
+ case 125:
2323
+ pos++;
2324
+ return token = 2;
2325
+ case 91:
2326
+ pos++;
2327
+ return token = 3;
2328
+ case 93:
2329
+ pos++;
2330
+ return token = 4;
2331
+ case 58:
2332
+ pos++;
2333
+ return token = 6;
2334
+ case 44:
2335
+ pos++;
2336
+ return token = 5;
2337
+ // strings
2338
+ case 34:
2339
+ pos++;
2340
+ value = scanString();
2341
+ return token = 10;
2342
+ // comments
2343
+ case 47:
2344
+ const start = pos - 1;
2345
+ if (text.charCodeAt(pos + 1) === 47) {
2346
+ pos += 2;
2347
+ while (pos < len) {
2348
+ if (isLineBreak(text.charCodeAt(pos))) {
2349
+ break;
2350
+ }
2351
+ pos++;
2352
+ }
2353
+ value = text.substring(start, pos);
2354
+ return token = 12;
2355
+ }
2356
+ if (text.charCodeAt(pos + 1) === 42) {
2357
+ pos += 2;
2358
+ const safeLength = len - 1;
2359
+ let commentClosed = false;
2360
+ while (pos < safeLength) {
2361
+ const ch = text.charCodeAt(pos);
2362
+ if (ch === 42 && text.charCodeAt(pos + 1) === 47) {
2363
+ pos += 2;
2364
+ commentClosed = true;
2365
+ break;
2366
+ }
2367
+ pos++;
2368
+ if (isLineBreak(ch)) {
2369
+ if (ch === 13 && text.charCodeAt(pos) === 10) {
2370
+ pos++;
2371
+ }
2372
+ lineNumber++;
2373
+ tokenLineStartOffset = pos;
2374
+ }
2375
+ }
2376
+ if (!commentClosed) {
2377
+ pos++;
2378
+ scanError = 1;
2379
+ }
2380
+ value = text.substring(start, pos);
2381
+ return token = 13;
2382
+ }
2383
+ value += String.fromCharCode(code);
2384
+ pos++;
2385
+ return token = 16;
2386
+ // numbers
2387
+ case 45:
2388
+ value += String.fromCharCode(code);
2389
+ pos++;
2390
+ if (pos === len || !isDigit2(text.charCodeAt(pos))) {
2391
+ return token = 16;
2392
+ }
2393
+ // found a minus, followed by a number so
2394
+ // we fall through to proceed with scanning
2395
+ // numbers
2396
+ case 48:
2397
+ case 49:
2398
+ case 50:
2399
+ case 51:
2400
+ case 52:
2401
+ case 53:
2402
+ case 54:
2403
+ case 55:
2404
+ case 56:
2405
+ case 57:
2406
+ value += scanNumber();
2407
+ return token = 11;
2408
+ // literals and unknown symbols
2409
+ default:
2410
+ while (pos < len && isUnknownContentCharacter(code)) {
2411
+ pos++;
2412
+ code = text.charCodeAt(pos);
2413
+ }
2414
+ if (tokenOffset !== pos) {
2415
+ value = text.substring(tokenOffset, pos);
2416
+ switch (value) {
2417
+ case "true":
2418
+ return token = 8;
2419
+ case "false":
2420
+ return token = 9;
2421
+ case "null":
2422
+ return token = 7;
2423
+ }
2424
+ return token = 16;
2425
+ }
2426
+ value += String.fromCharCode(code);
2427
+ pos++;
2428
+ return token = 16;
2429
+ }
2430
+ }
2431
+ function isUnknownContentCharacter(code) {
2432
+ if (isWhiteSpace(code) || isLineBreak(code)) {
2433
+ return false;
2434
+ }
2435
+ switch (code) {
2436
+ case 125:
2437
+ case 93:
2438
+ case 123:
2439
+ case 91:
2440
+ case 34:
2441
+ case 58:
2442
+ case 44:
2443
+ case 47:
2444
+ return false;
2445
+ }
2446
+ return true;
2447
+ }
2448
+ function scanNextNonTrivia() {
2449
+ let result;
2450
+ do {
2451
+ result = scanNext();
2452
+ } while (result >= 12 && result <= 15);
2453
+ return result;
2454
+ }
2455
+ return {
2456
+ setPosition,
2457
+ getPosition: () => pos,
2458
+ scan: ignoreTrivia ? scanNextNonTrivia : scanNext,
2459
+ getToken: () => token,
2460
+ getTokenValue: () => value,
2461
+ getTokenOffset: () => tokenOffset,
2462
+ getTokenLength: () => pos - tokenOffset,
2463
+ getTokenStartLine: () => lineStartOffset,
2464
+ getTokenStartCharacter: () => tokenOffset - prevTokenLineStartOffset,
2465
+ getTokenError: () => scanError
2466
+ };
2467
+ }
2468
+ function isWhiteSpace(ch) {
2469
+ return ch === 32 || ch === 9;
2470
+ }
2471
+ function isLineBreak(ch) {
2472
+ return ch === 10 || ch === 13;
2473
+ }
2474
+ function isDigit2(ch) {
2475
+ return ch >= 48 && ch <= 57;
2476
+ }
2477
+ var CharacterCodes;
2478
+ (function(CharacterCodes2) {
2479
+ CharacterCodes2[CharacterCodes2["lineFeed"] = 10] = "lineFeed";
2480
+ CharacterCodes2[CharacterCodes2["carriageReturn"] = 13] = "carriageReturn";
2481
+ CharacterCodes2[CharacterCodes2["space"] = 32] = "space";
2482
+ CharacterCodes2[CharacterCodes2["_0"] = 48] = "_0";
2483
+ CharacterCodes2[CharacterCodes2["_1"] = 49] = "_1";
2484
+ CharacterCodes2[CharacterCodes2["_2"] = 50] = "_2";
2485
+ CharacterCodes2[CharacterCodes2["_3"] = 51] = "_3";
2486
+ CharacterCodes2[CharacterCodes2["_4"] = 52] = "_4";
2487
+ CharacterCodes2[CharacterCodes2["_5"] = 53] = "_5";
2488
+ CharacterCodes2[CharacterCodes2["_6"] = 54] = "_6";
2489
+ CharacterCodes2[CharacterCodes2["_7"] = 55] = "_7";
2490
+ CharacterCodes2[CharacterCodes2["_8"] = 56] = "_8";
2491
+ CharacterCodes2[CharacterCodes2["_9"] = 57] = "_9";
2492
+ CharacterCodes2[CharacterCodes2["a"] = 97] = "a";
2493
+ CharacterCodes2[CharacterCodes2["b"] = 98] = "b";
2494
+ CharacterCodes2[CharacterCodes2["c"] = 99] = "c";
2495
+ CharacterCodes2[CharacterCodes2["d"] = 100] = "d";
2496
+ CharacterCodes2[CharacterCodes2["e"] = 101] = "e";
2497
+ CharacterCodes2[CharacterCodes2["f"] = 102] = "f";
2498
+ CharacterCodes2[CharacterCodes2["g"] = 103] = "g";
2499
+ CharacterCodes2[CharacterCodes2["h"] = 104] = "h";
2500
+ CharacterCodes2[CharacterCodes2["i"] = 105] = "i";
2501
+ CharacterCodes2[CharacterCodes2["j"] = 106] = "j";
2502
+ CharacterCodes2[CharacterCodes2["k"] = 107] = "k";
2503
+ CharacterCodes2[CharacterCodes2["l"] = 108] = "l";
2504
+ CharacterCodes2[CharacterCodes2["m"] = 109] = "m";
2505
+ CharacterCodes2[CharacterCodes2["n"] = 110] = "n";
2506
+ CharacterCodes2[CharacterCodes2["o"] = 111] = "o";
2507
+ CharacterCodes2[CharacterCodes2["p"] = 112] = "p";
2508
+ CharacterCodes2[CharacterCodes2["q"] = 113] = "q";
2509
+ CharacterCodes2[CharacterCodes2["r"] = 114] = "r";
2510
+ CharacterCodes2[CharacterCodes2["s"] = 115] = "s";
2511
+ CharacterCodes2[CharacterCodes2["t"] = 116] = "t";
2512
+ CharacterCodes2[CharacterCodes2["u"] = 117] = "u";
2513
+ CharacterCodes2[CharacterCodes2["v"] = 118] = "v";
2514
+ CharacterCodes2[CharacterCodes2["w"] = 119] = "w";
2515
+ CharacterCodes2[CharacterCodes2["x"] = 120] = "x";
2516
+ CharacterCodes2[CharacterCodes2["y"] = 121] = "y";
2517
+ CharacterCodes2[CharacterCodes2["z"] = 122] = "z";
2518
+ CharacterCodes2[CharacterCodes2["A"] = 65] = "A";
2519
+ CharacterCodes2[CharacterCodes2["B"] = 66] = "B";
2520
+ CharacterCodes2[CharacterCodes2["C"] = 67] = "C";
2521
+ CharacterCodes2[CharacterCodes2["D"] = 68] = "D";
2522
+ CharacterCodes2[CharacterCodes2["E"] = 69] = "E";
2523
+ CharacterCodes2[CharacterCodes2["F"] = 70] = "F";
2524
+ CharacterCodes2[CharacterCodes2["G"] = 71] = "G";
2525
+ CharacterCodes2[CharacterCodes2["H"] = 72] = "H";
2526
+ CharacterCodes2[CharacterCodes2["I"] = 73] = "I";
2527
+ CharacterCodes2[CharacterCodes2["J"] = 74] = "J";
2528
+ CharacterCodes2[CharacterCodes2["K"] = 75] = "K";
2529
+ CharacterCodes2[CharacterCodes2["L"] = 76] = "L";
2530
+ CharacterCodes2[CharacterCodes2["M"] = 77] = "M";
2531
+ CharacterCodes2[CharacterCodes2["N"] = 78] = "N";
2532
+ CharacterCodes2[CharacterCodes2["O"] = 79] = "O";
2533
+ CharacterCodes2[CharacterCodes2["P"] = 80] = "P";
2534
+ CharacterCodes2[CharacterCodes2["Q"] = 81] = "Q";
2535
+ CharacterCodes2[CharacterCodes2["R"] = 82] = "R";
2536
+ CharacterCodes2[CharacterCodes2["S"] = 83] = "S";
2537
+ CharacterCodes2[CharacterCodes2["T"] = 84] = "T";
2538
+ CharacterCodes2[CharacterCodes2["U"] = 85] = "U";
2539
+ CharacterCodes2[CharacterCodes2["V"] = 86] = "V";
2540
+ CharacterCodes2[CharacterCodes2["W"] = 87] = "W";
2541
+ CharacterCodes2[CharacterCodes2["X"] = 88] = "X";
2542
+ CharacterCodes2[CharacterCodes2["Y"] = 89] = "Y";
2543
+ CharacterCodes2[CharacterCodes2["Z"] = 90] = "Z";
2544
+ CharacterCodes2[CharacterCodes2["asterisk"] = 42] = "asterisk";
2545
+ CharacterCodes2[CharacterCodes2["backslash"] = 92] = "backslash";
2546
+ CharacterCodes2[CharacterCodes2["closeBrace"] = 125] = "closeBrace";
2547
+ CharacterCodes2[CharacterCodes2["closeBracket"] = 93] = "closeBracket";
2548
+ CharacterCodes2[CharacterCodes2["colon"] = 58] = "colon";
2549
+ CharacterCodes2[CharacterCodes2["comma"] = 44] = "comma";
2550
+ CharacterCodes2[CharacterCodes2["dot"] = 46] = "dot";
2551
+ CharacterCodes2[CharacterCodes2["doubleQuote"] = 34] = "doubleQuote";
2552
+ CharacterCodes2[CharacterCodes2["minus"] = 45] = "minus";
2553
+ CharacterCodes2[CharacterCodes2["openBrace"] = 123] = "openBrace";
2554
+ CharacterCodes2[CharacterCodes2["openBracket"] = 91] = "openBracket";
2555
+ CharacterCodes2[CharacterCodes2["plus"] = 43] = "plus";
2556
+ CharacterCodes2[CharacterCodes2["slash"] = 47] = "slash";
2557
+ CharacterCodes2[CharacterCodes2["formFeed"] = 12] = "formFeed";
2558
+ CharacterCodes2[CharacterCodes2["tab"] = 9] = "tab";
2559
+ })(CharacterCodes || (CharacterCodes = {}));
2560
+
2561
+ // node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/string-intern.js
2562
+ var cachedSpaces = new Array(20).fill(0).map((_, index) => {
2563
+ return " ".repeat(index);
2564
+ });
2565
+ var maxCachedValues = 200;
2566
+ var cachedBreakLinesWithSpaces = {
2567
+ " ": {
2568
+ "\n": new Array(maxCachedValues).fill(0).map((_, index) => {
2569
+ return "\n" + " ".repeat(index);
2570
+ }),
2571
+ "\r": new Array(maxCachedValues).fill(0).map((_, index) => {
2572
+ return "\r" + " ".repeat(index);
2573
+ }),
2574
+ "\r\n": new Array(maxCachedValues).fill(0).map((_, index) => {
2575
+ return "\r\n" + " ".repeat(index);
2576
+ })
2577
+ },
2578
+ " ": {
2579
+ "\n": new Array(maxCachedValues).fill(0).map((_, index) => {
2580
+ return "\n" + " ".repeat(index);
2581
+ }),
2582
+ "\r": new Array(maxCachedValues).fill(0).map((_, index) => {
2583
+ return "\r" + " ".repeat(index);
2584
+ }),
2585
+ "\r\n": new Array(maxCachedValues).fill(0).map((_, index) => {
2586
+ return "\r\n" + " ".repeat(index);
2587
+ })
2588
+ }
2589
+ };
2590
+
2591
+ // node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/parser.js
2592
+ var ParseOptions;
2593
+ (function(ParseOptions2) {
2594
+ ParseOptions2.DEFAULT = {
2595
+ allowTrailingComma: false
2596
+ };
2597
+ })(ParseOptions || (ParseOptions = {}));
2598
+ function parse(text, errors = [], options = ParseOptions.DEFAULT) {
2599
+ let currentProperty = null;
2600
+ let currentParent = [];
2601
+ const previousParents = [];
2602
+ function onValue(value) {
2603
+ if (Array.isArray(currentParent)) {
2604
+ currentParent.push(value);
2605
+ } else if (currentProperty !== null) {
2606
+ currentParent[currentProperty] = value;
2607
+ }
2608
+ }
2609
+ const visitor = {
2610
+ onObjectBegin: () => {
2611
+ const object = {};
2612
+ onValue(object);
2613
+ previousParents.push(currentParent);
2614
+ currentParent = object;
2615
+ currentProperty = null;
2616
+ },
2617
+ onObjectProperty: (name) => {
2618
+ currentProperty = name;
2619
+ },
2620
+ onObjectEnd: () => {
2621
+ currentParent = previousParents.pop();
2622
+ },
2623
+ onArrayBegin: () => {
2624
+ const array = [];
2625
+ onValue(array);
2626
+ previousParents.push(currentParent);
2627
+ currentParent = array;
2628
+ currentProperty = null;
2629
+ },
2630
+ onArrayEnd: () => {
2631
+ currentParent = previousParents.pop();
2632
+ },
2633
+ onLiteralValue: onValue,
2634
+ onError: (error, offset, length) => {
2635
+ errors.push({ error, offset, length });
2636
+ }
2637
+ };
2638
+ visit(text, visitor, options);
2639
+ return currentParent[0];
2640
+ }
2641
+ function visit(text, visitor, options = ParseOptions.DEFAULT) {
2642
+ const _scanner = createScanner(text, false);
2643
+ const _jsonPath = [];
2644
+ let suppressedCallbacks = 0;
2645
+ function toNoArgVisit(visitFunction) {
2646
+ return visitFunction ? () => suppressedCallbacks === 0 && visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
2647
+ }
2648
+ function toOneArgVisit(visitFunction) {
2649
+ return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
2650
+ }
2651
+ function toOneArgVisitWithPath(visitFunction) {
2652
+ return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice()) : () => true;
2653
+ }
2654
+ function toBeginVisit(visitFunction) {
2655
+ return visitFunction ? () => {
2656
+ if (suppressedCallbacks > 0) {
2657
+ suppressedCallbacks++;
2658
+ } else {
2659
+ let cbReturn = visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice());
2660
+ if (cbReturn === false) {
2661
+ suppressedCallbacks = 1;
2662
+ }
2663
+ }
2664
+ } : () => true;
2665
+ }
2666
+ function toEndVisit(visitFunction) {
2667
+ return visitFunction ? () => {
2668
+ if (suppressedCallbacks > 0) {
2669
+ suppressedCallbacks--;
2670
+ }
2671
+ if (suppressedCallbacks === 0) {
2672
+ visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter());
2673
+ }
2674
+ } : () => true;
2675
+ }
2676
+ const onObjectBegin = toBeginVisit(visitor.onObjectBegin), onObjectProperty = toOneArgVisitWithPath(visitor.onObjectProperty), onObjectEnd = toEndVisit(visitor.onObjectEnd), onArrayBegin = toBeginVisit(visitor.onArrayBegin), onArrayEnd = toEndVisit(visitor.onArrayEnd), onLiteralValue = toOneArgVisitWithPath(visitor.onLiteralValue), onSeparator = toOneArgVisit(visitor.onSeparator), onComment = toNoArgVisit(visitor.onComment), onError = toOneArgVisit(visitor.onError);
2677
+ const disallowComments = options && options.disallowComments;
2678
+ const allowTrailingComma = options && options.allowTrailingComma;
2679
+ function scanNext() {
2680
+ while (true) {
2681
+ const token = _scanner.scan();
2682
+ switch (_scanner.getTokenError()) {
2683
+ case 4:
2684
+ handleError(
2685
+ 14
2686
+ /* ParseErrorCode.InvalidUnicode */
2687
+ );
2688
+ break;
2689
+ case 5:
2690
+ handleError(
2691
+ 15
2692
+ /* ParseErrorCode.InvalidEscapeCharacter */
2693
+ );
2694
+ break;
2695
+ case 3:
2696
+ handleError(
2697
+ 13
2698
+ /* ParseErrorCode.UnexpectedEndOfNumber */
2699
+ );
2700
+ break;
2701
+ case 1:
2702
+ if (!disallowComments) {
2703
+ handleError(
2704
+ 11
2705
+ /* ParseErrorCode.UnexpectedEndOfComment */
2706
+ );
2707
+ }
2708
+ break;
2709
+ case 2:
2710
+ handleError(
2711
+ 12
2712
+ /* ParseErrorCode.UnexpectedEndOfString */
2713
+ );
2714
+ break;
2715
+ case 6:
2716
+ handleError(
2717
+ 16
2718
+ /* ParseErrorCode.InvalidCharacter */
2719
+ );
2720
+ break;
2721
+ }
2722
+ switch (token) {
2723
+ case 12:
2724
+ case 13:
2725
+ if (disallowComments) {
2726
+ handleError(
2727
+ 10
2728
+ /* ParseErrorCode.InvalidCommentToken */
2729
+ );
2730
+ } else {
2731
+ onComment();
2732
+ }
2733
+ break;
2734
+ case 16:
2735
+ handleError(
2736
+ 1
2737
+ /* ParseErrorCode.InvalidSymbol */
2738
+ );
2739
+ break;
2740
+ case 15:
2741
+ case 14:
2742
+ break;
2743
+ default:
2744
+ return token;
2745
+ }
2746
+ }
2747
+ }
2748
+ function handleError(error, skipUntilAfter = [], skipUntil = []) {
2749
+ onError(error);
2750
+ if (skipUntilAfter.length + skipUntil.length > 0) {
2751
+ let token = _scanner.getToken();
2752
+ while (token !== 17) {
2753
+ if (skipUntilAfter.indexOf(token) !== -1) {
2754
+ scanNext();
2755
+ break;
2756
+ } else if (skipUntil.indexOf(token) !== -1) {
2757
+ break;
2758
+ }
2759
+ token = scanNext();
2760
+ }
2761
+ }
2762
+ }
2763
+ function parseString(isValue) {
2764
+ const value = _scanner.getTokenValue();
2765
+ if (isValue) {
2766
+ onLiteralValue(value);
2767
+ } else {
2768
+ onObjectProperty(value);
2769
+ _jsonPath.push(value);
2770
+ }
2771
+ scanNext();
2772
+ return true;
2773
+ }
2774
+ function parseLiteral() {
2775
+ switch (_scanner.getToken()) {
2776
+ case 11:
2777
+ const tokenValue = _scanner.getTokenValue();
2778
+ let value = Number(tokenValue);
2779
+ if (isNaN(value)) {
2780
+ handleError(
2781
+ 2
2782
+ /* ParseErrorCode.InvalidNumberFormat */
2783
+ );
2784
+ value = 0;
2785
+ }
2786
+ onLiteralValue(value);
2787
+ break;
2788
+ case 7:
2789
+ onLiteralValue(null);
2790
+ break;
2791
+ case 8:
2792
+ onLiteralValue(true);
2793
+ break;
2794
+ case 9:
2795
+ onLiteralValue(false);
2796
+ break;
2797
+ default:
2798
+ return false;
2799
+ }
2800
+ scanNext();
2801
+ return true;
2802
+ }
2803
+ function parseProperty() {
2804
+ if (_scanner.getToken() !== 10) {
2805
+ handleError(3, [], [
2806
+ 2,
2807
+ 5
2808
+ /* SyntaxKind.CommaToken */
2809
+ ]);
2810
+ return false;
2811
+ }
2812
+ parseString(false);
2813
+ if (_scanner.getToken() === 6) {
2814
+ onSeparator(":");
2815
+ scanNext();
2816
+ if (!parseValue()) {
2817
+ handleError(4, [], [
2818
+ 2,
2819
+ 5
2820
+ /* SyntaxKind.CommaToken */
2821
+ ]);
2822
+ }
2823
+ } else {
2824
+ handleError(5, [], [
2825
+ 2,
2826
+ 5
2827
+ /* SyntaxKind.CommaToken */
2828
+ ]);
2829
+ }
2830
+ _jsonPath.pop();
2831
+ return true;
2832
+ }
2833
+ function parseObject() {
2834
+ onObjectBegin();
2835
+ scanNext();
2836
+ let needsComma = false;
2837
+ while (_scanner.getToken() !== 2 && _scanner.getToken() !== 17) {
2838
+ if (_scanner.getToken() === 5) {
2839
+ if (!needsComma) {
2840
+ handleError(4, [], []);
2841
+ }
2842
+ onSeparator(",");
2843
+ scanNext();
2844
+ if (_scanner.getToken() === 2 && allowTrailingComma) {
2845
+ break;
2846
+ }
2847
+ } else if (needsComma) {
2848
+ handleError(6, [], []);
2849
+ }
2850
+ if (!parseProperty()) {
2851
+ handleError(4, [], [
2852
+ 2,
2853
+ 5
2854
+ /* SyntaxKind.CommaToken */
2855
+ ]);
2856
+ }
2857
+ needsComma = true;
2858
+ }
2859
+ onObjectEnd();
2860
+ if (_scanner.getToken() !== 2) {
2861
+ handleError(7, [
2862
+ 2
2863
+ /* SyntaxKind.CloseBraceToken */
2864
+ ], []);
2865
+ } else {
2866
+ scanNext();
2867
+ }
2868
+ return true;
2869
+ }
2870
+ function parseArray() {
2871
+ onArrayBegin();
2872
+ scanNext();
2873
+ let isFirstElement = true;
2874
+ let needsComma = false;
2875
+ while (_scanner.getToken() !== 4 && _scanner.getToken() !== 17) {
2876
+ if (_scanner.getToken() === 5) {
2877
+ if (!needsComma) {
2878
+ handleError(4, [], []);
2879
+ }
2880
+ onSeparator(",");
2881
+ scanNext();
2882
+ if (_scanner.getToken() === 4 && allowTrailingComma) {
2883
+ break;
2884
+ }
2885
+ } else if (needsComma) {
2886
+ handleError(6, [], []);
2887
+ }
2888
+ if (isFirstElement) {
2889
+ _jsonPath.push(0);
2890
+ isFirstElement = false;
2891
+ } else {
2892
+ _jsonPath[_jsonPath.length - 1]++;
2893
+ }
2894
+ if (!parseValue()) {
2895
+ handleError(4, [], [
2896
+ 4,
2897
+ 5
2898
+ /* SyntaxKind.CommaToken */
2899
+ ]);
2900
+ }
2901
+ needsComma = true;
2902
+ }
2903
+ onArrayEnd();
2904
+ if (!isFirstElement) {
2905
+ _jsonPath.pop();
2906
+ }
2907
+ if (_scanner.getToken() !== 4) {
2908
+ handleError(8, [
2909
+ 4
2910
+ /* SyntaxKind.CloseBracketToken */
2911
+ ], []);
2912
+ } else {
2913
+ scanNext();
2914
+ }
2915
+ return true;
2916
+ }
2917
+ function parseValue() {
2918
+ switch (_scanner.getToken()) {
2919
+ case 3:
2920
+ return parseArray();
2921
+ case 1:
2922
+ return parseObject();
2923
+ case 10:
2924
+ return parseString(true);
2925
+ default:
2926
+ return parseLiteral();
2927
+ }
2928
+ }
2929
+ scanNext();
2930
+ if (_scanner.getToken() === 17) {
2931
+ if (options.allowEmptyContent) {
2932
+ return true;
2933
+ }
2934
+ handleError(4, [], []);
2935
+ return false;
2936
+ }
2937
+ if (!parseValue()) {
2938
+ handleError(4, [], []);
2939
+ return false;
2940
+ }
2941
+ if (_scanner.getToken() !== 17) {
2942
+ handleError(9, [], []);
2943
+ }
2944
+ return true;
2945
+ }
2946
+
2947
+ // node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/main.js
2948
+ var ScanError;
2949
+ (function(ScanError2) {
2950
+ ScanError2[ScanError2["None"] = 0] = "None";
2951
+ ScanError2[ScanError2["UnexpectedEndOfComment"] = 1] = "UnexpectedEndOfComment";
2952
+ ScanError2[ScanError2["UnexpectedEndOfString"] = 2] = "UnexpectedEndOfString";
2953
+ ScanError2[ScanError2["UnexpectedEndOfNumber"] = 3] = "UnexpectedEndOfNumber";
2954
+ ScanError2[ScanError2["InvalidUnicode"] = 4] = "InvalidUnicode";
2955
+ ScanError2[ScanError2["InvalidEscapeCharacter"] = 5] = "InvalidEscapeCharacter";
2956
+ ScanError2[ScanError2["InvalidCharacter"] = 6] = "InvalidCharacter";
2957
+ })(ScanError || (ScanError = {}));
2958
+ var SyntaxKind;
2959
+ (function(SyntaxKind2) {
2960
+ SyntaxKind2[SyntaxKind2["OpenBraceToken"] = 1] = "OpenBraceToken";
2961
+ SyntaxKind2[SyntaxKind2["CloseBraceToken"] = 2] = "CloseBraceToken";
2962
+ SyntaxKind2[SyntaxKind2["OpenBracketToken"] = 3] = "OpenBracketToken";
2963
+ SyntaxKind2[SyntaxKind2["CloseBracketToken"] = 4] = "CloseBracketToken";
2964
+ SyntaxKind2[SyntaxKind2["CommaToken"] = 5] = "CommaToken";
2965
+ SyntaxKind2[SyntaxKind2["ColonToken"] = 6] = "ColonToken";
2966
+ SyntaxKind2[SyntaxKind2["NullKeyword"] = 7] = "NullKeyword";
2967
+ SyntaxKind2[SyntaxKind2["TrueKeyword"] = 8] = "TrueKeyword";
2968
+ SyntaxKind2[SyntaxKind2["FalseKeyword"] = 9] = "FalseKeyword";
2969
+ SyntaxKind2[SyntaxKind2["StringLiteral"] = 10] = "StringLiteral";
2970
+ SyntaxKind2[SyntaxKind2["NumericLiteral"] = 11] = "NumericLiteral";
2971
+ SyntaxKind2[SyntaxKind2["LineCommentTrivia"] = 12] = "LineCommentTrivia";
2972
+ SyntaxKind2[SyntaxKind2["BlockCommentTrivia"] = 13] = "BlockCommentTrivia";
2973
+ SyntaxKind2[SyntaxKind2["LineBreakTrivia"] = 14] = "LineBreakTrivia";
2974
+ SyntaxKind2[SyntaxKind2["Trivia"] = 15] = "Trivia";
2975
+ SyntaxKind2[SyntaxKind2["Unknown"] = 16] = "Unknown";
2976
+ SyntaxKind2[SyntaxKind2["EOF"] = 17] = "EOF";
2977
+ })(SyntaxKind || (SyntaxKind = {}));
2978
+ var parse2 = parse;
2979
+ var ParseErrorCode;
2980
+ (function(ParseErrorCode2) {
2981
+ ParseErrorCode2[ParseErrorCode2["InvalidSymbol"] = 1] = "InvalidSymbol";
2982
+ ParseErrorCode2[ParseErrorCode2["InvalidNumberFormat"] = 2] = "InvalidNumberFormat";
2983
+ ParseErrorCode2[ParseErrorCode2["PropertyNameExpected"] = 3] = "PropertyNameExpected";
2984
+ ParseErrorCode2[ParseErrorCode2["ValueExpected"] = 4] = "ValueExpected";
2985
+ ParseErrorCode2[ParseErrorCode2["ColonExpected"] = 5] = "ColonExpected";
2986
+ ParseErrorCode2[ParseErrorCode2["CommaExpected"] = 6] = "CommaExpected";
2987
+ ParseErrorCode2[ParseErrorCode2["CloseBraceExpected"] = 7] = "CloseBraceExpected";
2988
+ ParseErrorCode2[ParseErrorCode2["CloseBracketExpected"] = 8] = "CloseBracketExpected";
2989
+ ParseErrorCode2[ParseErrorCode2["EndOfFileExpected"] = 9] = "EndOfFileExpected";
2990
+ ParseErrorCode2[ParseErrorCode2["InvalidCommentToken"] = 10] = "InvalidCommentToken";
2991
+ ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfComment"] = 11] = "UnexpectedEndOfComment";
2992
+ ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfString"] = 12] = "UnexpectedEndOfString";
2993
+ ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfNumber"] = 13] = "UnexpectedEndOfNumber";
2994
+ ParseErrorCode2[ParseErrorCode2["InvalidUnicode"] = 14] = "InvalidUnicode";
2995
+ ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
2996
+ ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
2997
+ })(ParseErrorCode || (ParseErrorCode = {}));
2998
+ function printParseErrorCode(code) {
2999
+ switch (code) {
3000
+ case 1:
3001
+ return "InvalidSymbol";
3002
+ case 2:
3003
+ return "InvalidNumberFormat";
3004
+ case 3:
3005
+ return "PropertyNameExpected";
3006
+ case 4:
3007
+ return "ValueExpected";
3008
+ case 5:
3009
+ return "ColonExpected";
3010
+ case 6:
3011
+ return "CommaExpected";
3012
+ case 7:
3013
+ return "CloseBraceExpected";
3014
+ case 8:
3015
+ return "CloseBracketExpected";
3016
+ case 9:
3017
+ return "EndOfFileExpected";
3018
+ case 10:
3019
+ return "InvalidCommentToken";
3020
+ case 11:
3021
+ return "UnexpectedEndOfComment";
3022
+ case 12:
3023
+ return "UnexpectedEndOfString";
3024
+ case 13:
3025
+ return "UnexpectedEndOfNumber";
3026
+ case 14:
3027
+ return "InvalidUnicode";
3028
+ case 15:
3029
+ return "InvalidEscapeCharacter";
3030
+ case 16:
3031
+ return "InvalidCharacter";
3032
+ }
3033
+ return "<unknown ParseErrorCode>";
3034
+ }
3035
+
3036
+ // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/config/imports/shared.js
3037
+ async function fileExists(filePath) {
3038
+ try {
3039
+ await fs.access(filePath);
3040
+ return true;
3041
+ } catch {
3042
+ return false;
3043
+ }
3044
+ }
3045
+ function parseJsonBuffer(buffer) {
3046
+ const errors = [];
3047
+ const parsed = parse2(buffer, errors, { allowTrailingComma: true });
3048
+ const first = errors[0];
3049
+ if (first) {
3050
+ const message = printParseErrorCode(first.error);
3051
+ throw new SyntaxError(`Failed to parse JSON (offset ${first.offset}): ${message}`);
3052
+ }
3053
+ return parsed;
3054
+ }
3055
+ function isRecord(value) {
3056
+ return Boolean(value && typeof value === "object" && !Array.isArray(value));
3057
+ }
3058
+
3059
+ // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/config/read-config.js
3060
+ async function loadConfigLayers(options, rootDir) {
3061
+ const explicitPath = options.configPath ?? process.env.MCPORTER_CONFIG;
3062
+ if (explicitPath) {
3063
+ const resolvedPath = path.resolve(expandHome(explicitPath.trim()));
3064
+ const config = await readConfigFile(resolvedPath, true);
3065
+ return [{ config, path: resolvedPath, explicit: true }];
3066
+ }
3067
+ const layers = [];
3068
+ const homeCandidates = homeConfigCandidates();
3069
+ const existingHome = homeCandidates.find((candidate) => pathExists(candidate));
3070
+ if (existingHome) {
3071
+ layers.push({ config: await readConfigFile(existingHome, false), path: existingHome, explicit: false });
3072
+ }
3073
+ const projectPath = path.resolve(rootDir, "config", "mcporter.json");
3074
+ if (pathExists(projectPath)) {
3075
+ layers.push({ config: await readConfigFile(projectPath, false), path: projectPath, explicit: false });
3076
+ }
3077
+ if (layers.length === 0) {
3078
+ layers.push({ config: { mcpServers: {} }, path: projectPath, explicit: false });
3079
+ }
3080
+ return layers;
3081
+ }
3082
+ async function readConfigFile(configPath, explicit) {
3083
+ if (!explicit && !await pathExistsAsync(configPath)) {
3084
+ return { mcpServers: {} };
3085
+ }
3086
+ try {
3087
+ const buffer = await fs2.readFile(configPath, "utf8");
3088
+ return RawConfigSchema.parse(parseJsonBuffer(buffer));
3089
+ } catch (error) {
3090
+ if (!explicit && isMissingConfigError(error)) {
3091
+ return { mcpServers: {} };
3092
+ }
3093
+ if (!explicit && isSyntaxError(error)) {
3094
+ warnConfigFallback(configPath, error);
3095
+ return { mcpServers: {} };
3096
+ }
3097
+ throw error;
3098
+ }
3099
+ }
3100
+ function isErrno(error, code) {
3101
+ return Boolean(error && typeof error === "object" && error.code === code);
3102
+ }
3103
+ function isMissingConfigError(error) {
3104
+ return isErrno(error, "ENOENT") || includesErrnoMessage(error, "ENOENT");
3105
+ }
3106
+ function isSyntaxError(error) {
3107
+ return error instanceof SyntaxError;
3108
+ }
3109
+ var warnedConfigPaths = /* @__PURE__ */ new Set();
3110
+ function warnConfigFallback(configPath, error) {
3111
+ if (warnedConfigPaths.has(configPath)) {
3112
+ return;
3113
+ }
3114
+ warnedConfigPaths.add(configPath);
3115
+ const reason = error instanceof Error ? error.message : String(error);
3116
+ console.warn(`[mcporter] Ignoring config at ${configPath}: ${reason}`);
3117
+ }
3118
+ function includesErrnoMessage(error, code) {
3119
+ if (!error || typeof error !== "object") {
3120
+ return false;
3121
+ }
3122
+ const message = error.message;
3123
+ return typeof message === "string" && message.includes(code);
3124
+ }
3125
+
3126
+ // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/config/imports/external.js
3127
+ var import_toml = __toESM(require_toml(), 1);
3128
+ import fs3 from "node:fs/promises";
3129
+ import path3 from "node:path";
3130
+
3131
+ // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/config/imports/paths-utils.js
3132
+ import os from "node:os";
3133
+ import path2 from "node:path";
3134
+ function normalizeProjectPath(input) {
3135
+ if (!input || typeof input !== "string") {
3136
+ return "";
3137
+ }
3138
+ return path2.resolve(expandHomeShortcut(input));
3139
+ }
3140
+ function expandHomeShortcut(input) {
3141
+ if (input === "~") {
3142
+ return os.homedir();
3143
+ }
3144
+ if (input.startsWith("~/") || input.startsWith("~\\")) {
3145
+ return path2.join(os.homedir(), input.slice(2));
3146
+ }
3147
+ return input;
3148
+ }
3149
+ function pathsEqual(a, b) {
3150
+ if (!a || !b) {
3151
+ return false;
3152
+ }
3153
+ if (process.platform === "win32") {
3154
+ return a.toLowerCase() === b.toLowerCase();
3155
+ }
3156
+ return a === b;
3157
+ }
3158
+
3159
+ // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/config/imports/external.js
3160
+ async function readExternalEntries(filePath, options = {}) {
3161
+ if (!await fileExists(filePath)) {
3162
+ return null;
3163
+ }
3164
+ const buffer = await fs3.readFile(filePath, "utf8");
3165
+ if (!buffer.trim()) {
3166
+ return /* @__PURE__ */ new Map();
3167
+ }
3168
+ try {
3169
+ if (filePath.endsWith(".toml")) {
3170
+ const parsed2 = (0, import_toml.parse)(buffer);
3171
+ return extractFromCodexConfig(parsed2);
3172
+ }
3173
+ const parsed = parseJsonBuffer(buffer);
3174
+ return extractFromMcpJson(parsed, options, filePath);
3175
+ } catch (error) {
3176
+ if (shouldIgnoreParseError(error)) {
3177
+ return /* @__PURE__ */ new Map();
3178
+ }
3179
+ throw error;
3180
+ }
3181
+ }
3182
+ function extractFromMcpJson(raw, options, filePath) {
3183
+ const map = /* @__PURE__ */ new Map();
3184
+ if (!isRecord(raw)) {
3185
+ return map;
3186
+ }
3187
+ const { importKind, projectRoot } = options;
3188
+ const descriptor2 = resolveContainerDescriptor(importKind, filePath);
3189
+ const containers = [];
3190
+ if (descriptor2.allowMcpServers && isRecord(raw.mcpServers)) {
3191
+ containers.push(raw.mcpServers);
3192
+ }
3193
+ if (descriptor2.allowServers && isRecord(raw.servers)) {
3194
+ containers.push(raw.servers);
3195
+ }
3196
+ if (descriptor2.allowMcp && isRecord(raw.mcp)) {
3197
+ containers.push(raw.mcp);
3198
+ }
3199
+ if (descriptor2.allowRootFallback && containers.length === 0) {
3200
+ containers.push(raw);
3201
+ }
3202
+ for (const container of containers) {
3203
+ addEntriesFromContainer(container, map);
3204
+ }
3205
+ if (projectRoot) {
3206
+ const projectEntries = extractClaudeProjectEntries(raw, projectRoot);
3207
+ for (const [name, entry] of projectEntries) {
3208
+ if (!map.has(name)) {
3209
+ map.set(name, entry);
3210
+ }
3211
+ }
3212
+ }
3213
+ return map;
3214
+ }
3215
+ function extractFromCodexConfig(raw) {
3216
+ const map = /* @__PURE__ */ new Map();
3217
+ const serversRaw = raw.mcp_servers;
3218
+ if (!serversRaw || typeof serversRaw !== "object") {
3219
+ return map;
3220
+ }
3221
+ for (const [name, value] of Object.entries(serversRaw)) {
3222
+ if (!value || typeof value !== "object") {
3223
+ continue;
3224
+ }
3225
+ const entry = convertExternalEntry(value);
3226
+ if (entry) {
3227
+ map.set(name, entry);
3228
+ }
3229
+ }
3230
+ return map;
3231
+ }
3232
+ function convertExternalEntry(value) {
3233
+ const result = {};
3234
+ if (typeof value.description === "string") {
3235
+ result.description = value.description;
3236
+ }
3237
+ const env = asStringRecord(value.env);
3238
+ if (env) {
3239
+ result.env = env;
3240
+ }
3241
+ const headers = buildExternalHeaders(value);
3242
+ if (headers) {
3243
+ result.headers = headers;
3244
+ }
3245
+ const auth = asString(value.auth);
3246
+ if (auth) {
3247
+ result.auth = auth;
3248
+ }
3249
+ const tokenCacheDir = asString(value.tokenCacheDir ?? value.token_cache_dir ?? value.token_cacheDir);
3250
+ if (tokenCacheDir) {
3251
+ result.tokenCacheDir = tokenCacheDir;
3252
+ }
3253
+ const clientName = asString(value.clientName ?? value.client_name);
3254
+ if (clientName) {
3255
+ result.clientName = clientName;
3256
+ }
3257
+ const oauthClientId = asString(value.oauthClientId ?? value.oauth_client_id);
3258
+ if (oauthClientId) {
3259
+ result.oauthClientId = oauthClientId;
3260
+ }
3261
+ const oauthClientSecret = asString(value.oauthClientSecret ?? value.oauth_client_secret);
3262
+ if (oauthClientSecret) {
3263
+ result.oauthClientSecret = oauthClientSecret;
3264
+ }
3265
+ const oauthClientSecretEnv = asString(value.oauthClientSecretEnv ?? value.oauth_client_secret_env);
3266
+ if (oauthClientSecretEnv) {
3267
+ result.oauthClientSecretEnv = oauthClientSecretEnv;
3268
+ }
3269
+ const oauthTokenEndpointAuthMethod = asString(value.oauthTokenEndpointAuthMethod ?? value.oauth_token_endpoint_auth_method);
3270
+ if (oauthTokenEndpointAuthMethod) {
3271
+ result.oauthTokenEndpointAuthMethod = oauthTokenEndpointAuthMethod;
3272
+ }
3273
+ const httpFetch = asString(value.httpFetch ?? value.http_fetch);
3274
+ if (httpFetch) {
3275
+ result.httpFetch = httpFetch;
3276
+ }
3277
+ const refresh = asRefresh(value.refresh);
3278
+ if (refresh) {
3279
+ result.refresh = refresh;
3280
+ }
3281
+ const url = asString(value.baseUrl ?? value.base_url ?? value.url ?? value.serverUrl ?? value.server_url);
3282
+ if (url) {
3283
+ result.baseUrl = url;
3284
+ }
3285
+ const commandValue = value.command ?? value.executable;
3286
+ if (Array.isArray(commandValue) && commandValue.every((item) => typeof item === "string")) {
3287
+ result.command = commandValue;
3288
+ } else if (typeof commandValue === "string") {
3289
+ result.command = commandValue;
3290
+ }
3291
+ if (Array.isArray(value.args) && value.args.every((item) => typeof item === "string")) {
3292
+ result.args = value.args;
3293
+ }
3294
+ const hasHttpTarget = typeof result.baseUrl === "string";
3295
+ const hasCommandTarget = typeof result.command === "string" || Array.isArray(result.command) && result.command.length > 0;
3296
+ if (!hasHttpTarget && !hasCommandTarget) {
3297
+ return null;
3298
+ }
3299
+ const parsed = RawEntrySchema.safeParse(result);
3300
+ return parsed.success ? parsed.data : null;
3301
+ }
3302
+ function buildExternalHeaders(record) {
3303
+ const headers = {};
3304
+ const literalHeaders = asStringRecord(record.headers);
3305
+ if (literalHeaders) {
3306
+ Object.assign(headers, literalHeaders);
3307
+ }
3308
+ const bearerToken = asString(record.bearerToken ?? record.bearer_token);
3309
+ if (bearerToken) {
3310
+ headers.Authorization = `Bearer ${bearerToken}`;
3311
+ }
3312
+ const bearerTokenEnv = asString(record.bearerTokenEnv ?? record.bearer_token_env);
3313
+ if (bearerTokenEnv) {
3314
+ headers.Authorization = `$env:${bearerTokenEnv}`;
3315
+ }
3316
+ return Object.keys(headers).length > 0 ? headers : void 0;
3317
+ }
3318
+ function asRefresh(value) {
3319
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
3320
+ return void 0;
3321
+ }
3322
+ const record = value;
3323
+ const result = {};
3324
+ copyString(record, result, "tokenEndpoint", "token_endpoint");
3325
+ copyString(record, result, "clientIdEnv", "client_id_env");
3326
+ copyString(record, result, "clientSecretEnv", "client_secret_env");
3327
+ copyString(record, result, "clientAuthMethod", "client_auth_method");
3328
+ copyString(record, result, "accessTokenEnv", "access_token_env");
3329
+ const refreshSkewSeconds = record.refreshSkewSeconds ?? record.refresh_skew_seconds;
3330
+ if (typeof refreshSkewSeconds === "number" && Number.isInteger(refreshSkewSeconds) && refreshSkewSeconds >= 0) {
3331
+ result.refreshSkewSeconds = refreshSkewSeconds;
3332
+ }
3333
+ return Object.keys(result).length > 0 ? result : void 0;
3334
+ }
3335
+ function copyString(source, target, camel, snake) {
3336
+ const value = asString(source[camel] ?? source[snake]);
3337
+ if (value) {
3338
+ target[camel] = value;
3339
+ }
3340
+ }
3341
+ function extractClaudeProjectEntries(raw, projectRoot) {
3342
+ const map = /* @__PURE__ */ new Map();
3343
+ if (!isRecord(raw.projects)) {
3344
+ return map;
3345
+ }
3346
+ const projects = raw.projects;
3347
+ const targetPath = normalizeProjectPath(projectRoot);
3348
+ for (const [projectKey, value] of Object.entries(projects)) {
3349
+ if (!isRecord(value) || !isRecord(value.mcpServers)) {
3350
+ continue;
3351
+ }
3352
+ const normalizedKey = normalizeProjectPath(projectKey);
3353
+ if (!pathsEqual(normalizedKey, targetPath)) {
3354
+ continue;
3355
+ }
3356
+ addEntriesFromContainer(value.mcpServers, map);
3357
+ }
3358
+ return map;
3359
+ }
3360
+ function addEntriesFromContainer(container, target) {
3361
+ for (const [name, value] of Object.entries(container)) {
3362
+ if (!isRecord(value)) {
3363
+ continue;
3364
+ }
3365
+ if (target.has(name)) {
3366
+ continue;
3367
+ }
3368
+ const entry = convertExternalEntry(value);
3369
+ if (entry) {
3370
+ target.set(name, entry);
3371
+ }
3372
+ }
3373
+ }
3374
+ function resolveContainerDescriptor(importKind, filePath) {
3375
+ if (importKind === "opencode") {
3376
+ return {
3377
+ allowMcpServers: false,
3378
+ allowServers: false,
3379
+ allowMcp: true,
3380
+ allowRootFallback: false
3381
+ };
3382
+ }
3383
+ if (importKind === "claude-code" && filePath) {
3384
+ const normalized = path3.normalize(filePath);
3385
+ const allowRootFallback = normalized.endsWith(".claude.json") || normalized.endsWith(`${path3.sep}.claude${path3.sep}mcp.json`);
3386
+ return {
3387
+ allowMcpServers: true,
3388
+ allowServers: true,
3389
+ allowMcp: true,
3390
+ allowRootFallback
3391
+ };
3392
+ }
3393
+ return {
3394
+ allowMcpServers: true,
3395
+ allowServers: true,
3396
+ allowMcp: true,
3397
+ allowRootFallback: true
3398
+ };
3399
+ }
3400
+ function asString(value) {
3401
+ return typeof value === "string" && value.length > 0 ? value : void 0;
3402
+ }
3403
+ function asStringRecord(input) {
3404
+ if (!input || typeof input !== "object") {
3405
+ return void 0;
3406
+ }
3407
+ const record = {};
3408
+ for (const [key, value] of Object.entries(input)) {
3409
+ if (typeof value === "string") {
3410
+ record[key] = value;
3411
+ } else if (typeof value === "number" || typeof value === "boolean") {
3412
+ record[key] = String(value);
3413
+ }
3414
+ }
3415
+ return Object.keys(record).length > 0 ? record : void 0;
3416
+ }
3417
+ function shouldIgnoreParseError(error) {
3418
+ if (error instanceof SyntaxError) {
3419
+ return true;
3420
+ }
3421
+ if (!error || typeof error !== "object") {
3422
+ return false;
3423
+ }
3424
+ return "fromTOML" in error;
3425
+ }
3426
+
3427
+ // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/config/imports/paths.js
3428
+ import os2 from "node:os";
3429
+ import path4 from "node:path";
3430
+ function pathsForImport(kind, rootDir) {
3431
+ switch (kind) {
3432
+ case "cursor":
3433
+ return dedupePaths([
3434
+ path4.resolve(rootDir, ".cursor", "mcp.json"),
3435
+ path4.join(os2.homedir(), ".cursor", "mcp.json"),
3436
+ ...defaultCursorUserConfigPaths()
3437
+ ]);
3438
+ case "claude-code":
3439
+ return dedupePaths([
3440
+ path4.resolve(rootDir, ".claude", "settings.local.json"),
3441
+ path4.resolve(rootDir, ".claude", "settings.json"),
3442
+ path4.resolve(rootDir, ".claude", "mcp.json"),
3443
+ path4.join(os2.homedir(), ".claude", "settings.local.json"),
3444
+ path4.join(os2.homedir(), ".claude", "settings.json"),
3445
+ path4.join(os2.homedir(), ".claude", "mcp.json"),
3446
+ path4.join(os2.homedir(), ".claude.json")
3447
+ ]);
3448
+ case "claude-desktop":
3449
+ return [defaultClaudeDesktopConfigPath()];
3450
+ case "codex":
3451
+ return [path4.resolve(rootDir, ".codex", "config.toml"), path4.join(os2.homedir(), ".codex", "config.toml")];
3452
+ case "windsurf":
3453
+ return defaultWindsurfConfigPaths();
3454
+ case "opencode":
3455
+ return opencodeConfigPaths(rootDir);
3456
+ case "vscode":
3457
+ return dedupePaths([path4.resolve(rootDir, ".vscode", "mcp.json"), ...defaultVscodeConfigPaths()]);
3458
+ default:
3459
+ return [];
3460
+ }
3461
+ }
3462
+ function defaultCursorUserConfigPaths() {
3463
+ const xdgConfig = process.env.XDG_CONFIG_HOME;
3464
+ const configs = xdgConfig ? [path4.join(xdgConfig, "Cursor", "User", "mcp.json")] : [];
3465
+ return dedupePaths([
3466
+ path4.join(os2.homedir(), "AppData", "Roaming", "Cursor", "User", "mcp.json"),
3467
+ path4.join(os2.homedir(), "Library", "Application Support", "Cursor", "User", "mcp.json"),
3468
+ ...configs
3469
+ ]);
3470
+ }
3471
+ function defaultWindsurfConfigPaths() {
3472
+ const homeDir = os2.homedir();
3473
+ const paths = [
3474
+ path4.join(homeDir, ".codeium", "windsurf", "mcp_config.json"),
3475
+ path4.join(homeDir, ".codeium", "windsurf-next", "mcp_config.json"),
3476
+ path4.join(homeDir, ".windsurf", "mcp_config.json"),
3477
+ path4.join(homeDir, ".config", ".codeium", "windsurf", "mcp_config.json")
3478
+ ];
3479
+ if (process.platform === "win32") {
3480
+ const appData = process.env.APPDATA ?? path4.join(homeDir, "AppData", "Roaming");
3481
+ paths.push(path4.join(appData, "Codeium", "windsurf", "mcp_config.json"));
3482
+ }
3483
+ return dedupePaths(paths);
3484
+ }
3485
+ function defaultVscodeConfigPaths() {
3486
+ if (process.platform === "darwin") {
3487
+ return [
3488
+ path4.join(os2.homedir(), "Library", "Application Support", "Code", "User", "mcp.json"),
3489
+ path4.join(os2.homedir(), "Library", "Application Support", "Code - Insiders", "User", "mcp.json")
3490
+ ];
3491
+ }
3492
+ if (process.platform === "win32") {
3493
+ const appData = process.env.APPDATA ?? path4.join(os2.homedir(), "AppData", "Roaming");
3494
+ return [path4.join(appData, "Code", "User", "mcp.json"), path4.join(appData, "Code - Insiders", "User", "mcp.json")];
3495
+ }
3496
+ return [
3497
+ path4.join(os2.homedir(), ".config", "Code", "User", "mcp.json"),
3498
+ path4.join(os2.homedir(), ".config", "Code - Insiders", "User", "mcp.json")
3499
+ ];
3500
+ }
3501
+ function opencodeConfigPaths(rootDir) {
3502
+ const overrideConfig = process.env.OPENCODE_CONFIG;
3503
+ const overrideDir = process.env.OPENCODE_CONFIG_DIR;
3504
+ const envConfigPath = process.env.OPENAI_WORKDIR;
3505
+ const xdg = process.env.XDG_CONFIG_HOME;
3506
+ const configHome = xdg ?? path4.join(process.env.HOME ?? "", ".config");
3507
+ const paths = [
3508
+ overrideConfig ?? "",
3509
+ path4.resolve(rootDir, "opencode.jsonc"),
3510
+ path4.resolve(rootDir, "opencode.json")
3511
+ ];
3512
+ if (overrideDir && overrideDir.length > 0) {
3513
+ paths.push(path4.join(overrideDir, "opencode.jsonc"), path4.join(overrideDir, "opencode.json"));
3514
+ }
3515
+ paths.push(path4.resolve(rootDir, ".openai", "config.json"), envConfigPath ? path4.resolve(envConfigPath, ".openai", "config.json") : "", path4.join(configHome, "openai", "config.json"));
3516
+ for (const dir of defaultOpencodeConfigDirs()) {
3517
+ paths.push(path4.join(dir, "opencode.jsonc"), path4.join(dir, "opencode.json"));
3518
+ }
3519
+ return dedupePaths(paths);
3520
+ }
3521
+ function defaultOpencodeConfigDirs() {
3522
+ const dirs = [];
3523
+ const xdg = process.env.XDG_CONFIG_HOME;
3524
+ if (xdg && xdg.length > 0) {
3525
+ dirs.push(path4.join(xdg, "opencode"));
3526
+ } else if (process.platform === "win32") {
3527
+ const appData = process.env.APPDATA ?? path4.join(os2.homedir(), "AppData", "Roaming");
3528
+ dirs.push(path4.join(appData, "opencode"));
3529
+ } else {
3530
+ dirs.push(path4.join(os2.homedir(), ".config", "opencode"));
3531
+ }
3532
+ return dirs;
3533
+ }
3534
+ function defaultClaudeDesktopConfigPath() {
3535
+ const homeDir = os2.homedir();
3536
+ const darwinPath = path4.join(homeDir, "Library", "Application Support", "Claude", "settings.json");
3537
+ const windowsPath = path4.join(homeDir, "AppData", "Roaming", "Claude", "settings.json");
3538
+ const linuxPath = path4.join(homeDir, ".config", "Claude", "settings.json");
3539
+ const platform = process.platform;
3540
+ if (platform === "darwin") {
3541
+ return darwinPath;
3542
+ }
3543
+ if (platform === "win32") {
3544
+ return windowsPath;
3545
+ }
3546
+ return linuxPath;
3547
+ }
3548
+ function dedupePaths(paths) {
3549
+ const seen = /* @__PURE__ */ new Set();
3550
+ const result = [];
3551
+ for (const candidate of paths) {
3552
+ if (!candidate || seen.has(candidate)) {
3553
+ continue;
3554
+ }
3555
+ seen.add(candidate);
3556
+ result.push(candidate);
3557
+ }
3558
+ return result;
3559
+ }
3560
+
3561
+ // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/config-normalize.js
3562
+ import fs4 from "node:fs";
3563
+ import path5 from "node:path";
3564
+ function normalizeServerEntry(name, raw, baseDir, source, sources) {
3565
+ const resolvedRaw = resolveConfigEnvPlaceholders(name, raw);
3566
+ raw = resolvedRaw;
3567
+ const description = raw.description;
3568
+ const env = raw.env ? { ...raw.env } : void 0;
3569
+ const auth = normalizeAuth(raw.auth);
3570
+ const tokenCacheDir = normalizePath(raw.tokenCacheDir ?? raw.token_cache_dir);
3571
+ const clientName = raw.clientName ?? raw.client_name;
3572
+ const oauthClientId = raw.oauthClientId ?? raw.oauth_client_id ?? void 0;
3573
+ const oauthClientSecret = raw.oauthClientSecret ?? raw.oauth_client_secret ?? void 0;
3574
+ const oauthClientSecretEnv = raw.oauthClientSecretEnv ?? raw.oauth_client_secret_env ?? void 0;
3575
+ const oauthTokenEndpointAuthMethod = raw.oauthTokenEndpointAuthMethod ?? raw.oauth_token_endpoint_auth_method ?? void 0;
3576
+ const oauthRedirectUrl = raw.oauthRedirectUrl ?? raw.oauth_redirect_url ?? void 0;
3577
+ const oauthScope = raw.oauthScope ?? raw.oauth_scope ?? void 0;
3578
+ const refresh = normalizeRefresh(raw.refresh);
3579
+ const httpFetch = normalizeHttpFetch(raw.httpFetch ?? raw.http_fetch);
3580
+ const oauthCommandRaw = raw.oauthCommand ?? raw.oauth_command;
3581
+ const oauthCommand = oauthCommandRaw ? { args: [...oauthCommandRaw.args] } : void 0;
3582
+ const headers = buildHeaders(raw);
3583
+ const httpUrl = getUrl(raw);
3584
+ const stdio = getCommand(raw, baseDir);
3585
+ let command;
3586
+ if (httpUrl) {
3587
+ command = {
3588
+ kind: "http",
3589
+ url: new URL(httpUrl),
3590
+ headers: ensureHttpAcceptHeader(headers)
3591
+ };
3592
+ } else if (stdio) {
3593
+ command = {
3594
+ kind: "stdio",
3595
+ command: stdio.command,
3596
+ args: stdio.args,
3597
+ cwd: resolveCwd(raw.cwd, baseDir)
3598
+ };
3599
+ } else {
3600
+ throw new Error(`Server '${name}' is missing a baseUrl/url or command definition in mcporter.json`);
3601
+ }
3602
+ const lifecycle = resolveLifecycle(name, raw.lifecycle, command);
3603
+ const logging = normalizeLogging(raw.logging);
3604
+ const allowedTools = raw.allowedTools ?? raw.allowed_tools;
3605
+ const blockedTools = raw.blockedTools ?? raw.blocked_tools;
3606
+ const defaultedOauthCommand = !oauthCommand && name.toLowerCase() === "gmail" && command.kind === "stdio" ? { args: ["auth", "http://localhost:3000/oauth2callback"] } : oauthCommand;
3607
+ return {
3608
+ name,
3609
+ description,
3610
+ command,
3611
+ env,
3612
+ auth,
3613
+ tokenCacheDir,
3614
+ clientName,
3615
+ oauthClientId,
3616
+ oauthClientSecret,
3617
+ oauthClientSecretEnv,
3618
+ oauthTokenEndpointAuthMethod,
3619
+ oauthRedirectUrl,
3620
+ oauthScope,
3621
+ oauthCommand: defaultedOauthCommand,
3622
+ refresh,
3623
+ httpFetch,
3624
+ source,
3625
+ sources,
3626
+ lifecycle,
3627
+ logging,
3628
+ ...allowedTools !== void 0 ? { allowedTools: [...allowedTools] } : {},
3629
+ ...blockedTools !== void 0 ? { blockedTools: [...blockedTools] } : {}
3630
+ };
3631
+ }
3632
+ var __configInternals = {
3633
+ ensureHttpAcceptHeader,
3634
+ resolveConfigEnvPlaceholders
3635
+ };
3636
+ function resolveConfigEnvPlaceholders(name, raw) {
3637
+ return resolveConfigEnvValue(name, raw, []);
3638
+ }
3639
+ function resolveConfigEnvValue(name, value, pathSegments) {
3640
+ if (typeof value === "string") {
3641
+ if (!value.includes("$") || shouldDeferEnvResolution(pathSegments)) {
3642
+ return value;
3643
+ }
3644
+ try {
3645
+ return resolveEnvPlaceholders(value);
3646
+ } catch (error) {
3647
+ const message = error instanceof Error ? error.message : String(error);
3648
+ const field = pathSegments.join(".") || "<root>";
3649
+ throw new Error(`Server '${name}' field '${field}' has unresolved env placeholder: ${message}`, { cause: error });
3650
+ }
3651
+ }
3652
+ if (Array.isArray(value)) {
3653
+ return value.map((entry, index) => resolveConfigEnvValue(name, entry, [...pathSegments, String(index)]));
3654
+ }
3655
+ if (value && typeof value === "object") {
3656
+ const resolved = {};
3657
+ for (const [key, entry] of Object.entries(value)) {
3658
+ resolved[key] = resolveConfigEnvValue(name, entry, [...pathSegments, key]);
3659
+ }
3660
+ return resolved;
3661
+ }
3662
+ return value;
3663
+ }
3664
+ function shouldDeferEnvResolution(pathSegments) {
3665
+ const [root] = pathSegments;
3666
+ const field = pathSegments.at(-1) ?? "";
3667
+ return root === "headers" || root === "env" || field === "bearerToken" || field === "bearer_token" || field.endsWith("Env") || field.endsWith("_env");
3668
+ }
3669
+ function normalizeAuth(auth) {
3670
+ if (!auth) {
3671
+ return void 0;
3672
+ }
3673
+ if (auth.toLowerCase() === "oauth") {
3674
+ return "oauth";
3675
+ }
3676
+ if (auth.toLowerCase() === "refreshable_bearer") {
3677
+ return "refreshable_bearer";
3678
+ }
3679
+ return void 0;
3680
+ }
3681
+ function normalizeRefresh(raw) {
3682
+ const tokenEndpoint = raw?.tokenEndpoint ?? raw?.token_endpoint;
3683
+ if (!tokenEndpoint) {
3684
+ return void 0;
3685
+ }
3686
+ return {
3687
+ tokenEndpoint,
3688
+ clientIdEnv: raw?.clientIdEnv ?? raw?.client_id_env,
3689
+ clientSecretEnv: raw?.clientSecretEnv ?? raw?.client_secret_env,
3690
+ clientAuthMethod: raw?.clientAuthMethod ?? raw?.client_auth_method,
3691
+ refreshSkewSeconds: raw?.refreshSkewSeconds ?? raw?.refresh_skew_seconds,
3692
+ accessTokenEnv: raw?.accessTokenEnv ?? raw?.access_token_env
3693
+ };
3694
+ }
3695
+ function normalizeHttpFetch(value) {
3696
+ return value;
3697
+ }
3698
+ function normalizePath(input) {
3699
+ if (!input) {
3700
+ return void 0;
3701
+ }
3702
+ return expandHome(input);
3703
+ }
3704
+ function resolveCwd(input, baseDir) {
3705
+ if (!input) {
3706
+ return baseDir;
3707
+ }
3708
+ return path5.resolve(baseDir, expandHome(input));
3709
+ }
3710
+ function getUrl(raw) {
3711
+ return raw.baseUrl ?? raw.base_url ?? raw.url ?? raw.serverUrl ?? raw.server_url ?? void 0;
3712
+ }
3713
+ function getCommand(raw, baseDir) {
3714
+ const commandValue = raw.command ?? raw.executable;
3715
+ if (Array.isArray(commandValue)) {
3716
+ if (commandValue.length === 0 || typeof commandValue[0] !== "string") {
3717
+ return void 0;
3718
+ }
3719
+ return { command: commandValue[0], args: commandValue.slice(1) };
3720
+ }
3721
+ if (typeof commandValue === "string" && commandValue.length > 0) {
3722
+ const args = Array.isArray(raw.args) ? raw.args : [];
3723
+ if (args.length > 0) {
3724
+ return { command: commandValue, args };
3725
+ }
3726
+ if (isExistingCommandPath(commandValue, baseDir)) {
3727
+ return { command: commandValue, args: [] };
3728
+ }
3729
+ const tokens = parseCommandString(commandValue);
3730
+ if (tokens.length === 0) {
3731
+ return void 0;
3732
+ }
3733
+ const [commandToken, ...rest] = tokens;
3734
+ if (!commandToken) {
3735
+ return void 0;
3736
+ }
3737
+ return { command: commandToken, args: rest };
3738
+ }
3739
+ return void 0;
3740
+ }
3741
+ function isExistingCommandPath(value, baseDir) {
3742
+ const trimmed = value.trim();
3743
+ if (!trimmed.includes(" ")) {
3744
+ return false;
3745
+ }
3746
+ if (!looksLikePath(trimmed)) {
3747
+ return false;
3748
+ }
3749
+ const expanded = expandHome(trimmed);
3750
+ const resolved = path5.isAbsolute(expanded) ? expanded : path5.resolve(baseDir, expanded);
3751
+ try {
3752
+ return fs4.statSync(resolved).isFile();
3753
+ } catch {
3754
+ return false;
3755
+ }
3756
+ }
3757
+ function looksLikePath(value) {
3758
+ return /^[A-Za-z]:[\\/]/.test(value) || value.startsWith("/") || value.startsWith("./") || value.startsWith("../") || value.startsWith("~/");
3759
+ }
3760
+ function buildHeaders(raw) {
3761
+ const headers = {};
3762
+ if (raw.headers) {
3763
+ Object.assign(headers, raw.headers);
3764
+ }
3765
+ const bearerToken = raw.bearerToken ?? raw.bearer_token;
3766
+ if (bearerToken) {
3767
+ headers.Authorization = `Bearer ${bearerToken}`;
3768
+ }
3769
+ const bearerTokenEnv = raw.bearerTokenEnv ?? raw.bearer_token_env;
3770
+ if (bearerTokenEnv) {
3771
+ headers.Authorization = `$env:${bearerTokenEnv}`;
3772
+ }
3773
+ return Object.keys(headers).length > 0 ? headers : void 0;
3774
+ }
3775
+ function ensureHttpAcceptHeader(headers) {
3776
+ const requiredAccept = "application/json, text/event-stream";
3777
+ const normalized = headers ? { ...headers } : {};
3778
+ const acceptKey = Object.keys(normalized).find((key) => key.toLowerCase() === "accept");
3779
+ const currentValue = acceptKey ? normalized[acceptKey] : void 0;
3780
+ if (!currentValue || !hasRequiredAcceptTokens(currentValue)) {
3781
+ normalized[acceptKey ?? "accept"] = requiredAccept;
3782
+ }
3783
+ return Object.keys(normalized).length > 0 ? normalized : void 0;
3784
+ }
3785
+ function hasRequiredAcceptTokens(value) {
3786
+ const lower = value.toLowerCase();
3787
+ return lower.includes("application/json") && lower.includes("text/event-stream");
3788
+ }
3789
+ function parseCommandString(value) {
3790
+ const result = [];
3791
+ let current = "";
3792
+ let inSingleQuote = false;
3793
+ let inDoubleQuote = false;
3794
+ let escapeNext = false;
3795
+ for (const char of value.trim()) {
3796
+ if (escapeNext) {
3797
+ current += char;
3798
+ escapeNext = false;
3799
+ continue;
3800
+ }
3801
+ if (char === "\\") {
3802
+ escapeNext = true;
3803
+ continue;
3804
+ }
3805
+ if (char === "'" && !inDoubleQuote) {
3806
+ inSingleQuote = !inSingleQuote;
3807
+ continue;
3808
+ }
3809
+ if (char === '"' && !inSingleQuote) {
3810
+ inDoubleQuote = !inDoubleQuote;
3811
+ continue;
3812
+ }
3813
+ if (char === " " && !inSingleQuote && !inDoubleQuote) {
3814
+ if (current.length > 0) {
3815
+ result.push(current);
3816
+ current = "";
3817
+ }
3818
+ continue;
3819
+ }
3820
+ current += char;
3821
+ }
3822
+ if (escapeNext) {
3823
+ current += "\\";
3824
+ }
3825
+ if (current.length > 0) {
3826
+ result.push(current);
3827
+ }
3828
+ return result;
3829
+ }
3830
+ function normalizeLogging(raw) {
3831
+ if (!raw) {
3832
+ return void 0;
3833
+ }
3834
+ if (raw.daemon) {
3835
+ const logging = { daemon: { enabled: raw.daemon.enabled } };
3836
+ return logging;
3837
+ }
3838
+ return void 0;
3839
+ }
3840
+
3841
+ // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/config.js
3842
+ async function loadServerDefinitions(options = {}) {
3843
+ const rootDir = options.rootDir ?? process.cwd();
3844
+ const layers = await loadConfigLayers(options, rootDir);
3845
+ const merged = /* @__PURE__ */ new Map();
3846
+ for (const layer of layers) {
3847
+ const configuredImports = layer.config.imports;
3848
+ const imports = configuredImports ? configuredImports.length === 0 ? configuredImports : [...configuredImports, ...DEFAULT_IMPORTS.filter((kind) => !configuredImports.includes(kind))] : DEFAULT_IMPORTS;
3849
+ for (const importKind of imports) {
3850
+ const candidates = pathsForImport(importKind, rootDir);
3851
+ for (const candidate of candidates) {
3852
+ const resolved = expandHome(candidate);
3853
+ const entries = await readExternalEntries(resolved, { projectRoot: rootDir, importKind });
3854
+ if (!entries) {
3855
+ continue;
3856
+ }
3857
+ for (const [name, rawEntry] of entries) {
3858
+ const source = { kind: "import", path: resolved, importKind };
3859
+ const baseDir = path6.dirname(resolved);
3860
+ try {
3861
+ normalizeServerEntry(name, rawEntry, baseDir, source, [source]);
3862
+ } catch {
3863
+ continue;
3864
+ }
3865
+ if (merged.has(name)) {
3866
+ continue;
3867
+ }
3868
+ const existing = merged.get(name);
3869
+ if (existing) {
3870
+ existing.sources.push(source);
3871
+ continue;
3872
+ }
3873
+ merged.set(name, {
3874
+ raw: rawEntry,
3875
+ baseDir,
3876
+ source,
3877
+ sources: [source]
3878
+ });
3879
+ }
3880
+ }
3881
+ }
3882
+ for (const [name, entryRaw] of Object.entries(layer.config.mcpServers)) {
3883
+ const source = { kind: "local", path: layer.path };
3884
+ const parsed = RawEntrySchema.parse(entryRaw);
3885
+ const existing = merged.get(name);
3886
+ if (existing) {
3887
+ const sources = [source, ...existing.sources];
3888
+ merged.set(name, { raw: parsed, baseDir: path6.dirname(layer.path), source, sources });
3889
+ continue;
3890
+ }
3891
+ merged.set(name, {
3892
+ raw: parsed,
3893
+ baseDir: path6.dirname(layer.path),
3894
+ source,
3895
+ sources: [source]
3896
+ });
3897
+ }
3898
+ }
3899
+ const servers = [];
3900
+ for (const [name, { raw, baseDir: entryBaseDir, source, sources }] of merged) {
3901
+ try {
3902
+ servers.push(normalizeServerEntry(name, raw, entryBaseDir, source, sources));
3903
+ } catch (error) {
3904
+ if (source.kind !== "import") {
3905
+ throw error;
3906
+ }
3907
+ }
3908
+ }
3909
+ return servers;
3910
+ }
3911
+ async function loadDaemonConfig(options = {}) {
3912
+ const rootDir = options.rootDir ?? process.cwd();
3913
+ const layers = await loadConfigLayers(options, rootDir);
3914
+ let idleTimeoutMs;
3915
+ for (const layer of layers) {
3916
+ const raw = layer.config.daemonIdleTimeoutMs ?? layer.config.daemon_idle_timeout_ms;
3917
+ if (typeof raw === "number" && Number.isFinite(raw) && raw > 0) {
3918
+ idleTimeoutMs = Math.trunc(raw);
3919
+ }
3920
+ }
3921
+ return { idleTimeoutMs };
3922
+ }
3923
+ async function loadRawConfig(options = {}) {
3924
+ const rootDir = options.rootDir ?? process.cwd();
3925
+ const resolved = resolveConfigPath2(options.configPath, rootDir);
3926
+ const config = await readConfigFile(resolved.path, resolved.explicit);
3927
+ return { config, ...resolved };
3928
+ }
3929
+ async function listConfigLayerPaths2(options = {}, rootDir = process.cwd()) {
3930
+ return await listConfigLayerPaths(options, rootDir);
3931
+ }
3932
+ async function writeRawConfig(targetPath, config) {
3933
+ const serialized = `${JSON.stringify(config, null, 2)}
3934
+ `;
3935
+ await writeTextFileAtomic(targetPath, serialized);
3936
+ }
3937
+ function resolveConfigPath2(configPath, rootDir) {
3938
+ return resolveConfigPath(configPath, rootDir);
3939
+ }
3940
+
3941
+ export {
3942
+ readExternalEntries,
3943
+ pathsForImport,
3944
+ __configInternals,
3945
+ loadServerDefinitions,
3946
+ loadDaemonConfig,
3947
+ loadRawConfig,
3948
+ listConfigLayerPaths2 as listConfigLayerPaths,
3949
+ writeRawConfig,
3950
+ resolveConfigPath2 as resolveConfigPath
3951
+ };