function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {
  var sourceMap = aSourceMap;
  if (typeof aSourceMap === 'string') {
    sourceMap = util.parseSourceMapInput(aSourceMap);
  }

  var version = util.getArg(sourceMap, 'version');
  var sources = util.getArg(sourceMap, 'sources');
  // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which
  // requires the array) to play nice here.
  var names = util.getArg(sourceMap, 'names', []);
  var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);
  var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);
  var mappings = util.getArg(sourceMap, 'mappings');
  var file = util.getArg(sourceMap, 'file', null);

  // Once again, Sass deviates from the spec and supplies the version as a
  // string rather than a number, so we use loose equality checking here.
  if (version != this._version) {
    throw new Error('Unsupported version: ' + version);
  }

  if (sourceRoot) {
    sourceRoot = util.normalize(sourceRoot);
  }

  sources = sources
    .map(String)
    // Some source maps produce relative source paths like "./foo.js" instead of
    // "foo.js".  Normalize these first so that future comparisons will succeed.
    // See bugzil.la/1090768.
    .map(util.normalize)
    // Always ensure that absolute sources are internally stored relative to
    // the source root, if the source root is absolute. Not doing this would
    // be particularly problematic when the source root is a prefix of the
    // source (valid, but why??). See github issue #199 and bugzil.la/1188982.
    .map(function (source) {
      return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source)
        ? util.relative(sourceRoot, source)
        : source;
    });

  // Pass `true` below to allow duplicate names and sources. While source maps
  // are intended to be compressed and deduplicated, the TypeScript compiler
  // sometimes generates source maps with duplicates in them. See Github issue
  // #72 and bugzil.la/889492.
  this._names = ArraySet.fromArray(names.map(String), true);
  this._sources = ArraySet.fromArray(sources, true);

  this._absoluteSources = this._sources.toArray().map(function (s) {
    return util.computeSourceURL(sourceRoot, s, aSourceMapURL);
  });

  this.sourceRoot = sourceRoot;
  this.sourcesContent = sourcesContent;
  this._mappings = mappings;
  this._sourceMapURL = aSourceMapURL;
  this.file = file;
}
function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {
  var sourceMap = aSourceMap;
  if (typeof aSourceMap === 'string') {
    sourceMap = util.parseSourceMapInput(aSourceMap);
  }

  var version = util.getArg(sourceMap, 'version');
  var sources = util.getArg(sourceMap, 'sources');
  // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which
  // requires the array) to play nice here.
  var names = util.getArg(sourceMap, 'names', []);
  var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);
  var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);
  var mappings = util.getArg(sourceMap, 'mappings');
  var file = util.getArg(sourceMap, 'file', null);

  // Once again, Sass deviates from the spec and supplies the version as a
  // string rather than a number, so we use loose equality checking here.
  if (version != this._version) {
    throw new Error('Unsupported version: ' + version);
  }

  if (sourceRoot) {
    sourceRoot = util.normalize(sourceRoot);
  }

  sources = sources
    .map(String)
    // Some source maps produce relative source paths like "./foo.js" instead of
    // "foo.js".  Normalize these first so that future comparisons will succeed.
    // See bugzil.la/1090768.
    .map(util.normalize)
    // Always ensure that absolute sources are internally stored relative to
    // the source root, if the source root is absolute. Not doing this would
    // be particularly problematic when the source root is a prefix of the
    // source (valid, but why??). See github issue #199 and bugzil.la/1188982.
    .map(function (source) {
      return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source)
        ? util.relative(sourceRoot, source)
        : source;
    });

  // Pass `true` below to allow duplicate names and sources. While source maps
  // are intended to be compressed and deduplicated, the TypeScript compiler
  // sometimes generates source maps with duplicates in them. See Github issue
  // #72 and bugzil.la/889492.
  this._names = ArraySet.fromArray(names.map(String), true);
  this._sources = ArraySet.fromArray(sources, true);

  this._absoluteSources = this._sources.toArray().map(function (s) {
    return util.computeSourceURL(sourceRoot, s, aSourceMapURL);
  });

  this.sourceRoot = sourceRoot;
  this.sourcesContent = sourcesContent;
  this._mappings = mappings;
  this._sourceMapURL = aSourceMapURL;
  this.file = file;
}
function BasicSourceMapConsumer ( aSourceMap , aSourceMapURL ) { var sourceMap = aSourceMap ; if ( typeof aSourceMap === 'string' ) { sourceMap = util . parseSourceMapInput ( aSourceMap ) ; } var version = util . getArg ( sourceMap , 'version' ) ; var sources = util . getArg ( sourceMap , 'sources' ) ; // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which // requires the array) to play nice here. var names = util . getArg ( sourceMap , 'names' , [ ] ) ; var sourceRoot = util . getArg ( sourceMap , 'sourceRoot' , null ) ; var sourcesContent = util . getArg ( sourceMap , 'sourcesContent' , null ) ; var mappings = util . getArg ( sourceMap , 'mappings' ) ; var file = util . getArg ( sourceMap , 'file' , null ) ; // Once again, Sass deviates from the spec and supplies the version as a // string rather than a number, so we use loose equality checking here. if ( version != this . _version ) { throw new Error ( 'Unsupported version: ' + version ) ; } if ( sourceRoot ) { sourceRoot = util . normalize ( sourceRoot ) ; } sources = sources . map ( String ) // Some source maps produce relative source paths like "./foo.js" instead of // "foo.js".  Normalize these first so that future comparisons will succeed. // See bugzil.la/1090768. . map ( util . normalize ) // Always ensure that absolute sources are internally stored relative to // the source root, if the source root is absolute. Not doing this would // be particularly problematic when the source root is a prefix of the // source (valid, but why??). See github issue #199 and bugzil.la/1188982. . map ( function ( source ) { return sourceRoot && util . isAbsolute ( sourceRoot ) && util . isAbsolute ( source ) ? util . relative ( sourceRoot , source ) : source ; } ) ; // Pass `true` below to allow duplicate names and sources. While source maps // are intended to be compressed and deduplicated, the TypeScript compiler // sometimes generates source maps with duplicates in them. See Github issue // #72 and bugzil.la/889492. this . _names = ArraySet . fromArray ( names . map ( String ) , true ) ; this . _sources = ArraySet . fromArray ( sources , true ) ; this . _absoluteSources = this . _sources . toArray ( ) . map ( function ( s ) { return util . computeSourceURL ( sourceRoot , s , aSourceMapURL ) ; } ) ; this . sourceRoot = sourceRoot ; this . sourcesContent = sourcesContent ; this . _mappings = mappings ; this . _sourceMapURL = aSourceMapURL ; this . file = file ; }
A BasicSourceMapConsumer instance represents a parsed source map which we can
query for information about the original file positions by giving it a file
position in the generated source.

The first parameter is the raw source map (either as a JSON string, or
already parsed to an object). According to the spec, source maps have the
following attributes:

- version: Which version of the source map spec this map is following.
- sources: An array of URLs to the original source files.
- names: An array of identifiers which can be referrenced by individual mappings.
- sourceRoot: Optional. The URL root from which all sources are relative.
- sourcesContent: Optional. An array of contents of the original source files.
- mappings: A string of base64 VLQs which contain the actual mappings.
- file: Optional. The generated file this source map is associated with.

Here is an example source map, taken from the source map spec[0]:

{
version : 3,
file: "out.js",
sourceRoot : "",
sources: ["foo.js", "bar.js"],
names: ["src", "maps", "are", "fun"],
mappings: "AA,AB;;ABCDE;"
}

The second parameter, if given, is a string whose value is the URL
at which the source map was found.  This URL is used to compute the
sources array.

[0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#
A BasicSourceMapConsumer instance represents a parsed source map which we can query for information about the original file positions by giving it a file position in the generated source .