@workos/oagen-emitters 0.16.1 → 0.17.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.
@@ -292,1997 +292,2333 @@ function lowerFirstForDoc(s) {
292
292
  }
293
293
  //#endregion
294
294
  //#region node_modules/js-yaml/dist/js-yaml.mjs
295
- /*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */
296
- function isNothing(subject) {
297
- return typeof subject === "undefined" || subject === null;
298
- }
299
- function isObject(subject) {
300
- return typeof subject === "object" && subject !== null;
301
- }
302
- function toArray(sequence) {
303
- if (Array.isArray(sequence)) return sequence;
304
- else if (isNothing(sequence)) return [];
305
- return [sequence];
306
- }
307
- function extend(target, source) {
308
- var index, length, key, sourceKeys;
309
- if (source) {
310
- sourceKeys = Object.keys(source);
311
- for (index = 0, length = sourceKeys.length; index < length; index += 1) {
312
- key = sourceKeys[index];
313
- target[key] = source[key];
314
- }
295
+ /*! js-yaml 4.2.0 https://github.com/nodeca/js-yaml @license MIT */
296
+ var __create = Object.create;
297
+ var __defProp = Object.defineProperty;
298
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
299
+ var __getOwnPropNames = Object.getOwnPropertyNames;
300
+ var __getProtoOf = Object.getPrototypeOf;
301
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
302
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
303
+ var __copyProps = (to, from, except, desc) => {
304
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
305
+ key = keys[i];
306
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
307
+ get: ((k) => from[k]).bind(null, key),
308
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
309
+ });
315
310
  }
316
- return target;
317
- }
318
- function repeat(string, count) {
319
- var result = "", cycle;
320
- for (cycle = 0; cycle < count; cycle += 1) result += string;
321
- return result;
322
- }
323
- function isNegativeZero(number) {
324
- return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
325
- }
326
- var common = {
327
- isNothing,
328
- isObject,
329
- toArray,
330
- repeat,
331
- isNegativeZero,
332
- extend
311
+ return to;
333
312
  };
