Liferay.Loader.define("commerce-dashboard-web$d3-shape@1.3.7/src/order/insideOut", ['module', 'exports', 'require'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    import appearance from "./appearance.js";
    import { sum } from "./ascending.js";

    export default function (series) {
      var n = series.length,
          i,
          j,
          sums = series.map(sum),
          order = appearance(series),
          top = 0,
          bottom = 0,
          tops = [],
          bottoms = [];

      for (i = 0; i < n; ++i) {
        j = order[i];
        if (top < bottom) {
          top += sums[j];
          tops.push(j);
        } else {
          bottom += sums[j];
          bottoms.push(j);
        }
      }

      return bottoms.reverse().concat(tops);
    }
  }
});
//# sourceMappingURL=insideOut.js.map