@kubb/oas 4.33.5 → 4.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -6,17 +6,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __getProtoOf = Object.getPrototypeOf;
8
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
10
- var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
11
- var __exportAll = (all, no_symbols) => {
12
- let target = {};
13
- for (var name in all) __defProp(target, name, {
14
- get: all[name],
15
- enumerable: true
16
- });
17
- if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
18
- return target;
19
- };
20
9
  var __copyProps = (to, from, except, desc) => {
21
10
  if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
22
11
  key = keys[i];
@@ -31,7 +20,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
31
20
  value: mod,
32
21
  enumerable: true
33
22
  }) : target, mod));
34
- var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
23
  //#endregion
36
24
  let jsonpointer = require("jsonpointer");
37
25
  jsonpointer = __toESM(jsonpointer);
@@ -41,12 +29,103 @@ let oas_utils = require("oas/utils");
41
29
  let node_path = require("node:path");
42
30
  node_path = __toESM(node_path);
43
31
  let _redocly_openapi_core = require("@redocly/openapi-core");
32
+ let _stoplight_yaml = require("@stoplight/yaml");
33
+ _stoplight_yaml = __toESM(_stoplight_yaml);
44
34
  let oas_types = require("oas/types");
45
35
  let oas_normalize = require("oas-normalize");
46
36
  oas_normalize = __toESM(oas_normalize);
47
37
  let remeda = require("remeda");
48
38
  let swagger2openapi = require("swagger2openapi");
49
39
  swagger2openapi = __toESM(swagger2openapi);
40
+ //#region src/constants.ts
41
+ /**
42
+ * JSON Schema keywords that indicate structural composition.
43
+ * Used when deciding whether an inline `allOf` fragment can be safely flattened
44
+ * into its parent (fragments containing any of these keys must not be inlined).
45
+ */
46
+ const STRUCTURAL_KEYS = new Set([
47
+ "properties",
48
+ "items",
49
+ "additionalProperties",
50
+ "oneOf",
51
+ "anyOf",
52
+ "allOf",
53
+ "not"
54
+ ]);
55
+ /**
56
+ * Maps OAS/JSON Schema `format` strings to their Kubb `SchemaType` equivalents.
57
+ *
58
+ * Only formats that require a type different from the raw OAS `type` are listed here.
59
+ * `int64`, `date-time`, `date`, and `time` are handled separately because their
60
+ * output depends on runtime parser options and cannot live in a static map.
61
+ *
62
+ * Note: `ipv4`, `ipv6`, and `hostname` map to `'url'` — not semantically accurate,
63
+ * but `'url'` is the closest supported scalar type in the Kubb AST.
64
+ */
65
+ const FORMAT_MAP = {
66
+ uuid: "uuid",
67
+ email: "email",
68
+ "idn-email": "email",
69
+ uri: "url",
70
+ "uri-reference": "url",
71
+ url: "url",
72
+ ipv4: "url",
73
+ ipv6: "url",
74
+ hostname: "url",
75
+ "idn-hostname": "url",
76
+ binary: "blob",
77
+ byte: "blob",
78
+ int32: "integer",
79
+ float: "number",
80
+ double: "number"
81
+ };
82
+ /**
83
+ * Exhaustive list of media types that Kubb recognizes.
84
+ * Kept as a module-level constant to avoid re-allocating the array on every call.
85
+ */
86
+ const KNOWN_MEDIA_TYPES = [
87
+ "application/json",
88
+ "application/xml",
89
+ "application/x-www-form-urlencoded",
90
+ "application/octet-stream",
91
+ "application/pdf",
92
+ "application/zip",
93
+ "application/graphql",
94
+ "multipart/form-data",
95
+ "text/plain",
96
+ "text/html",
97
+ "text/csv",
98
+ "text/xml",
99
+ "image/png",
100
+ "image/jpeg",
101
+ "image/gif",
102
+ "image/webp",
103
+ "image/svg+xml",
104
+ "audio/mpeg",
105
+ "video/mp4"
106
+ ];
107
+ /**
108
+ * Vendor extension keys used by various spec generators to attach human-readable
109
+ * labels to enum values. Checked in priority order: the first key found wins.
110
+ */
111
+ const ENUM_EXTENSION_KEYS = ["x-enumNames", "x-enum-varnames"];
112
+ /**
113
+ * Canonical HTTP method names used throughout the Kubb OAS layer.
114
+ * Keys are uppercase (as used in generated code); values are the lowercase
115
+ * strings that the `oas` library uses internally.
116
+ * @deprecated use httpMethods from @kubb/ast
117
+ */
118
+ const httpMethods = {
119
+ GET: "get",
120
+ POST: "post",
121
+ PUT: "put",
122
+ PATCH: "patch",
123
+ DELETE: "delete",
124
+ HEAD: "head",
125
+ OPTIONS: "options",
126
+ TRACE: "trace"
127
+ };
128
+ //#endregion
50
129
  //#region ../../internals/utils/src/casing.ts
