/*
********************************************************************
/* Extended API
********************************************************************
511116
public BigInteger asBigInteger() throws IOException {
        if (_value instanceof BigInteger) {
            return (BigInteger) _value;
        }
        if (_value instanceof BigDecimal) {
            BigDecimal dec = (BigDecimal) _value;
            return dec.toBigInteger();
        }
        return BigInteger.valueOf(_value.longValue());
    }
1354036
function extend() {
    var target = arguments[0] || {};
    var i = 1;
    var length = arguments.length;
    var deep = false;
    var options, name, src, copy, copy_is_array, clone;

    // Handle a deep copy situation
    if (typeof target === 'boolean') {
      deep = target;
      target = arguments[1] || {};
      // skip the boolean and the target
      i = 2;
    }

    // Handle case when target is a string or something (possible in deep copy)
    if (typeof target !== 'object' && !isFn(target)) {
      target = {};
    }

    for (; i < length; i++) {
      // Only deal with non-null/undefined values
      options = arguments[i];
      if (options !== null) {
        if (typeof options === 'string') {
          options = options.split('');
        }
        // Extend the base object
        for (name in options) {
          src = target[name];
          copy = options[name];

          // Prevent never-ending loop
          if (target === copy) {
            continue;
          }

          // Recurse if we're merging plain objects or arrays
          if (deep && copy && (isHash(copy) || (copy_is_array = isArray(copy)))) {
            if (copy_is_array) {
              copy_is_array = false;
              clone = src && isArray(src) ? src : [];
            } else {
              clone = src && isHash(src) ? src : {};
            }

            // Never move original objects, clone them
            target[name] = extend(deep, clone, copy);

            // Don't bring in undefined values
          } else if (typeof copy !== 'undefined') {
            target[name] = copy;
          }
        }
      }
    }

    // Return the modified object
    return target;
  }
72272
function findTypeForExtend(types, extend) {
  var orig = types.find(ea => ea.name === extend.name && ea.type !== "extend");
  if (!orig) throw new Error("Cannot find original for extension " + JSON.stringify(extend, null, 2));
  return orig;
}
278148
function registerExtension(extension) {
    try {
        var ext; // Actual extension

        if (is(extension, 'buildCore', 'function')) {
            // If extension has buildCore function then give it an instance of the core.
            extension.buildCore(self);
            addOne(extensions, extension);
            return; // No need to extend as that will be handled in buildCore
        }

        if (is(extension, 'function')) {
            // If extension is a function then give it an instance of the core.
            ext = extension(self);
        } else if (has(extension, 'core')) {
            // If extension has `core` property then extend core with it.
            ext = extension.core;
        } else {
            // Otherwise extend core with the extension itself.
            ext = extension;
        }

        if (ext) {
            extend(self, ext);
            addOne(extensions, extension);
        }
    } catch (ex) {
        error('Fatal error during application initialization. ', 'Failed to build core with extension "', extension, 'See following exception for more details.', ex);
    }

    return extension;
}
660387
function extend(o) {
  if (typeOf(o) !== 'object') { return {}; }
  var args = arguments;
  var len = args.length - 1;

  for (var i = 0; i < len; i++) {
    var obj = args[i + 1];

    if (typeOf(obj) === 'object' && typeOf(obj) !== 'regexp') {
      for (var key in obj) {
        if (obj.hasOwnProperty(key)) {
          o[key] = obj[key];
        }
      }
    }
  }
  return o;
}
1002295
function extend(prototype, utils) {
  const { debug, strong, warn } = utils.cnsl;
  const { sourceMapCommentStrip } = utils.string;

  /**
   * Compress file contents
   * @param {Object} buildOptions
   *  - {Boolean} bootstrap
   *  - {Boolean} boilerplate
   *  - {Boolean} browser
   *  - {Boolean} bundle
   *  - {Boolean} compress
   *  - {Array} ignoredFiles
   *  - {Boolean} helpers
   *  - {Boolean} watchOnly
   * @param {Function} fn(err)
   */
  prototype.compress = function compress(buildOptions, fn) {
    const options = Object.assign(
      this.hasMaps
        ? {
            sourceMap: {
              content: this.map.toJSON(),
              url: this.mapUrl
            }
          }
        : {},
      DEFAULT_OPTIONS,
      this.options.pluginOptions.uglify || {}
    );
    const minified = minify(this.content, options);

    if ('error' in minified) {
      fn(minified.error);
      return;
    }

    debug(`compress: ${strong(this.relpath)}`, 4);
    this.setContent(sourceMapCommentStrip(minified.code));
    if (minified.map) {
      this.setMap(minified.map);
    }
    fn();
  };
}
1356574
function extend() {
    var i,
        k,
        res = {},
        l = arguments.length;

    for (i = l - 1; i >= 0; i--)
      for (k in arguments[i])
        if (res[k] && isPlainObject(arguments[i][k]))
          res[k] = extend(arguments[i][k], res[k]);
        else
          res[k] = arguments[i][k];

    return res;
  }
