markmap-lib 0.12.0 → 0.13.1

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.
@@ -1,4 +1,4 @@
1
- /*! markmap-lib v0.12.0 | MIT License */
1
+ /*! markmap-lib v0.13.1 | MIT License */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('katex')) :
4
4
  typeof define === 'function' && define.amd ? define(['exports', 'katex'], factory) :
@@ -27,7 +27,7 @@ function _extends$1() {
27
27
  return _extends$1.apply(this, arguments);
28
28
  }
29
29
 
30
- /*! markmap-common v0.1.6 | MIT License */
30
+ /*! markmap-common v0.13.0 | MIT License */
31
31
  class Hook {
32
32
  constructor() {
33
33
  this.listeners = [];
@@ -253,19 +253,16 @@ async function loadJS(items, context) {
253
253
  }
254
254
 
255
255
  const template = "<!DOCTYPE html>\n<html>\n<head>\n<meta charset=\"UTF-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n<meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">\n<title>Markmap</title>\n<style>\n* {\n margin: 0;\n padding: 0;\n}\n#mindmap {\n display: block;\n width: 100vw;\n height: 100vh;\n}\n</style>\n<!--CSS-->\n</head>\n<body>\n<svg id=\"mindmap\"></svg>\n<!--JS-->\n</body>\n</html>\n";
256
- const BASE_JS = [`https://cdn.jsdelivr.net/npm/d3@${"6.7.0"}`, `https://cdn.jsdelivr.net/npm/markmap-view@${"0.2.7"}`].map(src => ({
256
+ const BASE_JS = [`https://cdn.jsdelivr.net/npm/d3@${"6.7.0"}`, `https://cdn.jsdelivr.net/npm/markmap-view@${"0.13.1"}`].map(src => ({
257
257
  type: 'script',
258
258
  data: {
259
259
  src
260
260
  }
261
261
  }));
262
- function fillTemplate(root, assets, extra) {
263
- if (typeof extra === 'function') {
264
- extra = {
265
- getOptions: extra
266
- };
267
- }
268
262
 
263
+ const defaultGetOptions = (markmap, jsonOptions) => markmap.deriveOptions(jsonOptions);
264
+
265
+ function fillTemplate(root, assets, extra) {
269
266
  extra = _extends$1({
270
267
  baseJs: BASE_JS
271
268
  }, extra);
@@ -276,24 +273,24 @@ function fillTemplate(root, assets, extra) {
276
273
  const cssList = [...(styles ? persistCSS(styles) : [])];
277
274
  const context = {
278
275
  getMarkmap: () => window.markmap,
279
- getOptions: extra.getOptions,
280
- data: root
276
+ getOptions: extra.getOptions || defaultGetOptions,
277
+ jsonOptions: extra.jsonOptions,
278
+ root
281
279
  };
282
- const jsList = [...persistJS(extra.baseJs), ...persistJS([...(scripts || []), {
280
+ const jsList = [...persistJS([...extra.baseJs, ...(scripts || []), {
283
281
  type: 'iife',
284
282
  data: {
285
- fn: (getMarkmap, getOptions, data) => {
286
- const {
287
- Markmap
288
- } = getMarkmap();
289
- window.mm = Markmap.create('svg#mindmap', getOptions == null ? void 0 : getOptions(), data);
283
+ fn: (getMarkmap, getOptions, root, jsonOptions) => {
284
+ const markmap = getMarkmap();
285
+ window.mm = markmap.Markmap.create('svg#mindmap', getOptions == null ? void 0 : getOptions(markmap, jsonOptions), root);
290
286
  },
291
287
  getParams: ({
292
288
  getMarkmap,
293
289
  getOptions,
294
- data
290
+ root,
291
+ jsonOptions
295
292
  }) => {
296
- return [getMarkmap, getOptions, data];
293
+ return [getMarkmap, getOptions, root, jsonOptions];
297
294
  }
298
295
  }
299
296
  }], context)];
@@ -8755,23 +8752,18 @@ transform: transform$1
8755
8752
 
8756
8753
  /*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */
8757
8754
  function isNothing(subject) {
8758
- return (typeof subject === 'undefined') || (subject === null);
8755
+ return typeof subject === 'undefined' || subject === null;
8759
8756
  }
8760
8757
 
8761
-
8762
8758
  function isObject(subject) {
8763
- return (typeof subject === 'object') && (subject !== null);
8759
+ return typeof subject === 'object' && subject !== null;
8764
8760
  }
8765
8761
 
8766
-
8767
8762
  function toArray(sequence) {
8768
- if (Array.isArray(sequence)) return sequence;
8769
- else if (isNothing(sequence)) return [];
8770
-
8771
- return [ sequence ];
8763
+ if (Array.isArray(sequence)) return sequence;else if (isNothing(sequence)) return [];
8764
+ return [sequence];
8772
8765
  }
8773
8766
 
8774
-
8775
8767
  function extend(target, source) {
8776
8768
  var index, length, key, sourceKeys;
8777
8769
 
@@ -8787,9 +8779,9 @@ function extend(target, source) {
8787
8779
  return target;
8788
8780
  }
8789
8781
 
8790
-
8791
8782
  function repeat(string, count) {
8792
- var result = '', cycle;
8783
+ var result = '',
8784
+ cycle;
8793
8785
 
8794
8786
  for (cycle = 0; cycle < count; cycle += 1) {
8795
8787
  result += string;
@@ -8798,34 +8790,28 @@ function repeat(string, count) {
8798
8790
  return result;
8799
8791
  }
8800
8792
 
8801
-
8802
8793
  function isNegativeZero(number) {
8803
- return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number);
8794
+ return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
8804
8795
  }
8805
8796
 
8806
-
8807
- var isNothing_1 = isNothing;
8808
- var isObject_1 = isObject;
8809
- var toArray_1 = toArray;
8810
- var repeat_1 = repeat;
8797
+ var isNothing_1 = isNothing;
8798
+ var isObject_1 = isObject;
8799
+ var toArray_1 = toArray;
8800
+ var repeat_1 = repeat;
8811
8801
  var isNegativeZero_1 = isNegativeZero;
8812
- var extend_1 = extend;
8813
-
8802
+ var extend_1 = extend;
8814
8803
  var common = {
8815
- isNothing: isNothing_1,
8816
- isObject: isObject_1,
8817
- toArray: toArray_1,
8818
- repeat: repeat_1,
8819
- isNegativeZero: isNegativeZero_1,
8820
- extend: extend_1
8821
- };
8822
-
8823
- // YAML error class. http://stackoverflow.com/questions/8458984
8824
-
8804
+ isNothing: isNothing_1,
8805
+ isObject: isObject_1,
8806
+ toArray: toArray_1,
8807
+ repeat: repeat_1,
8808
+ isNegativeZero: isNegativeZero_1,
8809
+ extend: extend_1
8810
+ }; // YAML error class. http://stackoverflow.com/questions/8458984
8825
8811
 
8826
8812
  function formatError(exception, compact) {
8827
- var where = '', message = exception.reason || '(unknown reason)';
8828
-
8813
+ var where = '',
8814
+ message = exception.reason || '(unknown reason)';
8829
8815
  if (!exception.mark) return message;
8830
8816
 
8831
8817
  if (exception.mark.name) {
@@ -8841,40 +8827,33 @@ function formatError(exception, compact) {
8841
8827
  return message + ' ' + where;
8842
8828
  }
8843
8829
 
8844
-
8845
8830
  function YAMLException$1(reason, mark) {
8846
8831
  // Super constructor
8847
8832
  Error.call(this);
8848
-
8849
8833
  this.name = 'YAMLException';
8850
8834
  this.reason = reason;
8851
8835
  this.mark = mark;
8852
- this.message = formatError(this, false);
8836
+ this.message = formatError(this, false); // Include stack trace in error object
8853
8837
 
8854
- // Include stack trace in error object
8855
8838
  if (Error.captureStackTrace) {
8856
8839
  // Chrome and NodeJS
8857
8840
  Error.captureStackTrace(this, this.constructor);
8858
8841
  } else {
8859
8842
  // FF, IE 10+ and Safari 6+. Fallback for others
8860
- this.stack = (new Error()).stack || '';
8843
+ this.stack = new Error().stack || '';
8861
8844
  }
8862
- }
8845
+ } // Inherit from Error
8863
8846
 
8864
8847
 
8865
- // Inherit from Error
8866
8848
  YAMLException$1.prototype = Object.create(Error.prototype);
8867
8849
  YAMLException$1.prototype.constructor = YAMLException$1;
8868
8850
 
8869
-
8870
8851
  YAMLException$1.prototype.toString = function toString(compact) {
8871
8852
  return this.name + ': ' + formatError(this, compact);
8872
8853
  };
8873
8854
 
8855
+ var exception = YAMLException$1; // get snippet for a single line, respecting maxLength
8874
8856
 
8875
- var exception = YAMLException$1;
8876
-
8877
- // get snippet for a single line, respecting maxLength
8878
8857
  function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
8879
8858
  var head = '';
8880
8859
  var tail = '';
@@ -8893,32 +8872,28 @@ function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
8893
8872
  return {
8894
8873
  str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, '→') + tail,
8895
8874
  pos: position - lineStart + head.length // relative position
8875
+
8896
8876
  };
8897
8877
  }
8898
8878
 
8899
-
8900
8879
  function padStart(string, max) {
8901
8880
  return common.repeat(' ', max - string.length) + string;
8902
8881
  }
8903
8882
 
8904
-
8905
8883
  function makeSnippet(mark, options) {
8906
8884
  options = Object.create(options || null);
8907
-
8908
8885
  if (!mark.buffer) return null;
8909
-
8910
8886
  if (!options.maxLength) options.maxLength = 79;
8911
- if (typeof options.indent !== 'number') options.indent = 1;
8887
+ if (typeof options.indent !== 'number') options.indent = 1;
8912
8888
  if (typeof options.linesBefore !== 'number') options.linesBefore = 3;
8913
- if (typeof options.linesAfter !== 'number') options.linesAfter = 2;
8914
-
8889
+ if (typeof options.linesAfter !== 'number') options.linesAfter = 2;
8915
8890
  var re = /\r?\n|\r|\0/g;
8916
- var lineStarts = [ 0 ];
8891
+ var lineStarts = [0];
8917
8892
  var lineEnds = [];
8918
8893
  var match;
8919
8894
  var foundLineNo = -1;
8920
8895
 
8921
- while ((match = re.exec(mark.buffer))) {
8896
+ while (match = re.exec(mark.buffer)) {
8922
8897
  lineEnds.push(match.index);
8923
8898
  lineStarts.push(match.index + match[0].length);
8924
8899
 
@@ -8928,66 +8903,34 @@ function makeSnippet(mark, options) {
8928
8903
  }
8929
8904
 
8930
8905
  if (foundLineNo < 0) foundLineNo = lineStarts.length - 1;
8931
-
8932
- var result = '', i, line;
8906
+ var result = '',
8907
+ i,
8908
+ line;
8933
8909
  var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
8934
8910
  var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
8935
8911
 
8936
8912
  for (i = 1; i <= options.linesBefore; i++) {
8937
8913
  if (foundLineNo - i < 0) break;
8938
- line = getLine(
8939
- mark.buffer,
8940
- lineStarts[foundLineNo - i],
8941
- lineEnds[foundLineNo - i],
8942
- mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]),
8943
- maxLineLength
8944
- );
8945
- result = common.repeat(' ', options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) +
8946
- ' | ' + line.str + '\n' + result;
8914
+ line = getLine(mark.buffer, lineStarts[foundLineNo - i], lineEnds[foundLineNo - i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]), maxLineLength);
8915
+ result = common.repeat(' ', options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + ' | ' + line.str + '\n' + result;
8947
8916
  }
8948
8917
 
8949
8918
  line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
8950
- result += common.repeat(' ', options.indent) + padStart((mark.line + 1).toString(), lineNoLength) +
8951
- ' | ' + line.str + '\n';
8919
+ result += common.repeat(' ', options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + ' | ' + line.str + '\n';
8952
8920
  result += common.repeat('-', options.indent + lineNoLength + 3 + line.pos) + '^' + '\n';
8953
8921
 
8954
8922
  for (i = 1; i <= options.linesAfter; i++) {
8955
8923
  if (foundLineNo + i >= lineEnds.length) break;
8956
- line = getLine(
8957
- mark.buffer,
8958
- lineStarts[foundLineNo + i],
8959
- lineEnds[foundLineNo + i],
8960
- mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]),
8961
- maxLineLength
8962
- );
8963
- result += common.repeat(' ', options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) +
8964
- ' | ' + line.str + '\n';
8924
+ line = getLine(mark.buffer, lineStarts[foundLineNo + i], lineEnds[foundLineNo + i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]), maxLineLength);
8925
+ result += common.repeat(' ', options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + ' | ' + line.str + '\n';
8965
8926
  }
8966
8927
 
8967
8928
  return result.replace(/\n$/, '');
8968
8929
  }
8969
8930
 
8970
-
8971
8931
  var snippet = makeSnippet;
8972
-
8973
- var TYPE_CONSTRUCTOR_OPTIONS = [
8974
- 'kind',
8975
- 'multi',
8976
- 'resolve',
8977
- 'construct',
8978
- 'instanceOf',
8979
- 'predicate',
8980
- 'represent',
8981
- 'representName',
8982
- 'defaultStyle',
8983
- 'styleAliases'
8984
- ];
8985
-
8986
- var YAML_NODE_KINDS = [
8987
- 'scalar',
8988
- 'sequence',
8989
- 'mapping'
8990
- ];
8932
+ var TYPE_CONSTRUCTOR_OPTIONS = ['kind', 'multi', 'resolve', 'construct', 'instanceOf', 'predicate', 'represent', 'representName', 'defaultStyle', 'styleAliases'];
8933
+ var YAML_NODE_KINDS = ['scalar', 'sequence', 'mapping'];
8991
8934
 
8992
8935
  function compileStyleAliases(map) {
8993
8936
  var result = {};
@@ -9005,26 +8948,32 @@ function compileStyleAliases(map) {
9005
8948
 
9006
8949
  function Type$1(tag, options) {
9007
8950
  options = options || {};
9008
-
9009
8951
  Object.keys(options).forEach(function (name) {
9010
8952
  if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
9011
8953
  throw new exception('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
9012
8954
  }
9013
- });
8955
+ }); // TODO: Add tag format check.
8956
+
8957
+ this.options = options; // keep original options in case user wants to extend this type later
8958
+
8959
+ this.tag = tag;
8960
+ this.kind = options['kind'] || null;
8961
+
8962
+ this.resolve = options['resolve'] || function () {
8963
+ return true;
8964
+ };
8965
+
8966
+ this.construct = options['construct'] || function (data) {
8967
+ return data;
8968
+ };
9014
8969
 
9015
- // TODO: Add tag format check.
9016
- this.options = options; // keep original options in case user wants to extend this type later
9017
- this.tag = tag;
9018
- this.kind = options['kind'] || null;
9019
- this.resolve = options['resolve'] || function () { return true; };
9020
- this.construct = options['construct'] || function (data) { return data; };
9021
- this.instanceOf = options['instanceOf'] || null;
9022
- this.predicate = options['predicate'] || null;
9023
- this.represent = options['represent'] || null;
8970
+ this.instanceOf = options['instanceOf'] || null;
8971
+ this.predicate = options['predicate'] || null;
8972
+ this.represent = options['represent'] || null;
9024
8973
  this.representName = options['representName'] || null;
9025
- this.defaultStyle = options['defaultStyle'] || null;
9026
- this.multi = options['multi'] || false;
9027
- this.styleAliases = compileStyleAliases(options['styleAliases'] || null);
8974
+ this.defaultStyle = options['defaultStyle'] || null;
8975
+ this.multi = options['multi'] || false;
8976
+ this.styleAliases = compileStyleAliases(options['styleAliases'] || null);
9028
8977
 
9029
8978
  if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
9030
8979
  throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
@@ -9032,48 +8981,39 @@ function Type$1(tag, options) {
9032
8981
  }
9033
8982
 
9034
8983
  var type = Type$1;
9035
-
9036
8984
  /*eslint-disable max-len*/
9037
8985
 
9038
-
9039
-
9040
-
9041
-
9042
8986
  function compileList(schema, name) {
9043
8987
  var result = [];
9044
-
9045
8988
  schema[name].forEach(function (currentType) {
9046
8989
  var newIndex = result.length;
9047
-
9048
8990
  result.forEach(function (previousType, previousIndex) {
9049
- if (previousType.tag === currentType.tag &&
9050
- previousType.kind === currentType.kind &&
9051
- previousType.multi === currentType.multi) {
9052
-
8991
+ if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) {
9053
8992
  newIndex = previousIndex;
9054
8993
  }
9055
8994
  });
9056
-
9057
8995
  result[newIndex] = currentType;
9058
8996
  });
9059
-
9060
8997
  return result;
9061
8998
  }
9062
8999
 
9063
-
9064
- function compileMap(/* lists... */) {
9000
+ function
9001
+ /* lists... */
9002
+ compileMap() {
9065
9003
  var result = {
9066
- scalar: {},
9067
- sequence: {},
9068
- mapping: {},
9069
- fallback: {},
9070
- multi: {
9071
- scalar: [],
9072
- sequence: [],
9073
- mapping: [],
9074
- fallback: []
9075
- }
9076
- }, index, length;
9004
+ scalar: {},
9005
+ sequence: {},
9006
+ mapping: {},
9007
+ fallback: {},
9008
+ multi: {
9009
+ scalar: [],
9010
+ sequence: [],
9011
+ mapping: [],
9012
+ fallback: []
9013
+ }
9014
+ },
9015
+ index,
9016
+ length;
9077
9017
 
9078
9018
  function collectType(type) {
9079
9019
  if (type.multi) {
@@ -9087,15 +9027,14 @@ function compileMap(/* lists... */) {
9087
9027
  for (index = 0, length = arguments.length; index < length; index += 1) {
9088
9028
  arguments[index].forEach(collectType);
9089
9029
  }
9030
+
9090
9031
  return result;
9091
9032
  }
9092
9033
 
9093
-
9094
9034
  function Schema$1(definition) {
9095
9035
  return this.extend(definition);
9096
9036
  }
9097
9037
 
9098
-
9099
9038
  Schema$1.prototype.extend = function extend(definition) {
9100
9039
  var implicit = [];
9101
9040
  var explicit = [];
@@ -9103,19 +9042,15 @@ Schema$1.prototype.extend = function extend(definition) {
9103
9042
  if (definition instanceof type) {
9104
9043
  // Schema.extend(type)
9105
9044
  explicit.push(definition);
9106
-
9107
9045
  } else if (Array.isArray(definition)) {
9108
9046
  // Schema.extend([ type1, type2, ... ])
9109
9047
  explicit = explicit.concat(definition);
9110
-
9111
9048
  } else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
9112
9049
  // Schema.extend({ explicit: [ type1, type2, ... ], implicit: [ type1, type2, ... ] })
9113
9050
  if (definition.implicit) implicit = implicit.concat(definition.implicit);
9114
9051
  if (definition.explicit) explicit = explicit.concat(definition.explicit);
9115
-
9116
9052
  } else {
9117
- throw new exception('Schema.extend argument should be a Type, [ Type ], ' +
9118
- 'or a schema definition ({ implicit: [...], explicit: [...] })');
9053
+ throw new exception('Schema.extend argument should be a Type, [ Type ], ' + 'or a schema definition ({ implicit: [...], explicit: [...] })');
9119
9054
  }
9120
9055
 
9121
9056
  implicit.forEach(function (type$1) {
@@ -9131,58 +9066,47 @@ Schema$1.prototype.extend = function extend(definition) {
9131
9066
  throw new exception('There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.');
9132
9067
  }
9133
9068
  });
9134
-
9135
9069
  explicit.forEach(function (type$1) {
9136
9070
  if (!(type$1 instanceof type)) {
9137
9071
  throw new exception('Specified list of YAML types (or a single Type object) contains a non-Type object.');
9138
9072
  }
9139
9073
  });
9140
-
9141
9074
  var result = Object.create(Schema$1.prototype);
9142
-
9143
9075
  result.implicit = (this.implicit || []).concat(implicit);
9144
9076
  result.explicit = (this.explicit || []).concat(explicit);
9145
-
9146
9077
  result.compiledImplicit = compileList(result, 'implicit');
9147
9078
  result.compiledExplicit = compileList(result, 'explicit');
9148
- result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
9149
-
9079
+ result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
9150
9080
  return result;
9151
9081
  };
9152
9082
 
9153
-
9154
9083
  var schema = Schema$1;
9155
-
9156
9084
  var str = new type('tag:yaml.org,2002:str', {
9157
9085
  kind: 'scalar',
9158
- construct: function (data) { return data !== null ? data : ''; }
9086
+ construct: function (data) {
9087
+ return data !== null ? data : '';
9088
+ }
9159
9089
  });
9160
-
9161
9090
  var seq = new type('tag:yaml.org,2002:seq', {
9162
9091
  kind: 'sequence',
9163
- construct: function (data) { return data !== null ? data : []; }
9092
+ construct: function (data) {
9093
+ return data !== null ? data : [];
9094
+ }
9164
9095
  });
9165
-
9166
9096
  var map = new type('tag:yaml.org,2002:map', {
9167
9097
  kind: 'mapping',
9168
- construct: function (data) { return data !== null ? data : {}; }
9098
+ construct: function (data) {
9099
+ return data !== null ? data : {};
9100
+ }
9169
9101
  });
9170
-
9171
9102
  var failsafe = new schema({
9172
- explicit: [
9173
- str,
9174
- seq,
9175
- map
9176
- ]
9103
+ explicit: [str, seq, map]
9177
9104
  });
9178
9105
 
9179
9106
  function resolveYamlNull(data) {
9180
9107
  if (data === null) return true;
9181
-
9182
9108
  var max = data.length;
9183
-
9184
- return (max === 1 && data === '~') ||
9185
- (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL'));
9109
+ return max === 1 && data === '~' || max === 4 && (data === 'null' || data === 'Null' || data === 'NULL');
9186
9110
  }
9187
9111
 
9188
9112
  function constructYamlNull() {
@@ -9199,28 +9123,33 @@ var _null = new type('tag:yaml.org,2002:null', {
9199
9123
  construct: constructYamlNull,
9200
9124
  predicate: isNull,
9201
9125
  represent: {
9202
- canonical: function () { return '~'; },
9203
- lowercase: function () { return 'null'; },
9204
- uppercase: function () { return 'NULL'; },
9205
- camelcase: function () { return 'Null'; },
9206
- empty: function () { return ''; }
9126
+ canonical: function () {
9127
+ return '~';
9128
+ },
9129
+ lowercase: function () {
9130
+ return 'null';
9131
+ },
9132
+ uppercase: function () {
9133
+ return 'NULL';
9134
+ },
9135
+ camelcase: function () {
9136
+ return 'Null';
9137
+ },
9138
+ empty: function () {
9139
+ return '';
9140
+ }
9207
9141
  },
9208
9142
  defaultStyle: 'lowercase'
9209
9143
  });
9210
9144
 
9211
9145
  function resolveYamlBoolean(data) {
9212
9146
  if (data === null) return false;
9213
-
9214
9147
  var max = data.length;
9215
-
9216
- return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) ||
9217
- (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE'));
9148
+ return max === 4 && (data === 'true' || data === 'True' || data === 'TRUE') || max === 5 && (data === 'false' || data === 'False' || data === 'FALSE');
9218
9149
  }
9219
9150
 
9220
9151
  function constructYamlBoolean(data) {
9221
- return data === 'true' ||
9222
- data === 'True' ||
9223
- data === 'TRUE';
9152
+ return data === 'true' || data === 'True' || data === 'TRUE';
9224
9153
  }
9225
9154
 
9226
9155
  function isBoolean(object) {
@@ -9233,40 +9162,60 @@ var bool = new type('tag:yaml.org,2002:bool', {
9233
9162
  construct: constructYamlBoolean,
9234
9163
  predicate: isBoolean,
9235
9164
  represent: {
9236
- lowercase: function (object) { return object ? 'true' : 'false'; },
9237
- uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; },
9238
- camelcase: function (object) { return object ? 'True' : 'False'; }
9165
+ lowercase: function (object) {
9166
+ return object ? 'true' : 'false';
9167
+ },
9168
+ uppercase: function (object) {
9169
+ return object ? 'TRUE' : 'FALSE';
9170
+ },
9171
+ camelcase: function (object) {
9172
+ return object ? 'True' : 'False';
9173
+ }
9239
9174
  },
9240
9175
  defaultStyle: 'lowercase'
9241
9176
  });
9242
9177
 
9243
9178
  function isHexCode(c) {
9244
- return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) ||
9245
- ((0x41/* A */ <= c) && (c <= 0x46/* F */)) ||
9246
- ((0x61/* a */ <= c) && (c <= 0x66/* f */));
9179
+ return 0x30
9180
+ /* 0 */
9181
+ <= c && c <= 0x39
9182
+ /* 9 */
9183
+ || 0x41
9184
+ /* A */
9185
+ <= c && c <= 0x46
9186
+ /* F */
9187
+ || 0x61
9188
+ /* a */
9189
+ <= c && c <= 0x66
9190
+ /* f */
9191
+ ;
9247
9192
  }
9248
9193
 
9249
9194
  function isOctCode(c) {
9250
- return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */));
9195
+ return 0x30
9196
+ /* 0 */
9197
+ <= c && c <= 0x37
9198
+ /* 7 */
9199
+ ;
9251
9200
  }
9252
9201
 
9253
9202
  function isDecCode(c) {
9254
- return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */));
9203
+ return 0x30
9204
+ /* 0 */
9205
+ <= c && c <= 0x39
9206
+ /* 9 */
9207
+ ;
9255
9208
  }
9256
9209
 
9257
9210
  function resolveYamlInteger(data) {
9258
9211
  if (data === null) return false;
9259
-
9260
9212
  var max = data.length,
9261
9213
  index = 0,
9262
9214
  hasDigits = false,
9263
9215
  ch;
9264
-
9265
9216
  if (!max) return false;
9217
+ ch = data[index]; // sign
9266
9218
 
9267
- ch = data[index];
9268
-
9269
- // sign
9270
9219
  if (ch === '-' || ch === '+') {
9271
9220
  ch = data[++index];
9272
9221
  }
@@ -9274,9 +9223,7 @@ function resolveYamlInteger(data) {
9274
9223
  if (ch === '0') {
9275
9224
  // 0
9276
9225
  if (index + 1 === max) return true;
9277
- ch = data[++index];
9278
-
9279
- // base 2, base 8, base 16
9226
+ ch = data[++index]; // base 2, base 8, base 16
9280
9227
 
9281
9228
  if (ch === 'b') {
9282
9229
  // base 2
@@ -9288,10 +9235,10 @@ function resolveYamlInteger(data) {
9288
9235
  if (ch !== '0' && ch !== '1') return false;
9289
9236
  hasDigits = true;
9290
9237
  }
9238
+
9291
9239
  return hasDigits && ch !== '_';
9292
9240
  }
9293
9241
 
9294
-
9295
9242
  if (ch === 'x') {
9296
9243
  // base 16
9297
9244
  index++;
@@ -9302,10 +9249,10 @@ function resolveYamlInteger(data) {
9302
9249
  if (!isHexCode(data.charCodeAt(index))) return false;
9303
9250
  hasDigits = true;
9304
9251
  }
9252
+
9305
9253
  return hasDigits && ch !== '_';
9306
9254
  }
9307
9255
 
9308
-
9309
9256
  if (ch === 'o') {
9310
9257
  // base 8
9311
9258
  index++;
@@ -9316,32 +9263,35 @@ function resolveYamlInteger(data) {
9316
9263
  if (!isOctCode(data.charCodeAt(index))) return false;
9317
9264
  hasDigits = true;
9318
9265
  }
9266
+
9319
9267
  return hasDigits && ch !== '_';
9320
9268
  }
9321
- }
9269
+ } // base 10 (except 0)
9270
+ // value should not start with `_`;
9322
9271
 
9323
- // base 10 (except 0)
9324
9272
 
9325
- // value should not start with `_`;
9326
9273
  if (ch === '_') return false;
9327
9274
 
9328
9275
  for (; index < max; index++) {
9329
9276
  ch = data[index];
9330
9277
  if (ch === '_') continue;
9278
+
9331
9279
  if (!isDecCode(data.charCodeAt(index))) {
9332
9280
  return false;
9333
9281
  }
9282
+
9334
9283
  hasDigits = true;
9335
- }
9284
+ } // Should have digits and should not end with `_`
9336
9285
 
9337
- // Should have digits and should not end with `_`
9338
- if (!hasDigits || ch === '_') return false;
9339
9286
 
9287
+ if (!hasDigits || ch === '_') return false;
9340
9288
  return true;
9341
9289
  }
9342
9290
 
9343
9291
  function constructYamlInteger(data) {
9344
- var value = data, sign = 1, ch;
9292
+ var value = data,
9293
+ sign = 1,
9294
+ ch;
9345
9295
 
9346
9296
  if (value.indexOf('_') !== -1) {
9347
9297
  value = value.replace(/_/g, '');
@@ -9367,8 +9317,7 @@ function constructYamlInteger(data) {
9367
9317
  }
9368
9318
 
9369
9319
  function isInteger(object) {
9370
- return (Object.prototype.toString.call(object)) === '[object Number]' &&
9371
- (object % 1 === 0 && !common.isNegativeZero(object));
9320
+ return Object.prototype.toString.call(object) === '[object Number]' && object % 1 === 0 && !common.isNegativeZero(object);
9372
9321
  }
9373
9322
 
9374
9323
  var int = new type('tag:yaml.org,2002:int', {
@@ -9377,39 +9326,42 @@ var int = new type('tag:yaml.org,2002:int', {
9377
9326
  construct: constructYamlInteger,
9378
9327
  predicate: isInteger,
9379
9328
  represent: {
9380
- binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); },
9381
- octal: function (obj) { return obj >= 0 ? '0o' + obj.toString(8) : '-0o' + obj.toString(8).slice(1); },
9382
- decimal: function (obj) { return obj.toString(10); },
9329
+ binary: function (obj) {
9330
+ return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1);
9331
+ },
9332
+ octal: function (obj) {
9333
+ return obj >= 0 ? '0o' + obj.toString(8) : '-0o' + obj.toString(8).slice(1);
9334
+ },
9335
+ decimal: function (obj) {
9336
+ return obj.toString(10);
9337
+ },
9338
+
9383
9339
  /* eslint-disable max-len */
9384
- hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); }
9340
+ hexadecimal: function (obj) {
9341
+ return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1);
9342
+ }
9385
9343
  },
9386
9344
  defaultStyle: 'decimal',
9387
9345
  styleAliases: {
9388
- binary: [ 2, 'bin' ],
9389
- octal: [ 8, 'oct' ],
9390
- decimal: [ 10, 'dec' ],
9391
- hexadecimal: [ 16, 'hex' ]
9346
+ binary: [2, 'bin'],
9347
+ octal: [8, 'oct'],
9348
+ decimal: [10, 'dec'],
9349
+ hexadecimal: [16, 'hex']
9392
9350
  }
9393
9351
  });
9394
-
9395
- var YAML_FLOAT_PATTERN = new RegExp(
9396
- // 2.5e4, 2.5 and integers
9397
- '^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' +
9398
- // .2e4, .2
9399
- // special case, seems not from spec
9400
- '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' +
9401
- // .inf
9402
- '|[-+]?\\.(?:inf|Inf|INF)' +
9403
- // .nan
9404
- '|\\.(?:nan|NaN|NAN))$');
9352
+ var YAML_FLOAT_PATTERN = new RegExp( // 2.5e4, 2.5 and integers
9353
+ '^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' + // .2e4, .2
9354
+ // special case, seems not from spec
9355
+ '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' + // .inf
9356
+ '|[-+]?\\.(?:inf|Inf|INF)' + // .nan
9357
+ '|\\.(?:nan|NaN|NAN))$');
9405
9358
 
9406
9359
  function resolveYamlFloat(data) {
9407
9360
  if (data === null) return false;
9408
9361
 
9409
- if (!YAML_FLOAT_PATTERN.test(data) ||
9410
- // Quick hack to not allow integers end with `_`
9411
- // Probably should update regexp & check speed
9412
- data[data.length - 1] === '_') {
9362
+ if (!YAML_FLOAT_PATTERN.test(data) || // Quick hack to not allow integers end with `_`
9363
+ // Probably should update regexp & check speed
9364
+ data[data.length - 1] === '_') {
9413
9365
  return false;
9414
9366
  }
9415
9367
 
@@ -9418,24 +9370,22 @@ function resolveYamlFloat(data) {
9418
9370
 
9419
9371
  function constructYamlFloat(data) {
9420
9372
  var value, sign;
9421
-
9422
- value = data.replace(/_/g, '').toLowerCase();
9423
- sign = value[0] === '-' ? -1 : 1;
9373
+ value = data.replace(/_/g, '').toLowerCase();
9374
+ sign = value[0] === '-' ? -1 : 1;
9424
9375
 
9425
9376
  if ('+-'.indexOf(value[0]) >= 0) {
9426
9377
  value = value.slice(1);
9427
9378
  }
9428
9379
 
9429
9380
  if (value === '.inf') {
9430
- return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
9431
-
9381
+ return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
9432
9382
  } else if (value === '.nan') {
9433
9383
  return NaN;
9434
9384
  }
9385
+
9435
9386
  return sign * parseFloat(value, 10);
9436
9387
  }
9437
9388
 
9438
-
9439
9389
  var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
9440
9390
 
9441
9391
  function representYamlFloat(object, style) {
@@ -9443,37 +9393,49 @@ function representYamlFloat(object, style) {
9443
9393
 
9444
9394
  if (isNaN(object)) {
9445
9395
  switch (style) {
9446
- case 'lowercase': return '.nan';
9447
- case 'uppercase': return '.NAN';
9448
- case 'camelcase': return '.NaN';
9396
+ case 'lowercase':
9397
+ return '.nan';
9398
+
9399
+ case 'uppercase':
9400
+ return '.NAN';
9401
+
9402
+ case 'camelcase':
9403
+ return '.NaN';
9449
9404
  }
9450
9405
  } else if (Number.POSITIVE_INFINITY === object) {
9451
9406
  switch (style) {
9452
- case 'lowercase': return '.inf';
9453
- case 'uppercase': return '.INF';
9454
- case 'camelcase': return '.Inf';
9407
+ case 'lowercase':
9408
+ return '.inf';
9409
+
9410
+ case 'uppercase':
9411
+ return '.INF';
9412
+
9413
+ case 'camelcase':
9414
+ return '.Inf';
9455
9415
  }
9456
9416
  } else if (Number.NEGATIVE_INFINITY === object) {
9457
9417
  switch (style) {
9458
- case 'lowercase': return '-.inf';
9459
- case 'uppercase': return '-.INF';
9460
- case 'camelcase': return '-.Inf';
9418
+ case 'lowercase':
9419
+ return '-.inf';
9420
+
9421
+ case 'uppercase':
9422
+ return '-.INF';
9423
+
9424
+ case 'camelcase':
9425
+ return '-.Inf';
9461
9426
  }
9462
9427
  } else if (common.isNegativeZero(object)) {
9463
9428
  return '-0.0';
9464
9429
  }
9465
9430
 
9466
- res = object.toString(10);
9467
-
9468
- // JS stringifier can build scientific format without dots: 5e-100,
9431
+ res = object.toString(10); // JS stringifier can build scientific format without dots: 5e-100,
9469
9432
  // while YAML requres dot: 5.e-100. Fix it with simple hack
9470
9433
 
9471
9434
  return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res;
9472
9435
  }
9473
9436
 
9474
9437
  function isFloat(object) {
9475
- return (Object.prototype.toString.call(object) === '[object Number]') &&
9476
- (object % 1 !== 0 || common.isNegativeZero(object));
9438
+ return Object.prototype.toString.call(object) === '[object Number]' && (object % 1 !== 0 || common.isNegativeZero(object));
9477
9439
  }
9478
9440
 
9479
9441
  var float = new type('tag:yaml.org,2002:float', {
@@ -9484,34 +9446,24 @@ var float = new type('tag:yaml.org,2002:float', {
9484
9446
  represent: representYamlFloat,
9485
9447
  defaultStyle: 'lowercase'
9486
9448
  });
9487
-
9488
9449
  var json = failsafe.extend({
9489
- implicit: [
9490
- _null,
9491
- bool,
9492
- int,
9493
- float
9494
- ]
9450
+ implicit: [_null, bool, int, float]
9495
9451
  });
9496
-
9497
9452
  var core = json;
9498
-
9499
- var YAML_DATE_REGEXP = new RegExp(
9500
- '^([0-9][0-9][0-9][0-9])' + // [1] year
9501
- '-([0-9][0-9])' + // [2] month
9502
- '-([0-9][0-9])$'); // [3] day
9503
-
9504
- var YAML_TIMESTAMP_REGEXP = new RegExp(
9505
- '^([0-9][0-9][0-9][0-9])' + // [1] year
9506
- '-([0-9][0-9]?)' + // [2] month
9507
- '-([0-9][0-9]?)' + // [3] day
9508
- '(?:[Tt]|[ \\t]+)' + // ...
9509
- '([0-9][0-9]?)' + // [4] hour
9510
- ':([0-9][0-9])' + // [5] minute
9511
- ':([0-9][0-9])' + // [6] second
9512
- '(?:\\.([0-9]*))?' + // [7] fraction
9513
- '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour
9514
- '(?::([0-9][0-9]))?))?$'); // [11] tz_minute
9453
+ var YAML_DATE_REGEXP = new RegExp('^([0-9][0-9][0-9][0-9])' + // [1] year
9454
+ '-([0-9][0-9])' + // [2] month
9455
+ '-([0-9][0-9])$'); // [3] day
9456
+
9457
+ var YAML_TIMESTAMP_REGEXP = new RegExp('^([0-9][0-9][0-9][0-9])' + // [1] year
9458
+ '-([0-9][0-9]?)' + // [2] month
9459
+ '-([0-9][0-9]?)' + // [3] day
9460
+ '(?:[Tt]|[ \\t]+)' + // ...
9461
+ '([0-9][0-9]?)' + // [4] hour
9462
+ ':([0-9][0-9])' + // [5] minute
9463
+ ':([0-9][0-9])' + // [6] second
9464
+ '(?:\\.([0-9]*))?' + // [7] fraction
9465
+ '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour
9466
+ '(?::([0-9][0-9]))?))?$'); // [11] tz_minute
9515
9467
 
9516
9468
  function resolveYamlTimestamp(data) {
9517
9469
  if (data === null) return false;
@@ -9521,55 +9473,65 @@ function resolveYamlTimestamp(data) {
9521
9473
  }
9522
9474
 
9523
9475
  function constructYamlTimestamp(data) {
9524
- var match, year, month, day, hour, minute, second, fraction = 0,
9525
- delta = null, tz_hour, tz_minute, date;
9526
-
9476
+ var match,
9477
+ year,
9478
+ month,
9479
+ day,
9480
+ hour,
9481
+ minute,
9482
+ second,
9483
+ fraction = 0,
9484
+ delta = null,
9485
+ tz_hour,
9486
+ tz_minute,
9487
+ date;
9527
9488
  match = YAML_DATE_REGEXP.exec(data);
9528
9489
  if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
9490
+ if (match === null) throw new Error('Date resolve error'); // match: [1] year [2] month [3] day
9529
9491
 
9530
- if (match === null) throw new Error('Date resolve error');
9531
-
9532
- // match: [1] year [2] month [3] day
9492
+ year = +match[1];
9493
+ month = +match[2] - 1; // JS month starts with 0
9533
9494
 
9534
- year = +(match[1]);
9535
- month = +(match[2]) - 1; // JS month starts with 0
9536
- day = +(match[3]);
9495
+ day = +match[3];
9537
9496
 
9538
- if (!match[4]) { // no hour
9497
+ if (!match[4]) {
9498
+ // no hour
9539
9499
  return new Date(Date.UTC(year, month, day));
9540
- }
9500
+ } // match: [4] hour [5] minute [6] second [7] fraction
9541
9501
 
9542
- // match: [4] hour [5] minute [6] second [7] fraction
9543
9502
 
9544
- hour = +(match[4]);
9545
- minute = +(match[5]);
9546
- second = +(match[6]);
9503
+ hour = +match[4];
9504
+ minute = +match[5];
9505
+ second = +match[6];
9547
9506
 
9548
9507
  if (match[7]) {
9549
9508
  fraction = match[7].slice(0, 3);
9550
- while (fraction.length < 3) { // milli-seconds
9509
+
9510
+ while (fraction.length < 3) {
9511
+ // milli-seconds
9551
9512
  fraction += '0';
9552
9513
  }
9514
+
9553
9515
  fraction = +fraction;
9554
- }
9516
+ } // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute
9555
9517
 
9556
- // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute
9557
9518
 
9558
9519
  if (match[9]) {
9559
- tz_hour = +(match[10]);
9520
+ tz_hour = +match[10];
9560
9521
  tz_minute = +(match[11] || 0);
9561
9522
  delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds
9523
+
9562
9524
  if (match[9] === '-') delta = -delta;
9563
9525
  }
9564
9526
 
9565
9527
  date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
9566
-
9567
9528
  if (delta) date.setTime(date.getTime() - delta);
9568
-
9569
9529
  return date;
9570
9530
  }
9571
9531
 
9572
- function representYamlTimestamp(object /*, style*/) {
9532
+ function representYamlTimestamp(object
9533
+ /*, style*/
9534
+ ) {
9573
9535
  return object.toISOString();
9574
9536
  }
9575
9537
 
@@ -9589,112 +9551,106 @@ var merge = new type('tag:yaml.org,2002:merge', {
9589
9551
  kind: 'scalar',
9590
9552
  resolve: resolveYamlMerge
9591
9553
  });
9592
-
9593
9554
  /*eslint-disable no-bitwise*/
9594
-
9595
-
9596
-
9597
-
9598
-
9599
9555
  // [ 64, 65, 66 ] -> [ padding, CR, LF ]
9600
- var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r';
9601
9556
 
9557
+ var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r';
9602
9558
 
9603
9559
  function resolveYamlBinary(data) {
9604
9560
  if (data === null) return false;
9561
+ var code,
9562
+ idx,
9563
+ bitlen = 0,
9564
+ max = data.length,
9565
+ map = BASE64_MAP; // Convert one by one.
9605
9566
 
9606
- var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP;
9607
-
9608
- // Convert one by one.
9609
9567
  for (idx = 0; idx < max; idx++) {
9610
- code = map.indexOf(data.charAt(idx));
9568
+ code = map.indexOf(data.charAt(idx)); // Skip CR/LF
9611
9569
 
9612
- // Skip CR/LF
9613
- if (code > 64) continue;
9570
+ if (code > 64) continue; // Fail on illegal characters
9614
9571
 
9615
- // Fail on illegal characters
9616
9572
  if (code < 0) return false;
9617
-
9618
9573
  bitlen += 6;
9619
- }
9574
+ } // If there are any bits left, source was corrupted
9620
9575
 
9621
- // If there are any bits left, source was corrupted
9622
- return (bitlen % 8) === 0;
9576
+
9577
+ return bitlen % 8 === 0;
9623
9578
  }
9624
9579
 
9625
9580
  function constructYamlBinary(data) {
9626
- var idx, tailbits,
9627
- input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan
9628
- max = input.length,
9581
+ var idx,
9582
+ tailbits,
9583
+ input = data.replace(/[\r\n=]/g, ''),
9584
+ // remove CR/LF & padding to simplify scan
9585
+ max = input.length,
9629
9586
  map = BASE64_MAP,
9630
9587
  bits = 0,
9631
- result = [];
9632
-
9633
- // Collect by 6*4 bits (3 bytes)
9588
+ result = []; // Collect by 6*4 bits (3 bytes)
9634
9589
 
9635
9590
  for (idx = 0; idx < max; idx++) {
9636
- if ((idx % 4 === 0) && idx) {
9637
- result.push((bits >> 16) & 0xFF);
9638
- result.push((bits >> 8) & 0xFF);
9591
+ if (idx % 4 === 0 && idx) {
9592
+ result.push(bits >> 16 & 0xFF);
9593
+ result.push(bits >> 8 & 0xFF);
9639
9594
  result.push(bits & 0xFF);
9640
9595
  }
9641
9596
 
9642
- bits = (bits << 6) | map.indexOf(input.charAt(idx));
9643
- }
9597
+ bits = bits << 6 | map.indexOf(input.charAt(idx));
9598
+ } // Dump tail
9644
9599
 
9645
- // Dump tail
9646
9600
 
9647
- tailbits = (max % 4) * 6;
9601
+ tailbits = max % 4 * 6;
9648
9602
 
9649
9603
  if (tailbits === 0) {
9650
- result.push((bits >> 16) & 0xFF);
9651
- result.push((bits >> 8) & 0xFF);
9604
+ result.push(bits >> 16 & 0xFF);
9605
+ result.push(bits >> 8 & 0xFF);
9652
9606
  result.push(bits & 0xFF);
9653
9607
  } else if (tailbits === 18) {
9654
- result.push((bits >> 10) & 0xFF);
9655
- result.push((bits >> 2) & 0xFF);
9608
+ result.push(bits >> 10 & 0xFF);
9609
+ result.push(bits >> 2 & 0xFF);
9656
9610
  } else if (tailbits === 12) {
9657
- result.push((bits >> 4) & 0xFF);
9611
+ result.push(bits >> 4 & 0xFF);
9658
9612
  }
9659
9613
 
9660
9614
  return new Uint8Array(result);
9661
9615
  }
9662
9616
 
9663
- function representYamlBinary(object /*, style*/) {
9664
- var result = '', bits = 0, idx, tail,
9617
+ function representYamlBinary(object
9618
+ /*, style*/
9619
+ ) {
9620
+ var result = '',
9621
+ bits = 0,
9622
+ idx,
9623
+ tail,
9665
9624
  max = object.length,
9666
- map = BASE64_MAP;
9667
-
9668
- // Convert every three bytes to 4 ASCII characters.
9625
+ map = BASE64_MAP; // Convert every three bytes to 4 ASCII characters.
9669
9626
 
9670
9627
  for (idx = 0; idx < max; idx++) {
9671
- if ((idx % 3 === 0) && idx) {
9672
- result += map[(bits >> 18) & 0x3F];
9673
- result += map[(bits >> 12) & 0x3F];
9674
- result += map[(bits >> 6) & 0x3F];
9628
+ if (idx % 3 === 0 && idx) {
9629
+ result += map[bits >> 18 & 0x3F];
9630
+ result += map[bits >> 12 & 0x3F];
9631
+ result += map[bits >> 6 & 0x3F];
9675
9632
  result += map[bits & 0x3F];
9676
9633
  }
9677
9634
 
9678
9635
  bits = (bits << 8) + object[idx];
9679
- }
9636
+ } // Dump tail
9680
9637
 
9681
- // Dump tail
9682
9638
 
9683
9639
  tail = max % 3;
9684
9640
 
9685
9641
  if (tail === 0) {
9686
- result += map[(bits >> 18) & 0x3F];
9687
- result += map[(bits >> 12) & 0x3F];
9688
- result += map[(bits >> 6) & 0x3F];
9642
+ result += map[bits >> 18 & 0x3F];
9643
+ result += map[bits >> 12 & 0x3F];
9644
+ result += map[bits >> 6 & 0x3F];
9689
9645
  result += map[bits & 0x3F];
9690
9646
  } else if (tail === 2) {
9691
- result += map[(bits >> 10) & 0x3F];
9692
- result += map[(bits >> 4) & 0x3F];
9693
- result += map[(bits << 2) & 0x3F];
9647
+ result += map[bits >> 10 & 0x3F];
9648
+ result += map[bits >> 4 & 0x3F];
9649
+ result += map[bits << 2 & 0x3F];
9694
9650
  result += map[64];
9695
9651
  } else if (tail === 1) {
9696
- result += map[(bits >> 2) & 0x3F];
9697
- result += map[(bits << 4) & 0x3F];
9652
+ result += map[bits >> 2 & 0x3F];
9653
+ result += map[bits << 4 & 0x3F];
9698
9654
  result += map[64];
9699
9655
  result += map[64];
9700
9656
  }
@@ -9703,7 +9659,7 @@ function representYamlBinary(object /*, style*/) {
9703
9659
  }
9704
9660
 
9705
9661
  function isBinary(obj) {
9706
- return Object.prototype.toString.call(obj) === '[object Uint8Array]';
9662
+ return Object.prototype.toString.call(obj) === '[object Uint8Array]';
9707
9663
  }
9708
9664
 
9709
9665
  var binary = new type('tag:yaml.org,2002:binary', {
@@ -9713,33 +9669,32 @@ var binary = new type('tag:yaml.org,2002:binary', {
9713
9669
  predicate: isBinary,
9714
9670
  represent: representYamlBinary
9715
9671
  });
9716
-
9717
9672
  var _hasOwnProperty$3 = Object.prototype.hasOwnProperty;
9718
- var _toString$2 = Object.prototype.toString;
9673
+ var _toString$2 = Object.prototype.toString;
9719
9674
 
9720
9675
  function resolveYamlOmap(data) {
9721
9676
  if (data === null) return true;
9722
-
9723
- var objectKeys = [], index, length, pair, pairKey, pairHasKey,
9677
+ var objectKeys = [],
9678
+ index,
9679
+ length,
9680
+ pair,
9681
+ pairKey,
9682
+ pairHasKey,
9724
9683
  object = data;
9725
9684
 
9726
9685
  for (index = 0, length = object.length; index < length; index += 1) {
9727
9686
  pair = object[index];
9728
9687
  pairHasKey = false;
9729
-
9730
9688
  if (_toString$2.call(pair) !== '[object Object]') return false;
9731
9689
 
9732
9690
  for (pairKey in pair) {
9733
9691
  if (_hasOwnProperty$3.call(pair, pairKey)) {
9734
- if (!pairHasKey) pairHasKey = true;
9735
- else return false;
9692
+ if (!pairHasKey) pairHasKey = true;else return false;
9736
9693
  }
9737
9694
  }
9738
9695
 
9739
9696
  if (!pairHasKey) return false;
9740
-
9741
- if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
9742
- else return false;
9697
+ if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);else return false;
9743
9698
  }
9744
9699
 
9745
9700
  return true;
@@ -9754,27 +9709,24 @@ var omap = new type('tag:yaml.org,2002:omap', {
9754
9709
  resolve: resolveYamlOmap,
9755
9710
  construct: constructYamlOmap
9756
9711
  });
9757
-
9758
9712
  var _toString$1 = Object.prototype.toString;
9759
9713
 
9760
9714
  function resolveYamlPairs(data) {
9761
9715
  if (data === null) return true;
9762
-
9763
- var index, length, pair, keys, result,
9716
+ var index,
9717
+ length,
9718
+ pair,
9719
+ keys,
9720
+ result,
9764
9721
  object = data;
9765
-
9766
9722
  result = new Array(object.length);
9767
9723
 
9768
9724
  for (index = 0, length = object.length; index < length; index += 1) {
9769
9725
  pair = object[index];
9770
-
9771
9726
  if (_toString$1.call(pair) !== '[object Object]') return false;
9772
-
9773
9727
  keys = Object.keys(pair);
9774
-
9775
9728
  if (keys.length !== 1) return false;
9776
-
9777
- result[index] = [ keys[0], pair[keys[0]] ];
9729
+ result[index] = [keys[0], pair[keys[0]]];
9778
9730
  }
9779
9731
 
9780
9732
  return true;
@@ -9782,18 +9734,18 @@ function resolveYamlPairs(data) {
9782
9734
 
9783
9735
  function constructYamlPairs(data) {
9784
9736
  if (data === null) return [];
9785
-
9786
- var index, length, pair, keys, result,
9737
+ var index,
9738
+ length,
9739
+ pair,
9740
+ keys,
9741
+ result,
9787
9742
  object = data;
9788
-
9789
9743
  result = new Array(object.length);
9790
9744
 
9791
9745
  for (index = 0, length = object.length; index < length; index += 1) {
9792
9746
  pair = object[index];
9793
-
9794
9747
  keys = Object.keys(pair);
9795
-
9796
- result[index] = [ keys[0], pair[keys[0]] ];
9748
+ result[index] = [keys[0], pair[keys[0]]];
9797
9749
  }
9798
9750
 
9799
9751
  return result;
@@ -9804,13 +9756,12 @@ var pairs = new type('tag:yaml.org,2002:pairs', {
9804
9756
  resolve: resolveYamlPairs,
9805
9757
  construct: constructYamlPairs
9806
9758
  });
9807
-
9808
9759
  var _hasOwnProperty$2 = Object.prototype.hasOwnProperty;
9809
9760
 
9810
9761
  function resolveYamlSet(data) {
9811
9762
  if (data === null) return true;
9812
-
9813
- var key, object = data;
9763
+ var key,
9764
+ object = data;
9814
9765
 
9815
9766
  for (key in object) {
9816
9767
  if (_hasOwnProperty$2.call(object, key)) {
@@ -9832,83 +9783,92 @@ var set = new type('tag:yaml.org,2002:set', {
9832
9783
  });
9833
9784
 
9834
9785
  var _default = core.extend({
9835
- implicit: [
9836
- timestamp,
9837
- merge
9838
- ],
9839
- explicit: [
9840
- binary,
9841
- omap,
9842
- pairs,
9843
- set
9844
- ]
9786
+ implicit: [timestamp, merge],
9787
+ explicit: [binary, omap, pairs, set]
9845
9788
  });
9846
-
9847
9789
  /*eslint-disable max-len,no-use-before-define*/
9848
9790
 
9849
9791
 
9850
-
9851
-
9852
-
9853
-
9854
-
9855
9792
  var _hasOwnProperty$1 = Object.prototype.hasOwnProperty;
9856
-
9857
-
9858
- var CONTEXT_FLOW_IN = 1;
9859
- var CONTEXT_FLOW_OUT = 2;
9860
- var CONTEXT_BLOCK_IN = 3;
9793
+ var CONTEXT_FLOW_IN = 1;
9794
+ var CONTEXT_FLOW_OUT = 2;
9795
+ var CONTEXT_BLOCK_IN = 3;
9861
9796
  var CONTEXT_BLOCK_OUT = 4;
9862
-
9863
-
9864
- var CHOMPING_CLIP = 1;
9797
+ var CHOMPING_CLIP = 1;
9865
9798
  var CHOMPING_STRIP = 2;
9866
- var CHOMPING_KEEP = 3;
9867
-
9868
-
9869
- var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
9799
+ var CHOMPING_KEEP = 3;
9800
+ var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
9870
9801
  var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
9871
- var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
9872
- var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
9873
- var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
9874
-
9802
+ var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
9803
+ var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
9804
+ var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
9875
9805
 
9876
- function _class(obj) { return Object.prototype.toString.call(obj); }
9806
+ function _class(obj) {
9807
+ return Object.prototype.toString.call(obj);
9808
+ }
9877
9809
 
9878
9810
  function is_EOL(c) {
9879
- return (c === 0x0A/* LF */) || (c === 0x0D/* CR */);
9811
+ return c === 0x0A
9812
+ /* LF */
9813
+ || c === 0x0D
9814
+ /* CR */
9815
+ ;
9880
9816
  }
9881
9817
 
9882
9818
  function is_WHITE_SPACE(c) {
9883
- return (c === 0x09/* Tab */) || (c === 0x20/* Space */);
9819
+ return c === 0x09
9820
+ /* Tab */
9821
+ || c === 0x20
9822
+ /* Space */
9823
+ ;
9884
9824
  }
9885
9825
 
9886
9826
  function is_WS_OR_EOL(c) {
9887
- return (c === 0x09/* Tab */) ||
9888
- (c === 0x20/* Space */) ||
9889
- (c === 0x0A/* LF */) ||
9890
- (c === 0x0D/* CR */);
9827
+ return c === 0x09
9828
+ /* Tab */
9829
+ || c === 0x20
9830
+ /* Space */
9831
+ || c === 0x0A
9832
+ /* LF */
9833
+ || c === 0x0D
9834
+ /* CR */
9835
+ ;
9891
9836
  }
9892
9837
 
9893
9838
  function is_FLOW_INDICATOR(c) {
9894
- return c === 0x2C/* , */ ||
9895
- c === 0x5B/* [ */ ||
9896
- c === 0x5D/* ] */ ||
9897
- c === 0x7B/* { */ ||
9898
- c === 0x7D/* } */;
9839
+ return c === 0x2C
9840
+ /* , */
9841
+ || c === 0x5B
9842
+ /* [ */
9843
+ || c === 0x5D
9844
+ /* ] */
9845
+ || c === 0x7B
9846
+ /* { */
9847
+ || c === 0x7D
9848
+ /* } */
9849
+ ;
9899
9850
  }
9900
9851
 
9901
9852
  function fromHexCode(c) {
9902
9853
  var lc;
9903
9854
 
9904
- if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {
9855
+ if (0x30
9856
+ /* 0 */
9857
+ <= c && c <= 0x39
9858
+ /* 9 */
9859
+ ) {
9905
9860
  return c - 0x30;
9906
9861
  }
9907
-
9908
9862
  /*eslint-disable no-bitwise*/
9863
+
9864
+
9909
9865
  lc = c | 0x20;
9910
9866
 
9911
- if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) {
9867
+ if (0x61
9868
+ /* a */
9869
+ <= lc && lc <= 0x66
9870
+ /* f */
9871
+ ) {
9912
9872
  return lc - 0x61 + 10;
9913
9873
  }
9914
9874
 
@@ -9916,14 +9876,33 @@ function fromHexCode(c) {
9916
9876
  }
9917
9877
 
9918
9878
  function escapedHexLen(c) {
9919
- if (c === 0x78/* x */) { return 2; }
9920
- if (c === 0x75/* u */) { return 4; }
9921
- if (c === 0x55/* U */) { return 8; }
9879
+ if (c === 0x78
9880
+ /* x */
9881
+ ) {
9882
+ return 2;
9883
+ }
9884
+
9885
+ if (c === 0x75
9886
+ /* u */
9887
+ ) {
9888
+ return 4;
9889
+ }
9890
+
9891
+ if (c === 0x55
9892
+ /* U */
9893
+ ) {
9894
+ return 8;
9895
+ }
9896
+
9922
9897
  return 0;
9923
9898
  }
9924
9899
 
9925
9900
  function fromDecimalCode(c) {
9926
- if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {
9901
+ if (0x30
9902
+ /* 0 */
9903
+ <= c && c <= 0x39
9904
+ /* 9 */
9905
+ ) {
9927
9906
  return c - 0x30;
9928
9907
  }
9929
9908
 
@@ -9932,74 +9911,85 @@ function fromDecimalCode(c) {
9932
9911
 
9933
9912
  function simpleEscapeSequence(c) {
9934
9913
  /* eslint-disable indent */
9935
- return (c === 0x30/* 0 */) ? '\x00' :
9936
- (c === 0x61/* a */) ? '\x07' :
9937
- (c === 0x62/* b */) ? '\x08' :
9938
- (c === 0x74/* t */) ? '\x09' :
9939
- (c === 0x09/* Tab */) ? '\x09' :
9940
- (c === 0x6E/* n */) ? '\x0A' :
9941
- (c === 0x76/* v */) ? '\x0B' :
9942
- (c === 0x66/* f */) ? '\x0C' :
9943
- (c === 0x72/* r */) ? '\x0D' :
9944
- (c === 0x65/* e */) ? '\x1B' :
9945
- (c === 0x20/* Space */) ? ' ' :
9946
- (c === 0x22/* " */) ? '\x22' :
9947
- (c === 0x2F/* / */) ? '/' :
9948
- (c === 0x5C/* \ */) ? '\x5C' :
9949
- (c === 0x4E/* N */) ? '\x85' :
9950
- (c === 0x5F/* _ */) ? '\xA0' :
9951
- (c === 0x4C/* L */) ? '\u2028' :
9952
- (c === 0x50/* P */) ? '\u2029' : '';
9914
+ return c === 0x30
9915
+ /* 0 */
9916
+ ? '\x00' : c === 0x61
9917
+ /* a */
9918
+ ? '\x07' : c === 0x62
9919
+ /* b */
9920
+ ? '\x08' : c === 0x74
9921
+ /* t */
9922
+ ? '\x09' : c === 0x09
9923
+ /* Tab */
9924
+ ? '\x09' : c === 0x6E
9925
+ /* n */
9926
+ ? '\x0A' : c === 0x76
9927
+ /* v */
9928
+ ? '\x0B' : c === 0x66
9929
+ /* f */
9930
+ ? '\x0C' : c === 0x72
9931
+ /* r */
9932
+ ? '\x0D' : c === 0x65
9933
+ /* e */
9934
+ ? '\x1B' : c === 0x20
9935
+ /* Space */
9936
+ ? ' ' : c === 0x22
9937
+ /* " */
9938
+ ? '\x22' : c === 0x2F
9939
+ /* / */
9940
+ ? '/' : c === 0x5C
9941
+ /* \ */
9942
+ ? '\x5C' : c === 0x4E
9943
+ /* N */
9944
+ ? '\x85' : c === 0x5F
9945
+ /* _ */
9946
+ ? '\xA0' : c === 0x4C
9947
+ /* L */
9948
+ ? '\u2028' : c === 0x50
9949
+ /* P */
9950
+ ? '\u2029' : '';
9953
9951
  }
9954
9952
 
9955
9953
  function charFromCodepoint(c) {
9956
9954
  if (c <= 0xFFFF) {
9957
9955
  return String.fromCharCode(c);
9958
- }
9959
- // Encode UTF-16 surrogate pair
9956
+ } // Encode UTF-16 surrogate pair
9960
9957
  // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF
9961
- return String.fromCharCode(
9962
- ((c - 0x010000) >> 10) + 0xD800,
9963
- ((c - 0x010000) & 0x03FF) + 0xDC00
9964
- );
9958
+
9959
+
9960
+ return String.fromCharCode((c - 0x010000 >> 10) + 0xD800, (c - 0x010000 & 0x03FF) + 0xDC00);
9965
9961
  }
9966
9962
 
9967
9963
  var simpleEscapeCheck = new Array(256); // integer, for fast access
9964
+
9968
9965
  var simpleEscapeMap = new Array(256);
9966
+
9969
9967
  for (var i = 0; i < 256; i++) {
9970
9968
  simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
9971
9969
  simpleEscapeMap[i] = simpleEscapeSequence(i);
9972
9970
  }
9973
9971
 
9974
-
9975
9972
  function State$1(input, options) {
9976
9973
  this.input = input;
9977
-
9978
- this.filename = options['filename'] || null;
9979
- this.schema = options['schema'] || _default;
9980
- this.onWarning = options['onWarning'] || null;
9981
- // (Hidden) Remove? makes the loader to expect YAML 1.1 documents
9974
+ this.filename = options['filename'] || null;
9975
+ this.schema = options['schema'] || _default;
9976
+ this.onWarning = options['onWarning'] || null; // (Hidden) Remove? makes the loader to expect YAML 1.1 documents
9982
9977
  // if such documents have no explicit %YAML directive
9983
- this.legacy = options['legacy'] || false;
9984
-
9985
- this.json = options['json'] || false;
9986
- this.listener = options['listener'] || null;
9987
9978
 
9979
+ this.legacy = options['legacy'] || false;
9980
+ this.json = options['json'] || false;
9981
+ this.listener = options['listener'] || null;
9988
9982
  this.implicitTypes = this.schema.compiledImplicit;
9989
- this.typeMap = this.schema.compiledTypeMap;
9990
-
9991
- this.length = input.length;
9992
- this.position = 0;
9993
- this.line = 0;
9994
- this.lineStart = 0;
9995
- this.lineIndent = 0;
9996
-
9997
- // position of first leading tab in the current line,
9983
+ this.typeMap = this.schema.compiledTypeMap;
9984
+ this.length = input.length;
9985
+ this.position = 0;
9986
+ this.line = 0;
9987
+ this.lineStart = 0;
9988
+ this.lineIndent = 0; // position of first leading tab in the current line,
9998
9989
  // used to make sure there are no tabs in the indentation
9999
- this.firstTabInLine = -1;
10000
9990
 
9991
+ this.firstTabInLine = -1;
10001
9992
  this.documents = [];
10002
-
10003
9993
  /*
10004
9994
  this.version;
10005
9995
  this.checkLineBreaks;
@@ -10009,21 +9999,18 @@ function State$1(input, options) {
10009
9999
  this.anchor;
10010
10000
  this.kind;
10011
10001
  this.result;*/
10012
-
10013
10002
  }
10014
10003
 
10015
-
10016
10004
  function generateError(state, message) {
10017
10005
  var mark = {
10018
- name: state.filename,
10019
- buffer: state.input.slice(0, -1), // omit trailing \0
10006
+ name: state.filename,
10007
+ buffer: state.input.slice(0, -1),
10008
+ // omit trailing \0
10020
10009
  position: state.position,
10021
- line: state.line,
10022
- column: state.position - state.lineStart
10010
+ line: state.line,
10011
+ column: state.position - state.lineStart
10023
10012
  };
10024
-
10025
10013
  mark.snippet = snippet(mark);
10026
-
10027
10014
  return new exception(message, mark);
10028
10015
  }
10029
10016
 
@@ -10037,11 +10024,8 @@ function throwWarning(state, message) {
10037
10024
  }
10038
10025
  }
10039
10026
 
10040
-
10041
10027
  var directiveHandlers = {
10042
-
10043
10028
  YAML: function handleYamlDirective(state, name, args) {
10044
-
10045
10029
  var match, major, minor;
10046
10030
 
10047
10031
  if (state.version !== null) {
@@ -10066,15 +10050,13 @@ var directiveHandlers = {
10066
10050
  }
10067
10051
 
10068
10052
  state.version = args[0];
10069
- state.checkLineBreaks = (minor < 2);
10053
+ state.checkLineBreaks = minor < 2;
10070
10054
 
10071
10055
  if (minor !== 1 && minor !== 2) {
10072
10056
  throwWarning(state, 'unsupported YAML version of the document');
10073
10057
  }
10074
10058
  },
10075
-
10076
10059
  TAG: function handleTagDirective(state, name, args) {
10077
-
10078
10060
  var handle, prefix;
10079
10061
 
10080
10062
  if (args.length !== 2) {
@@ -10106,7 +10088,6 @@ var directiveHandlers = {
10106
10088
  }
10107
10089
  };
10108
10090
 
10109
-
10110
10091
  function captureSegment(state, start, end, checkJson) {
10111
10092
  var _position, _length, _character, _result;
10112
10093
 
@@ -10116,8 +10097,8 @@ function captureSegment(state, start, end, checkJson) {
10116
10097
  if (checkJson) {
10117
10098
  for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
10118
10099
  _character = _result.charCodeAt(_position);
10119
- if (!(_character === 0x09 ||
10120
- (0x20 <= _character && _character <= 0x10FFFF))) {
10100
+
10101
+ if (!(_character === 0x09 || 0x20 <= _character && _character <= 0x10FFFF)) {
10121
10102
  throwError(state, 'expected valid JSON character');
10122
10103
  }
10123
10104
  }
@@ -10148,14 +10129,11 @@ function mergeMappings(state, destination, source, overridableKeys) {
10148
10129
  }
10149
10130
  }
10150
10131
 
10151
- function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode,
10152
- startLine, startLineStart, startPos) {
10153
-
10154
- var index, quantity;
10155
-
10156
- // The output is a plain object here, so keys can only be strings.
10132
+ function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startLineStart, startPos) {
10133
+ var index, quantity; // The output is a plain object here, so keys can only be strings.
10157
10134
  // We need to convert keyNode to a string, but doing so can hang the process
10158
10135
  // (deeply nested arrays that explode exponentially using aliases).
10136
+
10159
10137
  if (Array.isArray(keyNode)) {
10160
10138
  keyNode = Array.prototype.slice.call(keyNode);
10161
10139
 
@@ -10168,16 +10146,15 @@ function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valu
10168
10146
  keyNode[index] = '[object Object]';
10169
10147
  }
10170
10148
  }
10171
- }
10172
-
10173
- // Avoid code execution in load() via toString property
10149
+ } // Avoid code execution in load() via toString property
10174
10150
  // (still use its own toString for arrays, timestamps,
10175
10151
  // and whatever user schema extensions happen to have @@toStringTag)
10152
+
10153
+
10176
10154
  if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') {
10177
10155
  keyNode = '[object Object]';
10178
10156
  }
10179
10157
 
10180
-
10181
10158
  keyNode = String(keyNode);
10182
10159
 
10183
10160
  if (_result === null) {
@@ -10193,16 +10170,14 @@ function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valu
10193
10170
  mergeMappings(state, _result, valueNode, overridableKeys);
10194
10171
  }
10195
10172
  } else {
10196
- if (!state.json &&
10197
- !_hasOwnProperty$1.call(overridableKeys, keyNode) &&
10198
- _hasOwnProperty$1.call(_result, keyNode)) {
10173
+ if (!state.json && !_hasOwnProperty$1.call(overridableKeys, keyNode) && _hasOwnProperty$1.call(_result, keyNode)) {
10199
10174
  state.line = startLine || state.line;
10200
10175
  state.lineStart = startLineStart || state.lineStart;
10201
10176
  state.position = startPos || state.position;
10202
10177
  throwError(state, 'duplicated mapping key');
10203
- }
10178
+ } // used for this specific key only because Object.defineProperty is slow
10179
+
10204
10180
 
10205
- // used for this specific key only because Object.defineProperty is slow
10206
10181
  if (keyNode === '__proto__') {
10207
10182
  Object.defineProperty(_result, keyNode, {
10208
10183
  configurable: true,
@@ -10213,6 +10188,7 @@ function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valu
10213
10188
  } else {
10214
10189
  _result[keyNode] = valueNode;
10215
10190
  }
10191
+
10216
10192
  delete overridableKeys[keyNode];
10217
10193
  }
10218
10194
 
@@ -10221,14 +10197,20 @@ function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valu
10221
10197
 
10222
10198
  function readLineBreak(state) {
10223
10199
  var ch;
10224
-
10225
10200
  ch = state.input.charCodeAt(state.position);
10226
10201
 
10227
- if (ch === 0x0A/* LF */) {
10202
+ if (ch === 0x0A
10203
+ /* LF */
10204
+ ) {
10228
10205
  state.position++;
10229
- } else if (ch === 0x0D/* CR */) {
10206
+ } else if (ch === 0x0D
10207
+ /* CR */
10208
+ ) {
10230
10209
  state.position++;
10231
- if (state.input.charCodeAt(state.position) === 0x0A/* LF */) {
10210
+
10211
+ if (state.input.charCodeAt(state.position) === 0x0A
10212
+ /* LF */
10213
+ ) {
10232
10214
  state.position++;
10233
10215
  }
10234
10216
  } else {
@@ -10246,26 +10228,36 @@ function skipSeparationSpace(state, allowComments, checkIndent) {
10246
10228
 
10247
10229
  while (ch !== 0) {
10248
10230
  while (is_WHITE_SPACE(ch)) {
10249
- if (ch === 0x09/* Tab */ && state.firstTabInLine === -1) {
10231
+ if (ch === 0x09
10232
+ /* Tab */
10233
+ && state.firstTabInLine === -1) {
10250
10234
  state.firstTabInLine = state.position;
10251
10235
  }
10236
+
10252
10237
  ch = state.input.charCodeAt(++state.position);
10253
10238
  }
10254
10239
 
10255
- if (allowComments && ch === 0x23/* # */) {
10240
+ if (allowComments && ch === 0x23
10241
+ /* # */
10242
+ ) {
10256
10243
  do {
10257
10244
  ch = state.input.charCodeAt(++state.position);
10258
- } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0);
10245
+ } while (ch !== 0x0A
10246
+ /* LF */
10247
+ && ch !== 0x0D
10248
+ /* CR */
10249
+ && ch !== 0);
10259
10250
  }
10260
10251
 
10261
10252
  if (is_EOL(ch)) {
10262
10253
  readLineBreak(state);
10263
-
10264
10254
  ch = state.input.charCodeAt(state.position);
10265
10255
  lineBreaks++;
10266
10256
  state.lineIndent = 0;
10267
10257
 
10268
- while (ch === 0x20/* Space */) {
10258
+ while (ch === 0x20
10259
+ /* Space */
10260
+ ) {
10269
10261
  state.lineIndent++;
10270
10262
  ch = state.input.charCodeAt(++state.position);
10271
10263
  }
@@ -10284,17 +10276,15 @@ function skipSeparationSpace(state, allowComments, checkIndent) {
10284
10276
  function testDocumentSeparator(state) {
10285
10277
  var _position = state.position,
10286
10278
  ch;
10287
-
10288
- ch = state.input.charCodeAt(_position);
10289
-
10290
- // Condition state.position === state.lineStart is tested
10279
+ ch = state.input.charCodeAt(_position); // Condition state.position === state.lineStart is tested
10291
10280
  // in parent on each call, for efficiency. No needs to test here again.
10292
- if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) &&
10293
- ch === state.input.charCodeAt(_position + 1) &&
10294
- ch === state.input.charCodeAt(_position + 2)) {
10295
10281
 
10282
+ if ((ch === 0x2D
10283
+ /* - */
10284
+ || ch === 0x2E
10285
+ /* . */
10286
+ ) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) {
10296
10287
  _position += 3;
10297
-
10298
10288
  ch = state.input.charCodeAt(_position);
10299
10289
 
10300
10290
  if (ch === 0 || is_WS_OR_EOL(ch)) {
@@ -10313,7 +10303,6 @@ function writeFoldedLines(state, count) {
10313
10303
  }
10314
10304
  }
10315
10305
 
10316
-
10317
10306
  function readPlainScalar(state, nodeIndent, withinFlowCollection) {
10318
10307
  var preceding,
10319
10308
  following,
@@ -10329,27 +10318,40 @@ function readPlainScalar(state, nodeIndent, withinFlowCollection) {
10329
10318
 
10330
10319
  ch = state.input.charCodeAt(state.position);
10331
10320
 
10332
- if (is_WS_OR_EOL(ch) ||
10333
- is_FLOW_INDICATOR(ch) ||
10334
- ch === 0x23/* # */ ||
10335
- ch === 0x26/* & */ ||
10336
- ch === 0x2A/* * */ ||
10337
- ch === 0x21/* ! */ ||
10338
- ch === 0x7C/* | */ ||
10339
- ch === 0x3E/* > */ ||
10340
- ch === 0x27/* ' */ ||
10341
- ch === 0x22/* " */ ||
10342
- ch === 0x25/* % */ ||
10343
- ch === 0x40/* @ */ ||
10344
- ch === 0x60/* ` */) {
10321
+ if (is_WS_OR_EOL(ch) || is_FLOW_INDICATOR(ch) || ch === 0x23
10322
+ /* # */
10323
+ || ch === 0x26
10324
+ /* & */
10325
+ || ch === 0x2A
10326
+ /* * */
10327
+ || ch === 0x21
10328
+ /* ! */
10329
+ || ch === 0x7C
10330
+ /* | */
10331
+ || ch === 0x3E
10332
+ /* > */
10333
+ || ch === 0x27
10334
+ /* ' */
10335
+ || ch === 0x22
10336
+ /* " */
10337
+ || ch === 0x25
10338
+ /* % */
10339
+ || ch === 0x40
10340
+ /* @ */
10341
+ || ch === 0x60
10342
+ /* ` */
10343
+ ) {
10345
10344
  return false;
10346
10345
  }
10347
10346
 
10348
- if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) {
10347
+ if (ch === 0x3F
10348
+ /* ? */
10349
+ || ch === 0x2D
10350
+ /* - */
10351
+ ) {
10349
10352
  following = state.input.charCodeAt(state.position + 1);
10350
10353
 
10351
- if (is_WS_OR_EOL(following) ||
10352
- withinFlowCollection && is_FLOW_INDICATOR(following)) {
10354
+ if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
10353
10355
  return false;
10354
10356
  }
10355
10357
  }
@@ -10360,25 +10362,24 @@ function readPlainScalar(state, nodeIndent, withinFlowCollection) {
10360
10362
  hasPendingContent = false;
10361
10363
 
10362
10364
  while (ch !== 0) {
10363
- if (ch === 0x3A/* : */) {
10365
+ if (ch === 0x3A
10366
+ /* : */
10367
+ ) {
10364
10368
  following = state.input.charCodeAt(state.position + 1);
10365
10369
 
10366
- if (is_WS_OR_EOL(following) ||
10367
- withinFlowCollection && is_FLOW_INDICATOR(following)) {
10370
+ if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
10368
10371
  break;
10369
10372
  }
10370
-
10371
- } else if (ch === 0x23/* # */) {
10373
+ } else if (ch === 0x23
10374
+ /* # */
10375
+ ) {
10372
10376
  preceding = state.input.charCodeAt(state.position - 1);
10373
10377
 
10374
10378
  if (is_WS_OR_EOL(preceding)) {
10375
10379
  break;
10376
10380
  }
10377
-
10378
- } else if ((state.position === state.lineStart && testDocumentSeparator(state)) ||
10379
- withinFlowCollection && is_FLOW_INDICATOR(ch)) {
10381
+ } else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && is_FLOW_INDICATOR(ch)) {
10380
10382
  break;
10381
-
10382
10383
  } else if (is_EOL(ch)) {
10383
10384
  _line = state.line;
10384
10385
  _lineStart = state.lineStart;
@@ -10424,12 +10425,12 @@ function readPlainScalar(state, nodeIndent, withinFlowCollection) {
10424
10425
  }
10425
10426
 
10426
10427
  function readSingleQuotedScalar(state, nodeIndent) {
10427
- var ch,
10428
- captureStart, captureEnd;
10429
-
10428
+ var ch, captureStart, captureEnd;
10430
10429
  ch = state.input.charCodeAt(state.position);
10431
10430
 
10432
- if (ch !== 0x27/* ' */) {
10431
+ if (ch !== 0x27
10432
+ /* ' */
10433
+ ) {
10433
10434
  return false;
10434
10435
  }
10435
10436
 
@@ -10439,26 +10440,27 @@ function readSingleQuotedScalar(state, nodeIndent) {
10439
10440
  captureStart = captureEnd = state.position;
10440
10441
 
10441
10442
  while ((ch = state.input.charCodeAt(state.position)) !== 0) {
10442
- if (ch === 0x27/* ' */) {
10443
+ if (ch === 0x27
10444
+ /* ' */
10445
+ ) {
10443
10446
  captureSegment(state, captureStart, state.position, true);
10444
10447
  ch = state.input.charCodeAt(++state.position);
10445
10448
 
10446
- if (ch === 0x27/* ' */) {
10449
+ if (ch === 0x27
10450
+ /* ' */
10451
+ ) {
10447
10452
  captureStart = state.position;
10448
10453
  state.position++;
10449
10454
  captureEnd = state.position;
10450
10455
  } else {
10451
10456
  return true;
10452
10457
  }
10453
-
10454
10458
  } else if (is_EOL(ch)) {
10455
10459
  captureSegment(state, captureStart, captureEnd, true);
10456
10460
  writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
10457
10461
  captureStart = captureEnd = state.position;
10458
-
10459
10462
  } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
10460
10463
  throwError(state, 'unexpected end of the document within a single quoted scalar');
10461
-
10462
10464
  } else {
10463
10465
  state.position++;
10464
10466
  captureEnd = state.position;
@@ -10469,16 +10471,12 @@ function readSingleQuotedScalar(state, nodeIndent) {
10469
10471
  }
10470
10472
 
10471
10473
  function readDoubleQuotedScalar(state, nodeIndent) {
10472
- var captureStart,
10473
- captureEnd,
10474
- hexLength,
10475
- hexResult,
10476
- tmp,
10477
- ch;
10478
-
10474
+ var captureStart, captureEnd, hexLength, hexResult, tmp, ch;
10479
10475
  ch = state.input.charCodeAt(state.position);
10480
10476
 
10481
- if (ch !== 0x22/* " */) {
10477
+ if (ch !== 0x22
10478
+ /* " */
10479
+ ) {
10482
10480
  return false;
10483
10481
  }
10484
10482
 
@@ -10488,23 +10486,23 @@ function readDoubleQuotedScalar(state, nodeIndent) {
10488
10486
  captureStart = captureEnd = state.position;
10489
10487
 
10490
10488
  while ((ch = state.input.charCodeAt(state.position)) !== 0) {
10491
- if (ch === 0x22/* " */) {
10489
+ if (ch === 0x22
10490
+ /* " */
10491
+ ) {
10492
10492
  captureSegment(state, captureStart, state.position, true);
10493
10493
  state.position++;
10494
10494
  return true;
10495
-
10496
- } else if (ch === 0x5C/* \ */) {
10495
+ } else if (ch === 0x5C
10496
+ /* \ */
10497
+ ) {
10497
10498
  captureSegment(state, captureStart, state.position, true);
10498
10499
  ch = state.input.charCodeAt(++state.position);
10499
10500
 
10500
10501
  if (is_EOL(ch)) {
10501
- skipSeparationSpace(state, false, nodeIndent);
10502
-
10503
- // TODO: rework to inline fn with no type cast?
10502
+ skipSeparationSpace(state, false, nodeIndent); // TODO: rework to inline fn with no type cast?
10504
10503
  } else if (ch < 256 && simpleEscapeCheck[ch]) {
10505
10504
  state.result += simpleEscapeMap[ch];
10506
10505
  state.position++;
10507
-
10508
10506
  } else if ((tmp = escapedHexLen(ch)) > 0) {
10509
10507
  hexLength = tmp;
10510
10508
  hexResult = 0;
@@ -10514,30 +10512,24 @@ function readDoubleQuotedScalar(state, nodeIndent) {
10514
10512
 
10515
10513
  if ((tmp = fromHexCode(ch)) >= 0) {
10516
10514
  hexResult = (hexResult << 4) + tmp;
10517
-
10518
10515
  } else {
10519
10516
  throwError(state, 'expected hexadecimal character');
10520
10517
  }
10521
10518
  }
10522
10519
 
10523
10520
  state.result += charFromCodepoint(hexResult);
10524
-
10525
10521
  state.position++;
10526
-
10527
10522
  } else {
10528
10523
  throwError(state, 'unknown escape sequence');
10529
10524
  }
10530
10525
 
10531
10526
  captureStart = captureEnd = state.position;
10532
-
10533
10527
  } else if (is_EOL(ch)) {
10534
10528
  captureSegment(state, captureStart, captureEnd, true);
10535
10529
  writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
10536
10530
  captureStart = captureEnd = state.position;
10537
-
10538
10531
  } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
10539
10532
  throwError(state, 'unexpected end of the document within a double quoted scalar');
10540
-
10541
10533
  } else {
10542
10534
  state.position++;
10543
10535
  captureEnd = state.position;
@@ -10552,9 +10544,9 @@ function readFlowCollection(state, nodeIndent) {
10552
10544
  _line,
10553
10545
  _lineStart,
10554
10546
  _pos,
10555
- _tag = state.tag,
10547
+ _tag = state.tag,
10556
10548
  _result,
10557
- _anchor = state.anchor,
10549
+ _anchor = state.anchor,
10558
10550
  following,
10559
10551
  terminator,
10560
10552
  isPair,
@@ -10568,12 +10560,20 @@ function readFlowCollection(state, nodeIndent) {
10568
10560
 
10569
10561
  ch = state.input.charCodeAt(state.position);
10570
10562
 
10571
- if (ch === 0x5B/* [ */) {
10572
- terminator = 0x5D;/* ] */
10563
+ if (ch === 0x5B
10564
+ /* [ */
10565
+ ) {
10566
+ terminator = 0x5D;
10567
+ /* ] */
10568
+
10573
10569
  isMapping = false;
10574
10570
  _result = [];
10575
- } else if (ch === 0x7B/* { */) {
10576
- terminator = 0x7D;/* } */
10571
+ } else if (ch === 0x7B
10572
+ /* { */
10573
+ ) {
10574
+ terminator = 0x7D;
10575
+ /* } */
10576
+
10577
10577
  isMapping = true;
10578
10578
  _result = {};
10579
10579
  } else {
@@ -10588,7 +10588,6 @@ function readFlowCollection(state, nodeIndent) {
10588
10588
 
10589
10589
  while (ch !== 0) {
10590
10590
  skipSeparationSpace(state, true, nodeIndent);
10591
-
10592
10591
  ch = state.input.charCodeAt(state.position);
10593
10592
 
10594
10593
  if (ch === terminator) {
@@ -10600,7 +10599,9 @@ function readFlowCollection(state, nodeIndent) {
10600
10599
  return true;
10601
10600
  } else if (!readNext) {
10602
10601
  throwError(state, 'missed comma between flow collection entries');
10603
- } else if (ch === 0x2C/* , */) {
10602
+ } else if (ch === 0x2C
10603
+ /* , */
10604
+ ) {
10604
10605
  // "flow collection entries can never be completely empty", as per YAML 1.2, section 7.4
10605
10606
  throwError(state, "expected the node content, but found ','");
10606
10607
  }
@@ -10608,7 +10609,9 @@ function readFlowCollection(state, nodeIndent) {
10608
10609
  keyTag = keyNode = valueNode = null;
10609
10610
  isPair = isExplicitPair = false;
10610
10611
 
10611
- if (ch === 0x3F/* ? */) {
10612
+ if (ch === 0x3F
10613
+ /* ? */
10614
+ ) {
10612
10615
  following = state.input.charCodeAt(state.position + 1);
10613
10616
 
10614
10617
  if (is_WS_OR_EOL(following)) {
@@ -10619,16 +10622,18 @@ function readFlowCollection(state, nodeIndent) {
10619
10622
  }
10620
10623
 
10621
10624
  _line = state.line; // Save the current line.
10625
+
10622
10626
  _lineStart = state.lineStart;
10623
10627
  _pos = state.position;
10624
10628
  composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
10625
10629
  keyTag = state.tag;
10626
10630
  keyNode = state.result;
10627
10631
  skipSeparationSpace(state, true, nodeIndent);
10628
-
10629
10632
  ch = state.input.charCodeAt(state.position);
10630
10633
 
10631
- if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) {
10634
+ if ((isExplicitPair || state.line === _line) && ch === 0x3A
10635
+ /* : */
10636
+ ) {
10632
10637
  isPair = true;
10633
10638
  ch = state.input.charCodeAt(++state.position);
10634
10639
  skipSeparationSpace(state, true, nodeIndent);
@@ -10645,10 +10650,11 @@ function readFlowCollection(state, nodeIndent) {
10645
10650
  }
10646
10651
 
10647
10652
  skipSeparationSpace(state, true, nodeIndent);
10648
-
10649
10653
  ch = state.input.charCodeAt(state.position);
10650
10654
 
10651
- if (ch === 0x2C/* , */) {
10655
+ if (ch === 0x2C
10656
+ /* , */
10657
+ ) {
10652
10658
  readNext = true;
10653
10659
  ch = state.input.charCodeAt(++state.position);
10654
10660
  } else {
@@ -10662,20 +10668,23 @@ function readFlowCollection(state, nodeIndent) {
10662
10668
  function readBlockScalar(state, nodeIndent) {
10663
10669
  var captureStart,
10664
10670
  folding,
10665
- chomping = CHOMPING_CLIP,
10671
+ chomping = CHOMPING_CLIP,
10666
10672
  didReadContent = false,
10667
10673
  detectedIndent = false,
10668
- textIndent = nodeIndent,
10669
- emptyLines = 0,
10674
+ textIndent = nodeIndent,
10675
+ emptyLines = 0,
10670
10676
  atMoreIndented = false,
10671
10677
  tmp,
10672
10678
  ch;
10673
-
10674
10679
  ch = state.input.charCodeAt(state.position);
10675
10680
 
10676
- if (ch === 0x7C/* | */) {
10681
+ if (ch === 0x7C
10682
+ /* | */
10683
+ ) {
10677
10684
  folding = false;
10678
- } else if (ch === 0x3E/* > */) {
10685
+ } else if (ch === 0x3E
10686
+ /* > */
10687
+ ) {
10679
10688
  folding = true;
10680
10689
  } else {
10681
10690
  return false;
@@ -10687,13 +10696,18 @@ function readBlockScalar(state, nodeIndent) {
10687
10696
  while (ch !== 0) {
10688
10697
  ch = state.input.charCodeAt(++state.position);
10689
10698
 
10690
- if (ch === 0x2B/* + */ || ch === 0x2D/* - */) {
10699
+ if (ch === 0x2B
10700
+ /* + */
10701
+ || ch === 0x2D
10702
+ /* - */
10703
+ ) {
10691
10704
  if (CHOMPING_CLIP === chomping) {
10692
- chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP;
10705
+ chomping = ch === 0x2B
10706
+ /* + */
10707
+ ? CHOMPING_KEEP : CHOMPING_STRIP;
10693
10708
  } else {
10694
10709
  throwError(state, 'repeat of a chomping mode identifier');
10695
10710
  }
10696
-
10697
10711
  } else if ((tmp = fromDecimalCode(ch)) >= 0) {
10698
10712
  if (tmp === 0) {
10699
10713
  throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one');
@@ -10703,30 +10717,33 @@ function readBlockScalar(state, nodeIndent) {
10703
10717
  } else {
10704
10718
  throwError(state, 'repeat of an indentation width identifier');
10705
10719
  }
10706
-
10707
10720
  } else {
10708
10721
  break;
10709
10722
  }
10710
10723
  }
10711
10724
 
10712
10725
  if (is_WHITE_SPACE(ch)) {
10713
- do { ch = state.input.charCodeAt(++state.position); }
10714
- while (is_WHITE_SPACE(ch));
10726
+ do {
10727
+ ch = state.input.charCodeAt(++state.position);
10728
+ } while (is_WHITE_SPACE(ch));
10715
10729
 
10716
- if (ch === 0x23/* # */) {
10717
- do { ch = state.input.charCodeAt(++state.position); }
10718
- while (!is_EOL(ch) && (ch !== 0));
10730
+ if (ch === 0x23
10731
+ /* # */
10732
+ ) {
10733
+ do {
10734
+ ch = state.input.charCodeAt(++state.position);
10735
+ } while (!is_EOL(ch) && ch !== 0);
10719
10736
  }
10720
10737
  }
10721
10738
 
10722
10739
  while (ch !== 0) {
10723
10740
  readLineBreak(state);
10724
10741
  state.lineIndent = 0;
10725
-
10726
10742
  ch = state.input.charCodeAt(state.position);
10727
10743
 
10728
- while ((!detectedIndent || state.lineIndent < textIndent) &&
10729
- (ch === 0x20/* Space */)) {
10744
+ while ((!detectedIndent || state.lineIndent < textIndent) && ch === 0x20
10745
+ /* Space */
10746
+ ) {
10730
10747
  state.lineIndent++;
10731
10748
  ch = state.input.charCodeAt(++state.position);
10732
10749
  }
@@ -10738,50 +10755,44 @@ function readBlockScalar(state, nodeIndent) {
10738
10755
  if (is_EOL(ch)) {
10739
10756
  emptyLines++;
10740
10757
  continue;
10741
- }
10758
+ } // End of the scalar.
10742
10759
 
10743
- // End of the scalar.
10744
- if (state.lineIndent < textIndent) {
10745
10760
 
10761
+ if (state.lineIndent < textIndent) {
10746
10762
  // Perform the chomping.
10747
10763
  if (chomping === CHOMPING_KEEP) {
10748
10764
  state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
10749
10765
  } else if (chomping === CHOMPING_CLIP) {
10750
- if (didReadContent) { // i.e. only if the scalar is not empty.
10766
+ if (didReadContent) {
10767
+ // i.e. only if the scalar is not empty.
10751
10768
  state.result += '\n';
10752
10769
  }
10753
- }
10770
+ } // Break this `while` cycle and go to the funciton's epilogue.
10771
+
10754
10772
 
10755
- // Break this `while` cycle and go to the funciton's epilogue.
10756
10773
  break;
10757
- }
10774
+ } // Folded style: use fancy rules to handle line breaks.
10758
10775
 
10759
- // Folded style: use fancy rules to handle line breaks.
10760
- if (folding) {
10761
10776
 
10777
+ if (folding) {
10762
10778
  // Lines starting with white space characters (more-indented lines) are not folded.
10763
10779
  if (is_WHITE_SPACE(ch)) {
10764
- atMoreIndented = true;
10765
- // except for the first content line (cf. Example 8.1)
10766
- state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
10780
+ atMoreIndented = true; // except for the first content line (cf. Example 8.1)
10767
10781
 
10768
- // End of more-indented block.
10782
+ state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); // End of more-indented block.
10769
10783
  } else if (atMoreIndented) {
10770
10784
  atMoreIndented = false;
10771
- state.result += common.repeat('\n', emptyLines + 1);
10772
-
10773
- // Just one line break - perceive as the same line.
10785
+ state.result += common.repeat('\n', emptyLines + 1); // Just one line break - perceive as the same line.
10774
10786
  } else if (emptyLines === 0) {
10775
- if (didReadContent) { // i.e. only if we have already read some scalar content.
10787
+ if (didReadContent) {
10788
+ // i.e. only if we have already read some scalar content.
10776
10789
  state.result += ' ';
10777
- }
10790
+ } // Several line breaks - perceive as different lines.
10778
10791
 
10779
- // Several line breaks - perceive as different lines.
10780
10792
  } else {
10781
10793
  state.result += common.repeat('\n', emptyLines);
10782
- }
10794
+ } // Literal style: just add exact number of line breaks between content lines.
10783
10795
 
10784
- // Literal style: just add exact number of line breaks between content lines.
10785
10796
  } else {
10786
10797
  // Keep all line breaks except the header line break.
10787
10798
  state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
@@ -10792,7 +10803,7 @@ function readBlockScalar(state, nodeIndent) {
10792
10803
  emptyLines = 0;
10793
10804
  captureStart = state.position;
10794
10805
 
10795
- while (!is_EOL(ch) && (ch !== 0)) {
10806
+ while (!is_EOL(ch) && ch !== 0) {
10796
10807
  ch = state.input.charCodeAt(++state.position);
10797
10808
  }
10798
10809
 
@@ -10804,15 +10815,15 @@ function readBlockScalar(state, nodeIndent) {
10804
10815
 
10805
10816
  function readBlockSequence(state, nodeIndent) {
10806
10817
  var _line,
10807
- _tag = state.tag,
10808
- _anchor = state.anchor,
10809
- _result = [],
10818
+ _tag = state.tag,
10819
+ _anchor = state.anchor,
10820
+ _result = [],
10810
10821
  following,
10811
- detected = false,
10812
- ch;
10813
-
10814
- // there is a leading tab before this token, so it can't be a block sequence/mapping;
10822
+ detected = false,
10823
+ ch; // there is a leading tab before this token, so it can't be a block sequence/mapping;
10815
10824
  // it can still be flow sequence/mapping or a scalar
10825
+
10826
+
10816
10827
  if (state.firstTabInLine !== -1) return false;
10817
10828
 
10818
10829
  if (state.anchor !== null) {
@@ -10827,7 +10838,9 @@ function readBlockSequence(state, nodeIndent) {
10827
10838
  throwError(state, 'tab characters must not be used in indentation');
10828
10839
  }
10829
10840
 
10830
- if (ch !== 0x2D/* - */) {
10841
+ if (ch !== 0x2D
10842
+ /* - */
10843
+ ) {
10831
10844
  break;
10832
10845
  }
10833
10846
 
@@ -10843,6 +10856,7 @@ function readBlockSequence(state, nodeIndent) {
10843
10856
  if (skipSeparationSpace(state, true, -1)) {
10844
10857
  if (state.lineIndent <= nodeIndent) {
10845
10858
  _result.push(null);
10859
+
10846
10860
  ch = state.input.charCodeAt(state.position);
10847
10861
  continue;
10848
10862
  }
@@ -10850,12 +10864,13 @@ function readBlockSequence(state, nodeIndent) {
10850
10864
 
10851
10865
  _line = state.line;
10852
10866
  composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
10867
+
10853
10868
  _result.push(state.result);
10854
- skipSeparationSpace(state, true, -1);
10855
10869
 
10870
+ skipSeparationSpace(state, true, -1);
10856
10871
  ch = state.input.charCodeAt(state.position);
10857
10872
 
10858
- if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) {
10873
+ if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
10859
10874
  throwError(state, 'bad indentation of a sequence entry');
10860
10875
  } else if (state.lineIndent < nodeIndent) {
10861
10876
  break;
@@ -10869,6 +10884,7 @@ function readBlockSequence(state, nodeIndent) {
10869
10884
  state.result = _result;
10870
10885
  return true;
10871
10886
  }
10887
+
10872
10888
  return false;
10873
10889
  }
10874
10890
 
@@ -10879,19 +10895,19 @@ function readBlockMapping(state, nodeIndent, flowIndent) {
10879
10895
  _keyLine,
10880
10896
  _keyLineStart,
10881
10897
  _keyPos,
10882
- _tag = state.tag,
10883
- _anchor = state.anchor,
10884
- _result = {},
10898
+ _tag = state.tag,
10899
+ _anchor = state.anchor,
10900
+ _result = {},
10885
10901
  overridableKeys = Object.create(null),
10886
- keyTag = null,
10887
- keyNode = null,
10888
- valueNode = null,
10902
+ keyTag = null,
10903
+ keyNode = null,
10904
+ valueNode = null,
10889
10905
  atExplicitKey = false,
10890
- detected = false,
10891
- ch;
10892
-
10893
- // there is a leading tab before this token, so it can't be a block sequence/mapping;
10906
+ detected = false,
10907
+ ch; // there is a leading tab before this token, so it can't be a block sequence/mapping;
10894
10908
  // it can still be flow sequence/mapping or a scalar
10909
+
10910
+
10895
10911
  if (state.firstTabInLine !== -1) return false;
10896
10912
 
10897
10913
  if (state.anchor !== null) {
@@ -10908,14 +10924,19 @@ function readBlockMapping(state, nodeIndent, flowIndent) {
10908
10924
 
10909
10925
  following = state.input.charCodeAt(state.position + 1);
10910
10926
  _line = state.line; // Save the current line.
10911
-
10912
10927
  //
10913
10928
  // Explicit notation case. There are two separate blocks:
10914
10929
  // first for the key (denoted by "?") and second for the value (denoted by ":")
10915
10930
  //
10916
- if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) {
10917
10931
 
10918
- if (ch === 0x3F/* ? */) {
10932
+ if ((ch === 0x3F
10933
+ /* ? */
10934
+ || ch === 0x3A
10935
+ /* : */
10936
+ ) && is_WS_OR_EOL(following)) {
10937
+ if (ch === 0x3F
10938
+ /* ? */
10939
+ ) {
10919
10940
  if (atExplicitKey) {
10920
10941
  storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
10921
10942
  keyTag = keyNode = valueNode = null;
@@ -10924,22 +10945,18 @@ function readBlockMapping(state, nodeIndent, flowIndent) {
10924
10945
  detected = true;
10925
10946
  atExplicitKey = true;
10926
10947
  allowCompact = true;
10927
-
10928
10948
  } else if (atExplicitKey) {
10929
10949
  // i.e. 0x3A/* : */ === character after the explicit key.
10930
10950
  atExplicitKey = false;
10931
10951
  allowCompact = true;
10932
-
10933
10952
  } else {
10934
10953
  throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line');
10935
10954
  }
10936
10955
 
10937
10956
  state.position += 1;
10938
- ch = following;
10939
-
10940
- //
10941
- // Implicit notation case. Flow-style node as the key first, then ":", and the value.
10942
- //
10957
+ ch = following; //
10958
+ // Implicit notation case. Flow-style node as the key first, then ":", and the value.
10959
+ //
10943
10960
  } else {
10944
10961
  _keyLine = state.line;
10945
10962
  _keyLineStart = state.lineStart;
@@ -10958,7 +10975,9 @@ function readBlockMapping(state, nodeIndent, flowIndent) {
10958
10975
  ch = state.input.charCodeAt(++state.position);
10959
10976
  }
10960
10977
 
10961
- if (ch === 0x3A/* : */) {
10978
+ if (ch === 0x3A
10979
+ /* : */
10980
+ ) {
10962
10981
  ch = state.input.charCodeAt(++state.position);
10963
10982
 
10964
10983
  if (!is_WS_OR_EOL(ch)) {
@@ -10975,29 +10994,25 @@ function readBlockMapping(state, nodeIndent, flowIndent) {
10975
10994
  allowCompact = false;
10976
10995
  keyTag = state.tag;
10977
10996
  keyNode = state.result;
10978
-
10979
10997
  } else if (detected) {
10980
10998
  throwError(state, 'can not read an implicit mapping pair; a colon is missed');
10981
-
10982
10999
  } else {
10983
11000
  state.tag = _tag;
10984
11001
  state.anchor = _anchor;
10985
11002
  return true; // Keep the result of `composeNode`.
10986
11003
  }
10987
-
10988
11004
  } else if (detected) {
10989
11005
  throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key');
10990
-
10991
11006
  } else {
10992
11007
  state.tag = _tag;
10993
11008
  state.anchor = _anchor;
10994
11009
  return true; // Keep the result of `composeNode`.
10995
11010
  }
10996
- }
10997
-
10998
- //
11011
+ } //
10999
11012
  // Common reading code for both explicit and implicit notations.
11000
11013
  //
11014
+
11015
+
11001
11016
  if (state.line === _line || state.lineIndent > nodeIndent) {
11002
11017
  if (atExplicitKey) {
11003
11018
  _keyLine = state.line;
@@ -11022,23 +11037,22 @@ function readBlockMapping(state, nodeIndent, flowIndent) {
11022
11037
  ch = state.input.charCodeAt(state.position);
11023
11038
  }
11024
11039
 
11025
- if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) {
11040
+ if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
11026
11041
  throwError(state, 'bad indentation of a mapping entry');
11027
11042
  } else if (state.lineIndent < nodeIndent) {
11028
11043
  break;
11029
11044
  }
11030
- }
11031
-
11032
- //
11045
+ } //
11033
11046
  // Epilogue.
11034
11047
  //
11035
-
11036
11048
  // Special case: last mapping's node contains only the key in explicit notation.
11049
+
11050
+
11037
11051
  if (atExplicitKey) {
11038
11052
  storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
11039
- }
11053
+ } // Expose the resulting mapping.
11054
+
11040
11055
 
11041
- // Expose the resulting mapping.
11042
11056
  if (detected) {
11043
11057
  state.tag = _tag;
11044
11058
  state.anchor = _anchor;
@@ -11052,14 +11066,15 @@ function readBlockMapping(state, nodeIndent, flowIndent) {
11052
11066
  function readTagProperty(state) {
11053
11067
  var _position,
11054
11068
  isVerbatim = false,
11055
- isNamed = false,
11069
+ isNamed = false,
11056
11070
  tagHandle,
11057
11071
  tagName,
11058
11072
  ch;
11059
11073
 
11060
11074
  ch = state.input.charCodeAt(state.position);
11061
-
11062
- if (ch !== 0x21/* ! */) return false;
11075
+ if (ch !== 0x21
11076
+ /* ! */
11077
+ ) return false;
11063
11078
 
11064
11079
  if (state.tag !== null) {
11065
11080
  throwError(state, 'duplication of a tag property');
@@ -11067,15 +11082,17 @@ function readTagProperty(state) {
11067
11082
 
11068
11083
  ch = state.input.charCodeAt(++state.position);
11069
11084
 
11070
- if (ch === 0x3C/* < */) {
11085
+ if (ch === 0x3C
11086
+ /* < */
11087
+ ) {
11071
11088
  isVerbatim = true;
11072
11089
  ch = state.input.charCodeAt(++state.position);
11073
-
11074
- } else if (ch === 0x21/* ! */) {
11090
+ } else if (ch === 0x21
11091
+ /* ! */
11092
+ ) {
11075
11093
  isNamed = true;
11076
11094
  tagHandle = '!!';
11077
11095
  ch = state.input.charCodeAt(++state.position);
11078
-
11079
11096
  } else {
11080
11097
  tagHandle = '!';
11081
11098
  }
@@ -11083,8 +11100,11 @@ function readTagProperty(state) {
11083
11100
  _position = state.position;
11084
11101
 
11085
11102
  if (isVerbatim) {
11086
- do { ch = state.input.charCodeAt(++state.position); }
11087
- while (ch !== 0 && ch !== 0x3E/* > */);
11103
+ do {
11104
+ ch = state.input.charCodeAt(++state.position);
11105
+ } while (ch !== 0 && ch !== 0x3E
11106
+ /* > */
11107
+ );
11088
11108
 
11089
11109
  if (state.position < state.length) {
11090
11110
  tagName = state.input.slice(_position, state.position);
@@ -11094,8 +11114,9 @@ function readTagProperty(state) {
11094
11114
  }
11095
11115
  } else {
11096
11116
  while (ch !== 0 && !is_WS_OR_EOL(ch)) {
11097
-
11098
- if (ch === 0x21/* ! */) {
11117
+ if (ch === 0x21
11118
+ /* ! */
11119
+ ) {
11099
11120
  if (!isNamed) {
11100
11121
  tagHandle = state.input.slice(_position - 1, state.position + 1);
11101
11122
 
@@ -11132,16 +11153,12 @@ function readTagProperty(state) {
11132
11153
 
11133
11154
  if (isVerbatim) {
11134
11155
  state.tag = tagName;
11135
-
11136
11156
  } else if (_hasOwnProperty$1.call(state.tagMap, tagHandle)) {
11137
11157
  state.tag = state.tagMap[tagHandle] + tagName;
11138
-
11139
11158
  } else if (tagHandle === '!') {
11140
11159
  state.tag = '!' + tagName;
11141
-
11142
11160
  } else if (tagHandle === '!!') {
11143
11161
  state.tag = 'tag:yaml.org,2002:' + tagName;
11144
-
11145
11162
  } else {
11146
11163
  throwError(state, 'undeclared tag handle "' + tagHandle + '"');
11147
11164
  }
@@ -11150,12 +11167,12 @@ function readTagProperty(state) {
11150
11167
  }
11151
11168
 
11152
11169
  function readAnchorProperty(state) {
11153
- var _position,
11154
- ch;
11170
+ var _position, ch;
11155
11171
 
11156
11172
  ch = state.input.charCodeAt(state.position);
11157
-
11158
- if (ch !== 0x26/* & */) return false;
11173
+ if (ch !== 0x26
11174
+ /* & */
11175
+ ) return false;
11159
11176
 
11160
11177
  if (state.anchor !== null) {
11161
11178
  throwError(state, 'duplication of an anchor property');
@@ -11177,13 +11194,12 @@ function readAnchorProperty(state) {
11177
11194
  }
11178
11195
 
11179
11196
  function readAlias(state) {
11180
- var _position, alias,
11181
- ch;
11197
+ var _position, alias, ch;
11182
11198
 
11183
11199
  ch = state.input.charCodeAt(state.position);
11184
-
11185
- if (ch !== 0x2A/* * */) return false;
11186
-
11200
+ if (ch !== 0x2A
11201
+ /* * */
11202
+ ) return false;
11187
11203
  ch = state.input.charCodeAt(++state.position);
11188
11204
  _position = state.position;
11189
11205
 
@@ -11210,8 +11226,9 @@ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact
11210
11226
  var allowBlockStyles,
11211
11227
  allowBlockScalars,
11212
11228
  allowBlockCollections,
11213
- indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this<parent
11214
- atNewLine = false,
11229
+ indentStatus = 1,
11230
+ // 1: this>parent, 0: this=parent, -1: this<parent
11231
+ atNewLine = false,
11215
11232
  hasContent = false,
11216
11233
  typeIndex,
11217
11234
  typeQuantity,
@@ -11224,14 +11241,11 @@ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact
11224
11241
  state.listener('open', state);
11225
11242
  }
11226
11243
 
11227
- state.tag = null;
11244
+ state.tag = null;
11228
11245
  state.anchor = null;
11229
- state.kind = null;
11246
+ state.kind = null;
11230
11247
  state.result = null;
11231
-
11232
- allowBlockStyles = allowBlockScalars = allowBlockCollections =
11233
- CONTEXT_BLOCK_OUT === nodeContext ||
11234
- CONTEXT_BLOCK_IN === nodeContext;
11248
+ allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
11235
11249
 
11236
11250
  if (allowToSeek) {
11237
11251
  if (skipSeparationSpace(state, true, -1)) {
@@ -11280,24 +11294,17 @@ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact
11280
11294
  blockIndent = state.position - state.lineStart;
11281
11295
 
11282
11296
  if (indentStatus === 1) {
11283
- if (allowBlockCollections &&
11284
- (readBlockSequence(state, blockIndent) ||
11285
- readBlockMapping(state, blockIndent, flowIndent)) ||
11286
- readFlowCollection(state, flowIndent)) {
11297
+ if (allowBlockCollections && (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent)) || readFlowCollection(state, flowIndent)) {
11287
11298
  hasContent = true;
11288
11299
  } else {
11289
- if ((allowBlockScalars && readBlockScalar(state, flowIndent)) ||
11290
- readSingleQuotedScalar(state, flowIndent) ||
11291
- readDoubleQuotedScalar(state, flowIndent)) {
11300
+ if (allowBlockScalars && readBlockScalar(state, flowIndent) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) {
11292
11301
  hasContent = true;
11293
-
11294
11302
  } else if (readAlias(state)) {
11295
11303
  hasContent = true;
11296
11304
 
11297
11305
  if (state.tag !== null || state.anchor !== null) {
11298
11306
  throwError(state, 'alias node should not have any properties');
11299
11307
  }
11300
-
11301
11308
  } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
11302
11309
  hasContent = true;
11303
11310
 
@@ -11321,7 +11328,6 @@ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact
11321
11328
  if (state.anchor !== null) {
11322
11329
  state.anchorMap[state.anchor] = state.result;
11323
11330
  }
11324
-
11325
11331
  } else if (state.tag === '?') {
11326
11332
  // Implicit resolving is not allowed for non-scalar types, and '?'
11327
11333
  // non-specific tag is only automatically assigned to plain scalars.
@@ -11336,12 +11342,15 @@ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact
11336
11342
  for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
11337
11343
  type = state.implicitTypes[typeIndex];
11338
11344
 
11339
- if (type.resolve(state.result)) { // `state.result` updated in resolver if matched
11345
+ if (type.resolve(state.result)) {
11346
+ // `state.result` updated in resolver if matched
11340
11347
  state.result = type.construct(state.result);
11341
11348
  state.tag = type.tag;
11349
+
11342
11350
  if (state.anchor !== null) {
11343
11351
  state.anchorMap[state.anchor] = state.result;
11344
11352
  }
11353
+
11345
11354
  break;
11346
11355
  }
11347
11356
  }
@@ -11369,10 +11378,12 @@ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact
11369
11378
  throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"');
11370
11379
  }
11371
11380
 
11372
- if (!type.resolve(state.result, state.tag)) { // `state.result` updated in resolver if matched
11381
+ if (!type.resolve(state.result, state.tag)) {
11382
+ // `state.result` updated in resolver if matched
11373
11383
  throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag');
11374
11384
  } else {
11375
11385
  state.result = type.construct(state.result, state.tag);
11386
+
11376
11387
  if (state.anchor !== null) {
11377
11388
  state.anchorMap[state.anchor] = state.result;
11378
11389
  }
@@ -11382,7 +11393,8 @@ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact
11382
11393
  if (state.listener !== null) {
11383
11394
  state.listener('close', state);
11384
11395
  }
11385
- return state.tag !== null || state.anchor !== null || hasContent;
11396
+
11397
+ return state.tag !== null || state.anchor !== null || hasContent;
11386
11398
  }
11387
11399
 
11388
11400
  function readDocument(state) {
@@ -11400,10 +11412,11 @@ function readDocument(state) {
11400
11412
 
11401
11413
  while ((ch = state.input.charCodeAt(state.position)) !== 0) {
11402
11414
  skipSeparationSpace(state, true, -1);
11403
-
11404
11415
  ch = state.input.charCodeAt(state.position);
11405
11416
 
11406
- if (state.lineIndent > 0 || ch !== 0x25/* % */) {
11417
+ if (state.lineIndent > 0 || ch !== 0x25
11418
+ /* % */
11419
+ ) {
11407
11420
  break;
11408
11421
  }
11409
11422
 
@@ -11427,14 +11440,17 @@ function readDocument(state) {
11427
11440
  ch = state.input.charCodeAt(++state.position);
11428
11441
  }
11429
11442
 
11430
- if (ch === 0x23/* # */) {
11431
- do { ch = state.input.charCodeAt(++state.position); }
11432
- while (ch !== 0 && !is_EOL(ch));
11443
+ if (ch === 0x23
11444
+ /* # */
11445
+ ) {
11446
+ do {
11447
+ ch = state.input.charCodeAt(++state.position);
11448
+ } while (ch !== 0 && !is_EOL(ch));
11449
+
11433
11450
  break;
11434
11451
  }
11435
11452
 
11436
11453
  if (is_EOL(ch)) break;
11437
-
11438
11454
  _position = state.position;
11439
11455
 
11440
11456
  while (ch !== 0 && !is_WS_OR_EOL(ch)) {
@@ -11455,13 +11471,15 @@ function readDocument(state) {
11455
11471
 
11456
11472
  skipSeparationSpace(state, true, -1);
11457
11473
 
11458
- if (state.lineIndent === 0 &&
11459
- state.input.charCodeAt(state.position) === 0x2D/* - */ &&
11460
- state.input.charCodeAt(state.position + 1) === 0x2D/* - */ &&
11461
- state.input.charCodeAt(state.position + 2) === 0x2D/* - */) {
11474
+ if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 0x2D
11475
+ /* - */
11476
+ && state.input.charCodeAt(state.position + 1) === 0x2D
11477
+ /* - */
11478
+ && state.input.charCodeAt(state.position + 2) === 0x2D
11479
+ /* - */
11480
+ ) {
11462
11481
  state.position += 3;
11463
11482
  skipSeparationSpace(state, true, -1);
11464
-
11465
11483
  } else if (hasDirectives) {
11466
11484
  throwError(state, 'directives end mark is expected');
11467
11485
  }
@@ -11469,73 +11487,75 @@ function readDocument(state) {
11469
11487
  composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
11470
11488
  skipSeparationSpace(state, true, -1);
11471
11489
 
11472
- if (state.checkLineBreaks &&
11473
- PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
11490
+ if (state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
11474
11491
  throwWarning(state, 'non-ASCII line breaks are interpreted as content');
11475
11492
  }
11476
11493
 
11477
11494
  state.documents.push(state.result);
11478
11495
 
11479
11496
  if (state.position === state.lineStart && testDocumentSeparator(state)) {
11480
-
11481
- if (state.input.charCodeAt(state.position) === 0x2E/* . */) {
11497
+ if (state.input.charCodeAt(state.position) === 0x2E
11498
+ /* . */
11499
+ ) {
11482
11500
  state.position += 3;
11483
11501
  skipSeparationSpace(state, true, -1);
11484
11502
  }
11503
+
11485
11504
  return;
11486
11505
  }
11487
11506
 
11488
- if (state.position < (state.length - 1)) {
11507
+ if (state.position < state.length - 1) {
11489
11508
  throwError(state, 'end of the stream or a document separator is expected');
11490
11509
  } else {
11491
11510
  return;
11492
11511
  }
11493
11512
  }
11494
11513
 
11495
-
11496
11514
  function loadDocuments(input, options) {
11497
11515
  input = String(input);
11498
11516
  options = options || {};
11499
11517
 
11500
11518
  if (input.length !== 0) {
11501
-
11502
11519
  // Add tailing `\n` if not exists
11503
- if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ &&
11504
- input.charCodeAt(input.length - 1) !== 0x0D/* CR */) {
11520
+ if (input.charCodeAt(input.length - 1) !== 0x0A
11521
+ /* LF */
11522
+ && input.charCodeAt(input.length - 1) !== 0x0D
11523
+ /* CR */
11524
+ ) {
11505
11525
  input += '\n';
11506
- }
11526
+ } // Strip BOM
11527
+
11507
11528
 
11508
- // Strip BOM
11509
11529
  if (input.charCodeAt(0) === 0xFEFF) {
11510
11530
  input = input.slice(1);
11511
11531
  }
11512
11532
  }
11513
11533
 
11514
11534
  var state = new State$1(input, options);
11515
-
11516
11535
  var nullpos = input.indexOf('\0');
11517
11536
 
11518
11537
  if (nullpos !== -1) {
11519
11538
  state.position = nullpos;
11520
11539
  throwError(state, 'null byte is not allowed in input');
11521
- }
11540
+ } // Use 0 as string terminator. That significantly simplifies bounds check.
11541
+
11522
11542
 
11523
- // Use 0 as string terminator. That significantly simplifies bounds check.
11524
11543
  state.input += '\0';
11525
11544
 
11526
- while (state.input.charCodeAt(state.position) === 0x20/* Space */) {
11545
+ while (state.input.charCodeAt(state.position) === 0x20
11546
+ /* Space */
11547
+ ) {
11527
11548
  state.lineIndent += 1;
11528
11549
  state.position += 1;
11529
11550
  }
11530
11551
 
11531
- while (state.position < (state.length - 1)) {
11552
+ while (state.position < state.length - 1) {
11532
11553
  readDocument(state);
11533
11554
  }
11534
11555
 
11535
11556
  return state.documents;
11536
11557
  }
11537
11558
 
11538
-
11539
11559
  function loadAll$1(input, iterator, options) {
11540
11560
  if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') {
11541
11561
  options = iterator;
@@ -11553,7 +11573,6 @@ function loadAll$1(input, iterator, options) {
11553
11573
  }
11554
11574
  }
11555
11575
 
11556
-
11557
11576
  function load$1(input, options) {
11558
11577
  var documents = loadDocuments(input, options);
11559
11578
 
@@ -11563,83 +11582,115 @@ function load$1(input, options) {
11563
11582
  } else if (documents.length === 1) {
11564
11583
  return documents[0];
11565
11584
  }
11585
+
11566
11586
  throw new exception('expected a single document in the stream, but found more');
11567
11587
  }
11568
11588
 
11569
-
11570
11589
  var loadAll_1 = loadAll$1;
11571
- var load_1 = load$1;
11572
-
11590
+ var load_1 = load$1;
11573
11591
  var loader = {
11574
- loadAll: loadAll_1,
11575
- load: load_1
11592
+ loadAll: loadAll_1,
11593
+ load: load_1
11576
11594
  };
11577
-
11578
11595
  /*eslint-disable no-use-before-define*/
11579
11596
 
11597
+ var _toString = Object.prototype.toString;
11598
+ var _hasOwnProperty = Object.prototype.hasOwnProperty;
11599
+ var CHAR_BOM = 0xFEFF;
11600
+ var CHAR_TAB = 0x09;
11601
+ /* Tab */
11580
11602
 
11603
+ var CHAR_LINE_FEED = 0x0A;
11604
+ /* LF */
11581
11605
 
11606
+ var CHAR_CARRIAGE_RETURN = 0x0D;
11607
+ /* CR */
11582
11608
 
11609
+ var CHAR_SPACE = 0x20;
11610
+ /* Space */
11583
11611
 
11584
- var _toString = Object.prototype.toString;
11585
- var _hasOwnProperty = Object.prototype.hasOwnProperty;
11612
+ var CHAR_EXCLAMATION = 0x21;
11613
+ /* ! */
11586
11614
 
11587
- var CHAR_BOM = 0xFEFF;
11588
- var CHAR_TAB = 0x09; /* Tab */
11589
- var CHAR_LINE_FEED = 0x0A; /* LF */
11590
- var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */
11591
- var CHAR_SPACE = 0x20; /* Space */
11592
- var CHAR_EXCLAMATION = 0x21; /* ! */
11593
- var CHAR_DOUBLE_QUOTE = 0x22; /* " */
11594
- var CHAR_SHARP = 0x23; /* # */
11595
- var CHAR_PERCENT = 0x25; /* % */
11596
- var CHAR_AMPERSAND = 0x26; /* & */
11597
- var CHAR_SINGLE_QUOTE = 0x27; /* ' */
11598
- var CHAR_ASTERISK = 0x2A; /* * */
11599
- var CHAR_COMMA = 0x2C; /* , */
11600
- var CHAR_MINUS = 0x2D; /* - */
11601
- var CHAR_COLON = 0x3A; /* : */
11602
- var CHAR_EQUALS = 0x3D; /* = */
11603
- var CHAR_GREATER_THAN = 0x3E; /* > */
11604
- var CHAR_QUESTION = 0x3F; /* ? */
11605
- var CHAR_COMMERCIAL_AT = 0x40; /* @ */
11606
- var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */
11607
- var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */
11608
- var CHAR_GRAVE_ACCENT = 0x60; /* ` */
11609
- var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */
11610
- var CHAR_VERTICAL_LINE = 0x7C; /* | */
11611
- var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */
11615
+ var CHAR_DOUBLE_QUOTE = 0x22;
11616
+ /* " */
11612
11617
 
11613
- var ESCAPE_SEQUENCES = {};
11618
+ var CHAR_SHARP = 0x23;
11619
+ /* # */
11614
11620
 
11615
- ESCAPE_SEQUENCES[0x00] = '\\0';
11616
- ESCAPE_SEQUENCES[0x07] = '\\a';
11617
- ESCAPE_SEQUENCES[0x08] = '\\b';
11618
- ESCAPE_SEQUENCES[0x09] = '\\t';
11619
- ESCAPE_SEQUENCES[0x0A] = '\\n';
11620
- ESCAPE_SEQUENCES[0x0B] = '\\v';
11621
- ESCAPE_SEQUENCES[0x0C] = '\\f';
11622
- ESCAPE_SEQUENCES[0x0D] = '\\r';
11623
- ESCAPE_SEQUENCES[0x1B] = '\\e';
11624
- ESCAPE_SEQUENCES[0x22] = '\\"';
11625
- ESCAPE_SEQUENCES[0x5C] = '\\\\';
11626
- ESCAPE_SEQUENCES[0x85] = '\\N';
11627
- ESCAPE_SEQUENCES[0xA0] = '\\_';
11628
- ESCAPE_SEQUENCES[0x2028] = '\\L';
11629
- ESCAPE_SEQUENCES[0x2029] = '\\P';
11621
+ var CHAR_PERCENT = 0x25;
11622
+ /* % */
11623
+
11624
+ var CHAR_AMPERSAND = 0x26;
11625
+ /* & */
11626
+
11627
+ var CHAR_SINGLE_QUOTE = 0x27;
11628
+ /* ' */
11629
+
11630
+ var CHAR_ASTERISK = 0x2A;
11631
+ /* * */
11632
+
11633
+ var CHAR_COMMA = 0x2C;
11634
+ /* , */
11635
+
11636
+ var CHAR_MINUS = 0x2D;
11637
+ /* - */
11638
+
11639
+ var CHAR_COLON = 0x3A;
11640
+ /* : */
11641
+
11642
+ var CHAR_EQUALS = 0x3D;
11643
+ /* = */
11644
+
11645
+ var CHAR_GREATER_THAN = 0x3E;
11646
+ /* > */
11647
+
11648
+ var CHAR_QUESTION = 0x3F;
11649
+ /* ? */
11650
+
11651
+ var CHAR_COMMERCIAL_AT = 0x40;
11652
+ /* @ */
11630
11653
 
11631
- var DEPRECATED_BOOLEANS_SYNTAX = [
11632
- 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON',
11633
- 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF'
11634
- ];
11654
+ var CHAR_LEFT_SQUARE_BRACKET = 0x5B;
11655
+ /* [ */
11635
11656
 
11657
+ var CHAR_RIGHT_SQUARE_BRACKET = 0x5D;
11658
+ /* ] */
11659
+
11660
+ var CHAR_GRAVE_ACCENT = 0x60;
11661
+ /* ` */
11662
+
11663
+ var CHAR_LEFT_CURLY_BRACKET = 0x7B;
11664
+ /* { */
11665
+
11666
+ var CHAR_VERTICAL_LINE = 0x7C;
11667
+ /* | */
11668
+
11669
+ var CHAR_RIGHT_CURLY_BRACKET = 0x7D;
11670
+ /* } */
11671
+
11672
+ var ESCAPE_SEQUENCES = {};
11673
+ ESCAPE_SEQUENCES[0x00] = '\\0';
11674
+ ESCAPE_SEQUENCES[0x07] = '\\a';
11675
+ ESCAPE_SEQUENCES[0x08] = '\\b';
11676
+ ESCAPE_SEQUENCES[0x09] = '\\t';
11677
+ ESCAPE_SEQUENCES[0x0A] = '\\n';
11678
+ ESCAPE_SEQUENCES[0x0B] = '\\v';
11679
+ ESCAPE_SEQUENCES[0x0C] = '\\f';
11680
+ ESCAPE_SEQUENCES[0x0D] = '\\r';
11681
+ ESCAPE_SEQUENCES[0x1B] = '\\e';
11682
+ ESCAPE_SEQUENCES[0x22] = '\\"';
11683
+ ESCAPE_SEQUENCES[0x5C] = '\\\\';
11684
+ ESCAPE_SEQUENCES[0x85] = '\\N';
11685
+ ESCAPE_SEQUENCES[0xA0] = '\\_';
11686
+ ESCAPE_SEQUENCES[0x2028] = '\\L';
11687
+ ESCAPE_SEQUENCES[0x2029] = '\\P';
11688
+ var DEPRECATED_BOOLEANS_SYNTAX = ['y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF'];
11636
11689
  var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
11637
11690
 
11638
11691
  function compileStyleMap(schema, map) {
11639
11692
  var result, keys, index, length, tag, style, type;
11640
-
11641
11693
  if (map === null) return {};
11642
-
11643
11694
  result = {};
11644
11695
  keys = Object.keys(map);
11645
11696
 
@@ -11650,6 +11701,7 @@ function compileStyleMap(schema, map) {
11650
11701
  if (tag.slice(0, 2) === '!!') {
11651
11702
  tag = 'tag:yaml.org,2002:' + tag.slice(2);
11652
11703
  }
11704
+
11653
11705
  type = schema.compiledTypeMap['fallback'][tag];
11654
11706
 
11655
11707
  if (type && _hasOwnProperty.call(type.styleAliases, style)) {
@@ -11664,7 +11716,6 @@ function compileStyleMap(schema, map) {
11664
11716
 
11665
11717
  function encodeHex(character) {
11666
11718
  var string, handle, length;
11667
-
11668
11719
  string = character.toString(16).toUpperCase();
11669
11720
 
11670
11721
  if (character <= 0xFF) {
@@ -11683,37 +11734,33 @@ function encodeHex(character) {
11683
11734
  return '\\' + handle + common.repeat('0', length - string.length) + string;
11684
11735
  }
11685
11736
 
11686
-
11687
11737
  var QUOTING_TYPE_SINGLE = 1,
11688
11738
  QUOTING_TYPE_DOUBLE = 2;
11689
11739
 
11690
11740
  function State(options) {
11691
- this.schema = options['schema'] || _default;
11692
- this.indent = Math.max(1, (options['indent'] || 2));
11741
+ this.schema = options['schema'] || _default;
11742
+ this.indent = Math.max(1, options['indent'] || 2);
11693
11743
  this.noArrayIndent = options['noArrayIndent'] || false;
11694
- this.skipInvalid = options['skipInvalid'] || false;
11695
- this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']);
11696
- this.styleMap = compileStyleMap(this.schema, options['styles'] || null);
11697
- this.sortKeys = options['sortKeys'] || false;
11698
- this.lineWidth = options['lineWidth'] || 80;
11699
- this.noRefs = options['noRefs'] || false;
11700
- this.noCompatMode = options['noCompatMode'] || false;
11701
- this.condenseFlow = options['condenseFlow'] || false;
11702
- this.quotingType = options['quotingType'] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE;
11703
- this.forceQuotes = options['forceQuotes'] || false;
11704
- this.replacer = typeof options['replacer'] === 'function' ? options['replacer'] : null;
11705
-
11744
+ this.skipInvalid = options['skipInvalid'] || false;
11745
+ this.flowLevel = common.isNothing(options['flowLevel']) ? -1 : options['flowLevel'];
11746
+ this.styleMap = compileStyleMap(this.schema, options['styles'] || null);
11747
+ this.sortKeys = options['sortKeys'] || false;
11748
+ this.lineWidth = options['lineWidth'] || 80;
11749
+ this.noRefs = options['noRefs'] || false;
11750
+ this.noCompatMode = options['noCompatMode'] || false;
11751
+ this.condenseFlow = options['condenseFlow'] || false;
11752
+ this.quotingType = options['quotingType'] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE;
11753
+ this.forceQuotes = options['forceQuotes'] || false;
11754
+ this.replacer = typeof options['replacer'] === 'function' ? options['replacer'] : null;
11706
11755
  this.implicitTypes = this.schema.compiledImplicit;
11707
11756
  this.explicitTypes = this.schema.compiledExplicit;
11708
-
11709
11757
  this.tag = null;
11710
11758
  this.result = '';
11711
-
11712
11759
  this.duplicates = [];
11713
11760
  this.usedDuplicates = null;
11714
- }
11761
+ } // Indents every line in a string. Empty lines (\n only) are not indented.
11762
+
11715
11763
 
11716
- // Indents every line in a string. Empty lines (\n only) are not indented.
11717
11764
  function indentString(string, spaces) {
11718
11765
  var ind = common.repeat(' ', spaces),
11719
11766
  position = 0,
@@ -11724,6 +11771,7 @@ function indentString(string, spaces) {
11724
11771
 
11725
11772
  while (position < length) {
11726
11773
  next = string.indexOf('\n', position);
11774
+
11727
11775
  if (next === -1) {
11728
11776
  line = string.slice(position);
11729
11777
  position = length;
@@ -11733,7 +11781,6 @@ function indentString(string, spaces) {
11733
11781
  }
11734
11782
 
11735
11783
  if (line.length && line !== '\n') result += ind;
11736
-
11737
11784
  result += line;
11738
11785
  }
11739
11786
 
@@ -11756,38 +11803,30 @@ function testImplicitResolving(state, str) {
11756
11803
  }
11757
11804
 
11758
11805
  return false;
11759
- }
11806
+ } // [33] s-white ::= s-space | s-tab
11807
+
11760
11808
 
11761
- // [33] s-white ::= s-space | s-tab
11762
11809
  function isWhitespace(c) {
11763
11810
  return c === CHAR_SPACE || c === CHAR_TAB;
11764
- }
11765
-
11766
- // Returns true if the character can be printed without escaping.
11811
+ } // Returns true if the character can be printed without escaping.
11767
11812
  // From YAML 1.2: "any allowed characters known to be non-printable
11768
11813
  // should also be escaped. [However,] This isn’t mandatory"
11769
11814
  // Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029.
11770
- function isPrintable(c) {
11771
- return (0x00020 <= c && c <= 0x00007E)
11772
- || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029)
11773
- || ((0x0E000 <= c && c <= 0x00FFFD) && c !== CHAR_BOM)
11774
- || (0x10000 <= c && c <= 0x10FFFF);
11775
- }
11776
11815
 
11777
- // [34] ns-char ::= nb-char - s-white
11816
+
11817
+ function isPrintable(c) {
11818
+ return 0x00020 <= c && c <= 0x00007E || 0x000A1 <= c && c <= 0x00D7FF && c !== 0x2028 && c !== 0x2029 || 0x0E000 <= c && c <= 0x00FFFD && c !== CHAR_BOM || 0x10000 <= c && c <= 0x10FFFF;
11819
+ } // [34] ns-char ::= nb-char - s-white
11778
11820
  // [27] nb-char ::= c-printable - b-char - c-byte-order-mark
11779
11821
  // [26] b-char ::= b-line-feed | b-carriage-return
11780
11822
  // Including s-white (for some reason, examples doesn't match specs in this aspect)
11781
11823
  // ns-char ::= c-printable - b-line-feed - b-carriage-return - c-byte-order-mark
11782
- function isNsCharOrWhitespace(c) {
11783
- return isPrintable(c)
11784
- && c !== CHAR_BOM
11785
- // - b-char
11786
- && c !== CHAR_CARRIAGE_RETURN
11787
- && c !== CHAR_LINE_FEED;
11788
- }
11789
11824
 
11790
- // [127] ns-plain-safe(c) ::= c = flow-out ⇒ ns-plain-safe-out
11825
+
11826
+ function isNsCharOrWhitespace(c) {
11827
+ return isPrintable(c) && c !== CHAR_BOM // - b-char
11828
+ && c !== CHAR_CARRIAGE_RETURN && c !== CHAR_LINE_FEED;
11829
+ } // [127] ns-plain-safe(c) ::= c = flow-out ⇒ ns-plain-safe-out
11791
11830
  // c = flow-in ⇒ ns-plain-safe-in
11792
11831
  // c = block-key ⇒ ns-plain-safe-out
11793
11832
  // c = flow-key ⇒ ns-plain-safe-in
@@ -11796,120 +11835,97 @@ function isNsCharOrWhitespace(c) {
11796
11835
  // [130] ns-plain-char(c) ::= ( ns-plain-safe(c) - “:” - “#” )
11797
11836
  // | ( /* An ns-char preceding */ “#” )
11798
11837
  // | ( “:” /* Followed by an ns-plain-safe(c) */ )
11838
+
11839
+
11799
11840
  function isPlainSafe(c, prev, inblock) {
11800
11841
  var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c);
11801
11842
  var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c);
11802
- return (
11803
- // ns-plain-safe
11804
- inblock ? // c = flow-in
11805
- cIsNsCharOrWhitespace
11806
- : cIsNsCharOrWhitespace
11807
- // - c-flow-indicator
11808
- && c !== CHAR_COMMA
11809
- && c !== CHAR_LEFT_SQUARE_BRACKET
11810
- && c !== CHAR_RIGHT_SQUARE_BRACKET
11811
- && c !== CHAR_LEFT_CURLY_BRACKET
11812
- && c !== CHAR_RIGHT_CURLY_BRACKET
11813
- )
11814
- // ns-plain-char
11815
- && c !== CHAR_SHARP // false on '#'
11816
- && !(prev === CHAR_COLON && !cIsNsChar) // false on ': '
11817
- || (isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP) // change to true on '[^ ]#'
11818
- || (prev === CHAR_COLON && cIsNsChar); // change to true on ':[^ ]'
11819
- }
11820
-
11821
- // Simplified test for values allowed as the first character in plain style.
11843
+ return ( // ns-plain-safe
11844
+ inblock ? // c = flow-in
11845
+ cIsNsCharOrWhitespace : cIsNsCharOrWhitespace // - c-flow-indicator
11846
+ && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET // ns-plain-char
11847
+ ) && c !== CHAR_SHARP // false on '#'
11848
+ && !(prev === CHAR_COLON && !cIsNsChar) // false on ': '
11849
+ || isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP // change to true on '[^ ]#'
11850
+ || prev === CHAR_COLON && cIsNsChar; // change to true on ':[^ ]'
11851
+ } // Simplified test for values allowed as the first character in plain style.
11852
+
11853
+
11822
11854
  function isPlainSafeFirst(c) {
11823
11855
  // Uses a subset of ns-char - c-indicator
11824
11856
  // where ns-char = nb-char - s-white.
11825
11857
  // No support of ( ( “?” | “:” | “-” ) /* Followed by an ns-plain-safe(c)) */ ) part
11826
- return isPrintable(c) && c !== CHAR_BOM
11827
- && !isWhitespace(c) // - s-white
11828
- // - (c-indicator ::=
11829
- // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}”
11830
- && c !== CHAR_MINUS
11831
- && c !== CHAR_QUESTION
11832
- && c !== CHAR_COLON
11833
- && c !== CHAR_COMMA
11834
- && c !== CHAR_LEFT_SQUARE_BRACKET
11835
- && c !== CHAR_RIGHT_SQUARE_BRACKET
11836
- && c !== CHAR_LEFT_CURLY_BRACKET
11837
- && c !== CHAR_RIGHT_CURLY_BRACKET
11838
- // | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “"”
11839
- && c !== CHAR_SHARP
11840
- && c !== CHAR_AMPERSAND
11841
- && c !== CHAR_ASTERISK
11842
- && c !== CHAR_EXCLAMATION
11843
- && c !== CHAR_VERTICAL_LINE
11844
- && c !== CHAR_EQUALS
11845
- && c !== CHAR_GREATER_THAN
11846
- && c !== CHAR_SINGLE_QUOTE
11847
- && c !== CHAR_DOUBLE_QUOTE
11848
- // | “%” | “@” | “`”)
11849
- && c !== CHAR_PERCENT
11850
- && c !== CHAR_COMMERCIAL_AT
11851
- && c !== CHAR_GRAVE_ACCENT;
11852
- }
11853
-
11854
- // Simplified test for values allowed as the last character in plain style.
11858
+ return isPrintable(c) && c !== CHAR_BOM && !isWhitespace(c) // - s-white
11859
+ // - (c-indicator ::=
11860
+ // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}”
11861
+ && 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 // | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “"”
11862
+ && 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 // | “%” | “@” | “`”)
11863
+ && c !== CHAR_PERCENT && c !== CHAR_COMMERCIAL_AT && c !== CHAR_GRAVE_ACCENT;
11864
+ } // Simplified test for values allowed as the last character in plain style.
11865
+
11866
+
11855
11867
  function isPlainSafeLast(c) {
11856
11868
  // just not whitespace or colon, it will be checked to be plain character later
11857
11869
  return !isWhitespace(c) && c !== CHAR_COLON;
11858
- }
11870
+ } // Same as 'string'.codePointAt(pos), but works in older browsers.
11871
+
11859
11872
 
11860
- // Same as 'string'.codePointAt(pos), but works in older browsers.
11861
11873
  function codePointAt(string, pos) {
11862
- var first = string.charCodeAt(pos), second;
11874
+ var first = string.charCodeAt(pos),
11875
+ second;
11876
+
11863
11877
  if (first >= 0xD800 && first <= 0xDBFF && pos + 1 < string.length) {
11864
11878
  second = string.charCodeAt(pos + 1);
11879
+
11865
11880
  if (second >= 0xDC00 && second <= 0xDFFF) {
11866
11881
  // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
11867
11882
  return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
11868
11883
  }
11869
11884
  }
11885
+
11870
11886
  return first;
11871
- }
11887
+ } // Determines whether block indentation indicator is required.
11888
+
11872
11889
 
11873
- // Determines whether block indentation indicator is required.
11874
11890
  function needIndentIndicator(string) {
11875
11891
  var leadingSpaceRe = /^\n* /;
11876
11892
  return leadingSpaceRe.test(string);
11877
11893
  }
11878
11894
 
11879
- var STYLE_PLAIN = 1,
11880
- STYLE_SINGLE = 2,
11895
+ var STYLE_PLAIN = 1,
11896
+ STYLE_SINGLE = 2,
11881
11897
  STYLE_LITERAL = 3,
11882
- STYLE_FOLDED = 4,
11883
- STYLE_DOUBLE = 5;
11884
-
11885
- // Determines which scalar styles are possible and returns the preferred style.
11898
+ STYLE_FOLDED = 4,
11899
+ STYLE_DOUBLE = 5; // Determines which scalar styles are possible and returns the preferred style.
11886
11900
  // lineWidth = -1 => no limit.
11887
11901
  // Pre-conditions: str.length > 0.
11888
11902
  // Post-conditions:
11889
11903
  // STYLE_PLAIN or STYLE_SINGLE => no \n are in the string.
11890
11904
  // STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1).
11891
11905
  // STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1).
11892
- function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth,
11893
- testAmbiguousType, quotingType, forceQuotes, inblock) {
11894
11906
 
11907
+ function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType, quotingType, forceQuotes, inblock) {
11895
11908
  var i;
11896
11909
  var char = 0;
11897
11910
  var prevChar = null;
11898
11911
  var hasLineBreak = false;
11899
11912
  var hasFoldableLine = false; // only checked if shouldTrackWidth
11913
+
11900
11914
  var shouldTrackWidth = lineWidth !== -1;
11901
11915
  var previousLineBreak = -1; // count the first line correctly
11902
- var plain = isPlainSafeFirst(codePointAt(string, 0))
11903
- && isPlainSafeLast(codePointAt(string, string.length - 1));
11916
+
11917
+ var plain = isPlainSafeFirst(codePointAt(string, 0)) && isPlainSafeLast(codePointAt(string, string.length - 1));
11904
11918
 
11905
11919
  if (singleLineOnly || forceQuotes) {
11906
11920
  // Case: no block styles.
11907
11921
  // Check for disallowed characters to rule out plain and single.
11908
11922
  for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) {
11909
11923
  char = codePointAt(string, i);
11924
+
11910
11925
  if (!isPrintable(char)) {
11911
11926
  return STYLE_DOUBLE;
11912
11927
  }
11928
+
11913
11929
  plain = plain && isPlainSafe(char, prevChar, inblock);
11914
11930
  prevChar = char;
11915
11931
  }
@@ -11917,64 +11933,69 @@ function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth,
11917
11933
  // Case: block styles permitted.
11918
11934
  for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) {
11919
11935
  char = codePointAt(string, i);
11936
+
11920
11937
  if (char === CHAR_LINE_FEED) {
11921
- hasLineBreak = true;
11922
- // Check if any line can be folded.
11938
+ hasLineBreak = true; // Check if any line can be folded.
11939
+
11923
11940
  if (shouldTrackWidth) {
11924
- hasFoldableLine = hasFoldableLine ||
11925
- // Foldable line = too long, and not more-indented.
11926
- (i - previousLineBreak - 1 > lineWidth &&
11927
- string[previousLineBreak + 1] !== ' ');
11941
+ hasFoldableLine = hasFoldableLine || // Foldable line = too long, and not more-indented.
11942
+ i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== ' ';
11928
11943
  previousLineBreak = i;
11929
11944
  }
11930
11945
  } else if (!isPrintable(char)) {
11931
11946
  return STYLE_DOUBLE;
11932
11947
  }
11948
+
11933
11949
  plain = plain && isPlainSafe(char, prevChar, inblock);
11934
11950
  prevChar = char;
11935
- }
11936
- // in case the end is missing a \n
11937
- hasFoldableLine = hasFoldableLine || (shouldTrackWidth &&
11938
- (i - previousLineBreak - 1 > lineWidth &&
11939
- string[previousLineBreak + 1] !== ' '));
11940
- }
11941
- // Although every style can represent \n without escaping, prefer block styles
11951
+ } // in case the end is missing a \n
11952
+
11953
+
11954
+ hasFoldableLine = hasFoldableLine || shouldTrackWidth && i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== ' ';
11955
+ } // Although every style can represent \n without escaping, prefer block styles
11942
11956
  // for multiline, since they're more readable and they don't add empty lines.
11943
11957
  // Also prefer folding a super-long line.
11958
+
11959
+
11944
11960
  if (!hasLineBreak && !hasFoldableLine) {
11945
11961
  // Strings interpretable as another type have to be quoted;
11946
11962
  // e.g. the string 'true' vs. the boolean true.
11947
11963
  if (plain && !forceQuotes && !testAmbiguousType(string)) {
11948
11964
  return STYLE_PLAIN;
11949
11965
  }
11966
+
11950
11967
  return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
11951
- }
11952
- // Edge case: block indentation indicator can only have one digit.
11968
+ } // Edge case: block indentation indicator can only have one digit.
11969
+
11970
+
11953
11971
  if (indentPerLevel > 9 && needIndentIndicator(string)) {
11954
11972
  return STYLE_DOUBLE;
11955
- }
11956
- // At this point we know block styles are valid.
11973
+ } // At this point we know block styles are valid.
11957
11974
  // Prefer literal style unless we want to fold.
11975
+
11976
+
11958
11977
  if (!forceQuotes) {
11959
11978
  return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
11960
11979
  }
11961
- return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
11962
- }
11963
11980
 
11964
- // Note: line breaking/folding is implemented for only the folded style.
11981
+ return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
11982
+ } // Note: line breaking/folding is implemented for only the folded style.
11965
11983
  // NB. We drop the last trailing newline (if any) of a returned block scalar
11966
11984
  // since the dumper adds its own newline. This always works:
11967
11985
  // • No ending newline => unaffected; already using strip "-" chomping.
11968
11986
  // • Ending newline => removed then restored.
11969
11987
  // Importantly, this keeps the "+" chomp indicator from gaining an extra line.
11988
+
11989
+
11970
11990
  function writeScalar(state, string, level, iskey, inblock) {
11971
- state.dump = (function () {
11991
+ state.dump = function () {
11972
11992
  if (string.length === 0) {
11973
11993
  return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''";
11974
11994
  }
11995
+
11975
11996
  if (!state.noCompatMode) {
11976
11997
  if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) {
11977
- return state.quotingType === QUOTING_TYPE_DOUBLE ? ('"' + string + '"') : ("'" + string + "'");
11998
+ return state.quotingType === QUOTING_TYPE_DOUBLE ? '"' + string + '"' : "'" + string + "'";
11978
11999
  }
11979
12000
  }
11980
12001
 
@@ -11986,124 +12007,124 @@ function writeScalar(state, string, level, iskey, inblock) {
11986
12007
  // state.lineWidth > 40 + state.indent: width decreases until the lower bound.
11987
12008
  // This behaves better than a constant minimum width which disallows narrower options,
11988
12009
  // or an indent threshold which causes the width to suddenly increase.
11989
- var lineWidth = state.lineWidth === -1
11990
- ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
11991
12010
 
11992
- // Without knowing if keys are implicit/explicit, assume implicit for safety.
11993
- var singleLineOnly = iskey
11994
- // No block styles in flow mode.
11995
- || (state.flowLevel > -1 && level >= state.flowLevel);
12011
+ var lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent); // Without knowing if keys are implicit/explicit, assume implicit for safety.
12012
+
12013
+ var singleLineOnly = iskey // No block styles in flow mode.
12014
+ || state.flowLevel > -1 && level >= state.flowLevel;
12015
+
11996
12016
  function testAmbiguity(string) {
11997
12017
  return testImplicitResolving(state, string);
11998
12018
  }
11999
12019
 
12000
- switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth,
12001
- testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) {
12002
-
12020
+ switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) {
12003
12021
  case STYLE_PLAIN:
12004
12022
  return string;
12023
+
12005
12024
  case STYLE_SINGLE:
12006
12025
  return "'" + string.replace(/'/g, "''") + "'";
12026
+
12007
12027
  case STYLE_LITERAL:
12008
- return '|' + blockHeader(string, state.indent)
12009
- + dropEndingNewline(indentString(string, indent));
12028
+ return '|' + blockHeader(string, state.indent) + dropEndingNewline(indentString(string, indent));
12029
+
12010
12030
  case STYLE_FOLDED:
12011
- return '>' + blockHeader(string, state.indent)
12012
- + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
12031
+ return '>' + blockHeader(string, state.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
12032
+
12013
12033
  case STYLE_DOUBLE:
12014
12034
  return '"' + escapeString(string) + '"';
12035
+
12015
12036
  default:
12016
12037
  throw new exception('impossible error: invalid scalar style');
12017
12038
  }
12018
- }());
12019
- }
12039
+ }();
12040
+ } // Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9.
12041
+
12020
12042
 
12021
- // Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9.
12022
12043
  function blockHeader(string, indentPerLevel) {
12023
- var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : '';
12044
+ var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : ''; // note the special case: the string '\n' counts as a "trailing" empty line.
12024
12045
 
12025
- // note the special case: the string '\n' counts as a "trailing" empty line.
12026
- var clip = string[string.length - 1] === '\n';
12046
+ var clip = string[string.length - 1] === '\n';
12027
12047
  var keep = clip && (string[string.length - 2] === '\n' || string === '\n');
12028
- var chomp = keep ? '+' : (clip ? '' : '-');
12029
-
12048
+ var chomp = keep ? '+' : clip ? '' : '-';
12030
12049
  return indentIndicator + chomp + '\n';
12031
- }
12050
+ } // (See the note for writeScalar.)
12051
+
12032
12052
 
12033
- // (See the note for writeScalar.)
12034
12053
  function dropEndingNewline(string) {
12035
12054
  return string[string.length - 1] === '\n' ? string.slice(0, -1) : string;
12036
- }
12037
-
12038
- // Note: a long line without a suitable break point will exceed the width limit.
12055
+ } // Note: a long line without a suitable break point will exceed the width limit.
12039
12056
  // Pre-conditions: every char in str isPrintable, str.length > 0, width > 0.
12057
+
12058
+
12040
12059
  function foldString(string, width) {
12041
12060
  // In folded style, $k$ consecutive newlines output as $k+1$ newlines—
12042
12061
  // unless they're before or after a more-indented line, or at the very
12043
12062
  // beginning or end, in which case $k$ maps to $k$.
12044
12063
  // Therefore, parse each chunk as newline(s) followed by a content line.
12045
- var lineRe = /(\n+)([^\n]*)/g;
12064
+ var lineRe = /(\n+)([^\n]*)/g; // first line (possibly an empty line)
12046
12065
 
12047
- // first line (possibly an empty line)
12048
- var result = (function () {
12066
+ var result = function () {
12049
12067
  var nextLF = string.indexOf('\n');
12050
12068
  nextLF = nextLF !== -1 ? nextLF : string.length;
12051
12069
  lineRe.lastIndex = nextLF;
12052
12070
  return foldLine(string.slice(0, nextLF), width);
12053
- }());
12054
- // If we haven't reached the first content line yet, don't add an extra \n.
12071
+ }(); // If we haven't reached the first content line yet, don't add an extra \n.
12072
+
12073
+
12055
12074
  var prevMoreIndented = string[0] === '\n' || string[0] === ' ';
12056
- var moreIndented;
12075
+ var moreIndented; // rest of the lines
12057
12076
 
12058
- // rest of the lines
12059
12077
  var match;
12060
- while ((match = lineRe.exec(string))) {
12061
- var prefix = match[1], line = match[2];
12062
- moreIndented = (line[0] === ' ');
12063
- result += prefix
12064
- + (!prevMoreIndented && !moreIndented && line !== ''
12065
- ? '\n' : '')
12066
- + foldLine(line, width);
12078
+
12079
+ while (match = lineRe.exec(string)) {
12080
+ var prefix = match[1],
12081
+ line = match[2];
12082
+ moreIndented = line[0] === ' ';
12083
+ result += prefix + (!prevMoreIndented && !moreIndented && line !== '' ? '\n' : '') + foldLine(line, width);
12067
12084
  prevMoreIndented = moreIndented;
12068
12085
  }
12069
12086
 
12070
12087
  return result;
12071
- }
12072
-
12073
- // Greedy line breaking.
12088
+ } // Greedy line breaking.
12074
12089
  // Picks the longest line under the limit each time,
12075
12090
  // otherwise settles for the shortest line over the limit.
12076
12091
  // NB. More-indented lines *cannot* be folded, as that would add an extra \n.
12092
+
12093
+
12077
12094
  function foldLine(line, width) {
12078
- if (line === '' || line[0] === ' ') return line;
12095
+ if (line === '' || line[0] === ' ') return line; // Since a more-indented line adds a \n, breaks can't be followed by a space.
12079
12096
 
12080
- // Since a more-indented line adds a \n, breaks can't be followed by a space.
12081
12097
  var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.
12082
- var match;
12083
- // start is an inclusive index. end, curr, and next are exclusive.
12084
- var start = 0, end, curr = 0, next = 0;
12085
- var result = '';
12086
12098
 
12087
- // Invariants: 0 <= start <= length-1.
12099
+ var match; // start is an inclusive index. end, curr, and next are exclusive.
12100
+
12101
+ var start = 0,
12102
+ end,
12103
+ curr = 0,
12104
+ next = 0;
12105
+ var result = ''; // Invariants: 0 <= start <= length-1.
12088
12106
  // 0 <= curr <= next <= max(0, length-2). curr - start <= width.
12089
12107
  // Inside the loop:
12090
12108
  // A match implies length >= 2, so curr and next are <= length-2.
12091
- while ((match = breakRe.exec(line))) {
12092
- next = match.index;
12093
- // maintain invariant: curr - start <= width
12109
+
12110
+ while (match = breakRe.exec(line)) {
12111
+ next = match.index; // maintain invariant: curr - start <= width
12112
+
12094
12113
  if (next - start > width) {
12095
- end = (curr > start) ? curr : next; // derive end <= length-2
12096
- result += '\n' + line.slice(start, end);
12097
- // skip the space that was output as \n
12098
- start = end + 1; // derive start <= length-1
12114
+ end = curr > start ? curr : next; // derive end <= length-2
12115
+
12116
+ result += '\n' + line.slice(start, end); // skip the space that was output as \n
12117
+
12118
+ start = end + 1; // derive start <= length-1
12099
12119
  }
12100
- curr = next;
12101
- }
12102
12120
 
12103
- // By the invariants, start <= length-1, so there is something left over.
12121
+ curr = next;
12122
+ } // By the invariants, start <= length-1, so there is something left over.
12104
12123
  // It is either the whole string or a part starting from non-whitespace.
12105
- result += '\n';
12106
- // Insert a break if the remainder is too long and there is a break available.
12124
+
12125
+
12126
+ result += '\n'; // Insert a break if the remainder is too long and there is a break available.
12127
+
12107
12128
  if (line.length - start > width && curr > start) {
12108
12129
  result += line.slice(start, curr) + '\n' + line.slice(curr + 1);
12109
12130
  } else {
@@ -12111,9 +12132,9 @@ function foldLine(line, width) {
12111
12132
  }
12112
12133
 
12113
12134
  return result.slice(1); // drop extra \n joiner
12114
- }
12135
+ } // Escapes a double-quoted string.
12136
+
12115
12137
 
12116
- // Escapes a double-quoted string.
12117
12138
  function escapeString(string) {
12118
12139
  var result = '';
12119
12140
  var char = 0;
@@ -12136,7 +12157,7 @@ function escapeString(string) {
12136
12157
 
12137
12158
  function writeFlowSequence(state, level, object) {
12138
12159
  var _result = '',
12139
- _tag = state.tag,
12160
+ _tag = state.tag,
12140
12161
  index,
12141
12162
  length,
12142
12163
  value;
@@ -12146,13 +12167,10 @@ function writeFlowSequence(state, level, object) {
12146
12167
 
12147
12168
  if (state.replacer) {
12148
12169
  value = state.replacer.call(object, String(index), value);
12149
- }
12170
+ } // Write only valid elements, put null instead of invalid elements.
12150
12171
 
12151
- // Write only valid elements, put null instead of invalid elements.
12152
- if (writeNode(state, level, value, false, false) ||
12153
- (typeof value === 'undefined' &&
12154
- writeNode(state, level, null, false, false))) {
12155
12172
 
12173
+ if (writeNode(state, level, value, false, false) || typeof value === 'undefined' && writeNode(state, level, null, false, false)) {
12156
12174
  if (_result !== '') _result += ',' + (!state.condenseFlow ? ' ' : '');
12157
12175
  _result += state.dump;
12158
12176
  }
@@ -12164,7 +12182,7 @@ function writeFlowSequence(state, level, object) {
12164
12182
 
12165
12183
  function writeBlockSequence(state, level, object, compact) {
12166
12184
  var _result = '',
12167
- _tag = state.tag,
12185
+ _tag = state.tag,
12168
12186
  index,
12169
12187
  length,
12170
12188
  value;
@@ -12174,13 +12192,10 @@ function writeBlockSequence(state, level, object, compact) {
12174
12192
 
12175
12193
  if (state.replacer) {
12176
12194
  value = state.replacer.call(object, String(index), value);
12177
- }
12195
+ } // Write only valid elements, put null instead of invalid elements.
12178
12196
 
12179
- // Write only valid elements, put null instead of invalid elements.
12180
- if (writeNode(state, level + 1, value, true, true, false, true) ||
12181
- (typeof value === 'undefined' &&
12182
- writeNode(state, level + 1, null, true, true, false, true))) {
12183
12197
 
12198
+ if (writeNode(state, level + 1, value, true, true, false, true) || typeof value === 'undefined' && writeNode(state, level + 1, null, true, true, false, true)) {
12184
12199
  if (!compact || _result !== '') {
12185
12200
  _result += generateNextLine(state, level);
12186
12201
  }
@@ -12200,8 +12215,8 @@ function writeBlockSequence(state, level, object, compact) {
12200
12215
  }
12201
12216
 
12202
12217
  function writeFlowMapping(state, level, object) {
12203
- var _result = '',
12204
- _tag = state.tag,
12218
+ var _result = '',
12219
+ _tag = state.tag,
12205
12220
  objectKeyList = Object.keys(object),
12206
12221
  index,
12207
12222
  length,
@@ -12210,12 +12225,9 @@ function writeFlowMapping(state, level, object) {
12210
12225
  pairBuffer;
12211
12226
 
12212
12227
  for (index = 0, length = objectKeyList.length; index < length; index += 1) {
12213
-
12214
12228
  pairBuffer = '';
12215
12229
  if (_result !== '') pairBuffer += ', ';
12216
-
12217
12230
  if (state.condenseFlow) pairBuffer += '"';
12218
-
12219
12231
  objectKey = objectKeyList[index];
12220
12232
  objectValue = object[objectKey];
12221
12233
 
@@ -12228,16 +12240,14 @@ function writeFlowMapping(state, level, object) {
12228
12240
  }
12229
12241
 
12230
12242
  if (state.dump.length > 1024) pairBuffer += '? ';
12231
-
12232
12243
  pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' ');
12233
12244
 
12234
12245
  if (!writeNode(state, level, objectValue, false, false)) {
12235
12246
  continue; // Skip this pair because of invalid value.
12236
12247
  }
12237
12248
 
12238
- pairBuffer += state.dump;
12249
+ pairBuffer += state.dump; // Both key and value are valid.
12239
12250
 
12240
- // Both key and value are valid.
12241
12251
  _result += pairBuffer;
12242
12252
  }
12243
12253
 
@@ -12246,17 +12256,16 @@ function writeFlowMapping(state, level, object) {
12246
12256
  }
12247
12257
 
12248
12258
  function writeBlockMapping(state, level, object, compact) {
12249
- var _result = '',
12250
- _tag = state.tag,
12259
+ var _result = '',
12260
+ _tag = state.tag,
12251
12261
  objectKeyList = Object.keys(object),
12252
12262
  index,
12253
12263
  length,
12254
12264
  objectKey,
12255
12265
  objectValue,
12256
12266
  explicitPair,
12257
- pairBuffer;
12267
+ pairBuffer; // Allow sorting keys so that the output file is deterministic
12258
12268
 
12259
- // Allow sorting keys so that the output file is deterministic
12260
12269
  if (state.sortKeys === true) {
12261
12270
  // Default sorting
12262
12271
  objectKeyList.sort();
@@ -12286,8 +12295,7 @@ function writeBlockMapping(state, level, object, compact) {
12286
12295
  continue; // Skip this pair because of invalid key.
12287
12296
  }
12288
12297
 
12289
- explicitPair = (state.tag !== null && state.tag !== '?') ||
12290
- (state.dump && state.dump.length > 1024);
12298
+ explicitPair = state.tag !== null && state.tag !== '?' || state.dump && state.dump.length > 1024;
12291
12299
 
12292
12300
  if (explicitPair) {
12293
12301
  if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
@@ -12313,9 +12321,8 @@ function writeBlockMapping(state, level, object, compact) {
12313
12321
  pairBuffer += ': ';
12314
12322
  }
12315
12323
 
12316
- pairBuffer += state.dump;
12324
+ pairBuffer += state.dump; // Both key and value are valid.
12317
12325
 
12318
- // Both key and value are valid.
12319
12326
  _result += pairBuffer;
12320
12327
  }
12321
12328
 
@@ -12331,10 +12338,7 @@ function detectType(state, object, explicit) {
12331
12338
  for (index = 0, length = typeList.length; index < length; index += 1) {
12332
12339
  type = typeList[index];
12333
12340
 
12334
- if ((type.instanceOf || type.predicate) &&
12335
- (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) &&
12336
- (!type.predicate || type.predicate(object))) {
12337
-
12341
+ if ((type.instanceOf || type.predicate) && (!type.instanceOf || typeof object === 'object' && object instanceof type.instanceOf) && (!type.predicate || type.predicate(object))) {
12338
12342
  if (explicit) {
12339
12343
  if (type.multi && type.representName) {
12340
12344
  state.tag = type.representName(object);
@@ -12364,11 +12368,11 @@ function detectType(state, object, explicit) {
12364
12368
  }
12365
12369
 
12366
12370
  return false;
12367
- }
12368
-
12369
- // Serializes `object` and writes it to global `result`.
12371
+ } // Serializes `object` and writes it to global `result`.
12370
12372
  // Returns true on success, or false on invalid object.
12371
12373
  //
12374
+
12375
+
12372
12376
  function writeNode(state, level, object, block, compact, iskey, isblockseq) {
12373
12377
  state.tag = null;
12374
12378
  state.dump = object;
@@ -12378,11 +12382,12 @@ function writeNode(state, level, object, block, compact, iskey, isblockseq) {
12378
12382
  }
12379
12383
 
12380
12384
  var type = _toString.call(state.dump);
12385
+
12381
12386
  var inblock = block;
12382
12387
  var tagStr;
12383
12388
 
12384
12389
  if (block) {
12385
- block = (state.flowLevel < 0 || state.flowLevel > level);
12390
+ block = state.flowLevel < 0 || state.flowLevel > level;
12386
12391
  }
12387
12392
 
12388
12393
  var objectOrArray = type === '[object Object]' || type === '[object Array]',
@@ -12394,7 +12399,7 @@ function writeNode(state, level, object, block, compact, iskey, isblockseq) {
12394
12399
  duplicate = duplicateIndex !== -1;
12395
12400
  }
12396
12401
 
12397
- if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) {
12402
+ if (state.tag !== null && state.tag !== '?' || duplicate || state.indent !== 2 && level > 0) {
12398
12403
  compact = false;
12399
12404
  }
12400
12405
 
@@ -12404,30 +12409,35 @@ function writeNode(state, level, object, block, compact, iskey, isblockseq) {
12404
12409
  if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
12405
12410
  state.usedDuplicates[duplicateIndex] = true;
12406
12411
  }
12412
+
12407
12413
  if (type === '[object Object]') {
12408
- if (block && (Object.keys(state.dump).length !== 0)) {
12414
+ if (block && Object.keys(state.dump).length !== 0) {
12409
12415
  writeBlockMapping(state, level, state.dump, compact);
12416
+
12410
12417
  if (duplicate) {
12411
12418
  state.dump = '&ref_' + duplicateIndex + state.dump;
12412
12419
  }
12413
12420
  } else {
12414
12421
  writeFlowMapping(state, level, state.dump);
12422
+
12415
12423
  if (duplicate) {
12416
12424
  state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
12417
12425
  }
12418
12426
  }
12419
12427
  } else if (type === '[object Array]') {
12420
- if (block && (state.dump.length !== 0)) {
12428
+ if (block && state.dump.length !== 0) {
12421
12429
  if (state.noArrayIndent && !isblockseq && level > 0) {
12422
12430
  writeBlockSequence(state, level - 1, state.dump, compact);
12423
12431
  } else {
12424
12432
  writeBlockSequence(state, level, state.dump, compact);
12425
12433
  }
12434
+
12426
12435
  if (duplicate) {
12427
12436
  state.dump = '&ref_' + duplicateIndex + state.dump;
12428
12437
  }
12429
12438
  } else {
12430
12439
  writeFlowSequence(state, level, state.dump);
12440
+
12431
12441
  if (duplicate) {
12432
12442
  state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
12433
12443
  }
@@ -12457,9 +12467,7 @@ function writeNode(state, level, object, block, compact, iskey, isblockseq) {
12457
12467
  //
12458
12468
  // Also need to encode '!' because it has special meaning (end of tag prefix).
12459
12469
  //
12460
- tagStr = encodeURI(
12461
- state.tag[0] === '!' ? state.tag.slice(1) : state.tag
12462
- ).replace(/!/g, '%21');
12470
+ tagStr = encodeURI(state.tag[0] === '!' ? state.tag.slice(1) : state.tag).replace(/!/g, '%21');
12463
12471
 
12464
12472
  if (state.tag[0] === '!') {
12465
12473
  tagStr = '!' + tagStr;
@@ -12481,22 +12489,21 @@ function getDuplicateReferences(object, state) {
12481
12489
  duplicatesIndexes = [],
12482
12490
  index,
12483
12491
  length;
12484
-
12485
12492
  inspectNode(object, objects, duplicatesIndexes);
12486
12493
 
12487
12494
  for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
12488
12495
  state.duplicates.push(objects[duplicatesIndexes[index]]);
12489
12496
  }
12497
+
12490
12498
  state.usedDuplicates = new Array(length);
12491
12499
  }
12492
12500
 
12493
12501
  function inspectNode(object, objects, duplicatesIndexes) {
12494
- var objectKeyList,
12495
- index,
12496
- length;
12502
+ var objectKeyList, index, length;
12497
12503
 
12498
12504
  if (object !== null && typeof object === 'object') {
12499
12505
  index = objects.indexOf(object);
12506
+
12500
12507
  if (index !== -1) {
12501
12508
  if (duplicatesIndexes.indexOf(index) === -1) {
12502
12509
  duplicatesIndexes.push(index);
@@ -12521,84 +12528,76 @@ function inspectNode(object, objects, duplicatesIndexes) {
12521
12528
 
12522
12529
  function dump$1(input, options) {
12523
12530
  options = options || {};
12524
-
12525
12531
  var state = new State(options);
12526
-
12527
12532
  if (!state.noRefs) getDuplicateReferences(input, state);
12528
-
12529
12533
  var value = input;
12530
12534
 
12531
12535
  if (state.replacer) {
12532
- value = state.replacer.call({ '': value }, '', value);
12536
+ value = state.replacer.call({
12537
+ '': value
12538
+ }, '', value);
12533
12539
  }
12534
12540
 
12535
12541
  if (writeNode(state, 0, value, true, true)) return state.dump + '\n';
12536
-
12537
12542
  return '';
12538
12543
  }
12539
12544
 
12540
12545
  var dump_1 = dump$1;
12541
-
12542
12546
  var dumper = {
12543
- dump: dump_1
12547
+ dump: dump_1
12544
12548
  };
12545
12549
 
12546
12550
  function renamed(from, to) {
12547
12551
  return function () {
12548
- throw new Error('Function yaml.' + from + ' is removed in js-yaml 4. ' +
12549
- 'Use yaml.' + to + ' instead, which is now safe by default.');
12552
+ throw new Error('Function yaml.' + from + ' is removed in js-yaml 4. ' + 'Use yaml.' + to + ' instead, which is now safe by default.');
12550
12553
  };
12551
12554
  }
12552
12555
 
12556
+ var Type = type;
12557
+ var Schema = schema;
12558
+ var FAILSAFE_SCHEMA = failsafe;
12559
+ var JSON_SCHEMA = json;
12560
+ var CORE_SCHEMA = core;
12561
+ var DEFAULT_SCHEMA = _default;
12562
+ var load = loader.load;
12563
+ var loadAll = loader.loadAll;
12564
+ var dump = dumper.dump;
12565
+ var YAMLException = exception; // Re-export all types in case user wants to create custom schema
12553
12566
 
12554
- var Type = type;
12555
- var Schema = schema;
12556
- var FAILSAFE_SCHEMA = failsafe;
12557
- var JSON_SCHEMA = json;
12558
- var CORE_SCHEMA = core;
12559
- var DEFAULT_SCHEMA = _default;
12560
- var load = loader.load;
12561
- var loadAll = loader.loadAll;
12562
- var dump = dumper.dump;
12563
- var YAMLException = exception;
12564
-
12565
- // Re-export all types in case user wants to create custom schema
12566
12567
  var types = {
12567
- binary: binary,
12568
- float: float,
12569
- map: map,
12570
- null: _null,
12571
- pairs: pairs,
12572
- set: set,
12568
+ binary: binary,
12569
+ float: float,
12570
+ map: map,
12571
+ null: _null,
12572
+ pairs: pairs,
12573
+ set: set,
12573
12574
  timestamp: timestamp,
12574
- bool: bool,
12575
- int: int,
12576
- merge: merge,
12577
- omap: omap,
12578
- seq: seq,
12579
- str: str
12580
- };
12581
-
12582
- // Removed functions from JS-YAML 3.0.x
12583
- var safeLoad = renamed('safeLoad', 'load');
12584
- var safeLoadAll = renamed('safeLoadAll', 'loadAll');
12585
- var safeDump = renamed('safeDump', 'dump');
12586
-
12575
+ bool: bool,
12576
+ int: int,
12577
+ merge: merge,
12578
+ omap: omap,
12579
+ seq: seq,
12580
+ str: str
12581
+ }; // Removed functions from JS-YAML 3.0.x
12582
+
12583
+ var safeLoad = renamed('safeLoad', 'load');
12584
+ var safeLoadAll = renamed('safeLoadAll', 'loadAll');
12585
+ var safeDump = renamed('safeDump', 'dump');
12587
12586
  var jsYaml = {
12588
- Type: Type,
12589
- Schema: Schema,
12590
- FAILSAFE_SCHEMA: FAILSAFE_SCHEMA,
12591
- JSON_SCHEMA: JSON_SCHEMA,
12592
- CORE_SCHEMA: CORE_SCHEMA,
12593
- DEFAULT_SCHEMA: DEFAULT_SCHEMA,
12594
- load: load,
12595
- loadAll: loadAll,
12596
- dump: dump,
12597
- YAMLException: YAMLException,
12598
- types: types,
12599
- safeLoad: safeLoad,
12600
- safeLoadAll: safeLoadAll,
12601
- safeDump: safeDump
12587
+ Type: Type,
12588
+ Schema: Schema,
12589
+ FAILSAFE_SCHEMA: FAILSAFE_SCHEMA,
12590
+ JSON_SCHEMA: JSON_SCHEMA,
12591
+ CORE_SCHEMA: CORE_SCHEMA,
12592
+ DEFAULT_SCHEMA: DEFAULT_SCHEMA,
12593
+ load: load,
12594
+ loadAll: loadAll,
12595
+ dump: dump,
12596
+ YAMLException: YAMLException,
12597
+ types: types,
12598
+ safeLoad: safeLoad,
12599
+ safeLoadAll: safeLoadAll,
12600
+ safeDump: safeDump
12602
12601
  };
12603
12602
 
12604
12603
  const name = 'frontmatter';
@@ -12650,18 +12649,18 @@ function createTransformHooks() {
12650
12649
  const plugins = [katex, prism, frontmatter];
12651
12650
 
12652
12651
  function cleanNode(node, depth = 0) {
12653
- if (node.t === 'heading') {
12652
+ if (node.type === 'heading') {
12654
12653
  // drop all paragraphs
12655
- node.c = node.c.filter(item => item.t !== 'paragraph');
12656
- } else if (node.t === 'list_item') {
12657
- var _node$p;
12654
+ node.children = node.children.filter(item => item.type !== 'paragraph');
12655
+ } else if (node.type === 'list_item') {
12656
+ var _node$payload;
12658
12657
 
12659
12658
  // keep first paragraph as content of list_item, drop others
12660
- node.c = node.c.filter(item => {
12661
- if (['paragraph', 'fence'].includes(item.t)) {
12662
- if (!node.v) {
12663
- node.v = item.v;
12664
- node.p = _extends$1({}, node.p, item.p);
12659
+ node.children = node.children.filter(item => {
12660
+ if (['paragraph', 'fence'].includes(item.type)) {
12661
+ if (!node.content) {
12662
+ node.content = item.content;
12663
+ node.payload = _extends$1({}, node.payload, item.payload);
12665
12664
  }
12666
12665
 
12667
12666
  return false;
@@ -12670,16 +12669,16 @@ function cleanNode(node, depth = 0) {
12670
12669
  return true;
12671
12670
  });
12672
12671
 
12673
- if (((_node$p = node.p) == null ? void 0 : _node$p.index) != null) {
12674
- node.v = `${node.p.index}. ${node.v}`;
12672
+ if (((_node$payload = node.payload) == null ? void 0 : _node$payload.index) != null) {
12673
+ node.content = `${node.payload.index}. ${node.content}`;
12675
12674
  }
12676
- } else if (node.t === 'ordered_list') {
12677
- var _node$p$start, _node$p2;
12675
+ } else if (node.type === 'ordered_list') {
12676
+ var _node$payload$startIn, _node$payload2;
12678
12677
 
12679
- let index = (_node$p$start = (_node$p2 = node.p) == null ? void 0 : _node$p2.start) != null ? _node$p$start : 1;
12680
- node.c.forEach(item => {
12681
- if (item.t === 'list_item') {
12682
- item.p = _extends$1({}, item.p, {
12678
+ let index = (_node$payload$startIn = (_node$payload2 = node.payload) == null ? void 0 : _node$payload2.startIndex) != null ? _node$payload$startIn : 1;
12679
+ node.children.forEach(item => {
12680
+ if (item.type === 'list_item') {
12681
+ item.payload = _extends$1({}, item.payload, {
12683
12682
  index
12684
12683
  });
12685
12684
  index += 1;
@@ -12687,17 +12686,17 @@ function cleanNode(node, depth = 0) {
12687
12686
  });
12688
12687
  }
12689
12688
 
12690
- if (node.c.length === 0) {
12691
- delete node.c;
12689
+ if (node.children.length === 0) {
12690
+ delete node.children;
12692
12691
  } else {
12693
- node.c.forEach(child => cleanNode(child, depth + 1));
12692
+ node.children.forEach(child => cleanNode(child, depth + 1));
12694
12693
 
12695
- if (node.c.length === 1 && !node.c[0].v) {
12696
- node.c = node.c[0].c;
12694
+ if (node.children.length === 1 && !node.children[0].content) {
12695
+ node.children = node.children[0].children;
12697
12696
  }
12698
12697
  }
12699
12698
 
12700
- node.d = depth;
12699
+ node.depth = depth;
12701
12700
  }
12702
12701
 
12703
12702
  class Transformer {
@@ -12714,12 +12713,11 @@ class Transformer {
12714
12713
  }
12715
12714
 
12716
12715
  this.assetsMap = assetsMap;
12717
- const md = new Remarkable({
12716
+ const md = new Remarkable('full', {
12718
12717
  html: true,
12719
12718
  breaks: true,
12720
12719
  maxNesting: Infinity
12721
12720
  });
12722
- md.block.ruler.enable(['deflist']);
12723
12721
  md.renderer.rules.htmltag = wrapFunction(md.renderer.rules.htmltag, {
12724
12722
  after: ctx => {
12725
12723
  this.hooks.htmltag.call(ctx);
@@ -12732,14 +12730,13 @@ class Transformer {
12732
12730
  buildTree(tokens) {
12733
12731
  const {
12734
12732
  md
12735
- } = this; // TODO deal with <dl><dt>
12736
-
12733
+ } = this;
12737
12734
  const root = {
12738
- t: 'root',
12739
- d: 0,
12740
- v: '',
12741
- c: [],
12742
- p: {}
12735
+ type: 'root',
12736
+ depth: 0,
12737
+ content: '',
12738
+ children: [],
12739
+ payload: {}
12743
12740
  };
12744
12741
  const stack = [root];
12745
12742
  let depth = 0;
@@ -12758,7 +12755,7 @@ class Transformer {
12758
12755
  if (type === 'heading') {
12759
12756
  depth = token.hLevel;
12760
12757
 
12761
- while (((_current = current) == null ? void 0 : _current.d) >= depth) {
12758
+ while (((_current = current) == null ? void 0 : _current.depth) >= depth) {
12762
12759
  var _current;
12763
12760
 
12764
12761
  stack.pop();
@@ -12767,27 +12764,27 @@ class Transformer {
12767
12764
  } else {
12768
12765
  var _current2;
12769
12766
 
12770
- depth = Math.max(depth, ((_current2 = current) == null ? void 0 : _current2.d) || 0) + 1;
12767
+ depth = Math.max(depth, ((_current2 = current) == null ? void 0 : _current2.depth) || 0) + 1;
12771
12768
 
12772
12769
  if (type === 'ordered_list') {
12773
- payload.start = token.order;
12770
+ payload.startIndex = token.order;
12774
12771
  }
12775
12772
  }
12776
12773
 
12777
12774
  const item = {
12778
- t: type,
12779
- d: depth,
12780
- p: payload,
12781
- v: '',
12782
- c: []
12775
+ type,
12776
+ depth,
12777
+ payload,
12778
+ content: '',
12779
+ children: []
12783
12780
  };
12784
- current.c.push(item);
12781
+ current.children.push(item);
12785
12782
  stack.push(item);
12786
12783
  } else if (!current) {
12787
12784
  continue;
12788
- } else if (token.type === `${current.t}_close`) {
12789
- if (current.t === 'heading') {
12790
- depth = current.d;
12785
+ } else if (token.type === `${current.type}_close`) {
12786
+ if (current.type === 'heading') {
12787
+ depth = current.depth;
12791
12788
  } else {
12792
12789
  stack.pop();
12793
12790
  depth = 0;
@@ -12798,23 +12795,23 @@ class Transformer {
12798
12795
  const data = comment == null ? void 0 : comment[1].trim();
12799
12796
 
12800
12797
  if (data === 'fold') {
12801
- current.p.f = true;
12798
+ current.payload.fold = true;
12802
12799
  ctx.result = '';
12803
12800
  }
12804
12801
  });
12805
12802
  const text = md.renderer.render([token], md.options, {});
12806
12803
  revoke();
12807
- current.v = `${current.v || ''}${text}`;
12804
+ current.content = `${current.content || ''}${text}`;
12808
12805
  } else if (token.type === 'fence') {
12809
12806
  let result = md.renderer.render([token], md.options, {}); // Remarkable only adds className to `<code>` but not `<pre>`, copy it to make PrismJS style work.
12810
12807
 
12811
12808
  const matches = result.match(/<code( class="[^"]*")>/);
12812
12809
  if (matches) result = result.replace('<pre>', `<pre${matches[1]}>`);
12813
- current.c.push({
12814
- t: token.type,
12815
- d: depth + 1,
12816
- v: result,
12817
- c: []
12810
+ current.children.push({
12811
+ type: token.type,
12812
+ depth: depth + 1,
12813
+ content: result,
12814
+ children: []
12818
12815
  });
12819
12816
  } else ;
12820
12817
  }
@@ -12823,7 +12820,7 @@ class Transformer {
12823
12820
  }
12824
12821
 
12825
12822
  transform(content) {
12826
- var _root$c;
12823
+ var _root$children;
12827
12824
 
12828
12825
  const context = {
12829
12826
  features: {}
@@ -12832,7 +12829,7 @@ class Transformer {
12832
12829
  const tokens = this.md.parse(content, {});
12833
12830
  let root = this.buildTree(tokens);
12834
12831
  cleanNode(root);
12835
- if (((_root$c = root.c) == null ? void 0 : _root$c.length) === 1) root = root.c[0];
12832
+ if (((_root$children = root.children) == null ? void 0 : _root$children.length) === 1) root = root.children[0];
12836
12833
  return _extends$1({}, context, {
12837
12834
  root
12838
12835
  });