51
130
  /**
52
131
  * Shared implementation for camelCase and PascalCase conversion.
@@ -99,4377 +178,143 @@ function pascalCase(text, { isFile, prefix = "", suffix = "" } = {}) {
99
178
  prefix,
100
179
  suffix
101
180
  }) : camelCase(part));
102
- return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true);
103
- }
104
- //#endregion
105
- //#region ../../internals/utils/src/reserved.ts
106
- /**
107
- * Returns `true` when `name` is a syntactically valid JavaScript variable name.
108
- */
109
- function isValidVarName(name) {
110
- try {
111
- new Function(`var ${name}`);
112
- } catch {
113
- return false;
114
- }
115
- return true;
116
- }
117
- //#endregion
118
- //#region ../../internals/utils/src/urlPath.ts
119
- /**
120
- * Parses and transforms an OpenAPI/Swagger path string into various URL formats.
121
- *
122
- * @example
123
- * const p = new URLPath('/pet/{petId}')
124
- * p.URL // '/pet/:petId'
125
- * p.template // '`/pet/${petId}`'
126
- */
127
- var URLPath = class {
128
- /** The raw OpenAPI/Swagger path string, e.g. `/pet/{petId}`. */
129
- path;
130
- #options;
131
- constructor(path, options = {}) {
132
- this.path = path;
133
- this.#options = options;
134
- }
135
- /** Converts the OpenAPI path to Express-style colon syntax, e.g. `/pet/{petId}` → `/pet/:petId`. */
136
- get URL() {
137
- return this.toURLPath();
138
- }
139
- /** Returns `true` when `path` is a fully-qualified URL (e.g. starts with `https://`). */
140
- get isURL() {
141
- try {
142
- return !!new URL(this.path).href;
143
- } catch {
144
- return false;
145
- }
146
- }
147
- /**
148
- * Converts the OpenAPI path to a TypeScript template literal string.
149
- *
150
- * @example
151
- * new URLPath('/pet/{petId}').template // '`/pet/${petId}`'
152
- * new URLPath('/account/monetary-accountID').template // '`/account/${monetaryAccountId}`'
153
- */
154
- get template() {
155
- return this.toTemplateString();
156
- }
157
- /** Returns the path and its extracted params as a structured `URLObject`, or as a stringified expression when `stringify` is set. */
158
- get object() {
159
- return this.toObject();
160
- }
161
- /** Returns a map of path parameter names, or `undefined` when the path has no parameters. */
162
- get params() {
163
- return this.getParams();
164
- }
165
- #transformParam(raw) {
166
- const param = isValidVarName(raw) ? raw : camelCase(raw);
167
- return this.#options.casing === "camelcase" ? camelCase(param) : param;
168
- }
169
- /** Iterates over every `{param}` token in `path`, calling `fn` with the raw token and transformed name. */
170
- #eachParam(fn) {
171
- for (const match of this.path.matchAll(/\{([^}]+)\}/g)) {
172
- const raw = match[1];
173
- fn(raw, this.#transformParam(raw));
174
- }
175
- }
176
- toObject({ type = "path", replacer, stringify } = {}) {
177
- const object = {
178
- url: type === "path" ? this.toURLPath() : this.toTemplateString({ replacer }),
179
- params: this.getParams()
180
- };
181
- if (stringify) {
182
- if (type === "template") return JSON.stringify(object).replaceAll("'", "").replaceAll(`"`, "");
183
- if (object.params) return `{ url: '${object.url}', params: ${JSON.stringify(object.params).replaceAll("'", "").replaceAll(`"`, "")} }`;
184
- return `{ url: '${object.url}' }`;
185
- }
186
- return object;
187
- }
188
- /**
189
- * Converts the OpenAPI path to a TypeScript template literal string.
190
- * An optional `replacer` can transform each extracted parameter name before interpolation.
191
- *
192
- * @example
193
- * new URLPath('/pet/{petId}').toTemplateString() // '`/pet/${petId}`'
194
- */
195
- toTemplateString({ prefix = "", replacer } = {}) {
196
- return `\`${prefix}${this.path.split(/\{([^}]+)\}/).map((part, i) => {
197
- if (i % 2 === 0) return part;
198
- const param = this.#transformParam(part);
199
- return `\${${replacer ? replacer(param) : param}}`;
200
- }).join("")}\``;
201
- }
202
- /**
203
- * Extracts all `{param}` segments from the path and returns them as a key-value map.
204
- * An optional `replacer` transforms each parameter name in both key and value positions.
205
- * Returns `undefined` when no path parameters are found.
206
- */
207
- getParams(replacer) {
208
- const params = {};
209
- this.#eachParam((_raw, param) => {
210
- const key = replacer ? replacer(param) : param;
211
- params[key] = key;
212
- });
213
- return Object.keys(params).length > 0 ? params : void 0;
214
- }
215
- /** Converts the OpenAPI path to Express-style colon syntax, e.g. `/pet/{petId}` → `/pet/:petId`. */
216
- toURLPath() {
217
- return this.path.replace(/\{([^}]+)\}/g, ":$1");
218
- }
219
- };
220
- //#endregion
221
- //#region ../../node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs
222
- var tslib_es6_exports = /* @__PURE__ */ __exportAll({
223
- __addDisposableResource: () => __addDisposableResource,
224
- __assign: () => __assign,
225
- __asyncDelegator: () => __asyncDelegator,
226
- __asyncGenerator: () => __asyncGenerator,
227
- __asyncValues: () => __asyncValues,
228
- __await: () => __await,
229
- __awaiter: () => __awaiter,
230
- __classPrivateFieldGet: () => __classPrivateFieldGet,
231
- __classPrivateFieldIn: () => __classPrivateFieldIn,
232
- __classPrivateFieldSet: () => __classPrivateFieldSet,
233
- __createBinding: () => __createBinding,
234
- __decorate: () => __decorate,
235
- __disposeResources: () => __disposeResources,
236
- __esDecorate: () => __esDecorate,
237
- __exportStar: () => __exportStar,
238
- __extends: () => __extends,
239
- __generator: () => __generator,
240
- __importDefault: () => __importDefault,
241
- __importStar: () => __importStar,
242
- __makeTemplateObject: () => __makeTemplateObject,
243
- __metadata: () => __metadata,
244
- __param: () => __param,
245
- __propKey: () => __propKey,
246
- __read: () => __read,
247
- __rest: () => __rest,
248
- __rewriteRelativeImportExtension: () => __rewriteRelativeImportExtension,
249
- __runInitializers: () => __runInitializers,
250
- __setFunctionName: () => __setFunctionName,
251
- __spread: () => __spread,
252
- __spreadArray: () => __spreadArray,
253
- __spreadArrays: () => __spreadArrays,
254
- __values: () => __values,
255
- default: () => tslib_es6_default
256
- });
257
- function __extends(d, b) {
258
- if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
259
- extendStatics(d, b);
260
- function __() {
261
- this.constructor = d;
262
- }
263
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
264
- }
265
- function __rest(s, e) {
266
- var t = {};
267
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
268
- if (s != null && typeof Object.getOwnPropertySymbols === "function") {
269
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
270
- }
271
- return t;
272
- }
273
- function __decorate(decorators, target, key, desc) {
274
- var c = arguments.length;
275
- var r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
276
- var d;
277
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
278
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
279
- return c > 3 && r && Object.defineProperty(target, key, r), r;
280
- }
281
- function __param(paramIndex, decorator) {
282
- return function(target, key) {
283
- decorator(target, key, paramIndex);
284
- };
285
- }
286
- function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
287
- function accept(f) {
288
- if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected");
289
- return f;
290
- }
291
- var kind = contextIn.kind;
292
- var key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
293
- var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
294
- var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
295
- var _;
296
- var done = false;
297
- for (var i = decorators.length - 1; i >= 0; i--) {
298
- var context = {};
299
- for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
300
- for (var p in contextIn.access) context.access[p] = contextIn.access[p];
301
- context.addInitializer = function(f) {
302
- if (done) throw new TypeError("Cannot add initializers after decoration has completed");
303
- extraInitializers.push(accept(f || null));
304
- };
305
- var result = (0, decorators[i])(kind === "accessor" ? {
306
- get: descriptor.get,
307
- set: descriptor.set
308
- } : descriptor[key], context);
309
- if (kind === "accessor") {
310
- if (result === void 0) continue;
311
- if (result === null || typeof result !== "object") throw new TypeError("Object expected");
312
- if (_ = accept(result.get)) descriptor.get = _;
313
- if (_ = accept(result.set)) descriptor.set = _;
314
- if (_ = accept(result.init)) initializers.unshift(_);
315
- } else if (_ = accept(result)) if (kind === "field") initializers.unshift(_);
316
- else descriptor[key] = _;
317
- }
318
- if (target) Object.defineProperty(target, contextIn.name, descriptor);
319
- done = true;
320
- }
321
- function __runInitializers(thisArg, initializers, value) {
322
- var useValue = arguments.length > 2;
323
- for (var i = 0; i < initializers.length; i++) value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
324
- return useValue ? value : void 0;
325
- }
326
- function __propKey(x) {
327
- return typeof x === "symbol" ? x : "".concat(x);
328
- }
329
- function __setFunctionName(f, name, prefix) {
330
- if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
331
- return Object.defineProperty(f, "name", {
332
- configurable: true,
333
- value: prefix ? "".concat(prefix, " ", name) : name
334
- });
335
- }
336
- function __metadata(metadataKey, metadataValue) {
337
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
338
- }
339
- function __awaiter(thisArg, _arguments, P, generator) {
340
- function adopt(value) {
341
- return value instanceof P ? value : new P(function(resolve) {
342
- resolve(value);
343
- });
344
- }
345
- return new (P || (P = Promise))(function(resolve, reject) {
346
- function fulfilled(value) {
347
- try {
348
- step(generator.next(value));
349
- } catch (e) {
350
- reject(e);
351
- }
352
- }
353
- function rejected(value) {
354
- try {
355
- step(generator["throw"](value));
356
- } catch (e) {
357
- reject(e);
358
- }
359
- }
360
- function step(result) {
361
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
362
- }
363
- step((generator = generator.apply(thisArg, _arguments || [])).next());
364
- });
365
- }
366
- function __generator(thisArg, body) {
367
- var _ = {
368
- label: 0,
369
- sent: function() {
370
- if (t[0] & 1) throw t[1];
371
- return t[1];
372
- },
373
- trys: [],
374
- ops: []
375
- };
376
- var f;
377
- var y;
378
- var t;
379
- var g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
380
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
381
- return this;
382
- }), g;
383
- function verb(n) {
384
- return function(v) {
385
- return step([n, v]);
386
- };
387
- }
388
- function step(op) {
389
- if (f) throw new TypeError("Generator is already executing.");
390
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
391
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
392
- if (y = 0, t) op = [op[0] & 2, t.value];
393
- switch (op[0]) {
394
- case 0:
395
- case 1:
396
- t = op;
397
- break;
398
- case 4:
399
- _.label++;
400
- return {
401
- value: op[1],
402
- done: false
403
- };
404
- case 5:
405
- _.label++;
406
- y = op[1];
407
- op = [0];
408
- continue;
409
- case 7:
410
- op = _.ops.pop();
411
- _.trys.pop();
412
- continue;
413
- default:
414
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
415
- _ = 0;
416
- continue;
417
- }
418
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
419
- _.label = op[1];
420
- break;
421
- }
422
- if (op[0] === 6 && _.label < t[1]) {
423
- _.label = t[1];
424
- t = op;
425
- break;
426
- }
427
- if (t && _.label < t[2]) {
428
- _.label = t[2];
429
- _.ops.push(op);
430
- break;
431
- }
432
- if (t[2]) _.ops.pop();
433
- _.trys.pop();
434
- continue;
435
- }
436
- op = body.call(thisArg, _);
437
- } catch (e) {
438
- op = [6, e];
439
- y = 0;
440
- } finally {
441
- f = t = 0;
442
- }
443
- if (op[0] & 5) throw op[1];
444
- return {
445
- value: op[0] ? op[1] : void 0,
446
- done: true
447
- };
448
- }
449
- }
450
- function __exportStar(m, o) {
451
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
452
- }
453
- function __values(o) {
454
- var s = typeof Symbol === "function" && Symbol.iterator;
455
- var m = s && o[s];
456
- var i = 0;
457
- if (m) return m.call(o);
458
- if (o && typeof o.length === "number") return { next: function() {
459
- if (o && i >= o.length) o = void 0;
460
- return {
461
- value: o && o[i++],
462
- done: !o
463
- };
464
- } };
465
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
466
- }
467
- function __read(o, n) {
468
- var m = typeof Symbol === "function" && o[Symbol.iterator];
469
- if (!m) return o;
470
- var i = m.call(o);
471
- var r;
472
- var ar = [];
473
- var e;
474
- try {
475
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
476
- } catch (error) {
477
- e = { error };
478
- } finally {
479
- try {
480
- if (r && !r.done && (m = i["return"])) m.call(i);
481
- } finally {
482
- if (e) throw e.error;
483
- }
484
- }
485
- return ar;
486
- }
487
- /** @deprecated */
488
- function __spread() {
489
- for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
490
- return ar;
491
- }
492
- /** @deprecated */
493
- function __spreadArrays() {
494
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
495
- for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j];
496
- return r;
497
- }
498
- function __spreadArray(to, from, pack) {
499
- if (pack || arguments.length === 2) {
500
- for (var i = 0, l = from.length, ar; i < l; i++) if (ar || !(i in from)) {
501
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
502
- ar[i] = from[i];
503
- }
504
- }
505
- return to.concat(ar || Array.prototype.slice.call(from));
506
- }
507
- function __await(v) {
508
- return this instanceof __await ? (this.v = v, this) : new __await(v);
509
- }
510
- function __asyncGenerator(thisArg, _arguments, generator) {
511
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
512
- var g = generator.apply(thisArg, _arguments || []);
513
- var i;
514
- var q = [];
515
- return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() {
516
- return this;
517
- }, i;
518
- function awaitReturn(f) {
519
- return function(v) {
520
- return Promise.resolve(v).then(f, reject);
521
- };
522
- }
523
- function verb(n, f) {
524
- if (g[n]) {
525
- i[n] = function(v) {
526
- return new Promise(function(a, b) {
527
- q.push([
528
- n,
529
- v,
530
- a,
531
- b
532
- ]) > 1 || resume(n, v);
533
- });
534
- };
535
- if (f) i[n] = f(i[n]);
536
- }
537
- }
538
- function resume(n, v) {
539
- try {
540
- step(g[n](v));
541
- } catch (e) {
542
- settle(q[0][3], e);
543
- }
544
- }
545
- function step(r) {
546
- r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
547
- }
548
- function fulfill(value) {
549
- resume("next", value);
550
- }
551
- function reject(value) {
552
- resume("throw", value);
553
- }
554
- function settle(f, v) {
555
- if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);
556
- }
557
- }
558
- function __asyncDelegator(o) {
559
- var i;
560
- var p;
561
- return i = {}, verb("next"), verb("throw", function(e) {
562
- throw e;
563
- }), verb("return"), i[Symbol.iterator] = function() {
564
- return this;
565
- }, i;
566
- function verb(n, f) {
567
- i[n] = o[n] ? function(v) {
568
- return (p = !p) ? {
569
- value: __await(o[n](v)),
570
- done: false
571
- } : f ? f(v) : v;
572
- } : f;
573
- }
574
- }
575
- function __asyncValues(o) {
576
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
577
- var m = o[Symbol.asyncIterator];
578
- var i;
579
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
580
- return this;
581
- }, i);
582
- function verb(n) {
583
- i[n] = o[n] && function(v) {
584
- return new Promise(function(resolve, reject) {
585
- v = o[n](v), settle(resolve, reject, v.done, v.value);
586
- });
587
- };
588
- }
589
- function settle(resolve, reject, d, v) {
590
- Promise.resolve(v).then(function(v) {
591
- resolve({
592
- value: v,
593
- done: d
594
- });
595
- }, reject);
596
- }
597
- }
598
- function __makeTemplateObject(cooked, raw) {
599
- if (Object.defineProperty) Object.defineProperty(cooked, "raw", { value: raw });
600
- else cooked.raw = raw;
601
- return cooked;
602
- }
603
- function __importStar(mod) {
604
- if (mod && mod.__esModule) return mod;
605
- var result = {};
606
- if (mod != null) {
607
- for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
608
- }
609
- __setModuleDefault(result, mod);
610
- return result;
611
- }
612
- function __importDefault(mod) {
613
- return mod && mod.__esModule ? mod : { default: mod };
614
- }
615
- function __classPrivateFieldGet(receiver, state, kind, f) {
616
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
617
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
618
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
619
- }
620
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
621
- if (kind === "m") throw new TypeError("Private method is not writable");
622
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
623
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
624
- return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
625
- }
626
- function __classPrivateFieldIn(state, receiver) {
627
- if (receiver === null || typeof receiver !== "object" && typeof receiver !== "function") throw new TypeError("Cannot use 'in' operator on non-object");
628
- return typeof state === "function" ? receiver === state : state.has(receiver);
629
- }
630
- function __addDisposableResource(env, value, async) {
631
- if (value !== null && value !== void 0) {
632
- if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
633
- var dispose;
634
- var inner;
635
- if (async) {
636
- if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
637
- dispose = value[Symbol.asyncDispose];
638
- }
639
- if (dispose === void 0) {
640
- if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
641
- dispose = value[Symbol.dispose];
642
- if (async) inner = dispose;
643
- }
644
- if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
645
- if (inner) dispose = function() {
646
- try {
647
- inner.call(this);
648
- } catch (e) {
649
- return Promise.reject(e);
650
- }
651
- };
652
- env.stack.push({
653
- value,
654
- dispose,
655
- async
656
- });
657
- } else if (async) env.stack.push({ async: true });
658
- return value;
659
- }
660
- function __disposeResources(env) {
661
- function fail(e) {
662
- env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
663
- env.hasError = true;
664
- }
665
- var r;
666
- var s = 0;
667
- function next() {
668
- while (r = env.stack.pop()) try {
669
- if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
670
- if (r.dispose) {
671
- var result = r.dispose.call(r.value);
672
- if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) {
673
- fail(e);
674
- return next();
675
- });
676
- } else s |= 1;
677
- } catch (e) {
678
- fail(e);
679
- }
680
- if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
681
- if (env.hasError) throw env.error;
682
- }
683
- return next();
684
- }
685
- function __rewriteRelativeImportExtension(path, preserveJsx) {
686
- if (typeof path === "string" && /^\.\.?\//.test(path)) return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m, tsx, d, ext, cm) {
687
- return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : d + ext + "." + cm.toLowerCase() + "js";
688
- });
689
- return path;
690
- }
691
- var extendStatics, __assign, __createBinding, __setModuleDefault, ownKeys, _SuppressedError, tslib_es6_default;
692
- var init_tslib_es6 = __esmMin((() => {
693
- extendStatics = function(d, b) {
694
- extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d, b) {
695
- d.__proto__ = b;
696
- } || function(d, b) {
697
- for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
698
- };
699
- return extendStatics(d, b);
700
- };
701
- __assign = function() {
702
- __assign = Object.assign || function __assign(t) {
703
- for (var s, i = 1, n = arguments.length; i < n; i++) {
704
- s = arguments[i];
705
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
706
- }
707
- return t;
708
- };
709
- return __assign.apply(this, arguments);
710
- };
711
- __createBinding = Object.create ? (function(o, m, k, k2) {
712
- if (k2 === void 0) k2 = k;
713
- var desc = Object.getOwnPropertyDescriptor(m, k);
714
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
715
- enumerable: true,
716
- get: function() {
717
- return m[k];
718
- }
719
- };
720
- Object.defineProperty(o, k2, desc);
721
- }) : (function(o, m, k, k2) {
722
- if (k2 === void 0) k2 = k;
723
- o[k2] = m[k];
724
- });
725
- __setModuleDefault = Object.create ? (function(o, v) {
726
- Object.defineProperty(o, "default", {
727
- enumerable: true,
728
- value: v
729
- });
730
- }) : function(o, v) {
731
- o["default"] = v;
732
- };
733
- ownKeys = function(o) {
734
- ownKeys = Object.getOwnPropertyNames || function(o) {
735
- var ar = [];
736
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
737
- return ar;
738
- };
739
- return ownKeys(o);
740
- };
741
- _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
742
- var e = new Error(message);
743
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
744
- };
745
- tslib_es6_default = {
746
- __extends,
747
- __assign,
748
- __rest,
749
- __decorate,
750
- __param,
751
- __esDecorate,
752
- __runInitializers,
753
- __propKey,
754
- __setFunctionName,
755
- __metadata,
756
- __awaiter,
757
- __generator,
758
- __createBinding,
759
- __exportStar,
760
- __values,
761
- __read,
762
- __spread,
763
- __spreadArrays,
764
- __spreadArray,
765
- __await,
766
- __asyncGenerator,
767
- __asyncDelegator,
768
- __asyncValues,
769
- __makeTemplateObject,
770
- __importStar,
771
- __importDefault,
772
- __classPrivateFieldGet,
773
- __classPrivateFieldSet,
774
- __classPrivateFieldIn,
775
- __addDisposableResource,
776
- __disposeResources,
777
- __rewriteRelativeImportExtension
778
- };
779
- }));
780
- //#endregion
781
- //#region ../../node_modules/.pnpm/@stoplight+yaml-ast-parser@0.0.50/node_modules/@stoplight/yaml-ast-parser/dist/src/yamlAST.js
782
- var require_yamlAST = /* @__PURE__ */ __commonJSMin(((exports) => {
783
- Object.defineProperty(exports, "__esModule", { value: true });
784
- var Kind;
785
- (function(Kind) {
786
- Kind[Kind["SCALAR"] = 0] = "SCALAR";
787
- Kind[Kind["MAPPING"] = 1] = "MAPPING";
788
- Kind[Kind["MAP"] = 2] = "MAP";
789
- Kind[Kind["SEQ"] = 3] = "SEQ";
790
- Kind[Kind["ANCHOR_REF"] = 4] = "ANCHOR_REF";
791
- Kind[Kind["INCLUDE_REF"] = 5] = "INCLUDE_REF";
792
- })(Kind = exports.Kind || (exports.Kind = {}));
793
- function newMapping(key, value) {
794
- var end = value ? value.endPosition : key.endPosition + 1;
795
- return {
796
- key,
797
- value,
798
- startPosition: key.startPosition,
799
- endPosition: end,
800
- kind: Kind.MAPPING,
801
- parent: null,
802
- errors: []
803
- };
804
- }
805
- exports.newMapping = newMapping;
806
- function newAnchorRef(key, start, end, value) {
807
- return {
808
- errors: [],
809
- referencesAnchor: key,
810
- value,
811
- startPosition: start,
812
- endPosition: end,
813
- kind: Kind.ANCHOR_REF,
814
- parent: null
815
- };
816
- }
817
- exports.newAnchorRef = newAnchorRef;
818
- function newScalar(v = "") {
819
- const result = {
820
- errors: [],
821
- startPosition: -1,
822
- endPosition: -1,
823
- value: "" + v,
824
- kind: Kind.SCALAR,
825
- parent: null,
826
- doubleQuoted: false,
827
- rawValue: "" + v
828
- };
829
- if (typeof v !== "string") result.valueObject = v;
830
- return result;
831
- }
832
- exports.newScalar = newScalar;
833
- function newItems() {
834
- return {
835
- errors: [],
836
- startPosition: -1,
837
- endPosition: -1,
838
- items: [],
839
- kind: Kind.SEQ,
840
- parent: null
841
- };
842
- }
843
- exports.newItems = newItems;
844
- function newSeq() {
845
- return newItems();
846
- }
847
- exports.newSeq = newSeq;
848
- function newMap(mappings) {
849
- return {
850
- errors: [],
851
- startPosition: -1,
852
- endPosition: -1,
853
- mappings: mappings ? mappings : [],
854
- kind: Kind.MAP,
855
- parent: null
856
- };
857
- }
858
- exports.newMap = newMap;
859
- }));
860
- //#endregion
861
- //#region ../../node_modules/.pnpm/@stoplight+yaml-ast-parser@0.0.50/node_modules/@stoplight/yaml-ast-parser/dist/src/common.js
862
- var require_common = /* @__PURE__ */ __commonJSMin(((exports) => {
863
- Object.defineProperty(exports, "__esModule", { value: true });
864
- function isNothing(subject) {
865
- return typeof subject === "undefined" || null === subject;
866
- }
867
- exports.isNothing = isNothing;
868
- function isObject(subject) {
869
- return typeof subject === "object" && null !== subject;
870
- }
871
- exports.isObject = isObject;
872
- function toArray(sequence) {
873
- if (Array.isArray(sequence)) return sequence;
874
- else if (isNothing(sequence)) return [];
875
- return [sequence];
876
- }
877
- exports.toArray = toArray;
878
- function extend(target, source) {
879
- var index;
880
- var length;
881
- var key;
882
- var sourceKeys;
883
- if (source) {
884
- sourceKeys = Object.keys(source);
885
- for (index = 0, length = sourceKeys.length; index < length; index += 1) {
886
- key = sourceKeys[index];
887
- target[key] = source[key];
888
- }
889
- }
890
- return target;
891
- }
892
- exports.extend = extend;
893
- function repeat(string, count) {
894
- var result = "";
895
- var cycle;
896
- for (cycle = 0; cycle < count; cycle += 1) result += string;
897
- return result;
898
- }
899
- exports.repeat = repeat;
900
- function isNegativeZero(number) {
901
- return 0 === number && Number.NEGATIVE_INFINITY === 1 / number;
902
- }
903
- exports.isNegativeZero = isNegativeZero;
904
- }));
905
- //#endregion
906
- //#region ../../node_modules/.pnpm/@stoplight+yaml-ast-parser@0.0.50/node_modules/@stoplight/yaml-ast-parser/dist/src/exception.js
907
- var require_exception = /* @__PURE__ */ __commonJSMin(((exports, module) => {
908
- var YAMLException = class YAMLException {
909
- constructor(reason, mark = null, isWarning = false) {
910
- this.name = "YAMLException";
911
- this.reason = reason;
912
- this.mark = mark;
913
- this.message = this.toString(false);
914
- this.isWarning = isWarning;
915
- }
916
- static isInstance(instance) {
917
- if (instance != null && instance.getClassIdentifier && typeof instance.getClassIdentifier == "function") {
918
- for (let currentIdentifier of instance.getClassIdentifier()) if (currentIdentifier == YAMLException.CLASS_IDENTIFIER) return true;
919
- }
920
- return false;
921
- }
922
- getClassIdentifier() {
923
- return [].concat(YAMLException.CLASS_IDENTIFIER);
924
- }
925
- toString(compact = false) {
926
- var result = "JS-YAML: " + (this.reason || "(unknown reason)");
927
- if (!compact && this.mark) result += " " + this.mark.toString();
928
- return result;
929
- }
930
- };
931
- YAMLException.CLASS_IDENTIFIER = "yaml-ast-parser.YAMLException";
932
- module.exports = YAMLException;
933
- }));
934
- //#endregion
935
- //#region ../../node_modules/.pnpm/@stoplight+yaml-ast-parser@0.0.50/node_modules/@stoplight/yaml-ast-parser/dist/src/mark.js
936
- var require_mark = /* @__PURE__ */ __commonJSMin(((exports, module) => {
937
- const common = require_common();
938
- var Mark = class {
939
- constructor(name, buffer, position, line, column) {
940
- this.name = name;
941
- this.buffer = buffer;
942
- this.position = position;
943
- this.line = line;
944
- this.column = column;
945
- }
946
- getSnippet(indent = 0, maxLength = 75) {
947
- var head;
948
- var start;
949
- var tail;
950
- var end;
951
- var snippet;
952
- if (!this.buffer) return null;
953
- indent = indent || 4;
954
- maxLength = maxLength || 75;
955
- head = "";
956
- start = this.position;
957
- while (start > 0 && -1 === "\0\r\n…\u2028\u2029".indexOf(this.buffer.charAt(start - 1))) {
958
- start -= 1;
959
- if (this.position - start > maxLength / 2 - 1) {
960
- head = " ... ";
961
- start += 5;
962
- break;
963
- }
964
- }
965
- tail = "";
966
- end = this.position;
967
- while (end < this.buffer.length && -1 === "\0\r\n…\u2028\u2029".indexOf(this.buffer.charAt(end))) {
968
- end += 1;
969
- if (end - this.position > maxLength / 2 - 1) {
970
- tail = " ... ";
971
- end -= 5;
972
- break;
973
- }
974
- }
975
- snippet = this.buffer.slice(start, end);
976
- return common.repeat(" ", indent) + head + snippet + tail + "\n" + common.repeat(" ", indent + this.position - start + head.length) + "^";
977
- }
978
- toString(compact = true) {
979
- var snippet;
980
- var where = "";
981
- if (this.name) where += "in \"" + this.name + "\" ";
982
- where += "at line " + (this.line + 1) + ", column " + (this.column + 1);
983
- if (!compact) {
984
- snippet = this.getSnippet();
985
- if (snippet) where += ":\n" + snippet;
986
- }
987
- return where;
988
- }
989
- };
990
- module.exports = Mark;
991
- }));
992
- //#endregion
993
- //#region ../../node_modules/.pnpm/@stoplight+yaml-ast-parser@0.0.50/node_modules/@stoplight/yaml-ast-parser/dist/src/type.js
994
- var require_type = /* @__PURE__ */ __commonJSMin(((exports) => {
995
- Object.defineProperty(exports, "__esModule", { value: true });
996
- const YAMLException = require_exception();
997
- var TYPE_CONSTRUCTOR_OPTIONS = [
998
- "kind",
999
- "resolve",
1000
- "construct",
1001
- "instanceOf",
1002
- "predicate",
1003
- "represent",
1004
- "defaultStyle",
1005
- "styleAliases"
1006
- ];
1007
- var YAML_NODE_KINDS = [
1008
- "scalar",
1009
- "sequence",
1010
- "mapping"
1011
- ];
1012
- function compileStyleAliases(map) {
1013
- var result = {};
1014
- if (null !== map) Object.keys(map).forEach(function(style) {
1015
- map[style].forEach(function(alias) {
1016
- result[String(alias)] = style;
1017
- });
1018
- });
1019
- return result;
1020
- }
1021
- var Type = class {
1022
- constructor(tag, options) {
1023
- options = options || {};
1024
- Object.keys(options).forEach(function(name) {
1025
- if (-1 === TYPE_CONSTRUCTOR_OPTIONS.indexOf(name)) throw new YAMLException("Unknown option \"" + name + "\" is met in definition of \"" + tag + "\" YAML type.");
1026
- });
1027
- this.tag = tag;
1028
- this.kind = options["kind"] || null;
1029
- this.resolve = options["resolve"] || function() {
1030
- return true;
1031
- };
1032
- this.construct = options["construct"] || function(data) {
1033
- return data;
1034
- };
1035
- this.instanceOf = options["instanceOf"] || null;
1036
- this.predicate = options["predicate"] || null;
1037
- this.represent = options["represent"] || null;
1038
- this.defaultStyle = options["defaultStyle"] || null;
1039
- this.styleAliases = compileStyleAliases(options["styleAliases"] || null);
1040
- if (-1 === YAML_NODE_KINDS.indexOf(this.kind)) throw new YAMLException("Unknown kind \"" + this.kind + "\" is specified for \"" + tag + "\" YAML type.");
1041
- }
1042
- };
1043
- exports.Type = Type;
1044
- }));
1045
- //#endregion
1046
- //#region ../../node_modules/.pnpm/@stoplight+yaml-ast-parser@0.0.50/node_modules/@stoplight/yaml-ast-parser/dist/src/schema.js
1047
- var require_schema = /* @__PURE__ */ __commonJSMin(((exports) => {
1048
- Object.defineProperty(exports, "__esModule", { value: true });
1049
- const common = require_common();
1050
- const YAMLException = require_exception();
1051
- const type_1 = require_type();
1052
- function compileList(schema, name, result) {
1053
- var exclude = [];
1054
- schema.include.forEach(function(includedSchema) {
1055
- result = compileList(includedSchema, name, result);
1056
- });
1057
- schema[name].forEach(function(currentType) {
1058
- result.forEach(function(previousType, previousIndex) {
1059
- if (previousType.tag === currentType.tag) exclude.push(previousIndex);
1060
- });
1061
- result.push(currentType);
1062
- });
1063
- return result.filter(function(type, index) {
1064
- return -1 === exclude.indexOf(index);
1065
- });
1066
- }
1067
- function compileMap() {
1068
- var result = {};
1069
- var index;
1070
- var length;
1071
- function collectType(type) {
1072
- result[type.tag] = type;
1073
- }
1074
- for (index = 0, length = arguments.length; index < length; index += 1) arguments[index].forEach(collectType);
1075
- return result;
1076
- }
1077
- var Schema = class {
1078
- constructor(definition) {
1079
- this.include = definition.include || [];
1080
- this.implicit = definition.implicit || [];
1081
- this.explicit = definition.explicit || [];
1082
- this.implicit.forEach(function(type) {
1083
- if (type.loadKind && "scalar" !== type.loadKind) throw new YAMLException("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
1084
- });
1085
- this.compiledImplicit = compileList(this, "implicit", []);
1086
- this.compiledExplicit = compileList(this, "explicit", []);
1087
- this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit);
1088
- }
1089
- };
1090
- exports.Schema = Schema;
1091
- Schema.DEFAULT = null;
1092
- Schema.create = function createSchema() {
1093
- var schemas;
1094
- var types;
1095
- switch (arguments.length) {
1096
- case 1:
1097
- schemas = Schema.DEFAULT;
1098
- types = arguments[0];
1099
- break;
1100
- case 2:
1101
- schemas = arguments[0];
1102
- types = arguments[1];
1103
- break;
1104
- default: throw new YAMLException("Wrong number of arguments for Schema.create function");
1105
- }
1106
- schemas = common.toArray(schemas);
1107
- types = common.toArray(types);
1108
- if (!schemas.every(function(schema) {
1109
- return schema instanceof Schema;
1110
- })) throw new YAMLException("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");
1111
- if (!types.every(function(type) {
1112
- return type instanceof type_1.Type;
1113
- })) throw new YAMLException("Specified list of YAML types (or a single Type object) contains a non-Type object.");
1114
- return new Schema({
1115
- include: schemas,
1116
- explicit: types
1117
- });
1118
- };
1119
- }));
1120
- //#endregion
1121
- //#region ../../node_modules/.pnpm/@stoplight+yaml-ast-parser@0.0.50/node_modules/@stoplight/yaml-ast-parser/dist/src/type/str.js
1122
- var require_str = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1123
- module.exports = new (require_type()).Type("tag:yaml.org,2002:str", {
1124
- kind: "scalar",
1125
- construct: function(data) {
1126
- return null !== data ? data : "";
1127
- }
1128
- });
1129
- }));
1130
- //#endregion
1131
- //#region ../../node_modules/.pnpm/@stoplight+yaml-ast-parser@0.0.50/node_modules/@stoplight/yaml-ast-parser/dist/src/type/seq.js
1132
- var require_seq = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1133
- module.exports = new (require_type()).Type("tag:yaml.org,2002:seq", {
1134
- kind: "sequence",
1135
- construct: function(data) {
1136
- return null !== data ? data : [];
1137
- }
1138
- });
1139
- }));
1140
- //#endregion
1141
- //#region ../../node_modules/.pnpm/@stoplight+yaml-ast-parser@0.0.50/node_modules/@stoplight/yaml-ast-parser/dist/src/type/map.js
1142
- var require_map = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1143
- module.exports = new (require_type()).Type("tag:yaml.org,2002:map", {
1144
- kind: "mapping",
1145
- construct: function(data) {
1146
- return null !== data ? data : {};
1147
- }
1148
- });
1149
- }));
1150
- //#endregion
1151
- //#region ../../node_modules/.pnpm/@stoplight+yaml-ast-parser@0.0.50/node_modules/@stoplight/yaml-ast-parser/dist/src/schema/failsafe.js
1152
- var require_failsafe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1153
- module.exports = new (require_schema()).Schema({ explicit: [
1154
- require_str(),
1155
- require_seq(),
1156
- require_map()
1157
- ] });
1158
- }));
1159
- //#endregion
1160
- //#region ../../node_modules/.pnpm/@stoplight+yaml-ast-parser@0.0.50/node_modules/@stoplight/yaml-ast-parser/dist/src/type/null.js
1161
- var require_null = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1162
- const type_1 = require_type();
1163
- function resolveYamlNull(data) {
1164
- if (null === data) return true;
1165
- var max = data.length;
1166
- return max === 1 && data === "~" || max === 4 && (data === "null" || data === "Null" || data === "NULL");
1167
- }
1168
- function constructYamlNull() {
1169
- return null;
1170
- }
1171
- function isNull(object) {
1172
- return null === object;
1173
- }
1174
- module.exports = new type_1.Type("tag:yaml.org,2002:null", {
1175
- kind: "scalar",
1176
- resolve: resolveYamlNull,
1177
- construct: constructYamlNull,
1178
- predicate: isNull,
1179
- represent: {
1180
- canonical: function() {
1181
- return "~";
1182
- },
1183
- lowercase: function() {
1184
- return "null";
1185
- },
1186
- uppercase: function() {
1187
- return "NULL";
1188
- },
1189
- camelcase: function() {
1190
- return "Null";
1191
- }
1192
- },
1193
- defaultStyle: "lowercase"
1194
- });
1195
- }));
1196
- //#endregion
1197
- //#region ../../node_modules/.pnpm/@stoplight+yaml-ast-parser@0.0.50/node_modules/@stoplight/yaml-ast-parser/dist/src/type/bool.js
1198
- var require_bool = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1199
- const type_1 = require_type();
1200
- function resolveYamlBoolean(data) {
1201
- if (null === data) return false;
1202
- var max = data.length;
1203
- return max === 4 && (data === "true" || data === "True" || data === "TRUE") || max === 5 && (data === "false" || data === "False" || data === "FALSE");
1204
- }
1205
- function constructYamlBoolean(data) {
1206
- return data === "true" || data === "True" || data === "TRUE";
1207
- }
1208
- function isBoolean(object) {
1209
- return "[object Boolean]" === Object.prototype.toString.call(object);
1210
- }
1211
- module.exports = new type_1.Type("tag:yaml.org,2002:bool", {
1212
- kind: "scalar",
1213
- resolve: resolveYamlBoolean,
1214
- construct: constructYamlBoolean,
1215
- predicate: isBoolean,
1216
- represent: {
1217
- lowercase: function(object) {
1218
- return object ? "true" : "false";
1219
- },
1220
- uppercase: function(object) {
1221
- return object ? "TRUE" : "FALSE";
1222
- },
1223
- camelcase: function(object) {
1224
- return object ? "True" : "False";
1225
- }
1226
- },
1227
- defaultStyle: "lowercase"
1228
- });
1229
- }));
1230
- //#endregion
1231
- //#region ../../node_modules/.pnpm/@stoplight+yaml-ast-parser@0.0.50/node_modules/@stoplight/yaml-ast-parser/dist/src/type/int.js
1232
- var require_int = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1233
- const common = require_common();
1234
- const type_1 = require_type();
1235
- function isHexCode(c) {
1236
- return 48 <= c && c <= 57 || 65 <= c && c <= 70 || 97 <= c && c <= 102;
1237
- }
1238
- function isOctCode(c) {
1239
- return 48 <= c && c <= 55;
1240
- }
1241
- function isDecCode(c) {
1242
- return 48 <= c && c <= 57;
1243
- }
1244
- function resolveYamlInteger(data) {
1245
- if (null === data) return false;
1246
- var max = data.length;
1247
- var index = 0;
1248
- var hasDigits = false;
1249
- var ch;
1250
- if (!max) return false;
1251
- ch = data[index];
1252
- if (ch === "-" || ch === "+") ch = data[++index];
1253
- if (ch === "0") {
1254
- if (index + 1 === max) return true;
1255
- ch = data[++index];
1256
- if (ch === "b") {
1257
- index++;
1258
- for (; index < max; index++) {
1259
- ch = data[index];
1260
- if (ch === "_") continue;
1261
- if (ch !== "0" && ch !== "1") return false;
1262
- hasDigits = true;
1263
- }
1264
- return hasDigits;
1265
- }
1266
- if (ch === "x") {
1267
- index++;
1268
- for (; index < max; index++) {
1269
- ch = data[index];
1270
- if (ch === "_") continue;
1271
- if (!isHexCode(data.charCodeAt(index))) return false;
1272
- hasDigits = true;
1273
- }
1274
- return hasDigits;
1275
- }
1276
- for (; index < max; index++) {
1277
- ch = data[index];
1278
- if (ch === "_") continue;
1279
- if (!isOctCode(data.charCodeAt(index))) {
1280
- hasDigits = false;
1281
- break;
1282
- }
1283
- hasDigits = true;
1284
- }
1285
- if (hasDigits) return hasDigits;
1286
- }
1287
- for (; index < max; index++) {
1288
- ch = data[index];
1289
- if (ch === "_") continue;
1290
- if (ch === ":") break;
1291
- if (!isDecCode(data.charCodeAt(index))) return false;
1292
- hasDigits = true;
1293
- }
1294
- if (!hasDigits) return false;
1295
- if (ch !== ":") return true;
1296
- return /^(:[0-5]?[0-9])+$/.test(data.slice(index));
1297
- }
1298
- function constructYamlInteger(data) {
1299
- var value = data;
1300
- var sign = 1;
1301
- var ch;
1302
- var base;
1303
- var digits = [];
1304
- if (value.indexOf("_") !== -1) value = value.replace(/_/g, "");
1305
- ch = value[0];
1306
- if (ch === "-" || ch === "+") {
1307
- if (ch === "-") sign = -1;
1308
- value = value.slice(1);
1309
- ch = value[0];
1310
- }
1311
- if ("0" === value) return 0;
1312
- if (ch === "0") {
1313
- if (value[1] === "b") return sign * parseInt(value.slice(2), 2);
1314
- if (value[1] === "x") return sign * parseInt(value, 16);
1315
- return sign * parseInt(value, 8);
1316
- }
1317
- if (value.indexOf(":") !== -1) {
1318
- value.split(":").forEach(function(v) {
1319
- digits.unshift(parseInt(v, 10));
1320
- });
1321
- value = 0;
1322
- base = 1;
1323
- digits.forEach(function(d) {
1324
- value += d * base;
1325
- base *= 60;
1326
- });
1327
- return sign * value;
1328
- }
1329
- return sign * parseInt(value, 10);
1330
- }
1331
- function isInteger(object) {
1332
- const type = Object.prototype.toString.call(object);
1333
- return "[object Number]" === type && 0 === object % 1 && !common.isNegativeZero(object) || "[object BigInt]" === type;
1334
- }
1335
- module.exports = new type_1.Type("tag:yaml.org,2002:int", {
1336
- kind: "scalar",
1337
- resolve: resolveYamlInteger,
1338
- construct: constructYamlInteger,
1339
- predicate: isInteger,
1340
- represent: {
1341
- binary: function(object) {
1342
- return "0b" + object.toString(2);
1343
- },
1344
- octal: function(object) {
1345
- return "0" + object.toString(8);
1346
- },
1347
- decimal: function(object) {
1348
- return object.toString(10);
1349
- },
1350
- hexadecimal: function(object) {
1351
- return "0x" + object.toString(16).toUpperCase();
1352
- }
1353
- },
1354
- defaultStyle: "decimal",
1355
- styleAliases: {
1356
- binary: [2, "bin"],
1357
- octal: [8, "oct"],
1358
- decimal: [10, "dec"],
1359
- hexadecimal: [16, "hex"]
1360
- }
1361
- });
1362
- }));
1363
- //#endregion
1364
- //#region ../../node_modules/.pnpm/@stoplight+yaml-ast-parser@0.0.50/node_modules/@stoplight/yaml-ast-parser/dist/src/type/float.js
1365
- var require_float = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1366
- const common = require_common();
1367
- const type_1 = require_type();
1368
- var YAML_FLOAT_PATTERN = /* @__PURE__ */ new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
1369
- function resolveYamlFloat(data) {
1370
- if (null === data) return false;
1371
- if (!YAML_FLOAT_PATTERN.test(data)) return false;
1372
- return true;
1373
- }
1374
- function constructYamlFloat(data) {
1375
- var value = data.replace(/_/g, "").toLowerCase();
1376
- var sign = "-" === value[0] ? -1 : 1;
1377
- var base;
1378
- var digits = [];
1379
- if (0 <= "+-".indexOf(value[0])) value = value.slice(1);
1380
- if (".inf" === value) return 1 === sign ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
1381
- else if (".nan" === value) return NaN;
1382
- else if (0 <= value.indexOf(":")) {
1383
- value.split(":").forEach(function(v) {
1384
- digits.unshift(parseFloat(v, 10));
1385
- });
1386
- value = 0;
1387
- base = 1;
1388
- digits.forEach(function(d) {
1389
- value += d * base;
1390
- base *= 60;
1391
- });
1392
- return sign * value;
1393
- }
1394
- return sign * parseFloat(value, 10);
1395
- }
1396
- function representYamlFloat(object, style) {
1397
- if (isNaN(object)) switch (style) {
1398
- case "lowercase": return ".nan";
1399
- case "uppercase": return ".NAN";
1400
- case "camelcase": return ".NaN";
1401
- }
1402
- else if (Number.POSITIVE_INFINITY === object) switch (style) {
1403
- case "lowercase": return ".inf";
1404
- case "uppercase": return ".INF";
1405
- case "camelcase": return ".Inf";
1406
- }
1407
- else if (Number.NEGATIVE_INFINITY === object) switch (style) {
1408
- case "lowercase": return "-.inf";
1409
- case "uppercase": return "-.INF";
1410
- case "camelcase": return "-.Inf";
1411
- }
1412
- else if (common.isNegativeZero(object)) return "-0.0";
1413
- return object.toString(10);
1414
- }
1415
- function isFloat(object) {
1416
- return "[object Number]" === Object.prototype.toString.call(object) && (0 !== object % 1 || common.isNegativeZero(object));
1417
- }
1418
- module.exports = new type_1.Type("tag:yaml.org,2002:float", {
1419
- kind: "scalar",
1420
- resolve: resolveYamlFloat,
1421
- construct: constructYamlFloat,
1422
- predicate: isFloat,
1423
- represent: representYamlFloat,
1424
- defaultStyle: "lowercase"
1425
- });
1426
- }));
1427
- //#endregion
1428
- //#region ../../node_modules/.pnpm/@stoplight+yaml-ast-parser@0.0.50/node_modules/@stoplight/yaml-ast-parser/dist/src/schema/json.js
1429
- var require_json = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1430
- module.exports = new (require_schema()).Schema({
1431
- include: [require_failsafe()],
1432
- implicit: [
1433
- require_null(),
1434
- require_bool(),
1435
- require_int(),
1436
- require_float()
1437
- ]
1438
- });
1439
- }));
1440
- //#endregion
1441
- //#region ../../node_modules/.pnpm/@stoplight+yaml-ast-parser@0.0.50/node_modules/@stoplight/yaml-ast-parser/dist/src/schema/core.js
1442
- var require_core = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1443
- module.exports = new (require_schema()).Schema({ include: [require_json()] });
1444
- }));
1445
- //#endregion
1446
- //#region ../../node_modules/.pnpm/@stoplight+yaml-ast-parser@0.0.50/node_modules/@stoplight/yaml-ast-parser/dist/src/type/timestamp.js
1447
- var require_timestamp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1448
- const type_1 = require_type();
1449
- var YAML_TIMESTAMP_REGEXP = /* @__PURE__ */ new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?)?$");
1450
- function resolveYamlTimestamp(data) {
1451
- if (null === data) return false;
1452
- if (null === YAML_TIMESTAMP_REGEXP.exec(data)) return false;
1453
- return true;
1454
- }
1455
- function constructYamlTimestamp(data) {
1456
- var match;
1457
- var year;
1458
- var month;
1459
- var day;
1460
- var hour;
1461
- var minute;
1462
- var second;
1463
- var fraction = 0;
1464
- var delta = null;
1465
- var tz_hour;
1466
- var tz_minute;
1467
- var date;
1468
- match = YAML_TIMESTAMP_REGEXP.exec(data);
1469
- if (null === match) throw new Error("Date resolve error");
1470
- year = +match[1];
1471
- month = +match[2] - 1;
1472
- day = +match[3];
1473
- if (!match[4]) return new Date(Date.UTC(year, month, day));
1474
- hour = +match[4];
1475
- minute = +match[5];
1476
- second = +match[6];
1477
- if (match[7]) {
1478
- fraction = match[7].slice(0, 3);
1479
- while (fraction.length < 3) fraction = fraction + "0";
1480
- fraction = +fraction;
1481
- }
1482
- if (match[9]) {
1483
- tz_hour = +match[10];
1484
- tz_minute = +(match[11] || 0);
1485
- delta = (tz_hour * 60 + tz_minute) * 6e4;
1486
- if ("-" === match[9]) delta = -delta;
1487
- }
1488
- date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
1489
- if (delta) date.setTime(date.getTime() - delta);
1490
- return date;
1491
- }
1492
- function representYamlTimestamp(object) {
1493
- return object.toISOString();
1494
- }
1495
- module.exports = new type_1.Type("tag:yaml.org,2002:timestamp", {
1496
- kind: "scalar",
1497
- resolve: resolveYamlTimestamp,
1498
- construct: constructYamlTimestamp,
1499
- instanceOf: Date,
1500
- represent: representYamlTimestamp
1501
- });
1502
- }));
1503
- //#endregion
1504
- //#region ../../node_modules/.pnpm/@stoplight+yaml-ast-parser@0.0.50/node_modules/@stoplight/yaml-ast-parser/dist/src/type/merge.js
1505
- var require_merge = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1506
- const type_1 = require_type();
1507
- function resolveYamlMerge(data) {
1508
- return "<<" === data || null === data;
1509
- }
1510
- module.exports = new type_1.Type("tag:yaml.org,2002:merge", {
1511
- kind: "scalar",
1512
- resolve: resolveYamlMerge
1513
- });
1514
- }));
1515
- //#endregion
1516
- //#region ../../node_modules/.pnpm/@stoplight+yaml-ast-parser@0.0.50/node_modules/@stoplight/yaml-ast-parser/dist/src/type/binary.js
1517
- var require_binary = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1518
- var NodeBuffer = require("buffer").Buffer;
1519
- const type_1 = require_type();
1520
- var BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
1521
- function resolveYamlBinary(data) {
1522
- if (null === data) return false;
1523
- var code;
1524
- var idx;
1525
- var bitlen = 0;
1526
- var max = data.length;
1527
- var map = BASE64_MAP;
1528
- for (idx = 0; idx < max; idx++) {
1529
- code = map.indexOf(data.charAt(idx));
1530
- if (code > 64) continue;
1531
- if (code < 0) return false;
1532
- bitlen += 6;
1533
- }
1534
- return bitlen % 8 === 0;
1535
- }
1536
- function constructYamlBinary(data) {
1537
- var idx;
1538
- var tailbits;
1539
- var input = data.replace(/[\r\n=]/g, "");
1540
- var max = input.length;
1541
- var map = BASE64_MAP;
1542
- var bits = 0;
1543
- var result = [];
1544
- for (idx = 0; idx < max; idx++) {
1545
- if (idx % 4 === 0 && idx) {
1546
- result.push(bits >> 16 & 255);
1547
- result.push(bits >> 8 & 255);
1548
- result.push(bits & 255);
1549
- }
1550
- bits = bits << 6 | map.indexOf(input.charAt(idx));
1551
- }
1552
- tailbits = max % 4 * 6;
1553
- if (tailbits === 0) {
1554
- result.push(bits >> 16 & 255);
1555
- result.push(bits >> 8 & 255);
1556
- result.push(bits & 255);
1557
- } else if (tailbits === 18) {
1558
- result.push(bits >> 10 & 255);
1559
- result.push(bits >> 2 & 255);
1560
- } else if (tailbits === 12) result.push(bits >> 4 & 255);
1561
- if (NodeBuffer) return new NodeBuffer(result);
1562
- return result;
1563
- }
1564
- function representYamlBinary(object) {
1565
- var result = "";
1566
- var bits = 0;
1567
- var idx;
1568
- var tail;
1569
- var max = object.length;
1570
- var map = BASE64_MAP;
1571
- for (idx = 0; idx < max; idx++) {
1572
- if (idx % 3 === 0 && idx) {
1573
- result += map[bits >> 18 & 63];
1574
- result += map[bits >> 12 & 63];
1575
- result += map[bits >> 6 & 63];
1576
- result += map[bits & 63];
1577
- }
1578
- bits = (bits << 8) + object[idx];
1579
- }
1580
- tail = max % 3;
1581
- if (tail === 0) {
1582
- result += map[bits >> 18 & 63];
1583
- result += map[bits >> 12 & 63];
1584
- result += map[bits >> 6 & 63];
1585
- result += map[bits & 63];
1586
- } else if (tail === 2) {
1587
- result += map[bits >> 10 & 63];
1588
- result += map[bits >> 4 & 63];
1589
- result += map[bits << 2 & 63];
1590
- result += map[64];
1591
- } else if (tail === 1) {
1592
- result += map[bits >> 2 & 63];
1593
- result += map[bits << 4 & 63];
1594
- result += map[64];
1595
- result += map[64];
1596
- }
1597
- return result;
1598
- }
1599
- function isBinary(object) {
1600
- return NodeBuffer && NodeBuffer.isBuffer(object);
1601
- }
1602
- module.exports = new type_1.Type("tag:yaml.org,2002:binary", {
1603
- kind: "scalar",
1604
- resolve: resolveYamlBinary,
1605
- construct: constructYamlBinary,
1606
- predicate: isBinary,
1607
- represent: representYamlBinary
1608
- });
1609
- }));
1610
- //#endregion
1611
- //#region ../../node_modules/.pnpm/@stoplight+yaml-ast-parser@0.0.50/node_modules/@stoplight/yaml-ast-parser/dist/src/type/omap.js
1612
- var require_omap = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1613
- const type_1 = require_type();
1614
- var _hasOwnProperty = Object.prototype.hasOwnProperty;
1615
- var _toString = Object.prototype.toString;
1616
- function resolveYamlOmap(data) {
1617
- if (null === data) return true;
1618
- var objectKeys = [];
1619
- var index;
1620
- var length;
1621
- var pair;
1622
- var pairKey;
1623
- var pairHasKey;
1624
- var object = data;
1625
- for (index = 0, length = object.length; index < length; index += 1) {
1626
- pair = object[index];
1627
- pairHasKey = false;
1628
- if ("[object Object]" !== _toString.call(pair)) return false;
1629
- for (pairKey in pair) if (_hasOwnProperty.call(pair, pairKey)) if (!pairHasKey) pairHasKey = true;
1630
- else return false;
1631
- if (!pairHasKey) return false;
1632
- if (-1 === objectKeys.indexOf(pairKey)) objectKeys.push(pairKey);
1633
- else return false;
1634
- }
1635
- return true;
1636
- }
1637
- function constructYamlOmap(data) {
1638
- return null !== data ? data : [];
1639
- }
1640
- module.exports = new type_1.Type("tag:yaml.org,2002:omap", {
1641
- kind: "sequence",
1642
- resolve: resolveYamlOmap,
1643
- construct: constructYamlOmap
1644
- });
1645
- }));
1646
- //#endregion
1647
- //#region ../../node_modules/.pnpm/@stoplight+yaml-ast-parser@0.0.50/node_modules/@stoplight/yaml-ast-parser/dist/src/type/pairs.js
1648
- var require_pairs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1649
- const type_1 = require_type();
1650
- const ast = require_yamlAST();
1651
- var _toString = Object.prototype.toString;
1652
- function resolveYamlPairs(data) {
1653
- if (null === data) return true;
1654
- if (data.kind != ast.Kind.SEQ) return false;
1655
- var index;
1656
- var length;
1657
- var pair;
1658
- var object = data.items;
1659
- for (index = 0, length = object.length; index < length; index += 1) {
1660
- pair = object[index];
1661
- if ("[object Object]" !== _toString.call(pair)) return false;
1662
- if (!Array.isArray(pair.mappings)) return false;
1663
- if (1 !== pair.mappings.length) return false;
1664
- }
1665
- return true;
1666
- }
1667
- function constructYamlPairs(data) {
1668
- if (null === data || !Array.isArray(data.items)) return [];
1669
- let index;
1670
- let length;
1671
- let result;
1672
- let object = data.items;
1673
- result = ast.newItems();
1674
- result.parent = data.parent;
1675
- result.startPosition = data.startPosition;
1676
- result.endPosition = data.endPosition;
1677
- for (index = 0, length = object.length; index < length; index += 1) {
1678
- let mapping = object[index].mappings[0];
1679
- let pairSeq = ast.newItems();
1680
- pairSeq.parent = result;
1681
- pairSeq.startPosition = mapping.key.startPosition;
1682
- pairSeq.endPosition = mapping.value.startPosition;
1683
- mapping.key.parent = pairSeq;
1684
- mapping.value.parent = pairSeq;
1685
- pairSeq.items = [mapping.key, mapping.value];
1686
- result.items.push(pairSeq);
1687
- }
1688
- return result;
1689
- }
1690
- module.exports = new type_1.Type("tag:yaml.org,2002:pairs", {
1691
- kind: "sequence",
1692
- resolve: resolveYamlPairs,
1693
- construct: constructYamlPairs
1694
- });
1695
- }));
1696
- //#endregion
1697
- //#region ../../node_modules/.pnpm/@stoplight+yaml-ast-parser@0.0.50/node_modules/@stoplight/yaml-ast-parser/dist/src/type/set.js
1698
- var require_set = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1699
- const type_1 = require_type();
1700
- const ast = require_yamlAST();
1701
- function resolveYamlSet(data) {
1702
- if (null === data) return true;
1703
- if (data.kind != ast.Kind.MAP) return false;
1704
- return true;
1705
- }
1706
- function constructYamlSet(data) {
1707
- return null !== data ? data : {};
1708
- }
1709
- module.exports = new type_1.Type("tag:yaml.org,2002:set", {
1710
- kind: "mapping",
1711
- resolve: resolveYamlSet,
1712
- construct: constructYamlSet
1713
- });
1714
- }));
1715
- //#endregion
1716
- //#region ../../node_modules/.pnpm/@stoplight+yaml-ast-parser@0.0.50/node_modules/@stoplight/yaml-ast-parser/dist/src/schema/default_safe.js
1717
- var require_default_safe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1718
- module.exports = new (require_schema()).Schema({
1719
- include: [require_core()],
1720
- implicit: [require_timestamp(), require_merge()],
1721
- explicit: [
1722
- require_binary(),
1723
- require_omap(),
1724
- require_pairs(),
1725
- require_set()
1726
- ]
1727
- });
1728
- }));
1729
- //#endregion
1730
- //#region ../../node_modules/.pnpm/@stoplight+yaml-ast-parser@0.0.50/node_modules/@stoplight/yaml-ast-parser/dist/src/type/js/undefined.js
1731
- var require_undefined = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1732
- const type_1 = require_type();
1733
- function resolveJavascriptUndefined() {
1734
- return true;
1735
- }
1736
- function constructJavascriptUndefined() {}
1737
- function representJavascriptUndefined() {
1738
- return "";
1739
- }
1740
- function isUndefined(object) {
1741
- return "undefined" === typeof object;
1742
- }
1743
- module.exports = new type_1.Type("tag:yaml.org,2002:js/undefined", {
1744
- kind: "scalar",
1745
- resolve: resolveJavascriptUndefined,
1746
- construct: constructJavascriptUndefined,
1747
- predicate: isUndefined,
1748
- represent: representJavascriptUndefined
1749
- });
1750
- }));
1751
- //#endregion
1752
- //#region ../../node_modules/.pnpm/@stoplight+yaml-ast-parser@0.0.50/node_modules/@stoplight/yaml-ast-parser/dist/src/type/js/regexp.js
1753
- var require_regexp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1754
- const type_1 = require_type();
1755
- function resolveJavascriptRegExp(data) {
1756
- if (null === data) return false;
1757
- if (0 === data.length) return false;
1758
- var regexp = data;
1759
- var tail = /\/([gim]*)$/.exec(data);
1760
- var modifiers = "";
1761
- if ("/" === regexp[0]) {
1762
- if (tail) modifiers = tail[1];
1763
- if (modifiers.length > 3) return false;
1764
- if (regexp[regexp.length - modifiers.length - 1] !== "/") return false;
1765
- regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
1766
- }
1767
- try {
1768
- new RegExp(regexp, modifiers);
1769
- return true;
1770
- } catch (error) {
1771
- return false;
1772
- }
1773
- }
1774
- function constructJavascriptRegExp(data) {
1775
- var regexp = data;
1776
- var tail = /\/([gim]*)$/.exec(data);
1777
- var modifiers = "";
1778
- if ("/" === regexp[0]) {
1779
- if (tail) modifiers = tail[1];
1780
- regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
1781
- }
1782
- return new RegExp(regexp, modifiers);
1783
- }
1784
- function representJavascriptRegExp(object) {
1785
- var result = "/" + object.source + "/";
1786
- if (object.global) result += "g";
1787
- if (object.multiline) result += "m";
1788
- if (object.ignoreCase) result += "i";
1789
- return result;
1790
- }
1791
- function isRegExp(object) {
1792
- return "[object RegExp]" === Object.prototype.toString.call(object);
1793
- }
1794
- module.exports = new type_1.Type("tag:yaml.org,2002:js/regexp", {
1795
- kind: "scalar",
1796
- resolve: resolveJavascriptRegExp,
1797
- construct: constructJavascriptRegExp,
1798
- predicate: isRegExp,
1799
- represent: representJavascriptRegExp
1800
- });
1801
- }));
1802
- //#endregion
1803
- //#region ../../node_modules/.pnpm/@stoplight+yaml-ast-parser@0.0.50/node_modules/@stoplight/yaml-ast-parser/dist/src/schema/default_full.js
1804
- var require_default_full = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1805
- const schema_1 = require_schema();
1806
- var schema = new schema_1.Schema({
1807
- include: [require_default_safe()],
1808
- explicit: [require_undefined(), require_regexp()]
1809
- });
1810
- schema_1.Schema.DEFAULT = schema;
1811
- module.exports = schema;
1812
- }));
1813
- //#endregion
1814
- //#region ../../node_modules/.pnpm/@stoplight+yaml-ast-parser@0.0.50/node_modules/@stoplight/yaml-ast-parser/dist/src/loader.js
1815
- var require_loader = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1816
- Object.defineProperty(exports, "__esModule", { value: true });
1817
- const ast = require_yamlAST();
1818
- const common = require_common();
1819
- const YAMLException = require_exception();
1820
- const Mark = require_mark();
1821
- const DEFAULT_SAFE_SCHEMA = require_default_safe();
1822
- const DEFAULT_FULL_SCHEMA = require_default_full();
1823
- var _hasOwnProperty = Object.prototype.hasOwnProperty;
1824
- var CONTEXT_FLOW_IN = 1;
1825
- var CONTEXT_FLOW_OUT = 2;
1826
- var CONTEXT_BLOCK_IN = 3;
1827
- var CONTEXT_BLOCK_OUT = 4;
1828
- var CHOMPING_CLIP = 1;
1829
- var CHOMPING_STRIP = 2;
1830
- var CHOMPING_KEEP = 3;
1831
- var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
1832
- var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
1833
- var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
1834
- var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
1835
- var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
1836
- function is_EOL(c) {
1837
- return c === 10 || c === 13;
1838
- }
1839
- function is_WHITE_SPACE(c) {
1840
- return c === 9 || c === 32;
1841
- }
1842
- function is_WS_OR_EOL(c) {
1843
- return c === 9 || c === 32 || c === 10 || c === 13;
1844
- }
1845
- function is_FLOW_INDICATOR(c) {
1846
- return 44 === c || 91 === c || 93 === c || 123 === c || 125 === c;
1847
- }
1848
- function fromHexCode(c) {
1849
- var lc;
1850
- if (48 <= c && c <= 57) return c - 48;
1851
- lc = c | 32;
1852
- if (97 <= lc && lc <= 102) return lc - 97 + 10;
1853
- return -1;
1854
- }
1855
- function escapedHexLen(c) {
1856
- if (c === 120) return 2;
1857
- if (c === 117) return 4;
1858
- if (c === 85) return 8;
1859
- return 0;
1860
- }
1861
- function fromDecimalCode(c) {
1862
- if (48 <= c && c <= 57) return c - 48;
1863
- return -1;
1864
- }
1865
- function simpleEscapeSequence(c) {
1866
- return c === 48 ? "\0" : c === 97 ? "\x07" : c === 98 ? "\b" : c === 116 ? " " : c === 9 ? " " : c === 110 ? "\n" : c === 118 ? "\v" : c === 102 ? "\f" : c === 114 ? "\r" : c === 101 ? "\x1B" : c === 32 ? " " : c === 34 ? "\"" : c === 47 ? "/" : c === 92 ? "\\" : c === 78 ? "…" : c === 95 ? "\xA0" : c === 76 ? "\u2028" : c === 80 ? "\u2029" : "";
1867
- }
1868
- function charFromCodepoint(c) {
1869
- if (c <= 65535) return String.fromCharCode(c);
1870
- return String.fromCharCode((c - 65536 >> 10) + 55296, (c - 65536 & 1023) + 56320);
1871
- }
1872
- var simpleEscapeCheck = new Array(256);
1873
- var simpleEscapeMap = new Array(256);
1874
- var customEscapeCheck = new Array(256);
1875
- var customEscapeMap = new Array(256);
1876
- for (var i = 0; i < 256; i++) {
1877
- customEscapeMap[i] = simpleEscapeMap[i] = simpleEscapeSequence(i);
1878
- simpleEscapeCheck[i] = simpleEscapeMap[i] ? 1 : 0;
1879
- customEscapeCheck[i] = 1;
1880
- if (!simpleEscapeCheck[i]) customEscapeMap[i] = "\\" + String.fromCharCode(i);
1881
- }
1882
- var State = class {
1883
- constructor(input, options) {
1884
- this.errorMap = {};
1885
- this.errors = [];
1886
- this.lines = [];
1887
- this.input = input;
1888
- this.filename = options["filename"] || null;
1889
- this.schema = options["schema"] || DEFAULT_FULL_SCHEMA;
1890
- this.onWarning = options["onWarning"] || null;
1891
- this.legacy = options["legacy"] || false;
1892
- this.allowAnyEscape = options["allowAnyEscape"] || false;
1893
- this.ignoreDuplicateKeys = options["ignoreDuplicateKeys"] || false;
1894
- this.implicitTypes = this.schema.compiledImplicit;
1895
- this.typeMap = this.schema.compiledTypeMap;
1896
- this.length = input.length;
1897
- this.position = 0;
1898
- this.line = 0;
1899
- this.lineStart = 0;
1900
- this.lineIndent = 0;
1901
- this.documents = [];
1902
- }
1903
- };
1904
- function generateError(state, message, isWarning = false) {
1905
- return new YAMLException(message, new Mark(state.filename, state.input, state.position, state.line, state.position - state.lineStart), isWarning);
1906
- }
1907
- function throwErrorFromPosition(state, position, message, isWarning = false, toLineEnd = false) {
1908
- var line = positionToLine(state, position);
1909
- if (!line) return;
1910
- var hash = message + position;
1911
- if (state.errorMap[hash]) return;
1912
- var mark = new Mark(state.filename, state.input, position, line.line, position - line.start);
1913
- if (toLineEnd) mark.toLineEnd = true;
1914
- var error = new YAMLException(message, mark, isWarning);
1915
- state.errors.push(error);
1916
- }
1917
- function throwError(state, message) {
1918
- var error = generateError(state, message);
1919
- var hash = error.message + error.mark.position;
1920
- if (state.errorMap[hash]) return;
1921
- state.errors.push(error);
1922
- state.errorMap[hash] = 1;
1923
- var or = state.position;
1924
- while (true) {
1925
- if (state.position >= state.input.length - 1) return;
1926
- var c = state.input.charAt(state.position);
1927
- if (c == "\n") {
1928
- state.position--;
1929
- if (state.position == or) state.position += 1;
1930
- return;
1931
- }
1932
- if (c == "\r") {
1933
- state.position--;
1934
- if (state.position == or) state.position += 1;
1935
- return;
1936
- }
1937
- state.position++;
1938
- }
1939
- }
1940
- function throwWarning(state, message) {
1941
- var error = generateError(state, message);
1942
- if (state.onWarning) state.onWarning.call(null, error);
1943
- }
1944
- var directiveHandlers = {
1945
- YAML: function handleYamlDirective(state, name, args) {
1946
- var match;
1947
- var major;
1948
- var minor;
1949
- if (null !== state.version) throwError(state, "duplication of %YAML directive");
1950
- if (1 !== args.length) throwError(state, "YAML directive accepts exactly one argument");
1951
- match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
1952
- if (null === match) throwError(state, "ill-formed argument of the YAML directive");
1953
- major = parseInt(match[1], 10);
1954
- minor = parseInt(match[2], 10);
1955
- if (1 !== major) throwError(state, "found incompatible YAML document (version 1.2 is required)");
1956
- state.version = args[0];
1957
- state.checkLineBreaks = minor < 2;
1958
- if (2 !== minor) throwError(state, "found incompatible YAML document (version 1.2 is required)");
1959
- },
1960
- TAG: function handleTagDirective(state, name, args) {
1961
- var handle;
1962
- var prefix;
1963
- if (2 !== args.length) throwError(state, "TAG directive accepts exactly two arguments");
1964
- handle = args[0];
1965
- prefix = args[1];
1966
- if (!PATTERN_TAG_HANDLE.test(handle)) throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
1967
- if (_hasOwnProperty.call(state.tagMap, handle)) throwError(state, "there is a previously declared suffix for \"" + handle + "\" tag handle");
1968
- if (!PATTERN_TAG_URI.test(prefix)) throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
1969
- state.tagMap[handle] = prefix;
1970
- }
1971
- };
1972
- function captureSegment(state, start, end, checkJson) {
1973
- var _position;
1974
- var _length;
1975
- var _character;
1976
- var _result;
1977
- var scalar = state.result;
1978
- if (scalar.startPosition == -1) scalar.startPosition = start;
1979
- if (start <= end) {
1980
- _result = state.input.slice(start, end);
1981
- if (checkJson) for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
1982
- _character = _result.charCodeAt(_position);
1983
- if (!(9 === _character || 32 <= _character && _character <= 1114111)) throwError(state, "expected valid JSON character");
1984
- }
1985
- else if (PATTERN_NON_PRINTABLE.test(_result)) throwError(state, "the stream contains non-printable characters");
1986
- scalar.value += _result;
1987
- scalar.endPosition = end;
1988
- }
1989
- }
1990
- function storeMappingPair(state, _result, keyTag, keyNode, valueNode) {
1991
- if (keyNode == null) return;
1992
- if (null === _result) _result = {
1993
- startPosition: keyNode.startPosition,
1994
- endPosition: valueNode.endPosition,
1995
- parent: null,
1996
- errors: [],
1997
- mappings: [],
1998
- kind: ast.Kind.MAP
1999
- };
2000
- var mapping = ast.newMapping(keyNode, valueNode);
2001
- mapping.parent = _result;
2002
- keyNode.parent = mapping;
2003
- if (valueNode != null) valueNode.parent = mapping;
2004
- !state.ignoreDuplicateKeys && _result.mappings.forEach((sibling) => {
2005
- if (sibling.key && sibling.key.value === (mapping.key && mapping.key.value)) {
2006
- throwErrorFromPosition(state, mapping.key.startPosition, "duplicate key");
2007
- throwErrorFromPosition(state, sibling.key.startPosition, "duplicate key");
2008
- }
2009
- });
2010
- _result.mappings.push(mapping);
2011
- _result.endPosition = valueNode ? valueNode.endPosition : keyNode.endPosition + 1;
2012
- return _result;
2013
- }
2014
- function readLineBreak(state) {
2015
- var ch = state.input.charCodeAt(state.position);
2016
- if (10 === ch) state.position++;
2017
- else if (13 === ch) {
2018
- state.position++;
2019
- if (10 === state.input.charCodeAt(state.position)) state.position++;
2020
- } else throwError(state, "a line break is expected");
2021
- state.line += 1;
2022
- state.lineStart = state.position;
2023
- state.lines.push({
2024
- start: state.lineStart,
2025
- line: state.line
2026
- });
2027
- }
2028
- function positionToLine(state, position) {
2029
- var line;
2030
- for (var i = 0; i < state.lines.length; i++) {
2031
- if (state.lines[i].start > position) break;
2032
- line = state.lines[i];
2033
- }
2034
- if (!line) return {
2035
- start: 0,
2036
- line: 0
2037
- };
2038
- return line;
2039
- }
2040
- function readComment(state) {
2041
- var ch = 0;
2042
- var _position = state.position;
2043
- do
2044
- ch = state.input.charCodeAt(++state.position);
2045
- while (0 !== ch && !is_EOL(ch));
2046
- state.comments.push({
2047
- startPosition: _position,
2048
- endPosition: state.position,
2049
- value: state.input.slice(_position + 1, state.position)
2050
- });
2051
- }
2052
- function skipSeparationSpace(state, allowComments, checkIndent) {
2053
- var lineBreaks = 0;
2054
- var ch = state.input.charCodeAt(state.position);
2055
- while (0 !== ch) {
2056
- while (is_WHITE_SPACE(ch)) {
2057
- if (ch === 9) state.errors.push(generateError(state, "Using tabs can lead to unpredictable results", true));
2058
- ch = state.input.charCodeAt(++state.position);
2059
- }
2060
- if (allowComments && 35 === ch) {
2061
- readComment(state);
2062
- ch = state.input.charCodeAt(state.position);
2063
- }
2064
- if (is_EOL(ch)) {
2065
- readLineBreak(state);
2066
- ch = state.input.charCodeAt(state.position);
2067
- lineBreaks++;
2068
- state.lineIndent = 0;
2069
- while (32 === ch) {
2070
- state.lineIndent++;
2071
- ch = state.input.charCodeAt(++state.position);
2072
- }
2073
- } else break;
2074
- }
2075
- if (-1 !== checkIndent && 0 !== lineBreaks && state.lineIndent < checkIndent) throwWarning(state, "deficient indentation");
2076
- return lineBreaks;
2077
- }
2078
- function testDocumentSeparator(state) {
2079
- var _position = state.position;
2080
- var ch = state.input.charCodeAt(_position);
2081
- if ((45 === ch || 46 === ch) && state.input.charCodeAt(_position + 1) === ch && state.input.charCodeAt(_position + 2) === ch) {
2082
- _position += 3;
2083
- ch = state.input.charCodeAt(_position);
2084
- if (ch === 0 || is_WS_OR_EOL(ch)) return true;
2085
- }
2086
- return false;
2087
- }
2088
- function writeFoldedLines(state, scalar, count) {
2089
- if (1 === count) scalar.value += " ";
2090
- else if (count > 1) scalar.value += common.repeat("\n", count - 1);
2091
- }
2092
- function readPlainScalar(state, nodeIndent, withinFlowCollection) {
2093
- var preceding;
2094
- var following;
2095
- var captureStart;
2096
- var captureEnd;
2097
- var hasPendingContent;
2098
- var _line;
2099
- var _lineStart;
2100
- var _lineIndent;
2101
- var _kind = state.kind;
2102
- var _result = state.result;
2103
- var ch;
2104
- var state_result = ast.newScalar();
2105
- state_result.plainScalar = true;
2106
- state.result = state_result;
2107
- ch = state.input.charCodeAt(state.position);
2108
- if (is_WS_OR_EOL(ch) || is_FLOW_INDICATOR(ch) || 35 === ch || 38 === ch || 42 === ch || 33 === ch || 124 === ch || 62 === ch || 39 === ch || 34 === ch || 37 === ch || 64 === ch || 96 === ch) return false;
2109
- if (63 === ch || 45 === ch) {
2110
- following = state.input.charCodeAt(state.position + 1);
2111
- if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) return false;
2112
- }
2113
- state.kind = "scalar";
2114
- captureStart = captureEnd = state.position;
2115
- hasPendingContent = false;
2116
- while (0 !== ch) {
2117
- if (58 === ch) {
2118
- following = state.input.charCodeAt(state.position + 1);
2119
- if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) break;
2120
- } else if (35 === ch) {
2121
- preceding = state.input.charCodeAt(state.position - 1);
2122
- if (is_WS_OR_EOL(preceding)) break;
2123
- } else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && is_FLOW_INDICATOR(ch)) break;
2124
- else if (is_EOL(ch)) {
2125
- _line = state.line;
2126
- _lineStart = state.lineStart;
2127
- _lineIndent = state.lineIndent;
2128
- skipSeparationSpace(state, false, -1);
2129
- if (state.lineIndent >= nodeIndent) {
2130
- hasPendingContent = true;
2131
- ch = state.input.charCodeAt(state.position);
2132
- continue;
2133
- } else {
2134
- state.position = captureEnd;
2135
- state.line = _line;
2136
- state.lineStart = _lineStart;
2137
- state.lineIndent = _lineIndent;
2138
- break;
2139
- }
2140
- }
2141
- if (hasPendingContent) {
2142
- captureSegment(state, captureStart, captureEnd, false);
2143
- writeFoldedLines(state, state_result, state.line - _line);
2144
- captureStart = captureEnd = state.position;
2145
- hasPendingContent = false;
2146
- }
2147
- if (!is_WHITE_SPACE(ch)) captureEnd = state.position + 1;
2148
- ch = state.input.charCodeAt(++state.position);
2149
- if (state.position >= state.input.length) return false;
2150
- }
2151
- captureSegment(state, captureStart, captureEnd, false);
2152
- if (state.result.startPosition != -1) {
2153
- state_result.rawValue = state.input.substring(state_result.startPosition, state_result.endPosition);
2154
- return true;
2155
- }
2156
- state.kind = _kind;
2157
- state.result = _result;
2158
- return false;
2159
- }
2160
- function readSingleQuotedScalar(state, nodeIndent) {
2161
- var ch = state.input.charCodeAt(state.position);
2162
- var captureStart;
2163
- var captureEnd;
2164
- if (39 !== ch) return false;
2165
- var scalar = ast.newScalar();
2166
- scalar.singleQuoted = true;
2167
- state.kind = "scalar";
2168
- state.result = scalar;
2169
- scalar.startPosition = state.position;
2170
- state.position++;
2171
- captureStart = captureEnd = state.position;
2172
- while (0 !== (ch = state.input.charCodeAt(state.position))) if (39 === ch) {
2173
- captureSegment(state, captureStart, state.position, true);
2174
- ch = state.input.charCodeAt(++state.position);
2175
- scalar.endPosition = state.position;
2176
- if (39 === ch) {
2177
- captureStart = captureEnd = state.position;
2178
- state.position++;
2179
- } else return true;
2180
- } else if (is_EOL(ch)) {
2181
- captureSegment(state, captureStart, captureEnd, true);
2182
- writeFoldedLines(state, scalar, skipSeparationSpace(state, false, nodeIndent));
2183
- captureStart = captureEnd = state.position;
2184
- } else if (state.position === state.lineStart && testDocumentSeparator(state)) throwError(state, "unexpected end of the document within a single quoted scalar");
2185
- else {
2186
- state.position++;
2187
- captureEnd = state.position;
2188
- scalar.endPosition = state.position;
2189
- }
2190
- throwError(state, "unexpected end of the stream within a single quoted scalar");
2191
- }
2192
- function readDoubleQuotedScalar(state, nodeIndent) {
2193
- var captureStart;
2194
- var captureEnd;
2195
- var hexLength;
2196
- var hexResult;
2197
- var tmp;
2198
- var ch = state.input.charCodeAt(state.position);
2199
- if (34 !== ch) return false;
2200
- state.kind = "scalar";
2201
- var scalar = ast.newScalar();
2202
- scalar.doubleQuoted = true;
2203
- state.result = scalar;
2204
- scalar.startPosition = state.position;
2205
- state.position++;
2206
- captureStart = captureEnd = state.position;
2207
- while (0 !== (ch = state.input.charCodeAt(state.position))) if (34 === ch) {
2208
- captureSegment(state, captureStart, state.position, true);
2209
- state.position++;
2210
- scalar.endPosition = state.position;
2211
- scalar.rawValue = state.input.substring(scalar.startPosition, scalar.endPosition);
2212
- return true;
2213
- } else if (92 === ch) {
2214
- captureSegment(state, captureStart, state.position, true);
2215
- ch = state.input.charCodeAt(++state.position);
2216
- if (is_EOL(ch)) skipSeparationSpace(state, false, nodeIndent);
2217
- else if (ch < 256 && (state.allowAnyEscape ? customEscapeCheck[ch] : simpleEscapeCheck[ch])) {
2218
- scalar.value += state.allowAnyEscape ? customEscapeMap[ch] : simpleEscapeMap[ch];
2219
- state.position++;
2220
- } else if ((tmp = escapedHexLen(ch)) > 0) {
2221
- hexLength = tmp;
2222
- hexResult = 0;
2223
- for (; hexLength > 0; hexLength--) {
2224
- ch = state.input.charCodeAt(++state.position);
2225
- if ((tmp = fromHexCode(ch)) >= 0) hexResult = (hexResult << 4) + tmp;
2226
- else throwError(state, "expected hexadecimal character");
2227
- }
2228
- scalar.value += charFromCodepoint(hexResult);
2229
- state.position++;
2230
- } else throwError(state, "unknown escape sequence");
2231
- captureStart = captureEnd = state.position;
2232
- } else if (is_EOL(ch)) {
2233
- captureSegment(state, captureStart, captureEnd, true);
2234
- writeFoldedLines(state, scalar, skipSeparationSpace(state, false, nodeIndent));
2235
- captureStart = captureEnd = state.position;
2236
- } else if (state.position === state.lineStart && testDocumentSeparator(state)) throwError(state, "unexpected end of the document within a double quoted scalar");
2237
- else {
2238
- state.position++;
2239
- captureEnd = state.position;
2240
- }
2241
- throwError(state, "unexpected end of the stream within a double quoted scalar");
2242
- }
2243
- function readFlowCollection(state, nodeIndent) {
2244
- var readNext = true;
2245
- var _line;
2246
- var _tag = state.tag;
2247
- var _result;
2248
- var _anchor = state.anchor;
2249
- var following;
2250
- var terminator;
2251
- var isPair;
2252
- var isExplicitPair;
2253
- var isMapping;
2254
- var keyNode;
2255
- var keyTag;
2256
- var valueNode;
2257
- var ch = state.input.charCodeAt(state.position);
2258
- if (ch === 91) {
2259
- terminator = 93;
2260
- isMapping = false;
2261
- _result = ast.newItems();
2262
- _result.startPosition = state.position;
2263
- } else if (ch === 123) {
2264
- terminator = 125;
2265
- isMapping = true;
2266
- _result = ast.newMap();
2267
- _result.startPosition = state.position;
2268
- } else return false;
2269
- if (null !== state.anchor) {
2270
- _result.anchorId = state.anchor;
2271
- state.anchorMap[state.anchor] = _result;
2272
- }
2273
- ch = state.input.charCodeAt(++state.position);
2274
- while (0 !== ch) {
2275
- skipSeparationSpace(state, true, nodeIndent);
2276
- ch = state.input.charCodeAt(state.position);
2277
- if (ch === terminator) {
2278
- state.position++;
2279
- state.tag = _tag;
2280
- state.anchor = _anchor;
2281
- state.kind = isMapping ? "mapping" : "sequence";
2282
- state.result = _result;
2283
- _result.endPosition = state.position;
2284
- return true;
2285
- } else if (!readNext) {
2286
- var p = state.position;
2287
- throwError(state, "missed comma between flow collection entries");
2288
- state.position = p + 1;
2289
- }
2290
- keyTag = keyNode = valueNode = null;
2291
- isPair = isExplicitPair = false;
2292
- if (63 === ch) {
2293
- following = state.input.charCodeAt(state.position + 1);
2294
- if (is_WS_OR_EOL(following)) {
2295
- isPair = isExplicitPair = true;
2296
- state.position++;
2297
- skipSeparationSpace(state, true, nodeIndent);
2298
- }
2299
- }
2300
- _line = state.line;
2301
- composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
2302
- keyTag = state.tag;
2303
- keyNode = state.result;
2304
- skipSeparationSpace(state, true, nodeIndent);
2305
- ch = state.input.charCodeAt(state.position);
2306
- if ((isExplicitPair || state.line === _line) && 58 === ch) {
2307
- isPair = true;
2308
- ch = state.input.charCodeAt(++state.position);
2309
- skipSeparationSpace(state, true, nodeIndent);
2310
- composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
2311
- valueNode = state.result;
2312
- }
2313
- if (isMapping) storeMappingPair(state, _result, keyTag, keyNode, valueNode);
2314
- else if (isPair) {
2315
- var mp = storeMappingPair(state, null, keyTag, keyNode, valueNode);
2316
- mp.parent = _result;
2317
- _result.items.push(mp);
2318
- } else {
2319
- if (keyNode) keyNode.parent = _result;
2320
- _result.items.push(keyNode);
2321
- }
2322
- _result.endPosition = state.position + 1;
2323
- skipSeparationSpace(state, true, nodeIndent);
2324
- ch = state.input.charCodeAt(state.position);
2325
- if (44 === ch) {
2326
- readNext = true;
2327
- ch = state.input.charCodeAt(++state.position);
2328
- } else readNext = false;
2329
- }
2330
- throwError(state, "unexpected end of the stream within a flow collection");
2331
- }
2332
- function readBlockScalar(state, nodeIndent) {
2333
- var captureStart;
2334
- var folding;
2335
- var chomping = CHOMPING_CLIP;
2336
- var detectedIndent = false;
2337
- var textIndent = nodeIndent;
2338
- var emptyLines = 0;
2339
- var atMoreIndented = false;
2340
- var tmp;
2341
- var ch = state.input.charCodeAt(state.position);
2342
- if (ch === 124) folding = false;
2343
- else if (ch === 62) folding = true;
2344
- else return false;
2345
- var sc = ast.newScalar();
2346
- state.kind = "scalar";
2347
- state.result = sc;
2348
- sc.startPosition = state.position;
2349
- while (0 !== ch) {
2350
- ch = state.input.charCodeAt(++state.position);
2351
- if (43 === ch || 45 === ch) if (CHOMPING_CLIP === chomping) chomping = 43 === ch ? CHOMPING_KEEP : CHOMPING_STRIP;
2352
- else throwError(state, "repeat of a chomping mode identifier");
2353
- else if ((tmp = fromDecimalCode(ch)) >= 0) if (tmp === 0) throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
2354
- else if (!detectedIndent) {
2355
- textIndent = nodeIndent + tmp - 1;
2356
- detectedIndent = true;
2357
- } else throwError(state, "repeat of an indentation width identifier");
2358
- else break;
2359
- }
2360
- if (is_WHITE_SPACE(ch)) {
2361
- do
2362
- ch = state.input.charCodeAt(++state.position);
2363
- while (is_WHITE_SPACE(ch));
2364
- if (35 === ch) {
2365
- readComment(state);
2366
- ch = state.input.charCodeAt(state.position);
2367
- }
2368
- }
2369
- while (0 !== ch) {
2370
- readLineBreak(state);
2371
- state.lineIndent = 0;
2372
- ch = state.input.charCodeAt(state.position);
2373
- while ((!detectedIndent || state.lineIndent < textIndent) && 32 === ch) {
2374
- state.lineIndent++;
2375
- ch = state.input.charCodeAt(++state.position);
2376
- }
2377
- if (!detectedIndent && state.lineIndent > textIndent) textIndent = state.lineIndent;
2378
- if (is_EOL(ch)) {
2379
- emptyLines++;
2380
- continue;
2381
- }
2382
- if (state.lineIndent < textIndent) {
2383
- if (chomping === CHOMPING_KEEP) sc.value += common.repeat("\n", emptyLines);
2384
- else if (chomping === CHOMPING_CLIP) {
2385
- if (detectedIndent) sc.value += "\n";
2386
- }
2387
- break;
2388
- }
2389
- if (folding) if (is_WHITE_SPACE(ch)) {
2390
- atMoreIndented = true;
2391
- sc.value += common.repeat("\n", emptyLines + 1);
2392
- } else if (atMoreIndented) {
2393
- atMoreIndented = false;
2394
- sc.value += common.repeat("\n", emptyLines + 1);
2395
- } else if (0 === emptyLines) {
2396
- if (detectedIndent) sc.value += " ";
2397
- } else sc.value += common.repeat("\n", emptyLines);
2398
- else if (detectedIndent) sc.value += common.repeat("\n", emptyLines + 1);
2399
- detectedIndent = true;
2400
- emptyLines = 0;
2401
- captureStart = state.position;
2402
- while (!is_EOL(ch) && 0 !== ch) ch = state.input.charCodeAt(++state.position);
2403
- captureSegment(state, captureStart, state.position, false);
2404
- }
2405
- sc.endPosition = state.position;
2406
- var i = state.position - 1;
2407
- var needMinus = false;
2408
- while (true) {
2409
- var c = state.input[i];
2410
- if (c == "\r" || c == "\n") {
2411
- if (needMinus) i--;
2412
- break;
2413
- }
2414
- if (c != " " && c != " ") break;
2415
- i--;
2416
- }
2417
- sc.endPosition = i;
2418
- sc.rawValue = state.input.substring(sc.startPosition, sc.endPosition);
2419
- return true;
2420
- }
2421
- function readBlockSequence(state, nodeIndent) {
2422
- var _line;
2423
- var _tag = state.tag;
2424
- var _anchor = state.anchor;
2425
- var _result = ast.newItems();
2426
- var following;
2427
- var detected = false;
2428
- var ch;
2429
- if (null !== state.anchor) {
2430
- _result.anchorId = state.anchor;
2431
- state.anchorMap[state.anchor] = _result;
2432
- }
2433
- _result.startPosition = state.position;
2434
- ch = state.input.charCodeAt(state.position);
2435
- while (0 !== ch) {
2436
- if (45 !== ch) break;
2437
- following = state.input.charCodeAt(state.position + 1);
2438
- if (!is_WS_OR_EOL(following)) break;
2439
- detected = true;
2440
- state.position++;
2441
- if (skipSeparationSpace(state, true, -1)) {
2442
- if (state.lineIndent <= nodeIndent) {
2443
- _result.items.push(null);
2444
- ch = state.input.charCodeAt(state.position);
2445
- continue;
2446
- }
2447
- }
2448
- _line = state.line;
2449
- composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
2450
- if (state.result) {
2451
- state.result.parent = _result;
2452
- _result.items.push(state.result);
2453
- }
2454
- skipSeparationSpace(state, true, -1);
2455
- ch = state.input.charCodeAt(state.position);
2456
- if ((state.line === _line || state.lineIndent > nodeIndent) && 0 !== ch) throwError(state, "bad indentation of a sequence entry");
2457
- else if (state.lineIndent < nodeIndent) break;
2458
- }
2459
- _result.endPosition = state.position;
2460
- if (detected) {
2461
- state.tag = _tag;
2462
- state.anchor = _anchor;
2463
- state.kind = "sequence";
2464
- state.result = _result;
2465
- _result.endPosition = state.position;
2466
- return true;
2467
- }
2468
- return false;
2469
- }
2470
- function readBlockMapping(state, nodeIndent, flowIndent) {
2471
- var following;
2472
- var allowCompact;
2473
- var _line;
2474
- var _tag = state.tag;
2475
- var _anchor = state.anchor;
2476
- var _result = ast.newMap();
2477
- var keyTag = null;
2478
- var keyNode = null;
2479
- var valueNode = null;
2480
- var atExplicitKey = false;
2481
- var detected = false;
2482
- var ch;
2483
- _result.startPosition = state.position;
2484
- if (null !== state.anchor) {
2485
- _result.anchorId = state.anchor;
2486
- state.anchorMap[state.anchor] = _result;
2487
- }
2488
- ch = state.input.charCodeAt(state.position);
2489
- while (0 !== ch) {
2490
- following = state.input.charCodeAt(state.position + 1);
2491
- _line = state.line;
2492
- if ((63 === ch || 58 === ch) && is_WS_OR_EOL(following)) {
2493
- if (63 === ch) {
2494
- if (atExplicitKey) {
2495
- storeMappingPair(state, _result, keyTag, keyNode, null);
2496
- keyTag = keyNode = valueNode = null;
2497
- }
2498
- detected = true;
2499
- atExplicitKey = true;
2500
- allowCompact = true;
2501
- } else if (atExplicitKey) {
2502
- atExplicitKey = false;
2503
- allowCompact = true;
2504
- } else throwError(state, "incomplete explicit mapping pair; a key node is missed");
2505
- state.position += 1;
2506
- ch = following;
2507
- } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) if (state.line === _line) {
2508
- ch = state.input.charCodeAt(state.position);
2509
- while (is_WHITE_SPACE(ch)) ch = state.input.charCodeAt(++state.position);
2510
- if (58 === ch) {
2511
- ch = state.input.charCodeAt(++state.position);
2512
- if (!is_WS_OR_EOL(ch)) throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
2513
- if (atExplicitKey) {
2514
- storeMappingPair(state, _result, keyTag, keyNode, null);
2515
- keyTag = keyNode = valueNode = null;
2516
- }
2517
- detected = true;
2518
- atExplicitKey = false;
2519
- allowCompact = false;
2520
- keyTag = state.tag;
2521
- keyNode = state.result;
2522
- } else if (state.position == state.lineStart && testDocumentSeparator(state)) break;
2523
- else if (detected) throwError(state, "can not read an implicit mapping pair; a colon is missed");
2524
- else {
2525
- state.tag = _tag;
2526
- state.anchor = _anchor;
2527
- return true;
2528
- }
2529
- } else if (detected) {
2530
- throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
2531
- while (state.position > 0) {
2532
- ch = state.input.charCodeAt(--state.position);
2533
- if (is_EOL(ch)) {
2534
- state.position++;
2535
- break;
2536
- }
2537
- }
2538
- } else {
2539
- state.tag = _tag;
2540
- state.anchor = _anchor;
2541
- return true;
2542
- }
2543
- else break;
2544
- if (state.line === _line || state.lineIndent > nodeIndent) {
2545
- if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) if (atExplicitKey) keyNode = state.result;
2546
- else valueNode = state.result;
2547
- if (!atExplicitKey) {
2548
- storeMappingPair(state, _result, keyTag, keyNode, valueNode);
2549
- keyTag = keyNode = valueNode = null;
2550
- }
2551
- skipSeparationSpace(state, true, -1);
2552
- ch = state.input.charCodeAt(state.position);
2553
- }
2554
- if (state.lineIndent > nodeIndent && 0 !== ch) throwError(state, "bad indentation of a mapping entry");
2555
- else if (state.lineIndent < nodeIndent) break;
2556
- }
2557
- if (atExplicitKey) storeMappingPair(state, _result, keyTag, keyNode, null);
2558
- if (detected) {
2559
- state.tag = _tag;
2560
- state.anchor = _anchor;
2561
- state.kind = "mapping";
2562
- state.result = _result;
2563
- }
2564
- return detected;
2565
- }
2566
- function readTagProperty(state) {
2567
- var _position;
2568
- var isVerbatim = false;
2569
- var isNamed = false;
2570
- var tagHandle;
2571
- var tagName;
2572
- var ch = state.input.charCodeAt(state.position);
2573
- if (33 !== ch) return false;
2574
- if (null !== state.tag) throwError(state, "duplication of a tag property");
2575
- ch = state.input.charCodeAt(++state.position);
2576
- if (60 === ch) {
2577
- isVerbatim = true;
2578
- ch = state.input.charCodeAt(++state.position);
2579
- } else if (33 === ch) {
2580
- isNamed = true;
2581
- tagHandle = "!!";
2582
- ch = state.input.charCodeAt(++state.position);
2583
- } else tagHandle = "!";
2584
- _position = state.position;
2585
- if (isVerbatim) {
2586
- do
2587
- ch = state.input.charCodeAt(++state.position);
2588
- while (0 !== ch && 62 !== ch);
2589
- if (state.position < state.length) {
2590
- tagName = state.input.slice(_position, state.position);
2591
- ch = state.input.charCodeAt(++state.position);
2592
- } else throwError(state, "unexpected end of the stream within a verbatim tag");
2593
- } else {
2594
- while (0 !== ch && !is_WS_OR_EOL(ch)) {
2595
- if (33 === ch) if (!isNamed) {
2596
- tagHandle = state.input.slice(_position - 1, state.position + 1);
2597
- if (!PATTERN_TAG_HANDLE.test(tagHandle)) throwError(state, "named tag handle cannot contain such characters");
2598
- isNamed = true;
2599
- _position = state.position + 1;
2600
- } else throwError(state, "tag suffix cannot contain exclamation marks");
2601
- ch = state.input.charCodeAt(++state.position);
2602
- }
2603
- tagName = state.input.slice(_position, state.position);
2604
- if (PATTERN_FLOW_INDICATORS.test(tagName)) throwError(state, "tag suffix cannot contain flow indicator characters");
2605
- }
2606
- if (tagName && !PATTERN_TAG_URI.test(tagName)) throwError(state, "tag name cannot contain such characters: " + tagName);
2607
- if (isVerbatim) state.tag = tagName;
2608
- else if (_hasOwnProperty.call(state.tagMap, tagHandle)) state.tag = state.tagMap[tagHandle] + tagName;
2609
- else if ("!" === tagHandle) state.tag = "!" + tagName;
2610
- else if ("!!" === tagHandle) state.tag = "tag:yaml.org,2002:" + tagName;
2611
- else throwError(state, "undeclared tag handle \"" + tagHandle + "\"");
2612
- return true;
2613
- }
2614
- function readAnchorProperty(state) {
2615
- var _position;
2616
- var ch = state.input.charCodeAt(state.position);
2617
- if (38 !== ch) return false;
2618
- if (null !== state.anchor) throwError(state, "duplication of an anchor property");
2619
- ch = state.input.charCodeAt(++state.position);
2620
- _position = state.position;
2621
- while (0 !== ch && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) ch = state.input.charCodeAt(++state.position);
2622
- if (state.position === _position) throwError(state, "name of an anchor node must contain at least one character");
2623
- state.anchor = state.input.slice(_position, state.position);
2624
- return true;
2625
- }
2626
- function readAlias(state) {
2627
- var _position;
2628
- var alias;
2629
- state.length;
2630
- state.input;
2631
- var ch = state.input.charCodeAt(state.position);
2632
- if (42 !== ch) return false;
2633
- ch = state.input.charCodeAt(++state.position);
2634
- _position = state.position;
2635
- while (0 !== ch && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) ch = state.input.charCodeAt(++state.position);
2636
- if (state.position <= _position) {
2637
- throwError(state, "name of an alias node must contain at least one character");
2638
- state.position = _position + 1;
2639
- }
2640
- alias = state.input.slice(_position, state.position);
2641
- if (!state.anchorMap.hasOwnProperty(alias)) {
2642
- throwError(state, "unidentified alias \"" + alias + "\"");
2643
- if (state.position <= _position) state.position = _position + 1;
2644
- }
2645
- state.result = ast.newAnchorRef(alias, _position, state.position, state.anchorMap[alias]);
2646
- skipSeparationSpace(state, true, -1);
2647
- return true;
2648
- }
2649
- function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
2650
- var allowBlockStyles;
2651
- var allowBlockScalars;
2652
- var allowBlockCollections;
2653
- var indentStatus = 1;
2654
- var atNewLine = false;
2655
- var hasContent = false;
2656
- var typeIndex;
2657
- var typeQuantity;
2658
- var type;
2659
- var flowIndent;
2660
- var blockIndent;
2661
- state.tag = null;
2662
- state.anchor = null;
2663
- state.kind = null;
2664
- state.result = null;
2665
- allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
2666
- if (allowToSeek) {
2667
- if (skipSeparationSpace(state, true, -1)) {
2668
- atNewLine = true;
2669
- if (state.lineIndent > parentIndent) indentStatus = 1;
2670
- else if (state.lineIndent === parentIndent) indentStatus = 0;
2671
- else if (state.lineIndent < parentIndent) indentStatus = -1;
2672
- }
2673
- }
2674
- let tagStart = state.position;
2675
- state.position - state.lineStart;
2676
- if (1 === indentStatus) while (readTagProperty(state) || readAnchorProperty(state)) if (skipSeparationSpace(state, true, -1)) {
2677
- atNewLine = true;
2678
- allowBlockCollections = allowBlockStyles;
2679
- if (state.lineIndent > parentIndent) indentStatus = 1;
2680
- else if (state.lineIndent === parentIndent) indentStatus = 0;
2681
- else if (state.lineIndent < parentIndent) indentStatus = -1;
2682
- } else allowBlockCollections = false;
2683
- if (allowBlockCollections) allowBlockCollections = atNewLine || allowCompact;
2684
- if (1 === indentStatus || CONTEXT_BLOCK_OUT === nodeContext) {
2685
- if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) flowIndent = parentIndent;
2686
- else flowIndent = parentIndent + 1;
2687
- blockIndent = state.position - state.lineStart;
2688
- if (1 === indentStatus) if (allowBlockCollections && (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent)) || readFlowCollection(state, flowIndent)) hasContent = true;
2689
- else {
2690
- if (allowBlockScalars && readBlockScalar(state, flowIndent) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) hasContent = true;
2691
- else if (readAlias(state)) {
2692
- hasContent = true;
2693
- if (null !== state.tag || null !== state.anchor) throwError(state, "alias node should not have any properties");
2694
- } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
2695
- hasContent = true;
2696
- if (null === state.tag) state.tag = "?";
2697
- }
2698
- if (null !== state.anchor) {
2699
- state.anchorMap[state.anchor] = state.result;
2700
- state.result.anchorId = state.anchor;
2701
- }
2702
- }
2703
- else if (0 === indentStatus) hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
2704
- }
2705
- if (null !== state.tag && "!" !== state.tag) if (state.tag == "!include") {
2706
- if (!state.result) {
2707
- state.result = ast.newScalar();
2708
- state.result.startPosition = state.position;
2709
- state.result.endPosition = state.position;
2710
- throwError(state, "!include without value");
2711
- }
2712
- state.result.kind = ast.Kind.INCLUDE_REF;
2713
- } else if ("?" === state.tag) for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
2714
- type = state.implicitTypes[typeIndex];
2715
- var vl = state.result["value"];
2716
- if (type.resolve(vl)) {
2717
- state.result.valueObject = type.construct(state.result["value"]);
2718
- state.tag = type.tag;
2719
- if (null !== state.anchor) {
2720
- state.result.anchorId = state.anchor;
2721
- state.anchorMap[state.anchor] = state.result;
2722
- }
2723
- break;
2724
- }
2725
- }
2726
- else if (_hasOwnProperty.call(state.typeMap, state.tag)) {
2727
- type = state.typeMap[state.tag];
2728
- if (null !== state.result && type.kind !== state.kind) throwError(state, "unacceptable node kind for !<" + state.tag + "> tag; it should be \"" + type.kind + "\", not \"" + state.kind + "\"");
2729
- if (!type.resolve(state.result)) throwError(state, "cannot resolve a node with !<" + state.tag + "> explicit tag");
2730
- else {
2731
- state.result = type.construct(state.result);
2732
- if (null !== state.anchor) {
2733
- state.result.anchorId = state.anchor;
2734
- state.anchorMap[state.anchor] = state.result;
2735
- }
2736
- }
2737
- } else throwErrorFromPosition(state, tagStart, "unknown tag <" + state.tag + ">", false, true);
2738
- return null !== state.tag || null !== state.anchor || hasContent;
2739
- }
2740
- function readDocument(state) {
2741
- var documentStart = state.position;
2742
- var _position;
2743
- var directiveName;
2744
- var directiveArgs;
2745
- var hasDirectives = false;
2746
- var ch;
2747
- state.version = null;
2748
- state.checkLineBreaks = state.legacy;
2749
- state.tagMap = {};
2750
- state.anchorMap = {};
2751
- state.comments = [];
2752
- while (0 !== (ch = state.input.charCodeAt(state.position))) {
2753
- skipSeparationSpace(state, true, -1);
2754
- ch = state.input.charCodeAt(state.position);
2755
- if (state.lineIndent > 0 || 37 !== ch) break;
2756
- hasDirectives = true;
2757
- ch = state.input.charCodeAt(++state.position);
2758
- _position = state.position;
2759
- while (0 !== ch && !is_WS_OR_EOL(ch)) ch = state.input.charCodeAt(++state.position);
2760
- directiveName = state.input.slice(_position, state.position);
2761
- directiveArgs = [];
2762
- if (directiveName.length < 1) throwError(state, "directive name must not be less than one character in length");
2763
- while (0 !== ch) {
2764
- while (is_WHITE_SPACE(ch)) ch = state.input.charCodeAt(++state.position);
2765
- if (35 === ch) {
2766
- readComment(state);
2767
- ch = state.input.charCodeAt(state.position);
2768
- break;
2769
- }
2770
- if (is_EOL(ch)) break;
2771
- _position = state.position;
2772
- while (0 !== ch && !is_WS_OR_EOL(ch)) ch = state.input.charCodeAt(++state.position);
2773
- directiveArgs.push(state.input.slice(_position, state.position));
2774
- }
2775
- if (0 !== ch) readLineBreak(state);
2776
- if (_hasOwnProperty.call(directiveHandlers, directiveName)) directiveHandlers[directiveName](state, directiveName, directiveArgs);
2777
- else {
2778
- throwWarning(state, "unknown document directive \"" + directiveName + "\"");
2779
- state.position++;
2780
- }
2781
- }
2782
- skipSeparationSpace(state, true, -1);
2783
- if (0 === state.lineIndent && 45 === state.input.charCodeAt(state.position) && 45 === state.input.charCodeAt(state.position + 1) && 45 === state.input.charCodeAt(state.position + 2)) {
2784
- state.position += 3;
2785
- skipSeparationSpace(state, true, -1);
2786
- } else if (hasDirectives) throwError(state, "directives end mark is expected");
2787
- composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
2788
- skipSeparationSpace(state, true, -1);
2789
- if (state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) throwWarning(state, "non-ASCII line breaks are interpreted as content");
2790
- state.result.comments = state.comments;
2791
- state.documents.push(state.result);
2792
- if (state.position === state.lineStart && testDocumentSeparator(state)) {
2793
- if (46 === state.input.charCodeAt(state.position)) {
2794
- state.position += 3;
2795
- skipSeparationSpace(state, true, -1);
2796
- }
2797
- return;
2798
- }
2799
- if (state.position < state.length - 1) throwError(state, "end of the stream or a document separator is expected");
2800
- else return;
2801
- }
2802
- function loadDocuments(input, options) {
2803
- input = String(input);
2804
- options = options || {};
2805
- let inputLength = input.length;
2806
- if (inputLength !== 0) {
2807
- if (10 !== input.charCodeAt(inputLength - 1) && 13 !== input.charCodeAt(inputLength - 1)) input += "\n";
2808
- if (input.charCodeAt(0) === 65279) input = input.slice(1);
2809
- }
2810
- var state = new State(input, options);
2811
- state.input += "\0";
2812
- while (32 === state.input.charCodeAt(state.position)) {
2813
- state.lineIndent += 1;
2814
- state.position += 1;
2815
- }
2816
- while (state.position < state.length - 1) {
2817
- var q = state.position;
2818
- readDocument(state);
2819
- if (state.position <= q) {
2820
- for (; state.position < state.length - 1; state.position++) if (state.input.charAt(state.position) == "\n") break;
2821
- }
2822
- }
2823
- let documents = state.documents;
2824
- let docsCount = documents.length;
2825
- if (docsCount > 0) documents[docsCount - 1].endPosition = inputLength;
2826
- for (let x of documents) {
2827
- x.errors = state.errors;
2828
- if (x.startPosition > x.endPosition) x.startPosition = x.endPosition;
2829
- }
2830
- return documents;
2831
- }
2832
- function loadAll(input, iterator, options = {}) {
2833
- var documents = loadDocuments(input, options);
2834
- var index;
2835
- var length;
2836
- for (index = 0, length = documents.length; index < length; index += 1) iterator(documents[index]);
2837
- }
2838
- exports.loadAll = loadAll;
2839
- function load(input, options = {}) {
2840
- var documents = loadDocuments(input, options);
2841
- if (0 === documents.length) return;
2842
- else if (1 === documents.length) return documents[0];
2843
- var e = new YAMLException("expected a single document in the stream, but found more");
2844
- e.mark = new Mark("", "", 0, 0, 0);
2845
- e.mark.position = documents[0].endPosition;
2846
- documents[0].errors.push(e);
2847
- return documents[0];
2848
- }
2849
- exports.load = load;
2850
- function safeLoadAll(input, output, options = {}) {
2851
- loadAll(input, output, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
2852
- }
2853
- exports.safeLoadAll = safeLoadAll;
2854
- function safeLoad(input, options = {}) {
2855
- return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
2856
- }
2857
- exports.safeLoad = safeLoad;
2858
- module.exports.loadAll = loadAll;
2859
- module.exports.load = load;
2860
- module.exports.safeLoadAll = safeLoadAll;
2861
- module.exports.safeLoad = safeLoad;
2862
- }));
2863
- //#endregion
2864
- //#region ../../node_modules/.pnpm/@stoplight+yaml-ast-parser@0.0.50/node_modules/@stoplight/yaml-ast-parser/dist/src/dumper.js
2865
- var require_dumper = /* @__PURE__ */ __commonJSMin(((exports) => {
2866
- Object.defineProperty(exports, "__esModule", { value: true });
2867
- var common = require_common();
2868
- var YAMLException = require_exception();
2869
- var DEFAULT_FULL_SCHEMA = require_default_full();
2870
- var DEFAULT_SAFE_SCHEMA = require_default_safe();
2871
- var _toString = Object.prototype.toString;
2872
- var _hasOwnProperty = Object.prototype.hasOwnProperty;
2873
- var CHAR_TAB = 9;
2874
- var CHAR_LINE_FEED = 10;
2875
- var CHAR_CARRIAGE_RETURN = 13;
2876
- var CHAR_SPACE = 32;
2877
- var CHAR_EXCLAMATION = 33;
2878
- var CHAR_DOUBLE_QUOTE = 34;
2879
- var CHAR_SHARP = 35;
2880
- var CHAR_PERCENT = 37;
2881
- var CHAR_AMPERSAND = 38;
2882
- var CHAR_SINGLE_QUOTE = 39;
2883
- var CHAR_ASTERISK = 42;
2884
- var CHAR_COMMA = 44;
2885
- var CHAR_MINUS = 45;
2886
- var CHAR_COLON = 58;
2887
- var CHAR_EQUALS = 61;
2888
- var CHAR_GREATER_THAN = 62;
2889
- var CHAR_QUESTION = 63;
2890
- var CHAR_COMMERCIAL_AT = 64;
2891
- var CHAR_LEFT_SQUARE_BRACKET = 91;
2892
- var CHAR_RIGHT_SQUARE_BRACKET = 93;
2893
- var CHAR_GRAVE_ACCENT = 96;
2894
- var CHAR_LEFT_CURLY_BRACKET = 123;
2895
- var CHAR_VERTICAL_LINE = 124;
2896
- var CHAR_RIGHT_CURLY_BRACKET = 125;
2897
- var ESCAPE_SEQUENCES = {};
2898
- ESCAPE_SEQUENCES[0] = "\\0";
2899
- ESCAPE_SEQUENCES[7] = "\\a";
2900
- ESCAPE_SEQUENCES[8] = "\\b";
2901
- ESCAPE_SEQUENCES[9] = "\\t";
2902
- ESCAPE_SEQUENCES[10] = "\\n";
2903
- ESCAPE_SEQUENCES[11] = "\\v";
2904
- ESCAPE_SEQUENCES[12] = "\\f";
2905
- ESCAPE_SEQUENCES[13] = "\\r";
2906
- ESCAPE_SEQUENCES[27] = "\\e";
2907
- ESCAPE_SEQUENCES[34] = "\\\"";
2908
- ESCAPE_SEQUENCES[92] = "\\\\";
2909
- ESCAPE_SEQUENCES[133] = "\\N";
2910
- ESCAPE_SEQUENCES[160] = "\\_";
2911
- ESCAPE_SEQUENCES[8232] = "\\L";
2912
- ESCAPE_SEQUENCES[8233] = "\\P";
2913
- var DEPRECATED_BOOLEANS_SYNTAX = [
2914
- "y",
2915
- "Y",
2916
- "yes",
2917
- "Yes",
2918
- "YES",
2919
- "on",
2920
- "On",
2921
- "ON",
2922
- "n",
2923
- "N",
2924
- "no",
2925
- "No",
2926
- "NO",
2927
- "off",
2928
- "Off",
2929
- "OFF"
2930
- ];
2931
- function compileStyleMap(schema, map) {
2932
- var result;
2933
- var keys;
2934
- var index;
2935
- var length;
2936
- var tag;
2937
- var style;
2938
- var type;
2939
- if (map === null) return {};
2940
- result = {};
2941
- keys = Object.keys(map);
2942
- for (index = 0, length = keys.length; index < length; index += 1) {
2943
- tag = keys[index];
2944
- style = String(map[tag]);
2945
- if (tag.slice(0, 2) === "!!") tag = "tag:yaml.org,2002:" + tag.slice(2);
2946
- type = schema.compiledTypeMap["fallback"][tag];
2947
- if (type && _hasOwnProperty.call(type.styleAliases, style)) style = type.styleAliases[style];
2948
- result[tag] = style;
2949
- }
2950
- return result;
2951
- }
2952
- function encodeHex(character) {
2953
- var string = character.toString(16).toUpperCase();
2954
- var handle;
2955
- var length;
2956
- if (character <= 255) {
2957
- handle = "x";
2958
- length = 2;
2959
- } else if (character <= 65535) {
2960
- handle = "u";
2961
- length = 4;
2962
- } else if (character <= 4294967295) {
2963
- handle = "U";
2964
- length = 8;
2965
- } else throw new YAMLException("code point within a string may not be greater than 0xFFFFFFFF");
2966
- return "\\" + handle + common.repeat("0", length - string.length) + string;
2967
- }
2968
- function State(options) {
2969
- this.schema = options["schema"] || DEFAULT_FULL_SCHEMA;
2970
- this.indent = Math.max(1, options["indent"] || 2);
2971
- this.noArrayIndent = options["noArrayIndent"] || false;
2972
- this.skipInvalid = options["skipInvalid"] || false;
2973
- this.flowLevel = common.isNothing(options["flowLevel"]) ? -1 : options["flowLevel"];
2974
- this.styleMap = compileStyleMap(this.schema, options["styles"] || null);
2975
- this.sortKeys = options["sortKeys"] || false;
2976
- this.lineWidth = options["lineWidth"] || 80;
2977
- this.noRefs = options["noRefs"] || false;
2978
- this.noCompatMode = options["noCompatMode"] || false;
2979
- this.condenseFlow = options["condenseFlow"] || false;
2980
- this.implicitTypes = this.schema.compiledImplicit;
2981
- this.explicitTypes = this.schema.compiledExplicit;
2982
- this.comments = options["comments"] || {};
2983
- this.tag = null;
2984
- this.result = "";
2985
- this.duplicates = [];
2986
- this.usedDuplicates = null;
2987
- }
2988
- function indentString(string, spaces) {
2989
- var ind = common.repeat(" ", spaces);
2990
- var position = 0;
2991
- var next = -1;
2992
- var result = "";
2993
- var line;
2994
- var length = string.length;
2995
- while (position < length) {
2996
- next = string.indexOf("\n", position);
2997
- if (next === -1) {
2998
- line = string.slice(position);
2999
- position = length;
3000
- } else {
3001
- line = string.slice(position, next + 1);
3002
- position = next + 1;
3003
- }
3004
- if (line.length && line !== "\n") result += ind;
3005
- result += line;
3006
- }
3007
- return result;
3008
- }
3009
- function generateNextLine(state, level) {
3010
- return "\n" + common.repeat(" ", state.indent * level);
3011
- }
3012
- function testImplicitResolving(state, str) {
3013
- var index;
3014
- var length;
3015
- var type;
3016
- for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
3017
- type = state.implicitTypes[index];
3018
- if (type.resolve(str)) return true;
3019
- }
3020
- return false;
3021
- }
3022
- function isWhitespace(c) {
3023
- return c === CHAR_SPACE || c === CHAR_TAB;
3024
- }
3025
- function isPrintable(c) {
3026
- return 32 <= c && c <= 126 || 161 <= c && c <= 55295 && c !== 8232 && c !== 8233 || 57344 <= c && c <= 65533 && c !== 65279 || 65536 <= c && c <= 1114111;
3027
- }
3028
- function isNsChar(c) {
3029
- return isPrintable(c) && !isWhitespace(c) && c !== 65279 && c !== CHAR_CARRIAGE_RETURN && c !== CHAR_LINE_FEED;
3030
- }
3031
- function isPlainSafe(c, prev) {
3032
- return isPrintable(c) && c !== 65279 && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET && c !== CHAR_COLON && (c !== CHAR_SHARP || prev && isNsChar(prev));
3033
- }
3034
- function isPlainSafeFirst(c) {
3035
- return isPrintable(c) && c !== 65279 && !isWhitespace(c) && c !== CHAR_MINUS && c !== CHAR_QUESTION && c !== CHAR_COLON && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET && c !== CHAR_SHARP && c !== CHAR_AMPERSAND && c !== CHAR_ASTERISK && c !== CHAR_EXCLAMATION && c !== CHAR_VERTICAL_LINE && c !== CHAR_EQUALS && c !== CHAR_GREATER_THAN && c !== CHAR_SINGLE_QUOTE && c !== CHAR_DOUBLE_QUOTE && c !== CHAR_PERCENT && c !== CHAR_COMMERCIAL_AT && c !== CHAR_GRAVE_ACCENT;
3036
- }
3037
- function needIndentIndicator(string) {
3038
- return /^\n* /.test(string);
3039
- }
3040
- var STYLE_PLAIN = 1;
3041
- var STYLE_SINGLE = 2;
3042
- var STYLE_LITERAL = 3;
3043
- var STYLE_FOLDED = 4;
3044
- var STYLE_DOUBLE = 5;
3045
- function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) {
3046
- var i;
3047
- var char;
3048
- var prev_char;
3049
- var hasLineBreak = false;
3050
- var hasFoldableLine = false;
3051
- var shouldTrackWidth = lineWidth !== -1;
3052
- var previousLineBreak = -1;
3053
- var plain = isPlainSafeFirst(string.charCodeAt(0)) && !isWhitespace(string.charCodeAt(string.length - 1));
3054
- if (singleLineOnly) for (i = 0; i < string.length; i++) {
3055
- char = string.charCodeAt(i);
3056
- if (!isPrintable(char)) return STYLE_DOUBLE;
3057
- prev_char = i > 0 ? string.charCodeAt(i - 1) : null;
3058
- plain = plain && isPlainSafe(char, prev_char);
3059
- }
3060
- else {
3061
- for (i = 0; i < string.length; i++) {
3062
- char = string.charCodeAt(i);
3063
- if (char === CHAR_LINE_FEED) {
3064
- hasLineBreak = true;
3065
- if (shouldTrackWidth) {
3066
- hasFoldableLine = hasFoldableLine || i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ";
3067
- previousLineBreak = i;
3068
- }
3069
- } else if (!isPrintable(char)) return STYLE_DOUBLE;
3070
- prev_char = i > 0 ? string.charCodeAt(i - 1) : null;
3071
- plain = plain && isPlainSafe(char, prev_char);
3072
- }
3073
- hasFoldableLine = hasFoldableLine || shouldTrackWidth && i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ";
3074
- }
3075
- if (!hasLineBreak && !hasFoldableLine) return plain && !testAmbiguousType(string) ? STYLE_PLAIN : STYLE_SINGLE;
3076
- if (indentPerLevel > 9 && needIndentIndicator(string)) return STYLE_DOUBLE;
3077
- return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
3078
- }
3079
- function writeScalar(state, string, level, iskey, pointer) {
3080
- var _result = function() {
3081
- if (string.length === 0) return "''";
3082
- if (!state.noCompatMode && DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1) return "'" + string + "'";
3083
- var indent = state.indent * Math.max(1, level);
3084
- var lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
3085
- var singleLineOnly = iskey || state.flowLevel > -1 && level >= state.flowLevel;
3086
- function testAmbiguity(string) {
3087
- return testImplicitResolving(state, string);
3088
- }
3089
- switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity)) {
3090
- case STYLE_PLAIN: return string;
3091
- case STYLE_SINGLE: return "'" + string.replace(/'/g, "''") + "'";
3092
- case STYLE_LITERAL: return "|" + blockHeader(string, state.indent) + dropEndingNewline(indentString(string, indent));
3093
- case STYLE_FOLDED: return ">" + blockHeader(string, state.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
3094
- case STYLE_DOUBLE: return "\"" + escapeString(string) + "\"";
3095
- default: throw new YAMLException("impossible error: invalid scalar style");
3096
- }
3097
- }();
3098
- if (!iskey) {
3099
- let comment = new Comments(state, pointer).write(level, "before-eol");
3100
- if (comment !== "") _result += " " + comment;
3101
- }
3102
- state.dump = _result;
3103
- }
3104
- function blockHeader(string, indentPerLevel) {
3105
- var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : "";
3106
- var clip = string[string.length - 1] === "\n";
3107
- return indentIndicator + (clip && (string[string.length - 2] === "\n" || string === "\n") ? "+" : clip ? "" : "-") + "\n";
3108
- }
3109
- function dropEndingNewline(string) {
3110
- return string[string.length - 1] === "\n" ? string.slice(0, -1) : string;
3111
- }
3112
- function foldString(string, width) {
3113
- var lineRe = /(\n+)([^\n]*)/g;
3114
- var result = function() {
3115
- var nextLF = string.indexOf("\n");
3116
- nextLF = nextLF !== -1 ? nextLF : string.length;
3117
- lineRe.lastIndex = nextLF;
3118
- return foldLine(string.slice(0, nextLF), width);
3119
- }();
3120
- var prevMoreIndented = string[0] === "\n" || string[0] === " ";
3121
- var moreIndented;
3122
- var match;
3123
- while (match = lineRe.exec(string)) {
3124
- var prefix = match[1];
3125
- var line = match[2];
3126
- moreIndented = line[0] === " ";
3127
- result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + foldLine(line, width);
3128
- prevMoreIndented = moreIndented;
3129
- }
3130
- return result;
3131
- }
3132
- function foldLine(line, width) {
3133
- if (line === "" || line[0] === " ") return line;
3134
- var breakRe = / [^ ]/g;
3135
- var match;
3136
- var start = 0;
3137
- var end;
3138
- var curr = 0;
3139
- var next = 0;
3140
- var result = "";
3141
- while (match = breakRe.exec(line)) {
3142
- next = match.index;
3143
- if (next - start > width) {
3144
- end = curr > start ? curr : next;
3145
- result += "\n" + line.slice(start, end);
3146
- start = end + 1;
3147
- }
3148
- curr = next;
3149
- }
3150
- result += "\n";
3151
- if (line.length - start > width && curr > start) result += line.slice(start, curr) + "\n" + line.slice(curr + 1);
3152
- else result += line.slice(start);
3153
- return result.slice(1);
3154
- }
3155
- function escapeString(string) {
3156
- var result = "";
3157
- var char;
3158
- var nextChar;
3159
- var escapeSeq;
3160
- for (var i = 0; i < string.length; i++) {
3161
- char = string.charCodeAt(i);
3162
- if (char >= 55296 && char <= 56319) {
3163
- nextChar = string.charCodeAt(i + 1);
3164
- if (nextChar >= 56320 && nextChar <= 57343) {
3165
- result += encodeHex((char - 55296) * 1024 + nextChar - 56320 + 65536);
3166
- i++;
3167
- continue;
3168
- }
3169
- }
3170
- escapeSeq = ESCAPE_SEQUENCES[char];
3171
- result += !escapeSeq && isPrintable(char) ? string[i] : escapeSeq || encodeHex(char);
3172
- }
3173
- return result;
3174
- }
3175
- function writeFlowSequence(state, level, object, pointer) {
3176
- var _result = "";
3177
- var _tag = state.tag;
3178
- var index;
3179
- var length;
3180
- for (index = 0, length = object.length; index < length; index += 1) if (writeNode(state, level, object[index], false, false, false, pointer)) {
3181
- if (index !== 0) _result += "," + (!state.condenseFlow ? " " : "");
3182
- _result += state.dump;
3183
- }
3184
- state.tag = _tag;
3185
- state.dump = "[" + _result + "]";
3186
- }
3187
- function writeBlockSequence(state, level, object, compact, pointer) {
3188
- var _result = "";
3189
- var _tag = state.tag;
3190
- var index;
3191
- var length;
3192
- var comments = new Comments(state, pointer);
3193
- _result += comments.write(level, "before-eol");
3194
- _result += comments.write(level, "leading");
3195
- for (index = 0, length = object.length; index < length; index += 1) {
3196
- _result += comments.writeAt(String(index), level, "before");
3197
- if (writeNode(state, level + 1, object[index], true, true, false, `${pointer}/${index}`)) {
3198
- if (!compact || index !== 0) _result += generateNextLine(state, level);
3199
- if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) _result += "-";
3200
- else _result += "- ";
3201
- _result += state.dump;
3202
- }
3203
- _result += comments.writeAt(String(index), level, "after");
3204
- }
3205
- state.tag = _tag;
3206
- state.dump = _result || "[]";
3207
- state.dump += comments.write(level, "trailing");
3208
- }
3209
- function writeFlowMapping(state, level, object, pointer) {
3210
- var _result = "";
3211
- var _tag = state.tag;
3212
- var objectKeyList = Object.keys(object);
3213
- var index;
3214
- var length;
3215
- var objectKey;
3216
- var objectValue;
3217
- var pairBuffer;
3218
- for (index = 0, length = objectKeyList.length; index < length; index += 1) {
3219
- pairBuffer = "";
3220
- if (index !== 0) pairBuffer += ", ";
3221
- if (state.condenseFlow) pairBuffer += "\"";
3222
- objectKey = objectKeyList[index];
3223
- objectValue = object[objectKey];
3224
- if (!writeNode(state, level, objectKey, false, false, false, pointer)) continue;
3225
- if (state.dump.length > 1024) pairBuffer += "? ";
3226
- pairBuffer += state.dump + (state.condenseFlow ? "\"" : "") + ":" + (state.condenseFlow ? "" : " ");
3227
- if (!writeNode(state, level, objectValue, false, false, false, pointer)) continue;
3228
- pairBuffer += state.dump;
3229
- _result += pairBuffer;
3230
- }
3231
- state.tag = _tag;
3232
- state.dump = "{" + _result + "}";
3233
- }
3234
- function writeBlockMapping(state, level, object, compact, pointer) {
3235
- var _result = "";
3236
- var _tag = state.tag;
3237
- var objectKeyList = Object.keys(object);
3238
- var index;
3239
- var length;
3240
- var objectKey;
3241
- var objectValue;
3242
- var explicitPair;
3243
- var pairBuffer;
3244
- if (state.sortKeys === true) objectKeyList.sort();
3245
- else if (typeof state.sortKeys === "function") objectKeyList.sort(state.sortKeys);
3246
- else if (state.sortKeys) throw new YAMLException("sortKeys must be a boolean or a function");
3247
- var comments = new Comments(state, pointer);
3248
- _result += comments.write(level, "before-eol");
3249
- _result += comments.write(level, "leading");
3250
- for (index = 0, length = objectKeyList.length; index < length; index += 1) {
3251
- pairBuffer = "";
3252
- if (!compact || index !== 0) pairBuffer += generateNextLine(state, level);
3253
- objectKey = objectKeyList[index];
3254
- objectValue = object[objectKey];
3255
- _result += comments.writeAt(objectKey, level, "before");
3256
- if (!writeNode(state, level + 1, objectKey, true, true, true, pointer)) continue;
3257
- explicitPair = state.tag !== null && state.tag !== "?" || state.dump && state.dump.length > 1024;
3258
- if (explicitPair) if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) pairBuffer += "?";
3259
- else pairBuffer += "? ";
3260
- pairBuffer += state.dump;
3261
- if (explicitPair) pairBuffer += generateNextLine(state, level);
3262
- if (!writeNode(state, level + 1, objectValue, true, explicitPair, false, `${pointer}/${encodeSegment(objectKey)}`)) continue;
3263
- if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) pairBuffer += ":";
3264
- else pairBuffer += ": ";
3265
- pairBuffer += state.dump;
3266
- _result += pairBuffer;
3267
- _result += comments.writeAt(level, objectKey, "after");
3268
- }
3269
- state.tag = _tag;
3270
- state.dump = _result || "{}";
3271
- state.dump += comments.write(level, "trailing");
3272
- }
3273
- function detectType(state, object, explicit) {
3274
- var _result;
3275
- var typeList = explicit ? state.explicitTypes : state.implicitTypes;
3276
- var index;
3277
- var length;
3278
- var type;
3279
- var style;
3280
- for (index = 0, length = typeList.length; index < length; index += 1) {
3281
- type = typeList[index];
3282
- if ((type.instanceOf || type.predicate) && (!type.instanceOf || typeof object === "object" && object instanceof type.instanceOf) && (!type.predicate || type.predicate(object))) {
3283
- state.tag = explicit ? type.tag : "?";
3284
- if (type.represent) {
3285
- style = state.styleMap[type.tag] || type.defaultStyle;
3286
- if (_toString.call(type.represent) === "[object Function]") _result = type.represent(object, style);
3287
- else if (_hasOwnProperty.call(type.represent, style)) _result = type.represent[style](object, style);
3288
- else throw new YAMLException("!<" + type.tag + "> tag resolver accepts not \"" + style + "\" style");
3289
- state.dump = _result;
3290
- }
3291
- return true;
3292
- }
3293
- }
3294
- return false;
3295
- }
3296
- function writeNode(state, level, object, block, compact, iskey, pointer) {
3297
- state.tag = null;
3298
- state.dump = object;
3299
- if (!detectType(state, object, false)) detectType(state, object, true);
3300
- var type = _toString.call(state.dump);
3301
- if (block) block = state.flowLevel < 0 || state.flowLevel > level;
3302
- if (state.tag !== null && state.tag !== "?" || state.indent !== 2 && level > 0) compact = false;
3303
- var objectOrArray = type === "[object Object]" || type === "[object Array]";
3304
- var duplicateIndex;
3305
- var duplicate;
3306
- if (objectOrArray) {
3307
- duplicateIndex = state.duplicates.indexOf(object);
3308
- duplicate = duplicateIndex !== -1;
3309
- }
3310
- if (state.tag !== null && state.tag !== "?" || duplicate || state.indent !== 2 && level > 0) compact = false;
3311
- if (duplicate && state.usedDuplicates[duplicateIndex]) state.dump = "*ref_" + duplicateIndex;
3312
- else {
3313
- if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) state.usedDuplicates[duplicateIndex] = true;
3314
- if (type === "[object Object]") if (block && Object.keys(state.dump).length !== 0) {
3315
- writeBlockMapping(state, level, state.dump, compact, pointer);
3316
- if (duplicate) state.dump = "&ref_" + duplicateIndex + state.dump;
3317
- } else {
3318
- writeFlowMapping(state, level, state.dump, pointer);
3319
- if (duplicate) state.dump = "&ref_" + duplicateIndex + " " + state.dump;
3320
- }
3321
- else if (type === "[object Array]") {
3322
- var arrayLevel = state.noArrayIndent && level > 0 ? level - 1 : level;
3323
- if (block && state.dump.length !== 0) {
3324
- writeBlockSequence(state, arrayLevel, state.dump, compact, pointer);
3325
- if (duplicate) state.dump = "&ref_" + duplicateIndex + state.dump;
3326
- } else {
3327
- writeFlowSequence(state, arrayLevel, state.dump, pointer);
3328
- if (duplicate) state.dump = "&ref_" + duplicateIndex + " " + state.dump;
3329
- }
3330
- } else if (type === "[object String]") {
3331
- if (state.tag !== "?") writeScalar(state, state.dump, level, iskey, pointer);
3332
- } else {
3333
- if (state.skipInvalid) return false;
3334
- throw new YAMLException("unacceptable kind of an object to dump " + type);
3335
- }
3336
- if (state.tag !== null && state.tag !== "?") state.dump = "!<" + state.tag + "> " + state.dump;
3337
- }
3338
- return true;
3339
- }
3340
- function getDuplicateReferences(object, state) {
3341
- var objects = [];
3342
- var duplicatesIndexes = [];
3343
- var index;
3344
- var length;
3345
- inspectNode(object, objects, duplicatesIndexes);
3346
- for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) state.duplicates.push(objects[duplicatesIndexes[index]]);
3347
- state.usedDuplicates = new Array(length);
3348
- }
3349
- function inspectNode(object, objects, duplicatesIndexes) {
3350
- var objectKeyList;
3351
- var index;
3352
- var length;
3353
- if (object !== null && typeof object === "object") {
3354
- index = objects.indexOf(object);
3355
- if (index !== -1) {
3356
- if (duplicatesIndexes.indexOf(index) === -1) duplicatesIndexes.push(index);
3357
- } else {
3358
- objects.push(object);
3359
- if (Array.isArray(object)) for (index = 0, length = object.length; index < length; index += 1) inspectNode(object[index], objects, duplicatesIndexes);
3360
- else {
3361
- objectKeyList = Object.keys(object);
3362
- for (index = 0, length = objectKeyList.length; index < length; index += 1) inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
3363
- }
3364
- }
3365
- }
3366
- }
3367
- function dump(input, options) {
3368
- options = options || {};
3369
- var state = new State(options);
3370
- if (!options.noRefs) getDuplicateReferences(input, state);
3371
- if (writeNode(state, 0, input, true, true, false, "#")) return state.dump + "\n";
3372
- return "";
3373
- }
3374
- exports.dump = dump;
3375
- function safeDump(input, options) {
3376
- return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
3377
- }
3378
- exports.safeDump = safeDump;
3379
- const TILDE_REGEXP = /~/g;
3380
- const SLASH_REGEXP = /\//g;
3381
- function encodeSegment(input) {
3382
- return input.replace(TILDE_REGEXP, "~0").replace(SLASH_REGEXP, "~1");
3383
- }
3384
- function Comments(state, pointer) {
3385
- this.state = state;
3386
- this.comments = {
3387
- "before-eol": /* @__PURE__ */ new Set(),
3388
- leading: /* @__PURE__ */ new Set(),
3389
- trailing: /* @__PURE__ */ new Set(),
3390
- before: /* @__PURE__ */ new Map(),
3391
- after: /* @__PURE__ */ new Map()
3392
- };
3393
- this.written = /* @__PURE__ */ new WeakSet();
3394
- if (state.comments !== null && pointer in state.comments) for (let comment of state.comments[pointer]) switch (comment.placement) {
3395
- case "before-eol":
3396
- case "leading":
3397
- case "trailing":
3398
- this.comments[comment.placement].add(comment);
3399
- break;
3400
- case "between":
3401
- let before = this.comments.before.get(comment.between[1]);
3402
- if (!before) this.comments.before.set(comment.between[1], new Set([comment]));
3403
- else before.add(comment);
3404
- let after = this.comments.after.get(comment.between[0]);
3405
- if (!after) this.comments.after.set(comment.between[0], new Set([comment]));
3406
- else after.add(comment);
3407
- break;
3408
- }
3409
- }
3410
- Comments.prototype.write = function(level, placement) {
3411
- let result = "";
3412
- for (let comment of this.comments[placement]) result += this._write(comment, level);
3413
- return result;
3414
- };
3415
- Comments.prototype.writeAt = function(key, level, placement) {
3416
- let result = "";
3417
- let comments = this.comments[placement].get(key);
3418
- if (comments) for (let comment of comments) result += this._write(comment, level);
3419
- return result;
3420
- };
3421
- Comments.prototype._write = function(comment, level) {
3422
- if (this.written.has(comment)) return "";
3423
- this.written.add(comment);
3424
- let result = "#" + comment.value;
3425
- if (comment.placement === "before-eol") return result;
3426
- else if (level === 0 && comment.placement === "leading") return result + "\n";
3427
- else return generateNextLine(this.state, level) + result;
3428
- };
3429
- }));
3430
- //#endregion
3431
- //#region ../../node_modules/.pnpm/@stoplight+yaml-ast-parser@0.0.50/node_modules/@stoplight/yaml-ast-parser/dist/src/scalarInference.js
3432
- var require_scalarInference = /* @__PURE__ */ __commonJSMin(((exports) => {
3433
- Object.defineProperty(exports, "__esModule", { value: true });
3434
- function parseYamlBoolean(input) {
3435
- if ([
3436
- "true",
3437
- "True",
3438
- "TRUE"
3439
- ].lastIndexOf(input) >= 0) return true;
3440
- else if ([
3441
- "false",
3442
- "False",
3443
- "FALSE"
3444
- ].lastIndexOf(input) >= 0) return false;
3445
- throw `Invalid boolean "${input}"`;
3446
- }
3447
- exports.parseYamlBoolean = parseYamlBoolean;
3448
- function safeParseYamlInteger(input) {
3449
- if (input.lastIndexOf("0o", 0) === 0) return parseInt(input.substring(2), 8);
3450
- return parseInt(input);
3451
- }
3452
- function parseYamlInteger(input) {
3453
- const result = safeParseYamlInteger(input);
3454
- if (Number.isNaN(result)) throw `Invalid integer "${input}"`;
3455
- return result;
3456
- }
3457
- exports.parseYamlInteger = parseYamlInteger;
3458
- function parseYamlBigInteger(input) {
3459
- const result = parseYamlInteger(input);
3460
- if (result > Number.MAX_SAFE_INTEGER && input.lastIndexOf("0o", 0) === -1) return BigInt(input);
3461
- return result;
3462
- }
3463
- exports.parseYamlBigInteger = parseYamlBigInteger;
3464
- function parseYamlFloat(input) {
3465
- if ([
3466
- ".nan",
3467
- ".NaN",
3468
- ".NAN"
3469
- ].lastIndexOf(input) >= 0) return NaN;
3470
- const match = /^([-+])?(?:\.inf|\.Inf|\.INF)$/.exec(input);
3471
- if (match) return match[1] === "-" ? -Infinity : Infinity;
3472
- const result = parseFloat(input);
3473
- if (!isNaN(result)) return result;
3474
- throw `Invalid float "${input}"`;
3475
- }
3476
- exports.parseYamlFloat = parseYamlFloat;
3477
- var ScalarType;
3478
- (function(ScalarType) {
3479
- ScalarType[ScalarType["null"] = 0] = "null";
3480
- ScalarType[ScalarType["bool"] = 1] = "bool";
3481
- ScalarType[ScalarType["int"] = 2] = "int";
3482
- ScalarType[ScalarType["float"] = 3] = "float";
3483
- ScalarType[ScalarType["string"] = 4] = "string";
3484
- })(ScalarType = exports.ScalarType || (exports.ScalarType = {}));
3485
- function determineScalarType(node) {
3486
- if (node === void 0) return ScalarType.null;
3487
- if (node.doubleQuoted || !node.plainScalar || node["singleQuoted"]) return ScalarType.string;
3488
- const value = node.value;
3489
- if ([
3490
- "null",
3491
- "Null",
3492
- "NULL",
3493
- "~",
3494
- ""
3495
- ].indexOf(value) >= 0) return ScalarType.null;
3496
- if (value === null || value === void 0) return ScalarType.null;
3497
- if ([
3498
- "true",
3499
- "True",
3500
- "TRUE",
3501
- "false",
3502
- "False",
3503
- "FALSE"
3504
- ].indexOf(value) >= 0) return ScalarType.bool;
3505
- if (/^[-+]?[0-9]+$/.test(value) || /^0o[0-7]+$/.test(value) || /^0x[0-9a-fA-F]+$/.test(value)) return ScalarType.int;
3506
- if (/^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$/.test(value) || /^[-+]?(\.inf|\.Inf|\.INF)$/.test(value) || [
3507
- ".nan",
3508
- ".NaN",
3509
- ".NAN"
3510
- ].indexOf(value) >= 0) return ScalarType.float;
3511
- return ScalarType.string;
3512
- }
3513
- exports.determineScalarType = determineScalarType;
3514
- }));
3515
- //#endregion
3516
- //#region ../../node_modules/.pnpm/@stoplight+yaml-ast-parser@0.0.50/node_modules/@stoplight/yaml-ast-parser/dist/src/index.js
3517
- var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
3518
- function __export(m) {
3519
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
3520
- }
3521
- Object.defineProperty(exports, "__esModule", { value: true });
3522
- var loader_1 = require_loader();
3523
- exports.load = loader_1.load;
3524
- exports.loadAll = loader_1.loadAll;
3525
- exports.safeLoad = loader_1.safeLoad;
3526
- exports.safeLoadAll = loader_1.safeLoadAll;
3527
- var dumper_1 = require_dumper();
3528
- exports.dump = dumper_1.dump;
3529
- exports.safeDump = dumper_1.safeDump;
3530
- exports.YAMLException = require_exception();
3531
- __export(require_yamlAST());
3532
- __export(require_scalarInference());
3533
- }));
3534
- //#endregion
3535
- //#region ../../node_modules/.pnpm/@stoplight+yaml@4.3.0/node_modules/@stoplight/yaml/types.js
3536
- var require_types = /* @__PURE__ */ __commonJSMin(((exports) => {
3537
- Object.defineProperty(exports, "__esModule", { value: true });
3538
- const yaml_ast_parser_1 = require_src$1();
3539
- exports.Kind = yaml_ast_parser_1.Kind;
3540
- exports.ScalarType = yaml_ast_parser_1.ScalarType;
3541
- }));
3542
- //#endregion
3543
- //#region ../../node_modules/.pnpm/@stoplight+yaml@4.3.0/node_modules/@stoplight/yaml/utils.js
3544
- var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
3545
- Object.defineProperty(exports, "__esModule", { value: true });
3546
- exports.isObject = (sth) => sth !== null && typeof sth === "object";
3547
- }));
3548
- //#endregion
3549
- //#region ../../node_modules/.pnpm/@stoplight+yaml@4.3.0/node_modules/@stoplight/yaml/buildJsonPath.js
3550
- var require_buildJsonPath = /* @__PURE__ */ __commonJSMin(((exports) => {
3551
- Object.defineProperty(exports, "__esModule", { value: true });
3552
- const types_1 = require_types();
3553
- const utils_1 = require_utils();
3554
- function buildJsonPath(node) {
3555
- const path = [];
3556
- let prevNode = node;
3557
- while (node) {
3558
- switch (node.kind) {
3559
- case types_1.Kind.SCALAR:
3560
- path.unshift(node.value);
3561
- break;
3562
- case types_1.Kind.MAPPING:
3563
- if (prevNode !== node.key) if (path.length > 0 && utils_1.isObject(node.value) && node.value.value === path[0]) path[0] = node.key.value;
3564
- else path.unshift(node.key.value);
3565
- break;
3566
- case types_1.Kind.SEQ:
3567
- if (prevNode) {
3568
- const index = node.items.indexOf(prevNode);
3569
- if (prevNode.kind === types_1.Kind.SCALAR) path[0] = index;
3570
- else if (index !== -1) path.unshift(index);
3571
- }
3572
- break;
3573
- }
3574
- prevNode = node;
3575
- node = node.parent;
3576
- }
3577
- return path;
3578
- }
3579
- exports.buildJsonPath = buildJsonPath;
3580
- }));
3581
- //#endregion
3582
- //#region ../../node_modules/.pnpm/@stoplight+yaml@4.3.0/node_modules/@stoplight/yaml/dereferenceAnchor.js
3583
- var require_dereferenceAnchor = /* @__PURE__ */ __commonJSMin(((exports) => {
3584
- Object.defineProperty(exports, "__esModule", { value: true });
3585
- const types_1 = require_types();
3586
- const utils_1 = require_utils();
3587
- exports.dereferenceAnchor = (node, anchorId) => {
3588
- if (!utils_1.isObject(node)) return node;
3589
- if (node.kind === types_1.Kind.ANCHOR_REF && node.referencesAnchor === anchorId) return null;
3590
- switch (node.kind) {
3591
- case types_1.Kind.MAP: return Object.assign({}, node, { mappings: node.mappings.map((mapping) => exports.dereferenceAnchor(mapping, anchorId)) });
3592
- case types_1.Kind.SEQ: return Object.assign({}, node, { items: node.items.map((item) => exports.dereferenceAnchor(item, anchorId)) });
3593
- case types_1.Kind.MAPPING: return Object.assign({}, node, { value: exports.dereferenceAnchor(node.value, anchorId) });
3594
- case types_1.Kind.SCALAR: return node;
3595
- case types_1.Kind.ANCHOR_REF:
3596
- if (utils_1.isObject(node.value) && isSelfReferencingAnchorRef(node)) return null;
3597
- return node;
3598
- default: return node;
3599
- }
3600
- };
3601
- const isSelfReferencingAnchorRef = (anchorRef) => {
3602
- const { referencesAnchor } = anchorRef;
3603
- let node = anchorRef;
3604
- while (node = node.parent) if ("anchorId" in node && node.anchorId === referencesAnchor) return true;
3605
- return false;
3606
- };
3607
- }));
3608
- //#endregion
3609
- //#region ../../node_modules/.pnpm/@stoplight+yaml@4.3.0/node_modules/@stoplight/yaml/getJsonPathForPosition.js
3610
- var require_getJsonPathForPosition = /* @__PURE__ */ __commonJSMin(((exports) => {
3611
- Object.defineProperty(exports, "__esModule", { value: true });
3612
- const buildJsonPath_1 = require_buildJsonPath();
3613
- const types_1 = require_types();
3614
- const utils_1 = require_utils();
3615
- exports.getJsonPathForPosition = ({ ast, lineMap }, { line, character }) => {
3616
- if (line >= lineMap.length || character >= lineMap[line]) return;
3617
- const startOffset = line === 0 ? 0 : lineMap[line - 1] + 1;
3618
- const node = findClosestScalar(ast, Math.min(lineMap[line] - 1, startOffset + character), line, lineMap);
3619
- if (!utils_1.isObject(node)) return;
3620
- const path = buildJsonPath_1.buildJsonPath(node);
3621
- if (path.length === 0) return;
3622
- return path;
3623
- };
3624
- function* walk(node) {
3625
- switch (node.kind) {
3626
- case types_1.Kind.MAP:
3627
- if (node.mappings.length !== 0) {
3628
- for (const mapping of node.mappings) if (utils_1.isObject(mapping)) yield mapping;
3629
- }
3630
- break;
3631
- case types_1.Kind.MAPPING:
3632
- if (utils_1.isObject(node.key)) yield node.key;
3633
- if (utils_1.isObject(node.value)) yield node.value;
3634
- break;
3635
- case types_1.Kind.SEQ:
3636
- if (node.items.length !== 0) {
3637
- for (const item of node.items) if (utils_1.isObject(item)) yield item;
3638
- }
3639
- break;
3640
- case types_1.Kind.SCALAR:
3641
- yield node;
3642
- break;
3643
- }
3644
- }
3645
- function getFirstScalarChild(node, line, lineMap) {
3646
- const startOffset = lineMap[line - 1] + 1;
3647
- const endOffset = lineMap[line];
3648
- switch (node.kind) {
3649
- case types_1.Kind.MAPPING: return node.key;
3650
- case types_1.Kind.MAP:
3651
- if (node.mappings.length !== 0) {
3652
- for (const mapping of node.mappings) if (mapping.startPosition > startOffset && mapping.startPosition <= endOffset) return getFirstScalarChild(mapping, line, lineMap);
3653
- }
3654
- break;
3655
- case types_1.Kind.SEQ:
3656
- if (node.items.length !== 0) {
3657
- for (const item of node.items) if (item !== null && item.startPosition > startOffset && item.startPosition <= endOffset) return getFirstScalarChild(item, line, lineMap);
3658
- }
3659
- break;
3660
- }
3661
- return node;
3662
- }
3663
- function findClosestScalar(container, offset, line, lineMap) {
3664
- for (const node of walk(container)) if (node.startPosition <= offset && offset <= node.endPosition) return node.kind === types_1.Kind.SCALAR ? node : findClosestScalar(node, offset, line, lineMap);
3665
- if (lineMap[line - 1] === lineMap[line] - 1) return container;
3666
- if (container.startPosition < lineMap[line - 1] && offset <= container.endPosition) {
3667
- if (container.kind !== types_1.Kind.MAPPING) return getFirstScalarChild(container, line, lineMap);
3668
- if (container.value && container.key.endPosition < offset) return getFirstScalarChild(container.value, line, lineMap);
3669
- }
3670
- return container;
3671
- }
3672
- }));
3673
- //#endregion
3674
- //#region ../../node_modules/.pnpm/@stoplight+yaml@4.3.0/node_modules/@stoplight/yaml/lineForPosition.js
3675
- var require_lineForPosition = /* @__PURE__ */ __commonJSMin(((exports) => {
3676
- Object.defineProperty(exports, "__esModule", { value: true });
3677
- exports.lineForPosition = (pos, lines, start = 0, end) => {
3678
- if (pos === 0 || lines.length === 0 || pos < lines[0]) return 0;
3679
- if (typeof end === "undefined") end = lines.length;
3680
- const target = Math.floor((end - start) / 2) + start;
3681
- if (pos >= lines[target] && !lines[target + 1]) return target + 1;
3682
- const nextLinePos = lines[Math.min(target + 1, lines.length)];
3683
- if (pos === lines[target] - 1) return target;
3684
- if (pos >= lines[target] && pos <= nextLinePos) {
3685
- if (pos === nextLinePos) return target + 2;
3686
- return target + 1;
3687
- }
3688
- if (pos > lines[target]) return exports.lineForPosition(pos, lines, target + 1, end);
3689
- else return exports.lineForPosition(pos, lines, start, target - 1);
3690
- };
3691
- }));
181
+ return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true);
182
+ }
3692
183
  //#endregion
