@fern-api/typescript-dynamic-snippets 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/DynamicSnippetsGenerator.cjs +17 -5456
- package/cjs/EndpointSnippetGenerator.cjs +17 -3487
- package/cjs/context/DynamicSnippetsGeneratorContext.cjs +17 -4811
- package/cjs/context/DynamicTypeLiteralMapper.cjs +17 -3441
- package/cjs/context/FilePropertyMapper.cjs +17 -3021
- package/cjs/index.cjs +29 -8759
- package/esm/DynamicSnippetsGenerator.js +1 -12
- package/esm/EndpointSnippetGenerator.js +1 -8
- package/esm/chunk-25TNFA5L.js +14 -0
- package/esm/chunk-736FTN3M.js +1 -0
- package/esm/chunk-CQ55KPJT.js +1 -0
- package/esm/chunk-LX5O4JB7.js +1 -0
- package/esm/chunk-SQLJANKO.js +1 -0
- package/esm/chunk-V6G7NZKW.js +1 -0
- package/esm/chunk-YD6EIACZ.js +27 -0
- package/esm/context/DynamicSnippetsGeneratorContext.js +1 -10
- package/esm/context/DynamicTypeLiteralMapper.js +1 -8
- package/esm/context/FilePropertyMapper.js +1 -7
- package/esm/index.js +13 -3311
- package/package.json +2 -2
- package/esm/chunk-5AHCFZX2.js +0 -819
- package/esm/chunk-APAANCUR.js +0 -86
- package/esm/chunk-K6P3GMIJ.js +0 -551
- package/esm/chunk-QMEM6UIZ.js +0 -538
- package/esm/chunk-SGEN5HN3.js +0 -3008
- package/esm/chunk-VZ6REHK2.js +0 -90
- package/esm/chunk-ZHKZ5MWW.js +0 -501
|
@@ -1,4814 +1,20 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
if (__propIsEnum.call(b, prop))
|
|
18
|
-
__defNormalProp(a, prop, b[prop]);
|
|
19
|
-
}
|
|
20
|
-
return a;
|
|
21
|
-
};
|
|
22
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
|
-
var __restKey = (key) => typeof key === "symbol" ? key : key + "";
|
|
24
|
-
var __objRest = (source, exclude) => {
|
|
25
|
-
var target = {};
|
|
26
|
-
for (var prop in source)
|
|
27
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
if (source != null && __getOwnPropSymbols)
|
|
30
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
31
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
32
|
-
target[prop] = source[prop];
|
|
33
|
-
}
|
|
34
|
-
return target;
|
|
35
|
-
};
|
|
36
|
-
var __esm = (fn, res) => function __init() {
|
|
37
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
38
|
-
};
|
|
39
|
-
var __export = (target, all) => {
|
|
40
|
-
for (var name in all)
|
|
41
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
42
|
-
};
|
|
43
|
-
var __copyProps = (to, from2, except, desc) => {
|
|
44
|
-
if (from2 && typeof from2 === "object" || typeof from2 === "function") {
|
|
45
|
-
for (let key of __getOwnPropNames(from2))
|
|
46
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
47
|
-
__defProp(to, key, { get: () => from2[key], enumerable: !(desc = __getOwnPropDesc(from2, key)) || desc.enumerable });
|
|
48
|
-
}
|
|
49
|
-
return to;
|
|
50
|
-
};
|
|
51
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
52
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
53
|
-
|
|
54
|
-
// ../../../node_modules/.pnpm/@esbuild-plugins+node-globals-polyfill@0.2.3_esbuild@0.24.0/node_modules/@esbuild-plugins/node-globals-polyfill/process.js
|
|
55
|
-
function defaultSetTimout() {
|
|
56
|
-
throw new Error("setTimeout has not been defined");
|
|
57
|
-
}
|
|
58
|
-
function defaultClearTimeout() {
|
|
59
|
-
throw new Error("clearTimeout has not been defined");
|
|
60
|
-
}
|
|
61
|
-
function runTimeout(fun) {
|
|
62
|
-
if (cachedSetTimeout === setTimeout) {
|
|
63
|
-
return setTimeout(fun, 0);
|
|
64
|
-
}
|
|
65
|
-
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
|
66
|
-
cachedSetTimeout = setTimeout;
|
|
67
|
-
return setTimeout(fun, 0);
|
|
68
|
-
}
|
|
69
|
-
try {
|
|
70
|
-
return cachedSetTimeout(fun, 0);
|
|
71
|
-
} catch (e) {
|
|
72
|
-
try {
|
|
73
|
-
return cachedSetTimeout.call(null, fun, 0);
|
|
74
|
-
} catch (e2) {
|
|
75
|
-
return cachedSetTimeout.call(this, fun, 0);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
function runClearTimeout(marker) {
|
|
80
|
-
if (cachedClearTimeout === clearTimeout) {
|
|
81
|
-
return clearTimeout(marker);
|
|
82
|
-
}
|
|
83
|
-
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
|
84
|
-
cachedClearTimeout = clearTimeout;
|
|
85
|
-
return clearTimeout(marker);
|
|
86
|
-
}
|
|
87
|
-
try {
|
|
88
|
-
return cachedClearTimeout(marker);
|
|
89
|
-
} catch (e) {
|
|
90
|
-
try {
|
|
91
|
-
return cachedClearTimeout.call(null, marker);
|
|
92
|
-
} catch (e2) {
|
|
93
|
-
return cachedClearTimeout.call(this, marker);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
function cleanUpNextTick() {
|
|
98
|
-
if (!draining || !currentQueue) {
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
draining = false;
|
|
102
|
-
if (currentQueue.length) {
|
|
103
|
-
queue = currentQueue.concat(queue);
|
|
104
|
-
} else {
|
|
105
|
-
queueIndex = -1;
|
|
106
|
-
}
|
|
107
|
-
if (queue.length) {
|
|
108
|
-
drainQueue();
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
function drainQueue() {
|
|
112
|
-
if (draining) {
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
var timeout = runTimeout(cleanUpNextTick);
|
|
116
|
-
draining = true;
|
|
117
|
-
var len = queue.length;
|
|
118
|
-
while (len) {
|
|
119
|
-
currentQueue = queue;
|
|
120
|
-
queue = [];
|
|
121
|
-
while (++queueIndex < len) {
|
|
122
|
-
if (currentQueue) {
|
|
123
|
-
currentQueue[queueIndex].run();
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
queueIndex = -1;
|
|
127
|
-
len = queue.length;
|
|
128
|
-
}
|
|
129
|
-
currentQueue = null;
|
|
130
|
-
draining = false;
|
|
131
|
-
runClearTimeout(timeout);
|
|
132
|
-
}
|
|
133
|
-
function nextTick(fun) {
|
|
134
|
-
var args = new Array(arguments.length - 1);
|
|
135
|
-
if (arguments.length > 1) {
|
|
136
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
137
|
-
args[i - 1] = arguments[i];
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
queue.push(new Item(fun, args));
|
|
141
|
-
if (queue.length === 1 && !draining) {
|
|
142
|
-
runTimeout(drainQueue);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
function Item(fun, array) {
|
|
146
|
-
this.fun = fun;
|
|
147
|
-
this.array = array;
|
|
148
|
-
}
|
|
149
|
-
function noop() {
|
|
150
|
-
}
|
|
151
|
-
function binding(name) {
|
|
152
|
-
throw new Error("process.binding is not supported");
|
|
153
|
-
}
|
|
154
|
-
function cwd() {
|
|
155
|
-
return "/";
|
|
156
|
-
}
|
|
157
|
-
function chdir(dir) {
|
|
158
|
-
throw new Error("process.chdir is not supported");
|
|
159
|
-
}
|
|
160
|
-
function umask() {
|
|
161
|
-
return 0;
|
|
162
|
-
}
|
|
163
|
-
function hrtime(previousTimestamp) {
|
|
164
|
-
var clocktime = performanceNow.call(performance) * 1e-3;
|
|
165
|
-
var seconds = Math.floor(clocktime);
|
|
166
|
-
var nanoseconds = Math.floor(clocktime % 1 * 1e9);
|
|
167
|
-
if (previousTimestamp) {
|
|
168
|
-
seconds = seconds - previousTimestamp[0];
|
|
169
|
-
nanoseconds = nanoseconds - previousTimestamp[1];
|
|
170
|
-
if (nanoseconds < 0) {
|
|
171
|
-
seconds--;
|
|
172
|
-
nanoseconds += 1e9;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
return [seconds, nanoseconds];
|
|
176
|
-
}
|
|
177
|
-
function uptime() {
|
|
178
|
-
var currentTime = /* @__PURE__ */ new Date();
|
|
179
|
-
var dif = currentTime - startTime;
|
|
180
|
-
return dif / 1e3;
|
|
181
|
-
}
|
|
182
|
-
var cachedSetTimeout, cachedClearTimeout, queue, draining, currentQueue, queueIndex, title, platform, browser, env, argv, version, versions, release, config, on, addListener, once, off, removeListener, removeAllListeners, emit, performance, performanceNow, startTime, process, defines;
|
|
183
|
-
var init_process = __esm({
|
|
184
|
-
"../../../node_modules/.pnpm/@esbuild-plugins+node-globals-polyfill@0.2.3_esbuild@0.24.0/node_modules/@esbuild-plugins/node-globals-polyfill/process.js"() {
|
|
185
|
-
"use strict";
|
|
186
|
-
cachedSetTimeout = defaultSetTimout;
|
|
187
|
-
cachedClearTimeout = defaultClearTimeout;
|
|
188
|
-
if (typeof globalThis.setTimeout === "function") {
|
|
189
|
-
cachedSetTimeout = setTimeout;
|
|
190
|
-
}
|
|
191
|
-
if (typeof globalThis.clearTimeout === "function") {
|
|
192
|
-
cachedClearTimeout = clearTimeout;
|
|
193
|
-
}
|
|
194
|
-
queue = [];
|
|
195
|
-
draining = false;
|
|
196
|
-
queueIndex = -1;
|
|
197
|
-
Item.prototype.run = function() {
|
|
198
|
-
this.fun.apply(null, this.array);
|
|
199
|
-
};
|
|
200
|
-
title = "browser";
|
|
201
|
-
platform = "browser";
|
|
202
|
-
browser = true;
|
|
203
|
-
env = {};
|
|
204
|
-
argv = [];
|
|
205
|
-
version = "";
|
|
206
|
-
versions = {};
|
|
207
|
-
release = {};
|
|
208
|
-
config = {};
|
|
209
|
-
on = noop;
|
|
210
|
-
addListener = noop;
|
|
211
|
-
once = noop;
|
|
212
|
-
off = noop;
|
|
213
|
-
removeListener = noop;
|
|
214
|
-
removeAllListeners = noop;
|
|
215
|
-
emit = noop;
|
|
216
|
-
performance = globalThis.performance || {};
|
|
217
|
-
performanceNow = performance.now || performance.mozNow || performance.msNow || performance.oNow || performance.webkitNow || function() {
|
|
218
|
-
return (/* @__PURE__ */ new Date()).getTime();
|
|
219
|
-
};
|
|
220
|
-
startTime = /* @__PURE__ */ new Date();
|
|
221
|
-
process = {
|
|
222
|
-
nextTick,
|
|
223
|
-
title,
|
|
224
|
-
browser,
|
|
225
|
-
env,
|
|
226
|
-
argv,
|
|
227
|
-
version,
|
|
228
|
-
versions,
|
|
229
|
-
on,
|
|
230
|
-
addListener,
|
|
231
|
-
once,
|
|
232
|
-
off,
|
|
233
|
-
removeListener,
|
|
234
|
-
removeAllListeners,
|
|
235
|
-
emit,
|
|
236
|
-
binding,
|
|
237
|
-
cwd,
|
|
238
|
-
chdir,
|
|
239
|
-
umask,
|
|
240
|
-
hrtime,
|
|
241
|
-
platform,
|
|
242
|
-
release,
|
|
243
|
-
config,
|
|
244
|
-
uptime
|
|
245
|
-
};
|
|
246
|
-
defines = {};
|
|
247
|
-
Object.keys(defines).forEach((key) => {
|
|
248
|
-
const segs = key.split(".");
|
|
249
|
-
let target = process;
|
|
250
|
-
for (let i = 0; i < segs.length; i++) {
|
|
251
|
-
const seg = segs[i];
|
|
252
|
-
if (i === segs.length - 1) {
|
|
253
|
-
target[seg] = defines[key];
|
|
254
|
-
} else {
|
|
255
|
-
target = target[seg] || (target[seg] = {});
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
});
|
|
261
|
-
|
|
262
|
-
// ../../../node_modules/.pnpm/@esbuild-plugins+node-globals-polyfill@0.2.3_esbuild@0.24.0/node_modules/@esbuild-plugins/node-globals-polyfill/Buffer.js
|
|
263
|
-
function init() {
|
|
264
|
-
inited = true;
|
|
265
|
-
var code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
266
|
-
for (var i = 0, len = code.length; i < len; ++i) {
|
|
267
|
-
lookup[i] = code[i];
|
|
268
|
-
revLookup[code.charCodeAt(i)] = i;
|
|
269
|
-
}
|
|
270
|
-
revLookup["-".charCodeAt(0)] = 62;
|
|
271
|
-
revLookup["_".charCodeAt(0)] = 63;
|
|
272
|
-
}
|
|
273
|
-
function base64toByteArray(b64) {
|
|
274
|
-
if (!inited) {
|
|
275
|
-
init();
|
|
276
|
-
}
|
|
277
|
-
var i, j, l, tmp, placeHolders, arr;
|
|
278
|
-
var len = b64.length;
|
|
279
|
-
if (len % 4 > 0) {
|
|
280
|
-
throw new Error("Invalid string. Length must be a multiple of 4");
|
|
281
|
-
}
|
|
282
|
-
placeHolders = b64[len - 2] === "=" ? 2 : b64[len - 1] === "=" ? 1 : 0;
|
|
283
|
-
arr = new Arr(len * 3 / 4 - placeHolders);
|
|
284
|
-
l = placeHolders > 0 ? len - 4 : len;
|
|
285
|
-
var L = 0;
|
|
286
|
-
for (i = 0, j = 0; i < l; i += 4, j += 3) {
|
|
287
|
-
tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)];
|
|
288
|
-
arr[L++] = tmp >> 16 & 255;
|
|
289
|
-
arr[L++] = tmp >> 8 & 255;
|
|
290
|
-
arr[L++] = tmp & 255;
|
|
291
|
-
}
|
|
292
|
-
if (placeHolders === 2) {
|
|
293
|
-
tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4;
|
|
294
|
-
arr[L++] = tmp & 255;
|
|
295
|
-
} else if (placeHolders === 1) {
|
|
296
|
-
tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2;
|
|
297
|
-
arr[L++] = tmp >> 8 & 255;
|
|
298
|
-
arr[L++] = tmp & 255;
|
|
299
|
-
}
|
|
300
|
-
return arr;
|
|
301
|
-
}
|
|
302
|
-
function tripletToBase64(num) {
|
|
303
|
-
return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63];
|
|
304
|
-
}
|
|
305
|
-
function encodeChunk(uint8, start, end) {
|
|
306
|
-
var tmp;
|
|
307
|
-
var output = [];
|
|
308
|
-
for (var i = start; i < end; i += 3) {
|
|
309
|
-
tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + uint8[i + 2];
|
|
310
|
-
output.push(tripletToBase64(tmp));
|
|
311
|
-
}
|
|
312
|
-
return output.join("");
|
|
313
|
-
}
|
|
314
|
-
function base64fromByteArray(uint8) {
|
|
315
|
-
if (!inited) {
|
|
316
|
-
init();
|
|
317
|
-
}
|
|
318
|
-
var tmp;
|
|
319
|
-
var len = uint8.length;
|
|
320
|
-
var extraBytes = len % 3;
|
|
321
|
-
var output = "";
|
|
322
|
-
var parts = [];
|
|
323
|
-
var maxChunkLength = 16383;
|
|
324
|
-
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
|
|
325
|
-
parts.push(
|
|
326
|
-
encodeChunk(
|
|
327
|
-
uint8,
|
|
328
|
-
i,
|
|
329
|
-
i + maxChunkLength > len2 ? len2 : i + maxChunkLength
|
|
330
|
-
)
|
|
331
|
-
);
|
|
332
|
-
}
|
|
333
|
-
if (extraBytes === 1) {
|
|
334
|
-
tmp = uint8[len - 1];
|
|
335
|
-
output += lookup[tmp >> 2];
|
|
336
|
-
output += lookup[tmp << 4 & 63];
|
|
337
|
-
output += "==";
|
|
338
|
-
} else if (extraBytes === 2) {
|
|
339
|
-
tmp = (uint8[len - 2] << 8) + uint8[len - 1];
|
|
340
|
-
output += lookup[tmp >> 10];
|
|
341
|
-
output += lookup[tmp >> 4 & 63];
|
|
342
|
-
output += lookup[tmp << 2 & 63];
|
|
343
|
-
output += "=";
|
|
344
|
-
}
|
|
345
|
-
parts.push(output);
|
|
346
|
-
return parts.join("");
|
|
347
|
-
}
|
|
348
|
-
function kMaxLength() {
|
|
349
|
-
return Buffer2.TYPED_ARRAY_SUPPORT ? 2147483647 : 1073741823;
|
|
350
|
-
}
|
|
351
|
-
function createBuffer(that, length) {
|
|
352
|
-
if (kMaxLength() < length) {
|
|
353
|
-
throw new RangeError("Invalid typed array length");
|
|
354
|
-
}
|
|
355
|
-
if (Buffer2.TYPED_ARRAY_SUPPORT) {
|
|
356
|
-
that = new Uint8Array(length);
|
|
357
|
-
that.__proto__ = Buffer2.prototype;
|
|
358
|
-
} else {
|
|
359
|
-
if (that === null) {
|
|
360
|
-
that = new Buffer2(length);
|
|
361
|
-
}
|
|
362
|
-
that.length = length;
|
|
363
|
-
}
|
|
364
|
-
return that;
|
|
365
|
-
}
|
|
366
|
-
function Buffer2(arg, encodingOrOffset, length) {
|
|
367
|
-
if (!Buffer2.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer2)) {
|
|
368
|
-
return new Buffer2(arg, encodingOrOffset, length);
|
|
369
|
-
}
|
|
370
|
-
if (typeof arg === "number") {
|
|
371
|
-
if (typeof encodingOrOffset === "string") {
|
|
372
|
-
throw new Error(
|
|
373
|
-
"If encoding is specified then the first argument must be a string"
|
|
374
|
-
);
|
|
375
|
-
}
|
|
376
|
-
return allocUnsafe(this, arg);
|
|
377
|
-
}
|
|
378
|
-
return from(this, arg, encodingOrOffset, length);
|
|
379
|
-
}
|
|
380
|
-
function from(that, value, encodingOrOffset, length) {
|
|
381
|
-
if (typeof value === "number") {
|
|
382
|
-
throw new TypeError('"value" argument must not be a number');
|
|
383
|
-
}
|
|
384
|
-
if (typeof ArrayBuffer !== "undefined" && value instanceof ArrayBuffer) {
|
|
385
|
-
return fromArrayBuffer(that, value, encodingOrOffset, length);
|
|
386
|
-
}
|
|
387
|
-
if (typeof value === "string") {
|
|
388
|
-
return fromString(that, value, encodingOrOffset);
|
|
389
|
-
}
|
|
390
|
-
return fromObject(that, value);
|
|
391
|
-
}
|
|
392
|
-
function assertSize(size) {
|
|
393
|
-
if (typeof size !== "number") {
|
|
394
|
-
throw new TypeError('"size" argument must be a number');
|
|
395
|
-
} else if (size < 0) {
|
|
396
|
-
throw new RangeError('"size" argument must not be negative');
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
function alloc(that, size, fill2, encoding) {
|
|
400
|
-
assertSize(size);
|
|
401
|
-
if (size <= 0) {
|
|
402
|
-
return createBuffer(that, size);
|
|
403
|
-
}
|
|
404
|
-
if (fill2 !== void 0) {
|
|
405
|
-
return typeof encoding === "string" ? createBuffer(that, size).fill(fill2, encoding) : createBuffer(that, size).fill(fill2);
|
|
406
|
-
}
|
|
407
|
-
return createBuffer(that, size);
|
|
408
|
-
}
|
|
409
|
-
function allocUnsafe(that, size) {
|
|
410
|
-
assertSize(size);
|
|
411
|
-
that = createBuffer(that, size < 0 ? 0 : checked(size) | 0);
|
|
412
|
-
if (!Buffer2.TYPED_ARRAY_SUPPORT) {
|
|
413
|
-
for (var i = 0; i < size; ++i) {
|
|
414
|
-
that[i] = 0;
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
return that;
|
|
418
|
-
}
|
|
419
|
-
function fromString(that, string, encoding) {
|
|
420
|
-
if (typeof encoding !== "string" || encoding === "") {
|
|
421
|
-
encoding = "utf8";
|
|
422
|
-
}
|
|
423
|
-
if (!Buffer2.isEncoding(encoding)) {
|
|
424
|
-
throw new TypeError('"encoding" must be a valid string encoding');
|
|
425
|
-
}
|
|
426
|
-
var length = byteLength(string, encoding) | 0;
|
|
427
|
-
that = createBuffer(that, length);
|
|
428
|
-
var actual = that.write(string, encoding);
|
|
429
|
-
if (actual !== length) {
|
|
430
|
-
that = that.slice(0, actual);
|
|
431
|
-
}
|
|
432
|
-
return that;
|
|
433
|
-
}
|
|
434
|
-
function fromArrayLike(that, array) {
|
|
435
|
-
var length = array.length < 0 ? 0 : checked(array.length) | 0;
|
|
436
|
-
that = createBuffer(that, length);
|
|
437
|
-
for (var i = 0; i < length; i += 1) {
|
|
438
|
-
that[i] = array[i] & 255;
|
|
439
|
-
}
|
|
440
|
-
return that;
|
|
441
|
-
}
|
|
442
|
-
function fromArrayBuffer(that, array, byteOffset, length) {
|
|
443
|
-
array.byteLength;
|
|
444
|
-
if (byteOffset < 0 || array.byteLength < byteOffset) {
|
|
445
|
-
throw new RangeError("'offset' is out of bounds");
|
|
446
|
-
}
|
|
447
|
-
if (array.byteLength < byteOffset + (length || 0)) {
|
|
448
|
-
throw new RangeError("'length' is out of bounds");
|
|
449
|
-
}
|
|
450
|
-
if (byteOffset === void 0 && length === void 0) {
|
|
451
|
-
array = new Uint8Array(array);
|
|
452
|
-
} else if (length === void 0) {
|
|
453
|
-
array = new Uint8Array(array, byteOffset);
|
|
454
|
-
} else {
|
|
455
|
-
array = new Uint8Array(array, byteOffset, length);
|
|
456
|
-
}
|
|
457
|
-
if (Buffer2.TYPED_ARRAY_SUPPORT) {
|
|
458
|
-
that = array;
|
|
459
|
-
that.__proto__ = Buffer2.prototype;
|
|
460
|
-
} else {
|
|
461
|
-
that = fromArrayLike(that, array);
|
|
462
|
-
}
|
|
463
|
-
return that;
|
|
464
|
-
}
|
|
465
|
-
function fromObject(that, obj) {
|
|
466
|
-
if (internalIsBuffer(obj)) {
|
|
467
|
-
var len = checked(obj.length) | 0;
|
|
468
|
-
that = createBuffer(that, len);
|
|
469
|
-
if (that.length === 0) {
|
|
470
|
-
return that;
|
|
471
|
-
}
|
|
472
|
-
obj.copy(that, 0, 0, len);
|
|
473
|
-
return that;
|
|
474
|
-
}
|
|
475
|
-
if (obj) {
|
|
476
|
-
if (typeof ArrayBuffer !== "undefined" && obj.buffer instanceof ArrayBuffer || "length" in obj) {
|
|
477
|
-
if (typeof obj.length !== "number" || isnan(obj.length)) {
|
|
478
|
-
return createBuffer(that, 0);
|
|
479
|
-
}
|
|
480
|
-
return fromArrayLike(that, obj);
|
|
481
|
-
}
|
|
482
|
-
if (obj.type === "Buffer" && Array.isArray(obj.data)) {
|
|
483
|
-
return fromArrayLike(that, obj.data);
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
throw new TypeError(
|
|
487
|
-
"First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object."
|
|
488
|
-
);
|
|
489
|
-
}
|
|
490
|
-
function checked(length) {
|
|
491
|
-
if (length >= kMaxLength()) {
|
|
492
|
-
throw new RangeError(
|
|
493
|
-
"Attempt to allocate Buffer larger than maximum size: 0x" + kMaxLength().toString(16) + " bytes"
|
|
494
|
-
);
|
|
495
|
-
}
|
|
496
|
-
return length | 0;
|
|
497
|
-
}
|
|
498
|
-
function internalIsBuffer(b) {
|
|
499
|
-
return !!(b != null && b._isBuffer);
|
|
500
|
-
}
|
|
501
|
-
function byteLength(string, encoding) {
|
|
502
|
-
if (internalIsBuffer(string)) {
|
|
503
|
-
return string.length;
|
|
504
|
-
}
|
|
505
|
-
if (typeof ArrayBuffer !== "undefined" && typeof ArrayBuffer.isView === "function" && (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
|
|
506
|
-
return string.byteLength;
|
|
507
|
-
}
|
|
508
|
-
if (typeof string !== "string") {
|
|
509
|
-
string = "" + string;
|
|
510
|
-
}
|
|
511
|
-
var len = string.length;
|
|
512
|
-
if (len === 0) return 0;
|
|
513
|
-
var loweredCase = false;
|
|
514
|
-
for (; ; ) {
|
|
515
|
-
switch (encoding) {
|
|
516
|
-
case "ascii":
|
|
517
|
-
case "latin1":
|
|
518
|
-
case "binary":
|
|
519
|
-
return len;
|
|
520
|
-
case "utf8":
|
|
521
|
-
case "utf-8":
|
|
522
|
-
case void 0:
|
|
523
|
-
return utf8ToBytes(string).length;
|
|
524
|
-
case "ucs2":
|
|
525
|
-
case "ucs-2":
|
|
526
|
-
case "utf16le":
|
|
527
|
-
case "utf-16le":
|
|
528
|
-
return len * 2;
|
|
529
|
-
case "hex":
|
|
530
|
-
return len >>> 1;
|
|
531
|
-
case "base64":
|
|
532
|
-
return base64ToBytes(string).length;
|
|
533
|
-
default:
|
|
534
|
-
if (loweredCase) return utf8ToBytes(string).length;
|
|
535
|
-
encoding = ("" + encoding).toLowerCase();
|
|
536
|
-
loweredCase = true;
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
function slowToString(encoding, start, end) {
|
|
541
|
-
var loweredCase = false;
|
|
542
|
-
if (start === void 0 || start < 0) {
|
|
543
|
-
start = 0;
|
|
544
|
-
}
|
|
545
|
-
if (start > this.length) {
|
|
546
|
-
return "";
|
|
547
|
-
}
|
|
548
|
-
if (end === void 0 || end > this.length) {
|
|
549
|
-
end = this.length;
|
|
550
|
-
}
|
|
551
|
-
if (end <= 0) {
|
|
552
|
-
return "";
|
|
553
|
-
}
|
|
554
|
-
end >>>= 0;
|
|
555
|
-
start >>>= 0;
|
|
556
|
-
if (end <= start) {
|
|
557
|
-
return "";
|
|
558
|
-
}
|
|
559
|
-
if (!encoding) encoding = "utf8";
|
|
560
|
-
while (true) {
|
|
561
|
-
switch (encoding) {
|
|
562
|
-
case "hex":
|
|
563
|
-
return hexSlice(this, start, end);
|
|
564
|
-
case "utf8":
|
|
565
|
-
case "utf-8":
|
|
566
|
-
return utf8Slice(this, start, end);
|
|
567
|
-
case "ascii":
|
|
568
|
-
return asciiSlice(this, start, end);
|
|
569
|
-
case "latin1":
|
|
570
|
-
case "binary":
|
|
571
|
-
return latin1Slice(this, start, end);
|
|
572
|
-
case "base64":
|
|
573
|
-
return base64Slice(this, start, end);
|
|
574
|
-
case "ucs2":
|
|
575
|
-
case "ucs-2":
|
|
576
|
-
case "utf16le":
|
|
577
|
-
case "utf-16le":
|
|
578
|
-
return utf16leSlice(this, start, end);
|
|
579
|
-
default:
|
|
580
|
-
if (loweredCase)
|
|
581
|
-
throw new TypeError("Unknown encoding: " + encoding);
|
|
582
|
-
encoding = (encoding + "").toLowerCase();
|
|
583
|
-
loweredCase = true;
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
function swap(b, n, m) {
|
|
588
|
-
var i = b[n];
|
|
589
|
-
b[n] = b[m];
|
|
590
|
-
b[m] = i;
|
|
591
|
-
}
|
|
592
|
-
function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
|
|
593
|
-
if (buffer.length === 0) return -1;
|
|
594
|
-
if (typeof byteOffset === "string") {
|
|
595
|
-
encoding = byteOffset;
|
|
596
|
-
byteOffset = 0;
|
|
597
|
-
} else if (byteOffset > 2147483647) {
|
|
598
|
-
byteOffset = 2147483647;
|
|
599
|
-
} else if (byteOffset < -2147483648) {
|
|
600
|
-
byteOffset = -2147483648;
|
|
601
|
-
}
|
|
602
|
-
byteOffset = +byteOffset;
|
|
603
|
-
if (isNaN(byteOffset)) {
|
|
604
|
-
byteOffset = dir ? 0 : buffer.length - 1;
|
|
605
|
-
}
|
|
606
|
-
if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
|
|
607
|
-
if (byteOffset >= buffer.length) {
|
|
608
|
-
if (dir) return -1;
|
|
609
|
-
else byteOffset = buffer.length - 1;
|
|
610
|
-
} else if (byteOffset < 0) {
|
|
611
|
-
if (dir) byteOffset = 0;
|
|
612
|
-
else return -1;
|
|
613
|
-
}
|
|
614
|
-
if (typeof val === "string") {
|
|
615
|
-
val = Buffer2.from(val, encoding);
|
|
616
|
-
}
|
|
617
|
-
if (internalIsBuffer(val)) {
|
|
618
|
-
if (val.length === 0) {
|
|
619
|
-
return -1;
|
|
620
|
-
}
|
|
621
|
-
return arrayIndexOf(buffer, val, byteOffset, encoding, dir);
|
|
622
|
-
} else if (typeof val === "number") {
|
|
623
|
-
val = val & 255;
|
|
624
|
-
if (Buffer2.TYPED_ARRAY_SUPPORT && typeof Uint8Array.prototype.indexOf === "function") {
|
|
625
|
-
if (dir) {
|
|
626
|
-
return Uint8Array.prototype.indexOf.call(
|
|
627
|
-
buffer,
|
|
628
|
-
val,
|
|
629
|
-
byteOffset
|
|
630
|
-
);
|
|
631
|
-
} else {
|
|
632
|
-
return Uint8Array.prototype.lastIndexOf.call(
|
|
633
|
-
buffer,
|
|
634
|
-
val,
|
|
635
|
-
byteOffset
|
|
636
|
-
);
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
return arrayIndexOf(buffer, [val], byteOffset, encoding, dir);
|
|
640
|
-
}
|
|
641
|
-
throw new TypeError("val must be string, number or Buffer");
|
|
642
|
-
}
|
|
643
|
-
function arrayIndexOf(arr, val, byteOffset, encoding, dir) {
|
|
644
|
-
var indexSize = 1;
|
|
645
|
-
var arrLength = arr.length;
|
|
646
|
-
var valLength = val.length;
|
|
647
|
-
if (encoding !== void 0) {
|
|
648
|
-
encoding = String(encoding).toLowerCase();
|
|
649
|
-
if (encoding === "ucs2" || encoding === "ucs-2" || encoding === "utf16le" || encoding === "utf-16le") {
|
|
650
|
-
if (arr.length < 2 || val.length < 2) {
|
|
651
|
-
return -1;
|
|
652
|
-
}
|
|
653
|
-
indexSize = 2;
|
|
654
|
-
arrLength /= 2;
|
|
655
|
-
valLength /= 2;
|
|
656
|
-
byteOffset /= 2;
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
function read(buf, i2) {
|
|
660
|
-
if (indexSize === 1) {
|
|
661
|
-
return buf[i2];
|
|
662
|
-
} else {
|
|
663
|
-
return buf.readUInt16BE(i2 * indexSize);
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
var i;
|
|
667
|
-
if (dir) {
|
|
668
|
-
var foundIndex = -1;
|
|
669
|
-
for (i = byteOffset; i < arrLength; i++) {
|
|
670
|
-
if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
|
|
671
|
-
if (foundIndex === -1) foundIndex = i;
|
|
672
|
-
if (i - foundIndex + 1 === valLength)
|
|
673
|
-
return foundIndex * indexSize;
|
|
674
|
-
} else {
|
|
675
|
-
if (foundIndex !== -1) i -= i - foundIndex;
|
|
676
|
-
foundIndex = -1;
|
|
677
|
-
}
|
|
678
|
-
}
|
|
679
|
-
} else {
|
|
680
|
-
if (byteOffset + valLength > arrLength)
|
|
681
|
-
byteOffset = arrLength - valLength;
|
|
682
|
-
for (i = byteOffset; i >= 0; i--) {
|
|
683
|
-
var found = true;
|
|
684
|
-
for (var j = 0; j < valLength; j++) {
|
|
685
|
-
if (read(arr, i + j) !== read(val, j)) {
|
|
686
|
-
found = false;
|
|
687
|
-
break;
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
if (found) return i;
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
return -1;
|
|
694
|
-
}
|
|
695
|
-
function hexWrite(buf, string, offset, length) {
|
|
696
|
-
offset = Number(offset) || 0;
|
|
697
|
-
var remaining = buf.length - offset;
|
|
698
|
-
if (!length) {
|
|
699
|
-
length = remaining;
|
|
700
|
-
} else {
|
|
701
|
-
length = Number(length);
|
|
702
|
-
if (length > remaining) {
|
|
703
|
-
length = remaining;
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
var strLen = string.length;
|
|
707
|
-
if (strLen % 2 !== 0) throw new TypeError("Invalid hex string");
|
|
708
|
-
if (length > strLen / 2) {
|
|
709
|
-
length = strLen / 2;
|
|
710
|
-
}
|
|
711
|
-
for (var i = 0; i < length; ++i) {
|
|
712
|
-
var parsed = parseInt(string.substr(i * 2, 2), 16);
|
|
713
|
-
if (isNaN(parsed)) return i;
|
|
714
|
-
buf[offset + i] = parsed;
|
|
715
|
-
}
|
|
716
|
-
return i;
|
|
717
|
-
}
|
|
718
|
-
function utf8Write(buf, string, offset, length) {
|
|
719
|
-
return blitBuffer(
|
|
720
|
-
utf8ToBytes(string, buf.length - offset),
|
|
721
|
-
buf,
|
|
722
|
-
offset,
|
|
723
|
-
length
|
|
724
|
-
);
|
|
725
|
-
}
|
|
726
|
-
function asciiWrite(buf, string, offset, length) {
|
|
727
|
-
return blitBuffer(asciiToBytes(string), buf, offset, length);
|
|
728
|
-
}
|
|
729
|
-
function latin1Write(buf, string, offset, length) {
|
|
730
|
-
return asciiWrite(buf, string, offset, length);
|
|
731
|
-
}
|
|
732
|
-
function base64Write(buf, string, offset, length) {
|
|
733
|
-
return blitBuffer(base64ToBytes(string), buf, offset, length);
|
|
734
|
-
}
|
|
735
|
-
function ucs2Write(buf, string, offset, length) {
|
|
736
|
-
return blitBuffer(
|
|
737
|
-
utf16leToBytes(string, buf.length - offset),
|
|
738
|
-
buf,
|
|
739
|
-
offset,
|
|
740
|
-
length
|
|
741
|
-
);
|
|
742
|
-
}
|
|
743
|
-
function base64Slice(buf, start, end) {
|
|
744
|
-
if (start === 0 && end === buf.length) {
|
|
745
|
-
return base64fromByteArray(buf);
|
|
746
|
-
} else {
|
|
747
|
-
return base64fromByteArray(buf.slice(start, end));
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
function utf8Slice(buf, start, end) {
|
|
751
|
-
end = Math.min(buf.length, end);
|
|
752
|
-
var res = [];
|
|
753
|
-
var i = start;
|
|
754
|
-
while (i < end) {
|
|
755
|
-
var firstByte = buf[i];
|
|
756
|
-
var codePoint = null;
|
|
757
|
-
var bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1;
|
|
758
|
-
if (i + bytesPerSequence <= end) {
|
|
759
|
-
var secondByte, thirdByte, fourthByte, tempCodePoint;
|
|
760
|
-
switch (bytesPerSequence) {
|
|
761
|
-
case 1:
|
|
762
|
-
if (firstByte < 128) {
|
|
763
|
-
codePoint = firstByte;
|
|
764
|
-
}
|
|
765
|
-
break;
|
|
766
|
-
case 2:
|
|
767
|
-
secondByte = buf[i + 1];
|
|
768
|
-
if ((secondByte & 192) === 128) {
|
|
769
|
-
tempCodePoint = (firstByte & 31) << 6 | secondByte & 63;
|
|
770
|
-
if (tempCodePoint > 127) {
|
|
771
|
-
codePoint = tempCodePoint;
|
|
772
|
-
}
|
|
773
|
-
}
|
|
774
|
-
break;
|
|
775
|
-
case 3:
|
|
776
|
-
secondByte = buf[i + 1];
|
|
777
|
-
thirdByte = buf[i + 2];
|
|
778
|
-
if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) {
|
|
779
|
-
tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63;
|
|
780
|
-
if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) {
|
|
781
|
-
codePoint = tempCodePoint;
|
|
782
|
-
}
|
|
783
|
-
}
|
|
784
|
-
break;
|
|
785
|
-
case 4:
|
|
786
|
-
secondByte = buf[i + 1];
|
|
787
|
-
thirdByte = buf[i + 2];
|
|
788
|
-
fourthByte = buf[i + 3];
|
|
789
|
-
if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) {
|
|
790
|
-
tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63;
|
|
791
|
-
if (tempCodePoint > 65535 && tempCodePoint < 1114112) {
|
|
792
|
-
codePoint = tempCodePoint;
|
|
793
|
-
}
|
|
794
|
-
}
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
|
-
if (codePoint === null) {
|
|
798
|
-
codePoint = 65533;
|
|
799
|
-
bytesPerSequence = 1;
|
|
800
|
-
} else if (codePoint > 65535) {
|
|
801
|
-
codePoint -= 65536;
|
|
802
|
-
res.push(codePoint >>> 10 & 1023 | 55296);
|
|
803
|
-
codePoint = 56320 | codePoint & 1023;
|
|
804
|
-
}
|
|
805
|
-
res.push(codePoint);
|
|
806
|
-
i += bytesPerSequence;
|
|
807
|
-
}
|
|
808
|
-
return decodeCodePointsArray(res);
|
|
809
|
-
}
|
|
810
|
-
function decodeCodePointsArray(codePoints) {
|
|
811
|
-
var len = codePoints.length;
|
|
812
|
-
if (len <= MAX_ARGUMENTS_LENGTH) {
|
|
813
|
-
return String.fromCharCode.apply(String, codePoints);
|
|
814
|
-
}
|
|
815
|
-
var res = "";
|
|
816
|
-
var i = 0;
|
|
817
|
-
while (i < len) {
|
|
818
|
-
res += String.fromCharCode.apply(
|
|
819
|
-
String,
|
|
820
|
-
codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
|
|
821
|
-
);
|
|
822
|
-
}
|
|
823
|
-
return res;
|
|
824
|
-
}
|
|
825
|
-
function asciiSlice(buf, start, end) {
|
|
826
|
-
var ret = "";
|
|
827
|
-
end = Math.min(buf.length, end);
|
|
828
|
-
for (var i = start; i < end; ++i) {
|
|
829
|
-
ret += String.fromCharCode(buf[i] & 127);
|
|
830
|
-
}
|
|
831
|
-
return ret;
|
|
832
|
-
}
|
|
833
|
-
function latin1Slice(buf, start, end) {
|
|
834
|
-
var ret = "";
|
|
835
|
-
end = Math.min(buf.length, end);
|
|
836
|
-
for (var i = start; i < end; ++i) {
|
|
837
|
-
ret += String.fromCharCode(buf[i]);
|
|
838
|
-
}
|
|
839
|
-
return ret;
|
|
840
|
-
}
|
|
841
|
-
function hexSlice(buf, start, end) {
|
|
842
|
-
var len = buf.length;
|
|
843
|
-
if (!start || start < 0) start = 0;
|
|
844
|
-
if (!end || end < 0 || end > len) end = len;
|
|
845
|
-
var out = "";
|
|
846
|
-
for (var i = start; i < end; ++i) {
|
|
847
|
-
out += toHex(buf[i]);
|
|
848
|
-
}
|
|
849
|
-
return out;
|
|
850
|
-
}
|
|
851
|
-
function utf16leSlice(buf, start, end) {
|
|
852
|
-
var bytes = buf.slice(start, end);
|
|
853
|
-
var res = "";
|
|
854
|
-
for (var i = 0; i < bytes.length; i += 2) {
|
|
855
|
-
res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
|
|
856
|
-
}
|
|
857
|
-
return res;
|
|
858
|
-
}
|
|
859
|
-
function checkOffset(offset, ext, length) {
|
|
860
|
-
if (offset % 1 !== 0 || offset < 0)
|
|
861
|
-
throw new RangeError("offset is not uint");
|
|
862
|
-
if (offset + ext > length)
|
|
863
|
-
throw new RangeError("Trying to access beyond buffer length");
|
|
864
|
-
}
|
|
865
|
-
function checkInt(buf, value, offset, ext, max, min) {
|
|
866
|
-
if (!internalIsBuffer(buf))
|
|
867
|
-
throw new TypeError('"buffer" argument must be a Buffer instance');
|
|
868
|
-
if (value > max || value < min)
|
|
869
|
-
throw new RangeError('"value" argument is out of bounds');
|
|
870
|
-
if (offset + ext > buf.length) throw new RangeError("Index out of range");
|
|
871
|
-
}
|
|
872
|
-
function objectWriteUInt16(buf, value, offset, littleEndian) {
|
|
873
|
-
if (value < 0) value = 65535 + value + 1;
|
|
874
|
-
for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
|
|
875
|
-
buf[offset + i] = (value & 255 << 8 * (littleEndian ? i : 1 - i)) >>> (littleEndian ? i : 1 - i) * 8;
|
|
876
|
-
}
|
|
877
|
-
}
|
|
878
|
-
function objectWriteUInt32(buf, value, offset, littleEndian) {
|
|
879
|
-
if (value < 0) value = 4294967295 + value + 1;
|
|
880
|
-
for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
|
|
881
|
-
buf[offset + i] = value >>> (littleEndian ? i : 3 - i) * 8 & 255;
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
function checkIEEE754(buf, value, offset, ext, max, min) {
|
|
885
|
-
if (offset + ext > buf.length) throw new RangeError("Index out of range");
|
|
886
|
-
if (offset < 0) throw new RangeError("Index out of range");
|
|
887
|
-
}
|
|
888
|
-
function writeFloat(buf, value, offset, littleEndian, noAssert) {
|
|
889
|
-
if (!noAssert) {
|
|
890
|
-
checkIEEE754(
|
|
891
|
-
buf,
|
|
892
|
-
value,
|
|
893
|
-
offset,
|
|
894
|
-
4,
|
|
895
|
-
34028234663852886e22,
|
|
896
|
-
-34028234663852886e22
|
|
897
|
-
);
|
|
898
|
-
}
|
|
899
|
-
ieee754write(buf, value, offset, littleEndian, 23, 4);
|
|
900
|
-
return offset + 4;
|
|
901
|
-
}
|
|
902
|
-
function writeDouble(buf, value, offset, littleEndian, noAssert) {
|
|
903
|
-
if (!noAssert) {
|
|
904
|
-
checkIEEE754(
|
|
905
|
-
buf,
|
|
906
|
-
value,
|
|
907
|
-
offset,
|
|
908
|
-
8,
|
|
909
|
-
17976931348623157e292,
|
|
910
|
-
-17976931348623157e292
|
|
911
|
-
);
|
|
912
|
-
}
|
|
913
|
-
ieee754write(buf, value, offset, littleEndian, 52, 8);
|
|
914
|
-
return offset + 8;
|
|
915
|
-
}
|
|
916
|
-
function base64clean(str) {
|
|
917
|
-
str = stringtrim(str).replace(INVALID_BASE64_RE, "");
|
|
918
|
-
if (str.length < 2) return "";
|
|
919
|
-
while (str.length % 4 !== 0) {
|
|
920
|
-
str = str + "=";
|
|
921
|
-
}
|
|
922
|
-
return str;
|
|
923
|
-
}
|
|
924
|
-
function stringtrim(str) {
|
|
925
|
-
if (str.trim) return str.trim();
|
|
926
|
-
return str.replace(/^\s+|\s+$/g, "");
|
|
927
|
-
}
|
|
928
|
-
function toHex(n) {
|
|
929
|
-
if (n < 16) return "0" + n.toString(16);
|
|
930
|
-
return n.toString(16);
|
|
931
|
-
}
|
|
932
|
-
function utf8ToBytes(string, units) {
|
|
933
|
-
units = units || Infinity;
|
|
934
|
-
var codePoint;
|
|
935
|
-
var length = string.length;
|
|
936
|
-
var leadSurrogate = null;
|
|
937
|
-
var bytes = [];
|
|
938
|
-
for (var i = 0; i < length; ++i) {
|
|
939
|
-
codePoint = string.charCodeAt(i);
|
|
940
|
-
if (codePoint > 55295 && codePoint < 57344) {
|
|
941
|
-
if (!leadSurrogate) {
|
|
942
|
-
if (codePoint > 56319) {
|
|
943
|
-
if ((units -= 3) > -1) bytes.push(239, 191, 189);
|
|
944
|
-
continue;
|
|
945
|
-
} else if (i + 1 === length) {
|
|
946
|
-
if ((units -= 3) > -1) bytes.push(239, 191, 189);
|
|
947
|
-
continue;
|
|
948
|
-
}
|
|
949
|
-
leadSurrogate = codePoint;
|
|
950
|
-
continue;
|
|
951
|
-
}
|
|
952
|
-
if (codePoint < 56320) {
|
|
953
|
-
if ((units -= 3) > -1) bytes.push(239, 191, 189);
|
|
954
|
-
leadSurrogate = codePoint;
|
|
955
|
-
continue;
|
|
956
|
-
}
|
|
957
|
-
codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536;
|
|
958
|
-
} else if (leadSurrogate) {
|
|
959
|
-
if ((units -= 3) > -1) bytes.push(239, 191, 189);
|
|
960
|
-
}
|
|
961
|
-
leadSurrogate = null;
|
|
962
|
-
if (codePoint < 128) {
|
|
963
|
-
if ((units -= 1) < 0) break;
|
|
964
|
-
bytes.push(codePoint);
|
|
965
|
-
} else if (codePoint < 2048) {
|
|
966
|
-
if ((units -= 2) < 0) break;
|
|
967
|
-
bytes.push(codePoint >> 6 | 192, codePoint & 63 | 128);
|
|
968
|
-
} else if (codePoint < 65536) {
|
|
969
|
-
if ((units -= 3) < 0) break;
|
|
970
|
-
bytes.push(
|
|
971
|
-
codePoint >> 12 | 224,
|
|
972
|
-
codePoint >> 6 & 63 | 128,
|
|
973
|
-
codePoint & 63 | 128
|
|
974
|
-
);
|
|
975
|
-
} else if (codePoint < 1114112) {
|
|
976
|
-
if ((units -= 4) < 0) break;
|
|
977
|
-
bytes.push(
|
|
978
|
-
codePoint >> 18 | 240,
|
|
979
|
-
codePoint >> 12 & 63 | 128,
|
|
980
|
-
codePoint >> 6 & 63 | 128,
|
|
981
|
-
codePoint & 63 | 128
|
|
982
|
-
);
|
|
983
|
-
} else {
|
|
984
|
-
throw new Error("Invalid code point");
|
|
985
|
-
}
|
|
986
|
-
}
|
|
987
|
-
return bytes;
|
|
988
|
-
}
|
|
989
|
-
function asciiToBytes(str) {
|
|
990
|
-
var byteArray = [];
|
|
991
|
-
for (var i = 0; i < str.length; ++i) {
|
|
992
|
-
byteArray.push(str.charCodeAt(i) & 255);
|
|
993
|
-
}
|
|
994
|
-
return byteArray;
|
|
995
|
-
}
|
|
996
|
-
function utf16leToBytes(str, units) {
|
|
997
|
-
var c, hi, lo;
|
|
998
|
-
var byteArray = [];
|
|
999
|
-
for (var i = 0; i < str.length; ++i) {
|
|
1000
|
-
if ((units -= 2) < 0) break;
|
|
1001
|
-
c = str.charCodeAt(i);
|
|
1002
|
-
hi = c >> 8;
|
|
1003
|
-
lo = c % 256;
|
|
1004
|
-
byteArray.push(lo);
|
|
1005
|
-
byteArray.push(hi);
|
|
1006
|
-
}
|
|
1007
|
-
return byteArray;
|
|
1008
|
-
}
|
|
1009
|
-
function base64ToBytes(str) {
|
|
1010
|
-
return base64toByteArray(base64clean(str));
|
|
1011
|
-
}
|
|
1012
|
-
function blitBuffer(src, dst, offset, length) {
|
|
1013
|
-
for (var i = 0; i < length; ++i) {
|
|
1014
|
-
if (i + offset >= dst.length || i >= src.length) break;
|
|
1015
|
-
dst[i + offset] = src[i];
|
|
1016
|
-
}
|
|
1017
|
-
return i;
|
|
1018
|
-
}
|
|
1019
|
-
function isnan(val) {
|
|
1020
|
-
return val !== val;
|
|
1021
|
-
}
|
|
1022
|
-
function isBuffer(obj) {
|
|
1023
|
-
return obj != null && (!!obj._isBuffer || isFastBuffer(obj) || isSlowBuffer(obj));
|
|
1024
|
-
}
|
|
1025
|
-
function isFastBuffer(obj) {
|
|
1026
|
-
return !!obj.constructor && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj);
|
|
1027
|
-
}
|
|
1028
|
-
function isSlowBuffer(obj) {
|
|
1029
|
-
return typeof obj.readFloatLE === "function" && typeof obj.slice === "function" && isFastBuffer(obj.slice(0, 0));
|
|
1030
|
-
}
|
|
1031
|
-
function ieee754read(buffer, offset, isLE, mLen, nBytes) {
|
|
1032
|
-
var e, m;
|
|
1033
|
-
var eLen = nBytes * 8 - mLen - 1;
|
|
1034
|
-
var eMax = (1 << eLen) - 1;
|
|
1035
|
-
var eBias = eMax >> 1;
|
|
1036
|
-
var nBits = -7;
|
|
1037
|
-
var i = isLE ? nBytes - 1 : 0;
|
|
1038
|
-
var d = isLE ? -1 : 1;
|
|
1039
|
-
var s = buffer[offset + i];
|
|
1040
|
-
i += d;
|
|
1041
|
-
e = s & (1 << -nBits) - 1;
|
|
1042
|
-
s >>= -nBits;
|
|
1043
|
-
nBits += eLen;
|
|
1044
|
-
for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {
|
|
1045
|
-
}
|
|
1046
|
-
m = e & (1 << -nBits) - 1;
|
|
1047
|
-
e >>= -nBits;
|
|
1048
|
-
nBits += mLen;
|
|
1049
|
-
for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {
|
|
1050
|
-
}
|
|
1051
|
-
if (e === 0) {
|
|
1052
|
-
e = 1 - eBias;
|
|
1053
|
-
} else if (e === eMax) {
|
|
1054
|
-
return m ? NaN : (s ? -1 : 1) * Infinity;
|
|
1055
|
-
} else {
|
|
1056
|
-
m = m + Math.pow(2, mLen);
|
|
1057
|
-
e = e - eBias;
|
|
1058
|
-
}
|
|
1059
|
-
return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
|
|
1060
|
-
}
|
|
1061
|
-
function ieee754write(buffer, value, offset, isLE, mLen, nBytes) {
|
|
1062
|
-
var e, m, c;
|
|
1063
|
-
var eLen = nBytes * 8 - mLen - 1;
|
|
1064
|
-
var eMax = (1 << eLen) - 1;
|
|
1065
|
-
var eBias = eMax >> 1;
|
|
1066
|
-
var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
|
|
1067
|
-
var i = isLE ? 0 : nBytes - 1;
|
|
1068
|
-
var d = isLE ? 1 : -1;
|
|
1069
|
-
var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
|
|
1070
|
-
value = Math.abs(value);
|
|
1071
|
-
if (isNaN(value) || value === Infinity) {
|
|
1072
|
-
m = isNaN(value) ? 1 : 0;
|
|
1073
|
-
e = eMax;
|
|
1074
|
-
} else {
|
|
1075
|
-
e = Math.floor(Math.log(value) / Math.LN2);
|
|
1076
|
-
if (value * (c = Math.pow(2, -e)) < 1) {
|
|
1077
|
-
e--;
|
|
1078
|
-
c *= 2;
|
|
1079
|
-
}
|
|
1080
|
-
if (e + eBias >= 1) {
|
|
1081
|
-
value += rt / c;
|
|
1082
|
-
} else {
|
|
1083
|
-
value += rt * Math.pow(2, 1 - eBias);
|
|
1084
|
-
}
|
|
1085
|
-
if (value * c >= 2) {
|
|
1086
|
-
e++;
|
|
1087
|
-
c /= 2;
|
|
1088
|
-
}
|
|
1089
|
-
if (e + eBias >= eMax) {
|
|
1090
|
-
m = 0;
|
|
1091
|
-
e = eMax;
|
|
1092
|
-
} else if (e + eBias >= 1) {
|
|
1093
|
-
m = (value * c - 1) * Math.pow(2, mLen);
|
|
1094
|
-
e = e + eBias;
|
|
1095
|
-
} else {
|
|
1096
|
-
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
|
|
1097
|
-
e = 0;
|
|
1098
|
-
}
|
|
1099
|
-
}
|
|
1100
|
-
for (; mLen >= 8; buffer[offset + i] = m & 255, i += d, m /= 256, mLen -= 8) {
|
|
1101
|
-
}
|
|
1102
|
-
e = e << mLen | m;
|
|
1103
|
-
eLen += mLen;
|
|
1104
|
-
for (; eLen > 0; buffer[offset + i] = e & 255, i += d, e /= 256, eLen -= 8) {
|
|
1105
|
-
}
|
|
1106
|
-
buffer[offset + i - d] |= s * 128;
|
|
1107
|
-
}
|
|
1108
|
-
var lookup, revLookup, Arr, inited, MAX_ARGUMENTS_LENGTH, INVALID_BASE64_RE;
|
|
1109
|
-
var init_Buffer = __esm({
|
|
1110
|
-
"../../../node_modules/.pnpm/@esbuild-plugins+node-globals-polyfill@0.2.3_esbuild@0.24.0/node_modules/@esbuild-plugins/node-globals-polyfill/Buffer.js"() {
|
|
1111
|
-
"use strict";
|
|
1112
|
-
init_process();
|
|
1113
|
-
init_buffer();
|
|
1114
|
-
lookup = [];
|
|
1115
|
-
revLookup = [];
|
|
1116
|
-
Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array;
|
|
1117
|
-
inited = false;
|
|
1118
|
-
Buffer2.TYPED_ARRAY_SUPPORT = globalThis.TYPED_ARRAY_SUPPORT !== void 0 ? globalThis.TYPED_ARRAY_SUPPORT : true;
|
|
1119
|
-
Buffer2.poolSize = 8192;
|
|
1120
|
-
Buffer2._augment = function(arr) {
|
|
1121
|
-
arr.__proto__ = Buffer2.prototype;
|
|
1122
|
-
return arr;
|
|
1123
|
-
};
|
|
1124
|
-
Buffer2.from = function(value, encodingOrOffset, length) {
|
|
1125
|
-
return from(null, value, encodingOrOffset, length);
|
|
1126
|
-
};
|
|
1127
|
-
Buffer2.kMaxLength = kMaxLength();
|
|
1128
|
-
if (Buffer2.TYPED_ARRAY_SUPPORT) {
|
|
1129
|
-
Buffer2.prototype.__proto__ = Uint8Array.prototype;
|
|
1130
|
-
Buffer2.__proto__ = Uint8Array;
|
|
1131
|
-
if (typeof Symbol !== "undefined" && Symbol.species && Buffer2[Symbol.species] === Buffer2) {
|
|
1132
|
-
}
|
|
1133
|
-
}
|
|
1134
|
-
Buffer2.alloc = function(size, fill2, encoding) {
|
|
1135
|
-
return alloc(null, size, fill2, encoding);
|
|
1136
|
-
};
|
|
1137
|
-
Buffer2.allocUnsafe = function(size) {
|
|
1138
|
-
return allocUnsafe(null, size);
|
|
1139
|
-
};
|
|
1140
|
-
Buffer2.allocUnsafeSlow = function(size) {
|
|
1141
|
-
return allocUnsafe(null, size);
|
|
1142
|
-
};
|
|
1143
|
-
Buffer2.isBuffer = isBuffer;
|
|
1144
|
-
Buffer2.compare = function compare(a, b) {
|
|
1145
|
-
if (!internalIsBuffer(a) || !internalIsBuffer(b)) {
|
|
1146
|
-
throw new TypeError("Arguments must be Buffers");
|
|
1147
|
-
}
|
|
1148
|
-
if (a === b) return 0;
|
|
1149
|
-
var x = a.length;
|
|
1150
|
-
var y = b.length;
|
|
1151
|
-
for (var i = 0, len = Math.min(x, y); i < len; ++i) {
|
|
1152
|
-
if (a[i] !== b[i]) {
|
|
1153
|
-
x = a[i];
|
|
1154
|
-
y = b[i];
|
|
1155
|
-
break;
|
|
1156
|
-
}
|
|
1157
|
-
}
|
|
1158
|
-
if (x < y) return -1;
|
|
1159
|
-
if (y < x) return 1;
|
|
1160
|
-
return 0;
|
|
1161
|
-
};
|
|
1162
|
-
Buffer2.isEncoding = function isEncoding(encoding) {
|
|
1163
|
-
switch (String(encoding).toLowerCase()) {
|
|
1164
|
-
case "hex":
|
|
1165
|
-
case "utf8":
|
|
1166
|
-
case "utf-8":
|
|
1167
|
-
case "ascii":
|
|
1168
|
-
case "latin1":
|
|
1169
|
-
case "binary":
|
|
1170
|
-
case "base64":
|
|
1171
|
-
case "ucs2":
|
|
1172
|
-
case "ucs-2":
|
|
1173
|
-
case "utf16le":
|
|
1174
|
-
case "utf-16le":
|
|
1175
|
-
return true;
|
|
1176
|
-
default:
|
|
1177
|
-
return false;
|
|
1178
|
-
}
|
|
1179
|
-
};
|
|
1180
|
-
Buffer2.concat = function concat(list, length) {
|
|
1181
|
-
if (!Array.isArray(list)) {
|
|
1182
|
-
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
1183
|
-
}
|
|
1184
|
-
if (list.length === 0) {
|
|
1185
|
-
return Buffer2.alloc(0);
|
|
1186
|
-
}
|
|
1187
|
-
var i;
|
|
1188
|
-
if (length === void 0) {
|
|
1189
|
-
length = 0;
|
|
1190
|
-
for (i = 0; i < list.length; ++i) {
|
|
1191
|
-
length += list[i].length;
|
|
1192
|
-
}
|
|
1193
|
-
}
|
|
1194
|
-
var buffer = Buffer2.allocUnsafe(length);
|
|
1195
|
-
var pos = 0;
|
|
1196
|
-
for (i = 0; i < list.length; ++i) {
|
|
1197
|
-
var buf = list[i];
|
|
1198
|
-
if (!internalIsBuffer(buf)) {
|
|
1199
|
-
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
1200
|
-
}
|
|
1201
|
-
buf.copy(buffer, pos);
|
|
1202
|
-
pos += buf.length;
|
|
1203
|
-
}
|
|
1204
|
-
return buffer;
|
|
1205
|
-
};
|
|
1206
|
-
Buffer2.byteLength = byteLength;
|
|
1207
|
-
Buffer2.prototype._isBuffer = true;
|
|
1208
|
-
Buffer2.prototype.swap16 = function swap16() {
|
|
1209
|
-
var len = this.length;
|
|
1210
|
-
if (len % 2 !== 0) {
|
|
1211
|
-
throw new RangeError("Buffer size must be a multiple of 16-bits");
|
|
1212
|
-
}
|
|
1213
|
-
for (var i = 0; i < len; i += 2) {
|
|
1214
|
-
swap(this, i, i + 1);
|
|
1215
|
-
}
|
|
1216
|
-
return this;
|
|
1217
|
-
};
|
|
1218
|
-
Buffer2.prototype.swap32 = function swap32() {
|
|
1219
|
-
var len = this.length;
|
|
1220
|
-
if (len % 4 !== 0) {
|
|
1221
|
-
throw new RangeError("Buffer size must be a multiple of 32-bits");
|
|
1222
|
-
}
|
|
1223
|
-
for (var i = 0; i < len; i += 4) {
|
|
1224
|
-
swap(this, i, i + 3);
|
|
1225
|
-
swap(this, i + 1, i + 2);
|
|
1226
|
-
}
|
|
1227
|
-
return this;
|
|
1228
|
-
};
|
|
1229
|
-
Buffer2.prototype.swap64 = function swap64() {
|
|
1230
|
-
var len = this.length;
|
|
1231
|
-
if (len % 8 !== 0) {
|
|
1232
|
-
throw new RangeError("Buffer size must be a multiple of 64-bits");
|
|
1233
|
-
}
|
|
1234
|
-
for (var i = 0; i < len; i += 8) {
|
|
1235
|
-
swap(this, i, i + 7);
|
|
1236
|
-
swap(this, i + 1, i + 6);
|
|
1237
|
-
swap(this, i + 2, i + 5);
|
|
1238
|
-
swap(this, i + 3, i + 4);
|
|
1239
|
-
}
|
|
1240
|
-
return this;
|
|
1241
|
-
};
|
|
1242
|
-
Buffer2.prototype.toString = function toString() {
|
|
1243
|
-
var length = this.length | 0;
|
|
1244
|
-
if (length === 0) return "";
|
|
1245
|
-
if (arguments.length === 0) return utf8Slice(this, 0, length);
|
|
1246
|
-
return slowToString.apply(this, arguments);
|
|
1247
|
-
};
|
|
1248
|
-
Buffer2.prototype.equals = function equals(b) {
|
|
1249
|
-
if (!internalIsBuffer(b)) throw new TypeError("Argument must be a Buffer");
|
|
1250
|
-
if (this === b) return true;
|
|
1251
|
-
return Buffer2.compare(this, b) === 0;
|
|
1252
|
-
};
|
|
1253
|
-
Buffer2.prototype.compare = function compare2(target, start, end, thisStart, thisEnd) {
|
|
1254
|
-
if (!internalIsBuffer(target)) {
|
|
1255
|
-
throw new TypeError("Argument must be a Buffer");
|
|
1256
|
-
}
|
|
1257
|
-
if (start === void 0) {
|
|
1258
|
-
start = 0;
|
|
1259
|
-
}
|
|
1260
|
-
if (end === void 0) {
|
|
1261
|
-
end = target ? target.length : 0;
|
|
1262
|
-
}
|
|
1263
|
-
if (thisStart === void 0) {
|
|
1264
|
-
thisStart = 0;
|
|
1265
|
-
}
|
|
1266
|
-
if (thisEnd === void 0) {
|
|
1267
|
-
thisEnd = this.length;
|
|
1268
|
-
}
|
|
1269
|
-
if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
|
|
1270
|
-
throw new RangeError("out of range index");
|
|
1271
|
-
}
|
|
1272
|
-
if (thisStart >= thisEnd && start >= end) {
|
|
1273
|
-
return 0;
|
|
1274
|
-
}
|
|
1275
|
-
if (thisStart >= thisEnd) {
|
|
1276
|
-
return -1;
|
|
1277
|
-
}
|
|
1278
|
-
if (start >= end) {
|
|
1279
|
-
return 1;
|
|
1280
|
-
}
|
|
1281
|
-
start >>>= 0;
|
|
1282
|
-
end >>>= 0;
|
|
1283
|
-
thisStart >>>= 0;
|
|
1284
|
-
thisEnd >>>= 0;
|
|
1285
|
-
if (this === target) return 0;
|
|
1286
|
-
var x = thisEnd - thisStart;
|
|
1287
|
-
var y = end - start;
|
|
1288
|
-
var len = Math.min(x, y);
|
|
1289
|
-
var thisCopy = this.slice(thisStart, thisEnd);
|
|
1290
|
-
var targetCopy = target.slice(start, end);
|
|
1291
|
-
for (var i = 0; i < len; ++i) {
|
|
1292
|
-
if (thisCopy[i] !== targetCopy[i]) {
|
|
1293
|
-
x = thisCopy[i];
|
|
1294
|
-
y = targetCopy[i];
|
|
1295
|
-
break;
|
|
1296
|
-
}
|
|
1297
|
-
}
|
|
1298
|
-
if (x < y) return -1;
|
|
1299
|
-
if (y < x) return 1;
|
|
1300
|
-
return 0;
|
|
1301
|
-
};
|
|
1302
|
-
Buffer2.prototype.includes = function includes(val, byteOffset, encoding) {
|
|
1303
|
-
return this.indexOf(val, byteOffset, encoding) !== -1;
|
|
1304
|
-
};
|
|
1305
|
-
Buffer2.prototype.indexOf = function indexOf(val, byteOffset, encoding) {
|
|
1306
|
-
return bidirectionalIndexOf(this, val, byteOffset, encoding, true);
|
|
1307
|
-
};
|
|
1308
|
-
Buffer2.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {
|
|
1309
|
-
return bidirectionalIndexOf(this, val, byteOffset, encoding, false);
|
|
1310
|
-
};
|
|
1311
|
-
Buffer2.prototype.write = function write(string, offset, length, encoding) {
|
|
1312
|
-
if (offset === void 0) {
|
|
1313
|
-
encoding = "utf8";
|
|
1314
|
-
length = this.length;
|
|
1315
|
-
offset = 0;
|
|
1316
|
-
} else if (length === void 0 && typeof offset === "string") {
|
|
1317
|
-
encoding = offset;
|
|
1318
|
-
length = this.length;
|
|
1319
|
-
offset = 0;
|
|
1320
|
-
} else if (isFinite(offset)) {
|
|
1321
|
-
offset = offset | 0;
|
|
1322
|
-
if (isFinite(length)) {
|
|
1323
|
-
length = length | 0;
|
|
1324
|
-
if (encoding === void 0) encoding = "utf8";
|
|
1325
|
-
} else {
|
|
1326
|
-
encoding = length;
|
|
1327
|
-
length = void 0;
|
|
1328
|
-
}
|
|
1329
|
-
} else {
|
|
1330
|
-
throw new Error(
|
|
1331
|
-
"Buffer.write(string, encoding, offset[, length]) is no longer supported"
|
|
1332
|
-
);
|
|
1333
|
-
}
|
|
1334
|
-
var remaining = this.length - offset;
|
|
1335
|
-
if (length === void 0 || length > remaining) length = remaining;
|
|
1336
|
-
if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {
|
|
1337
|
-
throw new RangeError("Attempt to write outside buffer bounds");
|
|
1338
|
-
}
|
|
1339
|
-
if (!encoding) encoding = "utf8";
|
|
1340
|
-
var loweredCase = false;
|
|
1341
|
-
for (; ; ) {
|
|
1342
|
-
switch (encoding) {
|
|
1343
|
-
case "hex":
|
|
1344
|
-
return hexWrite(this, string, offset, length);
|
|
1345
|
-
case "utf8":
|
|
1346
|
-
case "utf-8":
|
|
1347
|
-
return utf8Write(this, string, offset, length);
|
|
1348
|
-
case "ascii":
|
|
1349
|
-
return asciiWrite(this, string, offset, length);
|
|
1350
|
-
case "latin1":
|
|
1351
|
-
case "binary":
|
|
1352
|
-
return latin1Write(this, string, offset, length);
|
|
1353
|
-
case "base64":
|
|
1354
|
-
return base64Write(this, string, offset, length);
|
|
1355
|
-
case "ucs2":
|
|
1356
|
-
case "ucs-2":
|
|
1357
|
-
case "utf16le":
|
|
1358
|
-
case "utf-16le":
|
|
1359
|
-
return ucs2Write(this, string, offset, length);
|
|
1360
|
-
default:
|
|
1361
|
-
if (loweredCase)
|
|
1362
|
-
throw new TypeError("Unknown encoding: " + encoding);
|
|
1363
|
-
encoding = ("" + encoding).toLowerCase();
|
|
1364
|
-
loweredCase = true;
|
|
1365
|
-
}
|
|
1366
|
-
}
|
|
1367
|
-
};
|
|
1368
|
-
Buffer2.prototype.toJSON = function toJSON() {
|
|
1369
|
-
return {
|
|
1370
|
-
type: "Buffer",
|
|
1371
|
-
data: Array.prototype.slice.call(this._arr || this, 0)
|
|
1372
|
-
};
|
|
1373
|
-
};
|
|
1374
|
-
MAX_ARGUMENTS_LENGTH = 4096;
|
|
1375
|
-
Buffer2.prototype.slice = function slice(start, end) {
|
|
1376
|
-
var len = this.length;
|
|
1377
|
-
start = ~~start;
|
|
1378
|
-
end = end === void 0 ? len : ~~end;
|
|
1379
|
-
if (start < 0) {
|
|
1380
|
-
start += len;
|
|
1381
|
-
if (start < 0) start = 0;
|
|
1382
|
-
} else if (start > len) {
|
|
1383
|
-
start = len;
|
|
1384
|
-
}
|
|
1385
|
-
if (end < 0) {
|
|
1386
|
-
end += len;
|
|
1387
|
-
if (end < 0) end = 0;
|
|
1388
|
-
} else if (end > len) {
|
|
1389
|
-
end = len;
|
|
1390
|
-
}
|
|
1391
|
-
if (end < start) end = start;
|
|
1392
|
-
var newBuf;
|
|
1393
|
-
if (Buffer2.TYPED_ARRAY_SUPPORT) {
|
|
1394
|
-
newBuf = this.subarray(start, end);
|
|
1395
|
-
newBuf.__proto__ = Buffer2.prototype;
|
|
1396
|
-
} else {
|
|
1397
|
-
var sliceLen = end - start;
|
|
1398
|
-
newBuf = new Buffer2(sliceLen, void 0);
|
|
1399
|
-
for (var i = 0; i < sliceLen; ++i) {
|
|
1400
|
-
newBuf[i] = this[i + start];
|
|
1401
|
-
}
|
|
1402
|
-
}
|
|
1403
|
-
return newBuf;
|
|
1404
|
-
};
|
|
1405
|
-
Buffer2.prototype.readUIntLE = function readUIntLE(offset, byteLength2, noAssert) {
|
|
1406
|
-
offset = offset | 0;
|
|
1407
|
-
byteLength2 = byteLength2 | 0;
|
|
1408
|
-
if (!noAssert) checkOffset(offset, byteLength2, this.length);
|
|
1409
|
-
var val = this[offset];
|
|
1410
|
-
var mul = 1;
|
|
1411
|
-
var i = 0;
|
|
1412
|
-
while (++i < byteLength2 && (mul *= 256)) {
|
|
1413
|
-
val += this[offset + i] * mul;
|
|
1414
|
-
}
|
|
1415
|
-
return val;
|
|
1416
|
-
};
|
|
1417
|
-
Buffer2.prototype.readUIntBE = function readUIntBE(offset, byteLength2, noAssert) {
|
|
1418
|
-
offset = offset | 0;
|
|
1419
|
-
byteLength2 = byteLength2 | 0;
|
|
1420
|
-
if (!noAssert) {
|
|
1421
|
-
checkOffset(offset, byteLength2, this.length);
|
|
1422
|
-
}
|
|
1423
|
-
var val = this[offset + --byteLength2];
|
|
1424
|
-
var mul = 1;
|
|
1425
|
-
while (byteLength2 > 0 && (mul *= 256)) {
|
|
1426
|
-
val += this[offset + --byteLength2] * mul;
|
|
1427
|
-
}
|
|
1428
|
-
return val;
|
|
1429
|
-
};
|
|
1430
|
-
Buffer2.prototype.readUInt8 = function readUInt8(offset, noAssert) {
|
|
1431
|
-
if (!noAssert) checkOffset(offset, 1, this.length);
|
|
1432
|
-
return this[offset];
|
|
1433
|
-
};
|
|
1434
|
-
Buffer2.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {
|
|
1435
|
-
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
1436
|
-
return this[offset] | this[offset + 1] << 8;
|
|
1437
|
-
};
|
|
1438
|
-
Buffer2.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {
|
|
1439
|
-
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
1440
|
-
return this[offset] << 8 | this[offset + 1];
|
|
1441
|
-
};
|
|
1442
|
-
Buffer2.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {
|
|
1443
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
1444
|
-
return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216;
|
|
1445
|
-
};
|
|
1446
|
-
Buffer2.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {
|
|
1447
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
1448
|
-
return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
|
|
1449
|
-
};
|
|
1450
|
-
Buffer2.prototype.readIntLE = function readIntLE(offset, byteLength2, noAssert) {
|
|
1451
|
-
offset = offset | 0;
|
|
1452
|
-
byteLength2 = byteLength2 | 0;
|
|
1453
|
-
if (!noAssert) checkOffset(offset, byteLength2, this.length);
|
|
1454
|
-
var val = this[offset];
|
|
1455
|
-
var mul = 1;
|
|
1456
|
-
var i = 0;
|
|
1457
|
-
while (++i < byteLength2 && (mul *= 256)) {
|
|
1458
|
-
val += this[offset + i] * mul;
|
|
1459
|
-
}
|
|
1460
|
-
mul *= 128;
|
|
1461
|
-
if (val >= mul) val -= Math.pow(2, 8 * byteLength2);
|
|
1462
|
-
return val;
|
|
1463
|
-
};
|
|
1464
|
-
Buffer2.prototype.readIntBE = function readIntBE(offset, byteLength2, noAssert) {
|
|
1465
|
-
offset = offset | 0;
|
|
1466
|
-
byteLength2 = byteLength2 | 0;
|
|
1467
|
-
if (!noAssert) checkOffset(offset, byteLength2, this.length);
|
|
1468
|
-
var i = byteLength2;
|
|
1469
|
-
var mul = 1;
|
|
1470
|
-
var val = this[offset + --i];
|
|
1471
|
-
while (i > 0 && (mul *= 256)) {
|
|
1472
|
-
val += this[offset + --i] * mul;
|
|
1473
|
-
}
|
|
1474
|
-
mul *= 128;
|
|
1475
|
-
if (val >= mul) val -= Math.pow(2, 8 * byteLength2);
|
|
1476
|
-
return val;
|
|
1477
|
-
};
|
|
1478
|
-
Buffer2.prototype.readInt8 = function readInt8(offset, noAssert) {
|
|
1479
|
-
if (!noAssert) checkOffset(offset, 1, this.length);
|
|
1480
|
-
if (!(this[offset] & 128)) return this[offset];
|
|
1481
|
-
return (255 - this[offset] + 1) * -1;
|
|
1482
|
-
};
|
|
1483
|
-
Buffer2.prototype.readInt16LE = function readInt16LE(offset, noAssert) {
|
|
1484
|
-
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
1485
|
-
var val = this[offset] | this[offset + 1] << 8;
|
|
1486
|
-
return val & 32768 ? val | 4294901760 : val;
|
|
1487
|
-
};
|
|
1488
|
-
Buffer2.prototype.readInt16BE = function readInt16BE(offset, noAssert) {
|
|
1489
|
-
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
1490
|
-
var val = this[offset + 1] | this[offset] << 8;
|
|
1491
|
-
return val & 32768 ? val | 4294901760 : val;
|
|
1492
|
-
};
|
|
1493
|
-
Buffer2.prototype.readInt32LE = function readInt32LE(offset, noAssert) {
|
|
1494
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
1495
|
-
return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
|
|
1496
|
-
};
|
|
1497
|
-
Buffer2.prototype.readInt32BE = function readInt32BE(offset, noAssert) {
|
|
1498
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
1499
|
-
return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
|
|
1500
|
-
};
|
|
1501
|
-
Buffer2.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
|
|
1502
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
1503
|
-
return ieee754read(this, offset, true, 23, 4);
|
|
1504
|
-
};
|
|
1505
|
-
Buffer2.prototype.readFloatBE = function readFloatBE(offset, noAssert) {
|
|
1506
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
1507
|
-
return ieee754read(this, offset, false, 23, 4);
|
|
1508
|
-
};
|
|
1509
|
-
Buffer2.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {
|
|
1510
|
-
if (!noAssert) checkOffset(offset, 8, this.length);
|
|
1511
|
-
return ieee754read(this, offset, true, 52, 8);
|
|
1512
|
-
};
|
|
1513
|
-
Buffer2.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {
|
|
1514
|
-
if (!noAssert) checkOffset(offset, 8, this.length);
|
|
1515
|
-
return ieee754read(this, offset, false, 52, 8);
|
|
1516
|
-
};
|
|
1517
|
-
Buffer2.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength2, noAssert) {
|
|
1518
|
-
value = +value;
|
|
1519
|
-
offset = offset | 0;
|
|
1520
|
-
byteLength2 = byteLength2 | 0;
|
|
1521
|
-
if (!noAssert) {
|
|
1522
|
-
var maxBytes = Math.pow(2, 8 * byteLength2) - 1;
|
|
1523
|
-
checkInt(this, value, offset, byteLength2, maxBytes, 0);
|
|
1524
|
-
}
|
|
1525
|
-
var mul = 1;
|
|
1526
|
-
var i = 0;
|
|
1527
|
-
this[offset] = value & 255;
|
|
1528
|
-
while (++i < byteLength2 && (mul *= 256)) {
|
|
1529
|
-
this[offset + i] = value / mul & 255;
|
|
1530
|
-
}
|
|
1531
|
-
return offset + byteLength2;
|
|
1532
|
-
};
|
|
1533
|
-
Buffer2.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength2, noAssert) {
|
|
1534
|
-
value = +value;
|
|
1535
|
-
offset = offset | 0;
|
|
1536
|
-
byteLength2 = byteLength2 | 0;
|
|
1537
|
-
if (!noAssert) {
|
|
1538
|
-
var maxBytes = Math.pow(2, 8 * byteLength2) - 1;
|
|
1539
|
-
checkInt(this, value, offset, byteLength2, maxBytes, 0);
|
|
1540
|
-
}
|
|
1541
|
-
var i = byteLength2 - 1;
|
|
1542
|
-
var mul = 1;
|
|
1543
|
-
this[offset + i] = value & 255;
|
|
1544
|
-
while (--i >= 0 && (mul *= 256)) {
|
|
1545
|
-
this[offset + i] = value / mul & 255;
|
|
1546
|
-
}
|
|
1547
|
-
return offset + byteLength2;
|
|
1548
|
-
};
|
|
1549
|
-
Buffer2.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {
|
|
1550
|
-
value = +value;
|
|
1551
|
-
offset = offset | 0;
|
|
1552
|
-
if (!noAssert) checkInt(this, value, offset, 1, 255, 0);
|
|
1553
|
-
if (!Buffer2.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
|
|
1554
|
-
this[offset] = value & 255;
|
|
1555
|
-
return offset + 1;
|
|
1556
|
-
};
|
|
1557
|
-
Buffer2.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {
|
|
1558
|
-
value = +value;
|
|
1559
|
-
offset = offset | 0;
|
|
1560
|
-
if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
|
|
1561
|
-
if (Buffer2.TYPED_ARRAY_SUPPORT) {
|
|
1562
|
-
this[offset] = value & 255;
|
|
1563
|
-
this[offset + 1] = value >>> 8;
|
|
1564
|
-
} else {
|
|
1565
|
-
objectWriteUInt16(this, value, offset, true);
|
|
1566
|
-
}
|
|
1567
|
-
return offset + 2;
|
|
1568
|
-
};
|
|
1569
|
-
Buffer2.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {
|
|
1570
|
-
value = +value;
|
|
1571
|
-
offset = offset | 0;
|
|
1572
|
-
if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
|
|
1573
|
-
if (Buffer2.TYPED_ARRAY_SUPPORT) {
|
|
1574
|
-
this[offset] = value >>> 8;
|
|
1575
|
-
this[offset + 1] = value & 255;
|
|
1576
|
-
} else {
|
|
1577
|
-
objectWriteUInt16(this, value, offset, false);
|
|
1578
|
-
}
|
|
1579
|
-
return offset + 2;
|
|
1580
|
-
};
|
|
1581
|
-
Buffer2.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {
|
|
1582
|
-
value = +value;
|
|
1583
|
-
offset = offset | 0;
|
|
1584
|
-
if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
|
|
1585
|
-
if (Buffer2.TYPED_ARRAY_SUPPORT) {
|
|
1586
|
-
this[offset + 3] = value >>> 24;
|
|
1587
|
-
this[offset + 2] = value >>> 16;
|
|
1588
|
-
this[offset + 1] = value >>> 8;
|
|
1589
|
-
this[offset] = value & 255;
|
|
1590
|
-
} else {
|
|
1591
|
-
objectWriteUInt32(this, value, offset, true);
|
|
1592
|
-
}
|
|
1593
|
-
return offset + 4;
|
|
1594
|
-
};
|
|
1595
|
-
Buffer2.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {
|
|
1596
|
-
value = +value;
|
|
1597
|
-
offset = offset | 0;
|
|
1598
|
-
if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
|
|
1599
|
-
if (Buffer2.TYPED_ARRAY_SUPPORT) {
|
|
1600
|
-
this[offset] = value >>> 24;
|
|
1601
|
-
this[offset + 1] = value >>> 16;
|
|
1602
|
-
this[offset + 2] = value >>> 8;
|
|
1603
|
-
this[offset + 3] = value & 255;
|
|
1604
|
-
} else {
|
|
1605
|
-
objectWriteUInt32(this, value, offset, false);
|
|
1606
|
-
}
|
|
1607
|
-
return offset + 4;
|
|
1608
|
-
};
|
|
1609
|
-
Buffer2.prototype.writeIntLE = function writeIntLE(value, offset, byteLength2, noAssert) {
|
|
1610
|
-
value = +value;
|
|
1611
|
-
offset = offset | 0;
|
|
1612
|
-
if (!noAssert) {
|
|
1613
|
-
var limit = Math.pow(2, 8 * byteLength2 - 1);
|
|
1614
|
-
checkInt(this, value, offset, byteLength2, limit - 1, -limit);
|
|
1615
|
-
}
|
|
1616
|
-
var i = 0;
|
|
1617
|
-
var mul = 1;
|
|
1618
|
-
var sub = 0;
|
|
1619
|
-
this[offset] = value & 255;
|
|
1620
|
-
while (++i < byteLength2 && (mul *= 256)) {
|
|
1621
|
-
if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
|
|
1622
|
-
sub = 1;
|
|
1623
|
-
}
|
|
1624
|
-
this[offset + i] = (value / mul >> 0) - sub & 255;
|
|
1625
|
-
}
|
|
1626
|
-
return offset + byteLength2;
|
|
1627
|
-
};
|
|
1628
|
-
Buffer2.prototype.writeIntBE = function writeIntBE(value, offset, byteLength2, noAssert) {
|
|
1629
|
-
value = +value;
|
|
1630
|
-
offset = offset | 0;
|
|
1631
|
-
if (!noAssert) {
|
|
1632
|
-
var limit = Math.pow(2, 8 * byteLength2 - 1);
|
|
1633
|
-
checkInt(this, value, offset, byteLength2, limit - 1, -limit);
|
|
1634
|
-
}
|
|
1635
|
-
var i = byteLength2 - 1;
|
|
1636
|
-
var mul = 1;
|
|
1637
|
-
var sub = 0;
|
|
1638
|
-
this[offset + i] = value & 255;
|
|
1639
|
-
while (--i >= 0 && (mul *= 256)) {
|
|
1640
|
-
if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
|
|
1641
|
-
sub = 1;
|
|
1642
|
-
}
|
|
1643
|
-
this[offset + i] = (value / mul >> 0) - sub & 255;
|
|
1644
|
-
}
|
|
1645
|
-
return offset + byteLength2;
|
|
1646
|
-
};
|
|
1647
|
-
Buffer2.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {
|
|
1648
|
-
value = +value;
|
|
1649
|
-
offset = offset | 0;
|
|
1650
|
-
if (!noAssert) checkInt(this, value, offset, 1, 127, -128);
|
|
1651
|
-
if (!Buffer2.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
|
|
1652
|
-
if (value < 0) value = 255 + value + 1;
|
|
1653
|
-
this[offset] = value & 255;
|
|
1654
|
-
return offset + 1;
|
|
1655
|
-
};
|
|
1656
|
-
Buffer2.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {
|
|
1657
|
-
value = +value;
|
|
1658
|
-
offset = offset | 0;
|
|
1659
|
-
if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
|
|
1660
|
-
if (Buffer2.TYPED_ARRAY_SUPPORT) {
|
|
1661
|
-
this[offset] = value & 255;
|
|
1662
|
-
this[offset + 1] = value >>> 8;
|
|
1663
|
-
} else {
|
|
1664
|
-
objectWriteUInt16(this, value, offset, true);
|
|
1665
|
-
}
|
|
1666
|
-
return offset + 2;
|
|
1667
|
-
};
|
|
1668
|
-
Buffer2.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {
|
|
1669
|
-
value = +value;
|
|
1670
|
-
offset = offset | 0;
|
|
1671
|
-
if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
|
|
1672
|
-
if (Buffer2.TYPED_ARRAY_SUPPORT) {
|
|
1673
|
-
this[offset] = value >>> 8;
|
|
1674
|
-
this[offset + 1] = value & 255;
|
|
1675
|
-
} else {
|
|
1676
|
-
objectWriteUInt16(this, value, offset, false);
|
|
1677
|
-
}
|
|
1678
|
-
return offset + 2;
|
|
1679
|
-
};
|
|
1680
|
-
Buffer2.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {
|
|
1681
|
-
value = +value;
|
|
1682
|
-
offset = offset | 0;
|
|
1683
|
-
if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
|
|
1684
|
-
if (Buffer2.TYPED_ARRAY_SUPPORT) {
|
|
1685
|
-
this[offset] = value & 255;
|
|
1686
|
-
this[offset + 1] = value >>> 8;
|
|
1687
|
-
this[offset + 2] = value >>> 16;
|
|
1688
|
-
this[offset + 3] = value >>> 24;
|
|
1689
|
-
} else {
|
|
1690
|
-
objectWriteUInt32(this, value, offset, true);
|
|
1691
|
-
}
|
|
1692
|
-
return offset + 4;
|
|
1693
|
-
};
|
|
1694
|
-
Buffer2.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {
|
|
1695
|
-
value = +value;
|
|
1696
|
-
offset = offset | 0;
|
|
1697
|
-
if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
|
|
1698
|
-
if (value < 0) value = 4294967295 + value + 1;
|
|
1699
|
-
if (Buffer2.TYPED_ARRAY_SUPPORT) {
|
|
1700
|
-
this[offset] = value >>> 24;
|
|
1701
|
-
this[offset + 1] = value >>> 16;
|
|
1702
|
-
this[offset + 2] = value >>> 8;
|
|
1703
|
-
this[offset + 3] = value & 255;
|
|
1704
|
-
} else {
|
|
1705
|
-
objectWriteUInt32(this, value, offset, false);
|
|
1706
|
-
}
|
|
1707
|
-
return offset + 4;
|
|
1708
|
-
};
|
|
1709
|
-
Buffer2.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {
|
|
1710
|
-
return writeFloat(this, value, offset, true, noAssert);
|
|
1711
|
-
};
|
|
1712
|
-
Buffer2.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {
|
|
1713
|
-
return writeFloat(this, value, offset, false, noAssert);
|
|
1714
|
-
};
|
|
1715
|
-
Buffer2.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {
|
|
1716
|
-
return writeDouble(this, value, offset, true, noAssert);
|
|
1717
|
-
};
|
|
1718
|
-
Buffer2.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {
|
|
1719
|
-
return writeDouble(this, value, offset, false, noAssert);
|
|
1720
|
-
};
|
|
1721
|
-
Buffer2.prototype.copy = function copy(target, targetStart, start, end) {
|
|
1722
|
-
if (!start) start = 0;
|
|
1723
|
-
if (!end && end !== 0) end = this.length;
|
|
1724
|
-
if (targetStart >= target.length) targetStart = target.length;
|
|
1725
|
-
if (!targetStart) targetStart = 0;
|
|
1726
|
-
if (end > 0 && end < start) end = start;
|
|
1727
|
-
if (end === start) return 0;
|
|
1728
|
-
if (target.length === 0 || this.length === 0) return 0;
|
|
1729
|
-
if (targetStart < 0) {
|
|
1730
|
-
throw new RangeError("targetStart out of bounds");
|
|
1731
|
-
}
|
|
1732
|
-
if (start < 0 || start >= this.length)
|
|
1733
|
-
throw new RangeError("sourceStart out of bounds");
|
|
1734
|
-
if (end < 0) throw new RangeError("sourceEnd out of bounds");
|
|
1735
|
-
if (end > this.length) end = this.length;
|
|
1736
|
-
if (target.length - targetStart < end - start) {
|
|
1737
|
-
end = target.length - targetStart + start;
|
|
1738
|
-
}
|
|
1739
|
-
var len = end - start;
|
|
1740
|
-
var i;
|
|
1741
|
-
if (this === target && start < targetStart && targetStart < end) {
|
|
1742
|
-
for (i = len - 1; i >= 0; --i) {
|
|
1743
|
-
target[i + targetStart] = this[i + start];
|
|
1744
|
-
}
|
|
1745
|
-
} else if (len < 1e3 || !Buffer2.TYPED_ARRAY_SUPPORT) {
|
|
1746
|
-
for (i = 0; i < len; ++i) {
|
|
1747
|
-
target[i + targetStart] = this[i + start];
|
|
1748
|
-
}
|
|
1749
|
-
} else {
|
|
1750
|
-
Uint8Array.prototype.set.call(
|
|
1751
|
-
target,
|
|
1752
|
-
this.subarray(start, start + len),
|
|
1753
|
-
targetStart
|
|
1754
|
-
);
|
|
1755
|
-
}
|
|
1756
|
-
return len;
|
|
1757
|
-
};
|
|
1758
|
-
Buffer2.prototype.fill = function fill(val, start, end, encoding) {
|
|
1759
|
-
if (typeof val === "string") {
|
|
1760
|
-
if (typeof start === "string") {
|
|
1761
|
-
encoding = start;
|
|
1762
|
-
start = 0;
|
|
1763
|
-
end = this.length;
|
|
1764
|
-
} else if (typeof end === "string") {
|
|
1765
|
-
encoding = end;
|
|
1766
|
-
end = this.length;
|
|
1767
|
-
}
|
|
1768
|
-
if (val.length === 1) {
|
|
1769
|
-
var code = val.charCodeAt(0);
|
|
1770
|
-
if (code < 256) {
|
|
1771
|
-
val = code;
|
|
1772
|
-
}
|
|
1773
|
-
}
|
|
1774
|
-
if (encoding !== void 0 && typeof encoding !== "string") {
|
|
1775
|
-
throw new TypeError("encoding must be a string");
|
|
1776
|
-
}
|
|
1777
|
-
if (typeof encoding === "string" && !Buffer2.isEncoding(encoding)) {
|
|
1778
|
-
throw new TypeError("Unknown encoding: " + encoding);
|
|
1779
|
-
}
|
|
1780
|
-
} else if (typeof val === "number") {
|
|
1781
|
-
val = val & 255;
|
|
1782
|
-
}
|
|
1783
|
-
if (start < 0 || this.length < start || this.length < end) {
|
|
1784
|
-
throw new RangeError("Out of range index");
|
|
1785
|
-
}
|
|
1786
|
-
if (end <= start) {
|
|
1787
|
-
return this;
|
|
1788
|
-
}
|
|
1789
|
-
start = start >>> 0;
|
|
1790
|
-
end = end === void 0 ? this.length : end >>> 0;
|
|
1791
|
-
if (!val) val = 0;
|
|
1792
|
-
var i;
|
|
1793
|
-
if (typeof val === "number") {
|
|
1794
|
-
for (i = start; i < end; ++i) {
|
|
1795
|
-
this[i] = val;
|
|
1796
|
-
}
|
|
1797
|
-
} else {
|
|
1798
|
-
var bytes = internalIsBuffer(val) ? val : utf8ToBytes(new Buffer2(val, encoding).toString());
|
|
1799
|
-
var len = bytes.length;
|
|
1800
|
-
for (i = 0; i < end - start; ++i) {
|
|
1801
|
-
this[i + start] = bytes[i % len];
|
|
1802
|
-
}
|
|
1803
|
-
}
|
|
1804
|
-
return this;
|
|
1805
|
-
};
|
|
1806
|
-
INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g;
|
|
1807
|
-
}
|
|
1808
|
-
});
|
|
1809
|
-
|
|
1810
|
-
// ../../../node_modules/.pnpm/@esbuild-plugins+node-globals-polyfill@0.2.3_esbuild@0.24.0/node_modules/@esbuild-plugins/node-globals-polyfill/_buffer.js
|
|
1811
|
-
var init_buffer = __esm({
|
|
1812
|
-
"../../../node_modules/.pnpm/@esbuild-plugins+node-globals-polyfill@0.2.3_esbuild@0.24.0/node_modules/@esbuild-plugins/node-globals-polyfill/_buffer.js"() {
|
|
1813
|
-
"use strict";
|
|
1814
|
-
init_Buffer();
|
|
1815
|
-
}
|
|
1816
|
-
});
|
|
1817
|
-
|
|
1818
|
-
// src/context/DynamicSnippetsGeneratorContext.ts
|
|
1819
|
-
var DynamicSnippetsGeneratorContext_exports = {};
|
|
1820
|
-
__export(DynamicSnippetsGeneratorContext_exports, {
|
|
1821
|
-
DynamicSnippetsGeneratorContext: () => DynamicSnippetsGeneratorContext
|
|
1822
|
-
});
|
|
1823
|
-
module.exports = __toCommonJS(DynamicSnippetsGeneratorContext_exports);
|
|
1824
|
-
init_process();
|
|
1825
|
-
init_buffer();
|
|
1826
|
-
|
|
1827
|
-
// ../../../packages/commons/core-utils/lib/index.js
|
|
1828
|
-
init_process();
|
|
1829
|
-
init_buffer();
|
|
1830
|
-
|
|
1831
|
-
// ../../../packages/commons/core-utils/lib/assertNever.js
|
|
1832
|
-
init_process();
|
|
1833
|
-
init_buffer();
|
|
1834
|
-
function assertNever(x) {
|
|
1835
|
-
throw new Error("Unexpected value: " + JSON.stringify(x));
|
|
1836
|
-
}
|
|
1837
|
-
|
|
1838
|
-
// ../../../packages/commons/core-utils/lib/objects/keys.js
|
|
1839
|
-
init_process();
|
|
1840
|
-
init_buffer();
|
|
1841
|
-
function keys(object) {
|
|
1842
|
-
return Object.keys(object);
|
|
1843
|
-
}
|
|
1844
|
-
|
|
1845
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/lodash.js
|
|
1846
|
-
init_process();
|
|
1847
|
-
init_buffer();
|
|
1848
|
-
|
|
1849
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isSymbol.js
|
|
1850
|
-
init_process();
|
|
1851
|
-
init_buffer();
|
|
1852
|
-
|
|
1853
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetTag.js
|
|
1854
|
-
init_process();
|
|
1855
|
-
init_buffer();
|
|
1856
|
-
|
|
1857
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Symbol.js
|
|
1858
|
-
init_process();
|
|
1859
|
-
init_buffer();
|
|
1860
|
-
|
|
1861
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_root.js
|
|
1862
|
-
init_process();
|
|
1863
|
-
init_buffer();
|
|
1864
|
-
|
|
1865
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_freeGlobal.js
|
|
1866
|
-
init_process();
|
|
1867
|
-
init_buffer();
|
|
1868
|
-
var freeGlobal = typeof globalThis == "object" && globalThis && globalThis.Object === Object && globalThis;
|
|
1869
|
-
var freeGlobal_default = freeGlobal;
|
|
1870
|
-
|
|
1871
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_root.js
|
|
1872
|
-
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
1873
|
-
var root = freeGlobal_default || freeSelf || Function("return this")();
|
|
1874
|
-
var root_default = root;
|
|
1875
|
-
|
|
1876
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Symbol.js
|
|
1877
|
-
var Symbol2 = root_default.Symbol;
|
|
1878
|
-
var Symbol_default = Symbol2;
|
|
1879
|
-
|
|
1880
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getRawTag.js
|
|
1881
|
-
init_process();
|
|
1882
|
-
init_buffer();
|
|
1883
|
-
var objectProto = Object.prototype;
|
|
1884
|
-
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
1885
|
-
var nativeObjectToString = objectProto.toString;
|
|
1886
|
-
var symToStringTag = Symbol_default ? Symbol_default.toStringTag : void 0;
|
|
1887
|
-
function getRawTag(value) {
|
|
1888
|
-
var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
|
|
1889
|
-
try {
|
|
1890
|
-
value[symToStringTag] = void 0;
|
|
1891
|
-
var unmasked = true;
|
|
1892
|
-
} catch (e) {
|
|
1893
|
-
}
|
|
1894
|
-
var result = nativeObjectToString.call(value);
|
|
1895
|
-
if (unmasked) {
|
|
1896
|
-
if (isOwn) {
|
|
1897
|
-
value[symToStringTag] = tag;
|
|
1898
|
-
} else {
|
|
1899
|
-
delete value[symToStringTag];
|
|
1900
|
-
}
|
|
1901
|
-
}
|
|
1902
|
-
return result;
|
|
1903
|
-
}
|
|
1904
|
-
var getRawTag_default = getRawTag;
|
|
1905
|
-
|
|
1906
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_objectToString.js
|
|
1907
|
-
init_process();
|
|
1908
|
-
init_buffer();
|
|
1909
|
-
var objectProto2 = Object.prototype;
|
|
1910
|
-
var nativeObjectToString2 = objectProto2.toString;
|
|
1911
|
-
function objectToString(value) {
|
|
1912
|
-
return nativeObjectToString2.call(value);
|
|
1913
|
-
}
|
|
1914
|
-
var objectToString_default = objectToString;
|
|
1915
|
-
|
|
1916
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetTag.js
|
|
1917
|
-
var nullTag = "[object Null]";
|
|
1918
|
-
var undefinedTag = "[object Undefined]";
|
|
1919
|
-
var symToStringTag2 = Symbol_default ? Symbol_default.toStringTag : void 0;
|
|
1920
|
-
function baseGetTag(value) {
|
|
1921
|
-
if (value == null) {
|
|
1922
|
-
return value === void 0 ? undefinedTag : nullTag;
|
|
1923
|
-
}
|
|
1924
|
-
return symToStringTag2 && symToStringTag2 in Object(value) ? getRawTag_default(value) : objectToString_default(value);
|
|
1925
|
-
}
|
|
1926
|
-
var baseGetTag_default = baseGetTag;
|
|
1927
|
-
|
|
1928
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObjectLike.js
|
|
1929
|
-
init_process();
|
|
1930
|
-
init_buffer();
|
|
1931
|
-
function isObjectLike(value) {
|
|
1932
|
-
return value != null && typeof value == "object";
|
|
1933
|
-
}
|
|
1934
|
-
var isObjectLike_default = isObjectLike;
|
|
1935
|
-
|
|
1936
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isSymbol.js
|
|
1937
|
-
var symbolTag = "[object Symbol]";
|
|
1938
|
-
function isSymbol(value) {
|
|
1939
|
-
return typeof value == "symbol" || isObjectLike_default(value) && baseGetTag_default(value) == symbolTag;
|
|
1940
|
-
}
|
|
1941
|
-
var isSymbol_default = isSymbol;
|
|
1942
|
-
|
|
1943
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseToString.js
|
|
1944
|
-
init_process();
|
|
1945
|
-
init_buffer();
|
|
1946
|
-
|
|
1947
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayMap.js
|
|
1948
|
-
init_process();
|
|
1949
|
-
init_buffer();
|
|
1950
|
-
function arrayMap(array, iteratee) {
|
|
1951
|
-
var index = -1, length = array == null ? 0 : array.length, result = Array(length);
|
|
1952
|
-
while (++index < length) {
|
|
1953
|
-
result[index] = iteratee(array[index], index, array);
|
|
1954
|
-
}
|
|
1955
|
-
return result;
|
|
1956
|
-
}
|
|
1957
|
-
var arrayMap_default = arrayMap;
|
|
1958
|
-
|
|
1959
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArray.js
|
|
1960
|
-
init_process();
|
|
1961
|
-
init_buffer();
|
|
1962
|
-
var isArray = Array.isArray;
|
|
1963
|
-
var isArray_default = isArray;
|
|
1964
|
-
|
|
1965
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseToString.js
|
|
1966
|
-
var INFINITY = 1 / 0;
|
|
1967
|
-
var symbolProto = Symbol_default ? Symbol_default.prototype : void 0;
|
|
1968
|
-
var symbolToString = symbolProto ? symbolProto.toString : void 0;
|
|
1969
|
-
function baseToString(value) {
|
|
1970
|
-
if (typeof value == "string") {
|
|
1971
|
-
return value;
|
|
1972
|
-
}
|
|
1973
|
-
if (isArray_default(value)) {
|
|
1974
|
-
return arrayMap_default(value, baseToString) + "";
|
|
1975
|
-
}
|
|
1976
|
-
if (isSymbol_default(value)) {
|
|
1977
|
-
return symbolToString ? symbolToString.call(value) : "";
|
|
1978
|
-
}
|
|
1979
|
-
var result = value + "";
|
|
1980
|
-
return result == "0" && 1 / value == -INFINITY ? "-0" : result;
|
|
1981
|
-
}
|
|
1982
|
-
var baseToString_default = baseToString;
|
|
1983
|
-
|
|
1984
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/toString.js
|
|
1985
|
-
init_process();
|
|
1986
|
-
init_buffer();
|
|
1987
|
-
function toString2(value) {
|
|
1988
|
-
return value == null ? "" : baseToString_default(value);
|
|
1989
|
-
}
|
|
1990
|
-
var toString_default = toString2;
|
|
1991
|
-
|
|
1992
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/camelCase.js
|
|
1993
|
-
init_process();
|
|
1994
|
-
init_buffer();
|
|
1995
|
-
|
|
1996
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/capitalize.js
|
|
1997
|
-
init_process();
|
|
1998
|
-
init_buffer();
|
|
1999
|
-
|
|
2000
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/upperFirst.js
|
|
2001
|
-
init_process();
|
|
2002
|
-
init_buffer();
|
|
2003
|
-
|
|
2004
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_createCaseFirst.js
|
|
2005
|
-
init_process();
|
|
2006
|
-
init_buffer();
|
|
2007
|
-
|
|
2008
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_castSlice.js
|
|
2009
|
-
init_process();
|
|
2010
|
-
init_buffer();
|
|
2011
|
-
|
|
2012
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseSlice.js
|
|
2013
|
-
init_process();
|
|
2014
|
-
init_buffer();
|
|
2015
|
-
function baseSlice(array, start, end) {
|
|
2016
|
-
var index = -1, length = array.length;
|
|
2017
|
-
if (start < 0) {
|
|
2018
|
-
start = -start > length ? 0 : length + start;
|
|
2019
|
-
}
|
|
2020
|
-
end = end > length ? length : end;
|
|
2021
|
-
if (end < 0) {
|
|
2022
|
-
end += length;
|
|
2023
|
-
}
|
|
2024
|
-
length = start > end ? 0 : end - start >>> 0;
|
|
2025
|
-
start >>>= 0;
|
|
2026
|
-
var result = Array(length);
|
|
2027
|
-
while (++index < length) {
|
|
2028
|
-
result[index] = array[index + start];
|
|
2029
|
-
}
|
|
2030
|
-
return result;
|
|
2031
|
-
}
|
|
2032
|
-
var baseSlice_default = baseSlice;
|
|
2033
|
-
|
|
2034
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_castSlice.js
|
|
2035
|
-
function castSlice(array, start, end) {
|
|
2036
|
-
var length = array.length;
|
|
2037
|
-
end = end === void 0 ? length : end;
|
|
2038
|
-
return !start && end >= length ? array : baseSlice_default(array, start, end);
|
|
2039
|
-
}
|
|
2040
|
-
var castSlice_default = castSlice;
|
|
2041
|
-
|
|
2042
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hasUnicode.js
|
|
2043
|
-
init_process();
|
|
2044
|
-
init_buffer();
|
|
2045
|
-
var rsAstralRange = "\\ud800-\\udfff";
|
|
2046
|
-
var rsComboMarksRange = "\\u0300-\\u036f";
|
|
2047
|
-
var reComboHalfMarksRange = "\\ufe20-\\ufe2f";
|
|
2048
|
-
var rsComboSymbolsRange = "\\u20d0-\\u20ff";
|
|
2049
|
-
var rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
|
|
2050
|
-
var rsVarRange = "\\ufe0e\\ufe0f";
|
|
2051
|
-
var rsZWJ = "\\u200d";
|
|
2052
|
-
var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]");
|
|
2053
|
-
function hasUnicode(string) {
|
|
2054
|
-
return reHasUnicode.test(string);
|
|
2055
|
-
}
|
|
2056
|
-
var hasUnicode_default = hasUnicode;
|
|
2057
|
-
|
|
2058
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_stringToArray.js
|
|
2059
|
-
init_process();
|
|
2060
|
-
init_buffer();
|
|
2061
|
-
|
|
2062
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_asciiToArray.js
|
|
2063
|
-
init_process();
|
|
2064
|
-
init_buffer();
|
|
2065
|
-
function asciiToArray(string) {
|
|
2066
|
-
return string.split("");
|
|
2067
|
-
}
|
|
2068
|
-
var asciiToArray_default = asciiToArray;
|
|
2069
|
-
|
|
2070
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_unicodeToArray.js
|
|
2071
|
-
init_process();
|
|
2072
|
-
init_buffer();
|
|
2073
|
-
var rsAstralRange2 = "\\ud800-\\udfff";
|
|
2074
|
-
var rsComboMarksRange2 = "\\u0300-\\u036f";
|
|
2075
|
-
var reComboHalfMarksRange2 = "\\ufe20-\\ufe2f";
|
|
2076
|
-
var rsComboSymbolsRange2 = "\\u20d0-\\u20ff";
|
|
2077
|
-
var rsComboRange2 = rsComboMarksRange2 + reComboHalfMarksRange2 + rsComboSymbolsRange2;
|
|
2078
|
-
var rsVarRange2 = "\\ufe0e\\ufe0f";
|
|
2079
|
-
var rsAstral = "[" + rsAstralRange2 + "]";
|
|
2080
|
-
var rsCombo = "[" + rsComboRange2 + "]";
|
|
2081
|
-
var rsFitz = "\\ud83c[\\udffb-\\udfff]";
|
|
2082
|
-
var rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")";
|
|
2083
|
-
var rsNonAstral = "[^" + rsAstralRange2 + "]";
|
|
2084
|
-
var rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}";
|
|
2085
|
-
var rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]";
|
|
2086
|
-
var rsZWJ2 = "\\u200d";
|
|
2087
|
-
var reOptMod = rsModifier + "?";
|
|
2088
|
-
var rsOptVar = "[" + rsVarRange2 + "]?";
|
|
2089
|
-
var rsOptJoin = "(?:" + rsZWJ2 + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*";
|
|
2090
|
-
var rsSeq = rsOptVar + reOptMod + rsOptJoin;
|
|
2091
|
-
var rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")";
|
|
2092
|
-
var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
|
|
2093
|
-
function unicodeToArray(string) {
|
|
2094
|
-
return string.match(reUnicode) || [];
|
|
2095
|
-
}
|
|
2096
|
-
var unicodeToArray_default = unicodeToArray;
|
|
2097
|
-
|
|
2098
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_stringToArray.js
|
|
2099
|
-
function stringToArray(string) {
|
|
2100
|
-
return hasUnicode_default(string) ? unicodeToArray_default(string) : asciiToArray_default(string);
|
|
2101
|
-
}
|
|
2102
|
-
var stringToArray_default = stringToArray;
|
|
2103
|
-
|
|
2104
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_createCaseFirst.js
|
|
2105
|
-
function createCaseFirst(methodName) {
|
|
2106
|
-
return function(string) {
|
|
2107
|
-
string = toString_default(string);
|
|
2108
|
-
var strSymbols = hasUnicode_default(string) ? stringToArray_default(string) : void 0;
|
|
2109
|
-
var chr = strSymbols ? strSymbols[0] : string.charAt(0);
|
|
2110
|
-
var trailing = strSymbols ? castSlice_default(strSymbols, 1).join("") : string.slice(1);
|
|
2111
|
-
return chr[methodName]() + trailing;
|
|
2112
|
-
};
|
|
2113
|
-
}
|
|
2114
|
-
var createCaseFirst_default = createCaseFirst;
|
|
2115
|
-
|
|
2116
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/upperFirst.js
|
|
2117
|
-
var upperFirst = createCaseFirst_default("toUpperCase");
|
|
2118
|
-
var upperFirst_default = upperFirst;
|
|
2119
|
-
|
|
2120
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/capitalize.js
|
|
2121
|
-
function capitalize(string) {
|
|
2122
|
-
return upperFirst_default(toString_default(string).toLowerCase());
|
|
2123
|
-
}
|
|
2124
|
-
var capitalize_default = capitalize;
|
|
2125
|
-
|
|
2126
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_createCompounder.js
|
|
2127
|
-
init_process();
|
|
2128
|
-
init_buffer();
|
|
2129
|
-
|
|
2130
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayReduce.js
|
|
2131
|
-
init_process();
|
|
2132
|
-
init_buffer();
|
|
2133
|
-
function arrayReduce(array, iteratee, accumulator, initAccum) {
|
|
2134
|
-
var index = -1, length = array == null ? 0 : array.length;
|
|
2135
|
-
if (initAccum && length) {
|
|
2136
|
-
accumulator = array[++index];
|
|
2137
|
-
}
|
|
2138
|
-
while (++index < length) {
|
|
2139
|
-
accumulator = iteratee(accumulator, array[index], index, array);
|
|
2140
|
-
}
|
|
2141
|
-
return accumulator;
|
|
2142
|
-
}
|
|
2143
|
-
var arrayReduce_default = arrayReduce;
|
|
2144
|
-
|
|
2145
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/deburr.js
|
|
2146
|
-
init_process();
|
|
2147
|
-
init_buffer();
|
|
2148
|
-
|
|
2149
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_deburrLetter.js
|
|
2150
|
-
init_process();
|
|
2151
|
-
init_buffer();
|
|
2152
|
-
|
|
2153
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_basePropertyOf.js
|
|
2154
|
-
init_process();
|
|
2155
|
-
init_buffer();
|
|
2156
|
-
function basePropertyOf(object) {
|
|
2157
|
-
return function(key) {
|
|
2158
|
-
return object == null ? void 0 : object[key];
|
|
2159
|
-
};
|
|
2160
|
-
}
|
|
2161
|
-
var basePropertyOf_default = basePropertyOf;
|
|
2162
|
-
|
|
2163
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_deburrLetter.js
|
|
2164
|
-
var deburredLetters = {
|
|
2165
|
-
// Latin-1 Supplement block.
|
|
2166
|
-
"\xC0": "A",
|
|
2167
|
-
"\xC1": "A",
|
|
2168
|
-
"\xC2": "A",
|
|
2169
|
-
"\xC3": "A",
|
|
2170
|
-
"\xC4": "A",
|
|
2171
|
-
"\xC5": "A",
|
|
2172
|
-
"\xE0": "a",
|
|
2173
|
-
"\xE1": "a",
|
|
2174
|
-
"\xE2": "a",
|
|
2175
|
-
"\xE3": "a",
|
|
2176
|
-
"\xE4": "a",
|
|
2177
|
-
"\xE5": "a",
|
|
2178
|
-
"\xC7": "C",
|
|
2179
|
-
"\xE7": "c",
|
|
2180
|
-
"\xD0": "D",
|
|
2181
|
-
"\xF0": "d",
|
|
2182
|
-
"\xC8": "E",
|
|
2183
|
-
"\xC9": "E",
|
|
2184
|
-
"\xCA": "E",
|
|
2185
|
-
"\xCB": "E",
|
|
2186
|
-
"\xE8": "e",
|
|
2187
|
-
"\xE9": "e",
|
|
2188
|
-
"\xEA": "e",
|
|
2189
|
-
"\xEB": "e",
|
|
2190
|
-
"\xCC": "I",
|
|
2191
|
-
"\xCD": "I",
|
|
2192
|
-
"\xCE": "I",
|
|
2193
|
-
"\xCF": "I",
|
|
2194
|
-
"\xEC": "i",
|
|
2195
|
-
"\xED": "i",
|
|
2196
|
-
"\xEE": "i",
|
|
2197
|
-
"\xEF": "i",
|
|
2198
|
-
"\xD1": "N",
|
|
2199
|
-
"\xF1": "n",
|
|
2200
|
-
"\xD2": "O",
|
|
2201
|
-
"\xD3": "O",
|
|
2202
|
-
"\xD4": "O",
|
|
2203
|
-
"\xD5": "O",
|
|
2204
|
-
"\xD6": "O",
|
|
2205
|
-
"\xD8": "O",
|
|
2206
|
-
"\xF2": "o",
|
|
2207
|
-
"\xF3": "o",
|
|
2208
|
-
"\xF4": "o",
|
|
2209
|
-
"\xF5": "o",
|
|
2210
|
-
"\xF6": "o",
|
|
2211
|
-
"\xF8": "o",
|
|
2212
|
-
"\xD9": "U",
|
|
2213
|
-
"\xDA": "U",
|
|
2214
|
-
"\xDB": "U",
|
|
2215
|
-
"\xDC": "U",
|
|
2216
|
-
"\xF9": "u",
|
|
2217
|
-
"\xFA": "u",
|
|
2218
|
-
"\xFB": "u",
|
|
2219
|
-
"\xFC": "u",
|
|
2220
|
-
"\xDD": "Y",
|
|
2221
|
-
"\xFD": "y",
|
|
2222
|
-
"\xFF": "y",
|
|
2223
|
-
"\xC6": "Ae",
|
|
2224
|
-
"\xE6": "ae",
|
|
2225
|
-
"\xDE": "Th",
|
|
2226
|
-
"\xFE": "th",
|
|
2227
|
-
"\xDF": "ss",
|
|
2228
|
-
// Latin Extended-A block.
|
|
2229
|
-
"\u0100": "A",
|
|
2230
|
-
"\u0102": "A",
|
|
2231
|
-
"\u0104": "A",
|
|
2232
|
-
"\u0101": "a",
|
|
2233
|
-
"\u0103": "a",
|
|
2234
|
-
"\u0105": "a",
|
|
2235
|
-
"\u0106": "C",
|
|
2236
|
-
"\u0108": "C",
|
|
2237
|
-
"\u010A": "C",
|
|
2238
|
-
"\u010C": "C",
|
|
2239
|
-
"\u0107": "c",
|
|
2240
|
-
"\u0109": "c",
|
|
2241
|
-
"\u010B": "c",
|
|
2242
|
-
"\u010D": "c",
|
|
2243
|
-
"\u010E": "D",
|
|
2244
|
-
"\u0110": "D",
|
|
2245
|
-
"\u010F": "d",
|
|
2246
|
-
"\u0111": "d",
|
|
2247
|
-
"\u0112": "E",
|
|
2248
|
-
"\u0114": "E",
|
|
2249
|
-
"\u0116": "E",
|
|
2250
|
-
"\u0118": "E",
|
|
2251
|
-
"\u011A": "E",
|
|
2252
|
-
"\u0113": "e",
|
|
2253
|
-
"\u0115": "e",
|
|
2254
|
-
"\u0117": "e",
|
|
2255
|
-
"\u0119": "e",
|
|
2256
|
-
"\u011B": "e",
|
|
2257
|
-
"\u011C": "G",
|
|
2258
|
-
"\u011E": "G",
|
|
2259
|
-
"\u0120": "G",
|
|
2260
|
-
"\u0122": "G",
|
|
2261
|
-
"\u011D": "g",
|
|
2262
|
-
"\u011F": "g",
|
|
2263
|
-
"\u0121": "g",
|
|
2264
|
-
"\u0123": "g",
|
|
2265
|
-
"\u0124": "H",
|
|
2266
|
-
"\u0126": "H",
|
|
2267
|
-
"\u0125": "h",
|
|
2268
|
-
"\u0127": "h",
|
|
2269
|
-
"\u0128": "I",
|
|
2270
|
-
"\u012A": "I",
|
|
2271
|
-
"\u012C": "I",
|
|
2272
|
-
"\u012E": "I",
|
|
2273
|
-
"\u0130": "I",
|
|
2274
|
-
"\u0129": "i",
|
|
2275
|
-
"\u012B": "i",
|
|
2276
|
-
"\u012D": "i",
|
|
2277
|
-
"\u012F": "i",
|
|
2278
|
-
"\u0131": "i",
|
|
2279
|
-
"\u0134": "J",
|
|
2280
|
-
"\u0135": "j",
|
|
2281
|
-
"\u0136": "K",
|
|
2282
|
-
"\u0137": "k",
|
|
2283
|
-
"\u0138": "k",
|
|
2284
|
-
"\u0139": "L",
|
|
2285
|
-
"\u013B": "L",
|
|
2286
|
-
"\u013D": "L",
|
|
2287
|
-
"\u013F": "L",
|
|
2288
|
-
"\u0141": "L",
|
|
2289
|
-
"\u013A": "l",
|
|
2290
|
-
"\u013C": "l",
|
|
2291
|
-
"\u013E": "l",
|
|
2292
|
-
"\u0140": "l",
|
|
2293
|
-
"\u0142": "l",
|
|
2294
|
-
"\u0143": "N",
|
|
2295
|
-
"\u0145": "N",
|
|
2296
|
-
"\u0147": "N",
|
|
2297
|
-
"\u014A": "N",
|
|
2298
|
-
"\u0144": "n",
|
|
2299
|
-
"\u0146": "n",
|
|
2300
|
-
"\u0148": "n",
|
|
2301
|
-
"\u014B": "n",
|
|
2302
|
-
"\u014C": "O",
|
|
2303
|
-
"\u014E": "O",
|
|
2304
|
-
"\u0150": "O",
|
|
2305
|
-
"\u014D": "o",
|
|
2306
|
-
"\u014F": "o",
|
|
2307
|
-
"\u0151": "o",
|
|
2308
|
-
"\u0154": "R",
|
|
2309
|
-
"\u0156": "R",
|
|
2310
|
-
"\u0158": "R",
|
|
2311
|
-
"\u0155": "r",
|
|
2312
|
-
"\u0157": "r",
|
|
2313
|
-
"\u0159": "r",
|
|
2314
|
-
"\u015A": "S",
|
|
2315
|
-
"\u015C": "S",
|
|
2316
|
-
"\u015E": "S",
|
|
2317
|
-
"\u0160": "S",
|
|
2318
|
-
"\u015B": "s",
|
|
2319
|
-
"\u015D": "s",
|
|
2320
|
-
"\u015F": "s",
|
|
2321
|
-
"\u0161": "s",
|
|
2322
|
-
"\u0162": "T",
|
|
2323
|
-
"\u0164": "T",
|
|
2324
|
-
"\u0166": "T",
|
|
2325
|
-
"\u0163": "t",
|
|
2326
|
-
"\u0165": "t",
|
|
2327
|
-
"\u0167": "t",
|
|
2328
|
-
"\u0168": "U",
|
|
2329
|
-
"\u016A": "U",
|
|
2330
|
-
"\u016C": "U",
|
|
2331
|
-
"\u016E": "U",
|
|
2332
|
-
"\u0170": "U",
|
|
2333
|
-
"\u0172": "U",
|
|
2334
|
-
"\u0169": "u",
|
|
2335
|
-
"\u016B": "u",
|
|
2336
|
-
"\u016D": "u",
|
|
2337
|
-
"\u016F": "u",
|
|
2338
|
-
"\u0171": "u",
|
|
2339
|
-
"\u0173": "u",
|
|
2340
|
-
"\u0174": "W",
|
|
2341
|
-
"\u0175": "w",
|
|
2342
|
-
"\u0176": "Y",
|
|
2343
|
-
"\u0177": "y",
|
|
2344
|
-
"\u0178": "Y",
|
|
2345
|
-
"\u0179": "Z",
|
|
2346
|
-
"\u017B": "Z",
|
|
2347
|
-
"\u017D": "Z",
|
|
2348
|
-
"\u017A": "z",
|
|
2349
|
-
"\u017C": "z",
|
|
2350
|
-
"\u017E": "z",
|
|
2351
|
-
"\u0132": "IJ",
|
|
2352
|
-
"\u0133": "ij",
|
|
2353
|
-
"\u0152": "Oe",
|
|
2354
|
-
"\u0153": "oe",
|
|
2355
|
-
"\u0149": "'n",
|
|
2356
|
-
"\u017F": "s"
|
|
2357
|
-
};
|
|
2358
|
-
var deburrLetter = basePropertyOf_default(deburredLetters);
|
|
2359
|
-
var deburrLetter_default = deburrLetter;
|
|
2360
|
-
|
|
2361
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/deburr.js
|
|
2362
|
-
var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
|
|
2363
|
-
var rsComboMarksRange3 = "\\u0300-\\u036f";
|
|
2364
|
-
var reComboHalfMarksRange3 = "\\ufe20-\\ufe2f";
|
|
2365
|
-
var rsComboSymbolsRange3 = "\\u20d0-\\u20ff";
|
|
2366
|
-
var rsComboRange3 = rsComboMarksRange3 + reComboHalfMarksRange3 + rsComboSymbolsRange3;
|
|
2367
|
-
var rsCombo2 = "[" + rsComboRange3 + "]";
|
|
2368
|
-
var reComboMark = RegExp(rsCombo2, "g");
|
|
2369
|
-
function deburr(string) {
|
|
2370
|
-
string = toString_default(string);
|
|
2371
|
-
return string && string.replace(reLatin, deburrLetter_default).replace(reComboMark, "");
|
|
2372
|
-
}
|
|
2373
|
-
var deburr_default = deburr;
|
|
2374
|
-
|
|
2375
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/words.js
|
|
2376
|
-
init_process();
|
|
2377
|
-
init_buffer();
|
|
2378
|
-
|
|
2379
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_asciiWords.js
|
|
2380
|
-
init_process();
|
|
2381
|
-
init_buffer();
|
|
2382
|
-
var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
|
|
2383
|
-
function asciiWords(string) {
|
|
2384
|
-
return string.match(reAsciiWord) || [];
|
|
2385
|
-
}
|
|
2386
|
-
var asciiWords_default = asciiWords;
|
|
2387
|
-
|
|
2388
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hasUnicodeWord.js
|
|
2389
|
-
init_process();
|
|
2390
|
-
init_buffer();
|
|
2391
|
-
var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
|
|
2392
|
-
function hasUnicodeWord(string) {
|
|
2393
|
-
return reHasUnicodeWord.test(string);
|
|
2394
|
-
}
|
|
2395
|
-
var hasUnicodeWord_default = hasUnicodeWord;
|
|
2396
|
-
|
|
2397
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_unicodeWords.js
|
|
2398
|
-
init_process();
|
|
2399
|
-
init_buffer();
|
|
2400
|
-
var rsAstralRange3 = "\\ud800-\\udfff";
|
|
2401
|
-
var rsComboMarksRange4 = "\\u0300-\\u036f";
|
|
2402
|
-
var reComboHalfMarksRange4 = "\\ufe20-\\ufe2f";
|
|
2403
|
-
var rsComboSymbolsRange4 = "\\u20d0-\\u20ff";
|
|
2404
|
-
var rsComboRange4 = rsComboMarksRange4 + reComboHalfMarksRange4 + rsComboSymbolsRange4;
|
|
2405
|
-
var rsDingbatRange = "\\u2700-\\u27bf";
|
|
2406
|
-
var rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff";
|
|
2407
|
-
var rsMathOpRange = "\\xac\\xb1\\xd7\\xf7";
|
|
2408
|
-
var rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf";
|
|
2409
|
-
var rsPunctuationRange = "\\u2000-\\u206f";
|
|
2410
|
-
var rsSpaceRange = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000";
|
|
2411
|
-
var rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde";
|
|
2412
|
-
var rsVarRange3 = "\\ufe0e\\ufe0f";
|
|
2413
|
-
var rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
|
|
2414
|
-
var rsApos = "['\u2019]";
|
|
2415
|
-
var rsBreak = "[" + rsBreakRange + "]";
|
|
2416
|
-
var rsCombo3 = "[" + rsComboRange4 + "]";
|
|
2417
|
-
var rsDigits = "\\d+";
|
|
2418
|
-
var rsDingbat = "[" + rsDingbatRange + "]";
|
|
2419
|
-
var rsLower = "[" + rsLowerRange + "]";
|
|
2420
|
-
var rsMisc = "[^" + rsAstralRange3 + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]";
|
|
2421
|
-
var rsFitz2 = "\\ud83c[\\udffb-\\udfff]";
|
|
2422
|
-
var rsModifier2 = "(?:" + rsCombo3 + "|" + rsFitz2 + ")";
|
|
2423
|
-
var rsNonAstral2 = "[^" + rsAstralRange3 + "]";
|
|
2424
|
-
var rsRegional2 = "(?:\\ud83c[\\udde6-\\uddff]){2}";
|
|
2425
|
-
var rsSurrPair2 = "[\\ud800-\\udbff][\\udc00-\\udfff]";
|
|
2426
|
-
var rsUpper = "[" + rsUpperRange + "]";
|
|
2427
|
-
var rsZWJ3 = "\\u200d";
|
|
2428
|
-
var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")";
|
|
2429
|
-
var rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")";
|
|
2430
|
-
var rsOptContrLower = "(?:" + rsApos + "(?:d|ll|m|re|s|t|ve))?";
|
|
2431
|
-
var rsOptContrUpper = "(?:" + rsApos + "(?:D|LL|M|RE|S|T|VE))?";
|
|
2432
|
-
var reOptMod2 = rsModifier2 + "?";
|
|
2433
|
-
var rsOptVar2 = "[" + rsVarRange3 + "]?";
|
|
2434
|
-
var rsOptJoin2 = "(?:" + rsZWJ3 + "(?:" + [rsNonAstral2, rsRegional2, rsSurrPair2].join("|") + ")" + rsOptVar2 + reOptMod2 + ")*";
|
|
2435
|
-
var rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])";
|
|
2436
|
-
var rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])";
|
|
2437
|
-
var rsSeq2 = rsOptVar2 + reOptMod2 + rsOptJoin2;
|
|
2438
|
-
var rsEmoji = "(?:" + [rsDingbat, rsRegional2, rsSurrPair2].join("|") + ")" + rsSeq2;
|
|
2439
|
-
var reUnicodeWord = RegExp([
|
|
2440
|
-
rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
|
|
2441
|
-
rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
|
|
2442
|
-
rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
|
|
2443
|
-
rsUpper + "+" + rsOptContrUpper,
|
|
2444
|
-
rsOrdUpper,
|
|
2445
|
-
rsOrdLower,
|
|
2446
|
-
rsDigits,
|
|
2447
|
-
rsEmoji
|
|
2448
|
-
].join("|"), "g");
|
|
2449
|
-
function unicodeWords(string) {
|
|
2450
|
-
return string.match(reUnicodeWord) || [];
|
|
2451
|
-
}
|
|
2452
|
-
var unicodeWords_default = unicodeWords;
|
|
2453
|
-
|
|
2454
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/words.js
|
|
2455
|
-
function words(string, pattern, guard) {
|
|
2456
|
-
string = toString_default(string);
|
|
2457
|
-
pattern = guard ? void 0 : pattern;
|
|
2458
|
-
if (pattern === void 0) {
|
|
2459
|
-
return hasUnicodeWord_default(string) ? unicodeWords_default(string) : asciiWords_default(string);
|
|
2460
|
-
}
|
|
2461
|
-
return string.match(pattern) || [];
|
|
2462
|
-
}
|
|
2463
|
-
var words_default = words;
|
|
2464
|
-
|
|
2465
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_createCompounder.js
|
|
2466
|
-
var rsApos2 = "['\u2019]";
|
|
2467
|
-
var reApos = RegExp(rsApos2, "g");
|
|
2468
|
-
function createCompounder(callback) {
|
|
2469
|
-
return function(string) {
|
|
2470
|
-
return arrayReduce_default(words_default(deburr_default(string).replace(reApos, "")), callback, "");
|
|
2471
|
-
};
|
|
2472
|
-
}
|
|
2473
|
-
var createCompounder_default = createCompounder;
|
|
2474
|
-
|
|
2475
|
-
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/camelCase.js
|
|
2476
|
-
var camelCase = createCompounder_default(function(result, word, index) {
|
|
2477
|
-
word = word.toLowerCase();
|
|
2478
|
-
return result + (index ? capitalize_default(word) : word);
|
|
2479
|
-
});
|
|
2480
|
-
var camelCase_default = camelCase;
|
|
2481
|
-
|
|
2482
|
-
// ../../browser-compatible-base/lib/ast/index.js
|
|
2483
|
-
init_process();
|
|
2484
|
-
init_buffer();
|
|
2485
|
-
|
|
2486
|
-
// ../../browser-compatible-base/lib/ast/AbstractAstNode.js
|
|
2487
|
-
init_process();
|
|
2488
|
-
init_buffer();
|
|
2489
|
-
var AbstractAstNode = class {
|
|
2490
|
-
};
|
|
2491
|
-
|
|
2492
|
-
// ../../browser-compatible-base/lib/ast/AbstractWriter.js
|
|
2493
|
-
init_process();
|
|
2494
|
-
init_buffer();
|
|
2495
|
-
|
|
2496
|
-
// ../../browser-compatible-base/lib/ast/CodeBlock.js
|
|
2497
|
-
init_process();
|
|
2498
|
-
init_buffer();
|
|
2499
|
-
var CodeBlock = class extends AbstractAstNode {
|
|
2500
|
-
constructor(value) {
|
|
2501
|
-
super();
|
|
2502
|
-
__publicField(this, "value");
|
|
2503
|
-
this.value = value;
|
|
2504
|
-
}
|
|
2505
|
-
write(writer) {
|
|
2506
|
-
if (typeof this.value === "string") {
|
|
2507
|
-
writer.write(this.value);
|
|
2508
|
-
} else {
|
|
2509
|
-
this.value(writer);
|
|
2510
|
-
}
|
|
2511
|
-
}
|
|
2512
|
-
};
|
|
2513
|
-
|
|
2514
|
-
// ../../browser-compatible-base/lib/ast/AbstractWriter.js
|
|
2515
|
-
var TAB_SIZE = 4;
|
|
2516
|
-
var AbstractWriter = class {
|
|
2517
|
-
constructor() {
|
|
2518
|
-
/* The contents being written */
|
|
2519
|
-
__publicField(this, "buffer", "");
|
|
2520
|
-
/* Indentation level (multiple of 4) */
|
|
2521
|
-
__publicField(this, "indentLevel", 0);
|
|
2522
|
-
/* Whether anything has been written to the buffer */
|
|
2523
|
-
__publicField(this, "hasWrittenAnything", false);
|
|
2524
|
-
/* Whether the last character written was a newline */
|
|
2525
|
-
__publicField(this, "lastCharacterIsNewline", false);
|
|
2526
|
-
}
|
|
2527
|
-
/**
|
|
2528
|
-
* Writes arbitrary text
|
|
2529
|
-
* @param text
|
|
2530
|
-
*/
|
|
2531
|
-
write(text) {
|
|
2532
|
-
const textEndsInNewline = text.length > 0 && text.endsWith("\n");
|
|
2533
|
-
const textWithoutNewline = textEndsInNewline ? text.substring(0, text.length - 1) : text;
|
|
2534
|
-
const indent = this.getIndentString();
|
|
2535
|
-
let indentedText = textWithoutNewline.replaceAll("\n", `
|
|
2536
|
-
${indent}`);
|
|
2537
|
-
if (this.isAtStartOfLine()) {
|
|
2538
|
-
indentedText = indent + indentedText;
|
|
2539
|
-
}
|
|
2540
|
-
if (textEndsInNewline) {
|
|
2541
|
-
indentedText += "\n";
|
|
2542
|
-
}
|
|
2543
|
-
this.writeInternal(indentedText);
|
|
2544
|
-
}
|
|
2545
|
-
/**
|
|
2546
|
-
* Writes arbitrary text without indentation
|
|
2547
|
-
* @param text
|
|
2548
|
-
*/
|
|
2549
|
-
writeNoIndent(text) {
|
|
2550
|
-
const currIndentLevel = this.indentLevel;
|
|
2551
|
-
this.indentLevel = 0;
|
|
2552
|
-
this.write(text);
|
|
2553
|
-
this.indentLevel = currIndentLevel;
|
|
2554
|
-
}
|
|
2555
|
-
/**
|
|
2556
|
-
* Writes a node
|
|
2557
|
-
* @param node
|
|
2558
|
-
*/
|
|
2559
|
-
writeNode(node) {
|
|
2560
|
-
node.write(this);
|
|
2561
|
-
}
|
|
2562
|
-
/**
|
|
2563
|
-
* Writes a node but then suffixes with a `;` and new line
|
|
2564
|
-
* @param node
|
|
2565
|
-
*/
|
|
2566
|
-
writeNodeStatement(node) {
|
|
2567
|
-
node.write(this);
|
|
2568
|
-
this.write(";");
|
|
2569
|
-
this.writeNewLineIfLastLineNot();
|
|
2570
|
-
}
|
|
2571
|
-
/**
|
|
2572
|
-
* Writes text but then suffixes with a `;`
|
|
2573
|
-
* @param node
|
|
2574
|
-
*/
|
|
2575
|
-
writeTextStatement(text) {
|
|
2576
|
-
const codeBlock = new CodeBlock(text);
|
|
2577
|
-
codeBlock.write(this);
|
|
2578
|
-
this.write(";");
|
|
2579
|
-
this.writeNewLineIfLastLineNot();
|
|
2580
|
-
}
|
|
2581
|
-
/**
|
|
2582
|
-
* Writes text but then suffixes with a `;`
|
|
2583
|
-
* @param node
|
|
2584
|
-
*/
|
|
2585
|
-
controlFlow(prefix, statement) {
|
|
2586
|
-
const codeBlock = new CodeBlock(prefix);
|
|
2587
|
-
codeBlock.write(this);
|
|
2588
|
-
this.write(" (");
|
|
2589
|
-
this.writeNode(statement);
|
|
2590
|
-
this.write(") {");
|
|
2591
|
-
this.writeNewLineIfLastLineNot();
|
|
2592
|
-
this.indent();
|
|
2593
|
-
}
|
|
2594
|
-
/**
|
|
2595
|
-
* Writes text but then suffixes with a `;`
|
|
2596
|
-
* @param node
|
|
2597
|
-
*/
|
|
2598
|
-
endControlFlow() {
|
|
2599
|
-
this.dedent();
|
|
2600
|
-
this.writeLine("}");
|
|
2601
|
-
}
|
|
2602
|
-
/**
|
|
2603
|
-
* Please try to not use this. It is here for swift.
|
|
2604
|
-
* @param titles
|
|
2605
|
-
* @param openingCharacter
|
|
2606
|
-
* @param callback
|
|
2607
|
-
* @param closingCharacter
|
|
2608
|
-
*/
|
|
2609
|
-
openBlock(titles, openingCharacter = "{", callback, closingCharacter = "}") {
|
|
2610
|
-
const filteredTitles = titles.filter((title2) => title2 !== void 0).join(" ");
|
|
2611
|
-
if (filteredTitles) {
|
|
2612
|
-
this.write(`${filteredTitles} ${openingCharacter != null ? openingCharacter : ""}`);
|
|
2613
|
-
} else {
|
|
2614
|
-
this.write(openingCharacter != null ? openingCharacter : "");
|
|
2615
|
-
}
|
|
2616
|
-
try {
|
|
2617
|
-
this.indent();
|
|
2618
|
-
callback();
|
|
2619
|
-
this.dedent();
|
|
2620
|
-
} finally {
|
|
2621
|
-
this.write(closingCharacter != null ? closingCharacter : "");
|
|
2622
|
-
}
|
|
2623
|
-
}
|
|
2624
|
-
/* Only writes a newline if last line in the buffer is not a newline */
|
|
2625
|
-
writeLine(text = "") {
|
|
2626
|
-
this.write(text);
|
|
2627
|
-
this.writeNewLineIfLastLineNot();
|
|
2628
|
-
}
|
|
2629
|
-
/* Always writes newline */
|
|
2630
|
-
newLine() {
|
|
2631
|
-
this.writeInternal("\n");
|
|
2632
|
-
}
|
|
2633
|
-
writeNewLineIfLastLineNot() {
|
|
2634
|
-
if (!this.lastCharacterIsNewline) {
|
|
2635
|
-
this.writeInternal("\n");
|
|
2636
|
-
}
|
|
2637
|
-
}
|
|
2638
|
-
indent() {
|
|
2639
|
-
this.indentLevel++;
|
|
2640
|
-
}
|
|
2641
|
-
dedent() {
|
|
2642
|
-
this.indentLevel--;
|
|
2643
|
-
}
|
|
2644
|
-
delimit({ nodes, delimiter, writeFunction }) {
|
|
2645
|
-
if (nodes.length > 0) {
|
|
2646
|
-
const firstNode = nodes[0];
|
|
2647
|
-
if (firstNode != null) {
|
|
2648
|
-
writeFunction(firstNode);
|
|
2649
|
-
}
|
|
2650
|
-
for (let i = 1; i < nodes.length; i++) {
|
|
2651
|
-
this.write(delimiter);
|
|
2652
|
-
const node = nodes[i];
|
|
2653
|
-
if (node != null) {
|
|
2654
|
-
writeFunction(node);
|
|
2655
|
-
}
|
|
2656
|
-
}
|
|
2657
|
-
}
|
|
2658
|
-
}
|
|
2659
|
-
/*******************************
|
|
2660
|
-
* Helper Methods
|
|
2661
|
-
*******************************/
|
|
2662
|
-
writeInternal(text) {
|
|
2663
|
-
if (text.length > 0) {
|
|
2664
|
-
this.hasWrittenAnything = true;
|
|
2665
|
-
this.lastCharacterIsNewline = text.endsWith("\n");
|
|
2666
|
-
}
|
|
2667
|
-
return this.buffer += text;
|
|
2668
|
-
}
|
|
2669
|
-
isAtStartOfLine() {
|
|
2670
|
-
return this.lastCharacterIsNewline || !this.hasWrittenAnything;
|
|
2671
|
-
}
|
|
2672
|
-
getIndentString() {
|
|
2673
|
-
return " ".repeat(this.indentLevel * TAB_SIZE);
|
|
2674
|
-
}
|
|
2675
|
-
};
|
|
2676
|
-
|
|
2677
|
-
// ../../browser-compatible-base/lib/dynamic-snippets/index.js
|
|
2678
|
-
init_process();
|
|
2679
|
-
init_buffer();
|
|
2680
|
-
|
|
2681
|
-
// ../../browser-compatible-base/lib/dynamic-snippets/AbstractDynamicSnippetsGeneratorContext.js
|
|
2682
|
-
init_process();
|
|
2683
|
-
init_buffer();
|
|
2684
|
-
|
|
2685
|
-
// ../../../packages/cli/fern-definition/schema/lib/index.js
|
|
2686
|
-
init_process();
|
|
2687
|
-
init_buffer();
|
|
2688
|
-
|
|
2689
|
-
// ../../../packages/cli/fern-definition/schema/lib/utils/HttpEndpointReferenceParser.js
|
|
2690
|
-
init_process();
|
|
2691
|
-
init_buffer();
|
|
2692
|
-
var HttpEndpointReferenceParser = class {
|
|
2693
|
-
constructor() {
|
|
2694
|
-
//eslint-disable-next-line
|
|
2695
|
-
__publicField(this, "REFERENCE_REGEX", /^(GET|POST|PUT|DELETE|PATCH)\s(\/[a-zA-Z0-9\/{}_-]*)$/);
|
|
2696
|
-
}
|
|
2697
|
-
validate(reference2) {
|
|
2698
|
-
const validFormat = this.REFERENCE_REGEX.test(reference2);
|
|
2699
|
-
if (!validFormat) {
|
|
2700
|
-
return { type: "invalid" };
|
|
2701
|
-
}
|
|
2702
|
-
return { type: "valid" };
|
|
2703
|
-
}
|
|
2704
|
-
tryParse(reference2) {
|
|
2705
|
-
const validationResponse = this.validate(reference2);
|
|
2706
|
-
if (validationResponse.type === "invalid") {
|
|
2707
|
-
return void 0;
|
|
2708
|
-
}
|
|
2709
|
-
const match = reference2.match(this.REFERENCE_REGEX);
|
|
2710
|
-
if (match == null || match[1] == null || match[2] == null) {
|
|
2711
|
-
return void 0;
|
|
2712
|
-
}
|
|
2713
|
-
return {
|
|
2714
|
-
method: match[1],
|
|
2715
|
-
path: match[2]
|
|
2716
|
-
};
|
|
2717
|
-
}
|
|
2718
|
-
};
|
|
2719
|
-
|
|
2720
|
-
// ../../browser-compatible-base/lib/dynamic-snippets/ErrorReporter.js
|
|
2721
|
-
init_process();
|
|
2722
|
-
init_buffer();
|
|
2723
|
-
var Severity = {
|
|
2724
|
-
Critical: "CRITICAL",
|
|
2725
|
-
Warning: "WARNING"
|
|
2726
|
-
};
|
|
2727
|
-
var ErrorReporter = class _ErrorReporter {
|
|
2728
|
-
constructor() {
|
|
2729
|
-
__publicField(this, "errors");
|
|
2730
|
-
__publicField(this, "path");
|
|
2731
|
-
this.errors = [];
|
|
2732
|
-
this.path = [];
|
|
2733
|
-
}
|
|
2734
|
-
add(err) {
|
|
2735
|
-
this.errors.push(__spreadProps(__spreadValues({}, err), {
|
|
2736
|
-
path: [...this.path]
|
|
2737
|
-
}));
|
|
2738
|
-
}
|
|
2739
|
-
scope(path) {
|
|
2740
|
-
this.path.push(path);
|
|
2741
|
-
}
|
|
2742
|
-
unscope() {
|
|
2743
|
-
this.path.pop();
|
|
2744
|
-
}
|
|
2745
|
-
getBySeverity(severity) {
|
|
2746
|
-
return this.errors.filter((err) => err.severity === severity);
|
|
2747
|
-
}
|
|
2748
|
-
empty() {
|
|
2749
|
-
return this.errors.length === 0;
|
|
2750
|
-
}
|
|
2751
|
-
size() {
|
|
2752
|
-
return this.errors.length;
|
|
2753
|
-
}
|
|
2754
|
-
clone() {
|
|
2755
|
-
const clone = new _ErrorReporter();
|
|
2756
|
-
clone.errors = [...this.errors];
|
|
2757
|
-
clone.path = [...this.path];
|
|
2758
|
-
return clone;
|
|
2759
|
-
}
|
|
2760
|
-
reset() {
|
|
2761
|
-
this.errors = [];
|
|
2762
|
-
this.path = [];
|
|
2763
|
-
}
|
|
2764
|
-
toDynamicSnippetErrors() {
|
|
2765
|
-
return this.errors.map((err) => ({
|
|
2766
|
-
severity: err.severity,
|
|
2767
|
-
path: err.path != null ? this.pathToStringArray(err.path) : void 0,
|
|
2768
|
-
message: err.message
|
|
2769
|
-
}));
|
|
2770
|
-
}
|
|
2771
|
-
pathToStringArray(path) {
|
|
2772
|
-
const result = [];
|
|
2773
|
-
for (const item of path) {
|
|
2774
|
-
if (typeof item === "string") {
|
|
2775
|
-
result.push(item);
|
|
2776
|
-
continue;
|
|
2777
|
-
}
|
|
2778
|
-
result[result.length - 1] += `[${item.index}]`;
|
|
2779
|
-
}
|
|
2780
|
-
return result;
|
|
2781
|
-
}
|
|
2782
|
-
};
|
|
2783
|
-
|
|
2784
|
-
// ../../browser-compatible-base/lib/dynamic-snippets/AbstractDynamicSnippetsGeneratorContext.js
|
|
2785
|
-
var AbstractDynamicSnippetsGeneratorContext = class {
|
|
2786
|
-
constructor({ ir, config: config2 }) {
|
|
2787
|
-
__publicField(this, "config");
|
|
2788
|
-
__publicField(this, "errors");
|
|
2789
|
-
__publicField(this, "_ir");
|
|
2790
|
-
__publicField(this, "httpEndpointReferenceParser");
|
|
2791
|
-
this._ir = ir;
|
|
2792
|
-
this.config = config2;
|
|
2793
|
-
this.errors = new ErrorReporter();
|
|
2794
|
-
this.httpEndpointReferenceParser = new HttpEndpointReferenceParser();
|
|
2795
|
-
}
|
|
2796
|
-
associateQueryParametersByWireValue({ parameters, values }) {
|
|
2797
|
-
const instances = [];
|
|
2798
|
-
for (const [key, value] of Object.entries(values)) {
|
|
2799
|
-
this.errors.scope(key);
|
|
2800
|
-
try {
|
|
2801
|
-
const parameter2 = parameters.find((param) => param.name.wireValue === key);
|
|
2802
|
-
if (parameter2 == null) {
|
|
2803
|
-
throw this.newParameterNotRecognizedError(key);
|
|
2804
|
-
}
|
|
2805
|
-
const typeInstanceValue = this.isListTypeReference(parameter2.typeReference) && !Array.isArray(value) ? [value] : value;
|
|
2806
|
-
instances.push({
|
|
2807
|
-
name: parameter2.name,
|
|
2808
|
-
typeReference: parameter2.typeReference,
|
|
2809
|
-
value: typeInstanceValue
|
|
2810
|
-
});
|
|
2811
|
-
} finally {
|
|
2812
|
-
this.errors.unscope();
|
|
2813
|
-
}
|
|
2814
|
-
}
|
|
2815
|
-
return instances;
|
|
2816
|
-
}
|
|
2817
|
-
associateByWireValue({ parameters, values, ignoreMissingParameters }) {
|
|
2818
|
-
const instances = [];
|
|
2819
|
-
for (const [key, value] of Object.entries(values)) {
|
|
2820
|
-
this.errors.scope(key);
|
|
2821
|
-
try {
|
|
2822
|
-
const parameter2 = parameters.find((param) => param.name.wireValue === key);
|
|
2823
|
-
if (parameter2 == null) {
|
|
2824
|
-
if (ignoreMissingParameters) {
|
|
2825
|
-
continue;
|
|
2826
|
-
}
|
|
2827
|
-
this.errors.add({
|
|
2828
|
-
severity: Severity.Critical,
|
|
2829
|
-
message: this.newParameterNotRecognizedError(key).message
|
|
2830
|
-
});
|
|
2831
|
-
continue;
|
|
2832
|
-
}
|
|
2833
|
-
instances.push({
|
|
2834
|
-
name: parameter2.name,
|
|
2835
|
-
typeReference: parameter2.typeReference,
|
|
2836
|
-
value
|
|
2837
|
-
});
|
|
2838
|
-
} finally {
|
|
2839
|
-
this.errors.unscope();
|
|
2840
|
-
}
|
|
2841
|
-
}
|
|
2842
|
-
return instances;
|
|
2843
|
-
}
|
|
2844
|
-
getSingleFileValue({ property, record }) {
|
|
2845
|
-
const fileValue = record[property.wireValue];
|
|
2846
|
-
if (fileValue == null) {
|
|
2847
|
-
return void 0;
|
|
2848
|
-
}
|
|
2849
|
-
if (typeof fileValue !== "string") {
|
|
2850
|
-
this.errors.add({
|
|
2851
|
-
severity: Severity.Critical,
|
|
2852
|
-
message: `Expected file value to be a string, got ${typeof fileValue}`
|
|
2853
|
-
});
|
|
2854
|
-
return void 0;
|
|
2855
|
-
}
|
|
2856
|
-
return fileValue;
|
|
2857
|
-
}
|
|
2858
|
-
getFileArrayValues({ property, record }) {
|
|
2859
|
-
const fileArrayValue = record[property.wireValue];
|
|
2860
|
-
if (fileArrayValue == null) {
|
|
2861
|
-
return void 0;
|
|
2862
|
-
}
|
|
2863
|
-
if (!Array.isArray(fileArrayValue)) {
|
|
2864
|
-
this.errors.add({
|
|
2865
|
-
severity: Severity.Critical,
|
|
2866
|
-
message: `Expected file array value to be an array of strings, got ${typeof fileArrayValue}`
|
|
2867
|
-
});
|
|
2868
|
-
return void 0;
|
|
2869
|
-
}
|
|
2870
|
-
const stringValues = [];
|
|
2871
|
-
for (const value of fileArrayValue) {
|
|
2872
|
-
if (typeof value !== "string") {
|
|
2873
|
-
this.errors.add({
|
|
2874
|
-
severity: Severity.Critical,
|
|
2875
|
-
message: `Expected file array value to be an array of strings, got ${typeof value}`
|
|
2876
|
-
});
|
|
2877
|
-
return void 0;
|
|
2878
|
-
}
|
|
2879
|
-
stringValues.push(value);
|
|
2880
|
-
}
|
|
2881
|
-
return stringValues;
|
|
2882
|
-
}
|
|
2883
|
-
getRecord(value) {
|
|
2884
|
-
if (typeof value !== "object" || Array.isArray(value)) {
|
|
2885
|
-
this.errors.add({
|
|
2886
|
-
severity: Severity.Critical,
|
|
2887
|
-
message: `Expected object with key, value pairs but got: ${Array.isArray(value) ? "array" : typeof value}`
|
|
2888
|
-
});
|
|
2889
|
-
return void 0;
|
|
2890
|
-
}
|
|
2891
|
-
if (value == null) {
|
|
2892
|
-
return {};
|
|
2893
|
-
}
|
|
2894
|
-
return value;
|
|
2895
|
-
}
|
|
2896
|
-
resolveNamedType({ typeId }) {
|
|
2897
|
-
const namedType = this._ir.types[typeId];
|
|
2898
|
-
if (namedType == null) {
|
|
2899
|
-
this.errors.add({
|
|
2900
|
-
severity: Severity.Critical,
|
|
2901
|
-
message: `Type identified by "${typeId}" could not be found`
|
|
2902
|
-
});
|
|
2903
|
-
return void 0;
|
|
2904
|
-
}
|
|
2905
|
-
return namedType;
|
|
2906
|
-
}
|
|
2907
|
-
resolveDiscriminatedUnionTypeInstance({ discriminatedUnion, value }) {
|
|
2908
|
-
const record = this.getRecord(value);
|
|
2909
|
-
if (record == null) {
|
|
2910
|
-
return void 0;
|
|
2911
|
-
}
|
|
2912
|
-
const discriminantFieldName = discriminatedUnion.discriminant.wireValue;
|
|
2913
|
-
const discriminantValue = record[discriminantFieldName];
|
|
2914
|
-
if (discriminantValue == null) {
|
|
2915
|
-
this.errors.add({
|
|
2916
|
-
severity: Severity.Critical,
|
|
2917
|
-
message: this.newParameterNotRecognizedError(discriminantFieldName).message
|
|
2918
|
-
});
|
|
2919
|
-
return void 0;
|
|
2920
|
-
}
|
|
2921
|
-
if (typeof discriminantValue !== "string") {
|
|
2922
|
-
this.errors.add({
|
|
2923
|
-
severity: Severity.Critical,
|
|
2924
|
-
message: `Expected discriminant value to be a string but got: ${typeof discriminantValue}`
|
|
2925
|
-
});
|
|
2926
|
-
return void 0;
|
|
2927
|
-
}
|
|
2928
|
-
const singleDiscriminatedUnionType = discriminatedUnion.types[discriminantValue];
|
|
2929
|
-
if (singleDiscriminatedUnionType == null) {
|
|
2930
|
-
this.errors.add({
|
|
2931
|
-
severity: Severity.Critical,
|
|
2932
|
-
message: `No type found for discriminant value "${discriminantValue}"`
|
|
2933
|
-
});
|
|
2934
|
-
return void 0;
|
|
2935
|
-
}
|
|
2936
|
-
const _a = record, { [discriminantFieldName]: _ } = _a, filtered = __objRest(_a, [__restKey(discriminantFieldName)]);
|
|
2937
|
-
return {
|
|
2938
|
-
singleDiscriminatedUnionType,
|
|
2939
|
-
discriminantValue: singleDiscriminatedUnionType.discriminantValue,
|
|
2940
|
-
value: filtered
|
|
2941
|
-
};
|
|
2942
|
-
}
|
|
2943
|
-
resolveEndpointOrThrow(rawEndpoint) {
|
|
2944
|
-
const parsedEndpoint = this.httpEndpointReferenceParser.tryParse(rawEndpoint);
|
|
2945
|
-
if (parsedEndpoint == null) {
|
|
2946
|
-
throw new Error(`Failed to parse endpoint reference "${rawEndpoint}"`);
|
|
2947
|
-
}
|
|
2948
|
-
return this.resolveEndpointLocationOrThrow(parsedEndpoint);
|
|
2949
|
-
}
|
|
2950
|
-
resolveEndpointLocationOrThrow(location) {
|
|
2951
|
-
const endpoints = [];
|
|
2952
|
-
for (const endpoint of Object.values(this._ir.endpoints)) {
|
|
2953
|
-
if (this.parsedEndpointMatches({ endpoint, parsedEndpoint: location })) {
|
|
2954
|
-
endpoints.push(endpoint);
|
|
2955
|
-
}
|
|
2956
|
-
}
|
|
2957
|
-
if (endpoints.length === 0) {
|
|
2958
|
-
throw new Error(`Failed to find endpoint identified by "${location.method} ${location.path}"`);
|
|
2959
|
-
}
|
|
2960
|
-
return endpoints;
|
|
2961
|
-
}
|
|
2962
|
-
needsRequestParameter({ request, inlinePathParameters, inlineFileProperties }) {
|
|
2963
|
-
var _a;
|
|
2964
|
-
if (this.includePathParametersInWrappedRequest({ request, inlinePathParameters })) {
|
|
2965
|
-
return true;
|
|
2966
|
-
}
|
|
2967
|
-
if (request.queryParameters != null && request.queryParameters.length > 0) {
|
|
2968
|
-
return true;
|
|
2969
|
-
}
|
|
2970
|
-
if (request.headers != null && request.headers.length > 0) {
|
|
2971
|
-
return true;
|
|
2972
|
-
}
|
|
2973
|
-
if (request.body != null) {
|
|
2974
|
-
return this.includeRequestBodyInWrappedRequest({ body: request.body, inlineFileProperties });
|
|
2975
|
-
}
|
|
2976
|
-
if ((_a = request.metadata) == null ? void 0 : _a.onlyPathParameters) {
|
|
2977
|
-
return false;
|
|
2978
|
-
}
|
|
2979
|
-
return true;
|
|
2980
|
-
}
|
|
2981
|
-
includePathParametersInWrappedRequest({ request, inlinePathParameters }) {
|
|
2982
|
-
var _a, _b;
|
|
2983
|
-
return inlinePathParameters && ((_b = (_a = request.metadata) == null ? void 0 : _a.includePathParameters) != null ? _b : false);
|
|
2984
|
-
}
|
|
2985
|
-
isFileUploadRequestBody(body) {
|
|
2986
|
-
switch (body.type) {
|
|
2987
|
-
case "fileUpload":
|
|
2988
|
-
return true;
|
|
2989
|
-
case "properties":
|
|
2990
|
-
case "referenced":
|
|
2991
|
-
return false;
|
|
2992
|
-
default:
|
|
2993
|
-
assertNever(body);
|
|
2994
|
-
}
|
|
2995
|
-
}
|
|
2996
|
-
resolveEnvironmentName(environmentID) {
|
|
2997
|
-
if (this._ir.environments == null) {
|
|
2998
|
-
return void 0;
|
|
2999
|
-
}
|
|
3000
|
-
const environments = this._ir.environments.environments;
|
|
3001
|
-
switch (environments.type) {
|
|
3002
|
-
case "singleBaseUrl": {
|
|
3003
|
-
const environment = environments.environments.find((env2) => env2.id === environmentID);
|
|
3004
|
-
if (environment == null) {
|
|
3005
|
-
return void 0;
|
|
3006
|
-
}
|
|
3007
|
-
return environment.name;
|
|
3008
|
-
}
|
|
3009
|
-
case "multipleBaseUrls": {
|
|
3010
|
-
const environment = environments.environments.find((env2) => env2.id === environmentID);
|
|
3011
|
-
if (environment == null) {
|
|
3012
|
-
return void 0;
|
|
3013
|
-
}
|
|
3014
|
-
return environment.name;
|
|
3015
|
-
}
|
|
3016
|
-
default:
|
|
3017
|
-
assertNever(environments);
|
|
3018
|
-
}
|
|
3019
|
-
}
|
|
3020
|
-
isSingleEnvironmentID(environment) {
|
|
3021
|
-
return typeof environment === "string";
|
|
3022
|
-
}
|
|
3023
|
-
isMultiEnvironmentValues(environment) {
|
|
3024
|
-
return typeof environment === "object";
|
|
3025
|
-
}
|
|
3026
|
-
validateMultiEnvironmentUrlValues(multiEnvironmentUrlValues) {
|
|
3027
|
-
if (this._ir.environments == null) {
|
|
3028
|
-
this.errors.add({
|
|
3029
|
-
severity: Severity.Critical,
|
|
3030
|
-
message: "Multiple environments are not supported for single base URL environments; use the baseUrl option instead"
|
|
3031
|
-
});
|
|
3032
|
-
return false;
|
|
3033
|
-
}
|
|
3034
|
-
const environments = this._ir.environments.environments;
|
|
3035
|
-
switch (environments.type) {
|
|
3036
|
-
case "singleBaseUrl": {
|
|
3037
|
-
this.errors.add({
|
|
3038
|
-
severity: Severity.Critical,
|
|
3039
|
-
message: "Multiple environments are not supported for single base URL environments; use the baseUrl option instead"
|
|
3040
|
-
});
|
|
3041
|
-
return false;
|
|
3042
|
-
}
|
|
3043
|
-
case "multipleBaseUrls": {
|
|
3044
|
-
const firstEnvironment = environments.environments[0];
|
|
3045
|
-
if (firstEnvironment == null) {
|
|
3046
|
-
this.errors.add({
|
|
3047
|
-
severity: Severity.Critical,
|
|
3048
|
-
message: "Multiple environments are not supported; use the baseUrl option instead"
|
|
3049
|
-
});
|
|
3050
|
-
return false;
|
|
3051
|
-
}
|
|
3052
|
-
const expectedKeys = new Set(keys(firstEnvironment.urls));
|
|
3053
|
-
for (const key of keys(multiEnvironmentUrlValues)) {
|
|
3054
|
-
if (expectedKeys.has(key)) {
|
|
3055
|
-
expectedKeys.delete(key);
|
|
3056
|
-
}
|
|
3057
|
-
}
|
|
3058
|
-
if (expectedKeys.size > 0) {
|
|
3059
|
-
this.errors.add({
|
|
3060
|
-
severity: Severity.Critical,
|
|
3061
|
-
message: `The provided environments are invalid; got: [${Object.keys(multiEnvironmentUrlValues).join(", ")}], expected: [${keys(firstEnvironment.urls).join(", ")}]`
|
|
3062
|
-
});
|
|
3063
|
-
return false;
|
|
3064
|
-
}
|
|
3065
|
-
return true;
|
|
3066
|
-
}
|
|
3067
|
-
}
|
|
3068
|
-
}
|
|
3069
|
-
getValueAsNumber({ value }) {
|
|
3070
|
-
if (typeof value !== "number") {
|
|
3071
|
-
this.errors.add({
|
|
3072
|
-
severity: Severity.Critical,
|
|
3073
|
-
message: this.newTypeMismatchError({ expected: "number", value }).message
|
|
3074
|
-
});
|
|
3075
|
-
return void 0;
|
|
3076
|
-
}
|
|
3077
|
-
return value;
|
|
3078
|
-
}
|
|
3079
|
-
getValueAsBoolean({ value }) {
|
|
3080
|
-
if (typeof value !== "boolean") {
|
|
3081
|
-
this.errors.add({
|
|
3082
|
-
severity: Severity.Critical,
|
|
3083
|
-
message: this.newTypeMismatchError({ expected: "boolean", value }).message
|
|
3084
|
-
});
|
|
3085
|
-
return void 0;
|
|
3086
|
-
}
|
|
3087
|
-
return value;
|
|
3088
|
-
}
|
|
3089
|
-
getValueAsString({ value }) {
|
|
3090
|
-
if (typeof value !== "string") {
|
|
3091
|
-
this.errors.add({
|
|
3092
|
-
severity: Severity.Critical,
|
|
3093
|
-
message: this.newTypeMismatchError({ expected: "string", value }).message
|
|
3094
|
-
});
|
|
3095
|
-
return void 0;
|
|
3096
|
-
}
|
|
3097
|
-
return value;
|
|
3098
|
-
}
|
|
3099
|
-
newAuthMismatchError({ auth, values }) {
|
|
3100
|
-
return new Error(`Expected auth type ${auth.type}, got ${values.type}`);
|
|
3101
|
-
}
|
|
3102
|
-
newParameterNotRecognizedError(parameterName) {
|
|
3103
|
-
return new Error(`"${parameterName}" is not a recognized parameter for this endpoint`);
|
|
3104
|
-
}
|
|
3105
|
-
newTypeMismatchError({ expected, value }) {
|
|
3106
|
-
return new Error(`Expected ${expected}, got ${typeof value}`);
|
|
3107
|
-
}
|
|
3108
|
-
includeRequestBodyInWrappedRequest({ body, inlineFileProperties }) {
|
|
3109
|
-
switch (body.type) {
|
|
3110
|
-
case "properties":
|
|
3111
|
-
case "referenced":
|
|
3112
|
-
return true;
|
|
3113
|
-
case "fileUpload":
|
|
3114
|
-
return this.includeFileUploadBodyInWrappedRequest({ fileUpload: body, inlineFileProperties });
|
|
3115
|
-
default:
|
|
3116
|
-
assertNever(body);
|
|
3117
|
-
}
|
|
3118
|
-
}
|
|
3119
|
-
includeFileUploadBodyInWrappedRequest({ fileUpload, inlineFileProperties }) {
|
|
3120
|
-
return this.fileUploadHasBodyProperties({ fileUpload }) || inlineFileProperties && this.fileUploadHasFileProperties({ fileUpload });
|
|
3121
|
-
}
|
|
3122
|
-
fileUploadHasBodyProperties({ fileUpload }) {
|
|
3123
|
-
return fileUpload.properties.some((property) => {
|
|
3124
|
-
switch (property.type) {
|
|
3125
|
-
case "file":
|
|
3126
|
-
case "fileArray":
|
|
3127
|
-
return false;
|
|
3128
|
-
case "bodyProperty":
|
|
3129
|
-
return true;
|
|
3130
|
-
default:
|
|
3131
|
-
assertNever(property);
|
|
3132
|
-
}
|
|
3133
|
-
});
|
|
3134
|
-
}
|
|
3135
|
-
fileUploadHasFileProperties({ fileUpload }) {
|
|
3136
|
-
return fileUpload.properties.some((property) => {
|
|
3137
|
-
switch (property.type) {
|
|
3138
|
-
case "file":
|
|
3139
|
-
case "fileArray":
|
|
3140
|
-
return true;
|
|
3141
|
-
case "bodyProperty":
|
|
3142
|
-
return false;
|
|
3143
|
-
default:
|
|
3144
|
-
assertNever(property);
|
|
3145
|
-
}
|
|
3146
|
-
});
|
|
3147
|
-
}
|
|
3148
|
-
isListTypeReference(typeReference) {
|
|
3149
|
-
if (typeReference.type === "optional") {
|
|
3150
|
-
return this.isListTypeReference(typeReference.value);
|
|
3151
|
-
}
|
|
3152
|
-
return typeReference.type === "list" || typeReference.type === "set";
|
|
3153
|
-
}
|
|
3154
|
-
parsedEndpointMatches({ endpoint, parsedEndpoint }) {
|
|
3155
|
-
return endpoint.location.method === parsedEndpoint.method && endpoint.location.path === parsedEndpoint.path;
|
|
3156
|
-
}
|
|
3157
|
-
};
|
|
3158
|
-
|
|
3159
|
-
// ../ast/lib/index.js
|
|
3160
|
-
init_process();
|
|
3161
|
-
init_buffer();
|
|
3162
|
-
|
|
3163
|
-
// ../ast/lib/typescript.js
|
|
3164
|
-
var typescript_exports = {};
|
|
3165
|
-
__export(typescript_exports, {
|
|
3166
|
-
AstNode: () => AstNode,
|
|
3167
|
-
ClassInstantiation: () => ClassInstantiation,
|
|
3168
|
-
CodeBlock: () => CodeBlock2,
|
|
3169
|
-
Comment: () => Comment,
|
|
3170
|
-
Function: () => Function2,
|
|
3171
|
-
FunctionInvocation: () => FunctionInvocation,
|
|
3172
|
-
MethodInvocation: () => MethodInvocation,
|
|
3173
|
-
Parameter: () => Parameter,
|
|
3174
|
-
Reference: () => Reference,
|
|
3175
|
-
Type: () => Type,
|
|
3176
|
-
TypeLiteral: () => TypeLiteral,
|
|
3177
|
-
Types: () => Type,
|
|
3178
|
-
Variable: () => Variable,
|
|
3179
|
-
Writer: () => Writer,
|
|
3180
|
-
codeblock: () => codeblock,
|
|
3181
|
-
function_: () => function_,
|
|
3182
|
-
instantiateClass: () => instantiateClass,
|
|
3183
|
-
invokeFunction: () => invokeFunction,
|
|
3184
|
-
invokeMethod: () => invokeMethod,
|
|
3185
|
-
parameter: () => parameter,
|
|
3186
|
-
reference: () => reference,
|
|
3187
|
-
variable: () => variable
|
|
3188
|
-
});
|
|
3189
|
-
init_process();
|
|
3190
|
-
init_buffer();
|
|
3191
|
-
|
|
3192
|
-
// ../ast/lib/ast/index.js
|
|
3193
|
-
init_process();
|
|
3194
|
-
init_buffer();
|
|
3195
|
-
|
|
3196
|
-
// ../ast/lib/ast/core/index.js
|
|
3197
|
-
init_process();
|
|
3198
|
-
init_buffer();
|
|
3199
|
-
|
|
3200
|
-
// ../ast/lib/ast/core/AstNode.js
|
|
3201
|
-
init_process();
|
|
3202
|
-
init_buffer();
|
|
3203
|
-
|
|
3204
|
-
// ../ast/lib/ast/core/Writer.js
|
|
3205
|
-
init_process();
|
|
3206
|
-
init_buffer();
|
|
3207
|
-
var Writer = class extends AbstractWriter {
|
|
3208
|
-
constructor({ customConfig }) {
|
|
3209
|
-
super();
|
|
3210
|
-
__publicField(this, "customConfig");
|
|
3211
|
-
__publicField(this, "imports", {});
|
|
3212
|
-
__publicField(this, "defaultImports", {});
|
|
3213
|
-
__publicField(this, "starImportAliases", {});
|
|
3214
|
-
__publicField(this, "starImportAliasesInverse", {});
|
|
3215
|
-
this.customConfig = customConfig;
|
|
3216
|
-
}
|
|
3217
|
-
/**
|
|
3218
|
-
* Adds the given import under its module name.
|
|
3219
|
-
*/
|
|
3220
|
-
addImport(reference2) {
|
|
3221
|
-
var _a, _b, _c;
|
|
3222
|
-
if (reference2.importFrom != null) {
|
|
3223
|
-
switch (reference2.importFrom.type) {
|
|
3224
|
-
case "default": {
|
|
3225
|
-
this.validateDefault(reference2);
|
|
3226
|
-
break;
|
|
3227
|
-
}
|
|
3228
|
-
case "named": {
|
|
3229
|
-
this.validateNamed(reference2);
|
|
3230
|
-
break;
|
|
3231
|
-
}
|
|
3232
|
-
case "star": {
|
|
3233
|
-
this.validateStar(reference2);
|
|
3234
|
-
break;
|
|
3235
|
-
}
|
|
3236
|
-
}
|
|
3237
|
-
const moduleImports = (_c = (_a = this.imports)[_b = reference2.importFrom.moduleName]) != null ? _c : _a[_b] = [];
|
|
3238
|
-
const names = moduleImports.map((import_) => import_.name);
|
|
3239
|
-
if (!names.includes(reference2.name)) {
|
|
3240
|
-
moduleImports.push(reference2);
|
|
3241
|
-
}
|
|
3242
|
-
}
|
|
3243
|
-
}
|
|
3244
|
-
validateDefault(reference2) {
|
|
3245
|
-
var _a, _b, _c, _d;
|
|
3246
|
-
if (((_a = reference2.importFrom) == null ? void 0 : _a.type) !== "default") {
|
|
3247
|
-
return;
|
|
3248
|
-
}
|
|
3249
|
-
const moduleDefault = (_d = (_b = this.defaultImports)[_c = reference2.importFrom.moduleName]) != null ? _d : _b[_c] = reference2;
|
|
3250
|
-
if (moduleDefault.name !== reference2.name) {
|
|
3251
|
-
throw new Error(`Cannot have multiple default imports for module ${reference2.importFrom.moduleName}: got ${reference2.name} but already had ${moduleDefault.name}`);
|
|
3252
|
-
}
|
|
3253
|
-
}
|
|
3254
|
-
validateNamed(reference2) {
|
|
3255
|
-
var _a, _b, _c, _d, _e;
|
|
3256
|
-
if (((_a = reference2.importFrom) == null ? void 0 : _a.type) !== "named") {
|
|
3257
|
-
return;
|
|
3258
|
-
}
|
|
3259
|
-
const existing = (_b = this.imports[reference2.importFrom.moduleName]) != null ? _b : [];
|
|
3260
|
-
const existingStar = existing.filter((e) => {
|
|
3261
|
-
var _a2;
|
|
3262
|
-
return ((_a2 = e.importFrom) == null ? void 0 : _a2.type) === "star";
|
|
3263
|
-
});
|
|
3264
|
-
if (existingStar.length > 0) {
|
|
3265
|
-
throw new Error(`Cannot add named import ${reference2.name} because non-named imports ${existingStar.map((e) => e.name)} already exist`);
|
|
3266
|
-
}
|
|
3267
|
-
const duplicates = [];
|
|
3268
|
-
for (const references of Object.values(this.imports)) {
|
|
3269
|
-
for (const ref of references) {
|
|
3270
|
-
if (((_c = ref.importFrom) == null ? void 0 : _c.type) === "named" && ref.importFrom.moduleName !== reference2.importFrom.moduleName && ref.name === reference2.name) {
|
|
3271
|
-
duplicates.push(ref);
|
|
3272
|
-
}
|
|
3273
|
-
}
|
|
3274
|
-
}
|
|
3275
|
-
if (duplicates.length > 0) {
|
|
3276
|
-
throw new Error(`Cannot add named import from module ${reference2.importFrom.moduleName} because it is already imported from ${(_e = (_d = duplicates[0]) == null ? void 0 : _d.importFrom) == null ? void 0 : _e.moduleName}`);
|
|
3277
|
-
}
|
|
3278
|
-
}
|
|
3279
|
-
validateStar(reference2) {
|
|
3280
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
3281
|
-
if (((_a = reference2.importFrom) == null ? void 0 : _a.type) !== "star") {
|
|
3282
|
-
return;
|
|
3283
|
-
}
|
|
3284
|
-
const moduleAlias = (_d = (_b = this.starImportAliases)[_c = reference2.importFrom.moduleName]) != null ? _d : _b[_c] = reference2.importFrom.starImportAlias;
|
|
3285
|
-
if (moduleAlias !== reference2.importFrom.starImportAlias) {
|
|
3286
|
-
throw new Error(`Cannot have more than one alias for non-named imports from a module: got ${reference2.importFrom.starImportAlias} but already have ${moduleAlias}.`);
|
|
3287
|
-
}
|
|
3288
|
-
const aliasModule = (_g = (_e = this.starImportAliasesInverse)[_f = reference2.importFrom.starImportAlias]) != null ? _g : _e[_f] = reference2.importFrom.moduleName;
|
|
3289
|
-
if (aliasModule !== reference2.importFrom.moduleName) {
|
|
3290
|
-
throw new Error(`Attempted to use alias ${reference2.importFrom.starImportAlias} for more than one module in the same file`);
|
|
3291
|
-
}
|
|
3292
|
-
}
|
|
3293
|
-
toString() {
|
|
3294
|
-
const imports = this.stringifyImports();
|
|
3295
|
-
if (imports.length > 0) {
|
|
3296
|
-
return imports + "\n" + this.buffer;
|
|
3297
|
-
}
|
|
3298
|
-
return this.buffer;
|
|
3299
|
-
}
|
|
3300
|
-
stringifyImports() {
|
|
3301
|
-
let result = "";
|
|
3302
|
-
for (const [module2, references] of Object.entries(this.imports)) {
|
|
3303
|
-
const defaultImport = this.defaultImports[module2];
|
|
3304
|
-
let stringifiedNonDefault = "";
|
|
3305
|
-
const named = references.filter((r) => {
|
|
3306
|
-
var _a;
|
|
3307
|
-
return ((_a = r.importFrom) == null ? void 0 : _a.type) === "named";
|
|
3308
|
-
});
|
|
3309
|
-
const starImportAlias = this.starImportAliases[module2];
|
|
3310
|
-
if (named.length > 0 || defaultImport != null || starImportAlias != null) {
|
|
3311
|
-
result += "import";
|
|
3312
|
-
if (defaultImport != null) {
|
|
3313
|
-
result += ` ${defaultImport.name}`;
|
|
3314
|
-
}
|
|
3315
|
-
if (named.length > 0) {
|
|
3316
|
-
for (const ref of named.slice(0, -1)) {
|
|
3317
|
-
stringifiedNonDefault += `${ref.name}, `;
|
|
3318
|
-
}
|
|
3319
|
-
const lastRef = named[named.length - 1];
|
|
3320
|
-
if (lastRef != null) {
|
|
3321
|
-
stringifiedNonDefault += `${lastRef.name}`;
|
|
3322
|
-
}
|
|
3323
|
-
if (defaultImport != null) {
|
|
3324
|
-
result += ",";
|
|
3325
|
-
}
|
|
3326
|
-
result += ` { ${stringifiedNonDefault} }`;
|
|
3327
|
-
}
|
|
3328
|
-
if (starImportAlias != null) {
|
|
3329
|
-
if (defaultImport != null || named.length > 0) {
|
|
3330
|
-
result += ", ";
|
|
3331
|
-
}
|
|
3332
|
-
result += ` * as ${starImportAlias}`;
|
|
3333
|
-
}
|
|
3334
|
-
result += ` from "${module2}";
|
|
3335
|
-
`;
|
|
3336
|
-
}
|
|
3337
|
-
}
|
|
3338
|
-
return result;
|
|
3339
|
-
}
|
|
3340
|
-
};
|
|
3341
|
-
|
|
3342
|
-
// ../ast/lib/ast/core/AstNode.js
|
|
3343
|
-
var AstNode = class extends AbstractAstNode {
|
|
3344
|
-
/**
|
|
3345
|
-
* Writes the node to a string.
|
|
3346
|
-
*/
|
|
3347
|
-
async toString({ customConfig }) {
|
|
3348
|
-
const writer = new Writer({ customConfig });
|
|
3349
|
-
this.write(writer);
|
|
3350
|
-
return writer.toString();
|
|
3351
|
-
}
|
|
3352
|
-
toStringSync({ customConfig }) {
|
|
3353
|
-
const writer = new Writer({ customConfig });
|
|
3354
|
-
this.write(writer);
|
|
3355
|
-
return writer.toString();
|
|
3356
|
-
}
|
|
3357
|
-
};
|
|
3358
|
-
|
|
3359
|
-
// ../ast/lib/ast/CodeBlock.js
|
|
3360
|
-
init_process();
|
|
3361
|
-
init_buffer();
|
|
3362
|
-
var CodeBlock2 = class extends AstNode {
|
|
3363
|
-
constructor(args) {
|
|
3364
|
-
super();
|
|
3365
|
-
__publicField(this, "args");
|
|
3366
|
-
this.args = args;
|
|
3367
|
-
}
|
|
3368
|
-
write(writer) {
|
|
3369
|
-
const commonCodeBlock = new CodeBlock(this.args);
|
|
3370
|
-
return commonCodeBlock.write(writer);
|
|
3371
|
-
}
|
|
3372
|
-
};
|
|
3373
|
-
|
|
3374
|
-
// ../ast/lib/ast/Type.js
|
|
3375
|
-
init_process();
|
|
3376
|
-
init_buffer();
|
|
3377
|
-
var Type = class extends AstNode {
|
|
3378
|
-
constructor(internalType) {
|
|
3379
|
-
super();
|
|
3380
|
-
__publicField(this, "internalType");
|
|
3381
|
-
this.internalType = internalType;
|
|
3382
|
-
}
|
|
3383
|
-
write(writer) {
|
|
3384
|
-
switch (this.internalType.type) {
|
|
3385
|
-
case "string":
|
|
3386
|
-
writer.write("string");
|
|
3387
|
-
break;
|
|
3388
|
-
case "number":
|
|
3389
|
-
writer.write("number");
|
|
3390
|
-
break;
|
|
3391
|
-
case "bigint":
|
|
3392
|
-
writer.write("bigint");
|
|
3393
|
-
break;
|
|
3394
|
-
case "boolean":
|
|
3395
|
-
writer.write("boolean");
|
|
3396
|
-
break;
|
|
3397
|
-
case "array":
|
|
3398
|
-
this.internalType.valueType.write(writer);
|
|
3399
|
-
writer.write("[]");
|
|
3400
|
-
break;
|
|
3401
|
-
case "map":
|
|
3402
|
-
writer.write("Record<");
|
|
3403
|
-
this.internalType.keyType.write(writer);
|
|
3404
|
-
writer.write(", ");
|
|
3405
|
-
this.internalType.valueType.write(writer);
|
|
3406
|
-
writer.write(">");
|
|
3407
|
-
break;
|
|
3408
|
-
case "object":
|
|
3409
|
-
writer.write("{");
|
|
3410
|
-
writer.indent();
|
|
3411
|
-
for (const [key, value] of Object.entries(this.internalType.fields)) {
|
|
3412
|
-
writer.write(`${key}: `);
|
|
3413
|
-
value.write(writer);
|
|
3414
|
-
writer.writeLine(",");
|
|
3415
|
-
}
|
|
3416
|
-
writer.dedent();
|
|
3417
|
-
writer.write("}");
|
|
3418
|
-
break;
|
|
3419
|
-
case "enum":
|
|
3420
|
-
writer.write("enum");
|
|
3421
|
-
break;
|
|
3422
|
-
case "any":
|
|
3423
|
-
writer.write("any");
|
|
3424
|
-
break;
|
|
3425
|
-
case "promise":
|
|
3426
|
-
writer.write("Promise<");
|
|
3427
|
-
this.internalType.value.write(writer);
|
|
3428
|
-
writer.write(">");
|
|
3429
|
-
break;
|
|
3430
|
-
case "unknown":
|
|
3431
|
-
writer.write("unknown");
|
|
3432
|
-
break;
|
|
3433
|
-
case "void":
|
|
3434
|
-
writer.write("void");
|
|
3435
|
-
break;
|
|
3436
|
-
case "undefined":
|
|
3437
|
-
writer.write("undefined");
|
|
3438
|
-
break;
|
|
3439
|
-
case "null":
|
|
3440
|
-
writer.write("null");
|
|
3441
|
-
break;
|
|
3442
|
-
case "never":
|
|
3443
|
-
writer.write("never");
|
|
3444
|
-
break;
|
|
3445
|
-
case "nop":
|
|
3446
|
-
break;
|
|
3447
|
-
default:
|
|
3448
|
-
assertNever(this.internalType);
|
|
3449
|
-
}
|
|
3450
|
-
}
|
|
3451
|
-
/* Static factory methods for creating a Type */
|
|
3452
|
-
static string() {
|
|
3453
|
-
return new this({
|
|
3454
|
-
type: "string"
|
|
3455
|
-
});
|
|
3456
|
-
}
|
|
3457
|
-
static number() {
|
|
3458
|
-
return new this({
|
|
3459
|
-
type: "number"
|
|
3460
|
-
});
|
|
3461
|
-
}
|
|
3462
|
-
static bigint() {
|
|
3463
|
-
return new this({
|
|
3464
|
-
type: "bigint"
|
|
3465
|
-
});
|
|
3466
|
-
}
|
|
3467
|
-
static boolean() {
|
|
3468
|
-
return new this({
|
|
3469
|
-
type: "boolean"
|
|
3470
|
-
});
|
|
3471
|
-
}
|
|
3472
|
-
static array(valueType) {
|
|
3473
|
-
return new this({
|
|
3474
|
-
type: "array",
|
|
3475
|
-
valueType
|
|
3476
|
-
});
|
|
3477
|
-
}
|
|
3478
|
-
static object(fields) {
|
|
3479
|
-
return new this({
|
|
3480
|
-
type: "object",
|
|
3481
|
-
fields
|
|
3482
|
-
});
|
|
3483
|
-
}
|
|
3484
|
-
static enum(values) {
|
|
3485
|
-
return new this({
|
|
3486
|
-
type: "enum",
|
|
3487
|
-
values
|
|
3488
|
-
});
|
|
3489
|
-
}
|
|
3490
|
-
static any() {
|
|
3491
|
-
return new this({
|
|
3492
|
-
type: "any"
|
|
3493
|
-
});
|
|
3494
|
-
}
|
|
3495
|
-
static promise(value) {
|
|
3496
|
-
if (value.internalType.type === "promise") {
|
|
3497
|
-
return value;
|
|
3498
|
-
}
|
|
3499
|
-
return new this({
|
|
3500
|
-
type: "promise",
|
|
3501
|
-
value
|
|
3502
|
-
});
|
|
3503
|
-
}
|
|
3504
|
-
static unknown() {
|
|
3505
|
-
return new this({
|
|
3506
|
-
type: "unknown"
|
|
3507
|
-
});
|
|
3508
|
-
}
|
|
3509
|
-
static void() {
|
|
3510
|
-
return new this({
|
|
3511
|
-
type: "void"
|
|
3512
|
-
});
|
|
3513
|
-
}
|
|
3514
|
-
static undefined() {
|
|
3515
|
-
return new this({
|
|
3516
|
-
type: "undefined"
|
|
3517
|
-
});
|
|
3518
|
-
}
|
|
3519
|
-
static null() {
|
|
3520
|
-
return new this({
|
|
3521
|
-
type: "null"
|
|
3522
|
-
});
|
|
3523
|
-
}
|
|
3524
|
-
static never() {
|
|
3525
|
-
return new this({
|
|
3526
|
-
type: "never"
|
|
3527
|
-
});
|
|
3528
|
-
}
|
|
3529
|
-
static nop() {
|
|
3530
|
-
return new this({
|
|
3531
|
-
type: "nop"
|
|
3532
|
-
});
|
|
3533
|
-
}
|
|
3534
|
-
};
|
|
3535
|
-
|
|
3536
|
-
// ../ast/lib/ast/TypeLiteral.js
|
|
3537
|
-
init_process();
|
|
3538
|
-
init_buffer();
|
|
3539
|
-
var TypeLiteral = class _TypeLiteral extends AstNode {
|
|
3540
|
-
constructor(internalType) {
|
|
3541
|
-
super();
|
|
3542
|
-
__publicField(this, "internalType");
|
|
3543
|
-
this.internalType = internalType;
|
|
3544
|
-
}
|
|
3545
|
-
write(writer) {
|
|
3546
|
-
var _a, _b, _c, _d;
|
|
3547
|
-
switch (this.internalType.type) {
|
|
3548
|
-
case "array": {
|
|
3549
|
-
this.writeIterable({ writer, iterable: this.internalType });
|
|
3550
|
-
break;
|
|
3551
|
-
}
|
|
3552
|
-
case "blob": {
|
|
3553
|
-
if ((_a = writer.customConfig) == null ? void 0 : _a.noSerdeLayer) {
|
|
3554
|
-
writer.writeNode(_TypeLiteral.string(this.internalType.value));
|
|
3555
|
-
return;
|
|
3556
|
-
}
|
|
3557
|
-
writer.write("new Blob([");
|
|
3558
|
-
writer.writeNode(_TypeLiteral.string(this.internalType.value));
|
|
3559
|
-
writer.write("])");
|
|
3560
|
-
break;
|
|
3561
|
-
}
|
|
3562
|
-
case "boolean": {
|
|
3563
|
-
writer.write(this.internalType.value.toString());
|
|
3564
|
-
break;
|
|
3565
|
-
}
|
|
3566
|
-
case "bigint": {
|
|
3567
|
-
if ((_b = writer.customConfig) == null ? void 0 : _b.noSerdeLayer) {
|
|
3568
|
-
writer.writeNode(_TypeLiteral.string(this.internalType.value.toString()));
|
|
3569
|
-
return;
|
|
3570
|
-
}
|
|
3571
|
-
writer.write(`BigInt(${this.internalType.value.toString()})`);
|
|
3572
|
-
break;
|
|
3573
|
-
}
|
|
3574
|
-
case "datetime": {
|
|
3575
|
-
if ((_c = writer.customConfig) == null ? void 0 : _c.noSerdeLayer) {
|
|
3576
|
-
writer.writeNode(_TypeLiteral.string(this.internalType.value));
|
|
3577
|
-
return;
|
|
3578
|
-
}
|
|
3579
|
-
writer.write("new Date(");
|
|
3580
|
-
writer.writeNode(_TypeLiteral.string(this.internalType.value));
|
|
3581
|
-
writer.write(")");
|
|
3582
|
-
break;
|
|
3583
|
-
}
|
|
3584
|
-
case "number": {
|
|
3585
|
-
writer.write(this.internalType.value.toString());
|
|
3586
|
-
break;
|
|
3587
|
-
}
|
|
3588
|
-
case "object": {
|
|
3589
|
-
this.writeObject({ writer, object: this.internalType });
|
|
3590
|
-
break;
|
|
3591
|
-
}
|
|
3592
|
-
case "record": {
|
|
3593
|
-
this.writeRecord({ writer, record: this.internalType });
|
|
3594
|
-
break;
|
|
3595
|
-
}
|
|
3596
|
-
case "reference": {
|
|
3597
|
-
writer.writeNode(this.internalType.value);
|
|
3598
|
-
break;
|
|
3599
|
-
}
|
|
3600
|
-
case "set": {
|
|
3601
|
-
if (((_d = writer.customConfig) == null ? void 0 : _d.noSerdeLayer) || this.isSetOfObjects()) {
|
|
3602
|
-
writer.writeNode(_TypeLiteral.array({ values: this.internalType.values }));
|
|
3603
|
-
return;
|
|
3604
|
-
}
|
|
3605
|
-
writer.write("new Set(");
|
|
3606
|
-
this.writeIterable({ writer, iterable: this.internalType });
|
|
3607
|
-
writer.write(")");
|
|
3608
|
-
break;
|
|
3609
|
-
}
|
|
3610
|
-
case "string": {
|
|
3611
|
-
if (this.internalType.value.includes("\n")) {
|
|
3612
|
-
this.writeStringWithBackticks({ writer, value: this.internalType.value });
|
|
3613
|
-
} else {
|
|
3614
|
-
writer.write(`"${this.internalType.value.replaceAll('"', '\\"')}"`);
|
|
3615
|
-
}
|
|
3616
|
-
break;
|
|
3617
|
-
}
|
|
3618
|
-
case "tuple": {
|
|
3619
|
-
this.writeIterable({ writer, iterable: this.internalType });
|
|
3620
|
-
break;
|
|
3621
|
-
}
|
|
3622
|
-
case "unknown": {
|
|
3623
|
-
this.writeUnknown({ writer, value: this.internalType.value });
|
|
3624
|
-
break;
|
|
3625
|
-
}
|
|
3626
|
-
case "nop":
|
|
3627
|
-
break;
|
|
3628
|
-
default:
|
|
3629
|
-
assertNever(this.internalType);
|
|
3630
|
-
}
|
|
3631
|
-
}
|
|
3632
|
-
isObject() {
|
|
3633
|
-
return this.internalType.type === "object";
|
|
3634
|
-
}
|
|
3635
|
-
asObjectOrThrow() {
|
|
3636
|
-
if (this.isObject()) {
|
|
3637
|
-
return this.internalType;
|
|
3638
|
-
}
|
|
3639
|
-
throw new Error("Internal error; ts.TypeLiteral is not an object");
|
|
3640
|
-
}
|
|
3641
|
-
isSet() {
|
|
3642
|
-
return this.internalType.type === "set";
|
|
3643
|
-
}
|
|
3644
|
-
asSetOrThrow() {
|
|
3645
|
-
if (this.isSet()) {
|
|
3646
|
-
return this.internalType;
|
|
3647
|
-
}
|
|
3648
|
-
throw new Error("Internal error; ts.TypeLiteral is not a set");
|
|
3649
|
-
}
|
|
3650
|
-
isSetOfObjects() {
|
|
3651
|
-
return this.isSet() && this.asSetOrThrow().values.every((value) => value.isObject());
|
|
3652
|
-
}
|
|
3653
|
-
writeStringWithBackticks({ writer, value }) {
|
|
3654
|
-
writer.write("`");
|
|
3655
|
-
const parts = value.split("\n");
|
|
3656
|
-
const head = parts[0] + "\n";
|
|
3657
|
-
const tail = parts.slice(1).join("\n");
|
|
3658
|
-
writer.write(head.replaceAll("`", "\\`"));
|
|
3659
|
-
writer.writeNoIndent(tail.replaceAll("`", "\\`"));
|
|
3660
|
-
writer.write("`");
|
|
3661
|
-
}
|
|
3662
|
-
writeIterable({ writer, iterable }) {
|
|
3663
|
-
const values = filterNopValues({ values: iterable.values });
|
|
3664
|
-
if (values.length === 0) {
|
|
3665
|
-
writer.write("[]");
|
|
3666
|
-
return;
|
|
3667
|
-
}
|
|
3668
|
-
writer.writeLine("[");
|
|
3669
|
-
writer.indent();
|
|
3670
|
-
for (const value of values) {
|
|
3671
|
-
value.write(writer);
|
|
3672
|
-
writer.writeLine(",");
|
|
3673
|
-
}
|
|
3674
|
-
writer.dedent();
|
|
3675
|
-
writer.write("]");
|
|
3676
|
-
}
|
|
3677
|
-
writeRecord({ writer, record }) {
|
|
3678
|
-
const entries = filterNopRecordEntries({ entries: record.entries });
|
|
3679
|
-
if (entries.length === 0) {
|
|
3680
|
-
writer.write("{}");
|
|
3681
|
-
return;
|
|
3682
|
-
}
|
|
3683
|
-
writer.writeLine("{");
|
|
3684
|
-
writer.indent();
|
|
3685
|
-
for (const entry of entries) {
|
|
3686
|
-
entry.key.write(writer);
|
|
3687
|
-
writer.write(": ");
|
|
3688
|
-
entry.value.write(writer);
|
|
3689
|
-
writer.writeLine(",");
|
|
3690
|
-
}
|
|
3691
|
-
writer.dedent();
|
|
3692
|
-
writer.write("}");
|
|
3693
|
-
}
|
|
3694
|
-
writeObject({ writer, object }) {
|
|
3695
|
-
const fields = filterNopObjectFields({ fields: object.fields });
|
|
3696
|
-
if (fields.length === 0) {
|
|
3697
|
-
writer.write("{}");
|
|
3698
|
-
return;
|
|
3699
|
-
}
|
|
3700
|
-
writer.writeLine("{");
|
|
3701
|
-
writer.indent();
|
|
3702
|
-
for (const field of fields) {
|
|
3703
|
-
writer.write(`${field.name}: `);
|
|
3704
|
-
field.value.write(writer);
|
|
3705
|
-
writer.writeLine(",");
|
|
3706
|
-
}
|
|
3707
|
-
writer.dedent();
|
|
3708
|
-
writer.write("}");
|
|
3709
|
-
}
|
|
3710
|
-
/* Static factory methods for creating a TypeLiteral */
|
|
3711
|
-
static array({ values }) {
|
|
3712
|
-
return new this({
|
|
3713
|
-
type: "array",
|
|
3714
|
-
values
|
|
3715
|
-
});
|
|
3716
|
-
}
|
|
3717
|
-
static bigint(value) {
|
|
3718
|
-
return new this({ type: "bigint", value });
|
|
3719
|
-
}
|
|
3720
|
-
static blob(value) {
|
|
3721
|
-
return new this({ type: "blob", value });
|
|
3722
|
-
}
|
|
3723
|
-
static boolean(value) {
|
|
3724
|
-
return new this({ type: "boolean", value });
|
|
3725
|
-
}
|
|
3726
|
-
static datetime(value) {
|
|
3727
|
-
return new this({ type: "datetime", value });
|
|
3728
|
-
}
|
|
3729
|
-
static number(value) {
|
|
3730
|
-
return new this({ type: "number", value });
|
|
3731
|
-
}
|
|
3732
|
-
static object({ fields }) {
|
|
3733
|
-
return new this({
|
|
3734
|
-
type: "object",
|
|
3735
|
-
fields
|
|
3736
|
-
});
|
|
3737
|
-
}
|
|
3738
|
-
static record({ entries }) {
|
|
3739
|
-
return new this({
|
|
3740
|
-
type: "record",
|
|
3741
|
-
entries
|
|
3742
|
-
});
|
|
3743
|
-
}
|
|
3744
|
-
static reference(value) {
|
|
3745
|
-
return new this({
|
|
3746
|
-
type: "reference",
|
|
3747
|
-
value
|
|
3748
|
-
});
|
|
3749
|
-
}
|
|
3750
|
-
static set({ values }) {
|
|
3751
|
-
return new this({
|
|
3752
|
-
type: "set",
|
|
3753
|
-
values
|
|
3754
|
-
});
|
|
3755
|
-
}
|
|
3756
|
-
static string(value) {
|
|
3757
|
-
return new this({
|
|
3758
|
-
type: "string",
|
|
3759
|
-
value
|
|
3760
|
-
});
|
|
3761
|
-
}
|
|
3762
|
-
static tuple({ values }) {
|
|
3763
|
-
return new this({
|
|
3764
|
-
type: "tuple",
|
|
3765
|
-
values
|
|
3766
|
-
});
|
|
3767
|
-
}
|
|
3768
|
-
static unknown(value) {
|
|
3769
|
-
return new this({ type: "unknown", value });
|
|
3770
|
-
}
|
|
3771
|
-
static nop() {
|
|
3772
|
-
return new this({ type: "nop" });
|
|
3773
|
-
}
|
|
3774
|
-
static isNop(typeLiteral) {
|
|
3775
|
-
return typeLiteral.internalType.type === "nop";
|
|
3776
|
-
}
|
|
3777
|
-
writeUnknown({ writer, value }) {
|
|
3778
|
-
switch (typeof value) {
|
|
3779
|
-
case "boolean":
|
|
3780
|
-
writer.write(value.toString());
|
|
3781
|
-
return;
|
|
3782
|
-
case "string":
|
|
3783
|
-
writer.write(value.includes('"') ? `\`${value}\`` : `"${value}"`);
|
|
3784
|
-
return;
|
|
3785
|
-
case "number":
|
|
3786
|
-
writer.write(value.toString());
|
|
3787
|
-
return;
|
|
3788
|
-
case "object":
|
|
3789
|
-
if (value == null) {
|
|
3790
|
-
writer.write("null");
|
|
3791
|
-
return;
|
|
3792
|
-
}
|
|
3793
|
-
if (Array.isArray(value)) {
|
|
3794
|
-
this.writeUnknownArray({ writer, value });
|
|
3795
|
-
return;
|
|
3796
|
-
}
|
|
3797
|
-
this.writeUnknownObject({ writer, value });
|
|
3798
|
-
return;
|
|
3799
|
-
default:
|
|
3800
|
-
throw new Error(`Internal error; unsupported unknown type: ${typeof value}`);
|
|
3801
|
-
}
|
|
3802
|
-
}
|
|
3803
|
-
writeUnknownArray({ writer, value }) {
|
|
3804
|
-
if (value.length === 0) {
|
|
3805
|
-
writer.write("[]");
|
|
3806
|
-
return;
|
|
3807
|
-
}
|
|
3808
|
-
writer.writeLine("[");
|
|
3809
|
-
writer.indent();
|
|
3810
|
-
for (const element of value) {
|
|
3811
|
-
writer.writeNode(_TypeLiteral.unknown(element));
|
|
3812
|
-
writer.writeLine(",");
|
|
3813
|
-
}
|
|
3814
|
-
writer.dedent();
|
|
3815
|
-
writer.write("]");
|
|
3816
|
-
}
|
|
3817
|
-
writeUnknownObject({ writer, value }) {
|
|
3818
|
-
const entries = Object.entries(value);
|
|
3819
|
-
if (entries.length === 0) {
|
|
3820
|
-
writer.write("{}");
|
|
3821
|
-
return;
|
|
3822
|
-
}
|
|
3823
|
-
writer.writeLine("{");
|
|
3824
|
-
writer.indent();
|
|
3825
|
-
for (const [key, val] of entries) {
|
|
3826
|
-
writer.write(`${key}: `);
|
|
3827
|
-
writer.writeNode(_TypeLiteral.unknown(val));
|
|
3828
|
-
writer.writeLine(",");
|
|
3829
|
-
}
|
|
3830
|
-
writer.dedent();
|
|
3831
|
-
writer.write("}");
|
|
3832
|
-
}
|
|
3833
|
-
};
|
|
3834
|
-
function filterNopObjectFields({ fields }) {
|
|
3835
|
-
return fields.filter((field) => !TypeLiteral.isNop(field.value));
|
|
3836
|
-
}
|
|
3837
|
-
function filterNopRecordEntries({ entries }) {
|
|
3838
|
-
return entries.filter((entry) => !TypeLiteral.isNop(entry.key) && !TypeLiteral.isNop(entry.value));
|
|
3839
|
-
}
|
|
3840
|
-
function filterNopValues({ values }) {
|
|
3841
|
-
return values.filter((value) => !TypeLiteral.isNop(value));
|
|
3842
|
-
}
|
|
3843
|
-
|
|
3844
|
-
// ../ast/lib/ast/Reference.js
|
|
3845
|
-
init_process();
|
|
3846
|
-
init_buffer();
|
|
3847
|
-
var Reference = class extends AstNode {
|
|
3848
|
-
constructor({ name, importFrom, memberName }) {
|
|
3849
|
-
super();
|
|
3850
|
-
__publicField(this, "name");
|
|
3851
|
-
__publicField(this, "importFrom");
|
|
3852
|
-
__publicField(this, "memberName");
|
|
3853
|
-
this.name = name;
|
|
3854
|
-
this.importFrom = importFrom;
|
|
3855
|
-
this.memberName = memberName;
|
|
3856
|
-
}
|
|
3857
|
-
write(writer) {
|
|
3858
|
-
var _a;
|
|
3859
|
-
if (this.importFrom != null) {
|
|
3860
|
-
writer.addImport(this);
|
|
3861
|
-
}
|
|
3862
|
-
const prefix = ((_a = this.importFrom) == null ? void 0 : _a.type) === "star" ? `${this.importFrom.starImportAlias}.` : "";
|
|
3863
|
-
const suffix = this.memberName != null ? `.${this.memberName}` : "";
|
|
3864
|
-
writer.write(`${prefix}${this.name}${suffix}`);
|
|
3865
|
-
}
|
|
3866
|
-
};
|
|
3867
|
-
|
|
3868
|
-
// ../ast/lib/ast/Variable.js
|
|
3869
|
-
init_process();
|
|
3870
|
-
init_buffer();
|
|
3871
|
-
var Variable = class extends AstNode {
|
|
3872
|
-
constructor(args) {
|
|
3873
|
-
super();
|
|
3874
|
-
__publicField(this, "args");
|
|
3875
|
-
this.args = args;
|
|
3876
|
-
}
|
|
3877
|
-
write(writer) {
|
|
3878
|
-
if (this.args.export) {
|
|
3879
|
-
writer.write("export ");
|
|
3880
|
-
}
|
|
3881
|
-
if (this.args.const) {
|
|
3882
|
-
writer.write("const ");
|
|
3883
|
-
} else {
|
|
3884
|
-
writer.write("let ");
|
|
3885
|
-
}
|
|
3886
|
-
writer.write(`${this.args.name} = `);
|
|
3887
|
-
writer.writeNode(this.args.initializer);
|
|
3888
|
-
}
|
|
3889
|
-
};
|
|
3890
|
-
|
|
3891
|
-
// ../ast/lib/ast/Parameter.js
|
|
3892
|
-
init_process();
|
|
3893
|
-
init_buffer();
|
|
3894
|
-
|
|
3895
|
-
// ../ast/lib/ast/Comment.js
|
|
3896
|
-
init_process();
|
|
3897
|
-
init_buffer();
|
|
3898
|
-
var Comment = class extends AstNode {
|
|
3899
|
-
constructor({ docs } = { docs: void 0 }) {
|
|
3900
|
-
super();
|
|
3901
|
-
__publicField(this, "docs");
|
|
3902
|
-
this.docs = docs;
|
|
3903
|
-
}
|
|
3904
|
-
write(writer) {
|
|
3905
|
-
if (this.docs != null) {
|
|
3906
|
-
writer.writeLine("/**");
|
|
3907
|
-
this.docs.split("\n").forEach((line) => {
|
|
3908
|
-
writer.writeLine(` * ${line}`);
|
|
3909
|
-
});
|
|
3910
|
-
writer.writeLine("*/");
|
|
3911
|
-
}
|
|
3912
|
-
}
|
|
3913
|
-
};
|
|
3914
|
-
|
|
3915
|
-
// ../ast/lib/ast/Parameter.js
|
|
3916
|
-
var Parameter = class extends AstNode {
|
|
3917
|
-
constructor({ name, type, docs }) {
|
|
3918
|
-
super();
|
|
3919
|
-
__publicField(this, "name");
|
|
3920
|
-
__publicField(this, "type");
|
|
3921
|
-
__publicField(this, "docs");
|
|
3922
|
-
this.name = name;
|
|
3923
|
-
this.type = type;
|
|
3924
|
-
this.docs = docs;
|
|
3925
|
-
}
|
|
3926
|
-
write(writer) {
|
|
3927
|
-
writer.write(`${this.name}`);
|
|
3928
|
-
}
|
|
3929
|
-
writeWithType(writer) {
|
|
3930
|
-
if (this.docs != null) {
|
|
3931
|
-
writer.writeNode(new Comment({ docs: this.docs }));
|
|
3932
|
-
}
|
|
3933
|
-
writer.write(`${this.name}: `);
|
|
3934
|
-
this.type.write(writer);
|
|
3935
|
-
}
|
|
3936
|
-
};
|
|
3937
|
-
|
|
3938
|
-
// ../ast/lib/ast/Function.js
|
|
3939
|
-
init_process();
|
|
3940
|
-
init_buffer();
|
|
3941
|
-
var Function2 = class extends AstNode {
|
|
3942
|
-
constructor({ name, parameters, async, body, return_, docs }) {
|
|
3943
|
-
super();
|
|
3944
|
-
__publicField(this, "name");
|
|
3945
|
-
__publicField(this, "parameters");
|
|
3946
|
-
__publicField(this, "async");
|
|
3947
|
-
__publicField(this, "body");
|
|
3948
|
-
__publicField(this, "return_");
|
|
3949
|
-
__publicField(this, "docs");
|
|
3950
|
-
this.name = name;
|
|
3951
|
-
this.parameters = parameters;
|
|
3952
|
-
this.async = async != null ? async : false;
|
|
3953
|
-
this.body = body;
|
|
3954
|
-
this.return_ = return_;
|
|
3955
|
-
this.docs = docs;
|
|
3956
|
-
}
|
|
3957
|
-
write(writer) {
|
|
3958
|
-
var _a;
|
|
3959
|
-
writer.writeNode(new Comment({ docs: this.docs }));
|
|
3960
|
-
if (this.async) {
|
|
3961
|
-
writer.write("async ");
|
|
3962
|
-
}
|
|
3963
|
-
writer.write("function ");
|
|
3964
|
-
writer.write(`${this.name}`);
|
|
3965
|
-
this.writeParameters(writer);
|
|
3966
|
-
if (this.return_ != null) {
|
|
3967
|
-
writer.write(": ");
|
|
3968
|
-
writer.writeNode(this.async ? Type.promise(this.return_) : this.return_);
|
|
3969
|
-
}
|
|
3970
|
-
writer.writeLine(" {");
|
|
3971
|
-
writer.indent();
|
|
3972
|
-
(_a = this.body) == null ? void 0 : _a.write(writer);
|
|
3973
|
-
writer.dedent();
|
|
3974
|
-
writer.writeNewLineIfLastLineNot();
|
|
3975
|
-
writer.writeLine("}");
|
|
3976
|
-
}
|
|
3977
|
-
writeParameters(writer) {
|
|
3978
|
-
if (this.parameters.length === 0) {
|
|
3979
|
-
writer.write("()");
|
|
3980
|
-
return;
|
|
3981
|
-
}
|
|
3982
|
-
writer.writeLine("(");
|
|
3983
|
-
writer.delimit({
|
|
3984
|
-
nodes: this.parameters,
|
|
3985
|
-
delimiter: ",\n",
|
|
3986
|
-
writeFunction: (parameter2) => parameter2.writeWithType(writer)
|
|
3987
|
-
});
|
|
3988
|
-
writer.write(")");
|
|
3989
|
-
}
|
|
3990
|
-
};
|
|
3991
|
-
|
|
3992
|
-
// ../ast/lib/ast/FunctionInvocation.js
|
|
3993
|
-
init_process();
|
|
3994
|
-
init_buffer();
|
|
3995
|
-
var FunctionInvocation = class extends AstNode {
|
|
3996
|
-
constructor({ function_: function_2, arguments_ }) {
|
|
3997
|
-
super();
|
|
3998
|
-
__publicField(this, "function_");
|
|
3999
|
-
__publicField(this, "arguments_");
|
|
4000
|
-
this.function_ = function_2;
|
|
4001
|
-
this.arguments_ = arguments_;
|
|
4002
|
-
}
|
|
4003
|
-
write(writer) {
|
|
4004
|
-
writer.writeNode(this.function_);
|
|
4005
|
-
writer.write("(");
|
|
4006
|
-
writer.delimit({
|
|
4007
|
-
nodes: this.arguments_,
|
|
4008
|
-
delimiter: ", ",
|
|
4009
|
-
writeFunction: (argument) => argument.write(writer)
|
|
4010
|
-
});
|
|
4011
|
-
writer.write(")");
|
|
4012
|
-
}
|
|
4013
|
-
};
|
|
4014
|
-
|
|
4015
|
-
// ../ast/lib/ast/MethodInvocation.js
|
|
4016
|
-
init_process();
|
|
4017
|
-
init_buffer();
|
|
4018
|
-
var MethodInvocation = class extends AstNode {
|
|
4019
|
-
constructor({ on: on2, method, arguments_, async }) {
|
|
4020
|
-
super();
|
|
4021
|
-
__publicField(this, "on");
|
|
4022
|
-
__publicField(this, "method");
|
|
4023
|
-
__publicField(this, "arguments_");
|
|
4024
|
-
__publicField(this, "async");
|
|
4025
|
-
this.on = on2;
|
|
4026
|
-
this.method = method;
|
|
4027
|
-
this.arguments_ = arguments_;
|
|
4028
|
-
this.async = async;
|
|
4029
|
-
}
|
|
4030
|
-
write(writer) {
|
|
4031
|
-
if (this.async) {
|
|
4032
|
-
writer.write("await ");
|
|
4033
|
-
}
|
|
4034
|
-
this.on.write(writer);
|
|
4035
|
-
writer.write(".");
|
|
4036
|
-
writer.write(this.method);
|
|
4037
|
-
writer.write("(");
|
|
4038
|
-
writer.delimit({
|
|
4039
|
-
nodes: this.arguments_,
|
|
4040
|
-
delimiter: ", ",
|
|
4041
|
-
writeFunction: (argument) => argument.write(writer)
|
|
4042
|
-
});
|
|
4043
|
-
writer.write(")");
|
|
4044
|
-
}
|
|
4045
|
-
};
|
|
4046
|
-
|
|
4047
|
-
// ../ast/lib/ast/ClassInstantiation.js
|
|
4048
|
-
init_process();
|
|
4049
|
-
init_buffer();
|
|
4050
|
-
var ClassInstantiation = class extends AstNode {
|
|
4051
|
-
constructor({ class_, arguments_ }) {
|
|
4052
|
-
super();
|
|
4053
|
-
__publicField(this, "class_");
|
|
4054
|
-
__publicField(this, "arguments_");
|
|
4055
|
-
this.class_ = class_;
|
|
4056
|
-
this.arguments_ = arguments_;
|
|
4057
|
-
}
|
|
4058
|
-
write(writer) {
|
|
4059
|
-
writer.write("new ");
|
|
4060
|
-
writer.writeNode(this.class_);
|
|
4061
|
-
writer.write("(");
|
|
4062
|
-
writer.delimit({
|
|
4063
|
-
nodes: this.arguments_,
|
|
4064
|
-
delimiter: ", ",
|
|
4065
|
-
writeFunction: (argument) => argument.write(writer)
|
|
4066
|
-
});
|
|
4067
|
-
writer.write(")");
|
|
4068
|
-
}
|
|
4069
|
-
};
|
|
4070
|
-
|
|
4071
|
-
// ../ast/lib/typescript.js
|
|
4072
|
-
function codeblock(arg) {
|
|
4073
|
-
return new CodeBlock2(arg);
|
|
4074
|
-
}
|
|
4075
|
-
function function_(args) {
|
|
4076
|
-
return new Function2(args);
|
|
4077
|
-
}
|
|
4078
|
-
function instantiateClass(args) {
|
|
4079
|
-
return new ClassInstantiation(args);
|
|
4080
|
-
}
|
|
4081
|
-
function invokeFunction(args) {
|
|
4082
|
-
return new FunctionInvocation(args);
|
|
4083
|
-
}
|
|
4084
|
-
function invokeMethod(args) {
|
|
4085
|
-
return new MethodInvocation(args);
|
|
4086
|
-
}
|
|
4087
|
-
function parameter(args) {
|
|
4088
|
-
return new Parameter(args);
|
|
4089
|
-
}
|
|
4090
|
-
function reference(arg) {
|
|
4091
|
-
return new Reference(arg);
|
|
4092
|
-
}
|
|
4093
|
-
function variable(arg) {
|
|
4094
|
-
return new Variable(arg);
|
|
4095
|
-
}
|
|
4096
|
-
|
|
4097
|
-
// ../browser-compatible-base/lib/utils/index.js
|
|
4098
|
-
init_process();
|
|
4099
|
-
init_buffer();
|
|
4100
|
-
|
|
4101
|
-
// ../browser-compatible-base/lib/utils/constructNpmPackage.js
|
|
4102
|
-
init_process();
|
|
4103
|
-
init_buffer();
|
|
4104
|
-
function constructNpmPackage({ generatorConfig, isPackagePrivate }) {
|
|
4105
|
-
var _a;
|
|
4106
|
-
const outputMode = generatorConfig.output.mode;
|
|
4107
|
-
switch (outputMode.type) {
|
|
4108
|
-
case "downloadFiles":
|
|
4109
|
-
return void 0;
|
|
4110
|
-
case "publish":
|
|
4111
|
-
return {
|
|
4112
|
-
packageName: outputMode.registriesV2.npm.packageName,
|
|
4113
|
-
version: outputMode.version,
|
|
4114
|
-
private: isPackagePrivate,
|
|
4115
|
-
publishInfo: {
|
|
4116
|
-
registryUrl: outputMode.registriesV2.npm.registryUrl,
|
|
4117
|
-
token: outputMode.registriesV2.npm.token
|
|
4118
|
-
},
|
|
4119
|
-
license: void 0,
|
|
4120
|
-
repoUrl: void 0
|
|
4121
|
-
};
|
|
4122
|
-
case "github":
|
|
4123
|
-
if (outputMode.publishInfo != null && outputMode.publishInfo.type !== "npm") {
|
|
4124
|
-
throw new Error(`Expected to receive npm publish info but received ${outputMode.publishInfo.type} instead`);
|
|
4125
|
-
}
|
|
4126
|
-
return {
|
|
4127
|
-
packageName: outputMode.publishInfo != null ? outputMode.publishInfo.packageName : "",
|
|
4128
|
-
version: outputMode.version,
|
|
4129
|
-
private: isPackagePrivate,
|
|
4130
|
-
publishInfo: void 0,
|
|
4131
|
-
repoUrl: outputMode.repoUrl,
|
|
4132
|
-
license: (_a = generatorConfig.license) == null ? void 0 : _a._visit({
|
|
4133
|
-
basic: (basic) => basic.id,
|
|
4134
|
-
custom: (custom) => `See ${custom.filename}`,
|
|
4135
|
-
_other: () => {
|
|
4136
|
-
return void 0;
|
|
4137
|
-
}
|
|
4138
|
-
})
|
|
4139
|
-
};
|
|
4140
|
-
default:
|
|
4141
|
-
throw new Error(`Encountered unknown output mode: ${outputMode}`);
|
|
4142
|
-
}
|
|
4143
|
-
}
|
|
4144
|
-
|
|
4145
|
-
// ../browser-compatible-base/lib/utils/getNamespaceExport.js
|
|
4146
|
-
init_process();
|
|
4147
|
-
init_buffer();
|
|
4148
|
-
function getNamespaceExport({ organization, workspaceName, namespaceExport }) {
|
|
4149
|
-
return namespaceExport != null ? namespaceExport : `${upperFirst_default(camelCase_default(organization))}${upperFirst_default(camelCase_default(workspaceName))}`;
|
|
4150
|
-
}
|
|
4151
|
-
|
|
4152
|
-
// src/context/DynamicTypeLiteralMapper.ts
|
|
4153
|
-
init_process();
|
|
4154
|
-
init_buffer();
|
|
4155
|
-
var UNION_VALUE_KEY = "value";
|
|
4156
|
-
var DynamicTypeLiteralMapper = class {
|
|
4157
|
-
constructor({ context }) {
|
|
4158
|
-
__publicField(this, "context");
|
|
4159
|
-
this.context = context;
|
|
4160
|
-
}
|
|
4161
|
-
convert(args) {
|
|
4162
|
-
if (args.value == null) {
|
|
4163
|
-
return typescript_exports.TypeLiteral.nop();
|
|
4164
|
-
}
|
|
4165
|
-
switch (args.typeReference.type) {
|
|
4166
|
-
case "list":
|
|
4167
|
-
return this.convertList({ list: args.typeReference.value, value: args.value });
|
|
4168
|
-
case "literal":
|
|
4169
|
-
return this.convertLiteral({ literalType: args.typeReference.value, value: args.value });
|
|
4170
|
-
case "map":
|
|
4171
|
-
return this.convertMap({ map: args.typeReference, value: args.value });
|
|
4172
|
-
case "named": {
|
|
4173
|
-
const named = this.context.resolveNamedType({ typeId: args.typeReference.value });
|
|
4174
|
-
if (named == null) {
|
|
4175
|
-
return typescript_exports.TypeLiteral.nop();
|
|
4176
|
-
}
|
|
4177
|
-
return this.convertNamed({ named, value: args.value, as: args.as });
|
|
4178
|
-
}
|
|
4179
|
-
case "optional":
|
|
4180
|
-
return this.convert({ typeReference: args.typeReference.value, value: args.value, as: args.as });
|
|
4181
|
-
case "primitive":
|
|
4182
|
-
return this.convertPrimitive({ primitive: args.typeReference.value, value: args.value, as: args.as });
|
|
4183
|
-
case "set":
|
|
4184
|
-
return this.convertSet({ set: args.typeReference.value, value: args.value });
|
|
4185
|
-
case "unknown":
|
|
4186
|
-
return this.convertUnknown({ value: args.value });
|
|
4187
|
-
default:
|
|
4188
|
-
assertNever(args.typeReference);
|
|
4189
|
-
}
|
|
4190
|
-
}
|
|
4191
|
-
convertLiteral({
|
|
4192
|
-
literalType,
|
|
4193
|
-
value
|
|
4194
|
-
}) {
|
|
4195
|
-
switch (literalType.type) {
|
|
4196
|
-
case "boolean": {
|
|
4197
|
-
const bool = this.context.getValueAsBoolean({ value });
|
|
4198
|
-
if (bool == null) {
|
|
4199
|
-
return typescript_exports.TypeLiteral.nop();
|
|
4200
|
-
}
|
|
4201
|
-
return typescript_exports.TypeLiteral.boolean(bool);
|
|
4202
|
-
}
|
|
4203
|
-
case "string": {
|
|
4204
|
-
const str = this.context.getValueAsString({ value });
|
|
4205
|
-
if (str == null) {
|
|
4206
|
-
return typescript_exports.TypeLiteral.nop();
|
|
4207
|
-
}
|
|
4208
|
-
return typescript_exports.TypeLiteral.string(str);
|
|
4209
|
-
}
|
|
4210
|
-
default:
|
|
4211
|
-
assertNever(literalType);
|
|
4212
|
-
}
|
|
4213
|
-
}
|
|
4214
|
-
convertList({ list, value }) {
|
|
4215
|
-
if (!Array.isArray(value)) {
|
|
4216
|
-
this.context.errors.add({
|
|
4217
|
-
severity: Severity.Critical,
|
|
4218
|
-
message: `Expected array but got: ${typeof value}`
|
|
4219
|
-
});
|
|
4220
|
-
return typescript_exports.TypeLiteral.nop();
|
|
4221
|
-
}
|
|
4222
|
-
return typescript_exports.TypeLiteral.array({
|
|
4223
|
-
values: value.map((v, index) => {
|
|
4224
|
-
this.context.errors.scope({ index });
|
|
4225
|
-
try {
|
|
4226
|
-
return this.convert({ typeReference: list, value: v });
|
|
4227
|
-
} finally {
|
|
4228
|
-
this.context.errors.unscope();
|
|
4229
|
-
}
|
|
4230
|
-
})
|
|
4231
|
-
});
|
|
4232
|
-
}
|
|
4233
|
-
convertSet({ set, value }) {
|
|
4234
|
-
if (!Array.isArray(value)) {
|
|
4235
|
-
this.context.errors.add({
|
|
4236
|
-
severity: Severity.Critical,
|
|
4237
|
-
message: `Expected array but got: ${typeof value}`
|
|
4238
|
-
});
|
|
4239
|
-
return typescript_exports.TypeLiteral.nop();
|
|
4240
|
-
}
|
|
4241
|
-
return typescript_exports.TypeLiteral.set({
|
|
4242
|
-
values: value.map((v, index) => {
|
|
4243
|
-
this.context.errors.scope({ index });
|
|
4244
|
-
try {
|
|
4245
|
-
return this.convert({ typeReference: set, value: v });
|
|
4246
|
-
} finally {
|
|
4247
|
-
this.context.errors.unscope();
|
|
4248
|
-
}
|
|
4249
|
-
})
|
|
4250
|
-
});
|
|
4251
|
-
}
|
|
4252
|
-
convertMap({ map, value }) {
|
|
4253
|
-
if (typeof value !== "object" || value == null) {
|
|
4254
|
-
this.context.errors.add({
|
|
4255
|
-
severity: Severity.Critical,
|
|
4256
|
-
message: `Expected object but got: ${value == null ? "null" : typeof value}`
|
|
4257
|
-
});
|
|
4258
|
-
return typescript_exports.TypeLiteral.nop();
|
|
4259
|
-
}
|
|
4260
|
-
return typescript_exports.TypeLiteral.record({
|
|
4261
|
-
entries: Object.entries(value).map(([key, value2]) => {
|
|
4262
|
-
this.context.errors.scope(key);
|
|
4263
|
-
try {
|
|
4264
|
-
return {
|
|
4265
|
-
key: this.convert({ typeReference: map.key, value: key, as: "key" }),
|
|
4266
|
-
value: this.convert({ typeReference: map.value, value: value2 })
|
|
4267
|
-
};
|
|
4268
|
-
} finally {
|
|
4269
|
-
this.context.errors.unscope();
|
|
4270
|
-
}
|
|
4271
|
-
})
|
|
4272
|
-
});
|
|
4273
|
-
}
|
|
4274
|
-
convertNamed({
|
|
4275
|
-
named,
|
|
4276
|
-
value,
|
|
4277
|
-
as
|
|
4278
|
-
}) {
|
|
4279
|
-
var _a;
|
|
4280
|
-
switch (named.type) {
|
|
4281
|
-
case "alias": {
|
|
4282
|
-
if ((_a = this.context.customConfig) == null ? void 0 : _a.useBrandedStringAliases) {
|
|
4283
|
-
return typescript_exports.TypeLiteral.reference(
|
|
4284
|
-
typescript_exports.codeblock((writer) => {
|
|
4285
|
-
writer.writeNode(
|
|
4286
|
-
typescript_exports.reference({
|
|
4287
|
-
name: this.context.namespaceExport,
|
|
4288
|
-
importFrom: this.context.getModuleImport(),
|
|
4289
|
-
memberName: this.context.getFullyQualifiedReference({
|
|
4290
|
-
declaration: named.declaration
|
|
4291
|
-
})
|
|
4292
|
-
})
|
|
4293
|
-
);
|
|
4294
|
-
writer.write("(");
|
|
4295
|
-
writer.writeNode(this.convert({ typeReference: named.typeReference, value, as }));
|
|
4296
|
-
writer.write(")");
|
|
4297
|
-
})
|
|
4298
|
-
);
|
|
4299
|
-
}
|
|
4300
|
-
return this.convert({ typeReference: named.typeReference, value, as });
|
|
4301
|
-
}
|
|
4302
|
-
case "discriminatedUnion":
|
|
4303
|
-
return this.convertDiscriminatedUnion({
|
|
4304
|
-
discriminatedUnion: named,
|
|
4305
|
-
value
|
|
4306
|
-
});
|
|
4307
|
-
case "enum":
|
|
4308
|
-
return this.convertEnum({ enum_: named, value });
|
|
4309
|
-
case "object":
|
|
4310
|
-
return this.convertObject({ object_: named, value });
|
|
4311
|
-
case "undiscriminatedUnion":
|
|
4312
|
-
return this.convertUndicriminatedUnion({ undicriminatedUnion: named, value });
|
|
4313
|
-
default:
|
|
4314
|
-
assertNever(named);
|
|
4315
|
-
}
|
|
4316
|
-
}
|
|
4317
|
-
convertDiscriminatedUnion({
|
|
4318
|
-
discriminatedUnion,
|
|
4319
|
-
value
|
|
4320
|
-
}) {
|
|
4321
|
-
var _a;
|
|
4322
|
-
const discriminatedUnionTypeInstance = this.context.resolveDiscriminatedUnionTypeInstance({
|
|
4323
|
-
discriminatedUnion,
|
|
4324
|
-
value
|
|
4325
|
-
});
|
|
4326
|
-
if (discriminatedUnionTypeInstance == null) {
|
|
4327
|
-
return typescript_exports.TypeLiteral.nop();
|
|
4328
|
-
}
|
|
4329
|
-
const unionVariant = discriminatedUnionTypeInstance.singleDiscriminatedUnionType;
|
|
4330
|
-
const unionProperties = this.convertDiscriminatedUnionProperties({
|
|
4331
|
-
discriminatedUnionTypeInstance,
|
|
4332
|
-
unionVariant
|
|
4333
|
-
});
|
|
4334
|
-
if (unionProperties == null) {
|
|
4335
|
-
return typescript_exports.TypeLiteral.nop();
|
|
4336
|
-
}
|
|
4337
|
-
if ((_a = this.context.customConfig) == null ? void 0 : _a.includeUtilsOnUnionMembers) {
|
|
4338
|
-
return typescript_exports.TypeLiteral.reference(
|
|
4339
|
-
typescript_exports.codeblock((writer) => {
|
|
4340
|
-
writer.writeNode(
|
|
4341
|
-
typescript_exports.invokeMethod({
|
|
4342
|
-
on: typescript_exports.reference({
|
|
4343
|
-
name: this.context.namespaceExport,
|
|
4344
|
-
importFrom: this.context.getModuleImport(),
|
|
4345
|
-
memberName: this.context.getFullyQualifiedReference({
|
|
4346
|
-
declaration: discriminatedUnion.declaration
|
|
4347
|
-
})
|
|
4348
|
-
}),
|
|
4349
|
-
method: this.context.getMethodName(unionVariant.discriminantValue.name),
|
|
4350
|
-
arguments_: this.convertDiscriminatedUnionUtilsArgs({
|
|
4351
|
-
discriminatedUnionTypeInstance,
|
|
4352
|
-
unionVariant,
|
|
4353
|
-
unionProperties
|
|
4354
|
-
})
|
|
4355
|
-
})
|
|
4356
|
-
);
|
|
4357
|
-
})
|
|
4358
|
-
);
|
|
4359
|
-
}
|
|
4360
|
-
const discriminantProperty = {
|
|
4361
|
-
name: this.context.getPropertyName(discriminatedUnion.discriminant.name),
|
|
4362
|
-
value: typescript_exports.TypeLiteral.string(unionVariant.discriminantValue.wireValue)
|
|
4363
|
-
};
|
|
4364
|
-
return typescript_exports.TypeLiteral.object({
|
|
4365
|
-
fields: [discriminantProperty, ...unionProperties]
|
|
4366
|
-
});
|
|
4367
|
-
}
|
|
4368
|
-
convertDiscriminatedUnionProperties({
|
|
4369
|
-
discriminatedUnionTypeInstance,
|
|
4370
|
-
unionVariant
|
|
4371
|
-
}) {
|
|
4372
|
-
const baseFields = this.getBaseFields({
|
|
4373
|
-
discriminatedUnionTypeInstance,
|
|
4374
|
-
singleDiscriminatedUnionType: unionVariant
|
|
4375
|
-
});
|
|
4376
|
-
switch (unionVariant.type) {
|
|
4377
|
-
case "samePropertiesAsObject": {
|
|
4378
|
-
const named = this.context.resolveNamedType({
|
|
4379
|
-
typeId: unionVariant.typeId
|
|
4380
|
-
});
|
|
4381
|
-
if (named == null) {
|
|
4382
|
-
return void 0;
|
|
4383
|
-
}
|
|
4384
|
-
const converted = this.convertNamed({ named, value: discriminatedUnionTypeInstance.value });
|
|
4385
|
-
if (!converted.isObject()) {
|
|
4386
|
-
this.context.errors.add({
|
|
4387
|
-
severity: Severity.Critical,
|
|
4388
|
-
message: "Internal error; expected union value to be an object"
|
|
4389
|
-
});
|
|
4390
|
-
return void 0;
|
|
4391
|
-
}
|
|
4392
|
-
const object_ = converted.asObjectOrThrow();
|
|
4393
|
-
return [...baseFields, ...object_.fields];
|
|
4394
|
-
}
|
|
4395
|
-
case "singleProperty": {
|
|
4396
|
-
try {
|
|
4397
|
-
this.context.errors.scope(unionVariant.discriminantValue.wireValue);
|
|
4398
|
-
const record = this.context.getRecord(discriminatedUnionTypeInstance.value);
|
|
4399
|
-
if (record == null) {
|
|
4400
|
-
return [
|
|
4401
|
-
...baseFields,
|
|
4402
|
-
{
|
|
4403
|
-
name: UNION_VALUE_KEY,
|
|
4404
|
-
value: this.convert({
|
|
4405
|
-
typeReference: unionVariant.typeReference,
|
|
4406
|
-
value: discriminatedUnionTypeInstance.value
|
|
4407
|
-
})
|
|
4408
|
-
}
|
|
4409
|
-
];
|
|
4410
|
-
}
|
|
4411
|
-
return [
|
|
4412
|
-
...baseFields,
|
|
4413
|
-
{
|
|
4414
|
-
name: this.context.getPropertyName(unionVariant.discriminantValue.name),
|
|
4415
|
-
value: this.convert({
|
|
4416
|
-
typeReference: unionVariant.typeReference,
|
|
4417
|
-
value: record[unionVariant.discriminantValue.wireValue]
|
|
4418
|
-
})
|
|
4419
|
-
}
|
|
4420
|
-
];
|
|
4421
|
-
} finally {
|
|
4422
|
-
this.context.errors.unscope();
|
|
4423
|
-
}
|
|
4424
|
-
}
|
|
4425
|
-
case "noProperties":
|
|
4426
|
-
return baseFields;
|
|
4427
|
-
default:
|
|
4428
|
-
assertNever(unionVariant);
|
|
4429
|
-
}
|
|
4430
|
-
}
|
|
4431
|
-
convertDiscriminatedUnionUtilsArgs({
|
|
4432
|
-
discriminatedUnionTypeInstance,
|
|
4433
|
-
unionVariant,
|
|
4434
|
-
unionProperties
|
|
4435
|
-
}) {
|
|
4436
|
-
if (unionVariant.type === "singleProperty") {
|
|
4437
|
-
const record = this.context.getRecord(discriminatedUnionTypeInstance.value);
|
|
4438
|
-
if (record == null && unionProperties.length === 1) {
|
|
4439
|
-
return [
|
|
4440
|
-
this.convert({
|
|
4441
|
-
typeReference: unionVariant.typeReference,
|
|
4442
|
-
value: discriminatedUnionTypeInstance.value
|
|
4443
|
-
})
|
|
4444
|
-
];
|
|
4445
|
-
}
|
|
4446
|
-
}
|
|
4447
|
-
return unionProperties.length > 0 ? [typescript_exports.TypeLiteral.object({ fields: unionProperties })] : [];
|
|
4448
|
-
}
|
|
4449
|
-
getBaseFields({
|
|
4450
|
-
discriminatedUnionTypeInstance,
|
|
4451
|
-
singleDiscriminatedUnionType
|
|
4452
|
-
}) {
|
|
4453
|
-
var _a, _b;
|
|
4454
|
-
const properties = this.context.associateByWireValue({
|
|
4455
|
-
parameters: (_a = singleDiscriminatedUnionType.properties) != null ? _a : [],
|
|
4456
|
-
values: (_b = this.context.getRecord(discriminatedUnionTypeInstance.value)) != null ? _b : {},
|
|
4457
|
-
// We're only selecting the base properties here. The rest of the properties
|
|
4458
|
-
// are handled by the union variant.
|
|
4459
|
-
ignoreMissingParameters: true
|
|
4460
|
-
});
|
|
4461
|
-
return properties.map((property) => {
|
|
4462
|
-
this.context.errors.scope(property.name.wireValue);
|
|
4463
|
-
try {
|
|
4464
|
-
return {
|
|
4465
|
-
name: this.context.getPropertyName(property.name.name),
|
|
4466
|
-
value: this.convert(property)
|
|
4467
|
-
};
|
|
4468
|
-
} finally {
|
|
4469
|
-
this.context.errors.unscope();
|
|
4470
|
-
}
|
|
4471
|
-
});
|
|
4472
|
-
}
|
|
4473
|
-
convertObject({ object_, value }) {
|
|
4474
|
-
var _a;
|
|
4475
|
-
const properties = this.context.associateByWireValue({
|
|
4476
|
-
parameters: object_.properties,
|
|
4477
|
-
values: (_a = this.context.getRecord(value)) != null ? _a : {}
|
|
4478
|
-
});
|
|
4479
|
-
return typescript_exports.TypeLiteral.object({
|
|
4480
|
-
fields: properties.map((property) => {
|
|
4481
|
-
this.context.errors.scope(property.name.wireValue);
|
|
4482
|
-
try {
|
|
4483
|
-
return {
|
|
4484
|
-
name: this.context.getPropertyName(property.name.name),
|
|
4485
|
-
value: this.convert(property)
|
|
4486
|
-
};
|
|
4487
|
-
} finally {
|
|
4488
|
-
this.context.errors.unscope();
|
|
4489
|
-
}
|
|
4490
|
-
})
|
|
4491
|
-
});
|
|
4492
|
-
}
|
|
4493
|
-
convertEnum({ enum_, value }) {
|
|
4494
|
-
const enumValue = this.getEnumValue({ enum_, value });
|
|
4495
|
-
if (enumValue == null) {
|
|
4496
|
-
return typescript_exports.TypeLiteral.nop();
|
|
4497
|
-
}
|
|
4498
|
-
return typescript_exports.TypeLiteral.string(enumValue);
|
|
4499
|
-
}
|
|
4500
|
-
getEnumValue({ enum_, value }) {
|
|
4501
|
-
if (typeof value !== "string") {
|
|
4502
|
-
this.context.errors.add({
|
|
4503
|
-
severity: Severity.Critical,
|
|
4504
|
-
message: `Expected enum value string, got: ${typeof value}`
|
|
4505
|
-
});
|
|
4506
|
-
return void 0;
|
|
4507
|
-
}
|
|
4508
|
-
const enumValue = enum_.values.find((v) => v.wireValue === value);
|
|
4509
|
-
if (enumValue == null) {
|
|
4510
|
-
this.context.errors.add({
|
|
4511
|
-
severity: Severity.Critical,
|
|
4512
|
-
message: `An enum value named "${value}" does not exist in this context`
|
|
4513
|
-
});
|
|
4514
|
-
return void 0;
|
|
4515
|
-
}
|
|
4516
|
-
return value;
|
|
4517
|
-
}
|
|
4518
|
-
convertUndicriminatedUnion({
|
|
4519
|
-
undicriminatedUnion,
|
|
4520
|
-
value
|
|
4521
|
-
}) {
|
|
4522
|
-
const result = this.findMatchingUndiscriminatedUnionType({
|
|
4523
|
-
undicriminatedUnion,
|
|
4524
|
-
value
|
|
4525
|
-
});
|
|
4526
|
-
if (result == null) {
|
|
4527
|
-
return typescript_exports.TypeLiteral.nop();
|
|
4528
|
-
}
|
|
4529
|
-
return result;
|
|
4530
|
-
}
|
|
4531
|
-
findMatchingUndiscriminatedUnionType({
|
|
4532
|
-
undicriminatedUnion,
|
|
4533
|
-
value
|
|
4534
|
-
}) {
|
|
4535
|
-
for (const typeReference of undicriminatedUnion.types) {
|
|
4536
|
-
try {
|
|
4537
|
-
return this.convert({ typeReference, value });
|
|
4538
|
-
} catch (e) {
|
|
4539
|
-
continue;
|
|
4540
|
-
}
|
|
4541
|
-
}
|
|
4542
|
-
this.context.errors.add({
|
|
4543
|
-
severity: Severity.Critical,
|
|
4544
|
-
message: `None of the types in the undicriminated union matched the given "${typeof value}" value`
|
|
4545
|
-
});
|
|
4546
|
-
return void 0;
|
|
4547
|
-
}
|
|
4548
|
-
convertUnknown({ value }) {
|
|
4549
|
-
return typescript_exports.TypeLiteral.unknown(value);
|
|
4550
|
-
}
|
|
4551
|
-
convertPrimitive({
|
|
4552
|
-
primitive,
|
|
4553
|
-
value,
|
|
4554
|
-
as
|
|
4555
|
-
}) {
|
|
4556
|
-
var _a, _b;
|
|
4557
|
-
switch (primitive) {
|
|
4558
|
-
case "INTEGER":
|
|
4559
|
-
case "UINT": {
|
|
4560
|
-
const num = this.getValueAsNumber({ value, as });
|
|
4561
|
-
if (num == null) {
|
|
4562
|
-
return typescript_exports.TypeLiteral.nop();
|
|
4563
|
-
}
|
|
4564
|
-
return typescript_exports.TypeLiteral.number(num);
|
|
4565
|
-
}
|
|
4566
|
-
case "LONG":
|
|
4567
|
-
case "UINT_64": {
|
|
4568
|
-
const num = this.getValueAsNumber({ value, as });
|
|
4569
|
-
if (num == null) {
|
|
4570
|
-
return typescript_exports.TypeLiteral.nop();
|
|
4571
|
-
}
|
|
4572
|
-
if ((_a = this.context.customConfig) == null ? void 0 : _a.useBigInt) {
|
|
4573
|
-
return typescript_exports.TypeLiteral.bigint(BigInt(num));
|
|
4574
|
-
}
|
|
4575
|
-
return typescript_exports.TypeLiteral.number(num);
|
|
4576
|
-
}
|
|
4577
|
-
case "FLOAT":
|
|
4578
|
-
case "DOUBLE": {
|
|
4579
|
-
const num = this.getValueAsNumber({ value });
|
|
4580
|
-
if (num == null) {
|
|
4581
|
-
return typescript_exports.TypeLiteral.nop();
|
|
4582
|
-
}
|
|
4583
|
-
return typescript_exports.TypeLiteral.number(num);
|
|
4584
|
-
}
|
|
4585
|
-
case "BOOLEAN": {
|
|
4586
|
-
const bool = this.getValueAsBoolean({ value, as });
|
|
4587
|
-
if (bool == null) {
|
|
4588
|
-
return typescript_exports.TypeLiteral.nop();
|
|
4589
|
-
}
|
|
4590
|
-
return typescript_exports.TypeLiteral.boolean(bool);
|
|
4591
|
-
}
|
|
4592
|
-
case "BASE_64":
|
|
4593
|
-
case "DATE":
|
|
4594
|
-
case "UUID":
|
|
4595
|
-
case "STRING": {
|
|
4596
|
-
const str = this.context.getValueAsString({ value });
|
|
4597
|
-
if (str == null) {
|
|
4598
|
-
return typescript_exports.TypeLiteral.nop();
|
|
4599
|
-
}
|
|
4600
|
-
return typescript_exports.TypeLiteral.string(str);
|
|
4601
|
-
}
|
|
4602
|
-
case "DATE_TIME": {
|
|
4603
|
-
const str = this.context.getValueAsString({ value });
|
|
4604
|
-
if (str == null) {
|
|
4605
|
-
return typescript_exports.TypeLiteral.nop();
|
|
4606
|
-
}
|
|
4607
|
-
return typescript_exports.TypeLiteral.datetime(str);
|
|
4608
|
-
}
|
|
4609
|
-
case "BIG_INTEGER": {
|
|
4610
|
-
const bigInt = this.context.getValueAsString({ value });
|
|
4611
|
-
if (bigInt == null) {
|
|
4612
|
-
return typescript_exports.TypeLiteral.nop();
|
|
4613
|
-
}
|
|
4614
|
-
if ((_b = this.context.customConfig) == null ? void 0 : _b.useBigInt) {
|
|
4615
|
-
return typescript_exports.TypeLiteral.bigint(BigInt(bigInt));
|
|
4616
|
-
}
|
|
4617
|
-
return typescript_exports.TypeLiteral.string(bigInt);
|
|
4618
|
-
}
|
|
4619
|
-
default:
|
|
4620
|
-
assertNever(primitive);
|
|
4621
|
-
}
|
|
4622
|
-
}
|
|
4623
|
-
getValueAsNumber({
|
|
4624
|
-
value,
|
|
4625
|
-
as
|
|
4626
|
-
}) {
|
|
4627
|
-
const num = as === "key" ? typeof value === "string" ? Number(value) : value : value;
|
|
4628
|
-
return this.context.getValueAsNumber({ value: num });
|
|
4629
|
-
}
|
|
4630
|
-
getValueAsBoolean({
|
|
4631
|
-
value,
|
|
4632
|
-
as
|
|
4633
|
-
}) {
|
|
4634
|
-
const bool = as === "key" ? typeof value === "string" ? value === "true" : value === "false" ? false : value : value;
|
|
4635
|
-
return this.context.getValueAsBoolean({ value: bool });
|
|
4636
|
-
}
|
|
4637
|
-
};
|
|
4638
|
-
|
|
4639
|
-
// src/context/FilePropertyMapper.ts
|
|
4640
|
-
init_process();
|
|
4641
|
-
init_buffer();
|
|
4642
|
-
var FilePropertyMapper = class {
|
|
4643
|
-
constructor({ context }) {
|
|
4644
|
-
__publicField(this, "context");
|
|
4645
|
-
this.context = context;
|
|
4646
|
-
}
|
|
4647
|
-
getFilePropertyInfo({
|
|
4648
|
-
body,
|
|
4649
|
-
value
|
|
4650
|
-
}) {
|
|
4651
|
-
var _a;
|
|
4652
|
-
const result = {
|
|
4653
|
-
fileFields: [],
|
|
4654
|
-
bodyPropertyFields: []
|
|
4655
|
-
};
|
|
4656
|
-
const record = (_a = this.context.getRecord(value)) != null ? _a : {};
|
|
4657
|
-
for (const property of body.properties) {
|
|
4658
|
-
switch (property.type) {
|
|
4659
|
-
case "file":
|
|
4660
|
-
result.fileFields.push({
|
|
4661
|
-
name: this.context.getPropertyName(property.name),
|
|
4662
|
-
value: this.getSingleFileProperty({ property, record })
|
|
4663
|
-
});
|
|
4664
|
-
break;
|
|
4665
|
-
case "fileArray":
|
|
4666
|
-
result.fileFields.push({
|
|
4667
|
-
name: this.context.getPropertyName(property.name),
|
|
4668
|
-
value: this.getArrayFileProperty({ property, record })
|
|
4669
|
-
});
|
|
4670
|
-
break;
|
|
4671
|
-
case "bodyProperty":
|
|
4672
|
-
result.bodyPropertyFields.push({
|
|
4673
|
-
name: this.context.getPropertyName(property.name.name),
|
|
4674
|
-
value: this.getBodyProperty({ property, record })
|
|
4675
|
-
});
|
|
4676
|
-
break;
|
|
4677
|
-
default:
|
|
4678
|
-
assertNever(property);
|
|
4679
|
-
}
|
|
4680
|
-
}
|
|
4681
|
-
return result;
|
|
4682
|
-
}
|
|
4683
|
-
getSingleFileProperty({
|
|
4684
|
-
property,
|
|
4685
|
-
record
|
|
4686
|
-
}) {
|
|
4687
|
-
const fileValue = this.context.getSingleFileValue({ property, record });
|
|
4688
|
-
if (fileValue == null) {
|
|
4689
|
-
return typescript_exports.TypeLiteral.nop();
|
|
4690
|
-
}
|
|
4691
|
-
return typescript_exports.TypeLiteral.blob(fileValue);
|
|
4692
|
-
}
|
|
4693
|
-
getArrayFileProperty({
|
|
4694
|
-
property,
|
|
4695
|
-
record
|
|
4696
|
-
}) {
|
|
4697
|
-
const fileValues = this.context.getFileArrayValues({ property, record });
|
|
4698
|
-
if (fileValues == null) {
|
|
4699
|
-
return typescript_exports.TypeLiteral.nop();
|
|
4700
|
-
}
|
|
4701
|
-
return typescript_exports.TypeLiteral.array({ values: fileValues.map((value) => typescript_exports.TypeLiteral.blob(value)) });
|
|
4702
|
-
}
|
|
4703
|
-
getBodyProperty({
|
|
4704
|
-
property,
|
|
4705
|
-
record
|
|
4706
|
-
}) {
|
|
4707
|
-
const bodyPropertyValue = record[property.name.wireValue];
|
|
4708
|
-
if (bodyPropertyValue == null) {
|
|
4709
|
-
return typescript_exports.TypeLiteral.nop();
|
|
4710
|
-
}
|
|
4711
|
-
return this.context.dynamicTypeLiteralMapper.convert({
|
|
4712
|
-
typeReference: property.typeReference,
|
|
4713
|
-
value: bodyPropertyValue
|
|
4714
|
-
});
|
|
4715
|
-
}
|
|
4716
|
-
};
|
|
4717
|
-
|
|
4718
|
-
// src/context/DynamicSnippetsGeneratorContext.ts
|
|
4719
|
-
var DynamicSnippetsGeneratorContext = class _DynamicSnippetsGeneratorContext extends AbstractDynamicSnippetsGeneratorContext {
|
|
4720
|
-
constructor({
|
|
4721
|
-
ir,
|
|
4722
|
-
config: config2
|
|
4723
|
-
}) {
|
|
4724
|
-
var _a;
|
|
4725
|
-
super({ ir, config: config2 });
|
|
4726
|
-
__publicField(this, "ir");
|
|
4727
|
-
__publicField(this, "customConfig");
|
|
4728
|
-
__publicField(this, "dynamicTypeLiteralMapper");
|
|
4729
|
-
__publicField(this, "filePropertyMapper");
|
|
4730
|
-
__publicField(this, "moduleName");
|
|
4731
|
-
__publicField(this, "namespaceExport");
|
|
4732
|
-
this.ir = ir;
|
|
4733
|
-
this.customConfig = config2.customConfig != null ? config2.customConfig : void 0;
|
|
4734
|
-
this.dynamicTypeLiteralMapper = new DynamicTypeLiteralMapper({ context: this });
|
|
4735
|
-
this.filePropertyMapper = new FilePropertyMapper({ context: this });
|
|
4736
|
-
this.moduleName = getModuleName({ config: config2, customConfig: this.customConfig });
|
|
4737
|
-
this.namespaceExport = getNamespaceExport({
|
|
4738
|
-
organization: config2.organization,
|
|
4739
|
-
workspaceName: config2.workspaceName,
|
|
4740
|
-
namespaceExport: (_a = this.customConfig) == null ? void 0 : _a.namespaceExport
|
|
4741
|
-
});
|
|
4742
|
-
}
|
|
4743
|
-
clone() {
|
|
4744
|
-
return new _DynamicSnippetsGeneratorContext({
|
|
4745
|
-
ir: this.ir,
|
|
4746
|
-
config: this.config
|
|
4747
|
-
});
|
|
4748
|
-
}
|
|
4749
|
-
getModuleImport() {
|
|
4750
|
-
return {
|
|
4751
|
-
type: "named",
|
|
4752
|
-
moduleName: this.moduleName
|
|
4753
|
-
};
|
|
4754
|
-
}
|
|
4755
|
-
getRootClientName() {
|
|
4756
|
-
return `${this.namespaceExport}Client`;
|
|
4757
|
-
}
|
|
4758
|
-
getPropertyName(name) {
|
|
4759
|
-
var _a, _b;
|
|
4760
|
-
if (((_a = this.customConfig) == null ? void 0 : _a.retainOriginalCasing) || ((_b = this.customConfig) == null ? void 0 : _b.noSerdeLayer)) {
|
|
4761
|
-
return this.formatOriginalPropertyName(name.originalName);
|
|
4762
|
-
}
|
|
4763
|
-
return name.camelCase.unsafeName;
|
|
4764
|
-
}
|
|
4765
|
-
getMethodName(name) {
|
|
4766
|
-
return name.camelCase.unsafeName;
|
|
4767
|
-
}
|
|
4768
|
-
getTypeName(name) {
|
|
4769
|
-
return name.pascalCase.unsafeName;
|
|
4770
|
-
}
|
|
4771
|
-
getEnvironmentTypeReferenceFromID(environmentID) {
|
|
4772
|
-
const environmentName = this.resolveEnvironmentName(environmentID);
|
|
4773
|
-
if (environmentName == null) {
|
|
4774
|
-
return void 0;
|
|
4775
|
-
}
|
|
4776
|
-
return this.getEnvironmentsTypeReference(environmentName);
|
|
4777
|
-
}
|
|
4778
|
-
getFullyQualifiedReference({ declaration }) {
|
|
4779
|
-
if (declaration.fernFilepath.allParts.length > 0) {
|
|
4780
|
-
return `${declaration.fernFilepath.allParts.map((val) => val.camelCase.unsafeName).join(".")}.${this.getTypeName(declaration.name)}`;
|
|
4781
|
-
}
|
|
4782
|
-
return `${this.getTypeName(declaration.name)}`;
|
|
4783
|
-
}
|
|
4784
|
-
getEnvironmentsTypeReference(name) {
|
|
4785
|
-
return typescript_exports.reference({
|
|
4786
|
-
name: `${this.namespaceExport}Environments`,
|
|
4787
|
-
importFrom: this.getModuleImport(),
|
|
4788
|
-
memberName: this.getTypeName(name)
|
|
4789
|
-
});
|
|
4790
|
-
}
|
|
4791
|
-
formatOriginalPropertyName(value) {
|
|
4792
|
-
if (value.includes("-")) {
|
|
4793
|
-
return `"${value}"`;
|
|
4794
|
-
}
|
|
4795
|
-
return value;
|
|
4796
|
-
}
|
|
4797
|
-
};
|
|
4798
|
-
function getModuleName({
|
|
4799
|
-
config: config2,
|
|
4800
|
-
customConfig
|
|
4801
|
-
}) {
|
|
4802
|
-
var _a, _b, _c;
|
|
4803
|
-
return (_c = (_b = constructNpmPackage({
|
|
4804
|
-
generatorConfig: config2,
|
|
4805
|
-
isPackagePrivate: (_a = customConfig == null ? void 0 : customConfig.private) != null ? _a : false
|
|
4806
|
-
})) == null ? void 0 : _b.packageName) != null ? _c : config2.organization;
|
|
4807
|
-
}
|
|
4808
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
4809
|
-
0 && (module.exports = {
|
|
4810
|
-
DynamicSnippetsGeneratorContext
|
|
4811
|
-
});
|
|
1
|
+
"use strict";var pe=Object.defineProperty,ct=Object.defineProperties,mt=Object.getOwnPropertyDescriptor,dt=Object.getOwnPropertyDescriptors,ht=Object.getOwnPropertyNames,le=Object.getOwnPropertySymbols;var Re=Object.prototype.hasOwnProperty,_e=Object.prototype.propertyIsEnumerable;var Ee=(t,r,e)=>r in t?pe(t,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[r]=e,Oe=(t,r)=>{for(var e in r||(r={}))Re.call(r,e)&&Ee(t,e,r[e]);if(le)for(var e of le(r))_e.call(r,e)&&Ee(t,e,r[e]);return t},Me=(t,r)=>ct(t,dt(r));var De=t=>typeof t=="symbol"?t:t+"",je=(t,r)=>{var e={};for(var n in t)Re.call(t,n)&&r.indexOf(n)<0&&(e[n]=t[n]);if(t!=null&&le)for(var n of le(t))r.indexOf(n)<0&&_e.call(t,n)&&(e[n]=t[n]);return e};var Ie=(t,r)=>()=>(t&&(r=t(t=0)),r);var $e=(t,r)=>{for(var e in r)pe(t,e,{get:r[e],enumerable:!0})},xt=(t,r,e,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of ht(r))!Re.call(t,i)&&i!==e&&pe(t,i,{get:()=>r[i],enumerable:!(n=mt(r,i))||n.enumerable});return t};var yt=t=>xt(pe({},"__esModule",{value:!0}),t);var p=(t,r,e)=>Ee(t,typeof r!="symbol"?r+"":r,e);function We(){throw new Error("setTimeout has not been defined")}function Ye(){throw new Error("clearTimeout has not been defined")}function ze(t){if(C===setTimeout)return setTimeout(t,0);if((C===We||!C)&&setTimeout)return C=setTimeout,setTimeout(t,0);try{return C(t,0)}catch(r){try{return C.call(null,t,0)}catch(e){return C.call(this,t,0)}}}function gt(t){if(F===clearTimeout)return clearTimeout(t);if((F===Ye||!F)&&clearTimeout)return F=clearTimeout,clearTimeout(t);try{return F(t)}catch(r){try{return F.call(null,t)}catch(e){return F.call(this,t)}}}function wt(){!G||!O||(G=!1,O.length?S=O.concat(S):ce=-1,S.length&&Ge())}function Ge(){if(!G){var t=ze(wt);G=!0;for(var r=S.length;r;){for(O=S,S=[];++ce<r;)O&&O[ce].run();ce=-1,r=S.length}O=null,G=!1,gt(t)}}function vt(t){var r=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)r[e-1]=arguments[e];S.push(new qe(t,r)),S.length===1&&!G&&ze(Ge)}function qe(t,r){this.fun=t,this.array=r}function M(){}function Ot(t){throw new Error("process.binding is not supported")}function Mt(){return"/"}function Dt(t){throw new Error("process.chdir is not supported")}function jt(){return 0}function Vt(t){var r=$t.call(z)*.001,e=Math.floor(r),n=Math.floor(r%1*1e9);return t&&(e=e-t[0],n=n-t[1],n<0&&(e--,n+=1e9)),[e,n]}function Yt(){var t=new Date,r=t-Wt;return r/1e3}var C,F,S,G,O,ce,bt,Tt,At,Et,Rt,It,Nt,St,Lt,Ut,kt,Ct,Ft,Pt,Bt,_t,z,$t,Wt,c,Ve,u=Ie(()=>{"use strict";C=We,F=Ye;typeof globalThis.setTimeout=="function"&&(C=setTimeout);typeof globalThis.clearTimeout=="function"&&(F=clearTimeout);S=[],G=!1,ce=-1;qe.prototype.run=function(){this.fun.apply(null,this.array)};bt="browser",Tt="browser",At=!0,Et={},Rt=[],It="",Nt={},St={},Lt={};Ut=M,kt=M,Ct=M,Ft=M,Pt=M,Bt=M,_t=M;z=globalThis.performance||{},$t=z.now||z.mozNow||z.msNow||z.oNow||z.webkitNow||function(){return new Date().getTime()};Wt=new Date;c={nextTick:vt,title:bt,browser:At,env:Et,argv:Rt,version:It,versions:Nt,on:Ut,addListener:kt,once:Ct,off:Ft,removeListener:Pt,removeAllListeners:Bt,emit:_t,binding:Ot,cwd:Mt,chdir:Dt,umask:jt,hrtime:Vt,platform:Tt,release:St,config:Lt,uptime:Yt},Ve={};Object.keys(Ve).forEach(t=>{let r=t.split("."),e=c;for(let n=0;n<r.length;n++){let i=r[n];n===r.length-1?e[i]=Ve[t]:e=e[i]||(e[i]={})}})});function Ke(){Se=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)I[r]=t[r],R[t.charCodeAt(r)]=r;R[45]=62,R[95]=63}function Gt(t){Se||Ke();var r,e,n,i,o,a,l=t.length;if(l%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=t[l-2]==="="?2:t[l-1]==="="?1:0,a=new zt(l*3/4-o),n=o>0?l-4:l;var m=0;for(r=0,e=0;r<n;r+=4,e+=3)i=R[t.charCodeAt(r)]<<18|R[t.charCodeAt(r+1)]<<12|R[t.charCodeAt(r+2)]<<6|R[t.charCodeAt(r+3)],a[m++]=i>>16&255,a[m++]=i>>8&255,a[m++]=i&255;return o===2?(i=R[t.charCodeAt(r)]<<2|R[t.charCodeAt(r+1)]>>4,a[m++]=i&255):o===1&&(i=R[t.charCodeAt(r)]<<10|R[t.charCodeAt(r+1)]<<4|R[t.charCodeAt(r+2)]>>2,a[m++]=i>>8&255,a[m++]=i&255),a}function qt(t){return I[t>>18&63]+I[t>>12&63]+I[t>>6&63]+I[t&63]}function Ht(t,r,e){for(var n,i=[],o=r;o<e;o+=3)n=(t[o]<<16)+(t[o+1]<<8)+t[o+2],i.push(qt(n));return i.join("")}function He(t){Se||Ke();for(var r,e=t.length,n=e%3,i="",o=[],a=16383,l=0,m=e-n;l<m;l+=a)o.push(Ht(t,l,l+a>m?m:l+a));return n===1?(r=t[e-1],i+=I[r>>2],i+=I[r<<4&63],i+="=="):n===2&&(r=(t[e-2]<<8)+t[e-1],i+=I[r>>10],i+=I[r>>4&63],i+=I[r<<2&63],i+="="),o.push(i),o.join("")}function me(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function L(t,r){if(me()<r)throw new RangeError("Invalid typed array length");return s.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r),t.__proto__=s.prototype):(t===null&&(t=new s(r)),t.length=r),t}function s(t,r,e){if(!s.TYPED_ARRAY_SUPPORT&&!(this instanceof s))return new s(t,r,e);if(typeof t=="number"){if(typeof r=="string")throw new Error("If encoding is specified then the first argument must be a string");return Le(this,t)}return Xe(this,t,r,e)}function Xe(t,r,e,n){if(typeof r=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer!="undefined"&&r instanceof ArrayBuffer?Kt(t,r,e,n):typeof r=="string"?Jt(t,r,e):Xt(t,r)}function Qe(t){if(typeof t!="number")throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function Zt(t,r,e,n){return Qe(r),r<=0?L(t,r):e!==void 0?typeof n=="string"?L(t,r).fill(e,n):L(t,r).fill(e):L(t,r)}function Le(t,r){if(Qe(r),t=L(t,r<0?0:Ue(r)|0),!s.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}function Jt(t,r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!s.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=er(r,e)|0;t=L(t,n);var i=t.write(r,e);return i!==n&&(t=t.slice(0,i)),t}function Ne(t,r){var e=r.length<0?0:Ue(r.length)|0;t=L(t,e);for(var n=0;n<e;n+=1)t[n]=r[n]&255;return t}function Kt(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");return e===void 0&&n===void 0?r=new Uint8Array(r):n===void 0?r=new Uint8Array(r,e):r=new Uint8Array(r,e,n),s.TYPED_ARRAY_SUPPORT?(t=r,t.__proto__=s.prototype):t=Ne(t,r),t}function Xt(t,r){if(N(r)){var e=Ue(r.length)|0;return t=L(t,e),t.length===0||r.copy(t,0,0,e),t}if(r){if(typeof ArrayBuffer!="undefined"&&r.buffer instanceof ArrayBuffer||"length"in r)return typeof r.length!="number"||gn(r.length)?L(t,0):Ne(t,r);if(r.type==="Buffer"&&Array.isArray(r.data))return Ne(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function Ue(t){if(t>=me())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+me().toString(16)+" bytes");return t|0}function N(t){return!!(t!=null&&t._isBuffer)}function er(t,r){if(N(t))return t.length;if(typeof ArrayBuffer!="undefined"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var e=t.length;if(e===0)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return de(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return sr(t).length;default:if(n)return de(t).length;r=(""+r).toLowerCase(),n=!0}}function Qt(t,r,e){var n=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,r>>>=0,e<=r))return"";for(t||(t="utf8");;)switch(t){case"hex":return ln(this,r,e);case"utf8":case"utf-8":return nr(this,r,e);case"ascii":return un(this,r,e);case"latin1":case"binary":return fn(this,r,e);case"base64":return an(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return pn(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function D(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function rr(t,r,e,n,i){if(t.length===0)return-1;if(typeof e=="string"?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(i)return-1;e=t.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof r=="string"&&(r=s.from(r,n)),N(r))return r.length===0?-1:Ze(t,r,e,n,i);if(typeof r=="number")return r=r&255,s.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):Ze(t,[r],e,n,i);throw new TypeError("val must be string, number or Buffer")}function Ze(t,r,e,n,i){var o=1,a=t.length,l=r.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||r.length<2)return-1;o=2,a/=2,l/=2,e/=2}function m(E,Y){return o===1?E[Y]:E.readUInt16BE(Y*o)}var h;if(i){var y=-1;for(h=e;h<a;h++)if(m(t,h)===m(r,y===-1?0:h-y)){if(y===-1&&(y=h),h-y+1===l)return y*o}else y!==-1&&(h-=h-y),y=-1}else for(e+l>a&&(e=a-l),h=e;h>=0;h--){for(var x=!0,v=0;v<l;v++)if(m(t,h+v)!==m(r,v)){x=!1;break}if(x)return h}return-1}function en(t,r,e,n){e=Number(e)||0;var i=t.length-e;n?(n=Number(n),n>i&&(n=i)):n=i;var o=r.length;if(o%2!==0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a<n;++a){var l=parseInt(r.substr(a*2,2),16);if(isNaN(l))return a;t[e+a]=l}return a}function rn(t,r,e,n){return ye(de(r,t.length-e),t,e,n)}function tr(t,r,e,n){return ye(xn(r),t,e,n)}function tn(t,r,e,n){return tr(t,r,e,n)}function nn(t,r,e,n){return ye(sr(r),t,e,n)}function on(t,r,e,n){return ye(yn(r,t.length-e),t,e,n)}function an(t,r,e){return r===0&&e===t.length?He(t):He(t.slice(r,e))}function nr(t,r,e){e=Math.min(t.length,e);for(var n=[],i=r;i<e;){var o=t[i],a=null,l=o>239?4:o>223?3:o>191?2:1;if(i+l<=e){var m,h,y,x;switch(l){case 1:o<128&&(a=o);break;case 2:m=t[i+1],(m&192)===128&&(x=(o&31)<<6|m&63,x>127&&(a=x));break;case 3:m=t[i+1],h=t[i+2],(m&192)===128&&(h&192)===128&&(x=(o&15)<<12|(m&63)<<6|h&63,x>2047&&(x<55296||x>57343)&&(a=x));break;case 4:m=t[i+1],h=t[i+2],y=t[i+3],(m&192)===128&&(h&192)===128&&(y&192)===128&&(x=(o&15)<<18|(m&63)<<12|(h&63)<<6|y&63,x>65535&&x<1114112&&(a=x))}}a===null?(a=65533,l=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),i+=l}return sn(n)}function sn(t){var r=t.length;if(r<=Je)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=Je));return e}function un(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(t[i]&127);return n}function fn(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(t[i]);return n}function ln(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var i="",o=r;o<e;++o)i+=hn(t[o]);return i}function pn(t,r,e){for(var n=t.slice(r,e),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+n[o+1]*256);return i}function T(t,r,e){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}function A(t,r,e,n,i,o){if(!N(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||r<o)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}function he(t,r,e,n){r<0&&(r=65535+r+1);for(var i=0,o=Math.min(t.length-e,2);i<o;++i)t[e+i]=(r&255<<8*(n?i:1-i))>>>(n?i:1-i)*8}function xe(t,r,e,n){r<0&&(r=4294967295+r+1);for(var i=0,o=Math.min(t.length-e,4);i<o;++i)t[e+i]=r>>>(n?i:3-i)*8&255}function ir(t,r,e,n,i,o){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function or(t,r,e,n,i){return i||ir(t,r,e,4,34028234663852886e22,-34028234663852886e22),fr(t,r,e,n,23,4),e+4}function ar(t,r,e,n,i){return i||ir(t,r,e,8,17976931348623157e292,-17976931348623157e292),fr(t,r,e,n,52,8),e+8}function mn(t){if(t=dn(t).replace(cn,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function dn(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function hn(t){return t<16?"0"+t.toString(16):t.toString(16)}function de(t,r){r=r||1/0;for(var e,n=t.length,i=null,o=[],a=0;a<n;++a){if(e=t.charCodeAt(a),e>55295&&e<57344){if(!i){if(e>56319){(r-=3)>-1&&o.push(239,191,189);continue}else if(a+1===n){(r-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(r-=3)>-1&&o.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(r-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((r-=1)<0)break;o.push(e)}else if(e<2048){if((r-=2)<0)break;o.push(e>>6|192,e&63|128)}else if(e<65536){if((r-=3)<0)break;o.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((r-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return o}function xn(t){for(var r=[],e=0;e<t.length;++e)r.push(t.charCodeAt(e)&255);return r}function yn(t,r){for(var e,n,i,o=[],a=0;a<t.length&&!((r-=2)<0);++a)e=t.charCodeAt(a),n=e>>8,i=e%256,o.push(i),o.push(n);return o}function sr(t){return Gt(mn(t))}function ye(t,r,e,n){for(var i=0;i<n&&!(i+e>=r.length||i>=t.length);++i)r[i+e]=t[i];return i}function gn(t){return t!==t}function wn(t){return t!=null&&(!!t._isBuffer||ur(t)||vn(t))}function ur(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function vn(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&ur(t.slice(0,0))}function ge(t,r,e,n,i){var o,a,l=i*8-n-1,m=(1<<l)-1,h=m>>1,y=-7,x=e?i-1:0,v=e?-1:1,E=t[r+x];for(x+=v,o=E&(1<<-y)-1,E>>=-y,y+=l;y>0;o=o*256+t[r+x],x+=v,y-=8);for(a=o&(1<<-y)-1,o>>=-y,y+=n;y>0;a=a*256+t[r+x],x+=v,y-=8);if(o===0)o=1-h;else{if(o===m)return a?NaN:(E?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-h}return(E?-1:1)*a*Math.pow(2,o-n)}function fr(t,r,e,n,i,o){var a,l,m,h=o*8-i-1,y=(1<<h)-1,x=y>>1,v=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=n?0:o-1,Y=n?1:-1,pt=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(l=isNaN(r)?1:0,a=y):(a=Math.floor(Math.log(r)/Math.LN2),r*(m=Math.pow(2,-a))<1&&(a--,m*=2),a+x>=1?r+=v/m:r+=v*Math.pow(2,1-x),r*m>=2&&(a++,m/=2),a+x>=y?(l=0,a=y):a+x>=1?(l=(r*m-1)*Math.pow(2,i),a=a+x):(l=r*Math.pow(2,x-1)*Math.pow(2,i),a=0));i>=8;t[e+E]=l&255,E+=Y,l/=256,i-=8);for(a=a<<i|l,h+=i;h>0;t[e+E]=a&255,E+=Y,a/=256,h-=8);t[e+E-Y]|=pt*128}var I,R,zt,Se,Je,cn,lr=Ie(()=>{"use strict";u();f();I=[],R=[],zt=typeof Uint8Array!="undefined"?Uint8Array:Array,Se=!1;s.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;s.poolSize=8192;s._augment=function(t){return t.__proto__=s.prototype,t};s.from=function(t,r,e){return Xe(null,t,r,e)};s.kMaxLength=me();s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&s[Symbol.species]);s.alloc=function(t,r,e){return Zt(null,t,r,e)};s.allocUnsafe=function(t){return Le(null,t)};s.allocUnsafeSlow=function(t){return Le(null,t)};s.isBuffer=wn;s.compare=function(r,e){if(!N(r)||!N(e))throw new TypeError("Arguments must be Buffers");if(r===e)return 0;for(var n=r.length,i=e.length,o=0,a=Math.min(n,i);o<a;++o)if(r[o]!==e[o]){n=r[o],i=e[o];break}return n<i?-1:i<n?1:0};s.isEncoding=function(r){switch(String(r).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};s.concat=function(r,e){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return s.alloc(0);var n;if(e===void 0)for(e=0,n=0;n<r.length;++n)e+=r[n].length;var i=s.allocUnsafe(e),o=0;for(n=0;n<r.length;++n){var a=r[n];if(!N(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(i,o),o+=a.length}return i};s.byteLength=er;s.prototype._isBuffer=!0;s.prototype.swap16=function(){var r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<r;e+=2)D(this,e,e+1);return this};s.prototype.swap32=function(){var r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<r;e+=4)D(this,e,e+3),D(this,e+1,e+2);return this};s.prototype.swap64=function(){var r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<r;e+=8)D(this,e,e+7),D(this,e+1,e+6),D(this,e+2,e+5),D(this,e+3,e+4);return this};s.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?nr(this,0,r):Qt.apply(this,arguments)};s.prototype.equals=function(r){if(!N(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:s.compare(this,r)===0};s.prototype.compare=function(r,e,n,i,o){if(!N(r))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),n===void 0&&(n=r?r.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),e<0||n>r.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&e>=n)return 0;if(i>=o)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,i>>>=0,o>>>=0,this===r)return 0;for(var a=o-i,l=n-e,m=Math.min(a,l),h=this.slice(i,o),y=r.slice(e,n),x=0;x<m;++x)if(h[x]!==y[x]){a=h[x],l=y[x];break}return a<l?-1:l<a?1:0};s.prototype.includes=function(r,e,n){return this.indexOf(r,e,n)!==-1};s.prototype.indexOf=function(r,e,n){return rr(this,r,e,n,!0)};s.prototype.lastIndexOf=function(r,e,n){return rr(this,r,e,n,!1)};s.prototype.write=function(r,e,n,i){if(e===void 0)i="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")i=e,n=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(n)?(n=n|0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o=this.length-e;if((n===void 0||n>o)&&(n=o),r.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return en(this,r,e,n);case"utf8":case"utf-8":return rn(this,r,e,n);case"ascii":return tr(this,r,e,n);case"latin1":case"binary":return tn(this,r,e,n);case"base64":return nn(this,r,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return on(this,r,e,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}};s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};Je=4096;s.prototype.slice=function(r,e){var n=this.length;r=~~r,e=e===void 0?n:~~e,r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e<r&&(e=r);var i;if(s.TYPED_ARRAY_SUPPORT)i=this.subarray(r,e),i.__proto__=s.prototype;else{var o=e-r;i=new s(o,void 0);for(var a=0;a<o;++a)i[a]=this[a+r]}return i};s.prototype.readUIntLE=function(r,e,n){r=r|0,e=e|0,n||T(r,e,this.length);for(var i=this[r],o=1,a=0;++a<e&&(o*=256);)i+=this[r+a]*o;return i};s.prototype.readUIntBE=function(r,e,n){r=r|0,e=e|0,n||T(r,e,this.length);for(var i=this[r+--e],o=1;e>0&&(o*=256);)i+=this[r+--e]*o;return i};s.prototype.readUInt8=function(r,e){return e||T(r,1,this.length),this[r]};s.prototype.readUInt16LE=function(r,e){return e||T(r,2,this.length),this[r]|this[r+1]<<8};s.prototype.readUInt16BE=function(r,e){return e||T(r,2,this.length),this[r]<<8|this[r+1]};s.prototype.readUInt32LE=function(r,e){return e||T(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};s.prototype.readUInt32BE=function(r,e){return e||T(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};s.prototype.readIntLE=function(r,e,n){r=r|0,e=e|0,n||T(r,e,this.length);for(var i=this[r],o=1,a=0;++a<e&&(o*=256);)i+=this[r+a]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i};s.prototype.readIntBE=function(r,e,n){r=r|0,e=e|0,n||T(r,e,this.length);for(var i=e,o=1,a=this[r+--i];i>0&&(o*=256);)a+=this[r+--i]*o;return o*=128,a>=o&&(a-=Math.pow(2,8*e)),a};s.prototype.readInt8=function(r,e){return e||T(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};s.prototype.readInt16LE=function(r,e){e||T(r,2,this.length);var n=this[r]|this[r+1]<<8;return n&32768?n|4294901760:n};s.prototype.readInt16BE=function(r,e){e||T(r,2,this.length);var n=this[r+1]|this[r]<<8;return n&32768?n|4294901760:n};s.prototype.readInt32LE=function(r,e){return e||T(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};s.prototype.readInt32BE=function(r,e){return e||T(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};s.prototype.readFloatLE=function(r,e){return e||T(r,4,this.length),ge(this,r,!0,23,4)};s.prototype.readFloatBE=function(r,e){return e||T(r,4,this.length),ge(this,r,!1,23,4)};s.prototype.readDoubleLE=function(r,e){return e||T(r,8,this.length),ge(this,r,!0,52,8)};s.prototype.readDoubleBE=function(r,e){return e||T(r,8,this.length),ge(this,r,!1,52,8)};s.prototype.writeUIntLE=function(r,e,n,i){if(r=+r,e=e|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;A(this,r,e,n,o,0)}var a=1,l=0;for(this[e]=r&255;++l<n&&(a*=256);)this[e+l]=r/a&255;return e+n};s.prototype.writeUIntBE=function(r,e,n,i){if(r=+r,e=e|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;A(this,r,e,n,o,0)}var a=n-1,l=1;for(this[e+a]=r&255;--a>=0&&(l*=256);)this[e+a]=r/l&255;return e+n};s.prototype.writeUInt8=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,1,255,0),s.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[e]=r&255,e+1};s.prototype.writeUInt16LE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):he(this,r,e,!0),e+2};s.prototype.writeUInt16BE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):he(this,r,e,!1),e+2};s.prototype.writeUInt32LE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e+3]=r>>>24,this[e+2]=r>>>16,this[e+1]=r>>>8,this[e]=r&255):xe(this,r,e,!0),e+4};s.prototype.writeUInt32BE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):xe(this,r,e,!1),e+4};s.prototype.writeIntLE=function(r,e,n,i){if(r=+r,e=e|0,!i){var o=Math.pow(2,8*n-1);A(this,r,e,n,o-1,-o)}var a=0,l=1,m=0;for(this[e]=r&255;++a<n&&(l*=256);)r<0&&m===0&&this[e+a-1]!==0&&(m=1),this[e+a]=(r/l>>0)-m&255;return e+n};s.prototype.writeIntBE=function(r,e,n,i){if(r=+r,e=e|0,!i){var o=Math.pow(2,8*n-1);A(this,r,e,n,o-1,-o)}var a=n-1,l=1,m=0;for(this[e+a]=r&255;--a>=0&&(l*=256);)r<0&&m===0&&this[e+a+1]!==0&&(m=1),this[e+a]=(r/l>>0)-m&255;return e+n};s.prototype.writeInt8=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,1,127,-128),s.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),r<0&&(r=255+r+1),this[e]=r&255,e+1};s.prototype.writeInt16LE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):he(this,r,e,!0),e+2};s.prototype.writeInt16BE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):he(this,r,e,!1),e+2};s.prototype.writeInt32LE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8,this[e+2]=r>>>16,this[e+3]=r>>>24):xe(this,r,e,!0),e+4};s.prototype.writeInt32BE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),s.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):xe(this,r,e,!1),e+4};s.prototype.writeFloatLE=function(r,e,n){return or(this,r,e,!0,n)};s.prototype.writeFloatBE=function(r,e,n){return or(this,r,e,!1,n)};s.prototype.writeDoubleLE=function(r,e,n){return ar(this,r,e,!0,n)};s.prototype.writeDoubleBE=function(r,e,n){return ar(this,r,e,!1,n)};s.prototype.copy=function(r,e,n,i){if(n||(n=0),!i&&i!==0&&(i=this.length),e>=r.length&&(e=r.length),e||(e=0),i>0&&i<n&&(i=n),i===n||r.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),r.length-e<i-n&&(i=r.length-e+n);var o=i-n,a;if(this===r&&n<e&&e<i)for(a=o-1;a>=0;--a)r[a+e]=this[a+n];else if(o<1e3||!s.TYPED_ARRAY_SUPPORT)for(a=0;a<o;++a)r[a+e]=this[a+n];else Uint8Array.prototype.set.call(r,this.subarray(n,n+o),e);return o};s.prototype.fill=function(r,e,n,i){if(typeof r=="string"){if(typeof e=="string"?(i=e,e=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),r.length===1){var o=r.charCodeAt(0);o<256&&(r=o)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!s.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof r=="number"&&(r=r&255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e=e>>>0,n=n===void 0?this.length:n>>>0,r||(r=0);var a;if(typeof r=="number")for(a=e;a<n;++a)this[a]=r;else{var l=N(r)?r:de(new s(r,i).toString()),m=l.length;for(a=0;a<n-e;++a)this[a+e]=l[a%m]}return this};cn=/[^+\/0-9A-Za-z-_]/g});var f=Ie(()=>{"use strict";lr()});var To={};$e(To,{DynamicSnippetsGeneratorContext:()=>Be});module.exports=yt(To);u();f();u();f();u();f();function b(t){throw new Error("Unexpected value: "+JSON.stringify(t))}u();f();function te(t){return Object.keys(t)}u();f();u();f();u();f();u();f();u();f();u();f();var bn=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis,pr=bn;var Tn=typeof self=="object"&&self&&self.Object===Object&&self,An=pr||Tn||Function("return this")(),cr=An;var En=cr.Symbol,U=En;u();f();var mr=Object.prototype,Rn=mr.hasOwnProperty,In=mr.toString,ne=U?U.toStringTag:void 0;function Nn(t){var r=Rn.call(t,ne),e=t[ne];try{t[ne]=void 0;var n=!0}catch(o){}var i=In.call(t);return n&&(r?t[ne]=e:delete t[ne]),i}var dr=Nn;u();f();var Sn=Object.prototype,Ln=Sn.toString;function Un(t){return Ln.call(t)}var hr=Un;var kn="[object Null]",Cn="[object Undefined]",xr=U?U.toStringTag:void 0;function Fn(t){return t==null?t===void 0?Cn:kn:xr&&xr in Object(t)?dr(t):hr(t)}var yr=Fn;u();f();function Pn(t){return t!=null&&typeof t=="object"}var gr=Pn;var Bn="[object Symbol]";function _n(t){return typeof t=="symbol"||gr(t)&&yr(t)==Bn}var wr=_n;u();f();u();f();function On(t,r){for(var e=-1,n=t==null?0:t.length,i=Array(n);++e<n;)i[e]=r(t[e],e,t);return i}var vr=On;u();f();var Mn=Array.isArray,br=Mn;var Dn=1/0,Tr=U?U.prototype:void 0,Ar=Tr?Tr.toString:void 0;function Er(t){if(typeof t=="string")return t;if(br(t))return vr(t,Er)+"";if(wr(t))return Ar?Ar.call(t):"";var r=t+"";return r=="0"&&1/t==-Dn?"-0":r}var Rr=Er;u();f();function jn(t){return t==null?"":Rr(t)}var P=jn;u();f();u();f();u();f();u();f();u();f();u();f();function $n(t,r,e){var n=-1,i=t.length;r<0&&(r=-r>i?0:i+r),e=e>i?i:e,e<0&&(e+=i),i=r>e?0:e-r>>>0,r>>>=0;for(var o=Array(i);++n<i;)o[n]=t[n+r];return o}var Ir=$n;function Vn(t,r,e){var n=t.length;return e=e===void 0?n:e,!r&&e>=n?t:Ir(t,r,e)}var Nr=Vn;u();f();var Wn="\\ud800-\\udfff",Yn="\\u0300-\\u036f",zn="\\ufe20-\\ufe2f",Gn="\\u20d0-\\u20ff",qn=Yn+zn+Gn,Hn="\\ufe0e\\ufe0f",Zn="\\u200d",Jn=RegExp("["+Zn+Wn+qn+Hn+"]");function Kn(t){return Jn.test(t)}var we=Kn;u();f();u();f();function Xn(t){return t.split("")}var Sr=Xn;u();f();var Lr="\\ud800-\\udfff",Qn="\\u0300-\\u036f",ei="\\ufe20-\\ufe2f",ri="\\u20d0-\\u20ff",ti=Qn+ei+ri,ni="\\ufe0e\\ufe0f",ii="["+Lr+"]",ke="["+ti+"]",Ce="\\ud83c[\\udffb-\\udfff]",oi="(?:"+ke+"|"+Ce+")",Ur="[^"+Lr+"]",kr="(?:\\ud83c[\\udde6-\\uddff]){2}",Cr="[\\ud800-\\udbff][\\udc00-\\udfff]",ai="\\u200d",Fr=oi+"?",Pr="["+ni+"]?",si="(?:"+ai+"(?:"+[Ur,kr,Cr].join("|")+")"+Pr+Fr+")*",ui=Pr+Fr+si,fi="(?:"+[Ur+ke+"?",ke,kr,Cr,ii].join("|")+")",li=RegExp(Ce+"(?="+Ce+")|"+fi+ui,"g");function pi(t){return t.match(li)||[]}var Br=pi;function ci(t){return we(t)?Br(t):Sr(t)}var _r=ci;function mi(t){return function(r){r=P(r);var e=we(r)?_r(r):void 0,n=e?e[0]:r.charAt(0),i=e?Nr(e,1).join(""):r.slice(1);return n[t]()+i}}var Or=mi;var di=Or("toUpperCase"),q=di;function hi(t){return q(P(t).toLowerCase())}var Mr=hi;u();f();u();f();function xi(t,r,e,n){var i=-1,o=t==null?0:t.length;for(n&&o&&(e=t[++i]);++i<o;)e=r(e,t[i],i,t);return e}var Dr=xi;u();f();u();f();u();f();function yi(t){return function(r){return t==null?void 0:t[r]}}var jr=yi;var gi={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},wi=jr(gi),$r=wi;var vi=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,bi="\\u0300-\\u036f",Ti="\\ufe20-\\ufe2f",Ai="\\u20d0-\\u20ff",Ei=bi+Ti+Ai,Ri="["+Ei+"]",Ii=RegExp(Ri,"g");function Ni(t){return t=P(t),t&&t.replace(vi,$r).replace(Ii,"")}var Vr=Ni;u();f();u();f();var Si=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Li(t){return t.match(Si)||[]}var Wr=Li;u();f();var Ui=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function ki(t){return Ui.test(t)}var Yr=ki;u();f();var Zr="\\ud800-\\udfff",Ci="\\u0300-\\u036f",Fi="\\ufe20-\\ufe2f",Pi="\\u20d0-\\u20ff",Bi=Ci+Fi+Pi,Jr="\\u2700-\\u27bf",Kr="a-z\\xdf-\\xf6\\xf8-\\xff",_i="\\xac\\xb1\\xd7\\xf7",Oi="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Mi="\\u2000-\\u206f",Di=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Xr="A-Z\\xc0-\\xd6\\xd8-\\xde",ji="\\ufe0e\\ufe0f",Qr=_i+Oi+Mi+Di,et="['\u2019]",zr="["+Qr+"]",$i="["+Bi+"]",rt="\\d+",Vi="["+Jr+"]",tt="["+Kr+"]",nt="[^"+Zr+Qr+rt+Jr+Kr+Xr+"]",Wi="\\ud83c[\\udffb-\\udfff]",Yi="(?:"+$i+"|"+Wi+")",zi="[^"+Zr+"]",it="(?:\\ud83c[\\udde6-\\uddff]){2}",ot="[\\ud800-\\udbff][\\udc00-\\udfff]",H="["+Xr+"]",Gi="\\u200d",Gr="(?:"+tt+"|"+nt+")",qi="(?:"+H+"|"+nt+")",qr="(?:"+et+"(?:d|ll|m|re|s|t|ve))?",Hr="(?:"+et+"(?:D|LL|M|RE|S|T|VE))?",at=Yi+"?",st="["+ji+"]?",Hi="(?:"+Gi+"(?:"+[zi,it,ot].join("|")+")"+st+at+")*",Zi="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ji="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Ki=st+at+Hi,Xi="(?:"+[Vi,it,ot].join("|")+")"+Ki,Qi=RegExp([H+"?"+tt+"+"+qr+"(?="+[zr,H,"$"].join("|")+")",qi+"+"+Hr+"(?="+[zr,H+Gr,"$"].join("|")+")",H+"?"+Gr+"+"+qr,H+"+"+Hr,Ji,Zi,rt,Xi].join("|"),"g");function eo(t){return t.match(Qi)||[]}var ut=eo;function ro(t,r,e){return t=P(t),r=e?void 0:r,r===void 0?Yr(t)?ut(t):Wr(t):t.match(r)||[]}var ft=ro;var to="['\u2019]",no=RegExp(to,"g");function io(t){return function(r){return Dr(ft(Vr(r).replace(no,"")),t,"")}}var lt=io;var oo=lt(function(t,r,e){return r=r.toLowerCase(),t+(e?Mr(r):r)}),ve=oo;u();f();u();f();var j=class{};u();f();u();f();var B=class extends j{constructor(e){super();p(this,"value");this.value=e}write(e){typeof this.value=="string"?e.write(this.value):this.value(e)}};var ao=4,ie=class{constructor(){p(this,"buffer","");p(this,"indentLevel",0);p(this,"hasWrittenAnything",!1);p(this,"lastCharacterIsNewline",!1)}write(r){let e=r.length>0&&r.endsWith(`
|
|
2
|
+
`),n=e?r.substring(0,r.length-1):r,i=this.getIndentString(),o=n.replaceAll(`
|
|
3
|
+
`,`
|
|
4
|
+
${i}`);this.isAtStartOfLine()&&(o=i+o),e&&(o+=`
|
|
5
|
+
`),this.writeInternal(o)}writeNoIndent(r){let e=this.indentLevel;this.indentLevel=0,this.write(r),this.indentLevel=e}writeNode(r){r.write(this)}writeNodeStatement(r){r.write(this),this.write(";"),this.writeNewLineIfLastLineNot()}writeTextStatement(r){new B(r).write(this),this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(r,e){new B(r).write(this),this.write(" ("),this.writeNode(e),this.write(") {"),this.writeNewLineIfLastLineNot(),this.indent()}endControlFlow(){this.dedent(),this.writeLine("}")}openBlock(r,e="{",n,i="}"){let o=r.filter(a=>a!==void 0).join(" ");o?this.write(`${o} ${e!=null?e:""}`):this.write(e!=null?e:"");try{this.indent(),n(),this.dedent()}finally{this.write(i!=null?i:"")}}writeLine(r=""){this.write(r),this.writeNewLineIfLastLineNot()}newLine(){this.writeInternal(`
|
|
6
|
+
`)}writeNewLineIfLastLineNot(){this.lastCharacterIsNewline||this.writeInternal(`
|
|
7
|
+
`)}indent(){this.indentLevel++}dedent(){this.indentLevel--}delimit({nodes:r,delimiter:e,writeFunction:n}){if(r.length>0){let i=r[0];i!=null&&n(i);for(let o=1;o<r.length;o++){this.write(e);let a=r[o];a!=null&&n(a)}}}toString(){return this.buffer}writeInternal(r){return r.length>0&&(this.hasWrittenAnything=!0,this.lastCharacterIsNewline=r.endsWith(`
|
|
8
|
+
`)),this.buffer+=r}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*ao)}};u();f();var be=class{},oe=class extends be{async format(r){return r}formatSync(r){return r}};u();f();u();f();u();f();u();f();var ae=class{constructor(){p(this,"REFERENCE_REGEX",/^(GET|POST|PUT|DELETE|PATCH)\s(\/[a-zA-Z0-9\/{}_-]*)$/)}validate(r){return this.REFERENCE_REGEX.test(r)?{type:"valid"}:{type:"invalid"}}tryParse(r){if(this.validate(r).type==="invalid")return;let n=r.match(this.REFERENCE_REGEX);if(!(n==null||n[1]==null||n[2]==null))return{method:n[1],path:n[2]}}};u();f();var g={Critical:"CRITICAL",Warning:"WARNING"},se=class t{constructor(){p(this,"errors");p(this,"path");this.errors=[],this.path=[]}add(r){this.errors.push(Me(Oe({},r),{path:[...this.path]}))}scope(r){this.path.push(r)}unscope(){this.path.pop()}getBySeverity(r){return this.errors.filter(e=>e.severity===r)}empty(){return this.errors.length===0}size(){return this.errors.length}clone(){let r=new t;return r.errors=[...this.errors],r.path=[...this.path],r}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(r=>({severity:r.severity,path:r.path!=null?this.pathToStringArray(r.path):void 0,message:r.message}))}pathToStringArray(r){let e=[];for(let n of r){if(typeof n=="string"){e.push(n);continue}e[e.length-1]+=`[${n.index}]`}return e}};var ue=class{constructor({ir:r,config:e}){p(this,"config");p(this,"errors");p(this,"_ir");p(this,"httpEndpointReferenceParser");this._ir=r,this.config=e,this.errors=new se,this.httpEndpointReferenceParser=new ae}associateQueryParametersByWireValue({parameters:r,values:e}){let n=[];for(let[i,o]of Object.entries(e)){this.errors.scope(i);try{let a=r.find(m=>m.name.wireValue===i);if(a==null)throw this.newParameterNotRecognizedError(i);let l=this.isListTypeReference(a.typeReference)&&!Array.isArray(o)?[o]:o;n.push({name:a.name,typeReference:a.typeReference,value:l})}finally{this.errors.unscope()}}return n}associateByWireValue({parameters:r,values:e,ignoreMissingParameters:n}){let i=[];for(let[o,a]of Object.entries(e)){this.errors.scope(o);try{let l=r.find(m=>m.name.wireValue===o);if(l==null){if(n)continue;this.errors.add({severity:g.Critical,message:this.newParameterNotRecognizedError(o).message});continue}i.push({name:l.name,typeReference:l.typeReference,value:a})}finally{this.errors.unscope()}}return i}getSingleFileValue({property:r,record:e}){let n=e[r.wireValue];if(n!=null){if(typeof n!="string"){this.errors.add({severity:g.Critical,message:`Expected file value to be a string, got ${typeof n}`});return}return n}}getFileArrayValues({property:r,record:e}){let n=e[r.wireValue];if(n==null)return;if(!Array.isArray(n)){this.errors.add({severity:g.Critical,message:`Expected file array value to be an array of strings, got ${typeof n}`});return}let i=[];for(let o of n){if(typeof o!="string"){this.errors.add({severity:g.Critical,message:`Expected file array value to be an array of strings, got ${typeof o}`});return}i.push(o)}return i}getRecord(r){if(typeof r!="object"||Array.isArray(r)){this.errors.add({severity:g.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(r)?"array":typeof r}`});return}return r==null?{}:r}resolveNamedType({typeId:r}){let e=this._ir.types[r];if(e==null){this.errors.add({severity:g.Critical,message:`Type identified by "${r}" could not be found`});return}return e}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:r,value:e}){let n=this.getRecord(e);if(n==null)return;let i=r.discriminant.wireValue,o=n[i];if(o==null){this.errors.add({severity:g.Critical,message:this.newParameterNotRecognizedError(i).message});return}if(typeof o!="string"){this.errors.add({severity:g.Critical,message:`Expected discriminant value to be a string but got: ${typeof o}`});return}let a=r.types[o];if(a==null){this.errors.add({severity:g.Critical,message:`No type found for discriminant value "${o}"`});return}let h=n,{[i]:l}=h,m=je(h,[De(i)]);return{singleDiscriminatedUnionType:a,discriminantValue:a.discriminantValue,value:m}}resolveEndpointOrThrow(r){let e=this.httpEndpointReferenceParser.tryParse(r);if(e==null)throw new Error(`Failed to parse endpoint reference "${r}"`);return this.resolveEndpointLocationOrThrow(e)}resolveEndpointLocationOrThrow(r){let e=[];for(let n of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:n,parsedEndpoint:r})&&e.push(n);if(e.length===0)throw new Error(`Failed to find endpoint identified by "${r.method} ${r.path}"`);return e}needsRequestParameter({request:r,inlinePathParameters:e,inlineFileProperties:n}){var i;return this.includePathParametersInWrappedRequest({request:r,inlinePathParameters:e})||r.queryParameters!=null&&r.queryParameters.length>0||r.headers!=null&&r.headers.length>0?!0:r.body!=null?this.includeRequestBodyInWrappedRequest({body:r.body,inlineFileProperties:n}):!((i=r.metadata)!=null&&i.onlyPathParameters)}includePathParametersInWrappedRequest({request:r,inlinePathParameters:e}){var n,i;return e&&((i=(n=r.metadata)==null?void 0:n.includePathParameters)!=null?i:!1)}isFileUploadRequestBody(r){switch(r.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:b(r)}}resolveEnvironmentName(r){if(this._ir.environments==null)return;let e=this._ir.environments.environments;switch(e.type){case"singleBaseUrl":{let n=e.environments.find(i=>i.id===r);return n==null?void 0:n.name}case"multipleBaseUrls":{let n=e.environments.find(i=>i.id===r);return n==null?void 0:n.name}default:b(e)}}isSingleEnvironmentID(r){return typeof r=="string"}isMultiEnvironmentValues(r){return typeof r=="object"}validateMultiEnvironmentUrlValues(r){if(this._ir.environments==null)return this.errors.add({severity:g.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;let e=this._ir.environments.environments;switch(e.type){case"singleBaseUrl":return this.errors.add({severity:g.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let n=e.environments[0];if(n==null)return this.errors.add({severity:g.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let i=new Set(te(n.urls));for(let o of te(r))i.has(o)&&i.delete(o);return i.size>0?(this.errors.add({severity:g.Critical,message:`The provided environments are invalid; got: [${Object.keys(r).join(", ")}], expected: [${te(n.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:r}){if(typeof r!="number"){this.errors.add({severity:g.Critical,message:this.newTypeMismatchError({expected:"number",value:r}).message});return}return r}getValueAsBoolean({value:r}){if(typeof r!="boolean"){this.errors.add({severity:g.Critical,message:this.newTypeMismatchError({expected:"boolean",value:r}).message});return}return r}getValueAsString({value:r}){if(typeof r!="string"){this.errors.add({severity:g.Critical,message:this.newTypeMismatchError({expected:"string",value:r}).message});return}return r}isOptional(r){switch(r.type){case"nullable":return this.isOptional(r.value);case"optional":return!0;case"named":{let e=this.resolveNamedType({typeId:r.value});return e==null?!1:e.type==="alias"?this.isNullable(e.typeReference):!1}}return!1}isNullable(r){switch(r.type){case"nullable":return!0;case"optional":return this.isNullable(r.value);case"named":{let e=this.resolveNamedType({typeId:r.value});return e==null?!1:e.type==="alias"?this.isNullable(e.typeReference):!1}}return!1}newAuthMismatchError({auth:r,values:e}){return new Error(`Expected auth type ${r.type}, got ${e.type}`)}newParameterNotRecognizedError(r){return new Error(`"${r}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:r,value:e}){return new Error(`Expected ${r}, got ${typeof e}`)}includeRequestBodyInWrappedRequest({body:r,inlineFileProperties:e}){switch(r.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:r,inlineFileProperties:e});default:b(r)}}includeFileUploadBodyInWrappedRequest({fileUpload:r,inlineFileProperties:e}){return this.fileUploadHasBodyProperties({fileUpload:r})||e&&this.fileUploadHasFileProperties({fileUpload:r})}fileUploadHasBodyProperties({fileUpload:r}){return r.properties.some(e=>{switch(e.type){case"file":case"fileArray":return!1;case"bodyProperty":return!0;default:b(e)}})}fileUploadHasFileProperties({fileUpload:r}){return r.properties.some(e=>{switch(e.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:b(e)}})}isListTypeReference(r){return r.type==="optional"?this.isListTypeReference(r.value):r.type==="list"||r.type==="set"}parsedEndpointMatches({endpoint:r,parsedEndpoint:e}){return r.location.method===e.method&&r.location.path===e.path}};u();f();var d={};$e(d,{AstNode:()=>w,ClassInstantiation:()=>re,CodeBlock:()=>Z,Comment:()=>_,Function:()=>X,FunctionInvocation:()=>Q,MethodInvocation:()=>ee,Parameter:()=>K,Reference:()=>W,Type:()=>V,TypeLiteral:()=>k,Types:()=>V,Variable:()=>J,Writer:()=>$,codeblock:()=>po,function_:()=>co,instantiateClass:()=>mo,invokeFunction:()=>ho,invokeMethod:()=>xo,parameter:()=>yo,reference:()=>go,variable:()=>wo});u();f();u();f();u();f();u();f();u();f();u();f();var $=class extends ie{constructor({customConfig:e,formatter:n}){super();p(this,"customConfig");p(this,"formatter");p(this,"imports",{});p(this,"defaultImports",{});p(this,"starImportAliases",{});p(this,"starImportAliasesInverse",{});this.customConfig=e,this.formatter=n!=null?n:new oe}addImport(e){var n,i,o;if(e.importFrom!=null){switch(e.importFrom.type){case"default":{this.validateDefault(e);break}case"named":{this.validateNamed(e);break}case"star":{this.validateStar(e);break}}let a=(o=(n=this.imports)[i=e.importFrom.moduleName])!=null?o:n[i]=[];a.map(m=>m.name).includes(e.name)||a.push(e)}}validateDefault(e){var i,o,a,l;if(((i=e.importFrom)==null?void 0:i.type)!=="default")return;let n=(l=(o=this.defaultImports)[a=e.importFrom.moduleName])!=null?l:o[a]=e;if(n.name!==e.name)throw new Error(`Cannot have multiple default imports for module ${e.importFrom.moduleName}: got ${e.name} but already had ${n.name}`)}validateNamed(e){var a,l,m,h,y;if(((a=e.importFrom)==null?void 0:a.type)!=="named")return;let i=((l=this.imports[e.importFrom.moduleName])!=null?l:[]).filter(x=>{var v;return((v=x.importFrom)==null?void 0:v.type)==="star"});if(i.length>0)throw new Error(`Cannot add named import ${e.name} because non-named imports ${i.map(x=>x.name)} already exist`);let o=[];for(let x of Object.values(this.imports))for(let v of x)((m=v.importFrom)==null?void 0:m.type)==="named"&&v.importFrom.moduleName!==e.importFrom.moduleName&&v.name===e.name&&o.push(v);if(o.length>0)throw new Error(`Cannot add named import from module ${e.importFrom.moduleName} because it is already imported from ${(y=(h=o[0])==null?void 0:h.importFrom)==null?void 0:y.moduleName}`)}validateStar(e){var o,a,l,m,h,y,x;if(((o=e.importFrom)==null?void 0:o.type)!=="star")return;let n=(m=(a=this.starImportAliases)[l=e.importFrom.moduleName])!=null?m:a[l]=e.importFrom.starImportAlias;if(n!==e.importFrom.starImportAlias)throw new Error(`Cannot have more than one alias for non-named imports from a module: got ${e.importFrom.starImportAlias} but already have ${n}.`);if(((x=(h=this.starImportAliasesInverse)[y=e.importFrom.starImportAlias])!=null?x:h[y]=e.importFrom.moduleName)!==e.importFrom.moduleName)throw new Error(`Attempted to use alias ${e.importFrom.starImportAlias} for more than one module in the same file`)}};var fe=class extends ${constructor({customConfig:r,formatter:e}){super({customConfig:r,formatter:e})}async toStringAsync(){let r=this.getContent();if(this.formatter!=null)try{return this.formatter.format(r)}catch(e){throw new Error(`Failed to format TypeScript file: ${e}
|
|
9
|
+
${r}`)}return r}toString(){let r=this.getContent();if(this.formatter!=null)try{return this.formatter.formatSync(r)}catch(e){throw new Error(`Failed to format TypeScript file: ${e}
|
|
10
|
+
${r}`)}return r}getContent(){let r=this.stringifyImports();return r.length>0?r+`
|
|
11
|
+
`+this.buffer:this.buffer}stringifyImports(){let r="";for(let[e,n]of Object.entries(this.imports)){let i=this.defaultImports[e],o="",a=n.filter(m=>{var h;return((h=m.importFrom)==null?void 0:h.type)==="named"}),l=this.starImportAliases[e];if(a.length>0||i!=null||l!=null){if(r+="import",i!=null&&(r+=` ${i.name}`),a.length>0){for(let h of a.slice(0,-1))o+=`${h.name}, `;let m=a[a.length-1];m!=null&&(o+=`${m.name}`),i!=null&&(r+=","),r+=` { ${o} }`}l!=null&&((i!=null||a.length>0)&&(r+=", "),r+=` * as ${l}`),r+=` from "${e}";
|
|
12
|
+
`}}return r}};var w=class extends j{async toStringAsync({customConfig:r,formatter:e}){let n=new fe({customConfig:r,formatter:e});return this.write(n),await n.toStringAsync()}toString({customConfig:r,formatter:e}){let n=new fe({customConfig:r,formatter:e});return this.write(n),n.toString()}};u();f();var Z=class extends w{constructor(e){super();p(this,"args");this.args=e}write(e){return new B(this.args).write(e)}};u();f();var V=class extends w{constructor(e){super();p(this,"internalType");this.internalType=e}write(e){switch(this.internalType.type){case"string":e.write("string");break;case"number":e.write("number");break;case"bigint":e.write("bigint");break;case"boolean":e.write("boolean");break;case"array":this.internalType.valueType.write(e),e.write("[]");break;case"map":e.write("Record<"),this.internalType.keyType.write(e),e.write(", "),this.internalType.valueType.write(e),e.write(">");break;case"object":e.write("{"),e.indent();for(let[n,i]of Object.entries(this.internalType.fields))e.write(`${n}: `),i.write(e),e.writeLine(",");e.dedent(),e.write("}");break;case"enum":e.write("enum");break;case"any":e.write("any");break;case"promise":e.write("Promise<"),this.internalType.value.write(e),e.write(">");break;case"unknown":e.write("unknown");break;case"void":e.write("void");break;case"undefined":e.write("undefined");break;case"null":e.write("null");break;case"never":e.write("never");break;case"nop":break;default:b(this.internalType)}}static string(){return new this({type:"string"})}static number(){return new this({type:"number"})}static bigint(){return new this({type:"bigint"})}static boolean(){return new this({type:"boolean"})}static array(e){return new this({type:"array",valueType:e})}static object(e){return new this({type:"object",fields:e})}static enum(e){return new this({type:"enum",values:e})}static any(){return new this({type:"any"})}static promise(e){return e.internalType.type==="promise"?e:new this({type:"promise",value:e})}static unknown(){return new this({type:"unknown"})}static void(){return new this({type:"void"})}static undefined(){return new this({type:"undefined"})}static null(){return new this({type:"null"})}static never(){return new this({type:"never"})}static nop(){return new this({type:"nop"})}};u();f();var k=class t extends w{constructor(e){super();p(this,"internalType");this.internalType=e}write(e){var o,a;let n=!!((o=e.customConfig)!=null&&o.noSerdeLayer),i=!!((a=e.customConfig)!=null&&a.useBigInt);switch(this.internalType.type){case"array":{this.writeIterable({writer:e,iterable:this.internalType});break}case"blob":{if(n){e.writeNode(t.string(this.internalType.value));return}e.write("new Blob(["),e.writeNode(t.string(this.internalType.value)),e.write("])");break}case"boolean":{e.write(this.internalType.value.toString());break}case"bigint":{if(i){e.write(`BigInt(${this.internalType.value.toString()})`);return}e.write(`"${this.internalType.value.toString()}"`);return}case"datetime":{if(n){e.writeNode(t.string(this.internalType.value));return}e.write("new Date("),e.writeNode(t.string(this.internalType.value)),e.write(")");break}case"number":{e.write(this.internalType.value.toString());break}case"object":{this.writeObject({writer:e,object:this.internalType});break}case"record":{this.writeRecord({writer:e,record:this.internalType});break}case"reference":{e.writeNode(this.internalType.value);break}case"set":{if(n||this.isSetOfObjects()){e.writeNode(t.array({values:this.internalType.values}));return}e.write("new Set("),this.writeIterable({writer:e,iterable:this.internalType}),e.write(")");break}case"string":{this.internalType.value.includes(`
|
|
13
|
+
`)?this.writeStringWithBackticks({writer:e,value:this.internalType.value}):e.write(`"${this.internalType.value.replaceAll('"','\\"')}"`);break}case"tuple":{this.writeIterable({writer:e,iterable:this.internalType});break}case"unknown":{this.writeUnknown({writer:e,value:this.internalType.value});break}case"null":{e.write("null");break}case"nop":break;default:b(this.internalType)}}isObject(){return this.internalType.type==="object"}asObjectOrThrow(){if(this.isObject())return this.internalType;throw new Error("Internal error; ts.TypeLiteral is not an object")}isSet(){return this.internalType.type==="set"}asSetOrThrow(){if(this.isSet())return this.internalType;throw new Error("Internal error; ts.TypeLiteral is not a set")}isSetOfObjects(){return this.isSet()&&this.asSetOrThrow().values.every(e=>e.isObject())}writeStringWithBackticks({writer:e,value:n}){e.write("`");let i=n.split(`
|
|
14
|
+
`),o=i[0]+`
|
|
15
|
+
`,a=i.slice(1).join(`
|
|
16
|
+
`);e.write(o.replaceAll("`","\\`")),e.writeNoIndent(a.replaceAll("`","\\`")),e.write("`")}writeIterable({writer:e,iterable:n}){let i=fo({values:n.values});if(i.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let o of i)o.write(e),e.writeLine(",");e.dedent(),e.write("]")}writeRecord({writer:e,record:n}){let i=uo({entries:n.entries});if(i.length===0){e.write("{}");return}e.writeLine("{"),e.indent();for(let o of i)o.key.write(e),e.write(": "),o.value.write(e),e.writeLine(",");e.dedent(),e.write("}")}writeObject({writer:e,object:n}){let i=so({fields:n.fields});if(i.length===0){e.write("{}");return}e.writeLine("{"),e.indent();for(let o of i)e.write(`${o.name}: `),o.value.write(e),e.writeLine(",");e.dedent(),e.write("}")}static array({values:e}){return new this({type:"array",values:e})}static bigint(e){return new this({type:"bigint",value:e})}static blob(e){return new this({type:"blob",value:e})}static boolean(e){return new this({type:"boolean",value:e})}static datetime(e){return new this({type:"datetime",value:e})}static number(e){return new this({type:"number",value:e})}static object({fields:e}){return new this({type:"object",fields:e})}static record({entries:e}){return new this({type:"record",entries:e})}static reference(e){return new this({type:"reference",value:e})}static set({values:e}){return new this({type:"set",values:e})}static string(e){return new this({type:"string",value:e})}static tuple({values:e}){return new this({type:"tuple",values:e})}static unknown(e){return new this({type:"unknown",value:e})}static null(){return new this({type:"null"})}static nop(){return new this({type:"nop"})}static isNop(e){return e.internalType.type==="nop"}writeUnknown({writer:e,value:n}){switch(typeof n){case"boolean":e.write(n.toString());return;case"string":e.write(n.includes('"')?`\`${n}\``:`"${n}"`);return;case"number":e.write(n.toString());return;case"object":if(n==null){e.write("null");return}if(Array.isArray(n)){this.writeUnknownArray({writer:e,value:n});return}this.writeUnknownObject({writer:e,value:n});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof n}`)}}writeUnknownArray({writer:e,value:n}){if(n.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let i of n)e.writeNode(t.unknown(i)),e.writeLine(",");e.dedent(),e.write("]")}writeUnknownObject({writer:e,value:n}){let i=Object.entries(n);if(i.length===0){e.write("{}");return}e.writeLine("{"),e.indent();for(let[o,a]of i)e.write(`${o}: `),e.writeNode(t.unknown(a)),e.writeLine(",");e.dedent(),e.write("}")}};function so({fields:t}){return t.filter(r=>!k.isNop(r.value))}function uo({entries:t}){return t.filter(r=>!k.isNop(r.key)&&!k.isNop(r.value))}function fo({values:t}){return t.filter(r=>!k.isNop(r))}u();f();var W=class extends w{constructor({name:e,importFrom:n,memberName:i}){super();p(this,"name");p(this,"importFrom");p(this,"memberName");this.name=e,this.importFrom=n,this.memberName=i}write(e){var o;this.importFrom!=null&&e.addImport(this);let n=((o=this.importFrom)==null?void 0:o.type)==="star"?`${this.importFrom.starImportAlias}.`:"",i=this.memberName!=null?`.${this.memberName}`:"";e.write(`${n}${this.name}${i}`)}};u();f();var J=class extends w{constructor(e){super();p(this,"args");this.args=e}write(e){this.args.export&&e.write("export "),this.args.const?e.write("const "):e.write("let "),e.write(`${this.args.name} = `),e.writeNode(this.args.initializer)}};u();f();u();f();var _=class extends w{constructor({docs:e}={docs:void 0}){super();p(this,"docs");this.docs=e}write(e){this.docs!=null&&(e.writeLine("/**"),this.docs.split(`
|
|
17
|
+
`).forEach(n=>{e.writeLine(` * ${n}`)}),e.writeLine("*/"))}};var K=class extends w{constructor({name:e,type:n,docs:i}){super();p(this,"name");p(this,"type");p(this,"docs");this.name=e,this.type=n,this.docs=i}write(e){this.docs!=null&&e.writeNode(new _({docs:this.docs})),e.write(`${this.name}: `),this.type.write(e)}};u();f();var X=class extends w{constructor({name:e,parameters:n,async:i,body:o,return_:a,docs:l}){super();p(this,"name");p(this,"parameters");p(this,"async");p(this,"body");p(this,"return_");p(this,"docs");this.name=e,this.parameters=n,this.async=i!=null?i:!1,this.body=o,this.return_=a,this.docs=l}write(e){var n;e.writeNode(new _({docs:this.docs})),this.async&&e.write("async "),e.write("function "),e.write(`${this.name}`),this.writeParameters(e),this.return_!=null&&(e.write(": "),e.writeNode(this.async?V.promise(this.return_):this.return_)),e.writeLine(" {"),e.indent(),(n=this.body)==null||n.write(e),e.dedent(),e.writeNewLineIfLastLineNot(),e.writeLine("}")}writeParameters(e){if(this.parameters.length===0){e.write("()");return}e.indent(),e.writeLine("(");for(let n of this.parameters)e.writeNode(n),e.writeLine(",");e.dedent(),e.write(")")}};u();f();var Q=class extends w{constructor({function_:e,arguments_:n}){super();p(this,"function_");p(this,"arguments_");this.function_=e,this.arguments_=n}write(e){e.writeNode(this.function_),e.write("("),e.delimit({nodes:this.arguments_,delimiter:", ",writeFunction:n=>n.write(e)}),e.write(")")}};u();f();var ee=class extends w{constructor({on:e,method:n,arguments_:i,async:o}){super();p(this,"on");p(this,"method");p(this,"arguments_");p(this,"async");this.on=e,this.method=n,this.arguments_=i,this.async=o}write(e){this.async&&e.write("await "),this.on.write(e),e.write("."),e.write(this.method),e.write("("),e.delimit({nodes:this.arguments_,delimiter:", ",writeFunction:n=>n.write(e)}),e.write(")")}};u();f();var re=class extends w{constructor({class_:e,arguments_:n}){super();p(this,"class_");p(this,"arguments_");this.class_=e,this.arguments_=n}write(e){e.write("new "),e.writeNode(this.class_),e.write("("),e.delimit({nodes:this.arguments_,delimiter:", ",writeFunction:n=>n.write(e)}),e.write(")")}};function po(t){return new Z(t)}function co(t){return new X(t)}function mo(t){return new re(t)}function ho(t){return new Q(t)}function xo(t){return new ee(t)}function yo(t){return new K(t)}function go(t){return new W(t)}function wo(t){return new J(t)}u();f();u();f();function Fe({generatorConfig:t,isPackagePrivate:r}){var n;let e=t.output.mode;switch(e.type){case"downloadFiles":return;case"publish":return{packageName:e.registriesV2.npm.packageName,version:e.version,private:r,publishInfo:{registryUrl:e.registriesV2.npm.registryUrl,token:e.registriesV2.npm.token},license:void 0,repoUrl:void 0};case"github":if(e.publishInfo!=null&&e.publishInfo.type!=="npm")throw new Error(`Expected to receive npm publish info but received ${e.publishInfo.type} instead`);return{packageName:e.publishInfo!=null?e.publishInfo.packageName:"",version:e.version,private:r,publishInfo:void 0,repoUrl:e.repoUrl,license:(n=t.license)==null?void 0:n._visit({basic:i=>i.id,custom:i=>`See ${i.filename}`,_other:()=>{}})};default:throw new Error(`Encountered unknown output mode: ${e}`)}}u();f();function Pe({organization:t,workspaceName:r,namespaceExport:e}){return e!=null?e:`${q(ve(t))}${q(ve(r))}`}u();f();var vo="value",Te=class{constructor({context:r}){p(this,"context");this.context=r}convert(r){if(r.value===null)return this.context.isNullable(r.typeReference)?d.TypeLiteral.null():(this.context.errors.add({severity:g.Critical,message:"Expected non-null value, but got null"}),d.TypeLiteral.nop());if(r.value===void 0)return d.TypeLiteral.nop();switch(r.typeReference.type){case"list":return this.convertList({list:r.typeReference.value,value:r.value});case"literal":return this.convertLiteral({literalType:r.typeReference.value,value:r.value});case"map":return this.convertMap({map:r.typeReference,value:r.value});case"named":{let e=this.context.resolveNamedType({typeId:r.typeReference.value});return e==null?d.TypeLiteral.nop():this.convertNamed({named:e,value:r.value,as:r.as})}case"optional":return this.convert({typeReference:r.typeReference.value,value:r.value,as:r.as});case"nullable":return this.convert({typeReference:r.typeReference.value,value:r.value,as:r.as});case"primitive":return this.convertPrimitive({primitive:r.typeReference.value,value:r.value,as:r.as});case"set":return this.convertSet({set:r.typeReference.value,value:r.value});case"unknown":return this.convertUnknown({value:r.value});default:b(r.typeReference)}}convertLiteral({literalType:r,value:e}){switch(r.type){case"boolean":{let n=this.context.getValueAsBoolean({value:e});return n==null?d.TypeLiteral.nop():d.TypeLiteral.boolean(n)}case"string":{let n=this.context.getValueAsString({value:e});return n==null?d.TypeLiteral.nop():d.TypeLiteral.string(n)}default:b(r)}}convertList({list:r,value:e}){return Array.isArray(e)?d.TypeLiteral.array({values:e.map((n,i)=>{this.context.errors.scope({index:i});try{return this.convert({typeReference:r,value:n})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:g.Critical,message:`Expected array but got: ${typeof e}`}),d.TypeLiteral.nop())}convertSet({set:r,value:e}){return Array.isArray(e)?d.TypeLiteral.set({values:e.map((n,i)=>{this.context.errors.scope({index:i});try{return this.convert({typeReference:r,value:n})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:g.Critical,message:`Expected array but got: ${typeof e}`}),d.TypeLiteral.nop())}convertMap({map:r,value:e}){return typeof e!="object"||e==null?(this.context.errors.add({severity:g.Critical,message:`Expected object but got: ${e==null?"null":typeof e}`}),d.TypeLiteral.nop()):d.TypeLiteral.record({entries:Object.entries(e).map(([n,i])=>{this.context.errors.scope(n);try{return{key:this.convert({typeReference:r.key,value:n,as:"key"}),value:this.convert({typeReference:r.value,value:i})}}finally{this.context.errors.unscope()}})})}convertNamed({named:r,value:e,as:n}){var i;switch(r.type){case"alias":return(i=this.context.customConfig)!=null&&i.useBrandedStringAliases?d.TypeLiteral.reference(d.codeblock(o=>{o.writeNode(d.reference({name:this.context.namespaceExport,importFrom:this.context.getModuleImport(),memberName:this.context.getFullyQualifiedReference({declaration:r.declaration})})),o.write("("),o.writeNode(this.convert({typeReference:r.typeReference,value:e,as:n})),o.write(")")})):this.convert({typeReference:r.typeReference,value:e,as:n});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:r,value:e});case"enum":return this.convertEnum({enum_:r,value:e});case"object":return this.convertObject({object_:r,value:e});case"undiscriminatedUnion":return this.convertUndicriminatedUnion({undicriminatedUnion:r,value:e});default:b(r)}}convertDiscriminatedUnion({discriminatedUnion:r,value:e}){var l;let n=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:r,value:e});if(n==null)return d.TypeLiteral.nop();let i=n.singleDiscriminatedUnionType,o=this.convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:n,unionVariant:i});if(o==null)return d.TypeLiteral.nop();if((l=this.context.customConfig)!=null&&l.includeUtilsOnUnionMembers)return d.TypeLiteral.reference(d.codeblock(m=>{m.writeNode(d.invokeMethod({on:d.reference({name:this.context.namespaceExport,importFrom:this.context.getModuleImport(),memberName:this.context.getFullyQualifiedReference({declaration:r.declaration})}),method:this.context.getMethodName(i.discriminantValue.name),arguments_:this.convertDiscriminatedUnionUtilsArgs({discriminatedUnionTypeInstance:n,unionVariant:i,unionProperties:o})}))}));let a={name:this.context.getPropertyName(r.discriminant.name),value:d.TypeLiteral.string(i.discriminantValue.wireValue)};return d.TypeLiteral.object({fields:[a,...o]})}convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:r,unionVariant:e}){let n=this.getBaseFields({discriminatedUnionTypeInstance:r,singleDiscriminatedUnionType:e});switch(e.type){case"samePropertiesAsObject":{let i=this.context.resolveNamedType({typeId:e.typeId});if(i==null)return;let o=this.convertNamed({named:i,value:r.value});if(!o.isObject()){this.context.errors.add({severity:g.Critical,message:"Internal error; expected union value to be an object"});return}let a=o.asObjectOrThrow();return[...n,...a.fields]}case"singleProperty":try{this.context.errors.scope(e.discriminantValue.wireValue);let i=this.context.getRecord(r.value);return i==null?[...n,{name:vo,value:this.convert({typeReference:e.typeReference,value:r.value})}]:[...n,{name:this.context.getPropertyName(e.discriminantValue.name),value:this.convert({typeReference:e.typeReference,value:i[e.discriminantValue.wireValue]})}]}finally{this.context.errors.unscope()}case"noProperties":return n;default:b(e)}}convertDiscriminatedUnionUtilsArgs({discriminatedUnionTypeInstance:r,unionVariant:e,unionProperties:n}){return e.type==="singleProperty"&&this.context.getRecord(r.value)==null&&n.length===1?[this.convert({typeReference:e.typeReference,value:r.value})]:n.length>0?[d.TypeLiteral.object({fields:n})]:[]}getBaseFields({discriminatedUnionTypeInstance:r,singleDiscriminatedUnionType:e}){var i,o;return this.context.associateByWireValue({parameters:(i=e.properties)!=null?i:[],values:(o=this.context.getRecord(r.value))!=null?o:{},ignoreMissingParameters:!0}).map(a=>{this.context.errors.scope(a.name.wireValue);try{return{name:this.context.getPropertyName(a.name.name),value:this.convert(a)}}finally{this.context.errors.unscope()}})}convertObject({object_:r,value:e}){var i;let n=this.context.associateByWireValue({parameters:r.properties,values:(i=this.context.getRecord(e))!=null?i:{}});return d.TypeLiteral.object({fields:n.map(o=>{this.context.errors.scope(o.name.wireValue);try{return{name:this.context.getPropertyName(o.name.name),value:this.convert(o)}}finally{this.context.errors.unscope()}})})}convertEnum({enum_:r,value:e}){let n=this.getEnumValue({enum_:r,value:e});return n==null?d.TypeLiteral.nop():d.TypeLiteral.string(n)}getEnumValue({enum_:r,value:e}){if(typeof e!="string"){this.context.errors.add({severity:g.Critical,message:`Expected enum value string, got: ${typeof e}`});return}if(r.values.find(i=>i.wireValue===e)==null){this.context.errors.add({severity:g.Critical,message:`An enum value named "${e}" does not exist in this context`});return}return e}convertUndicriminatedUnion({undicriminatedUnion:r,value:e}){let n=this.findMatchingUndiscriminatedUnionType({undicriminatedUnion:r,value:e});return n==null?d.TypeLiteral.nop():n}findMatchingUndiscriminatedUnionType({undicriminatedUnion:r,value:e}){for(let n of r.types)try{return this.convert({typeReference:n,value:e})}catch(i){continue}this.context.errors.add({severity:g.Critical,message:`None of the types in the undicriminated union matched the given "${typeof e}" value`})}convertUnknown({value:r}){return d.TypeLiteral.unknown(r)}convertPrimitive({primitive:r,value:e,as:n}){var i,o;switch(r){case"INTEGER":case"UINT":{let a=this.getValueAsNumber({value:e,as:n});return a==null?d.TypeLiteral.nop():d.TypeLiteral.number(a)}case"LONG":case"UINT_64":{let a=this.getValueAsNumber({value:e,as:n});return a==null?d.TypeLiteral.nop():(i=this.context.customConfig)!=null&&i.useBigInt?d.TypeLiteral.bigint(BigInt(a)):d.TypeLiteral.number(a)}case"FLOAT":case"DOUBLE":{let a=this.getValueAsNumber({value:e});return a==null?d.TypeLiteral.nop():d.TypeLiteral.number(a)}case"BOOLEAN":{let a=this.getValueAsBoolean({value:e,as:n});return a==null?d.TypeLiteral.nop():d.TypeLiteral.boolean(a)}case"BASE_64":case"DATE":case"UUID":case"STRING":{let a=this.context.getValueAsString({value:e});return a==null?d.TypeLiteral.nop():d.TypeLiteral.string(a)}case"DATE_TIME":{let a=this.context.getValueAsString({value:e});return a==null?d.TypeLiteral.nop():d.TypeLiteral.datetime(a)}case"BIG_INTEGER":{let a=this.context.getValueAsString({value:e});return a==null?d.TypeLiteral.nop():(o=this.context.customConfig)!=null&&o.useBigInt?d.TypeLiteral.bigint(BigInt(a)):d.TypeLiteral.string(a)}default:b(r)}}getValueAsNumber({value:r,as:e}){let n=e==="key"&&typeof r=="string"?Number(r):r;return this.context.getValueAsNumber({value:n})}getValueAsBoolean({value:r,as:e}){let n=e==="key"?typeof r=="string"?r==="true":r==="false"?!1:r:r;return this.context.getValueAsBoolean({value:n})}};u();f();var Ae=class{constructor({context:r}){p(this,"context");this.context=r}getFilePropertyInfo({body:r,value:e}){var o;let n={fileFields:[],bodyPropertyFields:[]},i=(o=this.context.getRecord(e))!=null?o:{};for(let a of r.properties)switch(a.type){case"file":n.fileFields.push({name:this.context.getPropertyName(a.name),value:this.getSingleFileProperty({property:a,record:i})});break;case"fileArray":n.fileFields.push({name:this.context.getPropertyName(a.name),value:this.getArrayFileProperty({property:a,record:i})});break;case"bodyProperty":n.bodyPropertyFields.push({name:this.context.getPropertyName(a.name.name),value:this.getBodyProperty({property:a,record:i})});break;default:b(a)}return n}getSingleFileProperty({property:r,record:e}){let n=this.context.getSingleFileValue({property:r,record:e});return n==null?d.TypeLiteral.nop():d.TypeLiteral.blob(n)}getArrayFileProperty({property:r,record:e}){let n=this.context.getFileArrayValues({property:r,record:e});return n==null?d.TypeLiteral.nop():d.TypeLiteral.array({values:n.map(i=>d.TypeLiteral.blob(i))})}getBodyProperty({property:r,record:e}){let n=e[r.name.wireValue];return n==null?d.TypeLiteral.nop():this.context.dynamicTypeLiteralMapper.convert({typeReference:r.typeReference,value:n})}};var Be=class t extends ue{constructor({ir:e,config:n}){var i;super({ir:e,config:n});p(this,"ir");p(this,"customConfig");p(this,"dynamicTypeLiteralMapper");p(this,"filePropertyMapper");p(this,"moduleName");p(this,"namespaceExport");this.ir=e,this.customConfig=n.customConfig!=null?n.customConfig:void 0,this.dynamicTypeLiteralMapper=new Te({context:this}),this.filePropertyMapper=new Ae({context:this}),this.moduleName=bo({config:n,customConfig:this.customConfig}),this.namespaceExport=Pe({organization:n.organization,workspaceName:n.workspaceName,namespaceExport:(i=this.customConfig)==null?void 0:i.namespaceExport})}clone(){return new t({ir:this.ir,config:this.config})}getModuleImport(){return{type:"named",moduleName:this.moduleName}}getRootClientName(){return`${this.namespaceExport}Client`}getPropertyName(e){var n,i;return(n=this.customConfig)!=null&&n.retainOriginalCasing||(i=this.customConfig)!=null&&i.noSerdeLayer?this.formatOriginalPropertyName(e.originalName):e.camelCase.unsafeName}getMethodName(e){return e.camelCase.unsafeName}getTypeName(e){return e.pascalCase.unsafeName}getEnvironmentTypeReferenceFromID(e){let n=this.resolveEnvironmentName(e);if(n!=null)return this.getEnvironmentsTypeReference(n)}getFullyQualifiedReference({declaration:e}){return e.fernFilepath.allParts.length>0?`${e.fernFilepath.allParts.map(n=>n.camelCase.unsafeName).join(".")}.${this.getTypeName(e.name)}`:`${this.getTypeName(e.name)}`}getEnvironmentsTypeReference(e){return d.reference({name:`${this.namespaceExport}Environments`,importFrom:this.getModuleImport(),memberName:this.getTypeName(e)})}formatOriginalPropertyName(e){return e.includes("-")?`"${e}"`:e}};function bo({config:t,customConfig:r}){var e,n,i;return(i=(n=Fe({generatorConfig:t,isPackagePrivate:(e=r==null?void 0:r.private)!=null?e:!1}))==null?void 0:n.packageName)!=null?i:t.organization}0&&(module.exports={DynamicSnippetsGeneratorContext});
|
|
4812
18
|
/*! Bundled license information:
|
|
4813
19
|
|
|
4814
20
|
@esbuild-plugins/node-globals-polyfill/Buffer.js:
|