334
- function formatError(exception, compact) {
335
- var where = "", message = exception.reason || "(unknown reason)";
336
- if (!exception.mark) return message;
337
- if (exception.mark.name) where += "in \"" + exception.mark.name + "\" ";
338
- where += "(" + (exception.mark.line + 1) + ":" + (exception.mark.column + 1) + ")";
339
- if (!compact && exception.mark.snippet) where += "\n\n" + exception.mark.snippet;
340
- return message + " " + where;
341
- }
342
- function YAMLException$1(reason, mark) {
343
- Error.call(this);
344
- this.name = "YAMLException";
345
- this.reason = reason;
346
- this.mark = mark;
347
- this.message = formatError(this, false);
348
- if (Error.captureStackTrace) Error.captureStackTrace(this, this.constructor);
349
- else this.stack = (/* @__PURE__ */ new Error()).stack || "";
350
- }
351
- YAMLException$1.prototype = Object.create(Error.prototype);
352
- YAMLException$1.prototype.constructor = YAMLException$1;
353
- YAMLException$1.prototype.toString = function toString(compact) {
354
- return this.name + ": " + formatError(this, compact);
355
- };
356
- var exception = YAMLException$1;
357
- function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
358
- var head = "";
359
- var tail = "";
360
- var maxHalfLength = Math.floor(maxLineLength / 2) - 1;
361
- if (position - lineStart > maxHalfLength) {
362
- head = " ... ";
363
- lineStart = position - maxHalfLength + head.length;
364
- }
365
- if (lineEnd - position > maxHalfLength) {
366
- tail = " ...";
367
- lineEnd = position + maxHalfLength - tail.length;
313
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
314
+ value: mod,
315
+ enumerable: true
316
+ }) : target, mod));
317
+ var require_common = /* @__PURE__ */ __commonJSMin(((exports, module) => {
318
+ function isNothing(subject) {
319
+ return typeof subject === "undefined" || subject === null;
320
+ }
321
+ function isObject(subject) {
322
+ return typeof subject === "object" && subject !== null;
323
+ }
324
+ function toArray(sequence) {
325
+ if (Array.isArray(sequence)) return sequence;
326
+ else if (isNothing(sequence)) return [];
327
+ return [sequence];
328
+ }
329
+ function extend(target, source) {
330
+ if (source) {
331
+ const sourceKeys = Object.keys(source);
332
+ for (let index = 0, length = sourceKeys.length; index < length; index += 1) {
333
+ const key = sourceKeys[index];
334
+ target[key] = source[key];
335
+ }
336
+ }
337
+ return target;
338
+ }
339
+ function repeat(string, count) {
340
+ let result = "";
341
+ for (let cycle = 0; cycle < count; cycle += 1) result += string;
342
+ return result;
368
343
  }
369
- return {
370
- str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, "→") + tail,
371
- pos: position - lineStart + head.length
344
+ function isNegativeZero(number) {
345
+ return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
346
+ }
347
+ module.exports.isNothing = isNothing;
348
+ module.exports.isObject = isObject;
349
+ module.exports.toArray = toArray;
350
+ module.exports.repeat = repeat;
351
+ module.exports.isNegativeZero = isNegativeZero;
352
+ module.exports.extend = extend;
353
+ }));
354
+ var require_exception = /* @__PURE__ */ __commonJSMin(((exports, module) => {
355
+ function formatError(exception, compact) {
356
+ let where = "";
357
+ const message = exception.reason || "(unknown reason)";
358
+ if (!exception.mark) return message;
359
+ if (exception.mark.name) where += "in \"" + exception.mark.name + "\" ";
360
+ where += "(" + (exception.mark.line + 1) + ":" + (exception.mark.column + 1) + ")";
361
+ if (!compact && exception.mark.snippet) where += "\n\n" + exception.mark.snippet;
362
+ return message + " " + where;
363
+ }
364
+ function YAMLException(reason, mark) {
365
+ Error.call(this);
366
+ this.name = "YAMLException";
367
+ this.reason = reason;
368
+ this.mark = mark;
369
+ this.message = formatError(this, false);
370
+ if (Error.captureStackTrace) Error.captureStackTrace(this, this.constructor);
371
+ else this.stack = (/* @__PURE__ */ new Error()).stack || "";
372
+ }
373
+ YAMLException.prototype = Object.create(Error.prototype);
374
+ YAMLException.prototype.constructor = YAMLException;
375
+ YAMLException.prototype.toString = function toString(compact) {
376
+ return this.name + ": " + formatError(this, compact);
372
377
  };
373
- }
374
- function padStart(string, max) {
375
- return common.repeat(" ", max - string.length) + string;
376
- }
377
- function makeSnippet(mark, options) {
378
- options = Object.create(options || null);
379
- if (!mark.buffer) return null;
380
- if (!options.maxLength) options.maxLength = 79;
381
- if (typeof options.indent !== "number") options.indent = 1;
382
- if (typeof options.linesBefore !== "number") options.linesBefore = 3;
383
- if (typeof options.linesAfter !== "number") options.linesAfter = 2;
384
- var re = /\r?\n|\r|\0/g;
385
- var lineStarts = [0];
386
- var lineEnds = [];
387
- var match;
388
- var foundLineNo = -1;
389
- while (match = re.exec(mark.buffer)) {
390
- lineEnds.push(match.index);
391
- lineStarts.push(match.index + match[0].length);
392
- if (mark.position <= match.index && foundLineNo < 0) foundLineNo = lineStarts.length - 2;
393
- }
394
- if (foundLineNo < 0) foundLineNo = lineStarts.length - 1;
395
- var result = "", i, line;
396
- var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
397
- var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
398
- for (i = 1; i <= options.linesBefore; i++) {
399
- if (foundLineNo - i < 0) break;
400
- line = getLine(mark.buffer, lineStarts[foundLineNo - i], lineEnds[foundLineNo - i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]), maxLineLength);
401
- result = common.repeat(" ", options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + " | " + line.str + "\n" + result;
402
- }
403
- line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
404
- result += common.repeat(" ", options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + " | " + line.str + "\n";
405
- result += common.repeat("-", options.indent + lineNoLength + 3 + line.pos) + "^\n";
406
- for (i = 1; i <= options.linesAfter; i++) {
407
- if (foundLineNo + i >= lineEnds.length) break;
408
- line = getLine(mark.buffer, lineStarts[foundLineNo + i], lineEnds[foundLineNo + i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]), maxLineLength);
409
- result += common.repeat(" ", options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + " | " + line.str + "\n";
410
- }
411
- return result.replace(/\n$/, "");
412
- }
413
- var snippet = makeSnippet;
414
- var TYPE_CONSTRUCTOR_OPTIONS = [
415
- "kind",
416
- "multi",
417
- "resolve",
418
- "construct",
419
- "instanceOf",
420
- "predicate",
421
- "represent",
422
- "representName",
423
- "defaultStyle",
424
- "styleAliases"
425
- ];
426
- var YAML_NODE_KINDS = [
427
- "scalar",
428
- "sequence",
429
- "mapping"
430
- ];
431
- function compileStyleAliases(map) {
432
- var result = {};
433
- if (map !== null) Object.keys(map).forEach(function(style) {
434
- map[style].forEach(function(alias) {
435
- result[String(alias)] = style;
378
+ module.exports = YAMLException;
379
+ }));
380
+ var require_snippet = /* @__PURE__ */ __commonJSMin(((exports, module) => {
381
+ var common = require_common();
382
+ function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
383
+ let head = "";
384
+ let tail = "";
385
+ const maxHalfLength = Math.floor(maxLineLength / 2) - 1;
386
+ if (position - lineStart > maxHalfLength) {
387
+ head = " ... ";
388
+ lineStart = position - maxHalfLength + head.length;
389
+ }
390
+ if (lineEnd - position > maxHalfLength) {
391
+ tail = " ...";
392
+ lineEnd = position + maxHalfLength - tail.length;
393
+ }
394
+ return {
395
+ str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, "→") + tail,
396
+ pos: position - lineStart + head.length
397
+ };
398
+ }
399
+ function padStart(string, max) {
400
+ return common.repeat(" ", max - string.length) + string;
401
+ }
402
+ function makeSnippet(mark, options) {
403
+ options = Object.create(options || null);
404
+ if (!mark.buffer) return null;
405
+ if (!options.maxLength) options.maxLength = 79;
406
+ if (typeof options.indent !== "number") options.indent = 1;
407
+ if (typeof options.linesBefore !== "number") options.linesBefore = 3;
408
+ if (typeof options.linesAfter !== "number") options.linesAfter = 2;
409
+ const re = /\r?\n|\r|\0/g;
410
+ const lineStarts = [0];
411
+ const lineEnds = [];
412
+ let match;
413
+ let foundLineNo = -1;
414
+ while (match = re.exec(mark.buffer)) {
415
+ lineEnds.push(match.index);
416
+ lineStarts.push(match.index + match[0].length);
417
+ if (mark.position <= match.index && foundLineNo < 0) foundLineNo = lineStarts.length - 2;
418
+ }
419
+ if (foundLineNo < 0) foundLineNo = lineStarts.length - 1;
420
+ let result = "";
421
+ const lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
422
+ const maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
423
+ for (let i = 1; i <= options.linesBefore; i++) {
424
+ if (foundLineNo - i < 0) break;
425
+ const line = getLine(mark.buffer, lineStarts[foundLineNo - i], lineEnds[foundLineNo - i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]), maxLineLength);
426
+ result = common.repeat(" ", options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + " | " + line.str + "\n" + result;
427
+ }
428
+ const line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
429
+ result += common.repeat(" ", options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + " | " + line.str + "\n";
430
+ result += common.repeat("-", options.indent + lineNoLength + 3 + line.pos) + "^\n";
431
+ for (let i = 1; i <= options.linesAfter; i++) {
432
+ if (foundLineNo + i >= lineEnds.length) break;
433
+ const line = getLine(mark.buffer, lineStarts[foundLineNo + i], lineEnds[foundLineNo + i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]), maxLineLength);
434
+ result += common.repeat(" ", options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + " | " + line.str + "\n";
435
+ }
436
+ return result.replace(/\n$/, "");
437
+ }
438
+ module.exports = makeSnippet;
439
+ }));
440
+ var require_type = /* @__PURE__ */ __commonJSMin(((exports, module) => {
441
+ var YAMLException = require_exception();
442
+ var TYPE_CONSTRUCTOR_OPTIONS = [
443
+ "kind",
444
+ "multi",
445
+ "resolve",
446
+ "construct",
447
+ "instanceOf",
448
+ "predicate",
449
+ "represent",
450
+ "representName",
451
+ "defaultStyle",
452
+ "styleAliases"
453
+ ];
454
+ var YAML_NODE_KINDS = [
455
+ "scalar",
456
+ "sequence",
457
+ "mapping"
458
+ ];
459
+ function compileStyleAliases(map) {
460
+ const result = {};
461
+ if (map !== null) Object.keys(map).forEach(function(style) {
462
+ map[style].forEach(function(alias) {
463
+ result[String(alias)] = style;
464
+ });
436
465
  });
437
- });
438
- return result;
439
- }
440
- function Type$1(tag, options) {
441
- options = options || {};
442
- Object.keys(options).forEach(function(name) {
443
- if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) throw new exception("Unknown option \"" + name + "\" is met in definition of \"" + tag + "\" YAML type.");
444
- });
445
- this.options = options;
446
- this.tag = tag;
447
- this.kind = options["kind"] || null;
448
- this.resolve = options["resolve"] || function() {
449
- return true;
450
- };
451
- this.construct = options["construct"] || function(data) {
452
- return data;
453
- };
454
- this.instanceOf = options["instanceOf"] || null;
455
- this.predicate = options["predicate"] || null;
456
- this.represent = options["represent"] || null;
457
- this.representName = options["representName"] || null;
458
- this.defaultStyle = options["defaultStyle"] || null;
459
- this.multi = options["multi"] || false;
460
- this.styleAliases = compileStyleAliases(options["styleAliases"] || null);
461
- if (YAML_NODE_KINDS.indexOf(this.kind) === -1) throw new exception("Unknown kind \"" + this.kind + "\" is specified for \"" + tag + "\" YAML type.");
462
- }
463
- var type = Type$1;
464
- function compileList(schema, name) {
465
- var result = [];
466
- schema[name].forEach(function(currentType) {
467
- var newIndex = result.length;
468
- result.forEach(function(previousType, previousIndex) {
469
- if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) newIndex = previousIndex;
466
+ return result;
467
+ }
468
+ function Type(tag, options) {
469
+ options = options || {};
470
+ Object.keys(options).forEach(function(name) {
471
+ if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) throw new YAMLException("Unknown option \"" + name + "\" is met in definition of \"" + tag + "\" YAML type.");
470
472
  });
471
- result[newIndex] = currentType;
472
- });
473
- return result;
474
- }
475
- function compileMap() {
476
- var result = {
477
- scalar: {},
478
- sequence: {},
479
- mapping: {},
480
- fallback: {},
481
- multi: {
482
- scalar: [],
483
- sequence: [],
484
- mapping: [],
485
- fallback: []
486
- }
487
- }, index, length;
488
- function collectType(type) {
489
- if (type.multi) {
490
- result.multi[type.kind].push(type);
491
- result.multi["fallback"].push(type);
492
- } else result[type.kind][type.tag] = result["fallback"][type.tag] = type;
493
- }
494
- for (index = 0, length = arguments.length; index < length; index += 1) arguments[index].forEach(collectType);
495
- return result;
496
- }
497
- function Schema$1(definition) {
498
- return this.extend(definition);
499
- }
500
- Schema$1.prototype.extend = function extend(definition) {
501
- var implicit = [];
502
- var explicit = [];
503
- if (definition instanceof type) explicit.push(definition);
504
- else if (Array.isArray(definition)) explicit = explicit.concat(definition);
505
- else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
506
- if (definition.implicit) implicit = implicit.concat(definition.implicit);
507
- if (definition.explicit) explicit = explicit.concat(definition.explicit);
508
- } else throw new exception("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
509
- implicit.forEach(function(type$1) {
510
- if (!(type$1 instanceof type)) throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
511
- if (type$1.loadKind && type$1.loadKind !== "scalar") throw new exception("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
512
- if (type$1.multi) throw new exception("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
513
- });
514
- explicit.forEach(function(type$1) {
515
- if (!(type$1 instanceof type)) throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
516
- });
517
- var result = Object.create(Schema$1.prototype);
518
- result.implicit = (this.implicit || []).concat(implicit);
519
- result.explicit = (this.explicit || []).concat(explicit);
520
- result.compiledImplicit = compileList(result, "implicit");
521
- result.compiledExplicit = compileList(result, "explicit");
522
- result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
523
- return result;
524
- };
525
- var failsafe = new Schema$1({ explicit: [
526
- new type("tag:yaml.org,2002:str", {
473
+ this.options = options;
474
+ this.tag = tag;
475
+ this.kind = options["kind"] || null;
476
+ this.resolve = options["resolve"] || function() {
477
+ return true;
478
+ };
479
+ this.construct = options["construct"] || function(data) {
480
+ return data;
481
+ };
482
+ this.instanceOf = options["instanceOf"] || null;
483
+ this.predicate = options["predicate"] || null;
484
+ this.represent = options["represent"] || null;
485
+ this.representName = options["representName"] || null;
486
+ this.defaultStyle = options["defaultStyle"] || null;
487
+ this.multi = options["multi"] || false;
488
+ this.styleAliases = compileStyleAliases(options["styleAliases"] || null);
489
+ if (YAML_NODE_KINDS.indexOf(this.kind) === -1) throw new YAMLException("Unknown kind \"" + this.kind + "\" is specified for \"" + tag + "\" YAML type.");
490
+ }
491
+ module.exports = Type;
492
+ }));
493
+ var require_schema = /* @__PURE__ */ __commonJSMin(((exports, module) => {
494
+ var YAMLException = require_exception();
495
+ var Type = require_type();
496
+ function compileList(schema, name) {
497
+ const result = [];
498
+ schema[name].forEach(function(currentType) {
499
+ let newIndex = result.length;
500
+ result.forEach(function(previousType, previousIndex) {
501
+ if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) newIndex = previousIndex;
502
+ });
503
+ result[newIndex] = currentType;
504
+ });
505
+ return result;
506
+ }
507
+ function compileMap() {
508
+ const result = {
509
+ scalar: {},
510
+ sequence: {},
511
+ mapping: {},
512
+ fallback: {},
513
+ multi: {
514
+ scalar: [],
515
+ sequence: [],
516
+ mapping: [],
517
+ fallback: []
518
+ }
519
+ };
520
+ function collectType(type) {
521
+ if (type.multi) {
522
+ result.multi[type.kind].push(type);
523
+ result.multi["fallback"].push(type);
524
+ } else result[type.kind][type.tag] = result["fallback"][type.tag] = type;
525
+ }
526
+ for (let index = 0, length = arguments.length; index < length; index += 1) arguments[index].forEach(collectType);
527
+ return result;
528
+ }
529
+ function Schema(definition) {
530
+ return this.extend(definition);
531
+ }
532
+ Schema.prototype.extend = function extend(definition) {
533
+ let implicit = [];
534
+ let explicit = [];
535
+ if (definition instanceof Type) explicit.push(definition);
536
+ else if (Array.isArray(definition)) explicit = explicit.concat(definition);
537
+ else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
538
+ if (definition.implicit) implicit = implicit.concat(definition.implicit);
539
+ if (definition.explicit) explicit = explicit.concat(definition.explicit);
540
+ } else throw new YAMLException("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
541
+ implicit.forEach(function(type) {
542
+ if (!(type instanceof Type)) throw new YAMLException("Specified list of YAML types (or a single Type object) contains a non-Type object.");
543
+ if (type.loadKind && type.loadKind !== "scalar") throw new YAMLException("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
544
+ if (type.multi) throw new YAMLException("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
545
+ });
546
+ explicit.forEach(function(type) {
547
+ if (!(type instanceof Type)) throw new YAMLException("Specified list of YAML types (or a single Type object) contains a non-Type object.");
548
+ });
549
+ const result = Object.create(Schema.prototype);
550
+ result.implicit = (this.implicit || []).concat(implicit);
551
+ result.explicit = (this.explicit || []).concat(explicit);
552
+ result.compiledImplicit = compileList(result, "implicit");
553
+ result.compiledExplicit = compileList(result, "explicit");
554
+ result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
555
+ return result;
556
+ };
557
+ module.exports = Schema;
558
+ }));
559
+ var require_str = /* @__PURE__ */ __commonJSMin(((exports, module) => {
560
+ module.exports = new (require_type())("tag:yaml.org,2002:str", {
527
561
  kind: "scalar",
528
562
  construct: function(data) {
529
563
  return data !== null ? data : "";
530
564
  }
531
- }),
532
- new type("tag:yaml.org,2002:seq", {
565
+ });
566
+ }));
567
+ var require_seq = /* @__PURE__ */ __commonJSMin(((exports, module) => {
568
+ module.exports = new (require_type())("tag:yaml.org,2002:seq", {
533
569
  kind: "sequence",
534
570
  construct: function(data) {
535
571
  return data !== null ? data : [];
536
572
  }
537
- }),
538
- new type("tag:yaml.org,2002:map", {
573
+ });
574
+ }));
575
+ var require_map = /* @__PURE__ */ __commonJSMin(((exports, module) => {
576
+ module.exports = new (require_type())("tag:yaml.org,2002:map", {
539
577
  kind: "mapping",
540
578
  construct: function(data) {
541
579
  return data !== null ? data : {};
542
580
  }
543
- })
544
- ] });
545
- function resolveYamlNull(data) {
546
- if (data === null) return true;
547
- var max = data.length;
548
- return max === 1 && data === "~" || max === 4 && (data === "null" || data === "Null" || data === "NULL");
549
- }
550
- function constructYamlNull() {
551
- return null;
552
- }
553
- function isNull(object) {
554
- return object === null;
555
- }
556
- var _null = new type("tag:yaml.org,2002:null", {
557
- kind: "scalar",
558
- resolve: resolveYamlNull,
559
- construct: constructYamlNull,
560
- predicate: isNull,
561
- represent: {
562
- canonical: function() {
563
- return "~";
564
- },
565
- lowercase: function() {
566
- return "null";
567
- },
568
- uppercase: function() {
569
- return "NULL";
581
+ });
582
+ }));
583
+ var require_failsafe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
584
+ module.exports = new (require_schema())({ explicit: [
585
+ require_str(),
586
+ require_seq(),
587
+ require_map()
588
+ ] });
589
+ }));
590
+ var require_null = /* @__PURE__ */ __commonJSMin(((exports, module) => {
591
+ var Type = require_type();
592
+ function resolveYamlNull(data) {
593
+ if (data === null) return true;
594
+ const max = data.length;
595
+ return max === 1 && data === "~" || max === 4 && (data === "null" || data === "Null" || data === "NULL");
596
+ }
597
+ function constructYamlNull() {
598
+ return null;
599
+ }
600
+ function isNull(object) {
601
+ return object === null;
602
+ }
603
+ module.exports = new Type("tag:yaml.org,2002:null", {
604
+ kind: "scalar",
605
+ resolve: resolveYamlNull,
606
+ construct: constructYamlNull,
607
+ predicate: isNull,
608
+ represent: {
609
+ canonical: function() {
610
+ return "~";
611
+ },
612
+ lowercase: function() {
613
+ return "null";
614
+ },
615
+ uppercase: function() {
616
+ return "NULL";
617
+ },
618
+ camelcase: function() {
619
+ return "Null";
620
+ },
621
+ empty: function() {
622
+ return "";
623
+ }
570
624
  },
571
- camelcase: function() {
572
- return "Null";
625
+ defaultStyle: "lowercase"
626
+ });
627
+ }));
628
+ var require_bool = /* @__PURE__ */ __commonJSMin(((exports, module) => {
629
+ var Type = require_type();
630
+ function resolveYamlBoolean(data) {
631
+ if (data === null) return false;
632
+ const max = data.length;
633
+ return max === 4 && (data === "true" || data === "True" || data === "TRUE") || max === 5 && (data === "false" || data === "False" || data === "FALSE");
634
+ }
635
+ function constructYamlBoolean(data) {
636
+ return data === "true" || data === "True" || data === "TRUE";
637
+ }
638
+ function isBoolean(object) {
639
+ return Object.prototype.toString.call(object) === "[object Boolean]";
640
+ }
641
+ module.exports = new Type("tag:yaml.org,2002:bool", {
642
+ kind: "scalar",
643
+ resolve: resolveYamlBoolean,
644
+ construct: constructYamlBoolean,
645
+ predicate: isBoolean,
646
+ represent: {
647
+ lowercase: function(object) {
648
+ return object ? "true" : "false";
649
+ },
650
+ uppercase: function(object) {
651
+ return object ? "TRUE" : "FALSE";
652
+ },
653
+ camelcase: function(object) {
654
+ return object ? "True" : "False";
655
+ }
573
656
  },
574
- empty: function() {
575
- return "";
657
+ defaultStyle: "lowercase"
658
+ });
659
+ }));
660
+ var require_int = /* @__PURE__ */ __commonJSMin(((exports, module) => {
661
+ var common = require_common();
662
+ var Type = require_type();
663
+ function isHexCode(c) {
664
+ return c >= 48 && c <= 57 || c >= 65 && c <= 70 || c >= 97 && c <= 102;
665
+ }
666
+ function isOctCode(c) {
667
+ return c >= 48 && c <= 55;
668
+ }
669
+ function isDecCode(c) {
670
+ return c >= 48 && c <= 57;
671
+ }
672
+ function resolveYamlInteger(data) {
673
+ if (data === null) return false;
674
+ const max = data.length;
675
+ let index = 0;
676
+ let hasDigits = false;
677
+ if (!max) return false;
678
+ let ch = data[index];
679
+ if (ch === "-" || ch === "+") ch = data[++index];
680
+ if (ch === "0") {
681
+ if (index + 1 === max) return true;
682
+ ch = data[++index];
683
+ if (ch === "b") {
684
+ index++;
685
+ for (; index < max; index++) {
686
+ ch = data[index];
687
+ if (ch !== "0" && ch !== "1") return false;
688
+ hasDigits = true;
689
+ }
690
+ return hasDigits && Number.isFinite(parseYamlInteger(data));
691
+ }
692
+ if (ch === "x") {
693
+ index++;
694
+ for (; index < max; index++) {
695
+ if (!isHexCode(data.charCodeAt(index))) return false;
696
+ hasDigits = true;
697
+ }
698
+ return hasDigits && Number.isFinite(parseYamlInteger(data));
699
+ }
700
+ if (ch === "o") {
701
+ index++;
702
+ for (; index < max; index++) {
703
+ if (!isOctCode(data.charCodeAt(index))) return false;
704
+ hasDigits = true;
705
+ }
706
+ return hasDigits && Number.isFinite(parseYamlInteger(data));
707
+ }
576
708
  }
577
- },
578
- defaultStyle: "lowercase"
579
- });
580
- function resolveYamlBoolean(data) {
581
- if (data === null) return false;
582
- var max = data.length;
583
- return max === 4 && (data === "true" || data === "True" || data === "TRUE") || max === 5 && (data === "false" || data === "False" || data === "FALSE");
584
- }
585
- function constructYamlBoolean(data) {
586
- return data === "true" || data === "True" || data === "TRUE";
587
- }
588
- function isBoolean(object) {
589
- return Object.prototype.toString.call(object) === "[object Boolean]";
590
- }
591
- var bool = new type("tag:yaml.org,2002:bool", {
592
- kind: "scalar",
593
- resolve: resolveYamlBoolean,
594
- construct: constructYamlBoolean,
595
- predicate: isBoolean,
596
- represent: {
597
- lowercase: function(object) {
598
- return object ? "true" : "false";
599
- },
600
- uppercase: function(object) {
601
- return object ? "TRUE" : "FALSE";
602
- },
603
- camelcase: function(object) {
604
- return object ? "True" : "False";
709
+ for (; index < max; index++) {
710
+ if (!isDecCode(data.charCodeAt(index))) return false;
711
+ hasDigits = true;
605
712
  }
606
- },
607
- defaultStyle: "lowercase"
608
- });
609
- function isHexCode(c) {
610
- return 48 <= c && c <= 57 || 65 <= c && c <= 70 || 97 <= c && c <= 102;
611
- }
612
- function isOctCode(c) {
613
- return 48 <= c && c <= 55;
614
- }
615
- function isDecCode(c) {
616
- return 48 <= c && c <= 57;
617
- }
618
- function resolveYamlInteger(data) {
619
- if (data === null) return false;
620
- var max = data.length, index = 0, hasDigits = false, ch;
621
- if (!max) return false;
622
- ch = data[index];
623
- if (ch === "-" || ch === "+") ch = data[++index];
624
- if (ch === "0") {
625
- if (index + 1 === max) return true;
626
- ch = data[++index];
627
- if (ch === "b") {
628
- index++;
629
- for (; index < max; index++) {
630
- ch = data[index];
631
- if (ch === "_") continue;
632
- if (ch !== "0" && ch !== "1") return false;
633
- hasDigits = true;
634
- }
635
- return hasDigits && ch !== "_";
636
- }
637
- if (ch === "x") {
638
- index++;
639
- for (; index < max; index++) {
640
- ch = data[index];
641
- if (ch === "_") continue;
642
- if (!isHexCode(data.charCodeAt(index))) return false;
643
- hasDigits = true;
644
- }
645
- return hasDigits && ch !== "_";
646
- }
647
- if (ch === "o") {
648
- index++;
649
- for (; index < max; index++) {
650
- ch = data[index];
651
- if (ch === "_") continue;
652
- if (!isOctCode(data.charCodeAt(index))) return false;
653
- hasDigits = true;
654
- }
655
- return hasDigits && ch !== "_";
656
- }
657
- }
658
- if (ch === "_") return false;
659
- for (; index < max; index++) {
660
- ch = data[index];
661
- if (ch === "_") continue;
662
- if (!isDecCode(data.charCodeAt(index))) return false;
663
- hasDigits = true;
664
- }
665
- if (!hasDigits || ch === "_") return false;
666
- return true;
667
- }
668
- function constructYamlInteger(data) {
669
- var value = data, sign = 1, ch;
670
- if (value.indexOf("_") !== -1) value = value.replace(/_/g, "");
671
- ch = value[0];
672
- if (ch === "-" || ch === "+") {
673
- if (ch === "-") sign = -1;
674
- value = value.slice(1);
675
- ch = value[0];
676
- }
677
- if (value === "0") return 0;
678
- if (ch === "0") {
679
- if (value[1] === "b") return sign * parseInt(value.slice(2), 2);
680
- if (value[1] === "x") return sign * parseInt(value.slice(2), 16);
681
- if (value[1] === "o") return sign * parseInt(value.slice(2), 8);
682
- }
683
- return sign * parseInt(value, 10);
684
- }
685
- function isInteger(object) {
686
- return Object.prototype.toString.call(object) === "[object Number]" && object % 1 === 0 && !common.isNegativeZero(object);
687
- }
688
- var int = new type("tag:yaml.org,2002:int", {
689
- kind: "scalar",
690
- resolve: resolveYamlInteger,
691
- construct: constructYamlInteger,
692
- predicate: isInteger,
693
- represent: {
694
- binary: function(obj) {
695
- return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
696
- },
697
- octal: function(obj) {
698
- return obj >= 0 ? "0o" + obj.toString(8) : "-0o" + obj.toString(8).slice(1);
699
- },
700
- decimal: function(obj) {
701
- return obj.toString(10);
713
+ if (!hasDigits) return false;
714
+ return Number.isFinite(parseYamlInteger(data));
715
+ }
716
+ function parseYamlInteger(data) {
717
+ let value = data;
718
+ let sign = 1;
719
+ let ch = value[0];
720
+ if (ch === "-" || ch === "+") {
721
+ if (ch === "-") sign = -1;
722
+ value = value.slice(1);
723
+ ch = value[0];
724
+ }
725
+ if (value === "0") return 0;
726
+ if (ch === "0") {
727
+ if (value[1] === "b") return sign * parseInt(value.slice(2), 2);
728
+ if (value[1] === "x") return sign * parseInt(value.slice(2), 16);
729
+ if (value[1] === "o") return sign * parseInt(value.slice(2), 8);
730
+ }
731
+ return sign * parseInt(value, 10);
732
+ }
733
+ function constructYamlInteger(data) {
734
+ return parseYamlInteger(data);
735
+ }
736
+ function isInteger(object) {
737
+ return Object.prototype.toString.call(object) === "[object Number]" && object % 1 === 0 && !common.isNegativeZero(object);
738
+ }
739
+ module.exports = new Type("tag:yaml.org,2002:int", {
740
+ kind: "scalar",
741
+ resolve: resolveYamlInteger,
742
+ construct: constructYamlInteger,
743
+ predicate: isInteger,
744
+ represent: {
745
+ binary: function(obj) {
746
+ return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
747
+ },
748
+ octal: function(obj) {
749
+ return obj >= 0 ? "0o" + obj.toString(8) : "-0o" + obj.toString(8).slice(1);
750
+ },
751
+ decimal: function(obj) {
752
+ return obj.toString(10);
753
+ },
754
+ hexadecimal: function(obj) {
755
+ return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
756
+ }
702
757
  },
703
- hexadecimal: function(obj) {
704
- return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
758
+ defaultStyle: "decimal",
759
+ styleAliases: {
760
+ binary: [2, "bin"],
761
+ octal: [8, "oct"],
762
+ decimal: [10, "dec"],
763
+ hexadecimal: [16, "hex"]
705
764
  }
706
- },
707
- defaultStyle: "decimal",
708
- styleAliases: {
709
- binary: [2, "bin"],
710
- octal: [8, "oct"],
711
- decimal: [10, "dec"],
712
- hexadecimal: [16, "hex"]
713
- }
714
- });
715
- 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))$");
716
- function resolveYamlFloat(data) {
717
- if (data === null) return false;
718
- if (!YAML_FLOAT_PATTERN.test(data) || data[data.length - 1] === "_") return false;
719
- return true;
720
- }
721
- function constructYamlFloat(data) {
722
- var value = data.replace(/_/g, "").toLowerCase(), sign = value[0] === "-" ? -1 : 1;
723
- if ("+-".indexOf(value[0]) >= 0) value = value.slice(1);
724
- if (value === ".inf") return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
725
- else if (value === ".nan") return NaN;
726
- return sign * parseFloat(value, 10);
727
- }
728
- var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
729
- function representYamlFloat(object, style) {
730
- var res;
731
- if (isNaN(object)) switch (style) {
732
- case "lowercase": return ".nan";
733
- case "uppercase": return ".NAN";
734
- case "camelcase": return ".NaN";
735
- }
736
- else if (Number.POSITIVE_INFINITY === object) switch (style) {
737
- case "lowercase": return ".inf";
738
- case "uppercase": return ".INF";
739
- case "camelcase": return ".Inf";
740
- }
741
- else if (Number.NEGATIVE_INFINITY === object) switch (style) {
742
- case "lowercase": return "-.inf";
743
- case "uppercase": return "-.INF";
744
- case "camelcase": return "-.Inf";
745
- }
746
- else if (common.isNegativeZero(object)) return "-0.0";
747
- res = object.toString(10);
748
- return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
749
- }
750
- function isFloat(object) {
751
- return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common.isNegativeZero(object));
752
- }
753
- var float = new type("tag:yaml.org,2002:float", {
754
- kind: "scalar",
755
- resolve: resolveYamlFloat,
756
- construct: constructYamlFloat,
757
- predicate: isFloat,
758
- represent: representYamlFloat,
759
- defaultStyle: "lowercase"
760
- });
761
- var core = failsafe.extend({ implicit: [
762
- _null,
763
- bool,
764
- int,
765
- float
766
- ] });
767
- var YAML_DATE_REGEXP = /* @__PURE__ */ new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$");
768
- 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]))?))?$");
769
- function resolveYamlTimestamp(data) {
770
- if (data === null) return false;
771
- if (YAML_DATE_REGEXP.exec(data) !== null) return true;
772
- if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
773
- return false;
774
- }
775
- function constructYamlTimestamp(data) {
776
- var match, year, month, day, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date;
777
- match = YAML_DATE_REGEXP.exec(data);
778
- if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
779
- if (match === null) throw new Error("Date resolve error");
780
- year = +match[1];
781
- month = +match[2] - 1;
782
- day = +match[3];
783
- if (!match[4]) return new Date(Date.UTC(year, month, day));
784
- hour = +match[4];
785
- minute = +match[5];
786
- second = +match[6];
787
- if (match[7]) {
788
- fraction = match[7].slice(0, 3);
789
- while (fraction.length < 3) fraction += "0";
790
- fraction = +fraction;
791
- }
792
- if (match[9]) {
793
- tz_hour = +match[10];
794
- tz_minute = +(match[11] || 0);
795
- delta = (tz_hour * 60 + tz_minute) * 6e4;
796
- if (match[9] === "-") delta = -delta;
797
- }
798
- date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
799
- if (delta) date.setTime(date.getTime() - delta);
800
- return date;
801
- }
802
- function representYamlTimestamp(object) {
803
- return object.toISOString();
804
- }
805
- var timestamp = new type("tag:yaml.org,2002:timestamp", {
806
- kind: "scalar",
807
- resolve: resolveYamlTimestamp,
808
- construct: constructYamlTimestamp,
809
- instanceOf: Date,
810
- represent: representYamlTimestamp
811
- });
812
- function resolveYamlMerge(data) {
813
- return data === "<<" || data === null;
814
- }
815
- var merge = new type("tag:yaml.org,2002:merge", {
816
- kind: "scalar",
817
- resolve: resolveYamlMerge
818
- });
819
- var BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
820
- function resolveYamlBinary(data) {
821
- if (data === null) return false;
822
- var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP;
823
- for (idx = 0; idx < max; idx++) {
824
- code = map.indexOf(data.charAt(idx));
825
- if (code > 64) continue;
826
- if (code < 0) return false;
827
- bitlen += 6;
828
- }
829
- return bitlen % 8 === 0;
830
- }
831
- function constructYamlBinary(data) {
832
- var idx, tailbits, input = data.replace(/[\r\n=]/g, ""), max = input.length, map = BASE64_MAP, bits = 0, result = [];
833
- for (idx = 0; idx < max; idx++) {
834
- if (idx % 4 === 0 && idx) {
765
+ });
766
+ }));
767
+ var require_float = /* @__PURE__ */ __commonJSMin(((exports, module) => {
768
+ var common = require_common();
769
+ var Type = require_type();
770
+ var YAML_FLOAT_PATTERN = /* @__PURE__ */ new RegExp("^(?:[-+]?(?:[0-9]+)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
771
+ var YAML_FLOAT_SPECIAL_PATTERN = /* @__PURE__ */ new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
772
+ function resolveYamlFloat(data) {
773
+ if (data === null) return false;
774
+ if (!YAML_FLOAT_PATTERN.test(data)) return false;
775
+ if (Number.isFinite(parseFloat(data, 10))) return true;
776
+ return YAML_FLOAT_SPECIAL_PATTERN.test(data);
777
+ }
778
+ function constructYamlFloat(data) {
779
+ let value = data.toLowerCase();
780
+ const sign = value[0] === "-" ? -1 : 1;
781
+ if ("+-".indexOf(value[0]) >= 0) value = value.slice(1);
782
+ if (value === ".inf") return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
783
+ else if (value === ".nan") return NaN;
784
+ return sign * parseFloat(value, 10);
785
+ }
786
+ var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
787
+ function representYamlFloat(object, style) {
788
+ if (isNaN(object)) switch (style) {
789
+ case "lowercase": return ".nan";
790
+ case "uppercase": return ".NAN";
791
+ case "camelcase": return ".NaN";
792
+ }
793
+ else if (Number.POSITIVE_INFINITY === object) switch (style) {
794
+ case "lowercase": return ".inf";
795
+ case "uppercase": return ".INF";
796
+ case "camelcase": return ".Inf";
797
+ }
798
+ else if (Number.NEGATIVE_INFINITY === object) switch (style) {
799
+ case "lowercase": return "-.inf";
800
+ case "uppercase": return "-.INF";
801
+ case "camelcase": return "-.Inf";
802
+ }
803
+ else if (common.isNegativeZero(object)) return "-0.0";
804
+ const res = object.toString(10);
805
+ return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
806
+ }
807
+ function isFloat(object) {
808
+ return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common.isNegativeZero(object));
809
+ }
810
+ module.exports = new Type("tag:yaml.org,2002:float", {
811
+ kind: "scalar",
812
+ resolve: resolveYamlFloat,
813
+ construct: constructYamlFloat,
814
+ predicate: isFloat,
815
+ represent: representYamlFloat,
816
+ defaultStyle: "lowercase"
817
+ });
818
+ }));
819
+ var require_json = /* @__PURE__ */ __commonJSMin(((exports, module) => {
820
+ module.exports = require_failsafe().extend({ implicit: [
821
+ require_null(),
822
+ require_bool(),
823
+ require_int(),
824
+ require_float()
825
+ ] });
826
+ }));
827
+ var require_core = /* @__PURE__ */ __commonJSMin(((exports, module) => {
828
+ module.exports = require_json();
829
+ }));
830
+ var require_timestamp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
831
+ var Type = require_type();
832
+ var YAML_DATE_REGEXP = /* @__PURE__ */ new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$");
833
+ 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]))?))?$");
834
+ function resolveYamlTimestamp(data) {
835
+ if (data === null) return false;
836
+ if (YAML_DATE_REGEXP.exec(data) !== null) return true;
837
+ if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
838
+ return false;
839
+ }
840
+ function constructYamlTimestamp(data) {
841
+ let fraction = 0;
842
+ let delta = null;
843
+ let match = YAML_DATE_REGEXP.exec(data);
844
+ if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
845
+ if (match === null) throw new Error("Date resolve error");
846
+ const year = +match[1];
847
+ const month = +match[2] - 1;
848
+ const day = +match[3];
849
+ if (!match[4]) return new Date(Date.UTC(year, month, day));
850
+ const hour = +match[4];
851
+ const minute = +match[5];
852
+ const second = +match[6];
853
+ if (match[7]) {
854
+ fraction = match[7].slice(0, 3);
855
+ while (fraction.length < 3) fraction += "0";
856
+ fraction = +fraction;
857
+ }
858
+ if (match[9]) {
859
+ const tzHour = +match[10];
860
+ const tzMinute = +(match[11] || 0);
861
+ delta = (tzHour * 60 + tzMinute) * 6e4;
862
+ if (match[9] === "-") delta = -delta;
863
+ }
864
+ const date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
865
+ if (delta) date.setTime(date.getTime() - delta);
866
+ return date;
867
+ }
868
+ function representYamlTimestamp(object) {
869
+ return object.toISOString();
870
+ }
871
+ module.exports = new Type("tag:yaml.org,2002:timestamp", {
872
+ kind: "scalar",
873
+ resolve: resolveYamlTimestamp,
874
+ construct: constructYamlTimestamp,
875
+ instanceOf: Date,
876
+ represent: representYamlTimestamp
877
+ });
878
+ }));
879
+ var require_merge = /* @__PURE__ */ __commonJSMin(((exports, module) => {
880
+ var Type = require_type();
881
+ function resolveYamlMerge(data) {
882
+ return data === "<<" || data === null;
883
+ }
884
+ module.exports = new Type("tag:yaml.org,2002:merge", {
885
+ kind: "scalar",
886
+ resolve: resolveYamlMerge
887
+ });
888
+ }));
889
+ var require_binary = /* @__PURE__ */ __commonJSMin(((exports, module) => {
890
+ var Type = require_type();
891
+ var BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
892
+ function resolveYamlBinary(data) {
893
+ if (data === null) return false;
894
+ let bitlen = 0;
895
+ const max = data.length;
896
+ const map = BASE64_MAP;
897
+ for (let idx = 0; idx < max; idx++) {
898
+ const code = map.indexOf(data.charAt(idx));
899
+ if (code > 64) continue;
900
+ if (code < 0) return false;
901
+ bitlen += 6;
902
+ }
903
+ return bitlen % 8 === 0;
904
+ }
905
+ function constructYamlBinary(data) {
906
+ const input = data.replace(/[\r\n=]/g, "");
907
+ const max = input.length;
908
+ const map = BASE64_MAP;
909
+ let bits = 0;
910
+ const result = [];
911
+ for (let idx = 0; idx < max; idx++) {
912
+ if (idx % 4 === 0 && idx) {
913
+ result.push(bits >> 16 & 255);
914
+ result.push(bits >> 8 & 255);
915
+ result.push(bits & 255);
916
+ }
917
+ bits = bits << 6 | map.indexOf(input.charAt(idx));
918
+ }
919
+ const tailbits = max % 4 * 6;
920
+ if (tailbits === 0) {
835
921
  result.push(bits >> 16 & 255);
836
922
  result.push(bits >> 8 & 255);
837
923
  result.push(bits & 255);
838
- }
839
- bits = bits << 6 | map.indexOf(input.charAt(idx));
840
- }
841
- tailbits = max % 4 * 6;
842
- if (tailbits === 0) {
843
- result.push(bits >> 16 & 255);
844
- result.push(bits >> 8 & 255);
845
- result.push(bits & 255);
846
- } else if (tailbits === 18) {
847
- result.push(bits >> 10 & 255);
848
- result.push(bits >> 2 & 255);
849
- } else if (tailbits === 12) result.push(bits >> 4 & 255);
850
- return new Uint8Array(result);
851
- }
852
- function representYamlBinary(object) {
853
- var result = "", bits = 0, idx, tail, max = object.length, map = BASE64_MAP;
854
- for (idx = 0; idx < max; idx++) {
855
- if (idx % 3 === 0 && idx) {
924
+ } else if (tailbits === 18) {
925
+ result.push(bits >> 10 & 255);
926
+ result.push(bits >> 2 & 255);
927
+ } else if (tailbits === 12) result.push(bits >> 4 & 255);
928
+ return new Uint8Array(result);
929
+ }
930
+ function representYamlBinary(object) {
931
+ let result = "";
932
+ let bits = 0;
933
+ const max = object.length;
934
+ const map = BASE64_MAP;
935
+ for (let idx = 0; idx < max; idx++) {
936
+ if (idx % 3 === 0 && idx) {
937
+ result += map[bits >> 18 & 63];
938
+ result += map[bits >> 12 & 63];
939
+ result += map[bits >> 6 & 63];
940
+ result += map[bits & 63];
941
+ }
942
+ bits = (bits << 8) + object[idx];
943
+ }
944
+ const tail = max % 3;
945
+ if (tail === 0) {
856
946
  result += map[bits >> 18 & 63];
857
947
  result += map[bits >> 12 & 63];
858
948
  result += map[bits >> 6 & 63];
859
949
  result += map[bits & 63];
950
+ } else if (tail === 2) {
951
+ result += map[bits >> 10 & 63];
952
+ result += map[bits >> 4 & 63];
953
+ result += map[bits << 2 & 63];
954
+ result += map[64];
955
+ } else if (tail === 1) {
956
+ result += map[bits >> 2 & 63];
957
+ result += map[bits << 4 & 63];
958
+ result += map[64];
959
+ result += map[64];
860
960
  }
861
- bits = (bits << 8) + object[idx];
862
- }
863
- tail = max % 3;
864
- if (tail === 0) {
865
- result += map[bits >> 18 & 63];
866
- result += map[bits >> 12 & 63];
867
- result += map[bits >> 6 & 63];
868
- result += map[bits & 63];
869
- } else if (tail === 2) {
870
- result += map[bits >> 10 & 63];
871
- result += map[bits >> 4 & 63];
872
- result += map[bits << 2 & 63];
873
- result += map[64];
874
- } else if (tail === 1) {
875
- result += map[bits >> 2 & 63];
876
- result += map[bits << 4 & 63];
877
- result += map[64];
878
- result += map[64];
961
+ return result;
879
962
  }
880
- return result;
881
- }
882
- function isBinary(obj) {
883
- return Object.prototype.toString.call(obj) === "[object Uint8Array]";
884
- }
885
- var binary = new type("tag:yaml.org,2002:binary", {
886
- kind: "scalar",
887
- resolve: resolveYamlBinary,
888
- construct: constructYamlBinary,
889
- predicate: isBinary,
890
- represent: representYamlBinary
891
- });
892
- var _hasOwnProperty$3 = Object.prototype.hasOwnProperty;
893
- var _toString$2 = Object.prototype.toString;
894
- function resolveYamlOmap(data) {
895
- if (data === null) return true;
896
- var objectKeys = [], index, length, pair, pairKey, pairHasKey, object = data;
897
- for (index = 0, length = object.length; index < length; index += 1) {
898
- pair = object[index];
899
- pairHasKey = false;
900
- if (_toString$2.call(pair) !== "[object Object]") return false;
901
- for (pairKey in pair) if (_hasOwnProperty$3.call(pair, pairKey)) if (!pairHasKey) pairHasKey = true;
902
- else return false;
903
- if (!pairHasKey) return false;
904
- if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
905
- else return false;
963
+ function isBinary(obj) {
964
+ return Object.prototype.toString.call(obj) === "[object Uint8Array]";
906
965
  }
907
- return true;
908
- }
909
- function constructYamlOmap(data) {
910
- return data !== null ? data : [];
911
- }
912
- var omap = new type("tag:yaml.org,2002:omap", {
913
- kind: "sequence",
914
- resolve: resolveYamlOmap,
915
- construct: constructYamlOmap
916
- });
917
- var _toString$1 = Object.prototype.toString;
918
- function resolveYamlPairs(data) {
919
- if (data === null) return true;
920
- var index, length, pair, keys, result, object = data;
921
- result = new Array(object.length);
922
- for (index = 0, length = object.length; index < length; index += 1) {
923
- pair = object[index];
924
- if (_toString$1.call(pair) !== "[object Object]") return false;
925
- keys = Object.keys(pair);
926
- if (keys.length !== 1) return false;
927
- result[index] = [keys[0], pair[keys[0]]];
966
+ module.exports = new Type("tag:yaml.org,2002:binary", {
967
+ kind: "scalar",
968
+ resolve: resolveYamlBinary,
969
+ construct: constructYamlBinary,
970
+ predicate: isBinary,
971
+ represent: representYamlBinary
972
+ });
973
+ }));
974
+ var require_omap = /* @__PURE__ */ __commonJSMin(((exports, module) => {
975
+ var Type = require_type();
976
+ var _hasOwnProperty = Object.prototype.hasOwnProperty;
977
+ var _toString = Object.prototype.toString;
978
+ function resolveYamlOmap(data) {
979
+ if (data === null) return true;
980
+ const objectKeys = [];
981
+ const object = data;
982
+ for (let index = 0, length = object.length; index < length; index += 1) {
983
+ const pair = object[index];
984
+ let pairHasKey = false;
985
+ if (_toString.call(pair) !== "[object Object]") return false;
986
+ let pairKey;
987
+ for (pairKey in pair) if (_hasOwnProperty.call(pair, pairKey)) if (!pairHasKey) pairHasKey = true;
988
+ else return false;
989
+ if (!pairHasKey) return false;
990
+ if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
991
+ else return false;
992
+ }
993
+ return true;
928
994
  }
929
- return true;
930
- }
931
- function constructYamlPairs(data) {
932
- if (data === null) return [];
933
- var index, length, pair, keys, result, object = data;
934
- result = new Array(object.length);
935
- for (index = 0, length = object.length; index < length; index += 1) {
936
- pair = object[index];
937
- keys = Object.keys(pair);
938
- result[index] = [keys[0], pair[keys[0]]];
995
+ function constructYamlOmap(data) {
996
+ return data !== null ? data : [];
939
997
  }
940
- return result;
941
- }
942
- var pairs = new type("tag:yaml.org,2002:pairs", {
943
- kind: "sequence",
944
- resolve: resolveYamlPairs,
945
- construct: constructYamlPairs
946
- });
947
- var _hasOwnProperty$2 = Object.prototype.hasOwnProperty;
948
- function resolveYamlSet(data) {
949
- if (data === null) return true;
950
- var key, object = data;
951
- for (key in object) if (_hasOwnProperty$2.call(object, key)) {
952
- if (object[key] !== null) return false;
998
+ module.exports = new Type("tag:yaml.org,2002:omap", {
999
+ kind: "sequence",
1000
+ resolve: resolveYamlOmap,
1001
+ construct: constructYamlOmap
1002
+ });
1003
+ }));
1004
+ var require_pairs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1005
+ var Type = require_type();
1006
+ var _toString = Object.prototype.toString;
1007
+ function resolveYamlPairs(data) {
1008
+ if (data === null) return true;
1009
+ const object = data;
1010
+ const result = new Array(object.length);
1011
+ for (let index = 0, length = object.length; index < length; index += 1) {
1012
+ const pair = object[index];
1013
+ if (_toString.call(pair) !== "[object Object]") return false;
1014
+ const keys = Object.keys(pair);
1015
+ if (keys.length !== 1) return false;
1016
+ result[index] = [keys[0], pair[keys[0]]];
1017
+ }
1018
+ return true;
953
1019
  }
954
- return true;
955
- }
956
- function constructYamlSet(data) {
957
- return data !== null ? data : {};
958
- }
959
- var set = new type("tag:yaml.org,2002:set", {
960
- kind: "mapping",
961
- resolve: resolveYamlSet,
962
- construct: constructYamlSet
963
- });
964
- var _default = core.extend({
965
- implicit: [timestamp, merge],
966
- explicit: [
967
- binary,
968
- omap,
969
- pairs,
970
- set
971
- ]
972
- });
973
- var _hasOwnProperty$1 = Object.prototype.hasOwnProperty;
974
- var CONTEXT_FLOW_IN = 1;
975
- var CONTEXT_FLOW_OUT = 2;
976
- var CONTEXT_BLOCK_IN = 3;
977
- var CONTEXT_BLOCK_OUT = 4;
978
- var CHOMPING_CLIP = 1;
979
- var CHOMPING_STRIP = 2;
980
- var CHOMPING_KEEP = 3;
981
- var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
982
- var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
983
- var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
984
- var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
985
- var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
986
- function _class(obj) {
987
- return Object.prototype.toString.call(obj);
988
- }
989
- function is_EOL(c) {
990
- return c === 10 || c === 13;
991
- }
992
- function is_WHITE_SPACE(c) {
993
- return c === 9 || c === 32;
994
- }
995
- function is_WS_OR_EOL(c) {
996
- return c === 9 || c === 32 || c === 10 || c === 13;
997
- }
998
- function is_FLOW_INDICATOR(c) {
999
- return c === 44 || c === 91 || c === 93 || c === 123 || c === 125;
1000
- }
1001
- function fromHexCode(c) {
1002
- var lc;
1003
- if (48 <= c && c <= 57) return c - 48;
1004
- lc = c | 32;
1005
- if (97 <= lc && lc <= 102) return lc - 97 + 10;
1006
- return -1;
1007
- }
1008
- function escapedHexLen(c) {
1009
- if (c === 120) return 2;
1010
- if (c === 117) return 4;
1011
- if (c === 85) return 8;
1012
- return 0;
1013
- }
1014
- function fromDecimalCode(c) {
1015
- if (48 <= c && c <= 57) return c - 48;
1016
- return -1;
1017
- }
1018
- function simpleEscapeSequence(c) {
1019
- 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" : "";
1020
- }
1021
- function charFromCodepoint(c) {
1022
- if (c <= 65535) return String.fromCharCode(c);
1023
- return String.fromCharCode((c - 65536 >> 10) + 55296, (c - 65536 & 1023) + 56320);
1024
- }
1025
- function setProperty(object, key, value) {
1026
- if (key === "__proto__") Object.defineProperty(object, key, {
1027
- configurable: true,
1028
- enumerable: true,
1029
- writable: true,
1030
- value
1020
+ function constructYamlPairs(data) {
1021
+ if (data === null) return [];
1022
+ const object = data;
1023
+ const result = new Array(object.length);
1024
+ for (let index = 0, length = object.length; index < length; index += 1) {
1025
+ const pair = object[index];
1026
+ const keys = Object.keys(pair);
1027
+ result[index] = [keys[0], pair[keys[0]]];
1028
+ }
1029
+ return result;
1030
+ }
1031
+ module.exports = new Type("tag:yaml.org,2002:pairs", {
1032
+ kind: "sequence",
1033
+ resolve: resolveYamlPairs,
1034
+ construct: constructYamlPairs
1031
1035
  });
1032
- else object[key] = value;
1033
- }
1034
- var simpleEscapeCheck = new Array(256);
1035
- var simpleEscapeMap = new Array(256);
1036
- for (var i = 0; i < 256; i++) {
1037
- simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
1038
- simpleEscapeMap[i] = simpleEscapeSequence(i);
1039
- }
1040
- function State$1(input, options) {
1041
- this.input = input;
1042
- this.filename = options["filename"] || null;
1043
- this.schema = options["schema"] || _default;
1044
- this.onWarning = options["onWarning"] || null;
1045
- this.legacy = options["legacy"] || false;
1046
- this.json = options["json"] || false;
1047
- this.listener = options["listener"] || null;
1048
- this.implicitTypes = this.schema.compiledImplicit;
1049
- this.typeMap = this.schema.compiledTypeMap;
1050
- this.length = input.length;
1051
- this.position = 0;
1052
- this.line = 0;
1053
- this.lineStart = 0;
1054
- this.lineIndent = 0;
1055
- this.firstTabInLine = -1;
1056
- this.documents = [];
1057
- }
1058
- function generateError(state, message) {
1059
- var mark = {
1060
- name: state.filename,
1061
- buffer: state.input.slice(0, -1),
1062
- position: state.position,
1063
- line: state.line,
1064
- column: state.position - state.lineStart
1065
- };
1066
- mark.snippet = snippet(mark);
1067
- return new exception(message, mark);
1068
- }
1069
- function throwError(state, message) {
1070
- throw generateError(state, message);
1071
- }
1072
- function throwWarning(state, message) {
1073
- if (state.onWarning) state.onWarning.call(null, generateError(state, message));
1074
- }
1075
- var directiveHandlers = {
1076
- YAML: function handleYamlDirective(state, name, args) {
1077
- var match, major, minor;
1078
- if (state.version !== null) throwError(state, "duplication of %YAML directive");
1079
- if (args.length !== 1) throwError(state, "YAML directive accepts exactly one argument");
1080
- match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
1081
- if (match === null) throwError(state, "ill-formed argument of the YAML directive");
1082
- major = parseInt(match[1], 10);
1083
- minor = parseInt(match[2], 10);
1084
- if (major !== 1) throwError(state, "unacceptable YAML version of the document");
1085
- state.version = args[0];
1086
- state.checkLineBreaks = minor < 2;
1087
- if (minor !== 1 && minor !== 2) throwWarning(state, "unsupported YAML version of the document");
1088
- },
1089
- TAG: function handleTagDirective(state, name, args) {
1090
- var handle, prefix;
1091
- if (args.length !== 2) throwError(state, "TAG directive accepts exactly two arguments");
1092
- handle = args[0];
1093
- prefix = args[1];
1094
- if (!PATTERN_TAG_HANDLE.test(handle)) throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
1095
- if (_hasOwnProperty$1.call(state.tagMap, handle)) throwError(state, "there is a previously declared suffix for \"" + handle + "\" tag handle");
1096
- if (!PATTERN_TAG_URI.test(prefix)) throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
1097
- try {
1098
- prefix = decodeURIComponent(prefix);
1099
- } catch (err) {
1100
- throwError(state, "tag prefix is malformed: " + prefix);
1036
+ }));
1037
+ var require_set = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1038
+ var Type = require_type();
1039
+ var _hasOwnProperty = Object.prototype.hasOwnProperty;
1040
+ function resolveYamlSet(data) {
1041
+ if (data === null) return true;
1042
+ const object = data;
1043
+ for (const key in object) if (_hasOwnProperty.call(object, key)) {
1044
+ if (object[key] !== null) return false;
1101
1045
  }
1102
- state.tagMap[handle] = prefix;
1046
+ return true;
1103
1047
  }
1104
- };
1105
- function captureSegment(state, start, end, checkJson) {
1106
- var _position, _length, _character, _result;
1107
- if (start < end) {
1108
- _result = state.input.slice(start, end);
1109
- if (checkJson) for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
1110
- _character = _result.charCodeAt(_position);
1111
- if (!(_character === 9 || 32 <= _character && _character <= 1114111)) throwError(state, "expected valid JSON character");
1112
- }
1113
- else if (PATTERN_NON_PRINTABLE.test(_result)) throwError(state, "the stream contains non-printable characters");
1114
- state.result += _result;
1115
- }
1116
- }
1117
- function mergeMappings(state, destination, source, overridableKeys) {
1118
- var sourceKeys, key, index, quantity;
1119
- if (!common.isObject(source)) throwError(state, "cannot merge mappings; the provided source object is unacceptable");
1120
- sourceKeys = Object.keys(source);
1121
- for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
1122
- key = sourceKeys[index];
1123
- if (!_hasOwnProperty$1.call(destination, key)) {
1124
- setProperty(destination, key, source[key]);
1125
- overridableKeys[key] = true;
1126
- }
1127
- }
1128
- }
1129
- function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startLineStart, startPos) {
1130
- var index, quantity;
1131
- if (Array.isArray(keyNode)) {
1132
- keyNode = Array.prototype.slice.call(keyNode);
1133
- for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {
1134
- if (Array.isArray(keyNode[index])) throwError(state, "nested arrays are not supported inside keys");
1135
- if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") keyNode[index] = "[object Object]";
1136
- }
1137
- }
1138
- if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") keyNode = "[object Object]";
1139
- keyNode = String(keyNode);
1140
- if (_result === null) _result = {};
1141
- if (keyTag === "tag:yaml.org,2002:merge") if (Array.isArray(valueNode)) for (index = 0, quantity = valueNode.length; index < quantity; index += 1) mergeMappings(state, _result, valueNode[index], overridableKeys);
1142
- else mergeMappings(state, _result, valueNode, overridableKeys);
1143
- else {
1144
- if (!state.json && !_hasOwnProperty$1.call(overridableKeys, keyNode) && _hasOwnProperty$1.call(_result, keyNode)) {
1145
- state.line = startLine || state.line;
1146
- state.lineStart = startLineStart || state.lineStart;
1147
- state.position = startPos || state.position;
1148
- throwError(state, "duplicated mapping key");
1048
+ function constructYamlSet(data) {
1049
+ return data !== null ? data : {};
1050
+ }
1051
+ module.exports = new Type("tag:yaml.org,2002:set", {
1052
+ kind: "mapping",
1053
+ resolve: resolveYamlSet,
1054
+ construct: constructYamlSet
1055
+ });
1056
+ }));
1057
+ var require_default = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1058
+ module.exports = require_core().extend({
1059
+ implicit: [require_timestamp(), require_merge()],
1060
+ explicit: [
1061
+ require_binary(),
1062
+ require_omap(),
1063
+ require_pairs(),
1064
+ require_set()
1065
+ ]
1066
+ });
1067
+ }));
1068
+ var require_loader = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1069
+ var common = require_common();
1070
+ var YAMLException = require_exception();
1071
+ var makeSnippet = require_snippet();
1072
+ var DEFAULT_SCHEMA = require_default();
1073
+ var _hasOwnProperty = Object.prototype.hasOwnProperty;
1074
+ var CONTEXT_FLOW_IN = 1;
1075
+ var CONTEXT_FLOW_OUT = 2;
1076
+ var CONTEXT_BLOCK_IN = 3;
1077
+ var CONTEXT_BLOCK_OUT = 4;
1078
+ var CHOMPING_CLIP = 1;
1079
+ var CHOMPING_STRIP = 2;
1080
+ var CHOMPING_KEEP = 3;
1081
+ var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
1082
+ var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
1083
+ var PATTERN_FLOW_INDICATORS = /[,\[\]{}]/;
1084
+ var PATTERN_TAG_HANDLE = /^(?:!|!!|![0-9A-Za-z-]+!)$/;
1085
+ var PATTERN_TAG_URI = /^(?:!|[^,\[\]{}])(?:%[0-9a-f]{2}|[0-9a-z\-#;/?:@&=+$,_.!~*'()\[\]])*$/i;
1086
+ function _class(obj) {
1087
+ return Object.prototype.toString.call(obj);
1088
+ }
1089
+ function isEol(c) {
1090
+ return c === 10 || c === 13;
1091
+ }
1092
+ function isWhiteSpace(c) {
1093
+ return c === 9 || c === 32;
1094
+ }
1095
+ function isWsOrEol(c) {
1096
+ return c === 9 || c === 32 || c === 10 || c === 13;
1097
+ }
1098
+ function isFlowIndicator(c) {
1099
+ return c === 44 || c === 91 || c === 93 || c === 123 || c === 125;
1100
+ }
1101
+ function fromHexCode(c) {
1102
+ if (c >= 48 && c <= 57) return c - 48;
1103
+ const lc = c | 32;
1104
+ if (lc >= 97 && lc <= 102) return lc - 97 + 10;
1105
+ return -1;
1106
+ }
1107
+ function escapedHexLen(c) {
1108
+ if (c === 120) return 2;
1109
+ if (c === 117) return 4;
1110
+ if (c === 85) return 8;
1111
+ return 0;
1112
+ }
1113
+ function fromDecimalCode(c) {
1114
+ if (c >= 48 && c <= 57) return c - 48;
1115
+ return -1;
1116
+ }
1117
+ function simpleEscapeSequence(c) {
1118
+ switch (c) {
1119
+ case 48: return "\0";
1120
+ case 97: return "\x07";
1121
+ case 98: return "\b";
1122
+ case 116: return " ";
1123
+ case 9: return " ";
1124
+ case 110: return "\n";
1125
+ case 118: return "\v";
1126
+ case 102: return "\f";
1127
+ case 114: return "\r";
1128
+ case 101: return "\x1B";
1129
+ case 32: return " ";
1130
+ case 34: return "\"";
1131
+ case 47: return "/";
1132
+ case 92: return "\\";
1133
+ case 78: return "…";
1134
+ case 95: return "\xA0";
1135
+ case 76: return "\u2028";
1136
+ case 80: return "\u2029";
1137
+ default: return "";
1138
+ }
1139
+ }
1140
+ function charFromCodepoint(c) {
1141
+ if (c <= 65535) return String.fromCharCode(c);
1142
+ return String.fromCharCode((c - 65536 >> 10) + 55296, (c - 65536 & 1023) + 56320);
1143
+ }
1144
+ function setProperty(object, key, value) {
1145
+ if (key === "__proto__") Object.defineProperty(object, key, {
1146
+ configurable: true,
1147
+ enumerable: true,
1148
+ writable: true,
1149
+ value
1150
+ });
1151
+ else object[key] = value;
1152
+ }
1153
+ var simpleEscapeCheck = new Array(256);
1154
+ var simpleEscapeMap = new Array(256);
1155
+ for (let i = 0; i < 256; i++) {
1156
+ simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
1157
+ simpleEscapeMap[i] = simpleEscapeSequence(i);
1158
+ }
1159
+ function State(input, options) {
1160
+ this.input = input;
1161
+ this.filename = options["filename"] || null;
1162
+ this.schema = options["schema"] || DEFAULT_SCHEMA;
1163
+ this.onWarning = options["onWarning"] || null;
1164
+ this.legacy = options["legacy"] || false;
1165
+ this.json = options["json"] || false;
1166
+ this.listener = options["listener"] || null;
1167
+ this.maxDepth = typeof options["maxDepth"] === "number" ? options["maxDepth"] : 100;
1168
+ this.maxMergeSeqLength = typeof options["maxMergeSeqLength"] === "number" ? options["maxMergeSeqLength"] : 20;
1169
+ this.implicitTypes = this.schema.compiledImplicit;
1170
+ this.typeMap = this.schema.compiledTypeMap;
1171
+ this.length = input.length;
1172
+ this.position = 0;
1173
+ this.line = 0;
1174
+ this.lineStart = 0;
1175
+ this.lineIndent = 0;
1176
+ this.depth = 0;
1177
+ this.firstTabInLine = -1;
1178
+ this.documents = [];
1179
+ this.anchorMapTransactions = [];
1180
+ }
1181
+ function generateError(state, message) {
1182
+ const mark = {
1183
+ name: state.filename,
1184
+ buffer: state.input.slice(0, -1),
1185
+ position: state.position,
1186
+ line: state.line,
1187
+ column: state.position - state.lineStart
1188
+ };
1189
+ mark.snippet = makeSnippet(mark);
1190
+ return new YAMLException(message, mark);
1191
+ }
1192
+ function throwError(state, message) {
1193
+ throw generateError(state, message);
1194
+ }
1195
+ function throwWarning(state, message) {
1196
+ if (state.onWarning) state.onWarning.call(null, generateError(state, message));
1197
+ }
1198
+ function storeAnchor(state, name, value) {
1199
+ const transactions = state.anchorMapTransactions;
1200
+ if (transactions.length !== 0) {
1201
+ const transaction = transactions[transactions.length - 1];
1202
+ if (!_hasOwnProperty.call(transaction, name)) transaction[name] = {
1203
+ existed: _hasOwnProperty.call(state.anchorMap, name),
1204
+ value: state.anchorMap[name]
1205
+ };
1149
1206
  }
1150
- setProperty(_result, keyNode, valueNode);
1151
- delete overridableKeys[keyNode];
1207
+ state.anchorMap[name] = value;
1152
1208
  }
1153
- return _result;
1154
- }
1155
- function readLineBreak(state) {
1156
- var ch = state.input.charCodeAt(state.position);
1157
- if (ch === 10) state.position++;
1158
- else if (ch === 13) {
1159
- state.position++;
1160
- if (state.input.charCodeAt(state.position) === 10) state.position++;
1161
- } else throwError(state, "a line break is expected");
1162
- state.line += 1;
1163
- state.lineStart = state.position;
1164
- state.firstTabInLine = -1;
1165
- }
1166
- function skipSeparationSpace(state, allowComments, checkIndent) {
1167
- var lineBreaks = 0, ch = state.input.charCodeAt(state.position);
1168
- while (ch !== 0) {
1169
- while (is_WHITE_SPACE(ch)) {
1170
- if (ch === 9 && state.firstTabInLine === -1) state.firstTabInLine = state.position;
1171
- ch = state.input.charCodeAt(++state.position);
1209
+ function beginAnchorTransaction(state) {
1210
+ state.anchorMapTransactions.push(Object.create(null));
1211
+ }
1212
+ function commitAnchorTransaction(state) {
1213
+ const transaction = state.anchorMapTransactions.pop();
1214
+ const transactions = state.anchorMapTransactions;
1215
+ if (transactions.length === 0) return;
1216
+ const parent = transactions[transactions.length - 1];
1217
+ const names = Object.keys(transaction);
1218
+ for (let index = 0, length = names.length; index < length; index += 1) {
1219
+ const name = names[index];
1220
+ if (!_hasOwnProperty.call(parent, name)) parent[name] = transaction[name];
1172
1221
  }
1173
- if (allowComments && ch === 35) do
1174
- ch = state.input.charCodeAt(++state.position);
1175
- while (ch !== 10 && ch !== 13 && ch !== 0);
1176
- if (is_EOL(ch)) {
1177
- readLineBreak(state);
1178
- ch = state.input.charCodeAt(state.position);
1179
- lineBreaks++;
1180
- state.lineIndent = 0;
1181
- while (ch === 32) {
1182
- state.lineIndent++;
1183
- ch = state.input.charCodeAt(++state.position);
1222
+ }
1223
+ function rollbackAnchorTransaction(state) {
1224
+ const transaction = state.anchorMapTransactions.pop();
1225
+ const names = Object.keys(transaction);
1226
+ for (let index = names.length - 1; index >= 0; index -= 1) {
1227
+ const entry = transaction[names[index]];
1228
+ if (entry.existed) state.anchorMap[names[index]] = entry.value;
1229
+ else delete state.anchorMap[names[index]];
1230
+ }
1231
+ }
1232
+ function snapshotState(state) {
1233
+ return {
1234
+ position: state.position,
1235
+ line: state.line,
1236
+ lineStart: state.lineStart,
1237
+ lineIndent: state.lineIndent,
1238
+ firstTabInLine: state.firstTabInLine,
1239
+ tag: state.tag,
1240
+ anchor: state.anchor,
1241
+ kind: state.kind,
1242
+ result: state.result
1243
+ };
1244
+ }
1245
+ function restoreState(state, snapshot) {
1246
+ state.position = snapshot.position;
1247
+ state.line = snapshot.line;
1248
+ state.lineStart = snapshot.lineStart;
1249
+ state.lineIndent = snapshot.lineIndent;
1250
+ state.firstTabInLine = snapshot.firstTabInLine;
1251
+ state.tag = snapshot.tag;
1252
+ state.anchor = snapshot.anchor;
1253
+ state.kind = snapshot.kind;
1254
+ state.result = snapshot.result;
1255
+ }
1256
+ var directiveHandlers = {
1257
+ YAML: function handleYamlDirective(state, name, args) {
1258
+ if (state.version !== null) throwError(state, "duplication of %YAML directive");
1259
+ if (args.length !== 1) throwError(state, "YAML directive accepts exactly one argument");
1260
+ const match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
1261
+ if (match === null) throwError(state, "ill-formed argument of the YAML directive");
1262
+ const major = parseInt(match[1], 10);
1263
+ const minor = parseInt(match[2], 10);
1264
+ if (major !== 1) throwError(state, "unacceptable YAML version of the document");
1265
+ state.version = args[0];
1266
+ state.checkLineBreaks = minor < 2;
1267
+ if (minor !== 1 && minor !== 2) throwWarning(state, "unsupported YAML version of the document");
1268
+ },
1269
+ TAG: function handleTagDirective(state, name, args) {
1270
+ let prefix;
1271
+ if (args.length !== 2) throwError(state, "TAG directive accepts exactly two arguments");
1272
+ const handle = args[0];
1273
+ prefix = args[1];
1274
+ if (!PATTERN_TAG_HANDLE.test(handle)) throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
1275
+ if (_hasOwnProperty.call(state.tagMap, handle)) throwError(state, "there is a previously declared suffix for \"" + handle + "\" tag handle");
1276
+ if (!PATTERN_TAG_URI.test(prefix)) throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
1277
+ try {
1278
+ prefix = decodeURIComponent(prefix);
1279
+ } catch (err) {
1280
+ throwError(state, "tag prefix is malformed: " + prefix);
1184
1281
  }
1185
- } else break;
1282
+ state.tagMap[handle] = prefix;
1283
+ }
1284
+ };
1285
+ function captureSegment(state, start, end, checkJson) {
1286
+ if (start < end) {
1287
+ const _result = state.input.slice(start, end);
1288
+ if (checkJson) for (let _position = 0, _length = _result.length; _position < _length; _position += 1) {
1289
+ const _character = _result.charCodeAt(_position);
1290
+ if (!(_character === 9 || _character >= 32 && _character <= 1114111)) throwError(state, "expected valid JSON character");
1291
+ }
1292
+ else if (PATTERN_NON_PRINTABLE.test(_result)) throwError(state, "the stream contains non-printable characters");
1293
+ state.result += _result;
1294
+ }
1186
1295
  }
1187
- if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) throwWarning(state, "deficient indentation");
1188
- return lineBreaks;
1189
- }
1190
- function testDocumentSeparator(state) {
1191
- var _position = state.position, ch = state.input.charCodeAt(_position);
1192
- if ((ch === 45 || ch === 46) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) {
1193
- _position += 3;
1194
- ch = state.input.charCodeAt(_position);
1195
- if (ch === 0 || is_WS_OR_EOL(ch)) return true;
1296
+ function mergeMappings(state, destination, source, overridableKeys) {
1297
+ if (!common.isObject(source)) throwError(state, "cannot merge mappings; the provided source object is unacceptable");
1298
+ const sourceKeys = Object.keys(source);
1299
+ for (let index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
1300
+ const key = sourceKeys[index];
1301
+ if (!_hasOwnProperty.call(destination, key)) {
1302
+ setProperty(destination, key, source[key]);
1303
+ overridableKeys[key] = true;
1304
+ }
1305
+ }
1196
1306
  }
1197
- return false;
1198
- }
1199
- function writeFoldedLines(state, count) {
1200
- if (count === 1) state.result += " ";
1201
- else if (count > 1) state.result += common.repeat("\n", count - 1);
1202
- }
1203
- function readPlainScalar(state, nodeIndent, withinFlowCollection) {
1204
- var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state.kind, _result = state.result, ch = state.input.charCodeAt(state.position);
1205
- if (is_WS_OR_EOL(ch) || is_FLOW_INDICATOR(ch) || ch === 35 || ch === 38 || ch === 42 || ch === 33 || ch === 124 || ch === 62 || ch === 39 || ch === 34 || ch === 37 || ch === 64 || ch === 96) return false;
1206
- if (ch === 63 || ch === 45) {
1207
- following = state.input.charCodeAt(state.position + 1);
1208
- if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) return false;
1209
- }
1210
- state.kind = "scalar";
1211
- state.result = "";
1212
- captureStart = captureEnd = state.position;
1213
- hasPendingContent = false;
1214
- while (ch !== 0) {
1215
- if (ch === 58) {
1216
- following = state.input.charCodeAt(state.position + 1);
1217
- if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) break;
1218
- } else if (ch === 35) {
1219
- preceding = state.input.charCodeAt(state.position - 1);
1220
- if (is_WS_OR_EOL(preceding)) break;
1221
- } else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && is_FLOW_INDICATOR(ch)) break;
1222
- else if (is_EOL(ch)) {
1223
- _line = state.line;
1224
- _lineStart = state.lineStart;
1225
- _lineIndent = state.lineIndent;
1226
- skipSeparationSpace(state, false, -1);
1227
- if (state.lineIndent >= nodeIndent) {
1228
- hasPendingContent = true;
1229
- ch = state.input.charCodeAt(state.position);
1230
- continue;
1231
- } else {
1232
- state.position = captureEnd;
1233
- state.line = _line;
1234
- state.lineStart = _lineStart;
1235
- state.lineIndent = _lineIndent;
1236
- break;
1307
+ function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startLineStart, startPos) {
1308
+ if (Array.isArray(keyNode)) {
1309
+ keyNode = Array.prototype.slice.call(keyNode);
1310
+ for (let index = 0, quantity = keyNode.length; index < quantity; index += 1) {
1311
+ if (Array.isArray(keyNode[index])) throwError(state, "nested arrays are not supported inside keys");
1312
+ if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") keyNode[index] = "[object Object]";
1237
1313
  }
1238
1314
  }
1239
- if (hasPendingContent) {
1240
- captureSegment(state, captureStart, captureEnd, false);
1241
- writeFoldedLines(state, state.line - _line);
1242
- captureStart = captureEnd = state.position;
1243
- hasPendingContent = false;
1315
+ if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") keyNode = "[object Object]";
1316
+ keyNode = String(keyNode);
1317
+ if (_result === null) _result = {};
1318
+ if (keyTag === "tag:yaml.org,2002:merge") if (Array.isArray(valueNode)) {
1319
+ if (valueNode.length > state.maxMergeSeqLength) throwError(state, "merge sequence length exceeded maxMergeSeqLength (" + state.maxMergeSeqLength + ")");
1320
+ const seen = /* @__PURE__ */ new Set();
1321
+ for (let index = 0, quantity = valueNode.length; index < quantity; index += 1) {
1322
+ const src = valueNode[index];
1323
+ if (seen.has(src)) continue;
1324
+ seen.add(src);
1325
+ mergeMappings(state, _result, src, overridableKeys);
1326
+ }
1327
+ } else mergeMappings(state, _result, valueNode, overridableKeys);
1328
+ else {
1329
+ if (!state.json && !_hasOwnProperty.call(overridableKeys, keyNode) && _hasOwnProperty.call(_result, keyNode)) {
1330
+ state.line = startLine || state.line;
1331
+ state.lineStart = startLineStart || state.lineStart;
1332
+ state.position = startPos || state.position;
1333
+ throwError(state, "duplicated mapping key");
1334
+ }
1335
+ setProperty(_result, keyNode, valueNode);
1336
+ delete overridableKeys[keyNode];
1244
1337
  }
1245
- if (!is_WHITE_SPACE(ch)) captureEnd = state.position + 1;
1246
- ch = state.input.charCodeAt(++state.position);
1338
+ return _result;
1247
1339
  }
1248
- captureSegment(state, captureStart, captureEnd, false);
1249
- if (state.result) return true;
1250
- state.kind = _kind;
1251
- state.result = _result;
1252
- return false;
1253
- }
1254
- function readSingleQuotedScalar(state, nodeIndent) {
1255
- var ch = state.input.charCodeAt(state.position), captureStart, captureEnd;
1256
- if (ch !== 39) return false;
1257
- state.kind = "scalar";
1258
- state.result = "";
1259
- state.position++;
1260
- captureStart = captureEnd = state.position;
1261
- while ((ch = state.input.charCodeAt(state.position)) !== 0) if (ch === 39) {
1262
- captureSegment(state, captureStart, state.position, true);
1263
- ch = state.input.charCodeAt(++state.position);
1264
- if (ch === 39) {
1265
- captureStart = state.position;
1340
+ function readLineBreak(state) {
1341
+ const ch = state.input.charCodeAt(state.position);
1342
+ if (ch === 10) state.position++;
1343
+ else if (ch === 13) {
1266
1344
  state.position++;
1267
- captureEnd = state.position;
1268
- } else return true;
1269
- } else if (is_EOL(ch)) {
1270
- captureSegment(state, captureStart, captureEnd, true);
1271
- writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
1272
- captureStart = captureEnd = state.position;
1273
- } else if (state.position === state.lineStart && testDocumentSeparator(state)) throwError(state, "unexpected end of the document within a single quoted scalar");
1274
- else {
1275
- state.position++;
1276
- captureEnd = state.position;
1277
- }
1278
- throwError(state, "unexpected end of the stream within a single quoted scalar");
1279
- }
1280
- function readDoubleQuotedScalar(state, nodeIndent) {
1281
- var captureStart, captureEnd, hexLength, hexResult, tmp, ch = state.input.charCodeAt(state.position);
1282
- if (ch !== 34) return false;
1283
- state.kind = "scalar";
1284
- state.result = "";
1285
- state.position++;
1286
- captureStart = captureEnd = state.position;
1287
- while ((ch = state.input.charCodeAt(state.position)) !== 0) if (ch === 34) {
1288
- captureSegment(state, captureStart, state.position, true);
1289
- state.position++;
1290
- return true;
1291
- } else if (ch === 92) {
1292
- captureSegment(state, captureStart, state.position, true);
1293
- ch = state.input.charCodeAt(++state.position);
1294
- if (is_EOL(ch)) skipSeparationSpace(state, false, nodeIndent);
1295
- else if (ch < 256 && simpleEscapeCheck[ch]) {
1296
- state.result += simpleEscapeMap[ch];
1297
- state.position++;
1298
- } else if ((tmp = escapedHexLen(ch)) > 0) {
1299
- hexLength = tmp;
1300
- hexResult = 0;
1301
- for (; hexLength > 0; hexLength--) {
1345
+ if (state.input.charCodeAt(state.position) === 10) state.position++;
1346
+ } else throwError(state, "a line break is expected");
1347
+ state.line += 1;
1348
+ state.lineStart = state.position;
1349
+ state.firstTabInLine = -1;
1350
+ }
1351
+ function skipSeparationSpace(state, allowComments, checkIndent) {
1352
+ let lineBreaks = 0;
1353
+ let ch = state.input.charCodeAt(state.position);
1354
+ while (ch !== 0) {
1355
+ while (isWhiteSpace(ch)) {
1356
+ if (ch === 9 && state.firstTabInLine === -1) state.firstTabInLine = state.position;
1302
1357
  ch = state.input.charCodeAt(++state.position);
1303
- if ((tmp = fromHexCode(ch)) >= 0) hexResult = (hexResult << 4) + tmp;
1304
- else throwError(state, "expected hexadecimal character");
1305
1358
  }
1306
- state.result += charFromCodepoint(hexResult);
1307
- state.position++;
1308
- } else throwError(state, "unknown escape sequence");
1359
+ if (allowComments && ch === 35) do
1360
+ ch = state.input.charCodeAt(++state.position);
1361
+ while (ch !== 10 && ch !== 13 && ch !== 0);
1362
+ if (isEol(ch)) {
1363
+ readLineBreak(state);
1364
+ ch = state.input.charCodeAt(state.position);
1365
+ lineBreaks++;
1366
+ state.lineIndent = 0;
1367
+ while (ch === 32) {
1368
+ state.lineIndent++;
1369
+ ch = state.input.charCodeAt(++state.position);
1370
+ }
1371
+ } else break;
1372
+ }
1373
+ if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) throwWarning(state, "deficient indentation");
1374
+ return lineBreaks;
1375
+ }
1376
+ function testDocumentSeparator(state) {
1377
+ let _position = state.position;
1378
+ let ch = state.input.charCodeAt(_position);
1379
+ if ((ch === 45 || ch === 46) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) {
1380
+ _position += 3;
1381
+ ch = state.input.charCodeAt(_position);
1382
+ if (ch === 0 || isWsOrEol(ch)) return true;
1383
+ }
1384
+ return false;
1385
+ }
1386
+ function writeFoldedLines(state, count) {
1387
+ if (count === 1) state.result += " ";
1388
+ else if (count > 1) state.result += common.repeat("\n", count - 1);
1389
+ }
1390
+ function readPlainScalar(state, nodeIndent, withinFlowCollection) {
1391
+ let captureStart;
1392
+ let captureEnd;
1393
+ let hasPendingContent;
1394
+ let _line;
1395
+ let _lineStart;
1396
+ let _lineIndent;
1397
+ const _kind = state.kind;
1398
+ const _result = state.result;
1399
+ let ch = state.input.charCodeAt(state.position);
1400
+ if (isWsOrEol(ch) || isFlowIndicator(ch) || ch === 35 || ch === 38 || ch === 42 || ch === 33 || ch === 124 || ch === 62 || ch === 39 || ch === 34 || ch === 37 || ch === 64 || ch === 96) return false;
1401
+ if (ch === 63 || ch === 45) {
1402
+ const following = state.input.charCodeAt(state.position + 1);
1403
+ if (isWsOrEol(following) || withinFlowCollection && isFlowIndicator(following)) return false;
1404
+ }
1405
+ state.kind = "scalar";
1406
+ state.result = "";
1309
1407
  captureStart = captureEnd = state.position;
1310
- } else if (is_EOL(ch)) {
1311
- captureSegment(state, captureStart, captureEnd, true);
1312
- writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
1408
+ hasPendingContent = false;
1409
+ while (ch !== 0) {
1410
+ if (ch === 58) {
1411
+ const following = state.input.charCodeAt(state.position + 1);
1412
+ if (isWsOrEol(following) || withinFlowCollection && isFlowIndicator(following)) break;
1413
+ } else if (ch === 35) {
1414
+ if (isWsOrEol(state.input.charCodeAt(state.position - 1))) break;
1415
+ } else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && isFlowIndicator(ch)) break;
1416
+ else if (isEol(ch)) {
1417
+ _line = state.line;
1418
+ _lineStart = state.lineStart;
1419
+ _lineIndent = state.lineIndent;
1420
+ skipSeparationSpace(state, false, -1);
1421
+ if (state.lineIndent >= nodeIndent) {
1422
+ hasPendingContent = true;
1423
+ ch = state.input.charCodeAt(state.position);
1424
+ continue;
1425
+ } else {
1426
+ state.position = captureEnd;
1427
+ state.line = _line;
1428
+ state.lineStart = _lineStart;
1429
+ state.lineIndent = _lineIndent;
1430
+ break;
1431
+ }
1432
+ }
1433
+ if (hasPendingContent) {
1434
+ captureSegment(state, captureStart, captureEnd, false);
1435
+ writeFoldedLines(state, state.line - _line);
1436
+ captureStart = captureEnd = state.position;
1437
+ hasPendingContent = false;
1438
+ }
1439
+ if (!isWhiteSpace(ch)) captureEnd = state.position + 1;
1440
+ ch = state.input.charCodeAt(++state.position);
1441
+ }
1442
+ captureSegment(state, captureStart, captureEnd, false);
1443
+ if (state.result) return true;
1444
+ state.kind = _kind;
1445
+ state.result = _result;
1446
+ return false;
1447
+ }
1448
+ function readSingleQuotedScalar(state, nodeIndent) {
1449
+ let captureStart;
1450
+ let captureEnd;
1451
+ let ch = state.input.charCodeAt(state.position);
1452
+ if (ch !== 39) return false;
1453
+ state.kind = "scalar";
1454
+ state.result = "";
1455
+ state.position++;
1313
1456
  captureStart = captureEnd = state.position;
1314
- } else if (state.position === state.lineStart && testDocumentSeparator(state)) throwError(state, "unexpected end of the document within a double quoted scalar");
1315
- else {
1457
+ while ((ch = state.input.charCodeAt(state.position)) !== 0) if (ch === 39) {
1458
+ captureSegment(state, captureStart, state.position, true);
1459
+ ch = state.input.charCodeAt(++state.position);
1460
+ if (ch === 39) {
1461
+ captureStart = state.position;
1462
+ state.position++;
1463
+ captureEnd = state.position;
1464
+ } else return true;
1465
+ } else if (isEol(ch)) {
1466
+ captureSegment(state, captureStart, captureEnd, true);
1467
+ writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
1468
+ captureStart = captureEnd = state.position;
1469
+ } else if (state.position === state.lineStart && testDocumentSeparator(state)) throwError(state, "unexpected end of the document within a single quoted scalar");
1470
+ else {
1471
+ state.position++;
1472
+ if (!isWhiteSpace(ch)) captureEnd = state.position;
1473
+ }
1474
+ throwError(state, "unexpected end of the stream within a single quoted scalar");
1475
+ }
1476
+ function readDoubleQuotedScalar(state, nodeIndent) {
1477
+ let captureStart;
1478
+ let captureEnd;
1479
+ let tmp;
1480
+ let ch = state.input.charCodeAt(state.position);
1481
+ if (ch !== 34) return false;
1482
+ state.kind = "scalar";
1483
+ state.result = "";
1316
1484
  state.position++;
1317
- captureEnd = state.position;
1318
- }
1319
- throwError(state, "unexpected end of the stream within a double quoted scalar");
1320
- }
1321
- function readFlowCollection(state, nodeIndent) {
1322
- var readNext = true, _line, _lineStart, _pos, _tag = state.tag, _result, _anchor = state.anchor, following, terminator, isPair, isExplicitPair, isMapping, overridableKeys = Object.create(null), keyNode, keyTag, valueNode, ch = state.input.charCodeAt(state.position);
1323
- if (ch === 91) {
1324
- terminator = 93;
1325
- isMapping = false;
1326
- _result = [];
1327
- } else if (ch === 123) {
1328
- terminator = 125;
1329
- isMapping = true;
1330
- _result = {};
1331
- } else return false;
1332
- if (state.anchor !== null) state.anchorMap[state.anchor] = _result;
1333
- ch = state.input.charCodeAt(++state.position);
1334
- while (ch !== 0) {
1335
- skipSeparationSpace(state, true, nodeIndent);
1336
- ch = state.input.charCodeAt(state.position);
1337
- if (ch === terminator) {
1485
+ captureStart = captureEnd = state.position;
1486
+ while ((ch = state.input.charCodeAt(state.position)) !== 0) if (ch === 34) {
1487
+ captureSegment(state, captureStart, state.position, true);
1338
1488
  state.position++;
1339
- state.tag = _tag;
1340
- state.anchor = _anchor;
1341
- state.kind = isMapping ? "mapping" : "sequence";
1342
- state.result = _result;
1343
1489
  return true;
1344
- } else if (!readNext) throwError(state, "missed comma between flow collection entries");
1345
- else if (ch === 44) throwError(state, "expected the node content, but found ','");
1346
- keyTag = keyNode = valueNode = null;
1347
- isPair = isExplicitPair = false;
1348
- if (ch === 63) {
1349
- following = state.input.charCodeAt(state.position + 1);
1350
- if (is_WS_OR_EOL(following)) {
1351
- isPair = isExplicitPair = true;
1490
+ } else if (ch === 92) {
1491
+ captureSegment(state, captureStart, state.position, true);
1492
+ ch = state.input.charCodeAt(++state.position);
1493
+ if (isEol(ch)) skipSeparationSpace(state, false, nodeIndent);
1494
+ else if (ch < 256 && simpleEscapeCheck[ch]) {
1495
+ state.result += simpleEscapeMap[ch];
1496
+ state.position++;
1497
+ } else if ((tmp = escapedHexLen(ch)) > 0) {
1498
+ let hexLength = tmp;
1499
+ let hexResult = 0;
1500
+ for (; hexLength > 0; hexLength--) {
1501
+ ch = state.input.charCodeAt(++state.position);
1502
+ if ((tmp = fromHexCode(ch)) >= 0) hexResult = (hexResult << 4) + tmp;
1503
+ else throwError(state, "expected hexadecimal character");
1504
+ }
1505
+ state.result += charFromCodepoint(hexResult);
1352
1506
  state.position++;
1507
+ } else throwError(state, "unknown escape sequence");
1508
+ captureStart = captureEnd = state.position;
1509
+ } else if (isEol(ch)) {
1510
+ captureSegment(state, captureStart, captureEnd, true);
1511
+ writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
1512
+ captureStart = captureEnd = state.position;
1513
+ } else if (state.position === state.lineStart && testDocumentSeparator(state)) throwError(state, "unexpected end of the document within a double quoted scalar");
1514
+ else {
1515
+ state.position++;
1516
+ if (!isWhiteSpace(ch)) captureEnd = state.position;
1517
+ }
1518
+ throwError(state, "unexpected end of the stream within a double quoted scalar");
1519
+ }
1520
+ function readFlowCollection(state, nodeIndent) {
1521
+ let readNext = true;
1522
+ let _line;
1523
+ let _lineStart;
1524
+ let _pos;
1525
+ const _tag = state.tag;
1526
+ let _result;
1527
+ const _anchor = state.anchor;
1528
+ let terminator;
1529
+ let isPair;
1530
+ let isExplicitPair;
1531
+ let isMapping;
1532
+ const overridableKeys = Object.create(null);
1533
+ let keyNode;
1534
+ let keyTag;
1535
+ let valueNode;
1536
+ let ch = state.input.charCodeAt(state.position);
1537
+ if (ch === 91) {
1538
+ terminator = 93;
1539
+ isMapping = false;
1540
+ _result = [];
1541
+ } else if (ch === 123) {
1542
+ terminator = 125;
1543
+ isMapping = true;
1544
+ _result = {};
1545
+ } else return false;
1546
+ if (state.anchor !== null) storeAnchor(state, state.anchor, _result);
1547
+ ch = state.input.charCodeAt(++state.position);
1548
+ while (ch !== 0) {
1549
+ skipSeparationSpace(state, true, nodeIndent);
1550
+ ch = state.input.charCodeAt(state.position);
1551
+ if (ch === terminator) {
1552
+ state.position++;
1553
+ state.tag = _tag;
1554
+ state.anchor = _anchor;
1555
+ state.kind = isMapping ? "mapping" : "sequence";
1556
+ state.result = _result;
1557
+ return true;
1558
+ } else if (!readNext) throwError(state, "missed comma between flow collection entries");
1559
+ else if (ch === 44) throwError(state, "expected the node content, but found ','");
1560
+ keyTag = keyNode = valueNode = null;
1561
+ isPair = isExplicitPair = false;
1562
+ if (ch === 63) {
1563
+ if (isWsOrEol(state.input.charCodeAt(state.position + 1))) {
1564
+ isPair = isExplicitPair = true;
1565
+ state.position++;
1566
+ skipSeparationSpace(state, true, nodeIndent);
1567
+ }
1568
+ }
1569
+ _line = state.line;
1570
+ _lineStart = state.lineStart;
1571
+ _pos = state.position;
1572
+ composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
1573
+ keyTag = state.tag;
1574
+ keyNode = state.result;
1575
+ skipSeparationSpace(state, true, nodeIndent);
1576
+ ch = state.input.charCodeAt(state.position);
1577
+ if ((isExplicitPair || state.line === _line) && ch === 58) {
1578
+ isPair = true;
1579
+ ch = state.input.charCodeAt(++state.position);
1353
1580
  skipSeparationSpace(state, true, nodeIndent);
1581
+ composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
1582
+ valueNode = state.result;
1354
1583
  }
1355
- }
1356
- _line = state.line;
1357
- _lineStart = state.lineStart;
1358
- _pos = state.position;
1359
- composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
1360
- keyTag = state.tag;
1361
- keyNode = state.result;
1362
- skipSeparationSpace(state, true, nodeIndent);
1363
- ch = state.input.charCodeAt(state.position);
1364
- if ((isExplicitPair || state.line === _line) && ch === 58) {
1365
- isPair = true;
1366
- ch = state.input.charCodeAt(++state.position);
1584
+ if (isMapping) storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
1585
+ else if (isPair) _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
1586
+ else _result.push(keyNode);
1367
1587
  skipSeparationSpace(state, true, nodeIndent);
1368
- composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
1369
- valueNode = state.result;
1370
- }
1371
- if (isMapping) storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
1372
- else if (isPair) _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
1373
- else _result.push(keyNode);
1374
- skipSeparationSpace(state, true, nodeIndent);
1375
- ch = state.input.charCodeAt(state.position);
1376
- if (ch === 44) {
1377
- readNext = true;
1378
- ch = state.input.charCodeAt(++state.position);
1379
- } else readNext = false;
1380
- }
1381
- throwError(state, "unexpected end of the stream within a flow collection");
1382
- }
1383
- function readBlockScalar(state, nodeIndent) {
1384
- var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch = state.input.charCodeAt(state.position);
1385
- if (ch === 124) folding = false;
1386
- else if (ch === 62) folding = true;
1387
- else return false;
1388
- state.kind = "scalar";
1389
- state.result = "";
1390
- while (ch !== 0) {
1391
- ch = state.input.charCodeAt(++state.position);
1392
- if (ch === 43 || ch === 45) if (CHOMPING_CLIP === chomping) chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
1393
- else throwError(state, "repeat of a chomping mode identifier");
1394
- 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");
1395
- else if (!detectedIndent) {
1396
- textIndent = nodeIndent + tmp - 1;
1397
- detectedIndent = true;
1398
- } else throwError(state, "repeat of an indentation width identifier");
1399
- else break;
1400
- }
1401
- if (is_WHITE_SPACE(ch)) {
1402
- do
1403
- ch = state.input.charCodeAt(++state.position);
1404
- while (is_WHITE_SPACE(ch));
1405
- if (ch === 35) do
1406
- ch = state.input.charCodeAt(++state.position);
1407
- while (!is_EOL(ch) && ch !== 0);
1408
- }
1409
- while (ch !== 0) {
1410
- readLineBreak(state);
1411
- state.lineIndent = 0;
1412
- ch = state.input.charCodeAt(state.position);
1413
- while ((!detectedIndent || state.lineIndent < textIndent) && ch === 32) {
1414
- state.lineIndent++;
1588
+ ch = state.input.charCodeAt(state.position);
1589
+ if (ch === 44) {
1590
+ readNext = true;
1591
+ ch = state.input.charCodeAt(++state.position);
1592
+ } else readNext = false;
1593
+ }
1594
+ throwError(state, "unexpected end of the stream within a flow collection");
1595
+ }
1596
+ function readBlockScalar(state, nodeIndent) {
1597
+ let folding;
1598
+ let chomping = CHOMPING_CLIP;
1599
+ let didReadContent = false;
1600
+ let detectedIndent = false;
1601
+ let textIndent = nodeIndent;
1602
+ let emptyLines = 0;
1603
+ let atMoreIndented = false;
1604
+ let tmp;
1605
+ let ch = state.input.charCodeAt(state.position);
1606
+ if (ch === 124) folding = false;
1607
+ else if (ch === 62) folding = true;
1608
+ else return false;
1609
+ state.kind = "scalar";
1610
+ state.result = "";
1611
+ while (ch !== 0) {
1415
1612
  ch = state.input.charCodeAt(++state.position);
1613
+ if (ch === 43 || ch === 45) if (CHOMPING_CLIP === chomping) chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
1614
+ else throwError(state, "repeat of a chomping mode identifier");
1615
+ 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");
1616
+ else if (!detectedIndent) {
1617
+ textIndent = nodeIndent + tmp - 1;
1618
+ detectedIndent = true;
1619
+ } else throwError(state, "repeat of an indentation width identifier");
1620
+ else break;
1416
1621
  }
1417
- if (!detectedIndent && state.lineIndent > textIndent) textIndent = state.lineIndent;
1418
- if (is_EOL(ch)) {
1419
- emptyLines++;
1420
- continue;
1622
+ if (isWhiteSpace(ch)) {
1623
+ do
1624
+ ch = state.input.charCodeAt(++state.position);
1625
+ while (isWhiteSpace(ch));
1626
+ if (ch === 35) do
1627
+ ch = state.input.charCodeAt(++state.position);
1628
+ while (!isEol(ch) && ch !== 0);
1421
1629
  }
1422
- if (state.lineIndent < textIndent) {
1423
- if (chomping === CHOMPING_KEEP) state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
1424
- else if (chomping === CHOMPING_CLIP) {
1425
- if (didReadContent) state.result += "\n";
1630
+ while (ch !== 0) {
1631
+ readLineBreak(state);
1632
+ state.lineIndent = 0;
1633
+ ch = state.input.charCodeAt(state.position);
1634
+ while ((!detectedIndent || state.lineIndent < textIndent) && ch === 32) {
1635
+ state.lineIndent++;
1636
+ ch = state.input.charCodeAt(++state.position);
1426
1637
  }
1427
- break;
1428
- }
1429
- if (folding) if (is_WHITE_SPACE(ch)) {
1430
- atMoreIndented = true;
1431
- state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
1432
- } else if (atMoreIndented) {
1433
- atMoreIndented = false;
1434
- state.result += common.repeat("\n", emptyLines + 1);
1435
- } else if (emptyLines === 0) {
1436
- if (didReadContent) state.result += " ";
1437
- } else state.result += common.repeat("\n", emptyLines);
1438
- else state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
1439
- didReadContent = true;
1440
- detectedIndent = true;
1441
- emptyLines = 0;
1442
- captureStart = state.position;
1443
- while (!is_EOL(ch) && ch !== 0) ch = state.input.charCodeAt(++state.position);
1444
- captureSegment(state, captureStart, state.position, false);
1445
- }
1446
- return true;
1447
- }
1448
- function readBlockSequence(state, nodeIndent) {
1449
- var _line, _tag = state.tag, _anchor = state.anchor, _result = [], following, detected = false, ch;
1450
- if (state.firstTabInLine !== -1) return false;
1451
- if (state.anchor !== null) state.anchorMap[state.anchor] = _result;
1452
- ch = state.input.charCodeAt(state.position);
1453
- while (ch !== 0) {
1454
- if (state.firstTabInLine !== -1) {
1455
- state.position = state.firstTabInLine;
1456
- throwError(state, "tab characters must not be used in indentation");
1457
- }
1458
- if (ch !== 45) break;
1459
- following = state.input.charCodeAt(state.position + 1);
1460
- if (!is_WS_OR_EOL(following)) break;
1461
- detected = true;
1462
- state.position++;
1463
- if (skipSeparationSpace(state, true, -1)) {
1464
- if (state.lineIndent <= nodeIndent) {
1465
- _result.push(null);
1466
- ch = state.input.charCodeAt(state.position);
1638
+ if (!detectedIndent && state.lineIndent > textIndent) textIndent = state.lineIndent;
1639
+ if (isEol(ch)) {
1640
+ emptyLines++;
1467
1641
  continue;
1468
1642
  }
1643
+ if (!detectedIndent && textIndent === 0) throwError(state, "missing indentation for block scalar");
1644
+ if (state.lineIndent < textIndent) {
1645
+ if (chomping === CHOMPING_KEEP) state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
1646
+ else if (chomping === CHOMPING_CLIP) {
1647
+ if (didReadContent) state.result += "\n";
1648
+ }
1649
+ break;
1650
+ }
1651
+ if (folding) if (isWhiteSpace(ch)) {
1652
+ atMoreIndented = true;
1653
+ state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
1654
+ } else if (atMoreIndented) {
1655
+ atMoreIndented = false;
1656
+ state.result += common.repeat("\n", emptyLines + 1);
1657
+ } else if (emptyLines === 0) {
1658
+ if (didReadContent) state.result += " ";
1659
+ } else state.result += common.repeat("\n", emptyLines);
1660
+ else state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
1661
+ didReadContent = true;
1662
+ detectedIndent = true;
1663
+ emptyLines = 0;
1664
+ const captureStart = state.position;
1665
+ while (!isEol(ch) && ch !== 0) ch = state.input.charCodeAt(++state.position);
1666
+ captureSegment(state, captureStart, state.position, false);
1469
1667
  }
1470
- _line = state.line;
1471
- composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
1472
- _result.push(state.result);
1473
- skipSeparationSpace(state, true, -1);
1474
- ch = state.input.charCodeAt(state.position);
1475
- if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) throwError(state, "bad indentation of a sequence entry");
1476
- else if (state.lineIndent < nodeIndent) break;
1477
- }
1478
- if (detected) {
1479
- state.tag = _tag;
1480
- state.anchor = _anchor;
1481
- state.kind = "sequence";
1482
- state.result = _result;
1483
1668
  return true;
1484
1669
  }
1485
- return false;
1486
- }
1487
- function readBlockMapping(state, nodeIndent, flowIndent) {
1488
- var following, allowCompact, _line, _keyLine, _keyLineStart, _keyPos, _tag = state.tag, _anchor = state.anchor, _result = {}, overridableKeys = Object.create(null), keyTag = null, keyNode = null, valueNode = null, atExplicitKey = false, detected = false, ch;
1489
- if (state.firstTabInLine !== -1) return false;
1490
- if (state.anchor !== null) state.anchorMap[state.anchor] = _result;
1491
- ch = state.input.charCodeAt(state.position);
1492
- while (ch !== 0) {
1493
- if (!atExplicitKey && state.firstTabInLine !== -1) {
1494
- state.position = state.firstTabInLine;
1495
- throwError(state, "tab characters must not be used in indentation");
1496
- }
1497
- following = state.input.charCodeAt(state.position + 1);
1498
- _line = state.line;
1499
- if ((ch === 63 || ch === 58) && is_WS_OR_EOL(following)) {
1500
- if (ch === 63) {
1501
- if (atExplicitKey) {
1502
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
1503
- keyTag = keyNode = valueNode = null;
1670
+ function readBlockSequence(state, nodeIndent) {
1671
+ const _tag = state.tag;
1672
+ const _anchor = state.anchor;
1673
+ const _result = [];
1674
+ let detected = false;
1675
+ if (state.firstTabInLine !== -1) return false;
1676
+ if (state.anchor !== null) storeAnchor(state, state.anchor, _result);
1677
+ let ch = state.input.charCodeAt(state.position);
1678
+ while (ch !== 0) {
1679
+ if (state.firstTabInLine !== -1) {
1680
+ state.position = state.firstTabInLine;
1681
+ throwError(state, "tab characters must not be used in indentation");
1682
+ }
1683
+ if (ch !== 45) break;
1684
+ if (!isWsOrEol(state.input.charCodeAt(state.position + 1))) break;
1685
+ detected = true;
1686
+ state.position++;
1687
+ if (skipSeparationSpace(state, true, -1)) {
1688
+ if (state.lineIndent <= nodeIndent) {
1689
+ _result.push(null);
1690
+ ch = state.input.charCodeAt(state.position);
1691
+ continue;
1504
1692
  }
1505
- detected = true;
1506
- atExplicitKey = true;
1507
- allowCompact = true;
1508
- } else if (atExplicitKey) {
1509
- atExplicitKey = false;
1510
- allowCompact = true;
1511
- } else throwError(state, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
1512
- state.position += 1;
1513
- ch = following;
1514
- } else {
1515
- _keyLine = state.line;
1516
- _keyLineStart = state.lineStart;
1517
- _keyPos = state.position;
1518
- if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) break;
1519
- if (state.line === _line) {
1520
- ch = state.input.charCodeAt(state.position);
1521
- while (is_WHITE_SPACE(ch)) ch = state.input.charCodeAt(++state.position);
1522
- if (ch === 58) {
1523
- ch = state.input.charCodeAt(++state.position);
1524
- if (!is_WS_OR_EOL(ch)) throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
1693
+ }
1694
+ const _line = state.line;
1695
+ composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
1696
+ _result.push(state.result);
1697
+ skipSeparationSpace(state, true, -1);
1698
+ ch = state.input.charCodeAt(state.position);
1699
+ if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) throwError(state, "bad indentation of a sequence entry");
1700
+ else if (state.lineIndent < nodeIndent) break;
1701
+ }
1702
+ if (detected) {
1703
+ state.tag = _tag;
1704
+ state.anchor = _anchor;
1705
+ state.kind = "sequence";
1706
+ state.result = _result;
1707
+ return true;
1708
+ }
1709
+ return false;
1710
+ }
1711
+ function readBlockMapping(state, nodeIndent, flowIndent) {
1712
+ let allowCompact;
1713
+ let _keyLine;
1714
+ let _keyLineStart;
1715
+ let _keyPos;
1716
+ const _tag = state.tag;
1717
+ const _anchor = state.anchor;
1718
+ const _result = {};
1719
+ const overridableKeys = Object.create(null);
1720
+ let keyTag = null;
1721
+ let keyNode = null;
1722
+ let valueNode = null;
1723
+ let atExplicitKey = false;
1724
+ let detected = false;
1725
+ if (state.firstTabInLine !== -1) return false;
1726
+ if (state.anchor !== null) storeAnchor(state, state.anchor, _result);
1727
+ let ch = state.input.charCodeAt(state.position);
1728
+ while (ch !== 0) {
1729
+ if (!atExplicitKey && state.firstTabInLine !== -1) {
1730
+ state.position = state.firstTabInLine;
1731
+ throwError(state, "tab characters must not be used in indentation");
1732
+ }
1733
+ const following = state.input.charCodeAt(state.position + 1);
1734
+ const _line = state.line;
1735
+ if ((ch === 63 || ch === 58) && isWsOrEol(following)) {
1736
+ if (ch === 63) {
1525
1737
  if (atExplicitKey) {
1526
1738
  storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
1527
1739
  keyTag = keyNode = valueNode = null;
1528
1740
  }
1529
- detected = true;
1530
- atExplicitKey = false;
1531
- allowCompact = false;
1532
- keyTag = state.tag;
1533
- keyNode = state.result;
1534
- } else if (detected) throwError(state, "can not read an implicit mapping pair; a colon is missed");
1741
+ detected = true;
1742
+ atExplicitKey = true;
1743
+ allowCompact = true;
1744
+ } else if (atExplicitKey) {
1745
+ atExplicitKey = false;
1746
+ allowCompact = true;
1747
+ } else throwError(state, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
1748
+ state.position += 1;
1749
+ ch = following;
1750
+ } else {
1751
+ _keyLine = state.line;
1752
+ _keyLineStart = state.lineStart;
1753
+ _keyPos = state.position;
1754
+ if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) break;
1755
+ if (state.line === _line) {
1756
+ ch = state.input.charCodeAt(state.position);
1757
+ while (isWhiteSpace(ch)) ch = state.input.charCodeAt(++state.position);
1758
+ if (ch === 58) {
1759
+ ch = state.input.charCodeAt(++state.position);
1760
+ if (!isWsOrEol(ch)) throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
1761
+ if (atExplicitKey) {
1762
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
1763
+ keyTag = keyNode = valueNode = null;
1764
+ }
1765
+ detected = true;
1766
+ atExplicitKey = false;
1767
+ allowCompact = false;
1768
+ keyTag = state.tag;
1769
+ keyNode = state.result;
1770
+ } else if (detected) throwError(state, "can not read an implicit mapping pair; a colon is missed");
1771
+ else {
1772
+ state.tag = _tag;
1773
+ state.anchor = _anchor;
1774
+ return true;
1775
+ }
1776
+ } else if (detected) throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
1535
1777
  else {
1536
1778
  state.tag = _tag;
1537
1779
  state.anchor = _anchor;
1538
1780
  return true;
1539
1781
  }
1540
- } else if (detected) throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
1541
- else {
1542
- state.tag = _tag;
1543
- state.anchor = _anchor;
1544
- return true;
1545
1782
  }
1546
- }
1547
- if (state.line === _line || state.lineIndent > nodeIndent) {
1548
- if (atExplicitKey) {
1549
- _keyLine = state.line;
1550
- _keyLineStart = state.lineStart;
1551
- _keyPos = state.position;
1552
- }
1553
- if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) if (atExplicitKey) keyNode = state.result;
1554
- else valueNode = state.result;
1555
- if (!atExplicitKey) {
1556
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
1557
- keyTag = keyNode = valueNode = null;
1783
+ if (state.line === _line || state.lineIndent > nodeIndent) {
1784
+ if (atExplicitKey) {
1785
+ _keyLine = state.line;
1786
+ _keyLineStart = state.lineStart;
1787
+ _keyPos = state.position;
1788
+ }
1789
+ if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) if (atExplicitKey) keyNode = state.result;
1790
+ else valueNode = state.result;
1791
+ if (!atExplicitKey) {
1792
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
1793
+ keyTag = keyNode = valueNode = null;
1794
+ }
1795
+ skipSeparationSpace(state, true, -1);
1796
+ ch = state.input.charCodeAt(state.position);
1558
1797
  }
1559
- skipSeparationSpace(state, true, -1);
1560
- ch = state.input.charCodeAt(state.position);
1798
+ if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) throwError(state, "bad indentation of a mapping entry");
1799
+ else if (state.lineIndent < nodeIndent) break;
1561
1800
  }
1562
- if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) throwError(state, "bad indentation of a mapping entry");
1563
- else if (state.lineIndent < nodeIndent) break;
1564
- }
1565
- if (atExplicitKey) storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
1566
- if (detected) {
1567
- state.tag = _tag;
1568
- state.anchor = _anchor;
1569
- state.kind = "mapping";
1570
- state.result = _result;
1801
+ if (atExplicitKey) storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
1802
+ if (detected) {
1803
+ state.tag = _tag;
1804
+ state.anchor = _anchor;
1805
+ state.kind = "mapping";
1806
+ state.result = _result;
1807
+ }
1808
+ return detected;
1571
1809
  }
1572
- return detected;
1573
- }
1574
- function readTagProperty(state) {
1575
- var _position, isVerbatim = false, isNamed = false, tagHandle, tagName, ch = state.input.charCodeAt(state.position);
1576
- if (ch !== 33) return false;
1577
- if (state.tag !== null) throwError(state, "duplication of a tag property");
1578
- ch = state.input.charCodeAt(++state.position);
1579
- if (ch === 60) {
1580
- isVerbatim = true;
1810
+ function readTagProperty(state) {
1811
+ let isVerbatim = false;
1812
+ let isNamed = false;
1813
+ let tagHandle;
1814
+ let tagName;
1815
+ let ch = state.input.charCodeAt(state.position);
1816
+ if (ch !== 33) return false;
1817
+ if (state.tag !== null) throwError(state, "duplication of a tag property");
1581
1818
  ch = state.input.charCodeAt(++state.position);
1582
- } else if (ch === 33) {
1583
- isNamed = true;
1584
- tagHandle = "!!";
1585
- ch = state.input.charCodeAt(++state.position);
1586
- } else tagHandle = "!";
1587
- _position = state.position;
1588
- if (isVerbatim) {
1589
- do
1590
- ch = state.input.charCodeAt(++state.position);
1591
- while (ch !== 0 && ch !== 62);
1592
- if (state.position < state.length) {
1593
- tagName = state.input.slice(_position, state.position);
1819
+ if (ch === 60) {
1820
+ isVerbatim = true;
1594
1821
  ch = state.input.charCodeAt(++state.position);
1595
- } else throwError(state, "unexpected end of the stream within a verbatim tag");
1596
- } else {
1597
- while (ch !== 0 && !is_WS_OR_EOL(ch)) {
1598
- if (ch === 33) if (!isNamed) {
1599
- tagHandle = state.input.slice(_position - 1, state.position + 1);
1600
- if (!PATTERN_TAG_HANDLE.test(tagHandle)) throwError(state, "named tag handle cannot contain such characters");
1601
- isNamed = true;
1602
- _position = state.position + 1;
1603
- } else throwError(state, "tag suffix cannot contain exclamation marks");
1822
+ } else if (ch === 33) {
1823
+ isNamed = true;
1824
+ tagHandle = "!!";
1604
1825
  ch = state.input.charCodeAt(++state.position);
1605
- }
1606
- tagName = state.input.slice(_position, state.position);
1607
- if (PATTERN_FLOW_INDICATORS.test(tagName)) throwError(state, "tag suffix cannot contain flow indicator characters");
1608
- }
1609
- if (tagName && !PATTERN_TAG_URI.test(tagName)) throwError(state, "tag name cannot contain such characters: " + tagName);
1610
- try {
1611
- tagName = decodeURIComponent(tagName);
1612
- } catch (err) {
1613
- throwError(state, "tag name is malformed: " + tagName);
1614
- }
1615
- if (isVerbatim) state.tag = tagName;
1616
- else if (_hasOwnProperty$1.call(state.tagMap, tagHandle)) state.tag = state.tagMap[tagHandle] + tagName;
1617
- else if (tagHandle === "!") state.tag = "!" + tagName;
1618
- else if (tagHandle === "!!") state.tag = "tag:yaml.org,2002:" + tagName;
1619
- else throwError(state, "undeclared tag handle \"" + tagHandle + "\"");
1620
- return true;
1621
- }
1622
- function readAnchorProperty(state) {
1623
- var _position, ch = state.input.charCodeAt(state.position);
1624
- if (ch !== 38) return false;
1625
- if (state.anchor !== null) throwError(state, "duplication of an anchor property");
1626
- ch = state.input.charCodeAt(++state.position);
1627
- _position = state.position;
1628
- while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) ch = state.input.charCodeAt(++state.position);
1629
- if (state.position === _position) throwError(state, "name of an anchor node must contain at least one character");
1630
- state.anchor = state.input.slice(_position, state.position);
1631
- return true;
1632
- }
1633
- function readAlias(state) {
1634
- var _position, alias, ch = state.input.charCodeAt(state.position);
1635
- if (ch !== 42) return false;
1636
- ch = state.input.charCodeAt(++state.position);
1637
- _position = state.position;
1638
- while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) ch = state.input.charCodeAt(++state.position);
1639
- if (state.position === _position) throwError(state, "name of an alias node must contain at least one character");
1640
- alias = state.input.slice(_position, state.position);
1641
- if (!_hasOwnProperty$1.call(state.anchorMap, alias)) throwError(state, "unidentified alias \"" + alias + "\"");
1642
- state.result = state.anchorMap[alias];
1643
- skipSeparationSpace(state, true, -1);
1644
- return true;
1645
- }
1646
- function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
1647
- var allowBlockStyles, allowBlockScalars, allowBlockCollections, indentStatus = 1, atNewLine = false, hasContent = false, typeIndex, typeQuantity, typeList, type, flowIndent, blockIndent;
1648
- if (state.listener !== null) state.listener("open", state);
1649
- state.tag = null;
1650
- state.anchor = null;
1651
- state.kind = null;
1652
- state.result = null;
1653
- allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
1654
- if (allowToSeek) {
1655
- if (skipSeparationSpace(state, true, -1)) {
1656
- atNewLine = true;
1657
- if (state.lineIndent > parentIndent) indentStatus = 1;
1658
- else if (state.lineIndent === parentIndent) indentStatus = 0;
1659
- else if (state.lineIndent < parentIndent) indentStatus = -1;
1660
- }
1661
- }
1662
- if (indentStatus === 1) while (readTagProperty(state) || readAnchorProperty(state)) if (skipSeparationSpace(state, true, -1)) {
1663
- atNewLine = true;
1664
- allowBlockCollections = allowBlockStyles;
1665
- if (state.lineIndent > parentIndent) indentStatus = 1;
1666
- else if (state.lineIndent === parentIndent) indentStatus = 0;
1667
- else if (state.lineIndent < parentIndent) indentStatus = -1;
1668
- } else allowBlockCollections = false;
1669
- if (allowBlockCollections) allowBlockCollections = atNewLine || allowCompact;
1670
- if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
1671
- if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) flowIndent = parentIndent;
1672
- else flowIndent = parentIndent + 1;
1673
- blockIndent = state.position - state.lineStart;
1674
- if (indentStatus === 1) if (allowBlockCollections && (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent)) || readFlowCollection(state, flowIndent)) hasContent = true;
1675
- else {
1676
- if (allowBlockScalars && readBlockScalar(state, flowIndent) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) hasContent = true;
1677
- else if (readAlias(state)) {
1678
- hasContent = true;
1679
- if (state.tag !== null || state.anchor !== null) throwError(state, "alias node should not have any properties");
1680
- } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
1681
- hasContent = true;
1682
- if (state.tag === null) state.tag = "?";
1683
- }
1684
- if (state.anchor !== null) state.anchorMap[state.anchor] = state.result;
1685
- }
1686
- else if (indentStatus === 0) hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
1687
- }
1688
- if (state.tag === null) {
1689
- if (state.anchor !== null) state.anchorMap[state.anchor] = state.result;
1690
- } else if (state.tag === "?") {
1691
- if (state.result !== null && state.kind !== "scalar") throwError(state, "unacceptable node kind for !<?> tag; it should be \"scalar\", not \"" + state.kind + "\"");
1692
- for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
1693
- type = state.implicitTypes[typeIndex];
1694
- if (type.resolve(state.result)) {
1695
- state.result = type.construct(state.result);
1696
- state.tag = type.tag;
1697
- if (state.anchor !== null) state.anchorMap[state.anchor] = state.result;
1698
- break;
1699
- }
1700
- }
1701
- } else if (state.tag !== "!") {
1702
- if (_hasOwnProperty$1.call(state.typeMap[state.kind || "fallback"], state.tag)) type = state.typeMap[state.kind || "fallback"][state.tag];
1703
- else {
1704
- type = null;
1705
- typeList = state.typeMap.multi[state.kind || "fallback"];
1706
- for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
1707
- type = typeList[typeIndex];
1708
- break;
1826
+ } else tagHandle = "!";
1827
+ let _position = state.position;
1828
+ if (isVerbatim) {
1829
+ do
1830
+ ch = state.input.charCodeAt(++state.position);
1831
+ while (ch !== 0 && ch !== 62);
1832
+ if (state.position < state.length) {
1833
+ tagName = state.input.slice(_position, state.position);
1834
+ ch = state.input.charCodeAt(++state.position);
1835
+ } else throwError(state, "unexpected end of the stream within a verbatim tag");
1836
+ } else {
1837
+ while (ch !== 0 && !isWsOrEol(ch)) {
1838
+ if (ch === 33) if (!isNamed) {
1839
+ tagHandle = state.input.slice(_position - 1, state.position + 1);
1840
+ if (!PATTERN_TAG_HANDLE.test(tagHandle)) throwError(state, "named tag handle cannot contain such characters");
1841
+ isNamed = true;
1842
+ _position = state.position + 1;
1843
+ } else throwError(state, "tag suffix cannot contain exclamation marks");
1844
+ ch = state.input.charCodeAt(++state.position);
1709
1845
  }
1846
+ tagName = state.input.slice(_position, state.position);
1847
+ if (PATTERN_FLOW_INDICATORS.test(tagName)) throwError(state, "tag suffix cannot contain flow indicator characters");
1710
1848
  }
1711
- if (!type) throwError(state, "unknown tag !<" + state.tag + ">");
1712
- if (state.result !== null && type.kind !== state.kind) throwError(state, "unacceptable node kind for !<" + state.tag + "> tag; it should be \"" + type.kind + "\", not \"" + state.kind + "\"");
1713
- if (!type.resolve(state.result, state.tag)) throwError(state, "cannot resolve a node with !<" + state.tag + "> explicit tag");
1714
- else {
1715
- state.result = type.construct(state.result, state.tag);
1716
- if (state.anchor !== null) state.anchorMap[state.anchor] = state.result;
1849
+ if (tagName && !PATTERN_TAG_URI.test(tagName)) throwError(state, "tag name cannot contain such characters: " + tagName);
1850
+ try {
1851
+ tagName = decodeURIComponent(tagName);
1852
+ } catch (err) {
1853
+ throwError(state, "tag name is malformed: " + tagName);
1717
1854
  }
1855
+ if (isVerbatim) state.tag = tagName;
1856
+ else if (_hasOwnProperty.call(state.tagMap, tagHandle)) state.tag = state.tagMap[tagHandle] + tagName;
1857
+ else if (tagHandle === "!") state.tag = "!" + tagName;
1858
+ else if (tagHandle === "!!") state.tag = "tag:yaml.org,2002:" + tagName;
1859
+ else throwError(state, "undeclared tag handle \"" + tagHandle + "\"");
1860
+ return true;
1718
1861
  }
1719
- if (state.listener !== null) state.listener("close", state);
1720
- return state.tag !== null || state.anchor !== null || hasContent;
1721
- }
1722
- function readDocument(state) {
1723
- var documentStart = state.position, _position, directiveName, directiveArgs, hasDirectives = false, ch;
1724
- state.version = null;
1725
- state.checkLineBreaks = state.legacy;
1726
- state.tagMap = Object.create(null);
1727
- state.anchorMap = Object.create(null);
1728
- while ((ch = state.input.charCodeAt(state.position)) !== 0) {
1729
- skipSeparationSpace(state, true, -1);
1730
- ch = state.input.charCodeAt(state.position);
1731
- if (state.lineIndent > 0 || ch !== 37) break;
1732
- hasDirectives = true;
1862
+ function readAnchorProperty(state) {
1863
+ let ch = state.input.charCodeAt(state.position);
1864
+ if (ch !== 38) return false;
1865
+ if (state.anchor !== null) throwError(state, "duplication of an anchor property");
1733
1866
  ch = state.input.charCodeAt(++state.position);
1734
- _position = state.position;
1735
- while (ch !== 0 && !is_WS_OR_EOL(ch)) ch = state.input.charCodeAt(++state.position);
1736
- directiveName = state.input.slice(_position, state.position);
1737
- directiveArgs = [];
1738
- if (directiveName.length < 1) throwError(state, "directive name must not be less than one character in length");
1739
- while (ch !== 0) {
1740
- while (is_WHITE_SPACE(ch)) ch = state.input.charCodeAt(++state.position);
1741
- if (ch === 35) {
1742
- do
1743
- ch = state.input.charCodeAt(++state.position);
1744
- while (ch !== 0 && !is_EOL(ch));
1745
- break;
1746
- }
1747
- if (is_EOL(ch)) break;
1748
- _position = state.position;
1749
- while (ch !== 0 && !is_WS_OR_EOL(ch)) ch = state.input.charCodeAt(++state.position);
1750
- directiveArgs.push(state.input.slice(_position, state.position));
1867
+ const _position = state.position;
1868
+ while (ch !== 0 && !isWsOrEol(ch) && !isFlowIndicator(ch)) ch = state.input.charCodeAt(++state.position);
1869
+ if (state.position === _position) throwError(state, "name of an anchor node must contain at least one character");
1870
+ state.anchor = state.input.slice(_position, state.position);
1871
+ return true;
1872
+ }
1873
+ function readAlias(state) {
1874
+ let ch = state.input.charCodeAt(state.position);
1875
+ if (ch !== 42) return false;
1876
+ ch = state.input.charCodeAt(++state.position);
1877
+ const _position = state.position;
1878
+ while (ch !== 0 && !isWsOrEol(ch) && !isFlowIndicator(ch)) ch = state.input.charCodeAt(++state.position);
1879
+ if (state.position === _position) throwError(state, "name of an alias node must contain at least one character");
1880
+ const alias = state.input.slice(_position, state.position);
1881
+ if (!_hasOwnProperty.call(state.anchorMap, alias)) throwError(state, "unidentified alias \"" + alias + "\"");
1882
+ state.result = state.anchorMap[alias];
1883
+ skipSeparationSpace(state, true, -1);
1884
+ return true;
1885
+ }
1886
+ function tryReadBlockMappingFromProperty(state, propertyStart, nodeIndent, flowIndent) {
1887
+ const fallbackState = snapshotState(state);
1888
+ beginAnchorTransaction(state);
1889
+ restoreState(state, propertyStart);
1890
+ state.tag = null;
1891
+ state.anchor = null;
1892
+ state.kind = null;
1893
+ state.result = null;
1894
+ if (readBlockMapping(state, nodeIndent, flowIndent) && state.kind === "mapping") {
1895
+ commitAnchorTransaction(state);
1896
+ return true;
1751
1897
  }
1752
- if (ch !== 0) readLineBreak(state);
1753
- if (_hasOwnProperty$1.call(directiveHandlers, directiveName)) directiveHandlers[directiveName](state, directiveName, directiveArgs);
1754
- else throwWarning(state, "unknown document directive \"" + directiveName + "\"");
1898
+ rollbackAnchorTransaction(state);
1899
+ restoreState(state, fallbackState);
1900
+ return false;
1755
1901
  }
1756
- skipSeparationSpace(state, true, -1);
1757
- if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 45 && state.input.charCodeAt(state.position + 1) === 45 && state.input.charCodeAt(state.position + 2) === 45) {
1758
- state.position += 3;
1902
+ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
1903
+ let allowBlockScalars;
1904
+ let allowBlockCollections;
1905
+ let indentStatus = 1;
1906
+ let atNewLine = false;
1907
+ let hasContent = false;
1908
+ let propertyStart = null;
1909
+ let type;
1910
+ let flowIndent;
1911
+ let blockIndent;
1912
+ if (state.depth >= state.maxDepth) throwError(state, "nesting exceeded maxDepth (" + state.maxDepth + ")");
1913
+ state.depth += 1;
1914
+ if (state.listener !== null) state.listener("open", state);
1915
+ state.tag = null;
1916
+ state.anchor = null;
1917
+ state.kind = null;
1918
+ state.result = null;
1919
+ const allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
1920
+ if (allowToSeek) {
1921
+ if (skipSeparationSpace(state, true, -1)) {
1922
+ atNewLine = true;
1923
+ if (state.lineIndent > parentIndent) indentStatus = 1;
1924
+ else if (state.lineIndent === parentIndent) indentStatus = 0;
1925
+ else if (state.lineIndent < parentIndent) indentStatus = -1;
1926
+ }
1927
+ }
1928
+ if (indentStatus === 1) while (true) {
1929
+ const ch = state.input.charCodeAt(state.position);
1930
+ const propertyState = snapshotState(state);
1931
+ if (atNewLine && (ch === 33 && state.tag !== null || ch === 38 && state.anchor !== null)) break;
1932
+ if (!readTagProperty(state) && !readAnchorProperty(state)) break;
1933
+ if (propertyStart === null) propertyStart = propertyState;
1934
+ if (skipSeparationSpace(state, true, -1)) {
1935
+ atNewLine = true;
1936
+ allowBlockCollections = allowBlockStyles;
1937
+ if (state.lineIndent > parentIndent) indentStatus = 1;
1938
+ else if (state.lineIndent === parentIndent) indentStatus = 0;
1939
+ else if (state.lineIndent < parentIndent) indentStatus = -1;
1940
+ } else allowBlockCollections = false;
1941
+ }
1942
+ if (allowBlockCollections) allowBlockCollections = atNewLine || allowCompact;
1943
+ if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
1944
+ if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) flowIndent = parentIndent;
1945
+ else flowIndent = parentIndent + 1;
1946
+ blockIndent = state.position - state.lineStart;
1947
+ if (indentStatus === 1) if (allowBlockCollections && (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent)) || readFlowCollection(state, flowIndent)) hasContent = true;
1948
+ else {
1949
+ const ch = state.input.charCodeAt(state.position);
1950
+ if (propertyStart !== null && allowBlockStyles && !allowBlockCollections && ch !== 124 && ch !== 62 && tryReadBlockMappingFromProperty(state, propertyStart, propertyStart.position - propertyStart.lineStart, flowIndent)) hasContent = true;
1951
+ else if (allowBlockScalars && readBlockScalar(state, flowIndent) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) hasContent = true;
1952
+ else if (readAlias(state)) {
1953
+ hasContent = true;
1954
+ if (state.tag !== null || state.anchor !== null) throwError(state, "alias node should not have any properties");
1955
+ } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
1956
+ hasContent = true;
1957
+ if (state.tag === null) state.tag = "?";
1958
+ }
1959
+ if (state.anchor !== null) storeAnchor(state, state.anchor, state.result);
1960
+ }
1961
+ else if (indentStatus === 0) hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
1962
+ }
1963
+ if (state.tag === null) {
1964
+ if (state.anchor !== null) storeAnchor(state, state.anchor, state.result);
1965
+ } else if (state.tag === "?") {
1966
+ if (state.result !== null && state.kind !== "scalar") throwError(state, "unacceptable node kind for !<?> tag; it should be \"scalar\", not \"" + state.kind + "\"");
1967
+ for (let typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
1968
+ type = state.implicitTypes[typeIndex];
1969
+ if (type.resolve(state.result)) {
1970
+ state.result = type.construct(state.result);
1971
+ state.tag = type.tag;
1972
+ if (state.anchor !== null) storeAnchor(state, state.anchor, state.result);
1973
+ break;
1974
+ }
1975
+ }
1976
+ } else if (state.tag !== "!") {
1977
+ if (_hasOwnProperty.call(state.typeMap[state.kind || "fallback"], state.tag)) type = state.typeMap[state.kind || "fallback"][state.tag];
1978
+ else {
1979
+ type = null;
1980
+ const typeList = state.typeMap.multi[state.kind || "fallback"];
1981
+ for (let typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
1982
+ type = typeList[typeIndex];
1983
+ break;
1984
+ }
1985
+ }
1986
+ if (!type) throwError(state, "unknown tag !<" + state.tag + ">");
1987
+ if (state.result !== null && type.kind !== state.kind) throwError(state, "unacceptable node kind for !<" + state.tag + "> tag; it should be \"" + type.kind + "\", not \"" + state.kind + "\"");
1988
+ if (!type.resolve(state.result, state.tag)) throwError(state, "cannot resolve a node with !<" + state.tag + "> explicit tag");
1989
+ else {
1990
+ state.result = type.construct(state.result, state.tag);
1991
+ if (state.anchor !== null) storeAnchor(state, state.anchor, state.result);
1992
+ }
1993
+ }
1994
+ if (state.listener !== null) state.listener("close", state);
1995
+ state.depth -= 1;
1996
+ return state.tag !== null || state.anchor !== null || hasContent;
1997
+ }
1998
+ function readDocument(state) {
1999
+ const documentStart = state.position;
2000
+ let hasDirectives = false;
2001
+ let ch;
2002
+ state.version = null;
2003
+ state.checkLineBreaks = state.legacy;
2004
+ state.tagMap = Object.create(null);
2005
+ state.anchorMap = Object.create(null);
2006
+ while ((ch = state.input.charCodeAt(state.position)) !== 0) {
2007
+ skipSeparationSpace(state, true, -1);
2008
+ ch = state.input.charCodeAt(state.position);
2009
+ if (state.lineIndent > 0 || ch !== 37) break;
2010
+ hasDirectives = true;
2011
+ ch = state.input.charCodeAt(++state.position);
2012
+ let _position = state.position;
2013
+ while (ch !== 0 && !isWsOrEol(ch)) ch = state.input.charCodeAt(++state.position);
2014
+ const directiveName = state.input.slice(_position, state.position);
2015
+ const directiveArgs = [];
2016
+ if (directiveName.length < 1) throwError(state, "directive name must not be less than one character in length");
2017
+ while (ch !== 0) {
2018
+ while (isWhiteSpace(ch)) ch = state.input.charCodeAt(++state.position);
2019
+ if (ch === 35) {
2020
+ do
2021
+ ch = state.input.charCodeAt(++state.position);
2022
+ while (ch !== 0 && !isEol(ch));
2023
+ break;
2024
+ }
2025
+ if (isEol(ch)) break;
2026
+ _position = state.position;
2027
+ while (ch !== 0 && !isWsOrEol(ch)) ch = state.input.charCodeAt(++state.position);
2028
+ directiveArgs.push(state.input.slice(_position, state.position));
2029
+ }
2030
+ if (ch !== 0) readLineBreak(state);
2031
+ if (_hasOwnProperty.call(directiveHandlers, directiveName)) directiveHandlers[directiveName](state, directiveName, directiveArgs);
2032
+ else throwWarning(state, "unknown document directive \"" + directiveName + "\"");
2033
+ }
1759
2034
  skipSeparationSpace(state, true, -1);
1760
- } else if (hasDirectives) throwError(state, "directives end mark is expected");
1761
- composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
1762
- skipSeparationSpace(state, true, -1);
1763
- 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");
1764
- state.documents.push(state.result);
1765
- if (state.position === state.lineStart && testDocumentSeparator(state)) {
1766
- if (state.input.charCodeAt(state.position) === 46) {
2035
+ if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 45 && state.input.charCodeAt(state.position + 1) === 45 && state.input.charCodeAt(state.position + 2) === 45) {
1767
2036
  state.position += 3;
1768
2037
  skipSeparationSpace(state, true, -1);
2038
+ } else if (hasDirectives) throwError(state, "directives end mark is expected");
2039
+ composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
2040
+ skipSeparationSpace(state, true, -1);
2041
+ 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");
2042
+ state.documents.push(state.result);
2043
+ if (state.position === state.lineStart && testDocumentSeparator(state)) {
2044
+ if (state.input.charCodeAt(state.position) === 46) {
2045
+ state.position += 3;
2046
+ skipSeparationSpace(state, true, -1);
2047
+ }
2048
+ return;
1769
2049
  }
1770
- return;
1771
- }
1772
- if (state.position < state.length - 1) throwError(state, "end of the stream or a document separator is expected");
1773
- else return;
1774
- }
1775
- function loadDocuments(input, options) {
1776
- input = String(input);
1777
- options = options || {};
1778
- if (input.length !== 0) {
1779
- if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) input += "\n";
1780
- if (input.charCodeAt(0) === 65279) input = input.slice(1);
1781
- }
1782
- var state = new State$1(input, options);
1783
- var nullpos = input.indexOf("\0");
1784
- if (nullpos !== -1) {
1785
- state.position = nullpos;
1786
- throwError(state, "null byte is not allowed in input");
1787
- }
1788
- state.input += "\0";
1789
- while (state.input.charCodeAt(state.position) === 32) {
1790
- state.lineIndent += 1;
1791
- state.position += 1;
1792
- }
1793
- while (state.position < state.length - 1) readDocument(state);
1794
- return state.documents;
1795
- }
1796
- function loadAll$1(input, iterator, options) {
1797
- if (iterator !== null && typeof iterator === "object" && typeof options === "undefined") {
1798
- options = iterator;
1799
- iterator = null;
1800
- }
1801
- var documents = loadDocuments(input, options);
1802
- if (typeof iterator !== "function") return documents;
1803
- for (var index = 0, length = documents.length; index < length; index += 1) iterator(documents[index]);
1804
- }
1805
- function load$1(input, options) {
1806
- var documents = loadDocuments(input, options);
1807
- if (documents.length === 0) return;
1808
- else if (documents.length === 1) return documents[0];
1809
- throw new exception("expected a single document in the stream, but found more");
1810
- }
1811
- var loader = {
1812
- loadAll: loadAll$1,
1813
- load: load$1
1814
- };
1815
- var _toString = Object.prototype.toString;
1816
- var _hasOwnProperty = Object.prototype.hasOwnProperty;
1817
- var CHAR_BOM = 65279;
1818
- var CHAR_TAB = 9;
1819
- var CHAR_LINE_FEED = 10;
1820
- var CHAR_CARRIAGE_RETURN = 13;
1821
- var CHAR_SPACE = 32;
1822
- var CHAR_EXCLAMATION = 33;
1823
- var CHAR_DOUBLE_QUOTE = 34;
1824
- var CHAR_SHARP = 35;
1825
- var CHAR_PERCENT = 37;
1826
- var CHAR_AMPERSAND = 38;
1827
- var CHAR_SINGLE_QUOTE = 39;
1828
- var CHAR_ASTERISK = 42;
1829
- var CHAR_COMMA = 44;
1830
- var CHAR_MINUS = 45;
1831
- var CHAR_COLON = 58;
1832
- var CHAR_EQUALS = 61;
1833
- var CHAR_GREATER_THAN = 62;
1834
- var CHAR_QUESTION = 63;
1835
- var CHAR_COMMERCIAL_AT = 64;
1836
- var CHAR_LEFT_SQUARE_BRACKET = 91;
1837
- var CHAR_RIGHT_SQUARE_BRACKET = 93;
1838
- var CHAR_GRAVE_ACCENT = 96;
1839
- var CHAR_LEFT_CURLY_BRACKET = 123;
1840
- var CHAR_VERTICAL_LINE = 124;
1841
- var CHAR_RIGHT_CURLY_BRACKET = 125;
1842
- var ESCAPE_SEQUENCES = {};
1843
- ESCAPE_SEQUENCES[0] = "\\0";
1844
- ESCAPE_SEQUENCES[7] = "\\a";
1845
- ESCAPE_SEQUENCES[8] = "\\b";
1846
- ESCAPE_SEQUENCES[9] = "\\t";
1847
- ESCAPE_SEQUENCES[10] = "\\n";
1848
- ESCAPE_SEQUENCES[11] = "\\v";
1849
- ESCAPE_SEQUENCES[12] = "\\f";
1850
- ESCAPE_SEQUENCES[13] = "\\r";
1851
- ESCAPE_SEQUENCES[27] = "\\e";
1852
- ESCAPE_SEQUENCES[34] = "\\\"";
1853
- ESCAPE_SEQUENCES[92] = "\\\\";
1854
- ESCAPE_SEQUENCES[133] = "\\N";
1855
- ESCAPE_SEQUENCES[160] = "\\_";
1856
- ESCAPE_SEQUENCES[8232] = "\\L";
1857
- ESCAPE_SEQUENCES[8233] = "\\P";
1858
- var DEPRECATED_BOOLEANS_SYNTAX = [
1859
- "y",
1860
- "Y",
1861
- "yes",
1862
- "Yes",
1863
- "YES",
1864
- "on",
1865
- "On",
1866
- "ON",
1867
- "n",
1868
- "N",
1869
- "no",
1870
- "No",
1871
- "NO",
1872
- "off",
1873
- "Off",
1874
- "OFF"
1875
- ];
1876
- var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
1877
- function compileStyleMap(schema, map) {
1878
- var result, keys, index, length, tag, style, type;
1879
- if (map === null) return {};
1880
- result = {};
1881
- keys = Object.keys(map);
1882
- for (index = 0, length = keys.length; index < length; index += 1) {
1883
- tag = keys[index];
1884
- style = String(map[tag]);
1885
- if (tag.slice(0, 2) === "!!") tag = "tag:yaml.org,2002:" + tag.slice(2);
1886
- type = schema.compiledTypeMap["fallback"][tag];
1887
- if (type && _hasOwnProperty.call(type.styleAliases, style)) style = type.styleAliases[style];
1888
- result[tag] = style;
2050
+ if (state.position < state.length - 1) throwError(state, "end of the stream or a document separator is expected");
1889
2051
  }
1890
- return result;
1891
- }
1892
- function encodeHex(character) {
1893
- var string = character.toString(16).toUpperCase(), handle, length;
1894
- if (character <= 255) {
1895
- handle = "x";
1896
- length = 2;
1897
- } else if (character <= 65535) {
1898
- handle = "u";
1899
- length = 4;
1900
- } else if (character <= 4294967295) {
1901
- handle = "U";
1902
- length = 8;
1903
- } else throw new exception("code point within a string may not be greater than 0xFFFFFFFF");
1904
- return "\\" + handle + common.repeat("0", length - string.length) + string;
1905
- }
1906
- var QUOTING_TYPE_SINGLE = 1, QUOTING_TYPE_DOUBLE = 2;
1907
- function State(options) {
1908
- this.schema = options["schema"] || _default;
1909
- this.indent = Math.max(1, options["indent"] || 2);
1910
- this.noArrayIndent = options["noArrayIndent"] || false;
1911
- this.skipInvalid = options["skipInvalid"] || false;
1912
- this.flowLevel = common.isNothing(options["flowLevel"]) ? -1 : options["flowLevel"];
1913
- this.styleMap = compileStyleMap(this.schema, options["styles"] || null);
1914
- this.sortKeys = options["sortKeys"] || false;
1915
- this.lineWidth = options["lineWidth"] || 80;
1916
- this.noRefs = options["noRefs"] || false;
1917
- this.noCompatMode = options["noCompatMode"] || false;
1918
- this.condenseFlow = options["condenseFlow"] || false;
1919
- this.quotingType = options["quotingType"] === "\"" ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE;
1920
- this.forceQuotes = options["forceQuotes"] || false;
1921
- this.replacer = typeof options["replacer"] === "function" ? options["replacer"] : null;
1922
- this.implicitTypes = this.schema.compiledImplicit;
1923
- this.explicitTypes = this.schema.compiledExplicit;
1924
- this.tag = null;
1925
- this.result = "";
1926
- this.duplicates = [];
1927
- this.usedDuplicates = null;
1928
- }
1929
- function indentString(string, spaces) {
1930
- var ind = common.repeat(" ", spaces), position = 0, next = -1, result = "", line, length = string.length;
1931
- while (position < length) {
1932
- next = string.indexOf("\n", position);
1933
- if (next === -1) {
1934
- line = string.slice(position);
1935
- position = length;
1936
- } else {
1937
- line = string.slice(position, next + 1);
1938
- position = next + 1;
2052
+ function loadDocuments(input, options) {
2053
+ input = String(input);
2054
+ options = options || {};
2055
+ if (input.length !== 0) {
2056
+ if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) input += "\n";
2057
+ if (input.charCodeAt(0) === 65279) input = input.slice(1);
2058
+ }
2059
+ const state = new State(input, options);
2060
+ const nullpos = input.indexOf("\0");
2061
+ if (nullpos !== -1) {
2062
+ state.position = nullpos;
2063
+ throwError(state, "null byte is not allowed in input");
2064
+ }
2065
+ state.input += "\0";
2066
+ while (state.input.charCodeAt(state.position) === 32) {
2067
+ state.lineIndent += 1;
2068
+ state.position += 1;
1939
2069
  }
1940
- if (line.length && line !== "\n") result += ind;
1941
- result += line;
2070
+ while (state.position < state.length - 1) readDocument(state);
2071
+ return state.documents;
2072
+ }
2073
+ function loadAll(input, iterator, options) {
2074
+ if (iterator !== null && typeof iterator === "object" && typeof options === "undefined") {
2075
+ options = iterator;
2076
+ iterator = null;
2077
+ }
2078
+ const documents = loadDocuments(input, options);
2079
+ if (typeof iterator !== "function") return documents;
2080
+ for (let index = 0, length = documents.length; index < length; index += 1) iterator(documents[index]);
2081
+ }
2082
+ function load(input, options) {
2083
+ const documents = loadDocuments(input, options);
2084
+ if (documents.length === 0) return;
2085
+ else if (documents.length === 1) return documents[0];
2086
+ throw new YAMLException("expected a single document in the stream, but found more");
2087
+ }
2088
+ module.exports.loadAll = loadAll;
2089
+ module.exports.load = load;
2090
+ }));
2091
+ var require_dumper = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2092
+ var common = require_common();
2093
+ var YAMLException = require_exception();
2094
+ var DEFAULT_SCHEMA = require_default();
2095
+ var _toString = Object.prototype.toString;
2096
+ var _hasOwnProperty = Object.prototype.hasOwnProperty;
2097
+ var CHAR_BOM = 65279;
2098
+ var CHAR_TAB = 9;
2099
+ var CHAR_LINE_FEED = 10;
2100
+ var CHAR_CARRIAGE_RETURN = 13;
2101
+ var CHAR_SPACE = 32;
2102
+ var CHAR_EXCLAMATION = 33;
2103
+ var CHAR_DOUBLE_QUOTE = 34;
2104
+ var CHAR_SHARP = 35;
2105
+ var CHAR_PERCENT = 37;
2106
+ var CHAR_AMPERSAND = 38;
2107
+ var CHAR_SINGLE_QUOTE = 39;
2108
+ var CHAR_ASTERISK = 42;
2109
+ var CHAR_COMMA = 44;
2110
+ var CHAR_MINUS = 45;
2111
+ var CHAR_COLON = 58;
2112
+ var CHAR_EQUALS = 61;
2113
+ var CHAR_GREATER_THAN = 62;
2114
+ var CHAR_QUESTION = 63;
2115
+ var CHAR_COMMERCIAL_AT = 64;
2116
+ var CHAR_LEFT_SQUARE_BRACKET = 91;
2117
+ var CHAR_RIGHT_SQUARE_BRACKET = 93;
2118
+ var CHAR_GRAVE_ACCENT = 96;
2119
+ var CHAR_LEFT_CURLY_BRACKET = 123;
2120
+ var CHAR_VERTICAL_LINE = 124;
2121
+ var CHAR_RIGHT_CURLY_BRACKET = 125;
2122
+ var ESCAPE_SEQUENCES = {};
2123
+ ESCAPE_SEQUENCES[0] = "\\0";
2124
+ ESCAPE_SEQUENCES[7] = "\\a";
2125
+ ESCAPE_SEQUENCES[8] = "\\b";
2126
+ ESCAPE_SEQUENCES[9] = "\\t";
2127
+ ESCAPE_SEQUENCES[10] = "\\n";
2128
+ ESCAPE_SEQUENCES[11] = "\\v";
2129
+ ESCAPE_SEQUENCES[12] = "\\f";
2130
+ ESCAPE_SEQUENCES[13] = "\\r";
2131
+ ESCAPE_SEQUENCES[27] = "\\e";
2132
+ ESCAPE_SEQUENCES[34] = "\\\"";
2133
+ ESCAPE_SEQUENCES[92] = "\\\\";
2134
+ ESCAPE_SEQUENCES[133] = "\\N";
2135
+ ESCAPE_SEQUENCES[160] = "\\_";
2136
+ ESCAPE_SEQUENCES[8232] = "\\L";
2137
+ ESCAPE_SEQUENCES[8233] = "\\P";
2138
+ var DEPRECATED_BOOLEANS_SYNTAX = [
2139
+ "y",
2140
+ "Y",
2141
+ "yes",
2142
+ "Yes",
2143
+ "YES",
2144
+ "on",
2145
+ "On",
2146
+ "ON",
2147
+ "n",
2148
+ "N",
2149
+ "no",
2150
+ "No",
2151
+ "NO",
2152
+ "off",
2153
+ "Off",
2154
+ "OFF"
2155
+ ];
2156
+ var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
2157
+ function compileStyleMap(schema, map) {
2158
+ if (map === null) return {};
2159
+ const result = {};
2160
+ const keys = Object.keys(map);
2161
+ for (let index = 0, length = keys.length; index < length; index += 1) {
2162
+ let tag = keys[index];
2163
+ let style = String(map[tag]);
2164
+ if (tag.slice(0, 2) === "!!") tag = "tag:yaml.org,2002:" + tag.slice(2);
2165
+ const type = schema.compiledTypeMap["fallback"][tag];
2166
+ if (type && _hasOwnProperty.call(type.styleAliases, style)) style = type.styleAliases[style];
2167
+ result[tag] = style;
2168
+ }
2169
+ return result;
1942
2170
  }