3693
- //#region ../../node_modules/.pnpm/@stoplight+yaml@4.3.0/node_modules/@stoplight/yaml/getLocationForJsonPath.js
3694
- var require_getLocationForJsonPath = /* @__PURE__ */ __commonJSMin(((exports) => {
3695
- Object.defineProperty(exports, "__esModule", { value: true });
3696
- const lineForPosition_1 = require_lineForPosition();
3697
- const types_1 = require_types();
3698
- const utils_1 = require_utils();
3699
- exports.getLocationForJsonPath = ({ ast, lineMap, metadata }, path, closest = false) => {
3700
- const node = findNodeAtPath(ast, path, {
3701
- closest,
3702
- mergeKeys: metadata !== void 0 && metadata.mergeKeys === true
3703
- });
3704
- if (node === void 0) return;
3705
- return getLoc(lineMap, {
3706
- start: getStartPosition(node, lineMap.length > 0 ? lineMap[0] : 0),
3707
- end: getEndPosition(node)
3708
- });
3709
- };
3710
- function getStartPosition(node, offset) {
3711
- if (node.parent && node.parent.kind === types_1.Kind.MAPPING) {
3712
- if (node.parent.value === null) return node.parent.endPosition;
3713
- if (node.kind !== types_1.Kind.SCALAR) return node.parent.key.endPosition + 1;
3714
- }
3715
- if (node.parent === null && offset - node.startPosition === 0) return 0;
3716
- return node.startPosition;
3717
- }
3718
- function getEndPosition(node) {
3719
- switch (node.kind) {
3720
- case types_1.Kind.SEQ:
3721
- const { items } = node;
3722
- if (items.length !== 0) {
3723
- const lastItem = items[items.length - 1];
3724
- if (lastItem !== null) return getEndPosition(lastItem);
3725
- }
3726
- break;
3727
- case types_1.Kind.MAPPING:
3728
- if (node.value !== null) return getEndPosition(node.value);
3729
- break;
3730
- case types_1.Kind.MAP:
3731
- if (node.value !== null && node.mappings.length !== 0) return getEndPosition(node.mappings[node.mappings.length - 1]);
3732
- break;
3733
- case types_1.Kind.SCALAR:
3734
- if (node.parent !== null && node.parent.kind === types_1.Kind.MAPPING && node.parent.value === null) return node.parent.endPosition;
3735
- break;
3736
- }
3737
- return node.endPosition;
3738
- }
3739
- function findNodeAtPath(node, path, { closest, mergeKeys }) {
3740
- pathLoop: for (const segment of path) {
3741
- if (!utils_1.isObject(node)) return closest ? node : void 0;
3742
- switch (node.kind) {
3743
- case types_1.Kind.MAP:
3744
- const mappings = getMappings(node.mappings, mergeKeys);
3745
- for (let i = mappings.length - 1; i >= 0; i--) {
3746
- const item = mappings[i];
3747
- if (item.key.value === segment) {
3748
- if (item.value === null) node = item.key;
3749
- else node = item.value;
3750
- continue pathLoop;
3751
- }
3752
- }
3753
- return closest ? node : void 0;
3754
- case types_1.Kind.SEQ:
3755
- for (let i = 0; i < node.items.length; i++) if (i === Number(segment)) {
3756
- const item = node.items[i];
3757
- if (item === null) break;
3758
- node = item;
3759
- continue pathLoop;
3760
- }
3761
- return closest ? node : void 0;
3762
- default: return closest ? node : void 0;
3763
- }
3764
- }
3765
- return node;
3766
- }
3767
- function getMappings(mappings, mergeKeys) {
3768
- if (!mergeKeys) return mappings;
3769
- return mappings.reduce((mergedMappings, mapping) => {
3770
- if (utils_1.isObject(mapping)) if (mapping.key.value === "<<") mergedMappings.push(...reduceMergeKeys(mapping.value));
3771
- else mergedMappings.push(mapping);
3772
- return mergedMappings;
3773
- }, []);
3774
- }
3775
- function reduceMergeKeys(node) {
3776
- if (!utils_1.isObject(node)) return [];
3777
- switch (node.kind) {
3778
- case types_1.Kind.SEQ: return node.items.reduceRight((items, item) => {
3779
- items.push(...reduceMergeKeys(item));
3780
- return items;
3781
- }, []);
3782
- case types_1.Kind.MAP: return node.mappings;
3783
- case types_1.Kind.ANCHOR_REF: return reduceMergeKeys(node.value);
3784
- default: return [];
3785
- }
184
+ //#region ../../internals/utils/src/reserved.ts
185
+ /**
186
+ * Returns `true` when `name` is a syntactically valid JavaScript variable name.
187
+ */
188
+ function isValidVarName(name) {
189
+ try {
190
+ new Function(`var ${name}`);
191
+ } catch {
192
+ return false;
3786
193
  }
3787
- const getLoc = (lineMap, { start = 0, end = 0 }) => {
3788
- const startLine = lineForPosition_1.lineForPosition(start, lineMap);
3789
- const endLine = lineForPosition_1.lineForPosition(end, lineMap);
3790
- return { range: {
3791
- start: {
3792
- line: startLine,
3793
- character: start - (startLine === 0 ? 0 : lineMap[startLine - 1])
3794
- },
3795
- end: {
3796
- line: endLine,
3797
- character: end - (endLine === 0 ? 0 : lineMap[endLine - 1])
3798
- }
3799
- } };
3800
- };
3801
- }));
194
+ return true;
195
+ }
3802
196
  //#endregion
3803
- //#region ../../node_modules/.pnpm/@stoplight+ordered-object-literal@1.0.5/node_modules/@stoplight/ordered-object-literal/src/index.cjs
3804
- var require_src = /* @__PURE__ */ __commonJSMin(((exports) => {
3805
- Object.defineProperty(exports, "__esModule", { value: true });
3806
- const ORDER_KEY_ID = `__object_order_${Math.floor(Date.now() / 36e5)}__`;
3807
- const ORDER_KEY = Symbol.for(ORDER_KEY_ID);
3808
- const STRINGIFIED_ORDER_KEY = String(ORDER_KEY);
3809
- const traps = {
3810
- defineProperty(target, key, descriptor) {
3811
- if (!Object.prototype.hasOwnProperty.call(target, key) && ORDER_KEY in target) target[ORDER_KEY].push(key);
3812
- else if ("value" in descriptor && key === ORDER_KEY && descriptor.value.lastIndexOf(ORDER_KEY) === -1) descriptor.value.push(ORDER_KEY);
3813
- return Reflect.defineProperty(target, key, descriptor);
3814
- },
3815
- deleteProperty(target, key) {
3816
- const hasKey = Object.prototype.hasOwnProperty.call(target, key);
3817
- const deleted = Reflect.deleteProperty(target, key);
3818
- if (deleted && hasKey && ORDER_KEY in target) {
3819
- const index = target[ORDER_KEY].indexOf(key);
3820
- if (index !== -1) target[ORDER_KEY].splice(index, 1);
3821
- }
3822
- return deleted;
3823
- },
3824
- ownKeys(target) {
3825
- if (ORDER_KEY in target) return target[ORDER_KEY];
3826
- return Reflect.ownKeys(target);
3827
- },
3828
- set(target, key, value) {
3829
- const hasKey = Object.prototype.hasOwnProperty.call(target, key);
3830
- const set = Reflect.set(target, key, value);
3831
- if (set && !hasKey && ORDER_KEY in target) target[ORDER_KEY].push(key);
3832
- return set;
3833
- }
3834
- };
3835
- function createObj(target, order = Reflect.ownKeys(target)) {
3836
- assertObjectLiteral(target);
3837
- const t = new Proxy(target, traps);
3838
- setOrder(t, order);
3839
- return t;
3840
- }
3841
- function setOrder(target, order) {
3842
- if (ORDER_KEY in target) {
3843
- target[ORDER_KEY].length = 0;
3844
- target[ORDER_KEY].push(...order);
3845
- return true;
3846
- } else return Reflect.defineProperty(target, ORDER_KEY, {
3847
- configurable: true,
3848
- value: order
3849
- });
3850
- }
3851
- function getOrder(target) {
3852
- return target[ORDER_KEY];
3853
- }
3854
- function serializeArray(target) {
3855
- const newTarget = target.slice();
3856
- for (let i = 0; i < newTarget.length; i += 1) {
3857
- const value = newTarget[i];
3858
- if (isObject(value)) newTarget[i] = Array.isArray(value) ? serializeArray(value) : serialize(value, true);
3859
- }
3860
- return newTarget;
3861
- }
3862
- function serialize(target, deep) {
3863
- assertObjectLiteral(target, "Invalid target provided");
3864
- const newTarget = { ...target };
3865
- if (ORDER_KEY in target) Object.defineProperty(newTarget, STRINGIFIED_ORDER_KEY, {
3866
- enumerable: true,
3867
- value: target[ORDER_KEY].filter((item) => item !== ORDER_KEY)
3868
- });
3869
- if (deep) for (const key of Object.keys(target)) {
3870
- if (key === STRINGIFIED_ORDER_KEY) continue;
3871
- const value = target[key];
3872
- if (isObject(value)) newTarget[key] = Array.isArray(value) ? serializeArray(value) : serialize(value, true);
3873
- }
3874
- return newTarget;
3875
- }
3876
- function deserializeArray(target) {
3877
- for (let i = 0; i < target.length; i += 1) {
3878
- const value = target[i];
3879
- if (isObject(value)) target[i] = Array.isArray(value) ? deserializeArray(value) : deserialize(value, true);
3880
- }
3881
- return target;
3882
- }
3883
- function deserialize(target, deep) {
3884
- assertObjectLiteral(target, "Invalid target provided");
3885
- const newTarget = createObj(target, STRINGIFIED_ORDER_KEY in target ? target[STRINGIFIED_ORDER_KEY] : Reflect.ownKeys(target));
3886
- delete newTarget[STRINGIFIED_ORDER_KEY];
3887
- if (deep) for (const key of Object.keys(target)) {
3888
- const value = target[key];
3889
- if (isObject(value)) target[key] = Array.isArray(value) ? deserializeArray(value) : deserialize(value, true);
3890
- }
3891
- return newTarget;
3892
- }
3893
- function isOrderedObject(target) {
3894
- return ORDER_KEY in target;
197
+ //#region ../../internals/utils/src/urlPath.ts
198
+ /**
199
+ * Parses and transforms an OpenAPI/Swagger path string into various URL formats.
200
+ *
201
+ * @example
202
+ * const p = new URLPath('/pet/{petId}')
203
+ * p.URL // '/pet/:petId'
204
+ * p.template // '`/pet/${petId}`'
205
+ */
206
+ var URLPath = class {
207
+ /** The raw OpenAPI/Swagger path string, e.g. `/pet/{petId}`. */
208
+ path;
209
+ #options;
210
+ constructor(path, options = {}) {
211
+ this.path = path;
212
+ this.#options = options;
3895
213
  }
3896
- function isObject(maybeObj) {
3897
- return maybeObj !== null && typeof maybeObj === "object";
214
+ /** Converts the OpenAPI path to Express-style colon syntax, e.g. `/pet/{petId}` → `/pet/:petId`. */
215
+ get URL() {
216
+ return this.toURLPath();
3898
217
  }
3899
- function isObjectLiteral(obj) {
3900
- if (!isObject(obj)) return false;
3901
- if (obj[Symbol.toStringTag] !== void 0) {
3902
- const proto = Object.getPrototypeOf(obj);
3903
- return proto === null || proto === Object.prototype;
218
+ /** Returns `true` when `path` is a fully-qualified URL (e.g. starts with `https://`). */
219
+ get isURL() {
220
+ try {
221
+ return !!new URL(this.path).href;
222
+ } catch {
223
+ return false;
3904
224
  }
3905
- return toStringTag(obj) === "Object";
3906
- }
3907
- function toStringTag(obj) {
3908
- const tag = obj[Symbol.toStringTag];
3909
- if (typeof tag === "string") return tag;
3910
- const name = Reflect.apply(Object.prototype.toString, obj, []);
3911
- return name.slice(8, name.length - 1);
3912
- }
3913
- function assertObjectLiteral(maybeObj, message) {
3914
- if (isDevEnv() && !isObjectLiteral(maybeObj)) throw new TypeError(message);
3915
225
  }
3916
- function isDevEnv() {
3917
- if (typeof process === "undefined" || !isObject(process) || !isObject(process.env)) return false;
3918
- return process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
3919
- }
3920
- exports.ORDER_KEY_ID = ORDER_KEY_ID;
3921
- exports.default = createObj;
3922
- exports.deserialize = deserialize;
3923
- exports.getOrder = getOrder;
3924
- exports.isOrderedObject = isOrderedObject;
3925
- exports.serialize = serialize;
3926
- exports.setOrder = setOrder;
3927
- }));
3928
- //#endregion
3929
- //#region ../../node_modules/.pnpm/@stoplight+types@14.1.1/node_modules/@stoplight/types/dist/index.js
3930
- var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
3931
- Object.defineProperty(exports, "__esModule", { value: true });
3932
- exports.HttpOperationSecurityDeclarationTypes = void 0;
3933
- (function(HttpOperationSecurityDeclarationTypes) {
3934
- /** Indicates that the operation has no security declarations. */
3935
- HttpOperationSecurityDeclarationTypes["None"] = "none";
3936
- /** Indicates that the operation has explicit security declarations. */
3937
- HttpOperationSecurityDeclarationTypes["Declared"] = "declared";
3938
- /** Indicates that the operation inherits its security declarations from the service. */
3939
- HttpOperationSecurityDeclarationTypes["InheritedFromService"] = "inheritedFromService";
3940
- })(exports.HttpOperationSecurityDeclarationTypes || (exports.HttpOperationSecurityDeclarationTypes = {}));
3941
- exports.HttpParamStyles = void 0;
3942
- (function(HttpParamStyles) {
3943
- /** Used when OAS2 type !== array */
3944
- HttpParamStyles["Unspecified"] = "unspecified";
3945
- /**
3946
- * OAS 3.x style simple
3947
- * OAS 2 collectionFormat csv
3948
- */
3949
- HttpParamStyles["Simple"] = "simple";
3950
- /**
3951
- * OAS 3.x style matrix
3952
- * OAS 2 collectionFormat no support
3953
- */
3954
- HttpParamStyles["Matrix"] = "matrix";
3955
- /**
3956
- * OAS 3.x style label
3957
- * OAS 2 collectionFormat no support
3958
- */
3959
- HttpParamStyles["Label"] = "label";
3960
- /**
3961
- * OAS 3.x style form
3962
- * OAS 2 collectionFormat
3963
- * * csv, when explode === false
3964
- * * multi, when explode === true
3965
- */
3966
- HttpParamStyles["Form"] = "form";
3967
- /**
3968
- * OAS 3.x no support
3969
- * OAS 2 collectionFormat csv when explode === undefined
3970
- */
3971
- HttpParamStyles["CommaDelimited"] = "commaDelimited";
3972
- /**
3973
- * OAS 3.x style spaceDelimited
3974
- * OAS 2 collectionFormat ssv
3975
- */
3976
- HttpParamStyles["SpaceDelimited"] = "spaceDelimited";
3977
- /**
3978
- * OAS 3.x style spaceDelimited
3979
- * OAS 2 collectionFormat pipes
3980
- */
3981
- HttpParamStyles["PipeDelimited"] = "pipeDelimited";
3982
- /**
3983
- * OAS 3.x style deepObject
3984
- * OAS 2 collectionFormat no support
3985
- */
3986
- HttpParamStyles["DeepObject"] = "deepObject";
3987
- /**
3988
- * OAS 3.x style no support
3989
- * OAS 2 collectionFormat tsv
3990
- */
3991
- HttpParamStyles["TabDelimited"] = "tabDelimited";
3992
- })(exports.HttpParamStyles || (exports.HttpParamStyles = {}));
3993
226
  /**
3994
- * Represents the severity of diagnostics.
3995
- */
3996
- exports.DiagnosticSeverity = void 0;
3997
- (function(DiagnosticSeverity) {
3998
- /**
3999
- * Something not allowed by the rules of a language or other means.
4000
- */
4001
- DiagnosticSeverity[DiagnosticSeverity["Error"] = 0] = "Error";
4002
- /**
4003
- * Something suspicious but allowed.
4004
- */
4005
- DiagnosticSeverity[DiagnosticSeverity["Warning"] = 1] = "Warning";
4006
- /**
4007
- * Something to inform about but not a problem.
4008
- */
4009
- DiagnosticSeverity[DiagnosticSeverity["Information"] = 2] = "Information";
4010
- /**
4011
- * Something to hint to a better way of doing it, like proposing
4012
- * a refactoring.
4013
- */
4014
- DiagnosticSeverity[DiagnosticSeverity["Hint"] = 3] = "Hint";
4015
- })(exports.DiagnosticSeverity || (exports.DiagnosticSeverity = {}));
4016
- /**
4017
- * Stoplight node types
4018
- */
4019
- exports.NodeType = void 0;
4020
- (function(NodeType) {
4021
- NodeType["Article"] = "article";
4022
- NodeType["HttpService"] = "http_service";
4023
- NodeType["HttpServer"] = "http_server";
4024
- NodeType["HttpOperation"] = "http_operation";
4025
- NodeType["HttpCallback"] = "http_callback";
4026
- NodeType["HttpWebhook"] = "http_webhook";
4027
- NodeType["Model"] = "model";
4028
- NodeType["Generic"] = "generic";
4029
- NodeType["Unknown"] = "unknown";
4030
- NodeType["TableOfContents"] = "table_of_contents";
4031
- NodeType["SpectralRuleset"] = "spectral_ruleset";
4032
- NodeType["Styleguide"] = "styleguide";
4033
- NodeType["Image"] = "image";
4034
- NodeType["StoplightResolutions"] = "stoplight_resolutions";
4035
- NodeType["StoplightOverride"] = "stoplight_override";
4036
- })(exports.NodeType || (exports.NodeType = {}));
4037
- /**
4038
- * Node data formats
227
+ * Converts the OpenAPI path to a TypeScript template literal string.
228
+ *
229
+ * @example
230
+ * new URLPath('/pet/{petId}').template // '`/pet/${petId}`'
231
+ * new URLPath('/account/monetary-accountID').template // '`/account/${monetaryAccountId}`'
4039
232
  */
4040
- exports.NodeFormat = void 0;
4041
- (function(NodeFormat) {
4042
- NodeFormat["Json"] = "json";
4043
- NodeFormat["Markdown"] = "markdown";
4044
- NodeFormat["Yaml"] = "yaml";
4045
- NodeFormat["Javascript"] = "javascript";
4046
- NodeFormat["Apng"] = "apng";
4047
- NodeFormat["Avif"] = "avif";
4048
- NodeFormat["Bmp"] = "bmp";
4049
- NodeFormat["Gif"] = "gif";
4050
- NodeFormat["Jpeg"] = "jpeg";
4051
- NodeFormat["Png"] = "png";
4052
- NodeFormat["Svg"] = "svg";
4053
- NodeFormat["Webp"] = "webp";
4054
- })(exports.NodeFormat || (exports.NodeFormat = {}));
4055
- }));
4056
- //#endregion
4057
- //#region ../../node_modules/.pnpm/@stoplight+yaml@4.3.0/node_modules/@stoplight/yaml/parseWithPointers.js
4058
- var require_parseWithPointers = /* @__PURE__ */ __commonJSMin(((exports) => {
4059
- Object.defineProperty(exports, "__esModule", { value: true });
4060
- const ordered_object_literal_1 = require_src();
4061
- const types_1 = require_dist();
4062
- const yaml_ast_parser_1 = require_src$1();
4063
- const buildJsonPath_1 = require_buildJsonPath();
4064
- const dereferenceAnchor_1 = require_dereferenceAnchor();
4065
- const lineForPosition_1 = require_lineForPosition();
4066
- const types_2 = require_types();
4067
- const utils_1 = require_utils();
4068
- exports.parseWithPointers = (value, options) => {
4069
- const lineMap = computeLineMap(value);
4070
- const ast = yaml_ast_parser_1.load(value, Object.assign({}, options, { ignoreDuplicateKeys: true }));
4071
- const parsed = {
4072
- ast,
4073
- lineMap,
4074
- data: void 0,
4075
- diagnostics: [],
4076
- metadata: options,
4077
- comments: {}
4078
- };
4079
- if (!ast) return parsed;
4080
- const normalizedOptions = normalizeOptions(options);
4081
- const comments = new Comments(parsed.comments, Comments.mapComments(normalizedOptions.attachComments && ast.comments ? ast.comments : [], lineMap), ast, lineMap, "#");
4082
- parsed.data = walkAST({
4083
- lineMap,
4084
- diagnostics: parsed.diagnostics
4085
- }, ast, comments, normalizedOptions);
4086
- if (ast.errors) parsed.diagnostics.push(...transformErrors(ast.errors, lineMap));
4087
- if (parsed.diagnostics.length > 0) parsed.diagnostics.sort((itemA, itemB) => itemA.range.start.line - itemB.range.start.line);
4088
- if (Array.isArray(parsed.ast.errors)) parsed.ast.errors.length = 0;
4089
- return parsed;
4090
- };
4091
- const TILDE_REGEXP = /~/g;
4092
- const SLASH_REGEXP = /\//g;
4093
- function encodeSegment(input) {
4094
- return input.replace(TILDE_REGEXP, "~0").replace(SLASH_REGEXP, "~1");
4095
- }
4096
- const walkAST = (ctx, node, comments, options) => {
4097
- if (node) switch (node.kind) {
4098
- case types_2.Kind.MAP: {
4099
- const mapComments = comments.enter(node);
4100
- const { lineMap, diagnostics } = ctx;
4101
- const { preserveKeyOrder, ignoreDuplicateKeys, json, mergeKeys } = options;
4102
- const container = createMapContainer(preserveKeyOrder);
4103
- const seenKeys = [];
4104
- const handleMergeKeys = mergeKeys;
4105
- const yamlMode = !json;
4106
- const handleDuplicates = !ignoreDuplicateKeys;
4107
- for (const mapping of node.mappings) {
4108
- if (!validateMappingKey(mapping, lineMap, diagnostics, yamlMode)) continue;
4109
- const key = String(getScalarValue(mapping.key));
4110
- const mappingComments = mapComments.enter(mapping, encodeSegment(key));
4111
- if ((yamlMode || handleDuplicates) && (!handleMergeKeys || key !== "<<")) if (seenKeys.includes(key)) {
4112
- if (yamlMode) throw new Error("Duplicate YAML mapping key encountered");
4113
- if (handleDuplicates) diagnostics.push(createYAMLException(mapping.key, lineMap, "duplicate key"));
4114
- } else seenKeys.push(key);
4115
- if (handleMergeKeys && key === "<<") {
4116
- const reduced = reduceMergeKeys(walkAST(ctx, mapping.value, mappingComments, options), preserveKeyOrder);
4117
- Object.assign(container, reduced);
4118
- } else {
4119
- container[key] = walkAST(ctx, mapping.value, mappingComments, options);
4120
- if (preserveKeyOrder) pushKey(container, key);
4121
- }
4122
- mappingComments.attachComments();
4123
- }
4124
- mapComments.attachComments();
4125
- return container;
4126
- }
4127
- case types_2.Kind.SEQ: {
4128
- const nodeComments = comments.enter(node);
4129
- const container = node.items.map((item, i) => {
4130
- if (item !== null) {
4131
- const sequenceItemComments = nodeComments.enter(item, i);
4132
- const walked = walkAST(ctx, item, sequenceItemComments, options);
4133
- sequenceItemComments.attachComments();
4134
- return walked;
4135
- } else return null;
4136
- });
4137
- nodeComments.attachComments();
4138
- return container;
4139
- }
4140
- case types_2.Kind.SCALAR: {
4141
- const value = getScalarValue(node);
4142
- return !options.bigInt && typeof value === "bigint" ? Number(value) : value;
4143
- }
4144
- case types_2.Kind.ANCHOR_REF:
4145
- if (utils_1.isObject(node.value)) node.value = dereferenceAnchor_1.dereferenceAnchor(node.value, node.referencesAnchor);
4146
- return walkAST(ctx, node.value, comments, options);
4147
- default: return null;
4148
- }
4149
- return node;
4150
- };
4151
- function getScalarValue(node) {
4152
- switch (yaml_ast_parser_1.determineScalarType(node)) {
4153
- case types_2.ScalarType.null: return null;
4154
- case types_2.ScalarType.string: return String(node.value);
4155
- case types_2.ScalarType.bool: return yaml_ast_parser_1.parseYamlBoolean(node.value);
4156
- case types_2.ScalarType.int: return yaml_ast_parser_1.parseYamlBigInteger(node.value);
4157
- case types_2.ScalarType.float: return yaml_ast_parser_1.parseYamlFloat(node.value);
4158
- }
4159
- }
4160
- const computeLineMap = (input) => {
4161
- const lineMap = [];
4162
- let i = 0;
4163
- for (; i < input.length; i++) if (input[i] === "\n") lineMap.push(i + 1);
4164
- lineMap.push(i + 1);
4165
- return lineMap;
4166
- };
4167
- function getLineLength(lineMap, line) {
4168
- if (line === 0) return Math.max(0, lineMap[0] - 1);
4169
- return Math.max(0, lineMap[line] - lineMap[line - 1] - 1);
4170
- }
4171
- const transformErrors = (errors, lineMap) => {
4172
- const validations = [];
4173
- let possiblyUnexpectedFlow = -1;
4174
- let i = 0;
4175
- for (const error of errors) {
4176
- const validation = {
4177
- code: error.name,
4178
- message: error.reason,
4179
- severity: error.isWarning ? types_1.DiagnosticSeverity.Warning : types_1.DiagnosticSeverity.Error,
4180
- range: {
4181
- start: {
4182
- line: error.mark.line,
4183
- character: error.mark.column
4184
- },
4185
- end: {
4186
- line: error.mark.line,
4187
- character: error.mark.toLineEnd ? getLineLength(lineMap, error.mark.line) : error.mark.column
4188
- }
4189
- }
4190
- };
4191
- if (error.reason === "missed comma between flow collection entries") possiblyUnexpectedFlow = possiblyUnexpectedFlow === -1 ? i : possiblyUnexpectedFlow;
4192
- else if (possiblyUnexpectedFlow !== -1) {
4193
- validations[possiblyUnexpectedFlow].range.end = validation.range.end;
4194
- validations[possiblyUnexpectedFlow].message = "invalid mixed usage of block and flow styles";
4195
- validations.length = possiblyUnexpectedFlow + 1;
4196
- i = validations.length;
4197
- possiblyUnexpectedFlow = -1;
4198
- }
4199
- validations.push(validation);
4200
- i++;
4201
- }
4202
- return validations;
4203
- };
4204
- const reduceMergeKeys = (items, preserveKeyOrder) => {
4205
- if (Array.isArray(items)) return items.reduceRight(preserveKeyOrder ? (merged, item) => {
4206
- const keys = Object.keys(item);
4207
- Object.assign(merged, item);
4208
- for (let i = keys.length - 1; i >= 0; i--) unshiftKey(merged, keys[i]);
4209
- return merged;
4210
- } : (merged, item) => Object.assign(merged, item), createMapContainer(preserveKeyOrder));
4211
- return typeof items !== "object" || items === null ? null : Object(items);
4212
- };
4213
- function createMapContainer(preserveKeyOrder) {
4214
- return preserveKeyOrder ? ordered_object_literal_1.default({}) : {};
233
+ get template() {
234
+ return this.toTemplateString();
4215
235
  }
4216
- function deleteKey(container, key) {
4217
- if (!(key in container)) return;
4218
- const order = ordered_object_literal_1.getOrder(container);
4219
- const index = order.indexOf(key);
4220
- if (index !== -1) order.splice(index, 1);
236
+ /** Returns the path and its extracted params as a structured `URLObject`, or as a stringified expression when `stringify` is set. */
237
+ get object() {
238
+ return this.toObject();
4221
239
  }
4222
- function unshiftKey(container, key) {
4223
- deleteKey(container, key);
4224
- ordered_object_literal_1.getOrder(container).unshift(key);
240
+ /** Returns a map of path parameter names, or `undefined` when the path has no parameters. */
241
+ get params() {
242
+ return this.getParams();
4225
243
  }
4226
- function pushKey(container, key) {
4227
- deleteKey(container, key);
4228
- ordered_object_literal_1.getOrder(container).push(key);
244
+ #transformParam(raw) {
245
+ const param = isValidVarName(raw) ? raw : camelCase(raw);
246
+ return this.#options.casing === "camelcase" ? camelCase(param) : param;
4229
247
  }
4230
- function validateMappingKey(mapping, lineMap, diagnostics, yamlMode) {
4231
- if (mapping.key.kind !== types_2.Kind.SCALAR) {
4232
- if (!yamlMode) diagnostics.push(createYAMLIncompatibilityException(mapping.key, lineMap, "mapping key must be a string scalar", yamlMode));
4233
- return false;
4234
- }
4235
- if (!yamlMode) {
4236
- const type = typeof getScalarValue(mapping.key);
4237
- if (type !== "string") diagnostics.push(createYAMLIncompatibilityException(mapping.key, lineMap, `mapping key must be a string scalar rather than ${mapping.key.valueObject === null ? "null" : type}`, yamlMode));
248
+ /** Iterates over every `{param}` token in `path`, calling `fn` with the raw token and transformed name. */
249
+ #eachParam(fn) {
250
+ for (const match of this.path.matchAll(/\{([^}]+)\}/g)) {
251
+ const raw = match[1];
252
+ fn(raw, this.#transformParam(raw));
4238
253
  }
4239
- return true;
4240
254
  }
4241
- function createYAMLIncompatibilityException(node, lineMap, message, yamlMode) {
4242
- const exception = createYAMLException(node, lineMap, message);
4243
- exception.code = "YAMLIncompatibleValue";
4244
- exception.severity = yamlMode ? types_1.DiagnosticSeverity.Hint : types_1.DiagnosticSeverity.Warning;
4245
- return exception;
4246
- }
4247
- function createYAMLException(node, lineMap, message) {
4248
- return {
4249
- code: "YAMLException",
4250
- message,
4251
- severity: types_1.DiagnosticSeverity.Error,
4252
- path: buildJsonPath_1.buildJsonPath(node),
4253
- range: getRange(lineMap, node.startPosition, node.endPosition)
255
+ toObject({ type = "path", replacer, stringify } = {}) {
256
+ const object = {
257
+ url: type === "path" ? this.toURLPath() : this.toTemplateString({ replacer }),
258
+ params: this.getParams()
4254
259
  };
260
+ if (stringify) {
261
+ if (type === "template") return JSON.stringify(object).replaceAll("'", "").replaceAll(`"`, "");
262
+ if (object.params) return `{ url: '${object.url}', params: ${JSON.stringify(object.params).replaceAll("'", "").replaceAll(`"`, "")} }`;
263
+ return `{ url: '${object.url}' }`;
264
+ }
265
+ return object;
4255
266
  }
4256
- function getRange(lineMap, startPosition, endPosition) {
4257
- const startLine = lineForPosition_1.lineForPosition(startPosition, lineMap);
4258
- const endLine = lineForPosition_1.lineForPosition(endPosition, lineMap);
4259
- return {
4260
- start: {
4261
- line: startLine,
4262
- character: startLine === 0 ? startPosition : startPosition - lineMap[startLine - 1]
4263
- },
4264
- end: {
4265
- line: endLine,
4266
- character: endLine === 0 ? endPosition : endPosition - lineMap[endLine - 1]
4267
- }
4268
- };
267
+ /**
268
+ * Converts the OpenAPI path to a TypeScript template literal string.
269
+ * An optional `replacer` can transform each extracted parameter name before interpolation.
270
+ *
271
+ * @example
272
+ * new URLPath('/pet/{petId}').toTemplateString() // '`/pet/${petId}`'
273
+ */
274
+ toTemplateString({ prefix = "", replacer } = {}) {
275
+ return `\`${prefix}${this.path.split(/\{([^}]+)\}/).map((part, i) => {
276
+ if (i % 2 === 0) return part;
277
+ const param = this.#transformParam(part);
278
+ return `\${${replacer ? replacer(param) : param}}`;
279
+ }).join("")}\``;
4269
280
  }
4270
- var Comments = class Comments {
4271
- constructor(attachedComments, comments, node, lineMap, pointer) {
4272
- this.attachedComments = attachedComments;
4273
- this.node = node;
4274
- this.lineMap = lineMap;
4275
- this.pointer = pointer;
4276
- if (comments.length === 0) this.comments = [];
4277
- else {
4278
- const startPosition = this.getStartPosition(node);
4279
- const endPosition = this.getEndPosition(node);
4280
- const startLine = lineForPosition_1.lineForPosition(startPosition, this.lineMap);
4281
- const endLine = lineForPosition_1.lineForPosition(endPosition, this.lineMap);
4282
- const matchingComments = [];
4283
- for (let i = comments.length - 1; i >= 0; i--) {
4284
- const comment = comments[i];
4285
- if (comment.range.start.line >= startLine && comment.range.end.line <= endLine) {
4286
- matchingComments.push(comment);
4287
- comments.splice(i, 1);
4288
- }
4289
- }
4290
- this.comments = matchingComments;
4291
- }
4292
- }
4293
- getStartPosition(node) {
4294
- if (node.parent === null) return 0;
4295
- return node.kind === types_2.Kind.MAPPING ? node.key.startPosition : node.startPosition;
4296
- }
4297
- getEndPosition(node) {
4298
- switch (node.kind) {
4299
- case types_2.Kind.MAPPING: return node.value === null ? node.endPosition : this.getEndPosition(node.value);
4300
- case types_2.Kind.MAP: return node.mappings.length === 0 ? node.endPosition : node.mappings[node.mappings.length - 1].endPosition;
4301
- case types_2.Kind.SEQ: {
4302
- if (node.items.length === 0) return node.endPosition;
4303
- const lastItem = node.items[node.items.length - 1];
4304
- return lastItem === null ? node.endPosition : lastItem.endPosition;
4305
- }
4306
- default: return node.endPosition;
4307
- }
4308
- }
4309
- static mapComments(comments, lineMap) {
4310
- return comments.map((comment) => ({
4311
- value: comment.value,
4312
- range: getRange(lineMap, comment.startPosition, comment.endPosition),
4313
- startPosition: comment.startPosition,
4314
- endPosition: comment.endPosition
4315
- }));
4316
- }
4317
- enter(node, key) {
4318
- return new Comments(this.attachedComments, this.comments, node, this.lineMap, key === void 0 ? this.pointer : `${this.pointer}/${key}`);
4319
- }
4320
- static isLeading(node, startPosition) {
4321
- switch (node.kind) {
4322
- case types_2.Kind.MAP: return node.mappings.length === 0 || node.mappings[0].startPosition > startPosition;
4323
- case types_2.Kind.SEQ: {
4324
- if (node.items.length === 0) return true;
4325
- const firstItem = node.items[0];
4326
- return firstItem === null || firstItem.startPosition > startPosition;
4327
- }
4328
- case types_2.Kind.MAPPING: return node.value === null || node.value.startPosition > startPosition;
4329
- default: return false;
4330
- }
4331
- }
4332
- static isTrailing(node, endPosition) {
4333
- switch (node.kind) {
4334
- case types_2.Kind.MAP: return node.mappings.length > 0 && endPosition > node.mappings[node.mappings.length - 1].endPosition;
4335
- case types_2.Kind.SEQ:
4336
- if (node.items.length === 0) return false;
4337
- const lastItem = node.items[node.items.length - 1];
4338
- return lastItem !== null && endPosition > lastItem.endPosition;
4339
- case types_2.Kind.MAPPING: return node.value !== null && endPosition > node.value.endPosition;
4340
- default: return false;
4341
- }
4342
- }
4343
- static findBetween(node, startPosition, endPosition) {
4344
- switch (node.kind) {
4345
- case types_2.Kind.MAP: {
4346
- let left;
4347
- for (const mapping of node.mappings) if (startPosition > mapping.startPosition) left = mapping.key.value;
4348
- else if (left !== void 0 && mapping.startPosition > endPosition) return [left, mapping.key.value];
4349
- return null;
4350
- }
4351
- case types_2.Kind.SEQ: {
4352
- let left;
4353
- for (let i = 0; i < node.items.length; i++) {
4354
- const item = node.items[i];
4355
- if (item === null) continue;
4356
- if (startPosition > item.startPosition) left = String(i);
4357
- else if (left !== void 0 && item.startPosition > endPosition) return [left, String(i)];
4358
- }
4359
- return null;
4360
- }
4361
- default: return null;
4362
- }
4363
- }
4364
- isBeforeEOL(comment) {
4365
- return this.node.kind === types_2.Kind.SCALAR || this.node.kind === types_2.Kind.MAPPING && comment.range.end.line === lineForPosition_1.lineForPosition(this.node.key.endPosition, this.lineMap);
4366
- }
4367
- attachComments() {
4368
- if (this.comments.length === 0) return;
4369
- const attachedComments = this.attachedComments[this.pointer] = this.attachedComments[this.pointer] || [];
4370
- for (const comment of this.comments) if (this.isBeforeEOL(comment)) attachedComments.push({
4371
- value: comment.value,
4372
- placement: "before-eol"
4373
- });
4374
- else if (Comments.isLeading(this.node, comment.startPosition)) attachedComments.push({
4375
- value: comment.value,
4376
- placement: "leading"
4377
- });
4378
- else if (Comments.isTrailing(this.node, comment.endPosition)) attachedComments.push({
4379
- value: comment.value,
4380
- placement: "trailing"
4381
- });
4382
- else {
4383
- const between = Comments.findBetween(this.node, comment.startPosition, comment.endPosition);
4384
- if (between !== null) attachedComments.push({
4385
- value: comment.value,
4386
- placement: "between",
4387
- between
4388
- });
4389
- else attachedComments.push({
4390
- value: comment.value,
4391
- placement: "trailing"
4392
- });
4393
- }
4394
- }
4395
- };
4396
- function normalizeOptions(options) {
4397
- if (options === void 0) return {
4398
- attachComments: false,
4399
- preserveKeyOrder: false,
4400
- bigInt: false,
4401
- mergeKeys: false,
4402
- json: true,
4403
- ignoreDuplicateKeys: false
4404
- };
4405
- return Object.assign({}, options, {
4406
- attachComments: options.attachComments === true,
4407
- preserveKeyOrder: options.preserveKeyOrder === true,
4408
- bigInt: options.bigInt === true,
4409
- mergeKeys: options.mergeKeys === true,
4410
- json: options.json !== false,
4411
- ignoreDuplicateKeys: options.ignoreDuplicateKeys !== false
281
+ /**
282
+ * Extracts all `{param}` segments from the path and returns them as a key-value map.
283
+ * An optional `replacer` transforms each parameter name in both key and value positions.
284
+ * Returns `undefined` when no path parameters are found.
285
+ */
286
+ getParams(replacer) {
287
+ const params = {};
288
+ this.#eachParam((_raw, param) => {
289
+ const key = replacer ? replacer(param) : param;
290
+ params[key] = key;
4412
291
  });
292
+ return Object.keys(params).length > 0 ? params : void 0;
4413
293
  }
4414
- }));
4415
- //#endregion
4416
- //#region ../../node_modules/.pnpm/@stoplight+yaml@4.3.0/node_modules/@stoplight/yaml/parse.js
4417
- var require_parse = /* @__PURE__ */ __commonJSMin(((exports) => {
4418
- Object.defineProperty(exports, "__esModule", { value: true });
4419
- const parseWithPointers_1 = require_parseWithPointers();
4420
- exports.parse = (value) => parseWithPointers_1.parseWithPointers(value).data;
4421
- }));
4422
- //#endregion
4423
- //#region ../../node_modules/.pnpm/@stoplight+yaml@4.3.0/node_modules/@stoplight/yaml/safeStringify.js
4424
- var require_safeStringify = /* @__PURE__ */ __commonJSMin(((exports) => {
4425
- Object.defineProperty(exports, "__esModule", { value: true });
4426
- const yaml_ast_parser_1 = require_src$1();
4427
- exports.safeStringify = (value, options) => typeof value === "string" ? value : yaml_ast_parser_1.safeDump(value, options);
4428
- }));
4429
- //#endregion
4430
- //#region ../../node_modules/.pnpm/@stoplight+yaml@4.3.0/node_modules/@stoplight/yaml/trapAccess.js
4431
- var require_trapAccess = /* @__PURE__ */ __commonJSMin(((exports) => {
4432
- Object.defineProperty(exports, "__esModule", { value: true });
4433
- const ordered_object_literal_1 = require_src();
4434
- exports.KEYS = Symbol.for(ordered_object_literal_1.ORDER_KEY_ID);
4435
- const traps = { ownKeys(target) {
4436
- return exports.KEYS in target ? target[exports.KEYS] : Reflect.ownKeys(target);
4437
- } };
4438
- exports.trapAccess = (target) => new Proxy(target, traps);
4439
- }));
294
+ /** Converts the OpenAPI path to Express-style colon syntax, e.g. `/pet/{petId}` → `/pet/:petId`. */
295
+ toURLPath() {
296
+ return this.path.replace(/\{([^}]+)\}/g, ":$1");
297
+ }
298
+ };
4440
299
  //#endregion
4441
300
  //#region src/utils.ts
4442
- var import_yaml = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports) => {
4443
- Object.defineProperty(exports, "__esModule", { value: true });
4444
- const tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
4445
- tslib_1.__exportStar(require_buildJsonPath(), exports);
4446
- tslib_1.__exportStar(require_dereferenceAnchor(), exports);
4447
- tslib_1.__exportStar(require_getJsonPathForPosition(), exports);
4448
- tslib_1.__exportStar(require_getLocationForJsonPath(), exports);
4449
- tslib_1.__exportStar(require_lineForPosition(), exports);
4450
- exports.parse = require_parse().parse;
4451
- exports.parseWithPointers = require_parseWithPointers().parseWithPointers;
4452
- tslib_1.__exportStar(require_safeStringify(), exports);
4453
- tslib_1.__exportStar(require_types(), exports);
4454
- tslib_1.__exportStar(require_trapAccess(), exports);
4455
- })))(), 1);
4456
- const STRUCTURAL_KEYS = new Set([
4457
- "properties",
4458
- "items",
4459
- "additionalProperties",
4460
- "oneOf",
4461
- "anyOf",
4462
- "allOf",
4463
- "not"
4464
- ]);
301
+ /**
302
+ * Returns `true` when `doc` looks like a Swagger 2.0 document (no `openapi` key).
303
+ */
4465
304
  function isOpenApiV2Document(doc) {
4466
- return doc && (0, remeda.isPlainObject)(doc) && !("openapi" in doc);
305
+ return !!doc && (0, remeda.isPlainObject)(doc) && !("openapi" in doc);
4467
306
  }
307
+ /**
308
+ * Returns `true` when `doc` is an OpenAPI 3.1 document.
309
+ */
4468
310
  function isOpenApiV3_1Document(doc) {
4469
- return doc && (0, remeda.isPlainObject)(doc) && "openapi" in doc && doc.openapi.startsWith("3.1");
311
+ return !!doc && (0, remeda.isPlainObject)(doc) && "openapi" in doc && doc.openapi.startsWith("3.1");
4470
312
  }
313
+ /**
314
+ * Returns `true` when `obj` is a parameter object (has an `in` field distinguishing it from a schema).
315
+ */
4471
316
  function isParameterObject(obj) {
4472
- return obj && "in" in obj;
317
+ return !!obj && "in" in obj;
4473
318
  }
4474
319
  /**
4475
320
  * Determines if a schema is nullable, considering:
@@ -4484,16 +329,18 @@ function isNullable(schema) {
4484
329
  return false;
4485
330
  }
4486
331
  /**
4487
- * Determines if the given object is an OpenAPI ReferenceObject.
332
+ * Returns `true` when `obj` is an OpenAPI `$ref` pointer object.
4488
333
  */
4489
334
  function isReference(obj) {
4490
335
  return !!obj && (0, oas_types.isRef)(obj);
4491
336
  }
4492
337
  /**
4493
- * Determines if the given object is a SchemaObject with a discriminator property of type DiscriminatorObject.
338
+ * Returns `true` when `obj` is a schema that carries a structured `discriminator` object
339
+ * (as opposed to a plain string discriminator used in some older specs).
4494
340
  */
4495
341
  function isDiscriminator(obj) {
4496
- return !!obj && obj?.["discriminator"] && typeof obj.discriminator !== "string";
342
+ const record = obj;
343
+ return !!obj && !!record["discriminator"] && typeof record["discriminator"] !== "string";
4497
344
  }
4498
345
  /**
4499
346
  * Determines whether a schema is required.
@@ -4584,7 +431,7 @@ function parseFromConfig(config, oasClass = Oas) {
4584
431
  if ("data" in config.input) {
4585
432
  if (typeof config.input.data === "object") return parse(structuredClone(config.input.data), { oasClass });
4586
433
  try {
4587
- return parse(import_yaml.parse(config.input.data), { oasClass });
434
+ return parse(_stoplight_yaml.default.parse(config.input.data), { oasClass });
4588
435
  } catch (_e) {
4589
436
  return parse(config.input.data, { oasClass });
4590
437
  }
@@ -5094,22 +941,15 @@ function resolveServerUrl(server, overrides) {
5094
941
  return url;
5095
942
  }
5096
943
  //#endregion
5097
- //#region src/types.ts
5098
- const HttpMethods = {
5099
- GET: "get",
5100
- POST: "post",
5101
- PUT: "put",
5102
- PATCH: "patch",
5103
- DELETE: "delete",
5104
- HEAD: "head",
5105
- OPTIONS: "options",
5106
- TRACE: "trace"
5107
- };
5108
- //#endregion
5109
- exports.HttpMethods = HttpMethods;
944
+ exports.ENUM_EXTENSION_KEYS = ENUM_EXTENSION_KEYS;
945
+ exports.FORMAT_MAP = FORMAT_MAP;
946
+ exports.HttpMethods = httpMethods;
947
+ exports.KNOWN_MEDIA_TYPES = KNOWN_MEDIA_TYPES;
5110
948
  exports.KUBB_INLINE_REF_PREFIX = KUBB_INLINE_REF_PREFIX;
5111
949
  exports.Oas = Oas;
950
+ exports.STRUCTURAL_KEYS = STRUCTURAL_KEYS;
5112
951
  exports.getDefaultValue = getDefaultValue;
952
+ exports.httpMethods = httpMethods;
5113
953
  exports.isAllOptional = isAllOptional;
5114
954
  exports.isDiscriminator = isDiscriminator;
5115
955
  exports.isNullable = isNullable;