System.register([], function (_export, _context) {
  "use strict";

  function iterate(obj, options) {
    let result = [];
    try {
      if (obj[Symbol.iterator]) {
        result.push(...Array.from(obj));
      }

      if (options.usePrototype && obj.__proto__) {
        result.push(obj.__proto__);
      }

      const props = Object.getOwnPropertyNames(obj);
      result.push(...props.map(prop => obj[prop]));
    } catch (e) {
      // ignore errors
    }

    return result;
  }

  function _convexHull(root, options, all = new Set()) {

    if (root !== undefined && root !== null && all.size < options.sizeLimit && !all.has(root)) {

      all.add(root);

      _recorder_._src_client_reflection_js.iterate(root, options).forEach(ea => {
        _recorder_._src_client_reflection_js._convexHull(ea, options, all);
      });
    }

    return all;
  }

  function convexHull(root, options = {}) {
    return _recorder_._src_client_reflection_js._convexHull(root, Object.assign({
      usePrototype: false,
      sizeLimit: Infinity
    }, options));
  }

  _export("convexHull", convexHull);

  return {
    setters: [],
    execute: function () {
      _recorder_._src_client_reflection_js = _recorder_._src_client_reflection_js || {};
      _recorder_._src_client_reflection_js.convexHull = convexHull;
      _recorder_._src_client_reflection_js._convexHull = _convexHull;
      _recorder_._src_client_reflection_js.iterate = iterate;
      if (self.lively) {
        lively.reflection = { convexHull: _recorder_._src_client_reflection_js.convexHull };
      }
    }
  };
});