1943
- return result;
1944
- }
1945
- function generateNextLine(state, level) {
1946
- return "\n" + common.repeat(" ", state.indent * level);
1947
- }
1948
- function testImplicitResolving(state, str) {
1949
- var index, length, type;
1950
- for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
1951
- type = state.implicitTypes[index];
1952
- if (type.resolve(str)) return true;
2171
+ function encodeHex(character) {
2172
+ let handle;
2173
+ let length;
2174
+ const string = character.toString(16).toUpperCase();
2175
+ if (character <= 255) {
2176
+ handle = "x";
2177
+ length = 2;
2178
+ } else if (character <= 65535) {
2179
+ handle = "u";
2180
+ length = 4;
2181
+ } else if (character <= 4294967295) {
2182
+ handle = "U";
2183
+ length = 8;
2184
+ } else throw new YAMLException("code point within a string may not be greater than 0xFFFFFFFF");
2185
+ return "\\" + handle + common.repeat("0", length - string.length) + string;
2186
+ }
2187
+ var QUOTING_TYPE_SINGLE = 1;
2188
+ var QUOTING_TYPE_DOUBLE = 2;
2189
+ function State(options) {
2190
+ this.schema = options["schema"] || DEFAULT_SCHEMA;
2191
+ this.indent = Math.max(1, options["indent"] || 2);
2192
+ this.noArrayIndent = options["noArrayIndent"] || false;
2193
+ this.skipInvalid = options["skipInvalid"] || false;
2194
+ this.flowLevel = common.isNothing(options["flowLevel"]) ? -1 : options["flowLevel"];
2195
+ this.styleMap = compileStyleMap(this.schema, options["styles"] || null);
2196
+ this.sortKeys = options["sortKeys"] || false;
2197
+ this.lineWidth = options["lineWidth"] || 80;
2198
+ this.noRefs = options["noRefs"] || false;
2199
+ this.noCompatMode = options["noCompatMode"] || false;
2200
+ this.condenseFlow = options["condenseFlow"] || false;
2201
+ this.quotingType = options["quotingType"] === "\"" ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE;
2202
+ this.forceQuotes = options["forceQuotes"] || false;
2203
+ this.replacer = typeof options["replacer"] === "function" ? options["replacer"] : null;
2204
+ this.implicitTypes = this.schema.compiledImplicit;
2205
+ this.explicitTypes = this.schema.compiledExplicit;
2206
+ this.tag = null;
2207
+ this.result = "";
2208
+ this.duplicates = [];
2209
+ this.usedDuplicates = null;
2210
+ }
2211
+ function indentString(string, spaces) {
2212
+ const ind = common.repeat(" ", spaces);
2213
+ let position = 0;
2214
+ let result = "";
2215
+ const length = string.length;
2216
+ while (position < length) {
2217
+ let line;
2218
+ const next = string.indexOf("\n", position);
2219
+ if (next === -1) {
2220
+ line = string.slice(position);
2221
+ position = length;
2222
+ } else {
2223
+ line = string.slice(position, next + 1);
2224
+ position = next + 1;
2225
+ }
2226
+ if (line.length && line !== "\n") result += ind;
2227
+ result += line;
2228
+ }
2229
+ return result;
1953
2230
  }
1954
- return false;
1955
- }
1956
- function isWhitespace(c) {
1957
- return c === CHAR_SPACE || c === CHAR_TAB;
1958
- }
1959
- function isPrintable(c) {
1960
- return 32 <= c && c <= 126 || 161 <= c && c <= 55295 && c !== 8232 && c !== 8233 || 57344 <= c && c <= 65533 && c !== CHAR_BOM || 65536 <= c && c <= 1114111;
1961
- }
1962
- function isNsCharOrWhitespace(c) {
1963
- return isPrintable(c) && c !== CHAR_BOM && c !== CHAR_CARRIAGE_RETURN && c !== CHAR_LINE_FEED;
1964
- }
1965
- function isPlainSafe(c, prev, inblock) {
1966
- var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c);
1967
- var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c);
1968
- return (inblock ? cIsNsCharOrWhitespace : cIsNsCharOrWhitespace && 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 && !(prev === CHAR_COLON && !cIsNsChar) || isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP || prev === CHAR_COLON && cIsNsChar;
1969
- }
1970
- function isPlainSafeFirst(c) {
1971
- return isPrintable(c) && c !== CHAR_BOM && !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;
1972
- }
1973
- function isPlainSafeLast(c) {
1974
- return !isWhitespace(c) && c !== CHAR_COLON;
1975
- }
1976
- function codePointAt(string, pos) {
1977
- var first = string.charCodeAt(pos), second;
1978
- if (first >= 55296 && first <= 56319 && pos + 1 < string.length) {
1979
- second = string.charCodeAt(pos + 1);
1980
- if (second >= 56320 && second <= 57343) return (first - 55296) * 1024 + second - 56320 + 65536;
2231
+ function generateNextLine(state, level) {
2232
+ return "\n" + common.repeat(" ", state.indent * level);
1981
2233
  }
1982
- return first;
1983
- }
1984
- function needIndentIndicator(string) {
1985
- return /^\n* /.test(string);
1986
- }
1987
- var STYLE_PLAIN = 1, STYLE_SINGLE = 2, STYLE_LITERAL = 3, STYLE_FOLDED = 4, STYLE_DOUBLE = 5;
1988
- function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType, quotingType, forceQuotes, inblock) {
1989
- var i;
1990
- var char = 0;
1991
- var prevChar = null;
1992
- var hasLineBreak = false;
1993
- var hasFoldableLine = false;
1994
- var shouldTrackWidth = lineWidth !== -1;
1995
- var previousLineBreak = -1;
1996
- var plain = isPlainSafeFirst(codePointAt(string, 0)) && isPlainSafeLast(codePointAt(string, string.length - 1));
1997
- if (singleLineOnly || forceQuotes) for (i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
1998
- char = codePointAt(string, i);
1999
- if (!isPrintable(char)) return STYLE_DOUBLE;
2000
- plain = plain && isPlainSafe(char, prevChar, inblock);
2001
- prevChar = char;
2234
+ function testImplicitResolving(state, str) {
2235
+ for (let index = 0, length = state.implicitTypes.length; index < length; index += 1) if (state.implicitTypes[index].resolve(str)) return true;
2236
+ return false;
2002
2237
  }
2003
- else {
2004
- for (i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
2238
+ function isWhitespace(c) {
2239
+ return c === CHAR_SPACE || c === CHAR_TAB;
2240
+ }
2241
+ function isPrintable(c) {
2242
+ return c >= 32 && c <= 126 || c >= 161 && c <= 55295 && c !== 8232 && c !== 8233 || c >= 57344 && c <= 65533 && c !== CHAR_BOM || c >= 65536 && c <= 1114111;
2243
+ }
2244
+ function isNsCharOrWhitespace(c) {
2245
+ return isPrintable(c) && c !== CHAR_BOM && c !== CHAR_CARRIAGE_RETURN && c !== CHAR_LINE_FEED;
2246
+ }
2247
+ function isPlainSafe(c, prev, inblock) {
2248
+ const cIsNsCharOrWhitespace = isNsCharOrWhitespace(c);
2249
+ const cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c);
2250
+ return (inblock ? cIsNsCharOrWhitespace : cIsNsCharOrWhitespace && 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 && !(prev === CHAR_COLON && !cIsNsChar) || isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP || prev === CHAR_COLON && cIsNsChar;
2251
+ }
2252
+ function isPlainSafeFirst(c) {
2253
+ return isPrintable(c) && c !== CHAR_BOM && !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;
2254
+ }
2255
+ function isPlainSafeLast(c) {
2256
+ return !isWhitespace(c) && c !== CHAR_COLON;
2257
+ }
2258
+ function codePointAt(string, pos) {
2259
+ const first = string.charCodeAt(pos);
2260
+ let second;
2261
+ if (first >= 55296 && first <= 56319 && pos + 1 < string.length) {
2262
+ second = string.charCodeAt(pos + 1);
2263
+ if (second >= 56320 && second <= 57343) return (first - 55296) * 1024 + second - 56320 + 65536;
2264
+ }
2265
+ return first;
2266
+ }
2267
+ function needIndentIndicator(string) {
2268
+ return /^\n* /.test(string);
2269
+ }
2270
+ var STYLE_PLAIN = 1;
2271
+ var STYLE_SINGLE = 2;
2272
+ var STYLE_LITERAL = 3;
2273
+ var STYLE_FOLDED = 4;
2274
+ var STYLE_DOUBLE = 5;
2275
+ function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType, quotingType, forceQuotes, inblock) {
2276
+ let i;
2277
+ let char = 0;
2278
+ let prevChar = null;
2279
+ let hasLineBreak = false;
2280
+ let hasFoldableLine = false;
2281
+ const shouldTrackWidth = lineWidth !== -1;
2282
+ let previousLineBreak = -1;
2283
+ let plain = isPlainSafeFirst(codePointAt(string, 0)) && isPlainSafeLast(codePointAt(string, string.length - 1));
2284
+ if (singleLineOnly || forceQuotes) for (i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
2005
2285
  char = codePointAt(string, i);
2006
- if (char === CHAR_LINE_FEED) {
2007
- hasLineBreak = true;
2008
- if (shouldTrackWidth) {
2009
- hasFoldableLine = hasFoldableLine || i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ";
2010
- previousLineBreak = i;
2011
- }
2012
- } else if (!isPrintable(char)) return STYLE_DOUBLE;
2286
+ if (!isPrintable(char)) return STYLE_DOUBLE;
2013
2287
  plain = plain && isPlainSafe(char, prevChar, inblock);
2014
2288
  prevChar = char;
2015
2289
  }
2016
- hasFoldableLine = hasFoldableLine || shouldTrackWidth && i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ";
2017
- }
2018
- if (!hasLineBreak && !hasFoldableLine) {
2019
- if (plain && !forceQuotes && !testAmbiguousType(string)) return STYLE_PLAIN;
2290
+ else {
2291
+ for (i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
2292
+ char = codePointAt(string, i);
2293
+ if (char === CHAR_LINE_FEED) {
2294
+ hasLineBreak = true;
2295
+ if (shouldTrackWidth) {
2296
+ hasFoldableLine = hasFoldableLine || i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ";
2297
+ previousLineBreak = i;
2298
+ }
2299
+ } else if (!isPrintable(char)) return STYLE_DOUBLE;
2300
+ plain = plain && isPlainSafe(char, prevChar, inblock);
2301
+ prevChar = char;
2302
+ }
2303
+ hasFoldableLine = hasFoldableLine || shouldTrackWidth && i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ";
2304
+ }
2305
+ if (!hasLineBreak && !hasFoldableLine) {
2306
+ if (plain && !forceQuotes && !testAmbiguousType(string)) return STYLE_PLAIN;
2307
+ return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
2308
+ }
2309
+ if (indentPerLevel > 9 && needIndentIndicator(string)) return STYLE_DOUBLE;
2310
+ if (!forceQuotes) return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
2020
2311
  return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
2021
2312
  }
2022
- if (indentPerLevel > 9 && needIndentIndicator(string)) return STYLE_DOUBLE;
2023
- if (!forceQuotes) return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
2024
- return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
2025
- }
2026
- function writeScalar(state, string, level, iskey, inblock) {
2027
- state.dump = function() {
2028
- if (string.length === 0) return state.quotingType === QUOTING_TYPE_DOUBLE ? "\"\"" : "''";
2029
- if (!state.noCompatMode) {
2030
- if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) return state.quotingType === QUOTING_TYPE_DOUBLE ? "\"" + string + "\"" : "'" + string + "'";
2031
- }
2032
- var indent = state.indent * Math.max(1, level);
2033
- var lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
2034
- var singleLineOnly = iskey || state.flowLevel > -1 && level >= state.flowLevel;
2035
- function testAmbiguity(string) {
2036
- return testImplicitResolving(state, string);
2037
- }
2038
- switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) {
2039
- case STYLE_PLAIN: return string;
2040
- case STYLE_SINGLE: return "'" + string.replace(/'/g, "''") + "'";
2041
- case STYLE_LITERAL: return "|" + blockHeader(string, state.indent) + dropEndingNewline(indentString(string, indent));
2042
- case STYLE_FOLDED: return ">" + blockHeader(string, state.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
2043
- case STYLE_DOUBLE: return "\"" + escapeString(string) + "\"";
2044
- default: throw new exception("impossible error: invalid scalar style");
2045
- }
2046
- }();
2047
- }
2048
- function blockHeader(string, indentPerLevel) {
2049
- var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : "";
2050
- var clip = string[string.length - 1] === "\n";
2051
- return indentIndicator + (clip && (string[string.length - 2] === "\n" || string === "\n") ? "+" : clip ? "" : "-") + "\n";
2052
- }
2053
- function dropEndingNewline(string) {
2054
- return string[string.length - 1] === "\n" ? string.slice(0, -1) : string;
2055
- }
2056
- function foldString(string, width) {
2057
- var lineRe = /(\n+)([^\n]*)/g;
2058
- var result = function() {
2059
- var nextLF = string.indexOf("\n");
2060
- nextLF = nextLF !== -1 ? nextLF : string.length;
2061
- lineRe.lastIndex = nextLF;
2062
- return foldLine(string.slice(0, nextLF), width);
2063
- }();
2064
- var prevMoreIndented = string[0] === "\n" || string[0] === " ";
2065
- var moreIndented;
2066
- var match;
2067
- while (match = lineRe.exec(string)) {
2068
- var prefix = match[1], line = match[2];
2069
- moreIndented = line[0] === " ";
2070
- result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + foldLine(line, width);
2071
- prevMoreIndented = moreIndented;
2313
+ function writeScalar(state, string, level, iskey, inblock) {
2314
+ state.dump = function() {
2315
+ if (string.length === 0) return state.quotingType === QUOTING_TYPE_DOUBLE ? "\"\"" : "''";
2316
+ if (!state.noCompatMode) {
2317
+ if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) return state.quotingType === QUOTING_TYPE_DOUBLE ? "\"" + string + "\"" : "'" + string + "'";
2318
+ }
2319
+ const indent = state.indent * Math.max(1, level);
2320
+ const lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
2321
+ const singleLineOnly = iskey || state.flowLevel > -1 && level >= state.flowLevel;
2322
+ function testAmbiguity(string) {
2323
+ return testImplicitResolving(state, string);
2324
+ }
2325
+ switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) {
2326
+ case STYLE_PLAIN: return string;
2327
+ case STYLE_SINGLE: return "'" + string.replace(/'/g, "''") + "'";
2328
+ case STYLE_LITERAL: return "|" + blockHeader(string, state.indent) + dropEndingNewline(indentString(string, indent));
2329
+ case STYLE_FOLDED: return ">" + blockHeader(string, state.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
2330
+ case STYLE_DOUBLE: return "\"" + escapeString(string, lineWidth) + "\"";
2331
+ default: throw new YAMLException("impossible error: invalid scalar style");
2332
+ }
2333
+ }();
2334
+ }
2335
+ function blockHeader(string, indentPerLevel) {
2336
+ const indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : "";
2337
+ const clip = string[string.length - 1] === "\n";
2338
+ return indentIndicator + (clip && (string[string.length - 2] === "\n" || string === "\n") ? "+" : clip ? "" : "-") + "\n";
2339
+ }
2340
+ function dropEndingNewline(string) {
2341
+ return string[string.length - 1] === "\n" ? string.slice(0, -1) : string;
2342
+ }
2343
+ function foldString(string, width) {
2344
+ const lineRe = /(\n+)([^\n]*)/g;
2345
+ let result = function() {
2346
+ let nextLF = string.indexOf("\n");
2347
+ nextLF = nextLF !== -1 ? nextLF : string.length;
2348
+ lineRe.lastIndex = nextLF;
2349
+ return foldLine(string.slice(0, nextLF), width);
2350
+ }();
2351
+ let prevMoreIndented = string[0] === "\n" || string[0] === " ";
2352
+ let moreIndented;
2353
+ let match;
2354
+ while (match = lineRe.exec(string)) {
2355
+ const prefix = match[1];
2356
+ const line = match[2];
2357
+ moreIndented = line[0] === " ";
2358
+ result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + foldLine(line, width);
2359
+ prevMoreIndented = moreIndented;
2360
+ }
2361
+ return result;
2072
2362
  }
2073
- return result;
2074
- }
2075
- function foldLine(line, width) {
2076
- if (line === "" || line[0] === " ") return line;
2077
- var breakRe = / [^ ]/g;
2078
- var match;
2079
- var start = 0, end, curr = 0, next = 0;
2080
- var result = "";
2081
- while (match = breakRe.exec(line)) {
2082
- next = match.index;
2083
- if (next - start > width) {
2084
- end = curr > start ? curr : next;
2085
- result += "\n" + line.slice(start, end);
2086
- start = end + 1;
2087
- }
2088
- curr = next;
2089
- }
2090
- result += "\n";
2091
- if (line.length - start > width && curr > start) result += line.slice(start, curr) + "\n" + line.slice(curr + 1);
2092
- else result += line.slice(start);
2093
- return result.slice(1);
2094
- }
2095
- function escapeString(string) {
2096
- var result = "";
2097
- var char = 0;
2098
- var escapeSeq;
2099
- for (var i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
2100
- char = codePointAt(string, i);
2101
- escapeSeq = ESCAPE_SEQUENCES[char];
2102
- if (!escapeSeq && isPrintable(char)) {
2103
- result += string[i];
2104
- if (char >= 65536) result += string[i + 1];
2105
- } else result += escapeSeq || encodeHex(char);
2363
+ function foldLine(line, width) {
2364
+ if (line === "" || line[0] === " ") return line;
2365
+ const breakRe = / [^ ]/g;
2366
+ let match;
2367
+ let start = 0;
2368
+ let end;
2369
+ let curr = 0;
2370
+ let next = 0;
2371
+ let result = "";
2372
+ while (match = breakRe.exec(line)) {
2373
+ next = match.index;
2374
+ if (next - start > width) {
2375
+ end = curr > start ? curr : next;
2376
+ result += "\n" + line.slice(start, end);
2377
+ start = end + 1;
2378
+ }
2379
+ curr = next;
2380
+ }
2381
+ result += "\n";
2382
+ if (line.length - start > width && curr > start) result += line.slice(start, curr) + "\n" + line.slice(curr + 1);
2383
+ else result += line.slice(start);
2384
+ return result.slice(1);
2385
+ }
2386
+ function escapeString(string) {
2387
+ let result = "";
2388
+ let char = 0;
2389
+ for (let i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
2390
+ char = codePointAt(string, i);
2391
+ const escapeSeq = ESCAPE_SEQUENCES[char];
2392
+ if (!escapeSeq && isPrintable(char)) {
2393
+ result += string[i];
2394
+ if (char >= 65536) result += string[i + 1];
2395
+ } else result += escapeSeq || encodeHex(char);
2396
+ }
2397
+ return result;
2106
2398
  }
2107
- return result;
2108
- }
2109
- function writeFlowSequence(state, level, object) {
2110
- var _result = "", _tag = state.tag, index, length, value;
2111
- for (index = 0, length = object.length; index < length; index += 1) {
2112
- value = object[index];
2113
- if (state.replacer) value = state.replacer.call(object, String(index), value);
2114
- if (writeNode(state, level, value, false, false) || typeof value === "undefined" && writeNode(state, level, null, false, false)) {
2115
- if (_result !== "") _result += "," + (!state.condenseFlow ? " " : "");
2116
- _result += state.dump;
2117
- }
2118
- }
2119
- state.tag = _tag;
2120
- state.dump = "[" + _result + "]";
2121
- }
2122
- function writeBlockSequence(state, level, object, compact) {
2123
- var _result = "", _tag = state.tag, index, length, value;
2124
- for (index = 0, length = object.length; index < length; index += 1) {
2125
- value = object[index];
2126
- if (state.replacer) value = state.replacer.call(object, String(index), value);
2127
- if (writeNode(state, level + 1, value, true, true, false, true) || typeof value === "undefined" && writeNode(state, level + 1, null, true, true, false, true)) {
2128
- if (!compact || _result !== "") _result += generateNextLine(state, level);
2129
- if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) _result += "-";
2130
- else _result += "- ";
2131
- _result += state.dump;
2132
- }
2133
- }
2134
- state.tag = _tag;
2135
- state.dump = _result || "[]";
2136
- }
2137
- function writeFlowMapping(state, level, object) {
2138
- var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, pairBuffer;
2139
- for (index = 0, length = objectKeyList.length; index < length; index += 1) {
2140
- pairBuffer = "";
2141
- if (_result !== "") pairBuffer += ", ";
2142
- if (state.condenseFlow) pairBuffer += "\"";
2143
- objectKey = objectKeyList[index];
2144
- objectValue = object[objectKey];
2145
- if (state.replacer) objectValue = state.replacer.call(object, objectKey, objectValue);
2146
- if (!writeNode(state, level, objectKey, false, false)) continue;
2147
- if (state.dump.length > 1024) pairBuffer += "? ";
2148
- pairBuffer += state.dump + (state.condenseFlow ? "\"" : "") + ":" + (state.condenseFlow ? "" : " ");
2149
- if (!writeNode(state, level, objectValue, false, false)) continue;
2150
- pairBuffer += state.dump;
2151
- _result += pairBuffer;
2152
- }
2153
- state.tag = _tag;
2154
- state.dump = "{" + _result + "}";
2155
- }
2156
- function writeBlockMapping(state, level, object, compact) {
2157
- var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, explicitPair, pairBuffer;
2158
- if (state.sortKeys === true) objectKeyList.sort();
2159
- else if (typeof state.sortKeys === "function") objectKeyList.sort(state.sortKeys);
2160
- else if (state.sortKeys) throw new exception("sortKeys must be a boolean or a function");
2161
- for (index = 0, length = objectKeyList.length; index < length; index += 1) {
2162
- pairBuffer = "";
2163
- if (!compact || _result !== "") pairBuffer += generateNextLine(state, level);
2164
- objectKey = objectKeyList[index];
2165
- objectValue = object[objectKey];
2166
- if (state.replacer) objectValue = state.replacer.call(object, objectKey, objectValue);
2167
- if (!writeNode(state, level + 1, objectKey, true, true, true)) continue;
2168
- explicitPair = state.tag !== null && state.tag !== "?" || state.dump && state.dump.length > 1024;
2169
- if (explicitPair) if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) pairBuffer += "?";
2170
- else pairBuffer += "? ";
2171
- pairBuffer += state.dump;
2172
- if (explicitPair) pairBuffer += generateNextLine(state, level);
2173
- if (!writeNode(state, level + 1, objectValue, true, explicitPair)) continue;
2174
- if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) pairBuffer += ":";
2175
- else pairBuffer += ": ";
2176
- pairBuffer += state.dump;
2177
- _result += pairBuffer;
2178
- }
2179
- state.tag = _tag;
2180
- state.dump = _result || "{}";
2181
- }
2182
- function detectType(state, object, explicit) {
2183
- var _result, typeList = explicit ? state.explicitTypes : state.implicitTypes, index, length, type, style;
2184
- for (index = 0, length = typeList.length; index < length; index += 1) {
2185
- type = typeList[index];
2186
- if ((type.instanceOf || type.predicate) && (!type.instanceOf || typeof object === "object" && object instanceof type.instanceOf) && (!type.predicate || type.predicate(object))) {
2187
- if (explicit) if (type.multi && type.representName) state.tag = type.representName(object);
2188
- else state.tag = type.tag;
2189
- else state.tag = "?";
2190
- if (type.represent) {
2191
- style = state.styleMap[type.tag] || type.defaultStyle;
2192
- if (_toString.call(type.represent) === "[object Function]") _result = type.represent(object, style);
2193
- else if (_hasOwnProperty.call(type.represent, style)) _result = type.represent[style](object, style);
2194
- else throw new exception("!<" + type.tag + "> tag resolver accepts not \"" + style + "\" style");
2195
- state.dump = _result;
2399
+ function writeFlowSequence(state, level, object) {
2400
+ let _result = "";
2401
+ const _tag = state.tag;
2402
+ for (let index = 0, length = object.length; index < length; index += 1) {
2403
+ let value = object[index];
2404
+ if (state.replacer) value = state.replacer.call(object, String(index), value);
2405
+ if (writeNode(state, level, value, false, false) || typeof value === "undefined" && writeNode(state, level, null, false, false)) {
2406
+ if (_result !== "") _result += "," + (!state.condenseFlow ? " " : "");
2407
+ _result += state.dump;
2196
2408
  }
2197
- return true;
2198
2409
  }
2410
+ state.tag = _tag;
2411
+ state.dump = "[" + _result + "]";
2199
2412
  }
2200
- return false;
2201
- }
2202
- function writeNode(state, level, object, block, compact, iskey, isblockseq) {
2203
- state.tag = null;
2204
- state.dump = object;
2205
- if (!detectType(state, object, false)) detectType(state, object, true);
2206
- var type = _toString.call(state.dump);
2207
- var inblock = block;
2208
- var tagStr;
2209
- if (block) block = state.flowLevel < 0 || state.flowLevel > level;
2210
- var objectOrArray = type === "[object Object]" || type === "[object Array]", duplicateIndex, duplicate;
2211
- if (objectOrArray) {
2212
- duplicateIndex = state.duplicates.indexOf(object);
2213
- duplicate = duplicateIndex !== -1;
2214
- }
2215
- if (state.tag !== null && state.tag !== "?" || duplicate || state.indent !== 2 && level > 0) compact = false;
2216
- if (duplicate && state.usedDuplicates[duplicateIndex]) state.dump = "*ref_" + duplicateIndex;
2217
- else {
2218
- if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) state.usedDuplicates[duplicateIndex] = true;
2219
- if (type === "[object Object]") if (block && Object.keys(state.dump).length !== 0) {
2220
- writeBlockMapping(state, level, state.dump, compact);
2221
- if (duplicate) state.dump = "&ref_" + duplicateIndex + state.dump;
2222
- } else {
2223
- writeFlowMapping(state, level, state.dump);
2224
- if (duplicate) state.dump = "&ref_" + duplicateIndex + " " + state.dump;
2413
+ function writeBlockSequence(state, level, object, compact) {
2414
+ let _result = "";
2415
+ const _tag = state.tag;
2416
+ for (let index = 0, length = object.length; index < length; index += 1) {
2417
+ let value = object[index];
2418
+ if (state.replacer) value = state.replacer.call(object, String(index), value);
2419
+ if (writeNode(state, level + 1, value, true, true, false, true) || typeof value === "undefined" && writeNode(state, level + 1, null, true, true, false, true)) {
2420
+ if (!compact || _result !== "") _result += generateNextLine(state, level);
2421
+ if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) _result += "-";
2422
+ else _result += "- ";
2423
+ _result += state.dump;
2424
+ }
2225
2425
  }
2226
- else if (type === "[object Array]") if (block && state.dump.length !== 0) {
2227
- if (state.noArrayIndent && !isblockseq && level > 0) writeBlockSequence(state, level - 1, state.dump, compact);
2228
- else writeBlockSequence(state, level, state.dump, compact);
2229
- if (duplicate) state.dump = "&ref_" + duplicateIndex + state.dump;
2230
- } else {
2231
- writeFlowSequence(state, level, state.dump);
2232
- if (duplicate) state.dump = "&ref_" + duplicateIndex + " " + state.dump;
2426
+ state.tag = _tag;
2427
+ state.dump = _result || "[]";
2428
+ }
2429
+ function writeFlowMapping(state, level, object) {
2430
+ let _result = "";
2431
+ const _tag = state.tag;
2432
+ const objectKeyList = Object.keys(object);
2433
+ for (let index = 0, length = objectKeyList.length; index < length; index += 1) {
2434
+ let pairBuffer = "";
2435
+ if (_result !== "") pairBuffer += ", ";
2436
+ if (state.condenseFlow) pairBuffer += "\"";
2437
+ const objectKey = objectKeyList[index];
2438
+ let objectValue = object[objectKey];
2439
+ if (state.replacer) objectValue = state.replacer.call(object, objectKey, objectValue);
2440
+ if (!writeNode(state, level, objectKey, false, false)) continue;
2441
+ if (state.dump.length > 1024) pairBuffer += "? ";
2442
+ pairBuffer += state.dump + (state.condenseFlow ? "\"" : "") + ":" + (state.condenseFlow ? "" : " ");
2443
+ if (!writeNode(state, level, objectValue, false, false)) continue;
2444
+ pairBuffer += state.dump;
2445
+ _result += pairBuffer;
2233
2446
  }
2234
- else if (type === "[object String]") {
2235
- if (state.tag !== "?") writeScalar(state, state.dump, level, iskey, inblock);
2236
- } else if (type === "[object Undefined]") return false;
2237
- else {
2238
- if (state.skipInvalid) return false;
2239
- throw new exception("unacceptable kind of an object to dump " + type);
2447
+ state.tag = _tag;
2448
+ state.dump = "{" + _result + "}";
2449
+ }
2450
+ function writeBlockMapping(state, level, object, compact) {
2451
+ let _result = "";
2452
+ const _tag = state.tag;
2453
+ const objectKeyList = Object.keys(object);
2454
+ if (state.sortKeys === true) objectKeyList.sort();
2455
+ else if (typeof state.sortKeys === "function") objectKeyList.sort(state.sortKeys);
2456
+ else if (state.sortKeys) throw new YAMLException("sortKeys must be a boolean or a function");
2457
+ for (let index = 0, length = objectKeyList.length; index < length; index += 1) {
2458
+ let pairBuffer = "";
2459
+ if (!compact || _result !== "") pairBuffer += generateNextLine(state, level);
2460
+ const objectKey = objectKeyList[index];
2461
+ let objectValue = object[objectKey];
2462
+ if (state.replacer) objectValue = state.replacer.call(object, objectKey, objectValue);
2463
+ if (!writeNode(state, level + 1, objectKey, true, true, true)) continue;
2464
+ const explicitPair = state.tag !== null && state.tag !== "?" || state.dump && state.dump.length > 1024;
2465
+ if (explicitPair) if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) pairBuffer += "?";
2466
+ else pairBuffer += "? ";
2467
+ pairBuffer += state.dump;
2468
+ if (explicitPair) pairBuffer += generateNextLine(state, level);
2469
+ if (!writeNode(state, level + 1, objectValue, true, explicitPair)) continue;
2470
+ if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) pairBuffer += ":";
2471
+ else pairBuffer += ": ";
2472
+ pairBuffer += state.dump;
2473
+ _result += pairBuffer;
2240
2474
  }
2241
- if (state.tag !== null && state.tag !== "?") {
2242
- tagStr = encodeURI(state.tag[0] === "!" ? state.tag.slice(1) : state.tag).replace(/!/g, "%21");
2243
- if (state.tag[0] === "!") tagStr = "!" + tagStr;
2244
- else if (tagStr.slice(0, 18) === "tag:yaml.org,2002:") tagStr = "!!" + tagStr.slice(18);
2245
- else tagStr = "!<" + tagStr + ">";
2246
- state.dump = tagStr + " " + state.dump;
2475
+ state.tag = _tag;
2476
+ state.dump = _result || "{}";
2477
+ }
2478
+ function detectType(state, object, explicit) {
2479
+ const typeList = explicit ? state.explicitTypes : state.implicitTypes;
2480
+ for (let index = 0, length = typeList.length; index < length; index += 1) {
2481
+ const type = typeList[index];
2482
+ if ((type.instanceOf || type.predicate) && (!type.instanceOf || typeof object === "object" && object instanceof type.instanceOf) && (!type.predicate || type.predicate(object))) {
2483
+ if (explicit) if (type.multi && type.representName) state.tag = type.representName(object);
2484
+ else state.tag = type.tag;
2485
+ else state.tag = "?";
2486
+ if (type.represent) {
2487
+ const style = state.styleMap[type.tag] || type.defaultStyle;
2488
+ let _result;
2489
+ if (_toString.call(type.represent) === "[object Function]") _result = type.represent(object, style);
2490
+ else if (_hasOwnProperty.call(type.represent, style)) _result = type.represent[style](object, style);
2491
+ else throw new YAMLException("!<" + type.tag + "> tag resolver accepts not \"" + style + "\" style");
2492
+ state.dump = _result;
2493
+ }
2494
+ return true;
2495
+ }
2247
2496
  }
2497
+ return false;
2248
2498
  }
2249
- return true;
2250
- }
2251
- function getDuplicateReferences(object, state) {
2252
- var objects = [], duplicatesIndexes = [], index, length;
2253
- inspectNode(object, objects, duplicatesIndexes);
2254
- for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) state.duplicates.push(objects[duplicatesIndexes[index]]);
2255
- state.usedDuplicates = new Array(length);
2256
- }
2257
- function inspectNode(object, objects, duplicatesIndexes) {
2258
- var objectKeyList, index, length;
2259
- if (object !== null && typeof object === "object") {
2260
- index = objects.indexOf(object);
2261
- if (index !== -1) {
2262
- if (duplicatesIndexes.indexOf(index) === -1) duplicatesIndexes.push(index);
2263
- } else {
2264
- objects.push(object);
2265
- if (Array.isArray(object)) for (index = 0, length = object.length; index < length; index += 1) inspectNode(object[index], objects, duplicatesIndexes);
2499
+ function writeNode(state, level, object, block, compact, iskey, isblockseq) {
2500
+ state.tag = null;
2501
+ state.dump = object;
2502
+ if (!detectType(state, object, false)) detectType(state, object, true);
2503
+ const type = _toString.call(state.dump);
2504
+ const inblock = block;
2505
+ if (block) block = state.flowLevel < 0 || state.flowLevel > level;
2506
+ const objectOrArray = type === "[object Object]" || type === "[object Array]";
2507
+ let duplicateIndex;
2508
+ let duplicate;
2509
+ if (objectOrArray) {
2510
+ duplicateIndex = state.duplicates.indexOf(object);
2511
+ duplicate = duplicateIndex !== -1;
2512
+ }
2513
+ if (state.tag !== null && state.tag !== "?" || duplicate || state.indent !== 2 && level > 0) compact = false;
2514
+ if (duplicate && state.usedDuplicates[duplicateIndex]) state.dump = "*ref_" + duplicateIndex;
2515
+ else {
2516
+ if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) state.usedDuplicates[duplicateIndex] = true;
2517
+ if (type === "[object Object]") if (block && Object.keys(state.dump).length !== 0) {
2518
+ writeBlockMapping(state, level, state.dump, compact);
2519
+ if (duplicate) state.dump = "&ref_" + duplicateIndex + state.dump;
2520
+ } else {
2521
+ writeFlowMapping(state, level, state.dump);
2522
+ if (duplicate) state.dump = "&ref_" + duplicateIndex + " " + state.dump;
2523
+ }
2524
+ else if (type === "[object Array]") if (block && state.dump.length !== 0) {
2525
+ if (state.noArrayIndent && !isblockseq && level > 0) writeBlockSequence(state, level - 1, state.dump, compact);
2526
+ else writeBlockSequence(state, level, state.dump, compact);
2527
+ if (duplicate) state.dump = "&ref_" + duplicateIndex + state.dump;
2528
+ } else {
2529
+ writeFlowSequence(state, level, state.dump);
2530
+ if (duplicate) state.dump = "&ref_" + duplicateIndex + " " + state.dump;
2531
+ }
2532
+ else if (type === "[object String]") {
2533
+ if (state.tag !== "?") writeScalar(state, state.dump, level, iskey, inblock);
2534
+ } else if (type === "[object Undefined]") return false;
2266
2535
  else {
2267
- objectKeyList = Object.keys(object);
2268
- for (index = 0, length = objectKeyList.length; index < length; index += 1) inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
2536
+ if (state.skipInvalid) return false;
2537
+ throw new YAMLException("unacceptable kind of an object to dump " + type);
2538
+ }
2539
+ if (state.tag !== null && state.tag !== "?") {
2540
+ let tagStr = encodeURI(state.tag[0] === "!" ? state.tag.slice(1) : state.tag).replace(/!/g, "%21");
2541
+ if (state.tag[0] === "!") tagStr = "!" + tagStr;
2542
+ else if (tagStr.slice(0, 18) === "tag:yaml.org,2002:") tagStr = "!!" + tagStr.slice(18);
2543
+ else tagStr = "!<" + tagStr + ">";
2544
+ state.dump = tagStr + " " + state.dump;
2269
2545
  }
2270
2546
  }
2547
+ return true;
2271
2548
  }
2272
- }
2273
- function dump$1(input, options) {
2274
- options = options || {};
2275
- var state = new State(options);
2276
- if (!state.noRefs) getDuplicateReferences(input, state);
2277
- var value = input;
2278
- if (state.replacer) value = state.replacer.call({ "": value }, "", value);
2279
- if (writeNode(state, 0, value, true, true)) return state.dump + "\n";
2280
- return "";
2281
- }
2282
- var dumper = { dump: dump$1 };
2283
- var load = loader.load;
2284
- loader.loadAll;
2285
- dumper.dump;
2549
+ function getDuplicateReferences(object, state) {
2550
+ const objects = [];
2551
+ const duplicatesIndexes = [];
2552
+ inspectNode(object, objects, duplicatesIndexes);
2553
+ const length = duplicatesIndexes.length;
2554
+ for (let index = 0; index < length; index += 1) state.duplicates.push(objects[duplicatesIndexes[index]]);
2555
+ state.usedDuplicates = new Array(length);
2556
+ }
2557
+ function inspectNode(object, objects, duplicatesIndexes) {
2558
+ if (object !== null && typeof object === "object") {
2559
+ const index = objects.indexOf(object);
2560
+ if (index !== -1) {
2561
+ if (duplicatesIndexes.indexOf(index) === -1) duplicatesIndexes.push(index);
2562
+ } else {
2563
+ objects.push(object);
2564
+ if (Array.isArray(object)) for (let i = 0, length = object.length; i < length; i += 1) inspectNode(object[i], objects, duplicatesIndexes);
2565
+ else {
2566
+ const objectKeyList = Object.keys(object);
2567
+ for (let i = 0, length = objectKeyList.length; i < length; i += 1) inspectNode(object[objectKeyList[i]], objects, duplicatesIndexes);
2568
+ }
2569
+ }
2570
+ }
2571
+ }
2572
+ function dump(input, options) {
2573
+ options = options || {};
2574
+ const state = new State(options);
2575
+ if (!state.noRefs) getDuplicateReferences(input, state);
2576
+ let value = input;
2577
+ if (state.replacer) value = state.replacer.call({ "": value }, "", value);
2578
+ if (writeNode(state, 0, value, true, true)) return state.dump + "\n";
2579
+ return "";
2580
+ }
2581
+ module.exports.dump = dump;
2582
+ }));
2583
+ var import_js_yaml = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
2584
+ var loader = require_loader();
2585
+ var dumper = require_dumper();
2586
+ function renamed(from, to) {
2587
+ return function() {
2588
+ throw new Error("Function yaml." + from + " is removed in js-yaml 4. Use yaml." + to + " instead, which is now safe by default.");
2589
+ };
2590
+ }
2591
+ module.exports.Type = require_type();
2592
+ module.exports.Schema = require_schema();
2593
+ module.exports.FAILSAFE_SCHEMA = require_failsafe();
2594
+ module.exports.JSON_SCHEMA = require_json();
2595
+ module.exports.CORE_SCHEMA = require_core();
2596
+ module.exports.DEFAULT_SCHEMA = require_default();
2597
+ module.exports.load = loader.load;
2598
+ module.exports.loadAll = loader.loadAll;
2599
+ module.exports.dump = dumper.dump;
2600
+ module.exports.YAMLException = require_exception();
2601
+ module.exports.types = {
2602
+ binary: require_binary(),
2603
+ float: require_float(),
2604
+ map: require_map(),
2605
+ null: require_null(),
2606
+ pairs: require_pairs(),
2607
+ set: require_set(),
2608
+ timestamp: require_timestamp(),
2609
+ bool: require_bool(),
2610
+ int: require_int(),
2611
+ merge: require_merge(),
2612
+ omap: require_omap(),
2613
+ seq: require_seq(),
2614
+ str: require_str()
2615
+ };
2616
+ module.exports.safeLoad = renamed("safeLoad", "load");
2617
+ module.exports.safeLoadAll = renamed("safeLoadAll", "loadAll");
2618
+ module.exports.safeDump = renamed("safeDump", "dump");
2619
+ })))(), 1);
2620
+ var { Type, Schema, FAILSAFE_SCHEMA, JSON_SCHEMA, CORE_SCHEMA, DEFAULT_SCHEMA, load, loadAll, dump, YAMLException, types, safeLoad, safeLoadAll, safeDump } = import_js_yaml.default;
2621
+ import_js_yaml.default;
2286
2622
  //#endregion