1016257
function compile (extension, content, options, fn) {
    // allow optional options argument
    if (_.isFunction(options)) {
      fn = options;
      options = {};
    }

    var config = _.clone(compile.configuration)
      , args = flags.slice(0)
      , buffer = ''
      , errors = ''
      , compressor;

    if (compile.configuration.type) {
      config.type = extension;
    }

    // generate the --key value options, both the key and the value should added
    // seperately to the `args` array or the child_process will chocke.
    Object.keys(config).filter(function filter (option) {
      return config[option];
    }).forEach(function format (option) {
      var bool = _.isBoolean(config[option]);

      if (!bool || config[option]) {
        args.push('--' + option);
        if (!bool) args.push(config[option]);
      }
    });

    // apply the configuration
    _.extend(config, options);

    // spawn the shit and set the correct encoding
    compressor = spawn(type, args);
    compressor.stdout.setEncoding('utf8');
    compressor.stderr.setEncoding('utf8');

    /**
     * Buffer up the results so we can concat them once the compression is
     * finished.
     *
     * @param {Buffer} chunk
     * @api private
     */

    compressor.stdout.on('data', function data (chunk) {
      buffer += chunk;
    });

    compressor.stderr.on('data', function data (err) {
      errors += err;
    });

    /**
     * The compressor has finished can we now process the data and see if it was
     * a success.
     *
     * @param {Number} code
     * @api private
     */

    compressor.on('close', function close (code) {
      // invalid states
      if (errors.length) return fn(new Error(errors));
      if (code !== 0) return fn(new Error('process exited with code ' + code));
      if (!buffer.length) return fn(new Error('no data returned ' + type + args));

      // correctly processed the data
      fn(null, buffer);
    });

    // write out the content that needs to be minified
    compressor.stdin.end(content);
  }
1025728
public final ProtoParser.extend_body_return extend_body(Proto proto, Extension extension) throws RecognitionException {
        ProtoParser.extend_body_return retval = new ProtoParser.extend_body_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        ProtoParser.message_field_return message_field164 = null;

        ProtoParser.annotation_entry_return annotation_entry165 = null;



        try {
            // com/dyuproject/protostuff/parser/ProtoParser.g:637:5: ( message_field[proto, extension] | annotation_entry[proto] )
            int alt37=2;
            switch ( input.LA(1) ) {
            case REQUIRED:
            case OPTIONAL:
            case REPEATED:
                {
                alt37=1;
                }
                break;
            case AT:
                {
                alt37=2;
                }
                break;
            default:
                if (state.backtracking>0) {state.failed=true; return retval;}
                NoViableAltException nvae =
                    new NoViableAltException("", 37, 0, input);

                throw nvae;
            }

            switch (alt37) {
                case 1 :
                    // com/dyuproject/protostuff/parser/ProtoParser.g:637:9: message_field[proto, extension]
                    {
                    root_0 = (Object)adaptor.nil();

                    pushFollow(FOLLOW_message_field_in_extend_body2588);
                    message_field164=message_field(proto, extension);

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, message_field164.getTree());

                    }
                    break;
                case 2 :
                    // com/dyuproject/protostuff/parser/ProtoParser.g:638:9: annotation_entry[proto]
                    {
                    root_0 = (Object)adaptor.nil();

                    pushFollow(FOLLOW_annotation_entry_in_extend_body2599);
                    annotation_entry165=annotation_entry(proto);

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, annotation_entry165.getTree());

                    }
                    break;

            }
            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
241763
function extend(target = {}, ...args) {
  let i = 0;
  const length = args.length;
  let options;
  let name;
  let src;
  let copy;
  if (!target) {
    target = exports.isArray(args[0]) ? [] : {};
  }
  for (; i < length; i++) {
    options = args[i];
    if (!options) {
      continue;
    }
    for (name in options) {
      src = target[name];
      copy = options[name];
      if (src && src === copy) {
        continue;
      }
      if (exports.isArray(copy)) {
        target[name] = extend([], copy);
      } else if (exports.isObject(copy)) {
        target[name] = extend(src && exports.isObject(src) ? src : {}, copy);
      } else {
        target[name] = copy;
      }
    }
  }
  return target;
}
1090905
function(prototype) {
      if (prototype.PolymerBase) {
        return prototype;
      }
      var extended = Object.create(prototype);
      // we need a unique copy of base api for each base prototype
      // therefore we 'extend' here instead of simply chaining
      api.publish(api.instance, extended);
      // TODO(sjmiles): sharing methods across prototype chains is
      // not supported by 'super' implementation which optimizes
      // by memoizing prototype relationships.
      // Probably we should have a version of 'extend' that is 
      // share-aware: it could study the text of each function,
      // look for usage of 'super', and wrap those functions in
      // closures.
      // As of now, there is only one problematic method, so 
      // we just patch it manually.
      // To avoid re-entrancy problems, the special super method
      // installed is called `mixinSuper` and the mixin method
      // must use this method instead of the default `super`.
      this.mixinMethod(extended, prototype, api.instance.mdv, 'bind');
      // return buffed-up prototype
      return extended;
    }
