15.5.1 x-user-defined decoder 
@constructor
@implements {Decoder}
@param {{fatal: boolean}} options
174038
function XUserDefinedDecoder(options) {
    var fatal = options.fatal;
    /**
     * @param {Stream} stream The stream of bytes being decoded.
     * @param {number} bite The next byte read from the stream.
     * @return {?(number|!Array.<number>)} The next code point(s)
     *     decoded, or null if not enough data exists in the input
     *     stream to decode a complete code point.
     */
    this.handler = function(stream, bite) {
      // 1. If byte is end-of-stream, return finished.
      if (bite === end_of_stream)
        return finished;

      // 2. If byte is an ASCII byte, return a code point whose value
      // is byte.
      if (isASCIIByte(bite))
        return bite;

      // 3. Return a code point whose value is 0xF780 + byte − 0x80.
      return 0xF780 + bite - 0x80;
    };
  }
832999
function Parser(tokens, options) {
  options = options || {};
  if (!Array.isArray(tokens)) {
    throw new Error('Expected tokens to be an Array but got "' + (typeof tokens) + '"');
  }
  if (typeof options !== 'object') {
    throw new Error('Expected "options" to be an object but got "' + (typeof options) + '"');
  }
  this.tokens = new TokenStream(tokens);
  this.filename = options.filename;
  this.src = options.src;
  this.inMixin = 0;
  this.plugins = options.plugins || [];
}
1089917
function GBKDecoder(gb18030, options) {
  var fatal = options.fatal;
  var /** @type {number} */ gbk_first = 0x00,
      /** @type {number} */ gbk_second = 0x00,
      /** @type {number} */ gbk_third = 0x00;
  /**
   * @param {ByteInputStream} byte_pointer The byte stream to decode.
   * @return {?number} The next code point decoded, or null if not enough
   *     data exists in the input stream to decode a complete code point.
   */
  this.decode = function(byte_pointer) {
    var bite = byte_pointer.get();
    if (bite === EOF_byte && gbk_first === 0x00 &&
        gbk_second === 0x00 && gbk_third === 0x00) {
      return EOF_code_point;
    }
    if (bite === EOF_byte &&
        (gbk_first !== 0x00 || gbk_second !== 0x00 || gbk_third !== 0x00)) {
      gbk_first = 0x00;
      gbk_second = 0x00;
      gbk_third = 0x00;
      decoderError(fatal);
    }
    byte_pointer.offset(1);
    var code_point;
    if (gbk_third !== 0x00) {
      code_point = null;
      if (inRange(bite, 0x30, 0x39)) {
        code_point = indexGB18030CodePointFor(
            (((gbk_first - 0x81) * 10 + (gbk_second - 0x30)) * 126 +
             (gbk_third - 0x81)) * 10 + bite - 0x30);
      }
      gbk_first = 0x00;
      gbk_second = 0x00;
      gbk_third = 0x00;
      if (code_point === null) {
        byte_pointer.offset(-3);
        return decoderError(fatal);
      }
      return code_point;
    }
    if (gbk_second !== 0x00) {
      if (inRange(bite, 0x81, 0xFE)) {
        gbk_third = bite;
        return null;
      }
      byte_pointer.offset(-2);
      gbk_first = 0x00;
      gbk_second = 0x00;
      return decoderError(fatal);
    }
    if (gbk_first !== 0x00) {
      if (inRange(bite, 0x30, 0x39) && gb18030) {
        gbk_second = bite;
        return null;
      }
      var lead = gbk_first;
      var pointer = null;
      gbk_first = 0x00;
      var offset = bite < 0x7F ? 0x40 : 0x41;
      if (inRange(bite, 0x40, 0x7E) || inRange(bite, 0x80, 0xFE)) {
        pointer = (lead - 0x81) * 190 + (bite - offset);
      }
      code_point = pointer === null ? null :
          indexCodePointFor(pointer, indexes['gbk']);
      if (pointer === null) {
        byte_pointer.offset(-1);
      }
      if (code_point === null) {
        return decoderError(fatal);
      }
      return code_point;
    }
    if (inRange(bite, 0x00, 0x7F)) {
      return bite;
    }
    if (bite === 0x80) {
      return 0x20AC;
    }
    if (inRange(bite, 0x81, 0xFE)) {
      gbk_first = bite;
      return null;
    }
    return decoderError(fatal);
  };
}
157714
function ShiftJISDecoder(options) {
    var fatal = options.fatal;
    // shift_jis's decoder has an associated shift_jis lead (initially
    // 0x00).
    var /** @type {number} */ shiftjis_lead = 0x00;
    /**
     * @param {Stream} stream The stream of bytes being decoded.
     * @param {number} bite The next byte read from the stream.
     * @return {?(number|!Array.<number>)} The next code point(s)
     *     decoded, or null if not enough data exists in the input
     *     stream to decode a complete code point.
     */
    this.handler = function(stream, bite) {
      // 1. If byte is end-of-stream and shift_jis lead is not 0x00,
      // set shift_jis lead to 0x00 and return error.
      if (bite === end_of_stream && shiftjis_lead !== 0x00) {
        shiftjis_lead = 0x00;
        return decoderError(fatal);
      }

      // 2. If byte is end-of-stream and shift_jis lead is 0x00,
      // return finished.
      if (bite === end_of_stream && shiftjis_lead === 0x00)
        return finished;

      // 3. If shift_jis lead is not 0x00, let lead be shift_jis lead,
      // let pointer be null, set shift_jis lead to 0x00, and then run
      // these substeps:
      if (shiftjis_lead !== 0x00) {
        var lead = shiftjis_lead;
        var pointer = null;
        shiftjis_lead = 0x00;

        // 1. Let offset be 0x40, if byte is less than 0x7F, and 0x41
        // otherwise.
        var offset = (bite < 0x7F) ? 0x40 : 0x41;

        // 2. Let lead offset be 0x81, if lead is less than 0xA0, and
        // 0xC1 otherwise.
        var lead_offset = (lead < 0xA0) ? 0x81 : 0xC1;

        // 3. If byte is in the range 0x40 to 0x7E or 0x80 to 0xFC,
        // set pointer to (lead − lead offset) × 188 + byte − offset.
        if (inRange(bite, 0x40, 0x7E) || inRange(bite, 0x80, 0xFC))
          pointer = (lead - lead_offset) * 188 + bite - offset;

        // 4. Let code point be null, if pointer is null, and the
        // index code point for pointer in index jis0208 otherwise.
        var code_point = (pointer === null) ? null :
              indexCodePointFor(pointer, index('jis0208'));

        // 5. If code point is null and pointer is in the range 8836
        // to 10528, return a code point whose value is 0xE000 +
        // pointer − 8836.
        if (code_point === null && pointer !== null &&
            inRange(pointer, 8836, 10528))
          return 0xE000 + pointer - 8836;

        // 6. If code point is null and byte is an ASCII byte, prepend
        // byte to stream.
        if (code_point === null && isASCIIByte(bite))
          stream.prepend(bite);

        // 7. If code point is null, return error.
        if (code_point === null)
          return decoderError(fatal);

        // 8. Return a code point whose value is code point.
        return code_point;
      }

      // 4. If byte is an ASCII byte or 0x80, return a code point
      // whose value is byte.
      if (isASCIIByte(bite) || bite === 0x80)
        return bite;

      // 5. If byte is in the range 0xA1 to 0xDF, return a code point
      // whose value is 0xFF61 + byte − 0xA1.
      if (inRange(bite, 0xA1, 0xDF))
        return 0xFF61 + bite - 0xA1;

      // 6. If byte is in the range 0x81 to 0x9F or 0xE0 to 0xFC, set
      // shift_jis lead to byte and return continue.
      if (inRange(bite, 0x81, 0x9F) || inRange(bite, 0xE0, 0xFC)) {
        shiftjis_lead = bite;
        return null;
      }

      // 7. Return error.
      return decoderError(fatal);
    };
  }