2287
2623
  //#region src/shared/model-utils.ts
2288
2624
  /**
@@ -5588,6 +5924,12 @@ function generateResourceClass(service, ctx) {
5588
5924
  lines.push("import { AutoPaginatable } from '../common/utils/pagination';");
5589
5925
  lines.push("import { fetchAndDeserialize } from '../common/utils/fetch-and-deserialize';");
5590
5926
  }
5927
+ if (plans.some((p) => {
5928
+ const r = lookupResolved(p.op, resolvedLookup);
5929
+ if (!r?.urlBuilder) return false;
5930
+ const hidden = hiddenParamsFor(r);
5931
+ return p.op.queryParams.some((qp) => !hidden.has(qp.name)) || Object.keys(getOpDefaults(r)).length > 0 || getOpInferFromClient(r).length > 0;
5932
+ })) lines.push("import { toQueryString } from '../common/utils/query-string';");
5591
5933
  const shouldEmitVaultCryptoHelpers = serviceClass === "Vault" && !ignoredMethodNames.has("encrypt") && !ignoredMethodNames.has("decrypt");
5592
5934
  if (shouldEmitVaultCryptoHelpers) lines.push("import { base64ToUint8Array, uint8ArrayToBase64 } from '../common/utils/base64';");
5593
5935
  const hasIdempotentPost = plans.some((p) => p.plan.isIdempotentPost);
@@ -5844,6 +6186,10 @@ function renderMethod$2(op, plan, method, service, ctx, modelMap, specEnumNames,
5844
6186
  const httpKey = `${op.httpMethod.toUpperCase()} ${op.path}`;
5845
6187
  const baselineClassMethod = baselineMethodFor$1(service, method, ctx);
5846
6188
  const optionInfo = optionsObjectInfo(service, method, op, plan, ctx, baselineClassMethod, resolvedOp);
6189
+ if (resolvedOp?.urlBuilder) {
6190
+ renderUrlBuilderMethod$1(lines, op, method, pathStr, optionInfo, specEnumNames, resolvedOp);
6191
+ return lines;
6192
+ }
5847
6193
  const overlayMethod = ctx.overlayLookup?.methodByOperation?.get(httpKey) ?? baselineClassMethod;
5848
6194
  let validParamNames = null;
5849
6195
  if (optionInfo) validParamNames = new Set(["options"]);
@@ -6359,6 +6705,66 @@ function clientFieldExpression$8(field) {
6359
6705
  default: return `this.workos.${toCamelCase(field)}`;
6360
6706
  }
6361
6707
  }
6708
+ /**
6709
+ * Compose a `` `${this.workos.baseURL}<path>[?${query}]` `` template literal from
6710
+ * a path expression produced by {@link buildPathStr}. The path expression is
6711
+ * either a single-quoted static literal (`'/sso/authorize'`) or a backtick
6712
+ * template with interpolated path params; either way its inner body is spliced
6713
+ * into the URL template.
6714
+ */
6715
+ function urlTemplateLiteral(pathExpr, hasQuery) {
6716
+ let inner;
6717
+ if (pathExpr.startsWith("`") && pathExpr.endsWith("`") || pathExpr.startsWith("'") && pathExpr.endsWith("'")) inner = pathExpr.slice(1, -1);
6718
+ else inner = "${" + pathExpr + "}";
6719
+ return "`${this.workos.baseURL}" + inner + (hasQuery ? "?${query}" : "") + "`";
6720
+ }
6721
+ /**
6722
+ * Emit a URL-builder method for an operation marked with the `urlBuilder` hint
6723
+ * (OAuth-style redirect endpoints such as `/sso/authorize`). The method is
6724
+ * synchronous, returns the constructed URL as a string, and makes no HTTP call.
6725
+ * Visible query params, constant `defaults`, and `inferFromClient` fields are
6726
+ * serialized via `toQueryString` (wire-name keyed), matching the SDK's
6727
+ * hand-written URL builders.
6728
+ */
6729
+ function renderUrlBuilderMethod$1(lines, op, method, pathStr, optionInfo, specEnumNames, resolvedOp) {
6730
+ const hidden = hiddenParamsFor(resolvedOp);
6731
+ const visibleQueryParams = op.queryParams.filter((p) => !hidden.has(p.name));
6732
+ const hasQuery = visibleQueryParams.length > 0 || Object.keys(getOpDefaults(resolvedOp)).length > 0 || getOpInferFromClient(resolvedOp).length > 0;
6733
+ {
6734
+ const docParts = [];
6735
+ if (op.description) docParts.push(op.description);
6736
+ docParts.push("@returns {string} The constructed URL.");
6737
+ if (op.deprecated) docParts.push("@deprecated");
6738
+ const allLines = docParts.flatMap((p) => p.split("\n"));
6739
+ if (allLines.length === 1) lines.push(` /** ${allLines[0]} */`);
6740
+ else {
6741
+ lines.push(" /**");
6742
+ for (const line of allLines) lines.push(line === "" ? " *" : ` * ${line}`);
6743
+ lines.push(" */");
6744
+ }
6745
+ }
6746
+ if (optionInfo) {
6747
+ lines.push(` ${method}(${renderOptionsParam(optionInfo)}): string {`);
6748
+ if (hasQuery) {
6749
+ const queryExpr = renderQueryExprWithOptions(visibleQueryParams, optionInfo.optional, resolvedOp);
6750
+ lines.push(` const query = toQueryString(${queryExpr});`);
6751
+ lines.push(` return ${urlTemplateLiteral(pathStr, true)};`);
6752
+ } else lines.push(` return ${urlTemplateLiteral(pathStr, false)};`);
6753
+ lines.push(" }");
6754
+ return;
6755
+ }
6756
+ if (visibleQueryParams.length > 0) throw new Error(`renderUrlBuilderMethod: positional url builder "${method}" has visible query params (${visibleQueryParams.map((p) => p.name).join(", ")}) but no options object; they would be referenced without being declared. Expected the options-object convention.`);
6757
+ const params = buildPathParams(op, specEnumNames);
6758
+ lines.push(` ${method}(${params}): string {`);
6759
+ if (hasQuery) {
6760
+ const queryParts = [];
6761
+ for (const [key, value] of Object.entries(getOpDefaults(resolvedOp))) queryParts.push(`${key}: ${tsLiteral(value)}`);
6762
+ for (const field of getOpInferFromClient(resolvedOp)) queryParts.push(`${field}: ${clientFieldExpression$8(field)}`);
6763
+ lines.push(` const query = toQueryString({ ${queryParts.join(", ")} });`);
6764
+ lines.push(` return ${urlTemplateLiteral(pathStr, true)};`);
6765
+ } else lines.push(` return ${urlTemplateLiteral(pathStr, false)};`);
6766
+ lines.push(" }");
6767
+ }
6362
6768
  function renderVoidMethod(lines, op, plan, method, pathStr, ctx, specEnumNames, resolvedOp) {
6363
6769
  const hiddenParams = new Set([...Object.keys(getOpDefaults(resolvedOp)), ...getOpInferFromClient(resolvedOp)]);
6364
6770
  const params = buildPathParams(op, specEnumNames);
@@ -8789,6 +9195,182 @@ function generateSerializerTests(spec, ctx) {
8789
9195
  return files;
8790
9196
  }
8791
9197
  //#endregion
9198
+ //#region src/shared/union-flatten.ts
9199
+ /**
9200
+ * Flatten field-level discriminated unions into a single superset model for
9201
+ * the flat-emit languages (Go, Kotlin, Node) that have no native sum type.
9202
+ *
9203
+ * Background: a property like `ApiKey.owner` is a discriminated `oneOf` whose
9204
+ * variants are inline objects — `{ type: 'organization', id }` and
9205
+ * `{ type: 'user', id, organization_id }`. The IR represents this as a `union`
9206
+ * TypeRef referencing two variant models (`ApiKeyOwner`, `UserApiKeyOwner`).
9207
+ * Languages that render such a union as "the first variant" — Go's
9208
+ * `unionResolverName`, Kotlin's `baseName` — silently drop every field that
9209
+ * only exists on a later variant, so `organization_id` disappears for
9210
+ * user-scoped keys. (See the SDK compat report's owner-field note.)
9211
+ *
9212
+ * This transform, applied only by the flat-emit emitters, merges every
9213
+ * variant's fields into the first variant (the union's canonical model),
9214
+ * marks any field not shared by all variants optional, widens the
9215
+ * discriminator property to the union of its per-variant literal values, and
9216
+ * rewrites the field to a plain model ref to that canonical model. The result
9217
+ * is one flat struct/data class/interface that carries every variant field,
9218
+ * with the discriminator property telling callers which variant they hold —
9219
+ * exactly how these emitters already flatten `allOf [base, oneOf]`
9220
+ * discriminated bases (see `enrichModelsFromSpec`).
9221
+ *
9222
+ * Returns a new models array; the input models are not mutated. Union-emitting
9223
+ * languages (Python, PHP, Rust, Ruby, .NET) must NOT call this — they emit a
9224
+ * real discriminated union and lose nothing.
9225
+ */
9226
+ function flattenDiscriminatedUnionFields(models) {
9227
+ const byName = new Map(models.map((m) => [m.name, m]));
9228
+ const mergedFieldsByCanonical = /* @__PURE__ */ new Map();
9229
+ /**
9230
+ * Decide whether a union is a flat-flattenable discriminated union of inline
9231
+ * object variants. When it is, record the merged field set for its canonical
9232
+ * model and return that model's name; otherwise return null.
9233
+ */
9234
+ function planUnion(union) {
9235
+ if (!union.discriminator) return null;
9236
+ const variantNames = union.variants.map((v) => v.kind === "model" ? v.name : null);
9237
+ if (variantNames.length < 2 || variantNames.some((n) => n === null)) return null;
9238
+ const variantModels = variantNames.map((n) => byName.get(n));
9239
+ if (variantModels.some((m) => !m || m.discriminator || m.fields.length === 0)) return null;
9240
+ const canonical = variantNames[0];
9241
+ const merged = mergeVariantFields(variantModels, union.discriminator.property);
9242
+ const existing = mergedFieldsByCanonical.get(canonical);
9243
+ if (existing && fieldListSignature(existing) !== fieldListSignature(merged)) throw new Error(`flattenDiscriminatedUnionFields: model "${canonical}" is the first variant of two distinct discriminated unions that merge to different field sets. Flattening both onto one model would silently drop fields; disambiguate the variants in the spec (rename the leading variant of one union).`);
9244
+ mergedFieldsByCanonical.set(canonical, merged);
9245
+ return canonical;
9246
+ }
9247
+ /** Rewrite a TypeRef, collapsing flattenable unions to a canonical model ref. */
9248
+ function rewriteRef(ref) {
9249
+ switch (ref.kind) {
9250
+ case "union": {
9251
+ const canonical = planUnion(ref);
9252
+ return canonical ? {
9253
+ kind: "model",
9254
+ name: canonical
9255
+ } : ref;
9256
+ }
9257
+ case "nullable": {
9258
+ const inner = rewriteRef(ref.inner);
9259
+ return inner === ref.inner ? ref : {
9260
+ kind: "nullable",
9261
+ inner
9262
+ };
9263
+ }
9264
+ case "array": {
9265
+ const items = rewriteRef(ref.items);
9266
+ return items === ref.items ? ref : {
9267
+ kind: "array",
9268
+ items
9269
+ };
9270
+ }
9271
+ default: return ref;
9272
+ }
9273
+ }
9274
+ const rewritten = models.map((model) => {
9275
+ let changed = false;
9276
+ const fields = model.fields.map((field) => {
9277
+ const type = rewriteRef(field.type);
9278
+ if (type === field.type) return field;
9279
+ changed = true;
9280
+ return {
9281
+ ...field,
9282
+ type
9283
+ };
9284
+ });
9285
+ return changed ? {
9286
+ ...model,
9287
+ fields
9288
+ } : model;
9289
+ });
9290
+ if (mergedFieldsByCanonical.size === 0) return models;
9291
+ return rewritten.map((model) => {
9292
+ const merged = mergedFieldsByCanonical.get(model.name);
9293
+ return merged ? {
9294
+ ...model,
9295
+ fields: merged
9296
+ } : model;
9297
+ });
9298
+ }
9299
+ /**
9300
+ * Build the merged field list for a discriminated union's variant models.
9301
+ *
9302
+ * - A field is required only when present-and-required in *every* variant; a
9303
+ * field missing from some variant (e.g. the user variant's `organization_id`)
9304
+ * becomes optional.
9305
+ * - The discriminator property is widened to the union of its per-variant
9306
+ * literal values (`'organization' | 'user'`) so it isn't pinned to the first
9307
+ * variant's constant. (Flat-emit type maps collapse a single-typed literal
9308
+ * union to a plain string, so this is a no-op for Go/Kotlin and a precise
9309
+ * `'organization' | 'user'` for Node.)
9310
+ * - Field order follows the first variant, then newly-seen fields from later
9311
+ * variants.
9312
+ */
9313
+ function mergeVariantFields(variants, discriminatorProp) {
9314
+ const total = variants.length;
9315
+ const order = [];
9316
+ const defByName = /* @__PURE__ */ new Map();
9317
+ const presence = /* @__PURE__ */ new Map();
9318
+ const requiredCount = /* @__PURE__ */ new Map();
9319
+ for (const variant of variants) for (const field of variant.fields) {
9320
+ const seen = defByName.get(field.name);
9321
+ if (!seen) {
9322
+ defByName.set(field.name, field);
9323
+ order.push(field.name);
9324
+ } else if (field.name !== discriminatorProp && !sameTypeRef(seen.type, field.type)) throw new Error(`flattenDiscriminatedUnionFields: field "${field.name}" has conflicting types across variants of a discriminated union; a flat superset model cannot represent both. Align the field type across variants in the spec.`);
9325
+ presence.set(field.name, (presence.get(field.name) ?? 0) + 1);
9326
+ if (field.required) requiredCount.set(field.name, (requiredCount.get(field.name) ?? 0) + 1);
9327
+ }
9328
+ return order.map((name) => {
9329
+ const def = defByName.get(name);
9330
+ if (name === discriminatorProp) {
9331
+ const literals = dedupeLiteralTypes(variants.map((v) => v.fields.find((f) => f.name === name)?.type).filter((t) => t != null));
9332
+ const type = literals.length > 1 ? {
9333
+ kind: "union",
9334
+ variants: literals
9335
+ } : literals[0] ?? def.type;
9336
+ return {
9337
+ ...def,
9338
+ type,
9339
+ required: presence.get(name) === total
9340
+ };
9341
+ }
9342
+ const required = presence.get(name) === total && requiredCount.get(name) === total;
9343
+ return required === def.required ? def : {
9344
+ ...def,
9345
+ required
9346
+ };
9347
+ });
9348
+ }
9349
+ /** Structural equality of two TypeRefs (IR refs have a stable, deterministic shape). */
9350
+ function sameTypeRef(a, b) {
9351
+ return JSON.stringify(a) === JSON.stringify(b);
9352
+ }
9353
+ /** Stable signature of a merged field list, used to detect canonical collisions. */
9354
+ function fieldListSignature(fields) {
9355
+ return JSON.stringify(fields.map((f) => [
9356
+ f.name,
9357
+ f.required,
9358
+ f.type
9359
+ ]));
9360
+ }
9361
+ /** Deduplicate literal TypeRefs by value, preserving first-seen order. */
9362
+ function dedupeLiteralTypes(types) {
9363
+ const seen = /* @__PURE__ */ new Set();
9364
+ const out = [];
9365
+ for (const t of types) {
9366
+ const key = t.kind === "literal" ? `lit:${String(t.value)}` : JSON.stringify(t);
9367
+ if (seen.has(key)) continue;
9368
+ seen.add(key);
9369
+ out.push(t);
9370
+ }
9371
+ return out;
9372
+ }
9373
+ //#endregion
8792
9374
  //#region src/node/discriminated-models.ts
8793
9375
  function detectDiscriminatedShape(modelName, rawSchemas) {
8794
9376
  const schema = rawSchemas[modelName];
@@ -9815,7 +10397,7 @@ function carryForwardManagedFiles(ctx, surface) {
9815
10397
  function enrichModelsForNode(models) {
9816
10398
  const enriched = enrichModelsFromSpec(models);
9817
10399
  const originalByName = new Map(models.map((m) => [m.name, m]));
9818
- return enriched.map((m) => {
10400
+ return flattenDiscriminatedUnionFields(enriched.map((m) => {
9819
10401
  if (m.discriminator && m.fields.length === 0) {
9820
10402
  const original = originalByName.get(m.name);
9821
10403
  if (original && original.fields.length > 0) return {
@@ -9824,7 +10406,7 @@ function enrichModelsForNode(models) {
9824
10406
  };
9825
10407
  }
9826
10408
  return m;
9827
- });
10409
+ }));
9828
10410
  }
9829
10411
  const nodeEmitter = {
9830
10412
  language: "node",
@@ -18635,7 +19217,7 @@ const goEmitter = {
18635
19217
  generateModels(models, ctx) {
18636
19218
  const enriched = enrichModelsFromSpec(models);
18637
19219
  const originalByName = new Map(models.map((m) => [m.name, m]));
18638
- return ensureTrailingNewlines$4(generateModels$4(enriched.map((m) => {
19220
+ return ensureTrailingNewlines$4(generateModels$4(flattenDiscriminatedUnionFields(enriched.map((m) => {
18639
19221
  if (m.discriminator && m.fields.length === 0) {
18640
19222
  const original = originalByName.get(m.name);
18641
19223
  if (original && original.fields.length > 0) return {
@@ -18644,7 +19226,7 @@ const goEmitter = {
18644
19226
  };
18645
19227
  }
18646
19228
  return m;
18647
- }), ctx));
19229
+ })), ctx));
18648
19230
  },
18649
19231
  generateEnums(enums, ctx) {
18650
19232
  const syntheticEnums = getSyntheticEnums();
@@ -24272,7 +24854,7 @@ const kotlinEmitter = {
24272
24854
  generateModels(models, ctx) {
24273
24855
  const enriched = enrichModelsFromSpec(models);
24274
24856
  const originalByName = new Map(models.map((m) => [m.name, m]));
24275
- return ensureTrailingNewlines$2(generateModels$2(enriched.map((m) => {
24857
+ return ensureTrailingNewlines$2(generateModels$2(flattenDiscriminatedUnionFields(enriched.map((m) => {
24276
24858
  if (m.discriminator && m.fields.length === 0) {
24277
24859
  const original = originalByName.get(m.name);
24278
24860
  if (original && original.fields.length > 0) return {
@@ -24281,7 +24863,7 @@ const kotlinEmitter = {
24281
24863
  };
24282
24864
  }
24283
24865
  return m;
24284
- }), ctx));
24866
+ })), ctx));
24285
24867
  },
24286
24868
  generateEnums(enums, ctx) {
24287
24869
  const syntheticEnums = getSyntheticEnums();
@@ -24300,7 +24882,7 @@ const kotlinEmitter = {
24300
24882
  return [];
24301
24883
  },
24302
24884
  generateTests(spec, ctx) {
24303
- const enrichedModels = enrichModelsFromSpec(spec.models);
24885
+ const enrichedModels = flattenDiscriminatedUnionFields(enrichModelsFromSpec(spec.models));
24304
24886
  const enrichedSpec = {
24305
24887
  ...spec,
24306
24888
  models: enrichedModels
@@ -27964,19 +28546,24 @@ function renderAutoPagingMethod(op, resolved, paramsType, method, ctx) {
27964
28546
  if (!op.pagination) return null;
27965
28547
  if (op.pagination.strategy !== "cursor") return null;
27966
28548
  if (resolved.urlBuilder) return null;
27967
- if (op.response.kind !== "model") return null;
27968
- const responseModel = ctx.spec.models.find((m) => m.name === op.response.name);
27969
- if (!responseModel) return null;
27970
28549
  const cursorParam = op.pagination.param;
27971
28550
  const dataPath = op.pagination.dataPath ?? "data";
27972
- const dataField = responseModel.fields.find((f) => f.name === dataPath);
27973
- if (!dataField || dataField.type.kind !== "array") return null;
27974
- const listMetadataField = responseModel.fields.find((f) => f.name === "list_metadata");
27975
- if (!listMetadataField || listMetadataField.type.kind !== "model") return null;
27976
- const metadataModel = ctx.spec.models.find((m) => m.name === listMetadataField.type.name);
27977
- if (!metadataModel) return null;
27978
- if (!metadataModel.fields.some((f) => f.name === cursorParam)) return null;
27979
- const itemType = mapTypeRef$1(dataField.type.items);
28551
+ let itemType;
28552
+ if (op.response.kind === "model") {
28553
+ const responseModel = ctx.spec.models.find((m) => m.name === op.response.name);
28554
+ if (!responseModel) return null;
28555
+ const dataField = responseModel.fields.find((f) => f.name === dataPath);
28556
+ if (!dataField || dataField.type.kind !== "array") return null;
28557
+ const listMetadataField = responseModel.fields.find((f) => f.name === "list_metadata");
28558
+ if (!listMetadataField || listMetadataField.type.kind !== "model") return null;
28559
+ const metadataModel = ctx.spec.models.find((m) => m.name === listMetadataField.type.name);
28560
+ if (!metadataModel) return null;
28561
+ if (!metadataModel.fields.some((f) => f.name === cursorParam)) return null;
28562
+ itemType = mapTypeRef$1(dataField.type.items);
28563
+ } else if (isInlineEnvelopeList(op) && cursorParam === "after") {
28564
+ if (!op.queryParams.some((p) => p.name === cursorParam)) return null;
28565
+ itemType = mapTypeRef$1(op.response.items);
28566
+ } else return null;
27980
28567
  const cursorField = fieldName(cursorParam);
27981
28568
  const dataAccessor = fieldName(dataPath);
27982
28569
  const pathArgList = op.pathParams.map((p) => `${methodName(p.name)}: impl Into<String>`);
@@ -28155,11 +28742,17 @@ function renderWrapperMethod(op, wrapper, params, paramsType, method) {
28155
28742
  sig.push(` let path = format!(${JSON.stringify(pathFormat)});`);
28156
28743
  } else sig.push(` let path = ${JSON.stringify(pathFormat)}.to_string();`);
28157
28744
  sig.push(` let method = http::Method::${op.httpMethod.toUpperCase()};`);
28158
- sig.push(" let body = serde_json::json!({");
28745
+ const inferredFields = wrapper.inferFromClient ?? [];
28746
+ sig.push(` let ${inferredFields.length > 0 ? "mut " : ""}body = serde_json::json!({`);
28159
28747
  for (const [k, v] of Object.entries(wrapper.defaults ?? {})) sig.push(` ${JSON.stringify(k)}: ${JSON.stringify(v)},`);
28160
- for (const k of wrapper.inferFromClient ?? []) sig.push(` ${JSON.stringify(k)}: ${clientFieldExpression(k)},`);
28161
28748
  for (const rp of params) sig.push(` ${JSON.stringify(rp.paramName)}: params.${fieldName(rp.paramName)},`);
28162
28749
  sig.push(" });");
28750
+ for (const k of inferredFields) {
28751
+ const expr = clientFieldExpression(k);
28752
+ sig.push(` if !${expr}.is_empty() {`);
28753
+ sig.push(` body[${JSON.stringify(k)}] = serde_json::Value::String(${expr}.to_string());`);
28754
+ sig.push(" }");
28755
+ }
28163
28756
  sig.push(" #[derive(Serialize)]");
28164
28757
  sig.push(" struct EmptyQuery {}");
28165
28758
  sig.push(" self.client");
@@ -28170,14 +28763,17 @@ function renderWrapperMethod(op, wrapper, params, paramsType, method) {
28170
28763
  }
28171
28764
  /**
28172
28765
  * Rust expression for reading a client-config field at request time. Mirrors
28173
- * the Go emitter's `clientFieldExpression`. Falls back to an empty literal
28174
- * for unknown fields so the body still compiles.
28766
+ * the Go emitter's `clientFieldExpression`. Throws on unknown fields rather
28767
+ * than falling back to an empty literal: with the `if !expr.is_empty()` guard
28768
+ * in `renderWrapperMethod`, an empty literal would silently drop the field from
28769
+ * every request body (and emit dead `if !"".is_empty()` Rust). Failing loud at
28770
+ * generation time surfaces a missing case instead of shipping a broken SDK.
28175
28771
  */
28176
28772
  function clientFieldExpression(field) {
28177
28773
  switch (field) {
28178
28774
  case "client_id": return "self.client.client_id()";
28179
28775
  case "client_secret": return "self.client.api_key()";
28180
- default: return "\"\"";
28776
+ default: throw new Error(`Rust emitter: no client-config accessor for inferFromClient field "${field}". Add a case to clientFieldExpression.`);
28181
28777
  }
28182
28778
  }
28183
28779
  /** Multi-line `///` doc comment from a free-form description. */
@@ -28237,9 +28833,30 @@ function methodDocLines(op) {
28237
28833
  }
28238
28834
  function renderResponseType(op) {
28239
28835
  if (isEmptyResponse(op)) return "()";
28836
+ if (isInlineEnvelopeList(op)) return `crate::pagination::Page<${mapTypeRef$1(op.response.items)}>`;
28240
28837
  return mapTypeRef$1(op.response);
28241
28838
  }
28242
28839
  /**
28840
+ * True when the spec declared this response as an inline pagination envelope
28841
+ * (`{ object, data: [...], list_metadata }` without a named component). The IR
28842
+ * models these as a bare array plus `pagination.dataPath`, but the wire format
28843
+ * is still the envelope — decoding the body straight into `Vec<T>` fails, so
28844
+ * these ops decode into the hand-maintained `crate::pagination::Page<T>`
28845
+ * instead. Restricted to `data` because that's the field `Page<T>` declares.
28846
+ *
28847
+ * The `=== 'data'` is a strict equality on purpose — deliberately *not* the
28848
+ * `?? 'data'` fallback used elsewhere. `dataPath` is the only signal that
28849
+ * separates an inline envelope (decoded as `Page<T>`) from a genuine paginated
28850
+ * bare array (decoded as `Vec<T>`, see the `responseKind === 'array'` branch in
28851
+ * tests.ts). This therefore relies on the IR setting `dataPath: 'data'`
28852
+ * explicitly for envelope responses and leaving it unset for bare arrays. If
28853
+ * the IR ever omitted it for an envelope op, this would return `false` and the
28854
+ * op would decode into `Vec<T>` and fail — so that invariant must hold upstream.
28855
+ */
28856
+ function isInlineEnvelopeList(op) {
28857
+ return op.response?.kind === "array" && op.pagination?.dataPath === "data";
28858
+ }
28859
+ /**
28243
28860
  * True when the operation has no usable response schema. We treat the IR's
28244
28861
  * `primitive: unknown` and missing-response cases the same way: the spec
28245
28862
  * declared no JSON body, so the SDK promises nothing about the contents.
@@ -28586,7 +29203,7 @@ function renderRegularTest(op, resolved, accessor, crate, modelMap, enumMap) {
28586
29203
  const m = methodName(resolved.methodName);
28587
29204
  const literalPath = op.path.replace(/\{[^}]+\}/g, "test_id");
28588
29205
  const httpMethod = op.httpMethod.toUpperCase();
28589
- const responseExpr = responseBodyExpr(op.response, modelMap, enumMap);
29206
+ const responseExpr = isInlineEnvelopeList(op) ? JSON.stringify("{\"object\":\"list\",\"data\":[],\"list_metadata\":{\"before\":null,\"after\":null}}") : responseBodyExpr(op.response, modelMap, enumMap);
28590
29207
  const isUrlBuilder = resolved.urlBuilder === true;
28591
29208
  const callArgs = buildCallArgs(op, resolved, crate, accessor, modelMap, enumMap).join(", ");
28592
29209
  const shape = {
@@ -28742,7 +29359,10 @@ function emptyPageTest(op, shape, accessor) {
28742
29359
  const responseKind = op.response.kind;
28743
29360
  let body;
28744
29361
  let dataAccessor;
28745
- if (responseKind === "array") {
29362
+ if (isInlineEnvelopeList(op)) {
29363
+ body = "{\"object\":\"list\",\"data\":[],\"list_metadata\":{\"before\":null,\"after\":null}}";
29364
+ dataAccessor = "resp.data";
29365
+ } else if (responseKind === "array") {
28746
29366
  body = "[]";
28747
29367
  dataAccessor = "resp";
28748
29368
  } else if (responseKind === "model") {
@@ -28825,7 +29445,7 @@ function encodesQueryParamsTest(op, resolved, accessor, crate, modelMap, enumMap
28825
29445
  /** Body expression for the encoding-test response (success, ignored). */
28826
29446
  function encodingResponseExpr(op, modelMap, enumMap) {
28827
29447
  if (op.pagination) {
28828
- if (op.response.kind === "array") return JSON.stringify("[]");
29448
+ if (op.response.kind === "array" && !isInlineEnvelopeList(op)) return JSON.stringify("[]");
28829
29449
  return JSON.stringify("{\"object\":\"list\",\"data\":[],\"list_metadata\":{\"before\":null,\"after\":null}}");
28830
29450
  }
28831
29451
  return responseBodyExpr(op.response, modelMap, enumMap);
@@ -29144,4 +29764,4 @@ const workosEmittersPlugin = {
29144
29764
  //#endregion
29145
29765
  export { fieldName$2 as A, servicePropertyName$2 as B, apiClassName as C, dotnetEmitter as D, propertyName as E, fieldName$3 as F, fieldName$5 as H, methodName$3 as I, trimMountedResourceFromMethod$2 as L, trimMountedResourceFromMethod$1 as M, goEmitter as N, appendAsyncSuffix as O, className$3 as P, phpEmitter as R, kotlinEmitter as S, packageSegment as T, safeParamName$1 as U, pythonEmitter as V, nodeEmitter as W, rubyEmitter as _, rustExtractor as a, resolveServiceTarget as b, pythonExtractor as c, rustEmitter as d, fieldName as f, typeName as g, resourceAccessorName as h, kotlinExtractor as i, methodName$2 as j, className$2 as k, rubyExtractor as l, moduleName as m, elixirExtractor as n, goExtractor as o, methodName as p, dotnetExtractor as r, phpExtractor as s, workosEmittersPlugin as t, nodeExtractor as u, buildExportedClassNameSet as v, methodName$1 as w, safeParamName as x, fieldName$1 as y, fieldName$4 as z };
29146
29766
 
29147
- //# sourceMappingURL=plugin-CpO8rePT.mjs.map
29767
+ //# sourceMappingURL=plugin-BLnR-FMi.mjs.map