512029
function (isLess) {
                var index = i, $re = _$re, elements, extendList, c, e, extend, when, condition;

                while ((isLess && (extend = this.extend())) || (isLess && (when = $re(/^when/))) || (e = this.element())) {
                    if (when) {
                        condition = expect(this.conditions, 'expected condition');
                    } else if (condition) {
                        error("CSS guard can only be used at the end of selector");
                    } else if (extend) {
                        if (extendList) { extendList.push(extend); } else { extendList = [ extend ]; }
                    } else {
                        if (extendList) { error("Extend can only be used at the end of selector"); }
                        c = input.charAt(i);
                        if (elements) { elements.push(e); } else { elements = [ e ]; }
                        e = null;
                    }
                    if (c === '{' || c === '}' || c === ';' || c === ',' || c === ')') {
                        break;
                    }
                }

                if (elements) { return new(tree.Selector)(elements, extendList, condition, index, env.currentFileInfo); }
                if (extendList) { error("Extend must be used to extend a selector, it cannot be used on its own"); }
            }
897685
function executeApi(apiName, opts, extras){

  var emitter = new Emitter()
    , apiItem
    , token = opts.access_token
    , form, method, path
    , url
    ;
  
  if(/^(https?:\/\/|\/)/.test(apiName)){
    if(apiName.indexOf('/') === 0){
      url = api.HOST + apiName;
    }else{
      url = apiName;
    }
    extras = extras || {};
    method = extras.method;
    
  }else{
    apiItem = getApiItem(apiName);
    if(!apiItem){
      process.nextTick(function(){
        emitter.emit('error', 'no or not support api: ' + apiName);
      });
      return emitter;
    }
    
    path = apiItem.path;
    method = apiItem.method;
    
    url = api.HOST + api.PREPATH + path + '.json';
  }
  
  if(method == 'post'){
    form = opts;
    opts = {};
  }
  
  delete opts.access_token;
  
  request({
      url: url + '?access_token=' + token
    , method: method
    , qs: opts
    , form: form
  }, function(err, res, reply){
    if(err){
      emitter.emit('error', err);
    }else{
      try{
        reply = JSON.parse(reply);
        emitter.emit('success', reply);
      }catch(e){
        emitter.emit('error', reply);
      }
    }
  });
  
  return emitter;
}
512140
function detect_ext_define(cls, ast) {
  // defaults
  cls["extends"] = "Ext.Base";
  cls["requires"] = [];
  cls["uses"] = [];
  cls["alternateClassNames"] = [];
  cls["mixins"] = [];
  cls["aliases"] = [];
  cls["members"] = [];
  cls["code_type"] = "ext_define";
  
  each_pair_in_object_expression(ast["arguments"][1], function(key, value, pair) {
    switch (key) {
     case "extend":
        cls["extends"] = make_string(value);
        break;
     case "override":
        cls["override"] = make_string(value);
        break;
     case "requires":
        cls["requires"] = make_string_list(value);
        break;
     case "uses":
        cls["uses"] = make_string_list(value);
        break;
     case "alternateClassName":
        cls["alternateClassNames"] = make_string_list(value);
        break;
     case "mixins":
        cls["mixins"] = make_mixins(value);
        break;
     case "singleton":
        cls["singleton"] = make_singleton(value);
        break;
     case "alias":
        cls["aliases"] += make_string_list(value);
        break;
     case "see":
        cls["see"] += make_string_list(value);
        break;
     case "xtype":
        cls["aliases"] += _.map(make_string_list(value), function(xtype) { return "widget."+xtype });
        break;
     case "config":
        cls["members"] += make_configs(value, {"accessor": true});
        break;
     case "cachedConfig":
        cls["members"] += make_configs(value, {"accessor": true});
        break;
     case "eventedConfig":
        cls["members"] += make_configs(value, {"accessor": true, "evented": true});
        break;
     case "statics":
        cls["members"] += make_statics(value);
        break;
     case "inheritableStatics":
        cls["members"] += make_statics(value, {"inheritable": true});
        break;
     default:
        detect_method_or_property(cls, key, value, pair);
        break;
    }
  });
}
1136054
function(url, method = 'get', body = undefined) {
		var deferred = Q.defer();

		this.extendedRequest(url, method, body)
			.then((res) => { deferred.resolve(res.body); })
			.catch((err) => { deferred.reject(err); });

		return deferred.promise;
	}
444308
function extend() {
  var result = {};
  var objs = Array.prototype.slice.call(arguments,0);
  objs.forEach(function(props, index){
    for(var prop in props) {
      if(props.hasOwnProperty(prop)) {
        result[prop] = props[prop]
      }
    }
  });
  return result;
}
381997
function extend(prototype, api) {
    if (prototype && api) {
      // use only own properties of 'api'
      Object.getOwnPropertyNames(api).forEach(function(n) {
        // acquire property descriptor
        var pd = Object.getOwnPropertyDescriptor(api, n);
        if (pd) {
          // clone property via descriptor
          Object.defineProperty(prototype, n, pd);
          // cache name-of-method for 'super' engine
          if (typeof pd.value == 'function') {
            // hint the 'super' engine
            pd.value.nom = n;
          }
        }
      });
    }
    return prototype;
  }