1151255
function Parser (options) {
  this.tokens = []
  this.token = null
  this.count = -1
  this.indent = []
  this.options = options || defaults
  this.options.renderer = this.options.renderer || new Renderer() // jshint ignore:line
  this.renderer = this.options.renderer
  this.renderer.options = this.options

  this.anchorMode = [
    MODE.GHOST,
    MODE.BITBUCKET,
    MODE.GITLAB,
    MODE.GITHUB,
    MODE.PANDOC,
    MODE.UNIFIED,
    MODE.MARKDOWNIT,
    MODE.MARKED
  ].map(k => this.options[k] && k).filter(k => k)[0]
  if (this.anchorMode === MODE.UNIFIED) {
    this.anchorMode = MODE.GITHUB
  } this._anchors = new Anchor(this.anchorMode)
}
787889
function makeFixer(options) {
  if (typeof options === 'undefined') {
    return true;
  }

  if (typeof options === 'boolean') {
    return options;
  }

  const rulesToFix = options.rules;
  const fixWarnings = options.warnings;

  function ruleFixer(eslintMessage) {
    if (!rulesToFix) return true;

    if (rulesToFix.indexOf(eslintMessage.ruleId) !== -1) {
      return true;
    }
    return false;
  }

  function warningFixer(eslintMessage) {
    if (fixWarnings === false) {
      return eslintMessage.severity === 2;
    }

    return true;
  }

  return function (eslintMessage) {
    return ruleFixer(eslintMessage) && warningFixer(eslintMessage);
  };
}
856406
function EUCKREncoder(options) {
    var fatal = options.fatal;
    /**
     * @param {Stream} stream Input stream.
     * @param {number} code_point Next code point read from the stream.
     * @return {(number|!Array.<number>)} Byte(s) to emit.
     */
    this.handler = function(stream, code_point) {
      // 1. If code point is end-of-stream, return finished.
      if (code_point === end_of_stream)
        return finished;

      // 2. If code point is an ASCII code point, return a byte whose
      // value is code point.
      if (isASCIICodePoint(code_point))
        return code_point;

      // 3. Let pointer be the index pointer for code point in index
      // euc-kr.
      var pointer = indexPointerFor(code_point, index('euc-kr'));

      // 4. If pointer is null, return error with code point.
      if (pointer === null)
        return encoderError(code_point);

      // 5. Let lead be floor(pointer / 190) + 0x81.
      var lead = floor(pointer / 190) + 0x81;

      // 6. Let trail be pointer % 190 + 0x41.
      var trail = (pointer % 190) + 0x41;

      // 7. Return two bytes whose values are lead and trail.
      return [lead, trail];
    };
  }
