require.config({
  baseDir: '/js',
  paths: {
      'jquery': 'vendor/jquery',
      'd3': 'vendor/d3.min',
      'es-glue': 'es-glue'
  }
});

require(['jquery', 'es-glue', 'd3'], function ($, ES, d3) {
  'use strict';

  function aggregateTimes(data, aggregate) {
    aggregate = aggregate || {};
    data.facets.default.terms.forEach(function(t) {
      aggregate[t.term] = aggregate[t.term] || {
        week: {
            count: 0,
            time: 0,
            min: Number.MAX_VALUE,
            max: Number.MIN_VALUE,
        },
        month: {
            count: 0,
            time: 0,
            min: Number.MAX_VALUE,
            max: Number.MIN_VALUE,
        },
        year: {
            count: 0,
            time: 0,
            min: Number.MAX_VALUE,
            max: Number.MIN_VALUE,
        },
      };
    });

    var now = 1383264000000;
    var lastmonth = new Date(now);
    lastmonth.setUTCMonth(lastmonth.getUTCMonth() - 1);
    lastmonth = now - lastmonth.getTime();
    var lastyear = new Date(now);
    lastyear.setUTCFullYear(lastyear.getUTCFullYear() - 1);
    lastyear = now - lastyear.getTime();

    data.hits.hits.forEach(function(h) {
      var agg = aggregate['firefox|' + h.fields.component];
      var elapsed = now - h.fields.request_time;
      var time = h.fields.review_time - h.fields.request_time;
      if (!elapsed || !time) {
        return;
      }
      if (elapsed < 604800000) { // 1 week
        agg.week.count = agg.week.count + 1;
        agg.week.time = agg.week.time + time;
        agg.week.min = Math.min(agg.week.min, time);
        agg.week.max = Math.max(agg.week.max, time);
      }
      if (elapsed < lastmonth) { // 1 month
        agg.month.count = agg.month.count + 1;
        agg.month.time = agg.month.time + time;
        agg.month.min = Math.min(agg.month.min, time);
        agg.month.max = Math.max(agg.month.max, time);
      }
      if (elapsed < lastyear) { // 1 year
        agg.year.count = agg.year.count + 1;
        agg.year.time = agg.year.time + time;
        agg.year.min = Math.min(agg.year.min, time);
        agg.year.max = Math.max(agg.year.max, time);
      }
    });

    return aggregate;
  }

  ES.query(function(data, status, xhr) {
    function capitalize(string) {
      return string.charAt(0).toUpperCase() + string.slice(1);
    }
    function formatTime(ms) {
      if (isNaN(ms)) {
        return "N/A";
      }
      if (ms < 1000) {
        return ms + " milliseconds";
      }
      if (ms < 60000) {
        return (ms / 1000).toFixed(1) + " seconds";
      }
      if (ms < 3600000) {
        return (ms / 60000).toFixed(1) + " minutes";
      }
      if (ms < 86400000) {
        return (ms / 3600000).toFixed(1) + " hours";
      }
      return (ms / 86400000).toFixed(1) + " days";
    }
    var aggregate = aggregateTimes(data);
    var row = d3.select("#component-times")
        .selectAll("tr")
        .data(Object.keys(aggregate)
                    .filter(function(k) aggregate[k].year.count))
        .enter()
        .append("tr");
    row.append("td")
        .text(function(d) capitalize(d.split("|")[1]));
    row.append("td")
        .text(function(d) formatTime(aggregate[d].week.time / aggregate[d].week.count));
    row.append("td")
        .text(function(d) formatTime(aggregate[d].month.time / aggregate[d].month.count));
    row.append("td")
        .text(function(d) formatTime(aggregate[d].year.time / aggregate[d].year.count));
    row.append("td")
        .text(function(d) formatTime(aggregate[d].year.min));
    row.append("td")
        .text(function(d) formatTime(aggregate[d].year.max));

    var data1 = [];
    for (var i = 0; i < 14; i += 0.5) {
      data1.push([i, Math.sin(i)]);
    }
    var data2 = [[0, 3], [4, 8], [8, 5], [9, 13]];
    var data3 = [[0, 12], [7, 12], null, [7, 2.5], [12, 2.5]];
    $.plot("#chart", [ data1, data2, data3 ]);
  });
});

@@ -2985,16 +2985,17 @@
 ction(k)
+%7B
  aggrega
@@ -3010,16 +3010,17 @@
 ar.count
+%7D
 ))%0A     
@@ -3100,16 +3100,17 @@
 ction(d)
+%7B
  capital
@@ -3129,16 +3129,17 @@
 %22%7C%22)%5B1%5D)
+%7D
 );%0A    r
@@ -3171,32 +3171,33 @@
 text(function(d)
+%7B
  formatTime(aggr
@@ -3237,24 +3237,25 @@
 .week.count)
+%7D
 );%0A    row.a
@@ -3283,32 +3283,33 @@
 text(function(d)
+%7B
  formatTime(aggr
@@ -3351,24 +3351,25 @@
 month.count)
+%7D
 );%0A    row.a
@@ -3397,32 +3397,33 @@
 text(function(d)
+%7B
  formatTime(aggr
@@ -3467,16 +3467,17 @@
 r.count)
+%7D
 );%0A    r
@@ -3509,32 +3509,33 @@
 text(function(d)
+%7B
  formatTime(aggr
@@ -3552,16 +3552,17 @@
 ear.min)
+%7D
 );%0A    r
@@ -3602,16 +3602,17 @@
 ction(d)
+%7B
  formatT
@@ -3637,16 +3637,17 @@
 ear.max)
+%7D
 );%0A%0A    

Add curly braces