@lookit/templates 0.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -85,17 +85,17 @@ var chsTemplates = (function () {
85
85
  // Sourced from lodash
86
86
  // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt
87
87
  /* eslint-disable func-style */
88
- var isFunction$1 = function isFunction(value) {
88
+ var isFunction = function isFunction(value) {
89
89
  return typeof value === 'function';
90
90
  };
91
91
  // fallback for older versions of Chrome and Safari
92
92
  /* istanbul ignore next */
93
- if (isFunction$1(/x/)) {
94
- utils.isFunction = isFunction$1 = function (value) {
93
+ if (isFunction(/x/)) {
94
+ utils.isFunction = isFunction = function (value) {
95
95
  return typeof value === 'function' && toString.call(value) === '[object Function]';
96
96
  };
97
97
  }
98
- utils.isFunction = isFunction$1;
98
+ utils.isFunction = isFunction;
99
99
 
100
100
  /* eslint-enable func-style */
101
101
 
@@ -8821,123 +8821,7 @@ var chsTemplates = (function () {
8821
8821
  }
8822
8822
  }
8823
8823
 
8824
- const consoleLogger = {
8825
- type: 'logger',
8826
- log(args) {
8827
- this.output('log', args);
8828
- },
8829
- warn(args) {
8830
- this.output('warn', args);
8831
- },
8832
- error(args) {
8833
- this.output('error', args);
8834
- },
8835
- output(type, args) {
8836
- if (console && console[type]) console[type].apply(console, args);
8837
- }
8838
- };
8839
- class Logger {
8840
- constructor(concreteLogger) {
8841
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
8842
- this.init(concreteLogger, options);
8843
- }
8844
- init(concreteLogger) {
8845
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
8846
- this.prefix = options.prefix || 'i18next:';
8847
- this.logger = concreteLogger || consoleLogger;
8848
- this.options = options;
8849
- this.debug = options.debug;
8850
- }
8851
- log() {
8852
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
8853
- args[_key] = arguments[_key];
8854
- }
8855
- return this.forward(args, 'log', '', true);
8856
- }
8857
- warn() {
8858
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
8859
- args[_key2] = arguments[_key2];
8860
- }
8861
- return this.forward(args, 'warn', '', true);
8862
- }
8863
- error() {
8864
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
8865
- args[_key3] = arguments[_key3];
8866
- }
8867
- return this.forward(args, 'error', '');
8868
- }
8869
- deprecate() {
8870
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
8871
- args[_key4] = arguments[_key4];
8872
- }
8873
- return this.forward(args, 'warn', 'WARNING DEPRECATED: ', true);
8874
- }
8875
- forward(args, lvl, prefix, debugOnly) {
8876
- if (debugOnly && !this.debug) return null;
8877
- if (typeof args[0] === 'string') args[0] = `${prefix}${this.prefix} ${args[0]}`;
8878
- return this.logger[lvl](args);
8879
- }
8880
- create(moduleName) {
8881
- return new Logger(this.logger, {
8882
- ...{
8883
- prefix: `${this.prefix}:${moduleName}:`
8884
- },
8885
- ...this.options
8886
- });
8887
- }
8888
- clone(options) {
8889
- options = options || this.options;
8890
- options.prefix = options.prefix || this.prefix;
8891
- return new Logger(this.logger, options);
8892
- }
8893
- }
8894
- var baseLogger = new Logger();
8895
-
8896
- class EventEmitter {
8897
- constructor() {
8898
- this.observers = {};
8899
- }
8900
- on(events, listener) {
8901
- events.split(' ').forEach(event => {
8902
- if (!this.observers[event]) this.observers[event] = new Map();
8903
- const numListeners = this.observers[event].get(listener) || 0;
8904
- this.observers[event].set(listener, numListeners + 1);
8905
- });
8906
- return this;
8907
- }
8908
- off(event, listener) {
8909
- if (!this.observers[event]) return;
8910
- if (!listener) {
8911
- delete this.observers[event];
8912
- return;
8913
- }
8914
- this.observers[event].delete(listener);
8915
- }
8916
- emit(event) {
8917
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
8918
- args[_key - 1] = arguments[_key];
8919
- }
8920
- if (this.observers[event]) {
8921
- const cloned = Array.from(this.observers[event].entries());
8922
- cloned.forEach(_ref => {
8923
- let [observer, numTimesAdded] = _ref;
8924
- for (let i = 0; i < numTimesAdded; i++) {
8925
- observer(...args);
8926
- }
8927
- });
8928
- }
8929
- if (this.observers['*']) {
8930
- const cloned = Array.from(this.observers['*'].entries());
8931
- cloned.forEach(_ref2 => {
8932
- let [observer, numTimesAdded] = _ref2;
8933
- for (let i = 0; i < numTimesAdded; i++) {
8934
- observer.apply(observer, [event, ...args]);
8935
- }
8936
- });
8937
- }
8938
- }
8939
- }
8940
-
8824
+ const isString = obj => typeof obj === 'string';
8941
8825
  const defer = () => {
8942
8826
  let res;
8943
8827
  let rej;
@@ -8960,9 +8844,9 @@ var chsTemplates = (function () {
8960
8844
  };
8961
8845
  const lastOfPathSeparatorRegExp = /###/g;
8962
8846
  const cleanKey = key => key && key.indexOf('###') > -1 ? key.replace(lastOfPathSeparatorRegExp, '.') : key;
8963
- const canNotTraverseDeeper = object => !object || typeof object === 'string';
8847
+ const canNotTraverseDeeper = object => !object || isString(object);
8964
8848
  const getLastOfPath$1 = (object, path, Empty) => {
8965
- const stack = typeof path !== 'string' ? path : path.split('.');
8849
+ const stack = !isString(path) ? path : path.split('.');
8966
8850
  let stackIndex = 0;
8967
8851
  while (stackIndex < stack.length - 1) {
8968
8852
  if (canNotTraverseDeeper(object)) return {};
@@ -9030,7 +8914,7 @@ var chsTemplates = (function () {
9030
8914
  for (const prop in source) {
9031
8915
  if (prop !== '__proto__' && prop !== 'constructor') {
9032
8916
  if (prop in target) {
9033
- if (typeof target[prop] === 'string' || target[prop] instanceof String || typeof source[prop] === 'string' || source[prop] instanceof String) {
8917
+ if (isString(target[prop]) || target[prop] instanceof String || isString(source[prop]) || source[prop] instanceof String) {
9034
8918
  if (overwrite) target[prop] = source[prop];
9035
8919
  } else {
9036
8920
  deepExtend(target[prop], source[prop], overwrite);
@@ -9052,7 +8936,7 @@ var chsTemplates = (function () {
9052
8936
  '/': '&#x2F;'
9053
8937
  };
9054
8938
  const escape = data => {
9055
- if (typeof data === 'string') {
8939
+ if (isString(data)) {
9056
8940
  return data.replace(/[&<>"'\/]/g, s => _entityMap[s]);
9057
8941
  }
9058
8942
  return data;
@@ -9124,10 +9008,124 @@ var chsTemplates = (function () {
9124
9008
  }
9125
9009
  return current;
9126
9010
  };
9127
- const getCleanedCode = code => {
9128
- if (code && code.indexOf('_') > 0) return code.replace('_', '-');
9129
- return code;
9011
+ const getCleanedCode = code => code && code.replace('_', '-');
9012
+
9013
+ const consoleLogger = {
9014
+ type: 'logger',
9015
+ log(args) {
9016
+ this.output('log', args);
9017
+ },
9018
+ warn(args) {
9019
+ this.output('warn', args);
9020
+ },
9021
+ error(args) {
9022
+ this.output('error', args);
9023
+ },
9024
+ output(type, args) {
9025
+ if (console && console[type]) console[type].apply(console, args);
9026
+ }
9130
9027
  };
9028
+ class Logger {
9029
+ constructor(concreteLogger) {
9030
+ let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
9031
+ this.init(concreteLogger, options);
9032
+ }
9033
+ init(concreteLogger) {
9034
+ let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
9035
+ this.prefix = options.prefix || 'i18next:';
9036
+ this.logger = concreteLogger || consoleLogger;
9037
+ this.options = options;
9038
+ this.debug = options.debug;
9039
+ }
9040
+ log() {
9041
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
9042
+ args[_key] = arguments[_key];
9043
+ }
9044
+ return this.forward(args, 'log', '', true);
9045
+ }
9046
+ warn() {
9047
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
9048
+ args[_key2] = arguments[_key2];
9049
+ }
9050
+ return this.forward(args, 'warn', '', true);
9051
+ }
9052
+ error() {
9053
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
9054
+ args[_key3] = arguments[_key3];
9055
+ }
9056
+ return this.forward(args, 'error', '');
9057
+ }
9058
+ deprecate() {
9059
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
9060
+ args[_key4] = arguments[_key4];
9061
+ }
9062
+ return this.forward(args, 'warn', 'WARNING DEPRECATED: ', true);
9063
+ }
9064
+ forward(args, lvl, prefix, debugOnly) {
9065
+ if (debugOnly && !this.debug) return null;
9066
+ if (isString(args[0])) args[0] = `${prefix}${this.prefix} ${args[0]}`;
9067
+ return this.logger[lvl](args);
9068
+ }
9069
+ create(moduleName) {
9070
+ return new Logger(this.logger, {
9071
+ ...{
9072
+ prefix: `${this.prefix}:${moduleName}:`
9073
+ },
9074
+ ...this.options
9075
+ });
9076
+ }
9077
+ clone(options) {
9078
+ options = options || this.options;
9079
+ options.prefix = options.prefix || this.prefix;
9080
+ return new Logger(this.logger, options);
9081
+ }
9082
+ }
9083
+ var baseLogger = new Logger();
9084
+
9085
+ class EventEmitter {
9086
+ constructor() {
9087
+ this.observers = {};
9088
+ }
9089
+ on(events, listener) {
9090
+ events.split(' ').forEach(event => {
9091
+ if (!this.observers[event]) this.observers[event] = new Map();
9092
+ const numListeners = this.observers[event].get(listener) || 0;
9093
+ this.observers[event].set(listener, numListeners + 1);
9094
+ });
9095
+ return this;
9096
+ }
9097
+ off(event, listener) {
9098
+ if (!this.observers[event]) return;
9099
+ if (!listener) {
9100
+ delete this.observers[event];
9101
+ return;
9102
+ }
9103
+ this.observers[event].delete(listener);
9104
+ }
9105
+ emit(event) {
9106
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
9107
+ args[_key - 1] = arguments[_key];
9108
+ }
9109
+ if (this.observers[event]) {
9110
+ const cloned = Array.from(this.observers[event].entries());
9111
+ cloned.forEach(_ref => {
9112
+ let [observer, numTimesAdded] = _ref;
9113
+ for (let i = 0; i < numTimesAdded; i++) {
9114
+ observer(...args);
9115
+ }
9116
+ });
9117
+ }
9118
+ if (this.observers['*']) {
9119
+ const cloned = Array.from(this.observers['*'].entries());
9120
+ cloned.forEach(_ref2 => {
9121
+ let [observer, numTimesAdded] = _ref2;
9122
+ for (let i = 0; i < numTimesAdded; i++) {
9123
+ observer.apply(observer, [event, ...args]);
9124
+ }
9125
+ });
9126
+ }
9127
+ }
9128
+ }
9131
9129
 
9132
9130
  class ResourceStore extends EventEmitter {
9133
9131
  constructor(data) {
@@ -9168,7 +9166,7 @@ var chsTemplates = (function () {
9168
9166
  if (key) {
9169
9167
  if (Array.isArray(key)) {
9170
9168
  path.push(...key);
9171
- } else if (typeof key === 'string' && keySeparator) {
9169
+ } else if (isString(key) && keySeparator) {
9172
9170
  path.push(...key.split(keySeparator));
9173
9171
  } else {
9174
9172
  path.push(key);
@@ -9181,7 +9179,7 @@ var chsTemplates = (function () {
9181
9179
  ns = path[1];
9182
9180
  key = path.slice(2).join('.');
9183
9181
  }
9184
- if (result || !ignoreJSONStructure || typeof key !== 'string') return result;
9182
+ if (result || !ignoreJSONStructure || !isString(key)) return result;
9185
9183
  return deepFind(this.data && this.data[lng] && this.data[lng][ns], key, keySeparator);
9186
9184
  }
9187
9185
  addResource(lng, ns, key, value) {
@@ -9205,7 +9203,7 @@ var chsTemplates = (function () {
9205
9203
  silent: false
9206
9204
  };
9207
9205
  for (const m in resources) {
9208
- if (typeof resources[m] === 'string' || Array.isArray(resources[m])) this.addResource(lng, ns, m, resources[m], {
9206
+ if (isString(resources[m]) || Array.isArray(resources[m])) this.addResource(lng, ns, m, resources[m], {
9209
9207
  silent: true
9210
9208
  });
9211
9209
  }
@@ -9325,7 +9323,7 @@ var chsTemplates = (function () {
9325
9323
  if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.indexOf(parts[0]) > -1) namespaces = parts.shift();
9326
9324
  key = parts.join(keySeparator);
9327
9325
  }
9328
- if (typeof namespaces === 'string') namespaces = [namespaces];
9326
+ if (isString(namespaces)) namespaces = [namespaces];
9329
9327
  return {
9330
9328
  key,
9331
9329
  namespaces
@@ -9385,8 +9383,8 @@ var chsTemplates = (function () {
9385
9383
  const noObject = ['[object Number]', '[object Function]', '[object RegExp]'];
9386
9384
  const joinArrays = options.joinArrays !== undefined ? options.joinArrays : this.options.joinArrays;
9387
9385
  const handleAsObjectInI18nFormat = !this.i18nFormat || this.i18nFormat.handleAsObject;
9388
- const handleAsObject = typeof res !== 'string' && typeof res !== 'boolean' && typeof res !== 'number';
9389
- if (handleAsObjectInI18nFormat && res && handleAsObject && noObject.indexOf(resType) < 0 && !(typeof joinArrays === 'string' && Array.isArray(res))) {
9386
+ const handleAsObject = !isString(res) && typeof res !== 'boolean' && typeof res !== 'number';
9387
+ if (handleAsObjectInI18nFormat && res && handleAsObject && noObject.indexOf(resType) < 0 && !(isString(joinArrays) && Array.isArray(res))) {
9390
9388
  if (!options.returnObjects && !this.options.returnObjects) {
9391
9389
  if (!this.options.returnedObjectHandler) {
9392
9390
  this.logger.warn('accessing an object - but returnObjects options is not enabled!');
@@ -9421,13 +9419,13 @@ var chsTemplates = (function () {
9421
9419
  }
9422
9420
  res = copy;
9423
9421
  }
9424
- } else if (handleAsObjectInI18nFormat && typeof joinArrays === 'string' && Array.isArray(res)) {
9422
+ } else if (handleAsObjectInI18nFormat && isString(joinArrays) && Array.isArray(res)) {
9425
9423
  res = res.join(joinArrays);
9426
9424
  if (res) res = this.extendTranslation(res, keys, options, lastKey);
9427
9425
  } else {
9428
9426
  let usedDefault = false;
9429
9427
  let usedKey = false;
9430
- const needsPluralHandling = options.count !== undefined && typeof options.count !== 'string';
9428
+ const needsPluralHandling = options.count !== undefined && !isString(options.count);
9431
9429
  const hasDefaultValue = Translator.hasDefaultValue(options);
9432
9430
  const defaultValueSuffix = needsPluralHandling ? this.pluralResolver.getSuffix(lng, options.count, options) : '';
9433
9431
  const defaultValueSuffixOrdinalFallback = options.ordinal && needsPluralHandling ? this.pluralResolver.getSuffix(lng, options.count, {
@@ -9527,13 +9525,13 @@ var chsTemplates = (function () {
9527
9525
  }
9528
9526
  }
9529
9527
  });
9530
- const skipOnVariables = typeof res === 'string' && (options && options.interpolation && options.interpolation.skipOnVariables !== undefined ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
9528
+ const skipOnVariables = isString(res) && (options && options.interpolation && options.interpolation.skipOnVariables !== undefined ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
9531
9529
  let nestBef;
9532
9530
  if (skipOnVariables) {
9533
9531
  const nb = res.match(this.interpolator.nestingRegexp);
9534
9532
  nestBef = nb && nb.length;
9535
9533
  }
9536
- let data = options.replace && typeof options.replace !== 'string' ? options.replace : options;
9534
+ let data = options.replace && !isString(options.replace) ? options.replace : options;
9537
9535
  if (this.options.interpolation.defaultVariables) data = {
9538
9536
  ...this.options.interpolation.defaultVariables,
9539
9537
  ...data
@@ -9558,7 +9556,7 @@ var chsTemplates = (function () {
9558
9556
  if (options.interpolation) this.interpolator.reset();
9559
9557
  }
9560
9558
  const postProcess = options.postProcess || this.options.postProcess;
9561
- const postProcessorNames = typeof postProcess === 'string' ? [postProcess] : postProcess;
9559
+ const postProcessorNames = isString(postProcess) ? [postProcess] : postProcess;
9562
9560
  if (res !== undefined && res !== null && postProcessorNames && postProcessorNames.length && options.applyPostProcessor !== false) {
9563
9561
  res = postProcessor.handle(postProcessorNames, res, key, this.options && this.options.postProcessPassResolved ? {
9564
9562
  i18nResolved: {
@@ -9577,7 +9575,7 @@ var chsTemplates = (function () {
9577
9575
  let exactUsedKey;
9578
9576
  let usedLng;
9579
9577
  let usedNS;
9580
- if (typeof keys === 'string') keys = [keys];
9578
+ if (isString(keys)) keys = [keys];
9581
9579
  keys.forEach(k => {
9582
9580
  if (this.isValidLookup(found)) return;
9583
9581
  const extracted = this.extractFromKey(k, options);
@@ -9585,9 +9583,9 @@ var chsTemplates = (function () {
9585
9583
  usedKey = key;
9586
9584
  let namespaces = extracted.namespaces;
9587
9585
  if (this.options.fallbackNS) namespaces = namespaces.concat(this.options.fallbackNS);
9588
- const needsPluralHandling = options.count !== undefined && typeof options.count !== 'string';
9586
+ const needsPluralHandling = options.count !== undefined && !isString(options.count);
9589
9587
  const needsZeroSuffixLookup = needsPluralHandling && !options.ordinal && options.count === 0 && this.pluralResolver.shouldUseIntlApi();
9590
- const needsContextHandling = options.context !== undefined && (typeof options.context === 'string' || typeof options.context === 'number') && options.context !== '';
9588
+ const needsContextHandling = options.context !== undefined && (isString(options.context) || typeof options.context === 'number') && options.context !== '';
9591
9589
  const codes = options.lngs ? options.lngs : this.languageUtils.toResolveHierarchy(options.lng || this.language, options.fallbackLng);
9592
9590
  namespaces.forEach(ns => {
9593
9591
  if (this.isValidLookup(found)) return;
@@ -9659,7 +9657,7 @@ var chsTemplates = (function () {
9659
9657
  getUsedParamsDetails() {
9660
9658
  let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
9661
9659
  const optionsKeys = ['defaultValue', 'ordinal', 'context', 'replace', 'lng', 'lngs', 'fallbackLng', 'ns', 'keySeparator', 'nsSeparator', 'returnObjects', 'returnDetails', 'joinArrays', 'postProcess', 'interpolation'];
9662
- const useOptionsReplaceForData = options.replace && typeof options.replace !== 'string';
9660
+ const useOptionsReplaceForData = options.replace && !isString(options.replace);
9663
9661
  let data = useOptionsReplaceForData ? options.replace : options;
9664
9662
  if (useOptionsReplaceForData && typeof options.count !== 'undefined') {
9665
9663
  data.count = options.count;
@@ -9714,7 +9712,16 @@ var chsTemplates = (function () {
9714
9712
  return this.formatLanguageCode(p[0]);
9715
9713
  }
9716
9714
  formatLanguageCode(code) {
9717
- if (typeof code === 'string' && code.indexOf('-') > -1) {
9715
+ if (isString(code) && code.indexOf('-') > -1) {
9716
+ if (typeof Intl !== 'undefined' && typeof Intl.getCanonicalLocales !== 'undefined') {
9717
+ try {
9718
+ let formattedCode = Intl.getCanonicalLocales(code)[0];
9719
+ if (formattedCode && this.options.lowerCaseLng) {
9720
+ formattedCode = formattedCode.toLowerCase();
9721
+ }
9722
+ if (formattedCode) return formattedCode;
9723
+ } catch (e) {}
9724
+ }
9718
9725
  const specialCases = ['hans', 'hant', 'latn', 'cyrl', 'cans', 'mong', 'arab'];
9719
9726
  let p = code.split('-');
9720
9727
  if (this.options.lowerCaseLng) {
@@ -9767,7 +9774,7 @@ var chsTemplates = (function () {
9767
9774
  getFallbackCodes(fallbacks, code) {
9768
9775
  if (!fallbacks) return [];
9769
9776
  if (typeof fallbacks === 'function') fallbacks = fallbacks(code);
9770
- if (typeof fallbacks === 'string') fallbacks = [fallbacks];
9777
+ if (isString(fallbacks)) fallbacks = [fallbacks];
9771
9778
  if (Array.isArray(fallbacks)) return fallbacks;
9772
9779
  if (!code) return fallbacks.default || [];
9773
9780
  let found = fallbacks[code];
@@ -9788,11 +9795,11 @@ var chsTemplates = (function () {
9788
9795
  this.logger.warn(`rejecting language code not found in supportedLngs: ${c}`);
9789
9796
  }
9790
9797
  };
9791
- if (typeof code === 'string' && (code.indexOf('-') > -1 || code.indexOf('_') > -1)) {
9798
+ if (isString(code) && (code.indexOf('-') > -1 || code.indexOf('_') > -1)) {
9792
9799
  if (this.options.load !== 'languageOnly') addCode(this.formatLanguageCode(code));
9793
9800
  if (this.options.load !== 'languageOnly' && this.options.load !== 'currentOnly') addCode(this.getScriptPartFromCode(code));
9794
9801
  if (this.options.load !== 'currentOnly') addCode(this.getLanguagePartFromCode(code));
9795
- } else if (typeof code === 'string') {
9802
+ } else if (isString(code)) {
9796
9803
  addCode(this.formatLanguageCode(code));
9797
9804
  }
9798
9805
  fallbackCodes.forEach(fc => {
@@ -10050,7 +10057,7 @@ var chsTemplates = (function () {
10050
10057
  let keySeparator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '.';
10051
10058
  let ignoreJSONStructure = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
10052
10059
  let path = getPathWithDefaults(data, defaultData, key);
10053
- if (!path && ignoreJSONStructure && typeof key === 'string') {
10060
+ if (!path && ignoreJSONStructure && isString(key)) {
10054
10061
  path = deepFind(data, key, keySeparator);
10055
10062
  if (path === undefined) path = deepFind(defaultData, key, keySeparator);
10056
10063
  }
@@ -10160,7 +10167,7 @@ var chsTemplates = (function () {
10160
10167
  if (value === undefined) {
10161
10168
  if (typeof missingInterpolationHandler === 'function') {
10162
10169
  const temp = missingInterpolationHandler(str, match, options);
10163
- value = typeof temp === 'string' ? temp : '';
10170
+ value = isString(temp) ? temp : '';
10164
10171
  } else if (options && Object.prototype.hasOwnProperty.call(options, matchedVar)) {
10165
10172
  value = '';
10166
10173
  } else if (skipOnVariables) {
@@ -10170,7 +10177,7 @@ var chsTemplates = (function () {
10170
10177
  this.logger.warn(`missed to pass in variable ${matchedVar} for interpolating ${str}`);
10171
10178
  value = '';
10172
10179
  }
10173
- } else if (typeof value !== 'string' && !this.useRawValueToEscape) {
10180
+ } else if (!isString(value) && !this.useRawValueToEscape) {
10174
10181
  value = makeString(value);
10175
10182
  }
10176
10183
  const safeValue = todo.safeValue(value);
@@ -10224,7 +10231,7 @@ var chsTemplates = (function () {
10224
10231
  clonedOptions = {
10225
10232
  ...options
10226
10233
  };
10227
- clonedOptions = clonedOptions.replace && typeof clonedOptions.replace !== 'string' ? clonedOptions.replace : clonedOptions;
10234
+ clonedOptions = clonedOptions.replace && !isString(clonedOptions.replace) ? clonedOptions.replace : clonedOptions;
10228
10235
  clonedOptions.applyPostProcessor = false;
10229
10236
  delete clonedOptions.defaultValue;
10230
10237
  let doReduce = false;
@@ -10235,8 +10242,8 @@ var chsTemplates = (function () {
10235
10242
  doReduce = true;
10236
10243
  }
10237
10244
  value = fc(handleHasOptions.call(this, match[1].trim(), clonedOptions), clonedOptions);
10238
- if (value && match[0] === str && typeof value !== 'string') return value;
10239
- if (typeof value !== 'string') value = makeString(value);
10245
+ if (value && match[0] === str && !isString(value)) return value;
10246
+ if (!isString(value)) value = makeString(value);
10240
10247
  if (!value) {
10241
10248
  this.logger.warn(`missed to resolve ${match[1]} for nesting ${str}`);
10242
10249
  value = '';
@@ -10348,8 +10355,7 @@ var chsTemplates = (function () {
10348
10355
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
10349
10356
  interpolation: {}
10350
10357
  };
10351
- const iOpts = options.interpolation;
10352
- this.formatSeparator = iOpts.formatSeparator ? iOpts.formatSeparator : iOpts.formatSeparator || ',';
10358
+ this.formatSeparator = options.interpolation.formatSeparator || ',';
10353
10359
  }
10354
10360
  add(name, fc) {
10355
10361
  this.formats[name.toLowerCase().trim()] = fc;
@@ -10550,8 +10556,8 @@ var chsTemplates = (function () {
10550
10556
  this.logger.warn('No backend was added via i18next.use. Will not load resources.');
10551
10557
  return callback && callback();
10552
10558
  }
10553
- if (typeof languages === 'string') languages = this.languageUtils.toResolveHierarchy(languages);
10554
- if (typeof namespaces === 'string') namespaces = [namespaces];
10559
+ if (isString(languages)) languages = this.languageUtils.toResolveHierarchy(languages);
10560
+ if (isString(namespaces)) namespaces = [namespaces];
10555
10561
  const toLoad = this.queueLoad(languages, namespaces, options, callback);
10556
10562
  if (!toLoad.toLoad.length) {
10557
10563
  if (!toLoad.pending.length) callback();
@@ -10655,8 +10661,8 @@ var chsTemplates = (function () {
10655
10661
  overloadTranslationOptionHandler: args => {
10656
10662
  let ret = {};
10657
10663
  if (typeof args[1] === 'object') ret = args[1];
10658
- if (typeof args[1] === 'string') ret.defaultValue = args[1];
10659
- if (typeof args[2] === 'string') ret.tDescription = args[2];
10664
+ if (isString(args[1])) ret.defaultValue = args[1];
10665
+ if (isString(args[2])) ret.tDescription = args[2];
10660
10666
  if (typeof args[2] === 'object' || typeof args[3] === 'object') {
10661
10667
  const options = args[3] || args[2];
10662
10668
  Object.keys(options).forEach(key => {
@@ -10680,9 +10686,9 @@ var chsTemplates = (function () {
10680
10686
  }
10681
10687
  });
10682
10688
  const transformOptions = options => {
10683
- if (typeof options.ns === 'string') options.ns = [options.ns];
10684
- if (typeof options.fallbackLng === 'string') options.fallbackLng = [options.fallbackLng];
10685
- if (typeof options.fallbackNS === 'string') options.fallbackNS = [options.fallbackNS];
10689
+ if (isString(options.ns)) options.ns = [options.ns];
10690
+ if (isString(options.fallbackLng)) options.fallbackLng = [options.fallbackLng];
10691
+ if (isString(options.fallbackNS)) options.fallbackNS = [options.fallbackNS];
10686
10692
  if (options.supportedLngs && options.supportedLngs.indexOf('cimode') < 0) {
10687
10693
  options.supportedLngs = options.supportedLngs.concat(['cimode']);
10688
10694
  }
@@ -10730,7 +10736,7 @@ var chsTemplates = (function () {
10730
10736
  options = {};
10731
10737
  }
10732
10738
  if (!options.defaultNS && options.defaultNS !== false && options.ns) {
10733
- if (typeof options.ns === 'string') {
10739
+ if (isString(options.ns)) {
10734
10740
  options.defaultNS = options.ns;
10735
10741
  } else if (options.ns.indexOf('translation') < 0) {
10736
10742
  options.defaultNS = options.ns[0];
@@ -10863,7 +10869,7 @@ var chsTemplates = (function () {
10863
10869
  loadResources(language) {
10864
10870
  let callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
10865
10871
  let usedCallback = callback;
10866
- const usedLng = typeof language === 'string' ? language : this.language;
10872
+ const usedLng = isString(language) ? language : this.language;
10867
10873
  if (typeof language === 'function') usedCallback = language;
10868
10874
  if (!this.options.resources || this.options.partialBundledLanguages) {
10869
10875
  if (usedLng && usedLng.toLowerCase() === 'cimode' && (!this.options.preload || this.options.preload.length === 0)) return usedCallback();
@@ -10981,7 +10987,7 @@ var chsTemplates = (function () {
10981
10987
  };
10982
10988
  const setLng = lngs => {
10983
10989
  if (!lng && !lngs && this.services.languageDetector) lngs = [];
10984
- const l = typeof lngs === 'string' ? lngs : this.services.languageUtils.getBestMatchFromCodes(lngs);
10990
+ const l = isString(lngs) ? lngs : this.services.languageUtils.getBestMatchFromCodes(lngs);
10985
10991
  if (l) {
10986
10992
  if (!this.language) {
10987
10993
  setLngProps(l);
@@ -11033,7 +11039,7 @@ var chsTemplates = (function () {
11033
11039
  }
11034
11040
  return _this3.t(resultKey, options);
11035
11041
  };
11036
- if (typeof lng === 'string') {
11042
+ if (isString(lng)) {
11037
11043
  fixedT.lng = lng;
11038
11044
  } else {
11039
11045
  fixedT.lngs = lng;
@@ -11084,7 +11090,7 @@ var chsTemplates = (function () {
11084
11090
  if (callback) callback();
11085
11091
  return Promise.resolve();
11086
11092
  }
11087
- if (typeof ns === 'string') ns = [ns];
11093
+ if (isString(ns)) ns = [ns];
11088
11094
  ns.forEach(n => {
11089
11095
  if (this.options.ns.indexOf(n) < 0) this.options.ns.push(n);
11090
11096
  });
@@ -11096,7 +11102,7 @@ var chsTemplates = (function () {
11096
11102
  }
11097
11103
  loadLanguages(lngs, callback) {
11098
11104
  const deferred = defer();
11099
- if (typeof lngs === 'string') lngs = [lngs];
11105
+ if (isString(lngs)) lngs = [lngs];
11100
11106
  const preloaded = this.options.preload || [];
11101
11107
  const newLngs = lngs.filter(lng => preloaded.indexOf(lng) < 0 && this.services.languageUtils.isSupportedCode(lng));
11102
11108
  if (!newLngs.length) {
@@ -13484,7 +13490,7 @@ var chsTemplates = (function () {
13484
13490
  }
13485
13491
  return obj;
13486
13492
  };
13487
- var codePointAt = hasNativeCodePointAt
13493
+ var codePointAt$1 = hasNativeCodePointAt
13488
13494
  ? // Native
13489
13495
  function codePointAt(s, index) {
13490
13496
  return s.codePointAt(index);
@@ -13544,7 +13550,7 @@ var chsTemplates = (function () {
13544
13550
  matchIdentifierAtIndex = function matchIdentifierAtIndex(s, index) {
13545
13551
  var match = [];
13546
13552
  while (true) {
13547
- var c = codePointAt(s, index);
13553
+ var c = codePointAt$1(s, index);
13548
13554
  if (c === undefined || _isWhiteSpace(c) || _isPatternSyntax(c)) {
13549
13555
  break;
13550
13556
  }
@@ -14261,7 +14267,7 @@ var chsTemplates = (function () {
14261
14267
  if (offset >= this.message.length) {
14262
14268
  throw Error('out of bound');
14263
14269
  }
14264
- var code = codePointAt(this.message, offset);
14270
+ var code = codePointAt$1(this.message, offset);
14265
14271
  if (code === undefined) {
14266
14272
  throw Error("Offset ".concat(offset, " is at invalid UTF-16 code unit boundary"));
14267
14273
  }
@@ -15363,12 +15369,7 @@ var chsTemplates = (function () {
15363
15369
 
15364
15370
  ICU.type = 'i18nFormat';
15365
15371
 
15366
- var jsYaml$1 = {};
15367
-
15368
- var loader$1 = {};
15369
-
15370
- var common$6 = {};
15371
-
15372
+ /*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */
15372
15373
  function isNothing(subject) {
15373
15374
  return (typeof subject === 'undefined') || (subject === null);
15374
15375
  }
@@ -15419,21 +15420,52 @@ var chsTemplates = (function () {
15419
15420
  }
15420
15421
 
15421
15422
 
15422
- common$6.isNothing = isNothing;
15423
- common$6.isObject = isObject;
15424
- common$6.toArray = toArray;
15425
- common$6.repeat = repeat;
15426
- common$6.isNegativeZero = isNegativeZero;
15427
- common$6.extend = extend;
15423
+ var isNothing_1 = isNothing;
15424
+ var isObject_1 = isObject;
15425
+ var toArray_1 = toArray;
15426
+ var repeat_1 = repeat;
15427
+ var isNegativeZero_1 = isNegativeZero;
15428
+ var extend_1 = extend;
15428
15429
 
15429
- function YAMLException$4(reason, mark) {
15430
+ var common = {
15431
+ isNothing: isNothing_1,
15432
+ isObject: isObject_1,
15433
+ toArray: toArray_1,
15434
+ repeat: repeat_1,
15435
+ isNegativeZero: isNegativeZero_1,
15436
+ extend: extend_1
15437
+ };
15438
+
15439
+ // YAML error class. http://stackoverflow.com/questions/8458984
15440
+
15441
+
15442
+ function formatError(exception, compact) {
15443
+ var where = '', message = exception.reason || '(unknown reason)';
15444
+
15445
+ if (!exception.mark) return message;
15446
+
15447
+ if (exception.mark.name) {
15448
+ where += 'in "' + exception.mark.name + '" ';
15449
+ }
15450
+
15451
+ where += '(' + (exception.mark.line + 1) + ':' + (exception.mark.column + 1) + ')';
15452
+
15453
+ if (!compact && exception.mark.snippet) {
15454
+ where += '\n\n' + exception.mark.snippet;
15455
+ }
15456
+
15457
+ return message + ' ' + where;
15458
+ }
15459
+
15460
+
15461
+ function YAMLException$1(reason, mark) {
15430
15462
  // Super constructor
15431
15463
  Error.call(this);
15432
15464
 
15433
15465
  this.name = 'YAMLException';
15434
15466
  this.reason = reason;
15435
15467
  this.mark = mark;
15436
- this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : '');
15468
+ this.message = formatError(this, false);
15437
15469
 
15438
15470
  // Include stack trace in error object
15439
15471
  if (Error.captureStackTrace) {
@@ -15447,108 +15479,122 @@ var chsTemplates = (function () {
15447
15479
 
15448
15480
 
15449
15481
  // Inherit from Error
15450
- YAMLException$4.prototype = Object.create(Error.prototype);
15451
- YAMLException$4.prototype.constructor = YAMLException$4;
15482
+ YAMLException$1.prototype = Object.create(Error.prototype);
15483
+ YAMLException$1.prototype.constructor = YAMLException$1;
15452
15484
 
15453
15485
 
15454
- YAMLException$4.prototype.toString = function toString(compact) {
15455
- var result = this.name + ': ';
15486
+ YAMLException$1.prototype.toString = function toString(compact) {
15487
+ return this.name + ': ' + formatError(this, compact);
15488
+ };
15456
15489
 
15457
- result += this.reason || '(unknown reason)';
15458
15490
 
15459
- if (!compact && this.mark) {
15460
- result += ' ' + this.mark.toString();
15461
- }
15491
+ var exception = YAMLException$1;
15462
15492
 
15463
- return result;
15464
- };
15493
+ // get snippet for a single line, respecting maxLength
15494
+ function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
15495
+ var head = '';
15496
+ var tail = '';
15497
+ var maxHalfLength = Math.floor(maxLineLength / 2) - 1;
15465
15498
 
15499
+ if (position - lineStart > maxHalfLength) {
15500
+ head = ' ... ';
15501
+ lineStart = position - maxHalfLength + head.length;
15502
+ }
15466
15503
 
15467
- var exception = YAMLException$4;
15504
+ if (lineEnd - position > maxHalfLength) {
15505
+ tail = ' ...';
15506
+ lineEnd = position + maxHalfLength - tail.length;
15507
+ }
15468
15508
 
15469
- var common$5 = common$6;
15509
+ return {
15510
+ str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, '→') + tail,
15511
+ pos: position - lineStart + head.length // relative position
15512
+ };
15513
+ }
15470
15514
 
15471
15515
 
15472
- function Mark$1(name, buffer, position, line, column) {
15473
- this.name = name;
15474
- this.buffer = buffer;
15475
- this.position = position;
15476
- this.line = line;
15477
- this.column = column;
15516
+ function padStart(string, max) {
15517
+ return common.repeat(' ', max - string.length) + string;
15478
15518
  }
15479
15519
 
15480
15520
 
15481
- Mark$1.prototype.getSnippet = function getSnippet(indent, maxLength) {
15482
- var head, start, tail, end, snippet;
15521
+ function makeSnippet(mark, options) {
15522
+ options = Object.create(options || null);
15483
15523
 
15484
- if (!this.buffer) return null;
15524
+ if (!mark.buffer) return null;
15485
15525
 
15486
- indent = indent || 4;
15487
- maxLength = maxLength || 75;
15526
+ if (!options.maxLength) options.maxLength = 79;
15527
+ if (typeof options.indent !== 'number') options.indent = 1;
15528
+ if (typeof options.linesBefore !== 'number') options.linesBefore = 3;
15529
+ if (typeof options.linesAfter !== 'number') options.linesAfter = 2;
15488
15530
 
15489
- head = '';
15490
- start = this.position;
15491
-
15492
- while (start > 0 && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1)) === -1) {
15493
- start -= 1;
15494
- if (this.position - start > (maxLength / 2 - 1)) {
15495
- head = ' ... ';
15496
- start += 5;
15497
- break;
15498
- }
15499
- }
15531
+ var re = /\r?\n|\r|\0/g;
15532
+ var lineStarts = [ 0 ];
15533
+ var lineEnds = [];
15534
+ var match;
15535
+ var foundLineNo = -1;
15500
15536
 
15501
- tail = '';
15502
- end = this.position;
15537
+ while ((match = re.exec(mark.buffer))) {
15538
+ lineEnds.push(match.index);
15539
+ lineStarts.push(match.index + match[0].length);
15503
15540
 
15504
- while (end < this.buffer.length && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end)) === -1) {
15505
- end += 1;
15506
- if (end - this.position > (maxLength / 2 - 1)) {
15507
- tail = ' ... ';
15508
- end -= 5;
15509
- break;
15541
+ if (mark.position <= match.index && foundLineNo < 0) {
15542
+ foundLineNo = lineStarts.length - 2;
15510
15543
  }
15511
15544
  }
15512
15545
 
15513
- snippet = this.buffer.slice(start, end);
15514
-
15515
- return common$5.repeat(' ', indent) + head + snippet + tail + '\n' +
15516
- common$5.repeat(' ', indent + this.position - start + head.length) + '^';
15517
- };
15546
+ if (foundLineNo < 0) foundLineNo = lineStarts.length - 1;
15518
15547
 
15548
+ var result = '', i, line;
15549
+ var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
15550
+ var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
15519
15551
 
15520
- Mark$1.prototype.toString = function toString(compact) {
15521
- var snippet, where = '';
15522
-
15523
- if (this.name) {
15524
- where += 'in "' + this.name + '" ';
15552
+ for (i = 1; i <= options.linesBefore; i++) {
15553
+ if (foundLineNo - i < 0) break;
15554
+ line = getLine(
15555
+ mark.buffer,
15556
+ lineStarts[foundLineNo - i],
15557
+ lineEnds[foundLineNo - i],
15558
+ mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]),
15559
+ maxLineLength
15560
+ );
15561
+ result = common.repeat(' ', options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) +
15562
+ ' | ' + line.str + '\n' + result;
15525
15563
  }
15526
15564
 
15527
- where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1);
15528
-
15529
- if (!compact) {
15530
- snippet = this.getSnippet();
15565
+ line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
15566
+ result += common.repeat(' ', options.indent) + padStart((mark.line + 1).toString(), lineNoLength) +
15567
+ ' | ' + line.str + '\n';
15568
+ result += common.repeat('-', options.indent + lineNoLength + 3 + line.pos) + '^' + '\n';
15531
15569
 
15532
- if (snippet) {
15533
- where += ':\n' + snippet;
15534
- }
15570
+ for (i = 1; i <= options.linesAfter; i++) {
15571
+ if (foundLineNo + i >= lineEnds.length) break;
15572
+ line = getLine(
15573
+ mark.buffer,
15574
+ lineStarts[foundLineNo + i],
15575
+ lineEnds[foundLineNo + i],
15576
+ mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]),
15577
+ maxLineLength
15578
+ );
15579
+ result += common.repeat(' ', options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) +
15580
+ ' | ' + line.str + '\n';
15535
15581
  }
15536
15582
 
15537
- return where;
15538
- };
15539
-
15583
+ return result.replace(/\n$/, '');
15584
+ }
15540
15585
 
15541
- var mark = Mark$1;
15542
15586
 
15543
- var YAMLException$3 = exception;
15587
+ var snippet = makeSnippet;
15544
15588
 
15545
15589
  var TYPE_CONSTRUCTOR_OPTIONS = [
15546
15590
  'kind',
15591
+ 'multi',
15547
15592
  'resolve',
15548
15593
  'construct',
15549
15594
  'instanceOf',
15550
15595
  'predicate',
15551
15596
  'represent',
15597
+ 'representName',
15552
15598
  'defaultStyle',
15553
15599
  'styleAliases'
15554
15600
  ];
@@ -15573,60 +15619,61 @@ var chsTemplates = (function () {
15573
15619
  return result;
15574
15620
  }
15575
15621
 
15576
- function Type$h(tag, options) {
15622
+ function Type$1(tag, options) {
15577
15623
  options = options || {};
15578
15624
 
15579
15625
  Object.keys(options).forEach(function (name) {
15580
15626
  if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
15581
- throw new YAMLException$3('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
15627
+ throw new exception('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
15582
15628
  }
15583
15629
  });
15584
15630
 
15585
15631
  // TODO: Add tag format check.
15586
- this.tag = tag;
15587
- this.kind = options['kind'] || null;
15588
- this.resolve = options['resolve'] || function () { return true; };
15589
- this.construct = options['construct'] || function (data) { return data; };
15590
- this.instanceOf = options['instanceOf'] || null;
15591
- this.predicate = options['predicate'] || null;
15592
- this.represent = options['represent'] || null;
15593
- this.defaultStyle = options['defaultStyle'] || null;
15594
- this.styleAliases = compileStyleAliases(options['styleAliases'] || null);
15632
+ this.options = options; // keep original options in case user wants to extend this type later
15633
+ this.tag = tag;
15634
+ this.kind = options['kind'] || null;
15635
+ this.resolve = options['resolve'] || function () { return true; };
15636
+ this.construct = options['construct'] || function (data) { return data; };
15637
+ this.instanceOf = options['instanceOf'] || null;
15638
+ this.predicate = options['predicate'] || null;
15639
+ this.represent = options['represent'] || null;
15640
+ this.representName = options['representName'] || null;
15641
+ this.defaultStyle = options['defaultStyle'] || null;
15642
+ this.multi = options['multi'] || false;
15643
+ this.styleAliases = compileStyleAliases(options['styleAliases'] || null);
15595
15644
 
15596
15645
  if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
15597
- throw new YAMLException$3('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
15646
+ throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
15598
15647
  }
15599
15648
  }
15600
15649
 
15601
- var type = Type$h;
15650
+ var type = Type$1;
15602
15651
 
15603
15652
  /*eslint-disable max-len*/
15604
15653
 
15605
- var common$4 = common$6;
15606
- var YAMLException$2 = exception;
15607
- var Type$g = type;
15608
15654
 
15609
15655
 
15610
- function compileList(schema, name, result) {
15611
- var exclude = [];
15612
15656
 
15613
- schema.include.forEach(function (includedSchema) {
15614
- result = compileList(includedSchema, name, result);
15615
- });
15657
+
15658
+ function compileList(schema, name) {
15659
+ var result = [];
15616
15660
 
15617
15661
  schema[name].forEach(function (currentType) {
15662
+ var newIndex = result.length;
15663
+
15618
15664
  result.forEach(function (previousType, previousIndex) {
15619
- if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) {
15620
- exclude.push(previousIndex);
15665
+ if (previousType.tag === currentType.tag &&
15666
+ previousType.kind === currentType.kind &&
15667
+ previousType.multi === currentType.multi) {
15668
+
15669
+ newIndex = previousIndex;
15621
15670
  }
15622
15671
  });
15623
15672
 
15624
- result.push(currentType);
15673
+ result[newIndex] = currentType;
15625
15674
  });
15626
15675
 
15627
- return result.filter(function (type, index) {
15628
- return exclude.indexOf(index) === -1;
15629
- });
15676
+ return result;
15630
15677
  }
15631
15678
 
15632
15679
 
@@ -15635,11 +15682,22 @@ var chsTemplates = (function () {
15635
15682
  scalar: {},
15636
15683
  sequence: {},
15637
15684
  mapping: {},
15638
- fallback: {}
15685
+ fallback: {},
15686
+ multi: {
15687
+ scalar: [],
15688
+ sequence: [],
15689
+ mapping: [],
15690
+ fallback: []
15691
+ }
15639
15692
  }, index, length;
15640
15693
 
15641
15694
  function collectType(type) {
15642
- result[type.kind][type.tag] = result['fallback'][type.tag] = type;
15695
+ if (type.multi) {
15696
+ result.multi[type.kind].push(type);
15697
+ result.multi['fallback'].push(type);
15698
+ } else {
15699
+ result[type.kind][type.tag] = result['fallback'][type.tag] = type;
15700
+ }
15643
15701
  }
15644
15702
 
15645
15703
  for (index = 0, length = arguments.length; index < length; index += 1) {
@@ -15649,89 +15707,84 @@ var chsTemplates = (function () {
15649
15707
  }
15650
15708
 
15651
15709
 
15652
- function Schema$5(definition) {
15653
- this.include = definition.include || [];
15654
- this.implicit = definition.implicit || [];
15655
- this.explicit = definition.explicit || [];
15656
-
15657
- this.implicit.forEach(function (type) {
15658
- if (type.loadKind && type.loadKind !== 'scalar') {
15659
- throw new YAMLException$2('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.');
15660
- }
15661
- });
15662
-
15663
- this.compiledImplicit = compileList(this, 'implicit', []);
15664
- this.compiledExplicit = compileList(this, 'explicit', []);
15665
- this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit);
15710
+ function Schema$1(definition) {
15711
+ return this.extend(definition);
15666
15712
  }
15667
15713
 
15668
15714
 
15669
- Schema$5.DEFAULT = null;
15715
+ Schema$1.prototype.extend = function extend(definition) {
15716
+ var implicit = [];
15717
+ var explicit = [];
15670
15718
 
15719
+ if (definition instanceof type) {
15720
+ // Schema.extend(type)
15721
+ explicit.push(definition);
15671
15722
 
15672
- Schema$5.create = function createSchema() {
15673
- var schemas, types;
15723
+ } else if (Array.isArray(definition)) {
15724
+ // Schema.extend([ type1, type2, ... ])
15725
+ explicit = explicit.concat(definition);
15674
15726
 
15675
- switch (arguments.length) {
15676
- case 1:
15677
- schemas = Schema$5.DEFAULT;
15678
- types = arguments[0];
15679
- break;
15680
-
15681
- case 2:
15682
- schemas = arguments[0];
15683
- types = arguments[1];
15684
- break;
15727
+ } else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
15728
+ // Schema.extend({ explicit: [ type1, type2, ... ], implicit: [ type1, type2, ... ] })
15729
+ if (definition.implicit) implicit = implicit.concat(definition.implicit);
15730
+ if (definition.explicit) explicit = explicit.concat(definition.explicit);
15685
15731
 
15686
- default:
15687
- throw new YAMLException$2('Wrong number of arguments for Schema.create function');
15732
+ } else {
15733
+ throw new exception('Schema.extend argument should be a Type, [ Type ], ' +
15734
+ 'or a schema definition ({ implicit: [...], explicit: [...] })');
15688
15735
  }
15689
15736
 
15690
- schemas = common$4.toArray(schemas);
15691
- types = common$4.toArray(types);
15737
+ implicit.forEach(function (type$1) {
15738
+ if (!(type$1 instanceof type)) {
15739
+ throw new exception('Specified list of YAML types (or a single Type object) contains a non-Type object.');
15740
+ }
15692
15741
 
15693
- if (!schemas.every(function (schema) { return schema instanceof Schema$5; })) {
15694
- throw new YAMLException$2('Specified list of super schemas (or a single Schema object) contains a non-Schema object.');
15695
- }
15742
+ if (type$1.loadKind && type$1.loadKind !== 'scalar') {
15743
+ throw new exception('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.');
15744
+ }
15696
15745
 
15697
- if (!types.every(function (type) { return type instanceof Type$g; })) {
15698
- throw new YAMLException$2('Specified list of YAML types (or a single Type object) contains a non-Type object.');
15699
- }
15746
+ if (type$1.multi) {
15747
+ throw new exception('There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.');
15748
+ }
15749
+ });
15700
15750
 
15701
- return new Schema$5({
15702
- include: schemas,
15703
- explicit: types
15751
+ explicit.forEach(function (type$1) {
15752
+ if (!(type$1 instanceof type)) {
15753
+ throw new exception('Specified list of YAML types (or a single Type object) contains a non-Type object.');
15754
+ }
15704
15755
  });
15705
- };
15706
15756
 
15757
+ var result = Object.create(Schema$1.prototype);
15707
15758
 
15708
- var schema = Schema$5;
15759
+ result.implicit = (this.implicit || []).concat(implicit);
15760
+ result.explicit = (this.explicit || []).concat(explicit);
15709
15761
 
15710
- var Type$f = type;
15762
+ result.compiledImplicit = compileList(result, 'implicit');
15763
+ result.compiledExplicit = compileList(result, 'explicit');
15764
+ result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
15765
+
15766
+ return result;
15767
+ };
15711
15768
 
15712
- var str = new Type$f('tag:yaml.org,2002:str', {
15769
+
15770
+ var schema = Schema$1;
15771
+
15772
+ var str = new type('tag:yaml.org,2002:str', {
15713
15773
  kind: 'scalar',
15714
15774
  construct: function (data) { return data !== null ? data : ''; }
15715
15775
  });
15716
15776
 
15717
- var Type$e = type;
15718
-
15719
- var seq = new Type$e('tag:yaml.org,2002:seq', {
15777
+ var seq = new type('tag:yaml.org,2002:seq', {
15720
15778
  kind: 'sequence',
15721
15779
  construct: function (data) { return data !== null ? data : []; }
15722
15780
  });
15723
15781
 
15724
- var Type$d = type;
15725
-
15726
- var map = new Type$d('tag:yaml.org,2002:map', {
15782
+ var map = new type('tag:yaml.org,2002:map', {
15727
15783
  kind: 'mapping',
15728
15784
  construct: function (data) { return data !== null ? data : {}; }
15729
15785
  });
15730
15786
 
15731
- var Schema$4 = schema;
15732
-
15733
-
15734
- var failsafe = new Schema$4({
15787
+ var failsafe = new schema({
15735
15788
  explicit: [
15736
15789
  str,
15737
15790
  seq,
@@ -15739,8 +15792,6 @@ var chsTemplates = (function () {
15739
15792
  ]
15740
15793
  });
15741
15794
 
15742
- var Type$c = type;
15743
-
15744
15795
  function resolveYamlNull(data) {
15745
15796
  if (data === null) return true;
15746
15797
 
@@ -15758,7 +15809,7 @@ var chsTemplates = (function () {
15758
15809
  return object === null;
15759
15810
  }
15760
15811
 
15761
- var _null = new Type$c('tag:yaml.org,2002:null', {
15812
+ var _null = new type('tag:yaml.org,2002:null', {
15762
15813
  kind: 'scalar',
15763
15814
  resolve: resolveYamlNull,
15764
15815
  construct: constructYamlNull,
@@ -15767,13 +15818,12 @@ var chsTemplates = (function () {
15767
15818
  canonical: function () { return '~'; },
15768
15819
  lowercase: function () { return 'null'; },
15769
15820
  uppercase: function () { return 'NULL'; },
15770
- camelcase: function () { return 'Null'; }
15821
+ camelcase: function () { return 'Null'; },
15822
+ empty: function () { return ''; }
15771
15823
  },
15772
15824
  defaultStyle: 'lowercase'
15773
15825
  });
15774
15826
 
15775
- var Type$b = type;
15776
-
15777
15827
  function resolveYamlBoolean(data) {
15778
15828
  if (data === null) return false;
15779
15829
 
@@ -15793,7 +15843,7 @@ var chsTemplates = (function () {
15793
15843
  return Object.prototype.toString.call(object) === '[object Boolean]';
15794
15844
  }
15795
15845
 
15796
- var bool = new Type$b('tag:yaml.org,2002:bool', {
15846
+ var bool = new type('tag:yaml.org,2002:bool', {
15797
15847
  kind: 'scalar',
15798
15848
  resolve: resolveYamlBoolean,
15799
15849
  construct: constructYamlBoolean,
@@ -15806,9 +15856,6 @@ var chsTemplates = (function () {
15806
15856
  defaultStyle: 'lowercase'
15807
15857
  });
15808
15858
 
15809
- var common$3 = common$6;
15810
- var Type$a = type;
15811
-
15812
15859
  function isHexCode(c) {
15813
15860
  return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) ||
15814
15861
  ((0x41/* A */ <= c) && (c <= 0x46/* F */)) ||
@@ -15874,17 +15921,22 @@ var chsTemplates = (function () {
15874
15921
  return hasDigits && ch !== '_';
15875
15922
  }
15876
15923
 
15877
- // base 8
15878
- for (; index < max; index++) {
15879
- ch = data[index];
15880
- if (ch === '_') continue;
15881
- if (!isOctCode(data.charCodeAt(index))) return false;
15882
- hasDigits = true;
15924
+
15925
+ if (ch === 'o') {
15926
+ // base 8
15927
+ index++;
15928
+
15929
+ for (; index < max; index++) {
15930
+ ch = data[index];
15931
+ if (ch === '_') continue;
15932
+ if (!isOctCode(data.charCodeAt(index))) return false;
15933
+ hasDigits = true;
15934
+ }
15935
+ return hasDigits && ch !== '_';
15883
15936
  }
15884
- return hasDigits && ch !== '_';
15885
15937
  }
15886
15938
 
15887
- // base 10 (except 0) or base 60
15939
+ // base 10 (except 0)
15888
15940
 
15889
15941
  // value should not start with `_`;
15890
15942
  if (ch === '_') return false;
@@ -15892,7 +15944,6 @@ var chsTemplates = (function () {
15892
15944
  for (; index < max; index++) {
15893
15945
  ch = data[index];
15894
15946
  if (ch === '_') continue;
15895
- if (ch === ':') break;
15896
15947
  if (!isDecCode(data.charCodeAt(index))) {
15897
15948
  return false;
15898
15949
  }
@@ -15902,15 +15953,11 @@ var chsTemplates = (function () {
15902
15953
  // Should have digits and should not end with `_`
15903
15954
  if (!hasDigits || ch === '_') return false;
15904
15955
 
15905
- // if !base60 - done;
15906
- if (ch !== ':') return true;
15907
-
15908
- // base60 almost not used, no needs to optimize
15909
- return /^(:[0-5]?[0-9])+$/.test(data.slice(index));
15956
+ return true;
15910
15957
  }
15911
15958
 
15912
15959
  function constructYamlInteger(data) {
15913
- var value = data, sign = 1, ch, base, digits = [];
15960
+ var value = data, sign = 1, ch;
15914
15961
 
15915
15962
  if (value.indexOf('_') !== -1) {
15916
15963
  value = value.replace(/_/g, '');
@@ -15928,25 +15975,8 @@ var chsTemplates = (function () {
15928
15975
 
15929
15976
  if (ch === '0') {
15930
15977
  if (value[1] === 'b') return sign * parseInt(value.slice(2), 2);
15931
- if (value[1] === 'x') return sign * parseInt(value, 16);
15932
- return sign * parseInt(value, 8);
15933
- }
15934
-
15935
- if (value.indexOf(':') !== -1) {
15936
- value.split(':').forEach(function (v) {
15937
- digits.unshift(parseInt(v, 10));
15938
- });
15939
-
15940
- value = 0;
15941
- base = 1;
15942
-
15943
- digits.forEach(function (d) {
15944
- value += (d * base);
15945
- base *= 60;
15946
- });
15947
-
15948
- return sign * value;
15949
-
15978
+ if (value[1] === 'x') return sign * parseInt(value.slice(2), 16);
15979
+ if (value[1] === 'o') return sign * parseInt(value.slice(2), 8);
15950
15980
  }
15951
15981
 
15952
15982
  return sign * parseInt(value, 10);
@@ -15954,17 +15984,17 @@ var chsTemplates = (function () {
15954
15984
 
15955
15985
  function isInteger(object) {
15956
15986
  return (Object.prototype.toString.call(object)) === '[object Number]' &&
15957
- (object % 1 === 0 && !common$3.isNegativeZero(object));
15987
+ (object % 1 === 0 && !common.isNegativeZero(object));
15958
15988
  }
15959
15989
 
15960
- var int = new Type$a('tag:yaml.org,2002:int', {
15990
+ var int = new type('tag:yaml.org,2002:int', {
15961
15991
  kind: 'scalar',
15962
15992
  resolve: resolveYamlInteger,
15963
15993
  construct: constructYamlInteger,
15964
15994
  predicate: isInteger,
15965
15995
  represent: {
15966
15996
  binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); },
15967
- octal: function (obj) { return obj >= 0 ? '0' + obj.toString(8) : '-0' + obj.toString(8).slice(1); },
15997
+ octal: function (obj) { return obj >= 0 ? '0o' + obj.toString(8) : '-0o' + obj.toString(8).slice(1); },
15968
15998
  decimal: function (obj) { return obj.toString(10); },
15969
15999
  /* eslint-disable max-len */
15970
16000
  hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); }
@@ -15978,17 +16008,12 @@ var chsTemplates = (function () {
15978
16008
  }
15979
16009
  });
15980
16010
 
15981
- var common$2 = common$6;
15982
- var Type$9 = type;
15983
-
15984
16011
  var YAML_FLOAT_PATTERN = new RegExp(
15985
16012
  // 2.5e4, 2.5 and integers
15986
- '^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' +
16013
+ '^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' +
15987
16014
  // .2e4, .2
15988
16015
  // special case, seems not from spec
15989
16016
  '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' +
15990
- // 20:59
15991
- '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' +
15992
16017
  // .inf
15993
16018
  '|[-+]?\\.(?:inf|Inf|INF)' +
15994
16019
  // .nan
@@ -16008,11 +16033,10 @@ var chsTemplates = (function () {
16008
16033
  }
16009
16034
 
16010
16035
  function constructYamlFloat(data) {
16011
- var value, sign, base, digits;
16036
+ var value, sign;
16012
16037
 
16013
16038
  value = data.replace(/_/g, '').toLowerCase();
16014
16039
  sign = value[0] === '-' ? -1 : 1;
16015
- digits = [];
16016
16040
 
16017
16041
  if ('+-'.indexOf(value[0]) >= 0) {
16018
16042
  value = value.slice(1);
@@ -16023,22 +16047,6 @@ var chsTemplates = (function () {
16023
16047
 
16024
16048
  } else if (value === '.nan') {
16025
16049
  return NaN;
16026
-
16027
- } else if (value.indexOf(':') >= 0) {
16028
- value.split(':').forEach(function (v) {
16029
- digits.unshift(parseFloat(v, 10));
16030
- });
16031
-
16032
- value = 0.0;
16033
- base = 1;
16034
-
16035
- digits.forEach(function (d) {
16036
- value += d * base;
16037
- base *= 60;
16038
- });
16039
-
16040
- return sign * value;
16041
-
16042
16050
  }
16043
16051
  return sign * parseFloat(value, 10);
16044
16052
  }
@@ -16067,7 +16075,7 @@ var chsTemplates = (function () {
16067
16075
  case 'uppercase': return '-.INF';
16068
16076
  case 'camelcase': return '-.Inf';
16069
16077
  }
16070
- } else if (common$2.isNegativeZero(object)) {
16078
+ } else if (common.isNegativeZero(object)) {
16071
16079
  return '-0.0';
16072
16080
  }
16073
16081
 
@@ -16081,10 +16089,10 @@ var chsTemplates = (function () {
16081
16089
 
16082
16090
  function isFloat(object) {
16083
16091
  return (Object.prototype.toString.call(object) === '[object Number]') &&
16084
- (object % 1 !== 0 || common$2.isNegativeZero(object));
16092
+ (object % 1 !== 0 || common.isNegativeZero(object));
16085
16093
  }
16086
16094
 
16087
- var float = new Type$9('tag:yaml.org,2002:float', {
16095
+ var float = new type('tag:yaml.org,2002:float', {
16088
16096
  kind: 'scalar',
16089
16097
  resolve: resolveYamlFloat,
16090
16098
  construct: constructYamlFloat,
@@ -16093,13 +16101,7 @@ var chsTemplates = (function () {
16093
16101
  defaultStyle: 'lowercase'
16094
16102
  });
16095
16103
 
16096
- var Schema$3 = schema;
16097
-
16098
-
16099
- var json = new Schema$3({
16100
- include: [
16101
- failsafe
16102
- ],
16104
+ var json = failsafe.extend({
16103
16105
  implicit: [
16104
16106
  _null,
16105
16107
  bool,
@@ -16108,16 +16110,7 @@ var chsTemplates = (function () {
16108
16110
  ]
16109
16111
  });
16110
16112
 
16111
- var Schema$2 = schema;
16112
-
16113
-
16114
- var core = new Schema$2({
16115
- include: [
16116
- json
16117
- ]
16118
- });
16119
-
16120
- var Type$8 = type;
16113
+ var core = json;
16121
16114
 
16122
16115
  var YAML_DATE_REGEXP = new RegExp(
16123
16116
  '^([0-9][0-9][0-9][0-9])' + // [1] year
@@ -16196,7 +16189,7 @@ var chsTemplates = (function () {
16196
16189
  return object.toISOString();
16197
16190
  }
16198
16191
 
16199
- var timestamp = new Type$8('tag:yaml.org,2002:timestamp', {
16192
+ var timestamp = new type('tag:yaml.org,2002:timestamp', {
16200
16193
  kind: 'scalar',
16201
16194
  resolve: resolveYamlTimestamp,
16202
16195
  construct: constructYamlTimestamp,
@@ -16204,28 +16197,19 @@ var chsTemplates = (function () {
16204
16197
  represent: representYamlTimestamp
16205
16198
  });
16206
16199
 
16207
- var Type$7 = type;
16208
-
16209
16200
  function resolveYamlMerge(data) {
16210
16201
  return data === '<<' || data === null;
16211
16202
  }
16212
16203
 
16213
- var merge = new Type$7('tag:yaml.org,2002:merge', {
16204
+ var merge = new type('tag:yaml.org,2002:merge', {
16214
16205
  kind: 'scalar',
16215
16206
  resolve: resolveYamlMerge
16216
16207
  });
16217
16208
 
16218
16209
  /*eslint-disable no-bitwise*/
16219
16210
 
16220
- var NodeBuffer;
16221
16211
 
16222
- try {
16223
- // A trick for browserified version, to not include `Buffer` shim
16224
- var _require$1 = commonjsRequire;
16225
- NodeBuffer = _require$1('buffer').Buffer;
16226
- } catch (__) {}
16227
16212
 
16228
- var Type$6 = type;
16229
16213
 
16230
16214
 
16231
16215
  // [ 64, 65, 66 ] -> [ padding, CR, LF ]
@@ -16289,13 +16273,7 @@ var chsTemplates = (function () {
16289
16273
  result.push((bits >> 4) & 0xFF);
16290
16274
  }
16291
16275
 
16292
- // Wrap into Buffer for NodeJS and leave Array for browser
16293
- if (NodeBuffer) {
16294
- // Support node 6.+ Buffer API when available
16295
- return NodeBuffer.from ? NodeBuffer.from(result) : new NodeBuffer(result);
16296
- }
16297
-
16298
- return result;
16276
+ return new Uint8Array(result);
16299
16277
  }
16300
16278
 
16301
16279
  function representYamlBinary(object /*, style*/) {
@@ -16340,11 +16318,11 @@ var chsTemplates = (function () {
16340
16318
  return result;
16341
16319
  }
16342
16320
 
16343
- function isBinary(object) {
16344
- return NodeBuffer && NodeBuffer.isBuffer(object);
16321
+ function isBinary(obj) {
16322
+ return Object.prototype.toString.call(obj) === '[object Uint8Array]';
16345
16323
  }
16346
16324
 
16347
- var binary = new Type$6('tag:yaml.org,2002:binary', {
16325
+ var binary = new type('tag:yaml.org,2002:binary', {
16348
16326
  kind: 'scalar',
16349
16327
  resolve: resolveYamlBinary,
16350
16328
  construct: constructYamlBinary,
@@ -16352,8 +16330,6 @@ var chsTemplates = (function () {
16352
16330
  represent: representYamlBinary
16353
16331
  });
16354
16332
 
16355
- var Type$5 = type;
16356
-
16357
16333
  var _hasOwnProperty$3 = Object.prototype.hasOwnProperty;
16358
16334
  var _toString$2 = Object.prototype.toString;
16359
16335
 
@@ -16389,14 +16365,12 @@ var chsTemplates = (function () {
16389
16365
  return data !== null ? data : [];
16390
16366
  }
16391
16367
 
16392
- var omap = new Type$5('tag:yaml.org,2002:omap', {
16368
+ var omap = new type('tag:yaml.org,2002:omap', {
16393
16369
  kind: 'sequence',
16394
16370
  resolve: resolveYamlOmap,
16395
16371
  construct: constructYamlOmap
16396
16372
  });
16397
16373
 
16398
- var Type$4 = type;
16399
-
16400
16374
  var _toString$1 = Object.prototype.toString;
16401
16375
 
16402
16376
  function resolveYamlPairs(data) {
@@ -16426,273 +16400,72 @@ var chsTemplates = (function () {
16426
16400
  if (data === null) return [];
16427
16401
 
16428
16402
  var index, length, pair, keys, result,
16429
- object = data;
16430
-
16431
- result = new Array(object.length);
16432
-
16433
- for (index = 0, length = object.length; index < length; index += 1) {
16434
- pair = object[index];
16435
-
16436
- keys = Object.keys(pair);
16437
-
16438
- result[index] = [ keys[0], pair[keys[0]] ];
16439
- }
16440
-
16441
- return result;
16442
- }
16443
-
16444
- var pairs = new Type$4('tag:yaml.org,2002:pairs', {
16445
- kind: 'sequence',
16446
- resolve: resolveYamlPairs,
16447
- construct: constructYamlPairs
16448
- });
16449
-
16450
- var Type$3 = type;
16451
-
16452
- var _hasOwnProperty$2 = Object.prototype.hasOwnProperty;
16453
-
16454
- function resolveYamlSet(data) {
16455
- if (data === null) return true;
16456
-
16457
- var key, object = data;
16458
-
16459
- for (key in object) {
16460
- if (_hasOwnProperty$2.call(object, key)) {
16461
- if (object[key] !== null) return false;
16462
- }
16463
- }
16464
-
16465
- return true;
16466
- }
16467
-
16468
- function constructYamlSet(data) {
16469
- return data !== null ? data : {};
16470
- }
16471
-
16472
- var set = new Type$3('tag:yaml.org,2002:set', {
16473
- kind: 'mapping',
16474
- resolve: resolveYamlSet,
16475
- construct: constructYamlSet
16476
- });
16477
-
16478
- var Schema$1 = schema;
16479
-
16480
-
16481
- var default_safe = new Schema$1({
16482
- include: [
16483
- core
16484
- ],
16485
- implicit: [
16486
- timestamp,
16487
- merge
16488
- ],
16489
- explicit: [
16490
- binary,
16491
- omap,
16492
- pairs,
16493
- set
16494
- ]
16495
- });
16496
-
16497
- var Type$2 = type;
16498
-
16499
- function resolveJavascriptUndefined() {
16500
- return true;
16501
- }
16502
-
16503
- function constructJavascriptUndefined() {
16504
- /*eslint-disable no-undefined*/
16505
- return undefined;
16506
- }
16507
-
16508
- function representJavascriptUndefined() {
16509
- return '';
16510
- }
16511
-
16512
- function isUndefined(object) {
16513
- return typeof object === 'undefined';
16514
- }
16515
-
16516
- var _undefined = new Type$2('tag:yaml.org,2002:js/undefined', {
16517
- kind: 'scalar',
16518
- resolve: resolveJavascriptUndefined,
16519
- construct: constructJavascriptUndefined,
16520
- predicate: isUndefined,
16521
- represent: representJavascriptUndefined
16522
- });
16523
-
16524
- var Type$1 = type;
16525
-
16526
- function resolveJavascriptRegExp(data) {
16527
- if (data === null) return false;
16528
- if (data.length === 0) return false;
16529
-
16530
- var regexp = data,
16531
- tail = /\/([gim]*)$/.exec(data),
16532
- modifiers = '';
16533
-
16534
- // if regexp starts with '/' it can have modifiers and must be properly closed
16535
- // `/foo/gim` - modifiers tail can be maximum 3 chars
16536
- if (regexp[0] === '/') {
16537
- if (tail) modifiers = tail[1];
16538
-
16539
- if (modifiers.length > 3) return false;
16540
- // if expression starts with /, is should be properly terminated
16541
- if (regexp[regexp.length - modifiers.length - 1] !== '/') return false;
16542
- }
16543
-
16544
- return true;
16545
- }
16546
-
16547
- function constructJavascriptRegExp(data) {
16548
- var regexp = data,
16549
- tail = /\/([gim]*)$/.exec(data),
16550
- modifiers = '';
16551
-
16552
- // `/foo/gim` - tail can be maximum 4 chars
16553
- if (regexp[0] === '/') {
16554
- if (tail) modifiers = tail[1];
16555
- regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
16556
- }
16557
-
16558
- return new RegExp(regexp, modifiers);
16559
- }
16560
-
16561
- function representJavascriptRegExp(object /*, style*/) {
16562
- var result = '/' + object.source + '/';
16563
-
16564
- if (object.global) result += 'g';
16565
- if (object.multiline) result += 'm';
16566
- if (object.ignoreCase) result += 'i';
16567
-
16568
- return result;
16569
- }
16570
-
16571
- function isRegExp(object) {
16572
- return Object.prototype.toString.call(object) === '[object RegExp]';
16573
- }
16574
-
16575
- var regexp = new Type$1('tag:yaml.org,2002:js/regexp', {
16576
- kind: 'scalar',
16577
- resolve: resolveJavascriptRegExp,
16578
- construct: constructJavascriptRegExp,
16579
- predicate: isRegExp,
16580
- represent: representJavascriptRegExp
16581
- });
16582
-
16583
- var esprima;
16584
-
16585
- // Browserified version does not have esprima
16586
- //
16587
- // 1. For node.js just require module as deps
16588
- // 2. For browser try to require mudule via external AMD system.
16589
- // If not found - try to fallback to window.esprima. If not
16590
- // found too - then fail to parse.
16591
- //
16592
- try {
16593
- // workaround to exclude package from browserify list.
16594
- var _require = commonjsRequire;
16595
- esprima = _require('esprima');
16596
- } catch (_) {
16597
- /* eslint-disable no-redeclare */
16598
- /* global window */
16599
- if (typeof window !== 'undefined') esprima = window.esprima;
16600
- }
16403
+ object = data;
16601
16404
 
16602
- var Type = type;
16405
+ result = new Array(object.length);
16603
16406
 
16604
- function resolveJavascriptFunction(data) {
16605
- if (data === null) return false;
16407
+ for (index = 0, length = object.length; index < length; index += 1) {
16408
+ pair = object[index];
16606
16409
 
16607
- try {
16608
- var source = '(' + data + ')',
16609
- ast = esprima.parse(source, { range: true });
16610
-
16611
- if (ast.type !== 'Program' ||
16612
- ast.body.length !== 1 ||
16613
- ast.body[0].type !== 'ExpressionStatement' ||
16614
- (ast.body[0].expression.type !== 'ArrowFunctionExpression' &&
16615
- ast.body[0].expression.type !== 'FunctionExpression')) {
16616
- return false;
16617
- }
16410
+ keys = Object.keys(pair);
16618
16411
 
16619
- return true;
16620
- } catch (err) {
16621
- return false;
16412
+ result[index] = [ keys[0], pair[keys[0]] ];
16622
16413
  }
16623
- }
16624
16414
 
16625
- function constructJavascriptFunction(data) {
16626
- /*jslint evil:true*/
16415
+ return result;
16416
+ }
16627
16417
 
16628
- var source = '(' + data + ')',
16629
- ast = esprima.parse(source, { range: true }),
16630
- params = [],
16631
- body;
16418
+ var pairs = new type('tag:yaml.org,2002:pairs', {
16419
+ kind: 'sequence',
16420
+ resolve: resolveYamlPairs,
16421
+ construct: constructYamlPairs
16422
+ });
16632
16423
 
16633
- if (ast.type !== 'Program' ||
16634
- ast.body.length !== 1 ||
16635
- ast.body[0].type !== 'ExpressionStatement' ||
16636
- (ast.body[0].expression.type !== 'ArrowFunctionExpression' &&
16637
- ast.body[0].expression.type !== 'FunctionExpression')) {
16638
- throw new Error('Failed to resolve function');
16639
- }
16424
+ var _hasOwnProperty$2 = Object.prototype.hasOwnProperty;
16640
16425
 
16641
- ast.body[0].expression.params.forEach(function (param) {
16642
- params.push(param.name);
16643
- });
16426
+ function resolveYamlSet(data) {
16427
+ if (data === null) return true;
16644
16428
 
16645
- body = ast.body[0].expression.body.range;
16429
+ var key, object = data;
16646
16430
 
16647
- // Esprima's ranges include the first '{' and the last '}' characters on
16648
- // function expressions. So cut them out.
16649
- if (ast.body[0].expression.body.type === 'BlockStatement') {
16650
- /*eslint-disable no-new-func*/
16651
- return new Function(params, source.slice(body[0] + 1, body[1] - 1));
16431
+ for (key in object) {
16432
+ if (_hasOwnProperty$2.call(object, key)) {
16433
+ if (object[key] !== null) return false;
16434
+ }
16652
16435
  }
16653
- // ES6 arrow functions can omit the BlockStatement. In that case, just return
16654
- // the body.
16655
- /*eslint-disable no-new-func*/
16656
- return new Function(params, 'return ' + source.slice(body[0], body[1]));
16657
- }
16658
16436
 
16659
- function representJavascriptFunction(object /*, style*/) {
16660
- return object.toString();
16437
+ return true;
16661
16438
  }
16662
16439
 
16663
- function isFunction(object) {
16664
- return Object.prototype.toString.call(object) === '[object Function]';
16440
+ function constructYamlSet(data) {
16441
+ return data !== null ? data : {};
16665
16442
  }
16666
16443
 
16667
- var _function = new Type('tag:yaml.org,2002:js/function', {
16668
- kind: 'scalar',
16669
- resolve: resolveJavascriptFunction,
16670
- construct: constructJavascriptFunction,
16671
- predicate: isFunction,
16672
- represent: representJavascriptFunction
16444
+ var set = new type('tag:yaml.org,2002:set', {
16445
+ kind: 'mapping',
16446
+ resolve: resolveYamlSet,
16447
+ construct: constructYamlSet
16673
16448
  });
16674
16449
 
16675
- var Schema = schema;
16676
-
16677
-
16678
- var default_full = Schema.DEFAULT = new Schema({
16679
- include: [
16680
- default_safe
16450
+ var _default = core.extend({
16451
+ implicit: [
16452
+ timestamp,
16453
+ merge
16681
16454
  ],
16682
16455
  explicit: [
16683
- _undefined,
16684
- regexp,
16685
- _function
16456
+ binary,
16457
+ omap,
16458
+ pairs,
16459
+ set
16686
16460
  ]
16687
16461
  });
16688
16462
 
16689
16463
  /*eslint-disable max-len,no-use-before-define*/
16690
16464
 
16691
- var common$1 = common$6;
16692
- var YAMLException$1 = exception;
16693
- var Mark = mark;
16694
- var DEFAULT_SAFE_SCHEMA$1 = default_safe;
16695
- var DEFAULT_FULL_SCHEMA$1 = default_full;
16465
+
16466
+
16467
+
16468
+
16696
16469
 
16697
16470
 
16698
16471
  var _hasOwnProperty$1 = Object.prototype.hasOwnProperty;
@@ -16819,9 +16592,12 @@ var chsTemplates = (function () {
16819
16592
  this.input = input;
16820
16593
 
16821
16594
  this.filename = options['filename'] || null;
16822
- this.schema = options['schema'] || DEFAULT_FULL_SCHEMA$1;
16595
+ this.schema = options['schema'] || _default;
16823
16596
  this.onWarning = options['onWarning'] || null;
16597
+ // (Hidden) Remove? makes the loader to expect YAML 1.1 documents
16598
+ // if such documents have no explicit %YAML directive
16824
16599
  this.legacy = options['legacy'] || false;
16600
+
16825
16601
  this.json = options['json'] || false;
16826
16602
  this.listener = options['listener'] || null;
16827
16603
 
@@ -16834,6 +16610,10 @@ var chsTemplates = (function () {
16834
16610
  this.lineStart = 0;
16835
16611
  this.lineIndent = 0;
16836
16612
 
16613
+ // position of first leading tab in the current line,
16614
+ // used to make sure there are no tabs in the indentation
16615
+ this.firstTabInLine = -1;
16616
+
16837
16617
  this.documents = [];
16838
16618
 
16839
16619
  /*
@@ -16850,9 +16630,17 @@ var chsTemplates = (function () {
16850
16630
 
16851
16631
 
16852
16632
  function generateError(state, message) {
16853
- return new YAMLException$1(
16854
- message,
16855
- new Mark(state.filename, state.input, state.position, state.line, (state.position - state.lineStart)));
16633
+ var mark = {
16634
+ name: state.filename,
16635
+ buffer: state.input.slice(0, -1), // omit trailing \0
16636
+ position: state.position,
16637
+ line: state.line,
16638
+ column: state.position - state.lineStart
16639
+ };
16640
+
16641
+ mark.snippet = snippet(mark);
16642
+
16643
+ return new exception(message, mark);
16856
16644
  }
16857
16645
 
16858
16646
  function throwError(state, message) {
@@ -16924,6 +16712,12 @@ var chsTemplates = (function () {
16924
16712
  throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive');
16925
16713
  }
16926
16714
 
16715
+ try {
16716
+ prefix = decodeURIComponent(prefix);
16717
+ } catch (err) {
16718
+ throwError(state, 'tag prefix is malformed: ' + prefix);
16719
+ }
16720
+
16927
16721
  state.tagMap[handle] = prefix;
16928
16722
  }
16929
16723
  };
@@ -16954,7 +16748,7 @@ var chsTemplates = (function () {
16954
16748
  function mergeMappings(state, destination, source, overridableKeys) {
16955
16749
  var sourceKeys, key, index, quantity;
16956
16750
 
16957
- if (!common$1.isObject(source)) {
16751
+ if (!common.isObject(source)) {
16958
16752
  throwError(state, 'cannot merge mappings; the provided source object is unacceptable');
16959
16753
  }
16960
16754
 
@@ -16970,7 +16764,9 @@ var chsTemplates = (function () {
16970
16764
  }
16971
16765
  }
16972
16766
 
16973
- function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startPos) {
16767
+ function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode,
16768
+ startLine, startLineStart, startPos) {
16769
+
16974
16770
  var index, quantity;
16975
16771
 
16976
16772
  // The output is a plain object here, so keys can only be strings.
@@ -17017,10 +16813,22 @@ var chsTemplates = (function () {
17017
16813
  !_hasOwnProperty$1.call(overridableKeys, keyNode) &&
17018
16814
  _hasOwnProperty$1.call(_result, keyNode)) {
17019
16815
  state.line = startLine || state.line;
16816
+ state.lineStart = startLineStart || state.lineStart;
17020
16817
  state.position = startPos || state.position;
17021
16818
  throwError(state, 'duplicated mapping key');
17022
16819
  }
17023
- _result[keyNode] = valueNode;
16820
+
16821
+ // used for this specific key only because Object.defineProperty is slow
16822
+ if (keyNode === '__proto__') {
16823
+ Object.defineProperty(_result, keyNode, {
16824
+ configurable: true,
16825
+ enumerable: true,
16826
+ writable: true,
16827
+ value: valueNode
16828
+ });
16829
+ } else {
16830
+ _result[keyNode] = valueNode;
16831
+ }
17024
16832
  delete overridableKeys[keyNode];
17025
16833
  }
17026
16834
 
@@ -17045,6 +16853,7 @@ var chsTemplates = (function () {
17045
16853
 
17046
16854
  state.line += 1;
17047
16855
  state.lineStart = state.position;
16856
+ state.firstTabInLine = -1;
17048
16857
  }
17049
16858
 
17050
16859
  function skipSeparationSpace(state, allowComments, checkIndent) {
@@ -17053,6 +16862,9 @@ var chsTemplates = (function () {
17053
16862
 
17054
16863
  while (ch !== 0) {
17055
16864
  while (is_WHITE_SPACE(ch)) {
16865
+ if (ch === 0x09/* Tab */ && state.firstTabInLine === -1) {
16866
+ state.firstTabInLine = state.position;
16867
+ }
17056
16868
  ch = state.input.charCodeAt(++state.position);
17057
16869
  }
17058
16870
 
@@ -17113,7 +16925,7 @@ var chsTemplates = (function () {
17113
16925
  if (count === 1) {
17114
16926
  state.result += ' ';
17115
16927
  } else if (count > 1) {
17116
- state.result += common$1.repeat('\n', count - 1);
16928
+ state.result += common.repeat('\n', count - 1);
17117
16929
  }
17118
16930
  }
17119
16931
 
@@ -17354,6 +17166,8 @@ var chsTemplates = (function () {
17354
17166
  function readFlowCollection(state, nodeIndent) {
17355
17167
  var readNext = true,
17356
17168
  _line,
17169
+ _lineStart,
17170
+ _pos,
17357
17171
  _tag = state.tag,
17358
17172
  _result,
17359
17173
  _anchor = state.anchor,
@@ -17362,7 +17176,7 @@ var chsTemplates = (function () {
17362
17176
  isPair,
17363
17177
  isExplicitPair,
17364
17178
  isMapping,
17365
- overridableKeys = {},
17179
+ overridableKeys = Object.create(null),
17366
17180
  keyNode,
17367
17181
  keyTag,
17368
17182
  valueNode,
@@ -17402,6 +17216,9 @@ var chsTemplates = (function () {
17402
17216
  return true;
17403
17217
  } else if (!readNext) {
17404
17218
  throwError(state, 'missed comma between flow collection entries');
17219
+ } else if (ch === 0x2C/* , */) {
17220
+ // "flow collection entries can never be completely empty", as per YAML 1.2, section 7.4
17221
+ throwError(state, "expected the node content, but found ','");
17405
17222
  }
17406
17223
 
17407
17224
  keyTag = keyNode = valueNode = null;
@@ -17417,7 +17234,9 @@ var chsTemplates = (function () {
17417
17234
  }
17418
17235
  }
17419
17236
 
17420
- _line = state.line;
17237
+ _line = state.line; // Save the current line.
17238
+ _lineStart = state.lineStart;
17239
+ _pos = state.position;
17421
17240
  composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
17422
17241
  keyTag = state.tag;
17423
17242
  keyNode = state.result;
@@ -17434,9 +17253,9 @@ var chsTemplates = (function () {
17434
17253
  }
17435
17254
 
17436
17255
  if (isMapping) {
17437
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode);
17256
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
17438
17257
  } else if (isPair) {
17439
- _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode));
17258
+ _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
17440
17259
  } else {
17441
17260
  _result.push(keyNode);
17442
17261
  }
@@ -17542,7 +17361,7 @@ var chsTemplates = (function () {
17542
17361
 
17543
17362
  // Perform the chomping.
17544
17363
  if (chomping === CHOMPING_KEEP) {
17545
- state.result += common$1.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
17364
+ state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
17546
17365
  } else if (chomping === CHOMPING_CLIP) {
17547
17366
  if (didReadContent) { // i.e. only if the scalar is not empty.
17548
17367
  state.result += '\n';
@@ -17560,12 +17379,12 @@ var chsTemplates = (function () {
17560
17379
  if (is_WHITE_SPACE(ch)) {
17561
17380
  atMoreIndented = true;
17562
17381
  // except for the first content line (cf. Example 8.1)
17563
- state.result += common$1.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
17382
+ state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
17564
17383
 
17565
17384
  // End of more-indented block.
17566
17385
  } else if (atMoreIndented) {
17567
17386
  atMoreIndented = false;
17568
- state.result += common$1.repeat('\n', emptyLines + 1);
17387
+ state.result += common.repeat('\n', emptyLines + 1);
17569
17388
 
17570
17389
  // Just one line break - perceive as the same line.
17571
17390
  } else if (emptyLines === 0) {
@@ -17575,13 +17394,13 @@ var chsTemplates = (function () {
17575
17394
 
17576
17395
  // Several line breaks - perceive as different lines.
17577
17396
  } else {
17578
- state.result += common$1.repeat('\n', emptyLines);
17397
+ state.result += common.repeat('\n', emptyLines);
17579
17398
  }
17580
17399
 
17581
17400
  // Literal style: just add exact number of line breaks between content lines.
17582
17401
  } else {
17583
17402
  // Keep all line breaks except the header line break.
17584
- state.result += common$1.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
17403
+ state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
17585
17404
  }
17586
17405
 
17587
17406
  didReadContent = true;
@@ -17608,6 +17427,10 @@ var chsTemplates = (function () {
17608
17427
  detected = false,
17609
17428
  ch;
17610
17429
 
17430
+ // there is a leading tab before this token, so it can't be a block sequence/mapping;
17431
+ // it can still be flow sequence/mapping or a scalar
17432
+ if (state.firstTabInLine !== -1) return false;
17433
+
17611
17434
  if (state.anchor !== null) {
17612
17435
  state.anchorMap[state.anchor] = _result;
17613
17436
  }
@@ -17615,6 +17438,10 @@ var chsTemplates = (function () {
17615
17438
  ch = state.input.charCodeAt(state.position);
17616
17439
 
17617
17440
  while (ch !== 0) {
17441
+ if (state.firstTabInLine !== -1) {
17442
+ state.position = state.firstTabInLine;
17443
+ throwError(state, 'tab characters must not be used in indentation');
17444
+ }
17618
17445
 
17619
17446
  if (ch !== 0x2D/* - */) {
17620
17447
  break;
@@ -17665,11 +17492,13 @@ var chsTemplates = (function () {
17665
17492
  var following,
17666
17493
  allowCompact,
17667
17494
  _line,
17668
- _pos,
17495
+ _keyLine,
17496
+ _keyLineStart,
17497
+ _keyPos,
17669
17498
  _tag = state.tag,
17670
17499
  _anchor = state.anchor,
17671
17500
  _result = {},
17672
- overridableKeys = {},
17501
+ overridableKeys = Object.create(null),
17673
17502
  keyTag = null,
17674
17503
  keyNode = null,
17675
17504
  valueNode = null,
@@ -17677,6 +17506,10 @@ var chsTemplates = (function () {
17677
17506
  detected = false,
17678
17507
  ch;
17679
17508
 
17509
+ // there is a leading tab before this token, so it can't be a block sequence/mapping;
17510
+ // it can still be flow sequence/mapping or a scalar
17511
+ if (state.firstTabInLine !== -1) return false;
17512
+
17680
17513
  if (state.anchor !== null) {
17681
17514
  state.anchorMap[state.anchor] = _result;
17682
17515
  }
@@ -17684,9 +17517,13 @@ var chsTemplates = (function () {
17684
17517
  ch = state.input.charCodeAt(state.position);
17685
17518
 
17686
17519
  while (ch !== 0) {
17520
+ if (!atExplicitKey && state.firstTabInLine !== -1) {
17521
+ state.position = state.firstTabInLine;
17522
+ throwError(state, 'tab characters must not be used in indentation');
17523
+ }
17524
+
17687
17525
  following = state.input.charCodeAt(state.position + 1);
17688
17526
  _line = state.line; // Save the current line.
17689
- _pos = state.position;
17690
17527
 
17691
17528
  //
17692
17529
  // Explicit notation case. There are two separate blocks:
@@ -17696,7 +17533,7 @@ var chsTemplates = (function () {
17696
17533
 
17697
17534
  if (ch === 0x3F/* ? */) {
17698
17535
  if (atExplicitKey) {
17699
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
17536
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
17700
17537
  keyTag = keyNode = valueNode = null;
17701
17538
  }
17702
17539
 
@@ -17719,7 +17556,16 @@ var chsTemplates = (function () {
17719
17556
  //
17720
17557
  // Implicit notation case. Flow-style node as the key first, then ":", and the value.
17721
17558
  //
17722
- } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
17559
+ } else {
17560
+ _keyLine = state.line;
17561
+ _keyLineStart = state.lineStart;
17562
+ _keyPos = state.position;
17563
+
17564
+ if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
17565
+ // Neither implicit nor explicit notation.
17566
+ // Reading is done. Go to the epilogue.
17567
+ break;
17568
+ }
17723
17569
 
17724
17570
  if (state.line === _line) {
17725
17571
  ch = state.input.charCodeAt(state.position);
@@ -17736,7 +17582,7 @@ var chsTemplates = (function () {
17736
17582
  }
17737
17583
 
17738
17584
  if (atExplicitKey) {
17739
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
17585
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
17740
17586
  keyTag = keyNode = valueNode = null;
17741
17587
  }
17742
17588
 
@@ -17763,15 +17609,18 @@ var chsTemplates = (function () {
17763
17609
  state.anchor = _anchor;
17764
17610
  return true; // Keep the result of `composeNode`.
17765
17611
  }
17766
-
17767
- } else {
17768
- break; // Reading is done. Go to the epilogue.
17769
17612
  }
17770
17613
 
17771
17614
  //
17772
17615
  // Common reading code for both explicit and implicit notations.
17773
17616
  //
17774
17617
  if (state.line === _line || state.lineIndent > nodeIndent) {
17618
+ if (atExplicitKey) {
17619
+ _keyLine = state.line;
17620
+ _keyLineStart = state.lineStart;
17621
+ _keyPos = state.position;
17622
+ }
17623
+
17775
17624
  if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
17776
17625
  if (atExplicitKey) {
17777
17626
  keyNode = state.result;
@@ -17781,7 +17630,7 @@ var chsTemplates = (function () {
17781
17630
  }
17782
17631
 
17783
17632
  if (!atExplicitKey) {
17784
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _pos);
17633
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
17785
17634
  keyTag = keyNode = valueNode = null;
17786
17635
  }
17787
17636
 
@@ -17789,7 +17638,7 @@ var chsTemplates = (function () {
17789
17638
  ch = state.input.charCodeAt(state.position);
17790
17639
  }
17791
17640
 
17792
- if (state.lineIndent > nodeIndent && (ch !== 0)) {
17641
+ if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) {
17793
17642
  throwError(state, 'bad indentation of a mapping entry');
17794
17643
  } else if (state.lineIndent < nodeIndent) {
17795
17644
  break;
@@ -17802,7 +17651,7 @@ var chsTemplates = (function () {
17802
17651
 
17803
17652
  // Special case: last mapping's node contains only the key in explicit notation.
17804
17653
  if (atExplicitKey) {
17805
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
17654
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
17806
17655
  }
17807
17656
 
17808
17657
  // Expose the resulting mapping.
@@ -17891,6 +17740,12 @@ var chsTemplates = (function () {
17891
17740
  throwError(state, 'tag name cannot contain such characters: ' + tagName);
17892
17741
  }
17893
17742
 
17743
+ try {
17744
+ tagName = decodeURIComponent(tagName);
17745
+ } catch (err) {
17746
+ throwError(state, 'tag name is malformed: ' + tagName);
17747
+ }
17748
+
17894
17749
  if (isVerbatim) {
17895
17750
  state.tag = tagName;
17896
17751
 
@@ -17976,6 +17831,7 @@ var chsTemplates = (function () {
17976
17831
  hasContent = false,
17977
17832
  typeIndex,
17978
17833
  typeQuantity,
17834
+ typeList,
17979
17835
  type,
17980
17836
  flowIndent,
17981
17837
  blockIndent;
@@ -18077,48 +17933,66 @@ var chsTemplates = (function () {
18077
17933
  }
18078
17934
  }
18079
17935
 
18080
- if (state.tag !== null && state.tag !== '!') {
18081
- if (state.tag === '?') {
18082
- // Implicit resolving is not allowed for non-scalar types, and '?'
18083
- // non-specific tag is only automatically assigned to plain scalars.
18084
- //
18085
- // We only need to check kind conformity in case user explicitly assigns '?'
18086
- // tag, for example like this: "!<?> [0]"
18087
- //
18088
- if (state.result !== null && state.kind !== 'scalar') {
18089
- throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
18090
- }
18091
-
18092
- for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
18093
- type = state.implicitTypes[typeIndex];
17936
+ if (state.tag === null) {
17937
+ if (state.anchor !== null) {
17938
+ state.anchorMap[state.anchor] = state.result;
17939
+ }
18094
17940
 
18095
- if (type.resolve(state.result)) { // `state.result` updated in resolver if matched
18096
- state.result = type.construct(state.result);
18097
- state.tag = type.tag;
18098
- if (state.anchor !== null) {
18099
- state.anchorMap[state.anchor] = state.result;
18100
- }
18101
- break;
18102
- }
18103
- }
18104
- } else if (_hasOwnProperty$1.call(state.typeMap[state.kind || 'fallback'], state.tag)) {
18105
- type = state.typeMap[state.kind || 'fallback'][state.tag];
17941
+ } else if (state.tag === '?') {
17942
+ // Implicit resolving is not allowed for non-scalar types, and '?'
17943
+ // non-specific tag is only automatically assigned to plain scalars.
17944
+ //
17945
+ // We only need to check kind conformity in case user explicitly assigns '?'
17946
+ // tag, for example like this: "!<?> [0]"
17947
+ //
17948
+ if (state.result !== null && state.kind !== 'scalar') {
17949
+ throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
17950
+ }
18106
17951
 
18107
- if (state.result !== null && type.kind !== state.kind) {
18108
- throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"');
18109
- }
17952
+ for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
17953
+ type = state.implicitTypes[typeIndex];
18110
17954
 
18111
- if (!type.resolve(state.result)) { // `state.result` updated in resolver if matched
18112
- throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag');
18113
- } else {
17955
+ if (type.resolve(state.result)) { // `state.result` updated in resolver if matched
18114
17956
  state.result = type.construct(state.result);
17957
+ state.tag = type.tag;
18115
17958
  if (state.anchor !== null) {
18116
17959
  state.anchorMap[state.anchor] = state.result;
18117
17960
  }
17961
+ break;
18118
17962
  }
17963
+ }
17964
+ } else if (state.tag !== '!') {
17965
+ if (_hasOwnProperty$1.call(state.typeMap[state.kind || 'fallback'], state.tag)) {
17966
+ type = state.typeMap[state.kind || 'fallback'][state.tag];
18119
17967
  } else {
17968
+ // looking for multi type
17969
+ type = null;
17970
+ typeList = state.typeMap.multi[state.kind || 'fallback'];
17971
+
17972
+ for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) {
17973
+ if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
17974
+ type = typeList[typeIndex];
17975
+ break;
17976
+ }
17977
+ }
17978
+ }
17979
+
17980
+ if (!type) {
18120
17981
  throwError(state, 'unknown tag !<' + state.tag + '>');
18121
17982
  }
17983
+
17984
+ if (state.result !== null && type.kind !== state.kind) {
17985
+ throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"');
17986
+ }
17987
+
17988
+ if (!type.resolve(state.result, state.tag)) { // `state.result` updated in resolver if matched
17989
+ throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag');
17990
+ } else {
17991
+ state.result = type.construct(state.result, state.tag);
17992
+ if (state.anchor !== null) {
17993
+ state.anchorMap[state.anchor] = state.result;
17994
+ }
17995
+ }
18122
17996
  }
18123
17997
 
18124
17998
  if (state.listener !== null) {
@@ -18137,8 +18011,8 @@ var chsTemplates = (function () {
18137
18011
 
18138
18012
  state.version = null;
18139
18013
  state.checkLineBreaks = state.legacy;
18140
- state.tagMap = {};
18141
- state.anchorMap = {};
18014
+ state.tagMap = Object.create(null);
18015
+ state.anchorMap = Object.create(null);
18142
18016
 
18143
18017
  while ((ch = state.input.charCodeAt(state.position)) !== 0) {
18144
18018
  skipSeparationSpace(state, true, -1);
@@ -18278,7 +18152,7 @@ var chsTemplates = (function () {
18278
18152
  }
18279
18153
 
18280
18154
 
18281
- function loadAll(input, iterator, options) {
18155
+ function loadAll$1(input, iterator, options) {
18282
18156
  if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') {
18283
18157
  options = iterator;
18284
18158
  iterator = null;
@@ -18296,7 +18170,7 @@ var chsTemplates = (function () {
18296
18170
  }
18297
18171
 
18298
18172
 
18299
- function load(input, options) {
18173
+ function load$1(input, options) {
18300
18174
  var documents = loadDocuments(input, options);
18301
18175
 
18302
18176
  if (documents.length === 0) {
@@ -18305,42 +18179,28 @@ var chsTemplates = (function () {
18305
18179
  } else if (documents.length === 1) {
18306
18180
  return documents[0];
18307
18181
  }
18308
- throw new YAMLException$1('expected a single document in the stream, but found more');
18182
+ throw new exception('expected a single document in the stream, but found more');
18309
18183
  }
18310
18184
 
18311
18185
 
18312
- function safeLoadAll(input, iterator, options) {
18313
- if (typeof iterator === 'object' && iterator !== null && typeof options === 'undefined') {
18314
- options = iterator;
18315
- iterator = null;
18316
- }
18317
-
18318
- return loadAll(input, iterator, common$1.extend({ schema: DEFAULT_SAFE_SCHEMA$1 }, options));
18319
- }
18320
-
18186
+ var loadAll_1 = loadAll$1;
18187
+ var load_1 = load$1;
18321
18188
 
18322
- function safeLoad(input, options) {
18323
- return load(input, common$1.extend({ schema: DEFAULT_SAFE_SCHEMA$1 }, options));
18324
- }
18189
+ var loader = {
18190
+ loadAll: loadAll_1,
18191
+ load: load_1
18192
+ };
18325
18193
 
18194
+ /*eslint-disable no-use-before-define*/
18326
18195
 
18327
- loader$1.loadAll = loadAll;
18328
- loader$1.load = load;
18329
- loader$1.safeLoadAll = safeLoadAll;
18330
- loader$1.safeLoad = safeLoad;
18331
18196
 
18332
- var dumper$1 = {};
18333
18197
 
18334
- /*eslint-disable no-use-before-define*/
18335
18198
 
18336
- var common = common$6;
18337
- var YAMLException = exception;
18338
- var DEFAULT_FULL_SCHEMA = default_full;
18339
- var DEFAULT_SAFE_SCHEMA = default_safe;
18340
18199
 
18341
18200
  var _toString = Object.prototype.toString;
18342
18201
  var _hasOwnProperty = Object.prototype.hasOwnProperty;
18343
18202
 
18203
+ var CHAR_BOM = 0xFEFF;
18344
18204
  var CHAR_TAB = 0x09; /* Tab */
18345
18205
  var CHAR_LINE_FEED = 0x0A; /* LF */
18346
18206
  var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */
@@ -18389,6 +18249,8 @@ var chsTemplates = (function () {
18389
18249
  'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF'
18390
18250
  ];
18391
18251
 
18252
+ var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
18253
+
18392
18254
  function compileStyleMap(schema, map) {
18393
18255
  var result, keys, index, length, tag, style, type;
18394
18256
 
@@ -18431,14 +18293,18 @@ var chsTemplates = (function () {
18431
18293
  handle = 'U';
18432
18294
  length = 8;
18433
18295
  } else {
18434
- throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF');
18296
+ throw new exception('code point within a string may not be greater than 0xFFFFFFFF');
18435
18297
  }
18436
18298
 
18437
18299
  return '\\' + handle + common.repeat('0', length - string.length) + string;
18438
18300
  }
18439
18301
 
18302
+
18303
+ var QUOTING_TYPE_SINGLE = 1,
18304
+ QUOTING_TYPE_DOUBLE = 2;
18305
+
18440
18306
  function State(options) {
18441
- this.schema = options['schema'] || DEFAULT_FULL_SCHEMA;
18307
+ this.schema = options['schema'] || _default;
18442
18308
  this.indent = Math.max(1, (options['indent'] || 2));
18443
18309
  this.noArrayIndent = options['noArrayIndent'] || false;
18444
18310
  this.skipInvalid = options['skipInvalid'] || false;
@@ -18449,6 +18315,9 @@ var chsTemplates = (function () {
18449
18315
  this.noRefs = options['noRefs'] || false;
18450
18316
  this.noCompatMode = options['noCompatMode'] || false;
18451
18317
  this.condenseFlow = options['condenseFlow'] || false;
18318
+ this.quotingType = options['quotingType'] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE;
18319
+ this.forceQuotes = options['forceQuotes'] || false;
18320
+ this.replacer = typeof options['replacer'] === 'function' ? options['replacer'] : null;
18452
18321
 
18453
18322
  this.implicitTypes = this.schema.compiledImplicit;
18454
18323
  this.explicitTypes = this.schema.compiledExplicit;
@@ -18517,47 +18386,60 @@ var chsTemplates = (function () {
18517
18386
  function isPrintable(c) {
18518
18387
  return (0x00020 <= c && c <= 0x00007E)
18519
18388
  || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029)
18520
- || ((0x0E000 <= c && c <= 0x00FFFD) && c !== 0xFEFF /* BOM */)
18389
+ || ((0x0E000 <= c && c <= 0x00FFFD) && c !== CHAR_BOM)
18521
18390
  || (0x10000 <= c && c <= 0x10FFFF);
18522
18391
  }
18523
18392
 
18524
18393
  // [34] ns-char ::= nb-char - s-white
18525
18394
  // [27] nb-char ::= c-printable - b-char - c-byte-order-mark
18526
18395
  // [26] b-char ::= b-line-feed | b-carriage-return
18527
- // [24] b-line-feed ::= #xA /* LF */
18528
- // [25] b-carriage-return ::= #xD /* CR */
18529
- // [3] c-byte-order-mark ::= #xFEFF
18530
- function isNsChar(c) {
18531
- return isPrintable(c) && !isWhitespace(c)
18532
- // byte-order-mark
18533
- && c !== 0xFEFF
18534
- // b-char
18396
+ // Including s-white (for some reason, examples doesn't match specs in this aspect)
18397
+ // ns-char ::= c-printable - b-line-feed - b-carriage-return - c-byte-order-mark
18398
+ function isNsCharOrWhitespace(c) {
18399
+ return isPrintable(c)
18400
+ && c !== CHAR_BOM
18401
+ // - b-char
18535
18402
  && c !== CHAR_CARRIAGE_RETURN
18536
18403
  && c !== CHAR_LINE_FEED;
18537
18404
  }
18538
18405
 
18539
- // Simplified test for values allowed after the first character in plain style.
18540
- function isPlainSafe(c, prev) {
18541
- // Uses a subset of nb-char - c-flow-indicator - ":" - "#"
18542
- // where nb-char ::= c-printable - b-char - c-byte-order-mark.
18543
- return isPrintable(c) && c !== 0xFEFF
18544
- // - c-flow-indicator
18545
- && c !== CHAR_COMMA
18546
- && c !== CHAR_LEFT_SQUARE_BRACKET
18547
- && c !== CHAR_RIGHT_SQUARE_BRACKET
18548
- && c !== CHAR_LEFT_CURLY_BRACKET
18549
- && c !== CHAR_RIGHT_CURLY_BRACKET
18550
- // - ":" - "#"
18551
- // /* An ns-char preceding */ "#"
18552
- && c !== CHAR_COLON
18553
- && ((c !== CHAR_SHARP) || (prev && isNsChar(prev)));
18406
+ // [127] ns-plain-safe(c) ::= c = flow-out ⇒ ns-plain-safe-out
18407
+ // c = flow-in ⇒ ns-plain-safe-in
18408
+ // c = block-key ns-plain-safe-out
18409
+ // c = flow-key ⇒ ns-plain-safe-in
18410
+ // [128] ns-plain-safe-out ::= ns-char
18411
+ // [129] ns-plain-safe-in ::= ns-char - c-flow-indicator
18412
+ // [130] ns-plain-char(c) ::= ( ns-plain-safe(c) - “:” - “#” )
18413
+ // | ( /* An ns-char preceding */ “#” )
18414
+ // | ( “:” /* Followed by an ns-plain-safe(c) */ )
18415
+ function isPlainSafe(c, prev, inblock) {
18416
+ var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c);
18417
+ var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c);
18418
+ return (
18419
+ // ns-plain-safe
18420
+ inblock ? // c = flow-in
18421
+ cIsNsCharOrWhitespace
18422
+ : cIsNsCharOrWhitespace
18423
+ // - c-flow-indicator
18424
+ && c !== CHAR_COMMA
18425
+ && c !== CHAR_LEFT_SQUARE_BRACKET
18426
+ && c !== CHAR_RIGHT_SQUARE_BRACKET
18427
+ && c !== CHAR_LEFT_CURLY_BRACKET
18428
+ && c !== CHAR_RIGHT_CURLY_BRACKET
18429
+ )
18430
+ // ns-plain-char
18431
+ && c !== CHAR_SHARP // false on '#'
18432
+ && !(prev === CHAR_COLON && !cIsNsChar) // false on ': '
18433
+ || (isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP) // change to true on '[^ ]#'
18434
+ || (prev === CHAR_COLON && cIsNsChar); // change to true on ':[^ ]'
18554
18435
  }
18555
18436
 
18556
18437
  // Simplified test for values allowed as the first character in plain style.
18557
18438
  function isPlainSafeFirst(c) {
18558
18439
  // Uses a subset of ns-char - c-indicator
18559
18440
  // where ns-char = nb-char - s-white.
18560
- return isPrintable(c) && c !== 0xFEFF
18441
+ // No support of ( ( “?” | “:” | “-” ) /* Followed by an ns-plain-safe(c)) */ ) part
18442
+ return isPrintable(c) && c !== CHAR_BOM
18561
18443
  && !isWhitespace(c) // - s-white
18562
18444
  // - (c-indicator ::=
18563
18445
  // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}”
@@ -18585,6 +18467,25 @@ var chsTemplates = (function () {
18585
18467
  && c !== CHAR_GRAVE_ACCENT;
18586
18468
  }
18587
18469
 
18470
+ // Simplified test for values allowed as the last character in plain style.
18471
+ function isPlainSafeLast(c) {
18472
+ // just not whitespace or colon, it will be checked to be plain character later
18473
+ return !isWhitespace(c) && c !== CHAR_COLON;
18474
+ }
18475
+
18476
+ // Same as 'string'.codePointAt(pos), but works in older browsers.
18477
+ function codePointAt(string, pos) {
18478
+ var first = string.charCodeAt(pos), second;
18479
+ if (first >= 0xD800 && first <= 0xDBFF && pos + 1 < string.length) {
18480
+ second = string.charCodeAt(pos + 1);
18481
+ if (second >= 0xDC00 && second <= 0xDFFF) {
18482
+ // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
18483
+ return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
18484
+ }
18485
+ }
18486
+ return first;
18487
+ }
18488
+
18588
18489
  // Determines whether block indentation indicator is required.
18589
18490
  function needIndentIndicator(string) {
18590
18491
  var leadingSpaceRe = /^\n* /;
@@ -18604,31 +18505,34 @@ var chsTemplates = (function () {
18604
18505
  // STYLE_PLAIN or STYLE_SINGLE => no \n are in the string.
18605
18506
  // STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1).
18606
18507
  // STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1).
18607
- function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) {
18508
+ function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth,
18509
+ testAmbiguousType, quotingType, forceQuotes, inblock) {
18510
+
18608
18511
  var i;
18609
- var char, prev_char;
18512
+ var char = 0;
18513
+ var prevChar = null;
18610
18514
  var hasLineBreak = false;
18611
18515
  var hasFoldableLine = false; // only checked if shouldTrackWidth
18612
18516
  var shouldTrackWidth = lineWidth !== -1;
18613
18517
  var previousLineBreak = -1; // count the first line correctly
18614
- var plain = isPlainSafeFirst(string.charCodeAt(0))
18615
- && !isWhitespace(string.charCodeAt(string.length - 1));
18518
+ var plain = isPlainSafeFirst(codePointAt(string, 0))
18519
+ && isPlainSafeLast(codePointAt(string, string.length - 1));
18616
18520
 
18617
- if (singleLineOnly) {
18521
+ if (singleLineOnly || forceQuotes) {
18618
18522
  // Case: no block styles.
18619
18523
  // Check for disallowed characters to rule out plain and single.
18620
- for (i = 0; i < string.length; i++) {
18621
- char = string.charCodeAt(i);
18524
+ for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) {
18525
+ char = codePointAt(string, i);
18622
18526
  if (!isPrintable(char)) {
18623
18527
  return STYLE_DOUBLE;
18624
18528
  }
18625
- prev_char = i > 0 ? string.charCodeAt(i - 1) : null;
18626
- plain = plain && isPlainSafe(char, prev_char);
18529
+ plain = plain && isPlainSafe(char, prevChar, inblock);
18530
+ prevChar = char;
18627
18531
  }
18628
18532
  } else {
18629
18533
  // Case: block styles permitted.
18630
- for (i = 0; i < string.length; i++) {
18631
- char = string.charCodeAt(i);
18534
+ for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) {
18535
+ char = codePointAt(string, i);
18632
18536
  if (char === CHAR_LINE_FEED) {
18633
18537
  hasLineBreak = true;
18634
18538
  // Check if any line can be folded.
@@ -18642,8 +18546,8 @@ var chsTemplates = (function () {
18642
18546
  } else if (!isPrintable(char)) {
18643
18547
  return STYLE_DOUBLE;
18644
18548
  }
18645
- prev_char = i > 0 ? string.charCodeAt(i - 1) : null;
18646
- plain = plain && isPlainSafe(char, prev_char);
18549
+ plain = plain && isPlainSafe(char, prevChar, inblock);
18550
+ prevChar = char;
18647
18551
  }
18648
18552
  // in case the end is missing a \n
18649
18553
  hasFoldableLine = hasFoldableLine || (shouldTrackWidth &&
@@ -18656,8 +18560,10 @@ var chsTemplates = (function () {
18656
18560
  if (!hasLineBreak && !hasFoldableLine) {
18657
18561
  // Strings interpretable as another type have to be quoted;
18658
18562
  // e.g. the string 'true' vs. the boolean true.
18659
- return plain && !testAmbiguousType(string)
18660
- ? STYLE_PLAIN : STYLE_SINGLE;
18563
+ if (plain && !forceQuotes && !testAmbiguousType(string)) {
18564
+ return STYLE_PLAIN;
18565
+ }
18566
+ return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
18661
18567
  }
18662
18568
  // Edge case: block indentation indicator can only have one digit.
18663
18569
  if (indentPerLevel > 9 && needIndentIndicator(string)) {
@@ -18665,7 +18571,10 @@ var chsTemplates = (function () {
18665
18571
  }
18666
18572
  // At this point we know block styles are valid.
18667
18573
  // Prefer literal style unless we want to fold.
18668
- return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
18574
+ if (!forceQuotes) {
18575
+ return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
18576
+ }
18577
+ return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
18669
18578
  }
18670
18579
 
18671
18580
  // Note: line breaking/folding is implemented for only the folded style.
@@ -18674,14 +18583,15 @@ var chsTemplates = (function () {
18674
18583
  // • No ending newline => unaffected; already using strip "-" chomping.
18675
18584
  // • Ending newline => removed then restored.
18676
18585
  // Importantly, this keeps the "+" chomp indicator from gaining an extra line.
18677
- function writeScalar(state, string, level, iskey) {
18586
+ function writeScalar(state, string, level, iskey, inblock) {
18678
18587
  state.dump = (function () {
18679
18588
  if (string.length === 0) {
18680
- return "''";
18589
+ return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''";
18681
18590
  }
18682
- if (!state.noCompatMode &&
18683
- DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1) {
18684
- return "'" + string + "'";
18591
+ if (!state.noCompatMode) {
18592
+ if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) {
18593
+ return state.quotingType === QUOTING_TYPE_DOUBLE ? ('"' + string + '"') : ("'" + string + "'");
18594
+ }
18685
18595
  }
18686
18596
 
18687
18597
  var indent = state.indent * Math.max(1, level); // no 0-indent scalars
@@ -18703,7 +18613,9 @@ var chsTemplates = (function () {
18703
18613
  return testImplicitResolving(state, string);
18704
18614
  }
18705
18615
 
18706
- switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity)) {
18616
+ switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth,
18617
+ testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) {
18618
+
18707
18619
  case STYLE_PLAIN:
18708
18620
  return string;
18709
18621
  case STYLE_SINGLE:
@@ -18717,7 +18629,7 @@ var chsTemplates = (function () {
18717
18629
  case STYLE_DOUBLE:
18718
18630
  return '"' + escapeString(string) + '"';
18719
18631
  default:
18720
- throw new YAMLException('impossible error: invalid scalar style');
18632
+ throw new exception('impossible error: invalid scalar style');
18721
18633
  }
18722
18634
  }());
18723
18635
  }
@@ -18820,25 +18732,19 @@ var chsTemplates = (function () {
18820
18732
  // Escapes a double-quoted string.
18821
18733
  function escapeString(string) {
18822
18734
  var result = '';
18823
- var char, nextChar;
18735
+ var char = 0;
18824
18736
  var escapeSeq;
18825
18737
 
18826
- for (var i = 0; i < string.length; i++) {
18827
- char = string.charCodeAt(i);
18828
- // Check for surrogate pairs (reference Unicode 3.0 section "3.7 Surrogates").
18829
- if (char >= 0xD800 && char <= 0xDBFF/* high surrogate */) {
18830
- nextChar = string.charCodeAt(i + 1);
18831
- if (nextChar >= 0xDC00 && nextChar <= 0xDFFF/* low surrogate */) {
18832
- // Combine the surrogate pair and store it escaped.
18833
- result += encodeHex((char - 0xD800) * 0x400 + nextChar - 0xDC00 + 0x10000);
18834
- // Advance index one extra since we already used that char here.
18835
- i++; continue;
18836
- }
18837
- }
18738
+ for (var i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) {
18739
+ char = codePointAt(string, i);
18838
18740
  escapeSeq = ESCAPE_SEQUENCES[char];
18839
- result += !escapeSeq && isPrintable(char)
18840
- ? string[i]
18841
- : escapeSeq || encodeHex(char);
18741
+
18742
+ if (!escapeSeq && isPrintable(char)) {
18743
+ result += string[i];
18744
+ if (char >= 0x10000) result += string[i + 1];
18745
+ } else {
18746
+ result += escapeSeq || encodeHex(char);
18747
+ }
18842
18748
  }
18843
18749
 
18844
18750
  return result;
@@ -18848,12 +18754,22 @@ var chsTemplates = (function () {
18848
18754
  var _result = '',
18849
18755
  _tag = state.tag,
18850
18756
  index,
18851
- length;
18757
+ length,
18758
+ value;
18852
18759
 
18853
18760
  for (index = 0, length = object.length; index < length; index += 1) {
18854
- // Write only valid elements.
18855
- if (writeNode(state, level, object[index], false, false)) {
18856
- if (index !== 0) _result += ',' + (!state.condenseFlow ? ' ' : '');
18761
+ value = object[index];
18762
+
18763
+ if (state.replacer) {
18764
+ value = state.replacer.call(object, String(index), value);
18765
+ }
18766
+
18767
+ // Write only valid elements, put null instead of invalid elements.
18768
+ if (writeNode(state, level, value, false, false) ||
18769
+ (typeof value === 'undefined' &&
18770
+ writeNode(state, level, null, false, false))) {
18771
+
18772
+ if (_result !== '') _result += ',' + (!state.condenseFlow ? ' ' : '');
18857
18773
  _result += state.dump;
18858
18774
  }
18859
18775
  }
@@ -18866,12 +18782,22 @@ var chsTemplates = (function () {
18866
18782
  var _result = '',
18867
18783
  _tag = state.tag,
18868
18784
  index,
18869
- length;
18785
+ length,
18786
+ value;
18870
18787
 
18871
18788
  for (index = 0, length = object.length; index < length; index += 1) {
18872
- // Write only valid elements.
18873
- if (writeNode(state, level + 1, object[index], true, true)) {
18874
- if (!compact || index !== 0) {
18789
+ value = object[index];
18790
+
18791
+ if (state.replacer) {
18792
+ value = state.replacer.call(object, String(index), value);
18793
+ }
18794
+
18795
+ // Write only valid elements, put null instead of invalid elements.
18796
+ if (writeNode(state, level + 1, value, true, true, false, true) ||
18797
+ (typeof value === 'undefined' &&
18798
+ writeNode(state, level + 1, null, true, true, false, true))) {
18799
+
18800
+ if (!compact || _result !== '') {
18875
18801
  _result += generateNextLine(state, level);
18876
18802
  }
18877
18803
 
@@ -18902,13 +18828,17 @@ var chsTemplates = (function () {
18902
18828
  for (index = 0, length = objectKeyList.length; index < length; index += 1) {
18903
18829
 
18904
18830
  pairBuffer = '';
18905
- if (index !== 0) pairBuffer += ', ';
18831
+ if (_result !== '') pairBuffer += ', ';
18906
18832
 
18907
18833
  if (state.condenseFlow) pairBuffer += '"';
18908
18834
 
18909
18835
  objectKey = objectKeyList[index];
18910
18836
  objectValue = object[objectKey];
18911
18837
 
18838
+ if (state.replacer) {
18839
+ objectValue = state.replacer.call(object, objectKey, objectValue);
18840
+ }
18841
+
18912
18842
  if (!writeNode(state, level, objectKey, false, false)) {
18913
18843
  continue; // Skip this pair because of invalid key;
18914
18844
  }
@@ -18951,19 +18881,23 @@ var chsTemplates = (function () {
18951
18881
  objectKeyList.sort(state.sortKeys);
18952
18882
  } else if (state.sortKeys) {
18953
18883
  // Something is wrong
18954
- throw new YAMLException('sortKeys must be a boolean or a function');
18884
+ throw new exception('sortKeys must be a boolean or a function');
18955
18885
  }
18956
18886
 
18957
18887
  for (index = 0, length = objectKeyList.length; index < length; index += 1) {
18958
18888
  pairBuffer = '';
18959
18889
 
18960
- if (!compact || index !== 0) {
18890
+ if (!compact || _result !== '') {
18961
18891
  pairBuffer += generateNextLine(state, level);
18962
18892
  }
18963
18893
 
18964
18894
  objectKey = objectKeyList[index];
18965
18895
  objectValue = object[objectKey];
18966
18896
 
18897
+ if (state.replacer) {
18898
+ objectValue = state.replacer.call(object, objectKey, objectValue);
18899
+ }
18900
+
18967
18901
  if (!writeNode(state, level + 1, objectKey, true, true, true)) {
18968
18902
  continue; // Skip this pair because of invalid key.
18969
18903
  }
@@ -19017,7 +18951,15 @@ var chsTemplates = (function () {
19017
18951
  (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) &&
19018
18952
  (!type.predicate || type.predicate(object))) {
19019
18953
 
19020
- state.tag = explicit ? type.tag : '?';
18954
+ if (explicit) {
18955
+ if (type.multi && type.representName) {
18956
+ state.tag = type.representName(object);
18957
+ } else {
18958
+ state.tag = type.tag;
18959
+ }
18960
+ } else {
18961
+ state.tag = '?';
18962
+ }
19021
18963
 
19022
18964
  if (type.represent) {
19023
18965
  style = state.styleMap[type.tag] || type.defaultStyle;
@@ -19027,7 +18969,7 @@ var chsTemplates = (function () {
19027
18969
  } else if (_hasOwnProperty.call(type.represent, style)) {
19028
18970
  _result = type.represent[style](object, style);
19029
18971
  } else {
19030
- throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style');
18972
+ throw new exception('!<' + type.tag + '> tag resolver accepts not "' + style + '" style');
19031
18973
  }
19032
18974
 
19033
18975
  state.dump = _result;
@@ -19043,7 +18985,7 @@ var chsTemplates = (function () {
19043
18985
  // Serializes `object` and writes it to global `result`.
19044
18986
  // Returns true on success, or false on invalid object.
19045
18987
  //
19046
- function writeNode(state, level, object, block, compact, iskey) {
18988
+ function writeNode(state, level, object, block, compact, iskey, isblockseq) {
19047
18989
  state.tag = null;
19048
18990
  state.dump = object;
19049
18991
 
@@ -19052,6 +18994,8 @@ var chsTemplates = (function () {
19052
18994
  }
19053
18995
 
19054
18996
  var type = _toString.call(state.dump);
18997
+ var inblock = block;
18998
+ var tagStr;
19055
18999
 
19056
19000
  if (block) {
19057
19001
  block = (state.flowLevel < 0 || state.flowLevel > level);
@@ -19089,29 +19033,59 @@ var chsTemplates = (function () {
19089
19033
  }
19090
19034
  }
19091
19035
  } else if (type === '[object Array]') {
19092
- var arrayLevel = (state.noArrayIndent && (level > 0)) ? level - 1 : level;
19093
19036
  if (block && (state.dump.length !== 0)) {
19094
- writeBlockSequence(state, arrayLevel, state.dump, compact);
19037
+ if (state.noArrayIndent && !isblockseq && level > 0) {
19038
+ writeBlockSequence(state, level - 1, state.dump, compact);
19039
+ } else {
19040
+ writeBlockSequence(state, level, state.dump, compact);
19041
+ }
19095
19042
  if (duplicate) {
19096
19043
  state.dump = '&ref_' + duplicateIndex + state.dump;
19097
19044
  }
19098
19045
  } else {
19099
- writeFlowSequence(state, arrayLevel, state.dump);
19046
+ writeFlowSequence(state, level, state.dump);
19100
19047
  if (duplicate) {
19101
19048
  state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
19102
19049
  }
19103
19050
  }
19104
19051
  } else if (type === '[object String]') {
19105
19052
  if (state.tag !== '?') {
19106
- writeScalar(state, state.dump, level, iskey);
19053
+ writeScalar(state, state.dump, level, iskey, inblock);
19107
19054
  }
19055
+ } else if (type === '[object Undefined]') {
19056
+ return false;
19108
19057
  } else {
19109
19058
  if (state.skipInvalid) return false;
19110
- throw new YAMLException('unacceptable kind of an object to dump ' + type);
19059
+ throw new exception('unacceptable kind of an object to dump ' + type);
19111
19060
  }
19112
19061
 
19113
19062
  if (state.tag !== null && state.tag !== '?') {
19114
- state.dump = '!<' + state.tag + '> ' + state.dump;
19063
+ // Need to encode all characters except those allowed by the spec:
19064
+ //
19065
+ // [35] ns-dec-digit ::= [#x30-#x39] /* 0-9 */
19066
+ // [36] ns-hex-digit ::= ns-dec-digit
19067
+ // | [#x41-#x46] /* A-F */ | [#x61-#x66] /* a-f */
19068
+ // [37] ns-ascii-letter ::= [#x41-#x5A] /* A-Z */ | [#x61-#x7A] /* a-z */
19069
+ // [38] ns-word-char ::= ns-dec-digit | ns-ascii-letter | “-”
19070
+ // [39] ns-uri-char ::= “%” ns-hex-digit ns-hex-digit | ns-word-char | “#”
19071
+ // | “;” | “/” | “?” | “:” | “@” | “&” | “=” | “+” | “$” | “,”
19072
+ // | “_” | “.” | “!” | “~” | “*” | “'” | “(” | “)” | “[” | “]”
19073
+ //
19074
+ // Also need to encode '!' because it has special meaning (end of tag prefix).
19075
+ //
19076
+ tagStr = encodeURI(
19077
+ state.tag[0] === '!' ? state.tag.slice(1) : state.tag
19078
+ ).replace(/!/g, '%21');
19079
+
19080
+ if (state.tag[0] === '!') {
19081
+ tagStr = '!' + tagStr;
19082
+ } else if (tagStr.slice(0, 18) === 'tag:yaml.org,2002:') {
19083
+ tagStr = '!!' + tagStr.slice(18);
19084
+ } else {
19085
+ tagStr = '!<' + tagStr + '>';
19086
+ }
19087
+
19088
+ state.dump = tagStr + ' ' + state.dump;
19115
19089
  }
19116
19090
  }
19117
19091
 
@@ -19161,68 +19135,87 @@ var chsTemplates = (function () {
19161
19135
  }
19162
19136
  }
19163
19137
 
19164
- function dump(input, options) {
19138
+ function dump$1(input, options) {
19165
19139
  options = options || {};
19166
19140
 
19167
19141
  var state = new State(options);
19168
19142
 
19169
19143
  if (!state.noRefs) getDuplicateReferences(input, state);
19170
19144
 
19171
- if (writeNode(state, 0, input, true, true)) return state.dump + '\n';
19145
+ var value = input;
19172
19146
 
19173
- return '';
19174
- }
19147
+ if (state.replacer) {
19148
+ value = state.replacer.call({ '': value }, '', value);
19149
+ }
19175
19150
 
19176
- function safeDump(input, options) {
19177
- return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
19178
- }
19151
+ if (writeNode(state, 0, value, true, true)) return state.dump + '\n';
19179
19152
 
19180
- dumper$1.dump = dump;
19181
- dumper$1.safeDump = safeDump;
19153
+ return '';
19154
+ }
19182
19155
 
19183
- var loader = loader$1;
19184
- var dumper = dumper$1;
19156
+ var dump_1 = dump$1;
19185
19157
 
19158
+ var dumper = {
19159
+ dump: dump_1
19160
+ };
19186
19161
 
19187
- function deprecated(name) {
19162
+ function renamed(from, to) {
19188
19163
  return function () {
19189
- throw new Error('Function ' + name + ' is deprecated and cannot be used.');
19164
+ throw new Error('Function yaml.' + from + ' is removed in js-yaml 4. ' +
19165
+ 'Use yaml.' + to + ' instead, which is now safe by default.');
19190
19166
  };
19191
19167
  }
19192
19168
 
19193
19169
 
19194
- jsYaml$1.Type = type;
19195
- jsYaml$1.Schema = schema;
19196
- jsYaml$1.FAILSAFE_SCHEMA = failsafe;
19197
- jsYaml$1.JSON_SCHEMA = json;
19198
- jsYaml$1.CORE_SCHEMA = core;
19199
- jsYaml$1.DEFAULT_SAFE_SCHEMA = default_safe;
19200
- jsYaml$1.DEFAULT_FULL_SCHEMA = default_full;
19201
- jsYaml$1.load = loader.load;
19202
- jsYaml$1.loadAll = loader.loadAll;
19203
- jsYaml$1.safeLoad = loader.safeLoad;
19204
- jsYaml$1.safeLoadAll = loader.safeLoadAll;
19205
- jsYaml$1.dump = dumper.dump;
19206
- jsYaml$1.safeDump = dumper.safeDump;
19207
- jsYaml$1.YAMLException = exception;
19208
-
19209
- // Deprecated schema names from JS-YAML 2.0.x
19210
- jsYaml$1.MINIMAL_SCHEMA = failsafe;
19211
- jsYaml$1.SAFE_SCHEMA = default_safe;
19212
- jsYaml$1.DEFAULT_SCHEMA = default_full;
19213
-
19214
- // Deprecated functions from JS-YAML 1.x.x
19215
- jsYaml$1.scan = deprecated('scan');
19216
- jsYaml$1.parse = deprecated('parse');
19217
- jsYaml$1.compose = deprecated('compose');
19218
- jsYaml$1.addConstructor = deprecated('addConstructor');
19219
-
19220
- var yaml = jsYaml$1;
19221
-
19170
+ var Type = type;
19171
+ var Schema = schema;
19172
+ var FAILSAFE_SCHEMA = failsafe;
19173
+ var JSON_SCHEMA = json;
19174
+ var CORE_SCHEMA = core;
19175
+ var DEFAULT_SCHEMA = _default;
19176
+ var load = loader.load;
19177
+ var loadAll = loader.loadAll;
19178
+ var dump = dumper.dump;
19179
+ var YAMLException = exception;
19222
19180
 
19223
- var jsYaml = yaml;
19181
+ // Re-export all types in case user wants to create custom schema
19182
+ var types = {
19183
+ binary: binary,
19184
+ float: float,
19185
+ map: map,
19186
+ null: _null,
19187
+ pairs: pairs,
19188
+ set: set,
19189
+ timestamp: timestamp,
19190
+ bool: bool,
19191
+ int: int,
19192
+ merge: merge,
19193
+ omap: omap,
19194
+ seq: seq,
19195
+ str: str
19196
+ };
19224
19197
 
19225
- var Yaml = /*@__PURE__*/getDefaultExportFromCjs(jsYaml);
19198
+ // Removed functions from JS-YAML 3.0.x
19199
+ var safeLoad = renamed('safeLoad', 'load');
19200
+ var safeLoadAll = renamed('safeLoadAll', 'loadAll');
19201
+ var safeDump = renamed('safeDump', 'dump');
19202
+
19203
+ var jsYaml = {
19204
+ Type: Type,
19205
+ Schema: Schema,
19206
+ FAILSAFE_SCHEMA: FAILSAFE_SCHEMA,
19207
+ JSON_SCHEMA: JSON_SCHEMA,
19208
+ CORE_SCHEMA: CORE_SCHEMA,
19209
+ DEFAULT_SCHEMA: DEFAULT_SCHEMA,
19210
+ load: load,
19211
+ loadAll: loadAll,
19212
+ dump: dump,
19213
+ YAMLException: YAMLException,
19214
+ types: types,
19215
+ safeLoad: safeLoad,
19216
+ safeLoadAll: safeLoadAll,
19217
+ safeDump: safeDump
19218
+ };
19226
19219
 
19227
19220
  var en_us = `No: No
19228
19221
  Yes: Yes
@@ -19833,10 +19826,10 @@ exp-video-config:
19833
19826
  click-here-to-detect: click here to detect
19834
19827
  see-troubleshooting:
19835
19828
  See the troubleshooting directions below if you're having trouble!
19836
- step-1:
19837
- Make sure you can see yourself to the left! You may need to click "Allow" so
19838
- that we can access your webcam and microphone. On Firefox, make sure to also
19839
- check "Remember this decision"!
19829
+ step-1-title: Make sure you can see yourself to the left!
19830
+ step-1-text:
19831
+ You may need to click "Allow" so that we can access your webcam and
19832
+ microphone. On Firefox, make sure to also check "Remember this decision"!
19840
19833
  looks-good: Looks good!
19841
19834
  no-webcam-detected: No webcam detected
19842
19835
  step-2-click-directions: Make sure your webcam settings got saved by clicking
@@ -19845,9 +19838,7 @@ exp-video-config:
19845
19838
  Your webcam should re-appear WITHOUT you having to allow access again. (If
19846
19839
  you do see a dialogue, click "Remember this decision" or "Always allow" and
19847
19840
  try again!)
19848
- step-3:
19849
- Make sure we'll be able to hear you! This box will be filled in once we hear
19850
- a loud enough sound
19841
+ step-3: Make sure we'll be able to hear you!
19851
19842
  sounds-good: Sounds good!
19852
19843
  try-clapping: Try clapping or saying hi.
19853
19844
  step-2-warning:
@@ -20551,10 +20542,11 @@ exp-video-config:
20551
20542
  click-here-to-detect: klikatu hemen kamera hautemateko
20552
20543
  see-troubleshooting:
20553
20544
  Arazorik baduzu, ikusi behean dauden arazoak konpontzeko jarraibideak!
20554
- step-1:
20555
- Ziurtatu zeure burua ezkerretara ikusten duzula! Beharbada "Baimendu"
20556
- klikatu beharko duzu webcamerako eta mikrofonorako sarbidea izan dezagun.
20557
- Firefoxen, ziurtatu "Aukera hau gogoratu" tikatzen duzula!
20545
+ step-1-title: Ziurtatu zeure burua ezkerretara ikusten duzula!
20546
+ step-1-text:
20547
+ Beharbada "Baimendu" klikatu beharko duzu webcamerako eta mikrofonorako
20548
+ sarbidea izan dezagun. Firefoxen, ziurtatu "Aukera hau gogoratu" tikatzen
20549
+ duzula!
20558
20550
  looks-good: Itxura ona du!
20559
20551
  no-webcam-detected: Ez da webcamik hauteman
20560
20552
  step-2-click-directions: Ziurtatu webcam ezarpenak gorde direla
@@ -20563,9 +20555,7 @@ exp-video-config:
20563
20555
  Webcamak berriz agertu beharko luke berriz baimenik eman GABE. (Dialogo bat
20564
20556
  agertzen bada, sakatu "Gogoratu aukera hau" edo "Beti baimendu" eta berriz
20565
20557
  saiatu!)
20566
- step-3:
20567
- Entzun zaitzakegula egiaztatu! Hotsa behar bezain altua denean kutxa hau
20568
- beteko da
20558
+ step-3: Entzun zaitzakegula egiaztatu!
20569
20559
  sounds-good: Itxura ona du!
20570
20560
  try-clapping: Txalo egin edo kaixo esan.
20571
20561
  step-2-warning:
@@ -21369,11 +21359,11 @@ exp-video-config:
21369
21359
  see-troubleshooting:
21370
21360
  Voir les conseils ci-dessous pour la résolution de problèmes si vous avez
21371
21361
  des difficultés.
21372
- step-1:
21373
- Assurez-vous que vous soyez visible à gauche. Il peut être nécessaire de
21374
- cliquer «Permettre» pour que nous puissions avoir accès à votre webcam et
21375
- micro. Sur Firefox, assurez-vous aussi de sélectionner «Se souvenir de ce
21376
- choix»!
21362
+ step-1-title: Assurez-vous que vous soyez visible à gauche.
21363
+ step-1-text:
21364
+ Il peut être nécessaire de cliquer «Permettre» pour que nous puissions avoir
21365
+ accès à votre webcam et micro. Sur Firefox, assurez-vous aussi de
21366
+ sélectionner «Se souvenir de ce choix»!
21377
21367
  looks-good: Très bien!
21378
21368
  no-webcam-detected: Aucune webcam n'est détectée
21379
21369
  step-2-click-directions:
@@ -21383,9 +21373,7 @@ exp-video-config:
21383
21373
  Votre webcam devrait réapparaître SANS que vous ayez besoin d'approuver à
21384
21374
  nouveau l'accès. (Si vous voyez encore une boîte de dialogue, cliquez «Se
21385
21375
  souvenir de ce choix» ou «Toujours permettre» et essayez à nouveau!)
21386
- step-3:
21387
- Assurez-vous que nous puissions vous entendre! Cette boîte se remplira une
21388
- fois que nous aurons entendu un son suffisamment long
21376
+ step-3: Assurez-vous que nous puissions vous entendre!
21389
21377
  sounds-good: Très bien!
21390
21378
  try-clapping: Essayez de taper des mains ou de dire bonjour.
21391
21379
  step-2-warning:
@@ -22149,11 +22137,11 @@ exp-video-config:
22149
22137
  click-here-to-detect: klikkeljen ide
22150
22138
  see-troubleshooting:
22151
22139
  Ha problémába ütközöl, olvasd el az alábbi hibaelhárítási utasításokat!
22152
- step-1:
22153
- Győződjön meg róla, hogy a bal oldalon látja magát! Előfordulhat, hogy az
22154
- "Engedélyezés" gombra kell kattintania, hogy hozzáférhessünk webkamerájához
22155
- és mikrofonjához. Firefoxban jelölje be a "Jegyezze meg ezt a döntést"
22156
- jelölőnégyzetet is!
22140
+ step-1-title: Győződjön meg róla, hogy a bal oldalon látja magát!
22141
+ step-1-text:
22142
+ Előfordulhat, hogy az "Engedélyezés" gombra kell kattintania, hogy
22143
+ hozzáférhessünk webkamerájához és mikrofonjához. Firefoxban jelölje be a
22144
+ "Jegyezze meg ezt a döntést" jelölőnégyzetet is!
22157
22145
  looks-good: Minden rendben!
22158
22146
  no-webcam-detected: Nincs webkamera
22159
22147
  step-2-click-directions:
@@ -22165,9 +22153,7 @@ exp-video-config:
22165
22153
  kellene a hozzáférést. (Ha lát egy párbeszédablakot, kattintson a
22166
22154
  "Emlékezzen erre a döntésre" vagy a "Mindig engedélyezze" gombra, és
22167
22155
  próbálja újra!)
22168
- step-3:
22169
- Győződjön meg róla, hogy halljuk Önt! Ez a mező akkor lesz teli, ha elég
22170
- hangos hangot hallunk
22156
+ step-3: Győződjön meg róla, hogy halljuk Önt!
22171
22157
  sounds-good: Jòl hallhatò!
22172
22158
  try-clapping: Pròbáljon tapsolni vagy köszönjön.
22173
22159
  step-2-warning:
@@ -22671,11 +22657,11 @@ exp-video-config:
22671
22657
  see-troubleshooting:
22672
22658
  Se hai problemi, consulta le istruzioni per la risoluzione dei problemi di
22673
22659
  seguito!
22674
- step-1:
22675
- Assicurati di essere nell'inquadratura a sinistra! Potrebbe essere
22676
- necessario fare clic su "Consenti" per farci accedere alla tua webcam e
22677
- microfono. Su Firefox, assicurati di selezionare anche "Ricorda questa
22678
- decisione"!
22660
+ step-1-title: Assicurati di essere nell'inquadratura a sinistra!
22661
+ step-1-text:
22662
+ Potrebbe essere necessario fare clic su "Consenti" per farci accedere alla
22663
+ tua webcam e microfono. Su Firefox, assicurati di selezionare anche "Ricorda
22664
+ questa decisione"!
22679
22665
  looks-good: Ti vediamo bene!
22680
22666
  no-webcam-detected: Nessuna webcam e' stata rilevata
22681
22667
  step-2-click-directions:
@@ -22686,9 +22672,7 @@ exp-video-config:
22686
22672
  La tua webcam dovrebbe riapparire SENZA che tu debba consentire nuovamente
22687
22673
  l'accesso. (Se vedi una finestra di dialogo, fai clic su "Ricorda questa
22688
22674
  decisione" o "Consenti sempre" e riprova!)
22689
- step-3:
22690
- Assicurati che possiamo sentirti chiaramente! Questa casella diventerà verde
22691
- quando sentiremo un suono abbastanza alto
22675
+ step-3: Assicurati che possiamo sentirti chiaramente!
22692
22676
  sounds-good: Ti sentiamo bene!
22693
22677
  try-clapping: Prova ad applaudire o a salutare.
22694
22678
  step-2-warning:
@@ -23016,11 +23000,12 @@ exp-video-config:
23016
23000
  see-troubleshooting: 問題がある場合は、以下のトラブルシューティングの方法をご覧ください。
23017
23001
  setup-tips-header: セットアップのヒントとトラブルシューティング
23018
23002
  sounds-good: 良さそうです!
23019
- step-1: 左側に自分の姿が見えることを確認してください。Webカメラとマイクにアクセスできるように、「許可」をクリックする必要があるかもしれません。Firefoxでは、「この決定を記憶する」にもチェックを入れてください。
23003
+ step-1-title: 左側に自分の姿が見えることを確認してください。
23004
+ step-1-text: Webカメラとマイクにアクセスできるように、「許可」をクリックする必要があるかもしれません。Firefoxでは、「この決定を記憶する」にもチェックを入れてください。
23020
23005
  step-2-click-directions: 「設定確認」をクリックして、ウェブカメラの設定が保存されていることを確認してください。
23021
23006
  step-2-warning: 最初に「ウェブカメラを再読み込み」ボタンを押して、「許可」をクリックしなくても再び表示されることを確認してください。
23022
23007
  step-2-what-should-happen: 再度アクセスを許可しなくても、ウェブカメラが表示されるはずです。(ダイアログが表示された場合は、「この決定を記憶する」または「常に許可する」をクリックして、もう一度試してみてください)。
23023
- step-3: 声が聞こえるかどうか確認してください。このボックスは、十分な大きさの音が聞こえると緑色に塗りつぶされます
23008
+ step-3: 声が聞こえるかどうか確認してください。
23024
23009
  step-3-warning: まず、録音した音声が十分な大きさであることを確認してください。音を出してみてください。
23025
23010
  support-message: Lookitは現在、FirefoxとChromeの最近のバージョンにのみ対応しています。携帯電話やタブレットなどのモバイルデバイスではまだ動作しません。
23026
23011
  supported-setup: お使いのデバイスとブラウザの確認
@@ -23444,10 +23429,11 @@ exp-video-config:
23444
23429
  see-troubleshooting:
23445
23430
  Raadpleeg de onderstaande instructies voor oplossingen als u problemen
23446
23431
  ondervindt!
23447
- step-1:
23448
- Zorg ervoor dat je jezelf aan de linkerkant kunt zien! Mogelijk moet u op
23449
- "Toestaan" klikken zodat we toegang hebben tot uw webcam en microfoon. Zorg
23450
- er in Firefox voor dat u ook "Onthoud deze beslissing" aanvinkt!
23432
+ step-1-title: Zorg ervoor dat je jezelf aan de linkerkant kunt zien!
23433
+ step-1-text:
23434
+ Mogelijk moet u op "Toestaan" klikken zodat we toegang hebben tot uw webcam
23435
+ en microfoon. Zorg er in Firefox voor dat u ook "Onthoud deze beslissing"
23436
+ aanvinkt!
23451
23437
  looks-good: Ziet er goed uit!
23452
23438
  no-webcam-detected: Geen webcam gedetecteerd
23453
23439
  step-2-click-directions:
@@ -23457,9 +23443,7 @@ exp-video-config:
23457
23443
  Uw webcam zou opnieuw moeten verschijnen ZONDER dat u opnieuw toegang hoeft
23458
23444
  te verlenen. (Als je een dialoogvenster ziet, klik dan op 'Onthoud deze
23459
23445
  beslissing' of 'Altijd toestaan' en probeer het opnieuw!)
23460
- step-3:
23461
- Zorg ervoor dat we u kunnen horen! Dit vak wordt ingevuld zodra we een
23462
- voldoende luid geluid horen
23446
+ step-3: Zorg ervoor dat we u kunnen horen!
23463
23447
  sounds-good: Klinkt goed!
23464
23448
  try-clapping: Probeer te klappen of hallo te zeggen.
23465
23449
  step-2-warning:
@@ -24274,10 +24258,11 @@ exp-video-config:
24274
24258
  problemas!
24275
24259
  setup-tips-header: Dicas de configuração e solução de problemas
24276
24260
  sounds-good: Parece bom!
24277
- step-1:
24278
- Certifique-se de que você pode se ver à esquerda! Pode ser necessário clicar
24279
- em "Permitir" para que possamos acessar sua webcam e microfone. No Firefox,
24280
- certifique-se de marcar também "Lembrar desta decisão"!
24261
+ step-1-title: Certifique-se de que você pode se ver à esquerda!
24262
+ step-1-text:
24263
+ Pode ser necessário clicar em "Permitir" para que possamos acessar sua
24264
+ webcam e microfone. No Firefox, certifique-se de marcar também "Lembrar
24265
+ desta decisão"!
24281
24266
  step-2-click-directions:
24282
24267
  Certifique-se de que as configurações da sua webcam foram salvas clicando em
24283
24268
  step-2-warning:
@@ -24287,9 +24272,7 @@ exp-video-config:
24287
24272
  Sua webcam deve reaparecer SEM que você precise permitir o acesso novamente.
24288
24273
  (Se você vir uma caixa de diálogo, clique em "Lembrar desta decisão" ou
24289
24274
  "Sempre permitir" e tente novamente!)
24290
- step-3:
24291
- Certifique-se de que podemos ouvi-lo! Esta caixa será preenchida assim que
24292
- ouvirmos um som alto o suficiente
24275
+ step-3: Certifique-se de que podemos ouvi-lo!
24293
24276
  step-3-warning:
24294
24277
  Verifique primeiro se o áudio da sua gravação está alto o suficiente. Faça
24295
24278
  algum Barulho!
@@ -24754,10 +24737,11 @@ exp-video-config:
24754
24737
  problemas!
24755
24738
  setup-tips-header: Dicas de configuração e solução de problemas
24756
24739
  sounds-good: Soa bem!
24757
- step-1:
24758
- Certifique-se de que você pode se ver à esquerda! Pode ser necessário clicar
24759
- em "Permitir" para que possamos acessar sua webcam e microfone. No Firefox,
24760
- certifique-se de marcar também "Lembrar desta decisão"!
24740
+ step-1-title: Certifique-se de que você pode se ver à esquerda!
24741
+ step-1-text:
24742
+ Pode ser necessário clicar em "Permitir" para que possamos acessar sua
24743
+ webcam e microfone. No Firefox, certifique-se de marcar também "Lembrar
24744
+ desta decisão"!
24761
24745
  step-2-click-directions:
24762
24746
  Certifique-se de que as configurações da sua webcam foram salvas clicando em
24763
24747
  step-2-warning:
@@ -24767,9 +24751,7 @@ exp-video-config:
24767
24751
  Sua webcam deve reaparecer SEM que você precise permitir o acesso novamente.
24768
24752
  (Se você vir uma caixa de diálogo, clique em "Lembrar desta decisão" ou
24769
24753
  "Sempre permitir" e tente novamente!)
24770
- step-3:
24771
- Certifique-se de que podemos ouvi-lo! Esta caixa será preenchida assim que
24772
- ouvirmos um som alto o suficiente
24754
+ step-3: Certifique-se de que podemos ouvi-lo!
24773
24755
  step-3-warning:
24774
24756
  Verifique primeiro se o áudio da sua gravação está alto o suficiente. Faça
24775
24757
  algum Barulho!
@@ -24836,7 +24818,7 @@ uploading video: enviando vídeo
24836
24818
  return Object.entries(translations).reduce((prev, [locale, translation]) => {
24837
24819
  const lcl = new Intl.Locale(locale);
24838
24820
  return Object.assign(Object.assign({}, prev), { [lcl.baseName]: {
24839
- translation: Yaml.load(translation),
24821
+ translation: jsYaml.load(translation),
24840
24822
  } });
24841
24823
  }, {});
24842
24824
  };
@@ -24856,7 +24838,7 @@ uploading video: enviando vídeo
24856
24838
  };
24857
24839
  // Initialize translations
24858
24840
  instance.use(ICU).init({
24859
- debug: process.env.DEBUG === "true",
24841
+ debug: "false" === "true",
24860
24842
  resources: resources(),
24861
24843
  });
24862
24844
  // Setup Handlebars' helpers
@@ -24899,9 +24881,425 @@ uploading video: enviando vídeo
24899
24881
  }
24900
24882
  };
24901
24883
 
24902
- var index = { consentVideo };
24884
+ /**
24885
+ * Class to augment and translate the exit survey JSON based on user set
24886
+ * parameters.
24887
+ */
24888
+ class ExitSurveyJson {
24889
+ /**
24890
+ * Adjust survey json to meet user's parameters.
24891
+ *
24892
+ * @param trial - Trial data including user supplied parameters.
24893
+ */
24894
+ constructor(trial) {
24895
+ this.trial = trial;
24896
+ this.names = {
24897
+ birthDate: "birthDate",
24898
+ databraryShare: "databraryShare",
24899
+ useOfMedia: "useOfMedia",
24900
+ withdrawal: "withdrawal",
24901
+ feedback: "feedback",
24902
+ };
24903
+ this.survey = {
24904
+ pages: [
24905
+ {
24906
+ elements: [
24907
+ {
24908
+ description: "exp-lookit-exit-survey.why-birthdate",
24909
+ inputType: "date",
24910
+ isRequired: true,
24911
+ maxValueExpression: "today()",
24912
+ name: this.names.birthDate,
24913
+ title: "exp-lookit-exit-survey.confirm-birthdate",
24914
+ type: "text",
24915
+ },
24916
+ {
24917
+ description: "exp-lookit-exit-survey.databrary-info",
24918
+ enableIf: "({withdrawal} empty) or ({withdrawal.length} = 0)",
24919
+ isRequired: true,
24920
+ name: this.names.databraryShare,
24921
+ title: "exp-lookit-exit-survey.q-databrary",
24922
+ type: "boolean",
24923
+ valueFalse: "no",
24924
+ valueTrue: "yes",
24925
+ },
24926
+ {
24927
+ choices: [
24928
+ {
24929
+ text: "exp-lookit-exit-survey.private-option-part-1",
24930
+ value: "private",
24931
+ },
24932
+ {
24933
+ text: "exp-lookit-exit-survey.scientific-option",
24934
+ value: "scientific",
24935
+ },
24936
+ {
24937
+ text: "exp-lookit-exit-survey.publicity-option",
24938
+ value: "public",
24939
+ },
24940
+ ],
24941
+ description: "",
24942
+ enableIf: "({withdrawal} empty) or ({withdrawal.length} = 0)",
24943
+ isRequired: true,
24944
+ name: this.names.useOfMedia,
24945
+ title: "exp-lookit-exit-survey.acceptable-use-header",
24946
+ type: "radiogroup",
24947
+ },
24948
+ {
24949
+ choices: [
24950
+ {
24951
+ text: "exp-lookit-exit-survey.withdrawal-details",
24952
+ value: true,
24953
+ },
24954
+ ],
24955
+ defaultValue: [],
24956
+ isRequired: false,
24957
+ name: this.names.withdrawal,
24958
+ title: "exp-lookit-exit-survey.withdrawal-header",
24959
+ type: "checkbox",
24960
+ },
24961
+ {
24962
+ autoGrow: true,
24963
+ name: this.names.feedback,
24964
+ rows: 3,
24965
+ title: "exp-lookit-exit-survey.feedback-label",
24966
+ type: "comment",
24967
+ },
24968
+ ],
24969
+ name: "page1",
24970
+ },
24971
+ ],
24972
+ showQuestionNumbers: "off",
24973
+ };
24974
+ this.showDatabraryOptions();
24975
+ this.additionalVideoPrivacyText();
24976
+ this.privateLevelOnly();
24977
+ this.translation();
24978
+ }
24979
+ /** Alter survey to show Databrary options. */
24980
+ showDatabraryOptions() {
24981
+ if (!this.trial.show_databrary_options) {
24982
+ const survey_elements = this.survey.pages[0].elements;
24983
+ const databrary_share_element_idx = survey_elements.findIndex((element) => element.name === this.names.databraryShare);
24984
+ survey_elements.splice(databrary_share_element_idx, 1);
24985
+ }
24986
+ }
24987
+ /** Alter survey to contain additional video privacy text. */
24988
+ additionalVideoPrivacyText() {
24989
+ const element = this.survey.pages[0].elements.find((element) => element.name === this.names.useOfMedia);
24990
+ element &&
24991
+ Object.assign(element, {
24992
+ description: this.trial.additional_video_privacy_text,
24993
+ });
24994
+ }
24995
+ /** Alter survey to only show "private" on use of media question. */
24996
+ privateLevelOnly() {
24997
+ if (this.trial.private_level_only) {
24998
+ const media_use_element = this.survey.pages[0].elements.find((element) => element.name === this.names.useOfMedia);
24999
+ media_use_element &&
25000
+ Object.assign(media_use_element, {
25001
+ defaultValue: "private",
25002
+ description: "exp-lookit-exit-survey.private-option-part-1",
25003
+ choicesVisibleIf: "false", // this must be a string expression
25004
+ isRequired: false,
25005
+ });
25006
+ }
25007
+ }
25008
+ /** Translate the survey text. */
25009
+ translation() {
25010
+ const { contact_info, name } = window.chs.study.attributes;
25011
+ const view = Object.assign(Object.assign({}, this.trial), { include_example: this.trial.include_withdrawal_example, contact: contact_info, name });
25012
+ this.survey.pages[0].elements.forEach((element) => {
25013
+ // Descriptions
25014
+ element.description &&
25015
+ Object.assign(element, {
25016
+ description: instance.t(element.description, view),
25017
+ });
25018
+ // Titles
25019
+ Object.assign(element, { title: instance.t(element.title, view) });
25020
+ // Choices
25021
+ element.choices &&
25022
+ element.choices.forEach((choice) => {
25023
+ Object.assign(choice, { text: instance.t(choice.text, view) });
25024
+ });
25025
+ });
25026
+ }
25027
+ }
25028
+ /**
25029
+ * Translate survey text to desired locale.
25030
+ *
25031
+ * @param trial - Trial data including user supplied parameters.
25032
+ * @returns Survey json
25033
+ */
25034
+ const exitSurvey = (trial) => {
25035
+ setLocale(trial);
25036
+ return new ExitSurveyJson(trial).survey;
25037
+ };
25038
+
25039
+ var uploadingVideoTemplate = `<div>{{t "uploading video"}}, {{t "please wait"}}...</div>`;
25040
+
25041
+ /**
25042
+ * Get translated template for uploading video message.
25043
+ *
25044
+ * @param trial - JsPsych trial object containing trial params
25045
+ * @returns Uploading video message HTML
25046
+ */
25047
+ const uploadingVideo = (trial) => {
25048
+ setLocale(trial);
25049
+ return Handlebars.compile(uploadingVideoTemplate)({});
25050
+ };
25051
+
25052
+ var videoConfigTemplate = `<div id="lookit-jspsych-video-config">
25053
+ <div id="lookit-jspsych-video-config-title-row">
25054
+ <h2>{{t "exp-video-config.title"}}</h2>
25055
+ <p>{{t "exp-video-config.not-recording-note"}}</p>
25056
+ </div>
25057
+ <div id="lookit-jspsych-video-config-row-container">
25058
+ <div id="lookit-jspsych-video-config-webcam-column">
25059
+ <div id="{{webcam_container_id}}"></div>
25060
+ <div id="lookit-jspsych-webcam-buttons">
25061
+ <div id="lookit-jspsych-webcam-reload-container">
25062
+ <div>
25063
+ <button
25064
+ type="button"
25065
+ id="{{reload_button_id_cam}}"
25066
+ class="jspsych-btn lookit-jspsych-btn"
25067
+ >
25068
+ {{t "Reload webcam"}}
25069
+ </button>
25070
+ </div>
25071
+ </div>
25072
+ <div id="lookit-jspsych-device-selection-container">
25073
+ <div id="lookit-jspsych-webcam-selection">
25074
+ <select
25075
+ name="lookit-jspsych-webcam"
25076
+ id="{{camera_selection_id}}"
25077
+ class="lookit-jspsych-device-selection"
25078
+ ></select>
25079
+ </div>
25080
+ <div id="lookit-jspsych-mic-selection">
25081
+ <select
25082
+ name="lookit-jspsych-mic"
25083
+ id="{{mic_selection_id}}"
25084
+ class="lookit-jspsych-device-selection"
25085
+ ></select>
25086
+ </div>
25087
+ </div>
25088
+ </div>
25089
+ <div id="lookit-jspsych-browser-note" class="lookit-jspsych-help-text">
25090
+ {{t "exp-video-config.Note"}}:
25091
+ {{t "exp-video-config.support-message"}}
25092
+ </div>
25093
+ </div>
25094
+ <div id="lookit-jspsych-video-config-instructions-column">
25095
+ <div id="lookit-jspsych-video-config-errors">
25096
+ <span
25097
+ id="lookit-jspsych-waiting-for-access"
25098
+ class="error_msg"
25099
+ style="display: none;"
25100
+ >{{t "exp-video-config.no-webcam-detected"}}</span>
25101
+ <span
25102
+ id="lookit-jspsych-checking-mic"
25103
+ class="error_msg"
25104
+ style="display: none;"
25105
+ >{{t "exp-video-config.try-clapping"}}</span>
25106
+ <span
25107
+ id="lookit-jspsych-access-problem"
25108
+ class="error_msg"
25109
+ style="display: none;"
25110
+ >{{t "exp-video-config.camera-access-warning"}}</span>
25111
+ <span
25112
+ id="lookit-jspsych-setup-problem"
25113
+ class="error_msg"
25114
+ style="display: none;"
25115
+ >{{t "exp-video-config.see-troubleshooting"}}</span>
25116
+ </div>
25117
+ <ol id="lookit-jspsych-video-config-instructions">
25118
+ <li id="{{step1_id}}">
25119
+ <strong>{{t "exp-video-config.step-1-title"}}</strong>
25120
+ <span
25121
+ id="{{step1_id}}-span"
25122
+ style="visibility: hidden"
25123
+ class="{{step_complete_class}}"
25124
+ >{{t "exp-video-config.looks-good"}}
25125
+ <img
25126
+ class="lookit-jspsych-checkmark"
25127
+ src="{{checkmarkIcon}}"
25128
+ alt="Green checkmark"
25129
+ /></span>
25130
+ <p id="{{step1_id}}-paragraph">
25131
+ {{t "exp-video-config.step-1-text"}}
25132
+ </p>
25133
+ </li>
25134
+ <li id="{{step2_id}}">
25135
+ <strong>{{t "exp-video-config.step-2-click-directions"}}
25136
+ <button
25137
+ id="{{reload_button_id_text}}"
25138
+ class="jspsych-btn lookit-jspsych-btn"
25139
+ >
25140
+ {{t "exp-video-config.reload-button-label"}}
25141
+ </button>.</strong>
25142
+ <span
25143
+ id="{{step2_id}}-span"
25144
+ style="visibility: hidden"
25145
+ class="{{step_complete_class}}"
25146
+ ><img
25147
+ class="lookit-jspsych-checkmark"
25148
+ src="{{checkmarkIcon}}"
25149
+ alt="Green checkmark"
25150
+ /></span>
25151
+ <p id="{{step2_id}}-paragraph">
25152
+ {{t "exp-video-config.step-2-what-should-happen"}}
25153
+ </p>
25154
+ </li>
25155
+ <li id="{{step3_id}}">
25156
+ <strong>{{t "exp-video-config.step-3"}}:</strong>
25157
+ <span
25158
+ id="{{step3_id}}-span"
25159
+ style="visibility: hidden"
25160
+ class="{{step_complete_class}}"
25161
+ >{{t "exp-video-config.sounds-good"}}
25162
+ <img
25163
+ class="lookit-jspsych-checkmark"
25164
+ src="{{checkmarkIcon}}"
25165
+ alt="Green checkmark"
25166
+ /></span>
25167
+ <p id="{{step3_id}}-paragraph">{{t
25168
+ "exp-video-config.try-clapping"
25169
+ }}</p>
25170
+ </li>
25171
+ </ol>
25172
+ </div>
25173
+ </div>
25174
+ <div id="lookit-jspsych-next-container" class="jspsych-instructions-nav">
25175
+ <button
25176
+ id="{{next_button_id}}"
25177
+ class="jspsych-btn lookit-jspsych-btn"
25178
+ style="margin-left: 5px"
25179
+ disabled
25180
+ >
25181
+ {{t "Next"}}
25182
+ </button>
25183
+ </div>
25184
+ <div id="lookit-jspsych-config-troubleshooting-column-container">
25185
+ <div id="lookit-jspsych-accordion-header-container">
25186
+ <h2> {{t "exp-video-config.setup-tips-header"}} </h2>
25187
+ <hr />
25188
+ <p id="lookit-jspsych-troubleshooting-intro">
25189
+ {{exp-format troubleshooting_intro}}
25190
+ </p>
25191
+ </div>
25192
+ <div id="lookit-jspsych-accordion-container">
25193
+ <button class="lookit-jspsych-accordion">
25194
+ {{t "exp-video-config.supported-setup"}}
25195
+ </button>
25196
+ <div class="lookit-jspsych-accordion-panel" style="display: none">
25197
+ <ol>
25198
+ <li>
25199
+ {{t "exp-video-config.mobile-devices"}}
25200
+ </li>
25201
+ <li>
25202
+ {{t "exp-video-config.browser-support"}}
25203
+ </li>
25204
+ </ol>
25205
+ </div>
25206
+ <button class="lookit-jspsych-accordion">
25207
+ {{t "exp-video-config.chrome-instructions-header"}}
25208
+ </button>
25209
+ <div class="lookit-jspsych-accordion-panel" style="display: none">
25210
+ <ol>
25211
+ <li>
25212
+ {{t "exp-video-config.chrome-directions-prompt"}}
25213
+ <img
25214
+ class="lookit-jspsych-screenshot"
25215
+ src="{{chromeInitialPrompt}}"
25216
+ alt="Chrome permissions prompt"
25217
+ />
25218
+ </li>
25219
+ <li>
25220
+ {{t "exp-video-config.chrome-directions-set-perms"}}
25221
+ <img
25222
+ class="lookit-jspsych-screenshot"
25223
+ src="{{chromePermissions}}"
25224
+ alt="Editing microphone and camera permissions in Chrome, step 1"
25225
+ />
25226
+ </li>
25227
+ <li>
25228
+ {{t "exp-video-config.chrome-select-mic" htmlSafe=true}}
25229
+ </li>
25230
+ <li>
25231
+ {{t "exp-video-config.chrome-select-camera" htmlSafe=true}}
25232
+ </li>
25233
+ <li>
25234
+ {{t "exp-video-config.chrome-further-help" htmlSafe=true}}
25235
+ </li>
25236
+ </ol>
25237
+ </div>
25238
+ <button class="lookit-jspsych-accordion">
25239
+ {{t "exp-video-config.firefox-instructions-header"}}
25240
+ </button>
25241
+ <div class="lookit-jspsych-accordion-panel" style="display: none">
25242
+ <ol>
25243
+ <li>
25244
+ {{t "exp-video-config.firefox-directions-prompt"}}
25245
+ <img
25246
+ class="lookit-jspsych-screenshot"
25247
+ src="{{firefoxInitialPrompt}}"
25248
+ alt="Firefox permissions prompt"
25249
+ />
25250
+ </li>
25251
+ <li>
25252
+ {{t "exp-video-config.firefox-directions-set-perms"}}
25253
+ <img
25254
+ class="lookit-jspsych-screenshot"
25255
+ src="{{firefoxDevicesBlocked}}"
25256
+ alt="Blocked microphone and camera permissions in Firefox"
25257
+ />
25258
+ </li>
25259
+ </ol>
25260
+ </div>
25261
+ <button class="lookit-jspsych-accordion">
25262
+ {{t "exp-video-config.additional-troubleshooting-header"}}
25263
+ </button>
25264
+ <div class="lookit-jspsych-accordion-panel" style="display: none">
25265
+ <p>
25266
+ {{t "exp-video-config.additional-troubleshooting-intro"}}
25267
+ </p>
25268
+ <ol>
25269
+ <li>
25270
+ {{t "exp-video-config.camera-check"}}
25271
+ </li>
25272
+ <li>
25273
+ {{t "exp-video-config.try-another-browser"}}
25274
+ </li>
25275
+ <li>
25276
+ {{t "exp-video-config.chrome-incognito"}}
25277
+ </li>
25278
+ <li>
25279
+ {{t "exp-video-config.additional-troubleshooting-contact"}}:
25280
+ {{session.id}}
25281
+ </li>
25282
+ </ol>
25283
+ </div>
25284
+ </div>
25285
+ </div>
25286
+ </div>`;
25287
+
25288
+ /**
25289
+ * Get translated template for video config.
25290
+ *
25291
+ * @param trial - JsPsych trial object containing trial params
25292
+ * @param html_params - Additional context variables for the template.
25293
+ * @returns Video config HTML
25294
+ */
25295
+ const videoConfig = (trial, html_params) => {
25296
+ setLocale(trial);
25297
+ return Handlebars.compile(videoConfigTemplate)(Object.assign(Object.assign({}, trial), html_params));
25298
+ };
25299
+
25300
+ var index = { consentVideo, videoConfig, uploadingVideo, exitSurvey };
24903
25301
 
24904
25302
  return index;
24905
25303
 
24906
25304
  })();
24907
- //# sourceMappingURL=https://unpkg.com/@lookit/templates@0.0.1/dist/index.browser.js.map
25305
+ //# sourceMappingURL=https://unpkg.com/@lookit/templates@1.1.0/dist/index.browser.js.map