315749
function(input, options) {
		var mode;
		if (options && options.mode) {
			mode = options.mode.toLowerCase();
		}
		// “An error mode […] is either `fatal` (default) or `HTML` for an
		// encoder.”
		if (mode != 'fatal' && mode != 'html') {
			mode = 'fatal';
		}
		var length = input.length;
		var index = -1;
		var codePoint;
		var pointer;
		var result = '';
		while (++index < length) {
			codePoint = input.charCodeAt(index);
			// “If `code point` is in the range U+0000 to U+007F, return a byte whose
			// value is `code point`.”
			if (codePoint >= 0x00 && codePoint <= 0x7F) {
				result += stringFromCharCode(codePoint);
				continue;
			}
			// “Let `pointer` be the index pointer for `code point` in index
			// `single-byte`.”
			if (hasOwnProperty.call(INDEX_BY_CODE_POINT, codePoint)) {
				pointer = INDEX_BY_CODE_POINT[codePoint];
				// “Return a byte whose value is `pointer + 0x80`.”
				result += stringFromCharCode(pointer + 0x80);
			} else {
				// “If `pointer` is `null`, return `error` with `code point`.”
				result += error(codePoint, mode);
			}
		}
		return result;
	}
880484
function prepareOptions(value) {
        var options = {};

        if (isType(value, 'String')) {
            XRegExp.forEach(value, /[^\s,]+/, function(match) {
                options[match] = true;
            });

            return options;
        }

        return value;
    }
741297
function decoder(value, position, handler) {
    entities(value, {
      position: normalize(position),
      warning: handleWarning,
      text: handler,
      reference: handler,
      textContext: ctx,
      referenceContext: ctx
    })
  }
1167530
function(json) {
      var decoder = Parse.Op._opDecoderMap[json.__op];
      if (decoder) {
        return decoder(json);
      } else {
        return undefined;
      }
    }
152802
function Compiler(options) {
  options = options || {};
  Base.call(this, options);
  this.indentation = options.indent;
}
865466
function UTF8Decoder(options) {
  var fatal = options.fatal;
  var /** @type {number} */ utf8_code_point = 0,
      /** @type {number} */ utf8_bytes_needed = 0,
      /** @type {number} */ utf8_bytes_seen = 0,
      /** @type {number} */ utf8_lower_boundary = 0;

  /**
   * @param {ByteInputStream} byte_pointer The byte stream to decode.
   * @return {?number} The next code point decoded, or null if not enough
   *     data exists in the input stream to decode a complete code point.
   */
  this.decode = function(byte_pointer) {
    var bite = byte_pointer.get();
    if (bite === EOF_byte) {
      if (utf8_bytes_needed !== 0) {
        return decoderError(fatal);
      }
      return EOF_code_point;
    }
    byte_pointer.offset(1);

    if (utf8_bytes_needed === 0) {
      if (inRange(bite, 0x00, 0x7F)) {
        return bite;
      }
      if (inRange(bite, 0xC2, 0xDF)) {
        utf8_bytes_needed = 1;
        utf8_lower_boundary = 0x80;
        utf8_code_point = bite - 0xC0;
      } else if (inRange(bite, 0xE0, 0xEF)) {
        utf8_bytes_needed = 2;
        utf8_lower_boundary = 0x800;
        utf8_code_point = bite - 0xE0;
      } else if (inRange(bite, 0xF0, 0xF4)) {
        utf8_bytes_needed = 3;
        utf8_lower_boundary = 0x10000;
        utf8_code_point = bite - 0xF0;
      } else {
        return decoderError(fatal);
      }
      utf8_code_point = utf8_code_point * Math.pow(64, utf8_bytes_needed);
      return null;
    }
    if (!inRange(bite, 0x80, 0xBF)) {
      utf8_code_point = 0;
      utf8_bytes_needed = 0;
      utf8_bytes_seen = 0;
      utf8_lower_boundary = 0;
      byte_pointer.offset(-1);
      return decoderError(fatal);
    }
    utf8_bytes_seen += 1;
    utf8_code_point = utf8_code_point + (bite - 0x80) *
        Math.pow(64, utf8_bytes_needed - utf8_bytes_seen);
    if (utf8_bytes_seen !== utf8_bytes_needed) {
      return null;
    }
    var code_point = utf8_code_point;
    var lower_boundary = utf8_lower_boundary;
    utf8_code_point = 0;
    utf8_bytes_needed = 0;
    utf8_bytes_seen = 0;
    utf8_lower_boundary = 0;
    if (inRange(code_point, lower_boundary, 0x10FFFF) &&
        !inRange(code_point, 0xD800, 0xDFFF)) {
      return code_point;
    }
    return decoderError(fatal);
  };
}
385608
function amfXEncodeOne(rules, o) {
//    console.log('amfXEncodeOne type',o,amfType(o),rules[amfType(o)]);
    var f = rules[amfType(o)];
    if (f) return f(o);
    throw new Error('Unsupported type for encoding!');
}
603913
function decode(input) {
    var decoder = new Decoder()
    var output = decoder.update(input, true)
    return output
}
319582
function parseOptions(options) {
		options = options || {};
		return {
			boolean: "boolean" in options ? Boolean(options.boolean) : true,
			number: "number" in options ? Boolean(options.number) : true,
			string: "string" in options ? Boolean(options.string) : true
		};
	}
1156839
function(input, options) {
		var mode;
		if (options && options.mode) {
			mode = options.mode.toLowerCase();
		}
		// “An error mode […] is either `replacement` (default) or `fatal` for a
		// decoder.”
		if (mode != 'replacement' && mode != 'fatal') {
			mode = 'replacement';
		}
		var length = input.length;
		var index = -1;
		var byteValue;
		var pointer;
		var result = '';
		while (++index < length) {
			byteValue = input.charCodeAt(index);
			// “If `byte` is in the range `0x00` to `0x7F`, return a code point whose
			// value is `byte`.”
			if (byteValue >= 0x00 && byteValue <= 0x7F) {
				result += stringFromCharCode(byteValue);
				continue;
			}
			// “Let `code point` be the index code point for `byte − 0x80` in index
			// `single-byte`.”
			pointer = byteValue - 0x80;
			if (hasOwnProperty.call(INDEX_BY_POINTER, pointer)) {
				// “Return a code point whose value is `code point`.”
				result += INDEX_BY_POINTER[pointer];
			} else {
				// “If `code point` is `null`, return `error`.”
				result += error(null, mode);
			}
		}
		return result;
	}