this["ts"] = this["ts"] || {};
this["ts"]["templates"] = this["ts"]["templates"] || {};

this["ts"]["templates"]["edit"] = this["ts"]["templates"]["edit"] || {};

this["ts"]["templates"]["flot"] = this["ts"]["templates"]["flot"] || {};

this["ts"]["templates"]["listing"] = this["ts"]["templates"]["listing"] || {};

this["ts"]["templates"]["models"] = this["ts"]["templates"]["models"] || {};

Handlebars.registerPartial("action-menu-button", this["ts"]["templates"]["action-menu-button"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
    var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression, alias5=container.lambda;

  return "  <li role=\"presentation\"\n    data-ds-action=\""
    + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"name","hash":{},"data":data}) : helper)))
    + "\"\n    data-ds-category=\""
    + alias4(((helper = (helper = helpers.category || (depth0 != null ? depth0.category : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"category","hash":{},"data":data}) : helper)))
    + "\"\n    data-ds-show=\""
    + alias4(alias5(((stack1 = (depth0 != null ? depth0.action : depth0)) != null ? stack1.show : stack1), depth0))
    + "\"\n    data-ds-hide=\""
    + alias4(alias5(((stack1 = (depth0 != null ? depth0.action : depth0)) != null ? stack1.hide : stack1), depth0))
    + "\">\n    <a role=\"menuitem\" href=\"#\"><i class=\""
    + alias4(alias5(((stack1 = (depth0 != null ? depth0.action : depth0)) != null ? stack1.icon : stack1), depth0))
    + "\"></i> "
    + alias4(alias5(((stack1 = (depth0 != null ? depth0.action : depth0)) != null ? stack1.display : stack1), depth0))
    + "</a>\n";
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1;

  return ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.actions : depth0),{"name":"each","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "");
},"useData":true}));

Handlebars.registerPartial("ds-action-menu", this["ts"]["templates"]["ds-action-menu"] = Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=container.escapeExpression;

  return "<div data-ds-hide=\"edit\" class=\"btn-group\" align=\"left\">\n  <button type=\"button\"\n          class=\"btn btn-default btn-xs dropdown-toggle\"\n          data-toggle=\"dropdown\">\n    <span class=\"caret\"></span>\n  </button>\n  <ul class=\"dropdown-menu dropdown-menu-right ds-action-menu\" role=\"menu\">\n    "
    + alias3((helpers.actions || (depth0 && depth0.actions) || alias2).call(alias1,"presentation-transform-actions",{"name":"actions","hash":{},"data":data}))
    + "\n    "
    + alias3((helpers.actions || (depth0 && depth0.actions) || alias2).call(alias1,"presentation-actions",true,{"name":"actions","hash":{},"data":data}))
    + "\n    "
    + alias3((helpers.actions || (depth0 && depth0.actions) || alias2).call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_type : stack1),true,{"name":"actions","hash":{},"data":data}))
    + "\n  </ul>\n</div>\n";
},"useData":true}));

Handlebars.registerPartial("ds-dashboard-listing-action-menu", this["ts"]["templates"]["ds-dashboard-listing-action-menu"] = Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;

  return "<div class=\"btn-group\">\n  <button\n     type=\"button\"\n     class=\"btn btn-default btn-xs dropdown-toggle\"\n     data-toggle=\"dropdown\">\n    <span class=\"caret\"></span>\n  </button>\n  <ul class=\"dropdown-menu dropdown-menu-right ds-dashboard-action-menu\" role=\"menu\" data-ds-href=\""
    + alias4(((helper = (helper = helpers.href || (depth0 != null ? depth0.href : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"href","hash":{},"data":data}) : helper)))
    + "\" data-ds-view-href=\""
    + alias4(((helper = (helper = helpers.view_href || (depth0 != null ? depth0.view_href : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"view_href","hash":{},"data":data}) : helper)))
    + "\">\n\n    "
    + alias4((helpers.actions || (depth0 && depth0.actions) || alias2).call(alias1,"dashboard-list-actions",{"name":"actions","hash":{},"data":data}))
    + "\n  </ul>\n</div>\n";
},"useData":true}));

Handlebars.registerPartial("ds-dashboard-listing-entry", this["ts"]["templates"]["ds-dashboard-listing-entry"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
    var helper;

  return "            <br/>\n            <small>"
    + container.escapeExpression(((helper = (helper = helpers.summary || (depth0 != null ? depth0.summary : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"summary","hash":{},"data":data}) : helper)))
    + "</small>\n";
},"3":function(container,depth0,helpers,partials,data) {
    var stack1;

  return ((stack1 = container.invokePartial(partials["ds-dashboard-tag-with-link"],depth0,{"name":"ds-dashboard-tag-with-link","data":data,"indent":"          ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "");
},"5":function(container,depth0,helpers,partials,data) {
    var helper;

  return "          <a href=\""
    + container.escapeExpression(((helper = (helper = helpers.imported_from || (depth0 != null ? depth0.imported_from : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"imported_from","hash":{},"data":data}) : helper)))
    + "\" target=\"_blank\"><i class=\"fa fa-cloud\"></i></a><br/>\n";
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;

  return "<tr data-ds-href=\""
    + alias4(((helper = (helper = helpers.href || (depth0 != null ? depth0.href : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"href","hash":{},"data":data}) : helper)))
    + "\">\n  <td>\n    <div class=\"row\">\n      <div class=\"col-md-12\">\n\n        <div class=\"pull-left\">\n          <a href=\""
    + alias4(((helper = (helper = helpers.view_href || (depth0 != null ? depth0.view_href : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"view_href","hash":{},"data":data}) : helper)))
    + "\">\n            <span class=\"ds-dashboard-listing-category\">\n              "
    + alias4(((helper = (helper = helpers.category || (depth0 != null ? depth0.category : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"category","hash":{},"data":data}) : helper)))
    + "\n            </span>\n            <span class=\"ds-dashboard-listing-title\">\n              "
    + alias4(((helper = (helper = helpers.title || (depth0 != null ? depth0.title : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"title","hash":{},"data":data}) : helper)))
    + "\n            </span>\n"
    + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.summary : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "          </a><br/>\n          <span class=\"ds-dashboard-listing-last-modified\">\n            Last modified "
    + alias4((helpers.moment || (depth0 && depth0.moment) || alias2).call(alias1,"fromNow",(depth0 != null ? depth0.last_modified_date : depth0),{"name":"moment","hash":{},"data":data}))
    + ".\n          </span>\n        </div>\n\n        <div class=\"pull-right\" style=\"margin-left: 0.5em\">\n"
    + ((stack1 = container.invokePartial(partials["ds-dashboard-listing-action-menu"],depth0,{"name":"ds-dashboard-listing-action-menu","data":data,"indent":"          ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "")
    + "        </div>\n\n        <div data-ds-href=\""
    + alias4(((helper = (helper = helpers.href || (depth0 != null ? depth0.href : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"href","hash":{},"data":data}) : helper)))
    + "\" class=\"pull-right ds-favorite-indicator\" style=\"margin-left: 0.5em\">\n          <i class=\"text-muted fa fa-lg fa-star-o\"></i>\n        </div>\n\n        <div class=\"pull-right\" style=\"text-align:right\">\n"
    + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.tags : depth0),{"name":"each","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "          <br/>\n"
    + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.imported_from : depth0),{"name":"if","hash":{},"fn":container.program(5, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "        </div>\n\n      </div>\n\n    </div> <!-- row -->\n  </td>\n</tr>\n";
},"usePartial":true,"useData":true}));

Handlebars.registerPartial("ds-dashboard-tag-with-link", this["ts"]["templates"]["ds-dashboard-tag-with-link"] = Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, helper;

  return "<a href=\"/dashboards/tagged/"
    + container.escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"name","hash":{},"data":data}) : helper)))
    + "\">"
    + ((stack1 = container.invokePartial(partials["ds-dashboard-tag"],depth0,{"name":"ds-dashboard-tag","data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "")
    + "</a>\n";
},"usePartial":true,"useData":true}));

Handlebars.registerPartial("ds-dashboard-tag", this["ts"]["templates"]["ds-dashboard-tag"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
    var helper;

  return "    background-color: "
    + container.escapeExpression(((helper = (helper = helpers.bgcolor || (depth0 != null ? depth0.bgcolor : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"bgcolor","hash":{},"data":data}) : helper)))
    + ";\n";
},"3":function(container,depth0,helpers,partials,data) {
    var helper;

  return "    color: "
    + container.escapeExpression(((helper = (helper = helpers.fgcolor || (depth0 != null ? depth0.fgcolor : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"fgcolor","hash":{},"data":data}) : helper)))
    + ";\n  ";
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;

  return "<span class=\"badge badge-neutral\" data-ds-tag=\""
    + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"name","hash":{},"data":data}) : helper)))
    + "\"\n  style=\"\n"
    + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.bgcolor : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.fgcolor : depth0),{"name":"if","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + ">\n  \">\n  "
    + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"name","hash":{},"data":data}) : helper)))
    + "\n</span>\n";
},"useData":true}));

Handlebars.registerPartial("ds-edit-bar-cell", this["ts"]["templates"]["ds-edit-bar-cell"] = Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=container.lambda, alias2=container.escapeExpression;

  return "<div class=\"ds-edit-bar ds-edit-bar-cell alert alert-info\" align=\"left\" data-ds-item-id=\""
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\">\n  <span class=\"badge ds-badge-cell\" data-ds-item-id=\""
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\"><i class=\"fa fa-cog\"></i> cell "
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "</span>\n  <div class=\"btn-group btn-group-sm\" data-ds-item-id=\""
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\" style=\"display:none\">\n    "
    + alias2((helpers.actions || (depth0 && depth0.actions) || helpers.helperMissing).call(depth0 != null ? depth0 : {},"edit-bar-cell","button",{"name":"actions","hash":{},"data":data}))
    + "\n  </div>\n</div>\n";
},"useData":true}));

Handlebars.registerPartial("ds-edit-bar-definition", this["ts"]["templates"]["ds-edit-bar-definition"] = Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=container.lambda, alias2=container.escapeExpression;

  return "<div class=\"container\">\n  <div class=\"ds-edit-bar ds-edit-bar-definition alert alert-info\" align=\"left\" data-ds-item-id=\""
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\">\n    <span class=\"badge ds-badge-cell\" data-ds-item-id=\""
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\"><i class=\"fa fa-cog\"></i> definition "
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "</span>\n  </div>\n</div>\n";
},"useData":true}));

Handlebars.registerPartial("ds-edit-bar-item-details", this["ts"]["templates"]["ds-edit-bar-item-details"] = Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1;

  return "<div class=\"row\" id=\""
    + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "-details\">\n  <div class=\"col-md-12\">\n"
    + ((stack1 = container.invokePartial(partials["ds-item-property-sheet"],depth0,{"name":"ds-item-property-sheet","data":data,"indent":"    ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "")
    + "  </div>\n</div>\n";
},"usePartial":true,"useData":true}));

Handlebars.registerPartial("ds-edit-bar-item", this["ts"]["templates"]["ds-edit-bar-item"] = Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=container.lambda, alias2=container.escapeExpression;

  return "<div class=\"row\" data-ds-show=\"edit\" style=\"display:none\">\n  <div class=\"col-md-12\">\n    <div class=\"ds-edit-bar ds-edit-bar-item\" align=\"left\" data-ds-item-id=\""
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\">\n      <span class=\"badge ds-badge-item\" data-ds-item-id=\""
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\"><i class=\"fa fa-cog\"></i> "
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_type : stack1), depth0))
    + " "
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "</span>\n      <div class=\"btn-group btn-group-sm\" data-ds-item-id=\""
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\" style=\"display:none\">\n        "
    + alias2((helpers.actions || (depth0 && depth0.actions) || helpers.helperMissing).call(depth0 != null ? depth0 : {},"edit-bar-item","button",{"name":"actions","hash":{},"data":data}))
    + "\n      </div>\n    </div>\n  </div>\n</div>\n";
},"useData":true}));

Handlebars.registerPartial("ds-edit-bar-row", this["ts"]["templates"]["ds-edit-bar-row"] = Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=container.lambda, alias2=container.escapeExpression;

  return "    <div class=\"ds-edit-bar ds-edit-bar-row\" data-ds-item-id=\""
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\">\n      <span class=\"badge ds-badge-row\" data-ds-item-id=\""
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\"><i class=\"fa fa-cog\"></i> row "
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "</span>\n      <div class=\"btn-group btn-group-sm\" data-ds-item-id=\""
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\" style=\"display:none\">\n        "
    + alias2((helpers.actions || (depth0 && depth0.actions) || helpers.helperMissing).call(depth0 != null ? depth0 : {},"edit-bar-row","button",{"name":"actions","hash":{},"data":data}))
    + "\n      </div>\n    </div>\n";
},"useData":true}));

Handlebars.registerPartial("ds-edit-bar-section", this["ts"]["templates"]["ds-edit-bar-section"] = Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=container.lambda, alias2=container.escapeExpression;

  return "    <div class=\"ds-edit-bar ds-edit-bar-section\" align=\"left\" data-ds-item-id=\""
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\">\n      <span class=\"badge ds-badge-section\" data-ds-item-id=\""
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\"><i class=\"fa fa-cog\"></i> section "
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "</span>\n      <div class=\"btn-group btn-group-sm\" data-ds-item-id=\""
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\" style=\"display:none\">\n        "
    + alias2((helpers.actions || (depth0 && depth0.actions) || helpers.helperMissing).call(depth0 != null ? depth0 : {},"edit-bar-section","button",{"name":"actions","hash":{},"data":data}))
    + "\n      </div>\n    </div>\n";
},"useData":true}));

Handlebars.registerPartial("ds-edit-bar", this["ts"]["templates"]["ds-edit-bar"] = Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=container.escapeExpression;

  return "<div class=\"row\" data-ds-show=\"edit\" style=\"display:none\">\n  <div class=\"col-md-12\">\n    <i title=\"Drag to reposition\" class=\"fa fa-align-justify pull-right ds-drag-handle\" data-ds-item-id=\""
    + alias1(container.lambda(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\"></i>\n    "
    + alias1((helpers["ds-edit-bar"] || (depth0 && depth0["ds-edit-bar"]) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.item : depth0),{"name":"ds-edit-bar","hash":{},"data":data}))
    + "\n  </div>\n</div>\n";
},"useData":true}));

Handlebars.registerPartial("ds-edit-menu", this["ts"]["templates"]["ds-edit-menu"] = Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    return "<div data-ds-show=\"edit\" class=\"btn-group\" align=\"left\" style=\"display:none\">\n  <button type=\"button\"\n          class=\"btn btn-default btn-xs dropdown-toggle\"\n          data-toggle=\"dropdown\">\n          <i class=\"fa fa-cog\"></i> <span class=\"caret\"></span>\n  </button>\n  <ul class=\"dropdown-menu dropdown-menu-right ds-edit-menu\" role=\"menu\">\n    "
    + container.escapeExpression((helpers.actions || (depth0 && depth0.actions) || helpers.helperMissing).call(depth0 != null ? depth0 : {},"presentation-edit",{"name":"actions","hash":{},"data":data}))
    + "\n  </ul>\n</div>\n";
},"useData":true}));

Handlebars.registerPartial("ds-preferences-renderer-entry", this["ts"]["templates"]["ds-preferences-renderer-entry"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
    return "checked=\"checked\"";
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=container.lambda, alias2=container.escapeExpression;

  return "<div class=\"radio\">\n  <label for=\"chartRenderRadios-"
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.renderer : depth0)) != null ? stack1.name : stack1), depth0))
    + "\">\n    <input type=\"radio\"\n           name=\"chartRenderRadios\"\n           id=\"chartRenderRadios-"
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.renderer : depth0)) != null ? stack1.name : stack1), depth0))
    + "\"\n           value=\""
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.renderer : depth0)) != null ? stack1.name : stack1), depth0))
    + "\"\n           "
    + ((stack1 = helpers["if"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.checked : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\n           onclick=\"dsSetPref('renderer', '"
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.renderer : depth0)) != null ? stack1.name : stack1), depth0))
    + "')\">\n    "
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.renderer : depth0)) != null ? stack1.name : stack1), depth0))
    + "\n  </label>\n  <p><small>"
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.renderer : depth0)) != null ? stack1.description : stack1), depth0))
    + "</small></p>\n</div>\n";
},"useData":true}));

Handlebars.registerPartial("ds-row-edit-bar", this["ts"]["templates"]["ds-row-edit-bar"] = Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    return "<div class=\"row\" data-ds-show=\"edit\">\n  <div class=\"col-md-12\">\n    <div class=\"ds-edit-bar ds-row-edit-bar bs-callout bs-callout-info\">\n\n\n\n\n      row <i class=\"fa fa-trash-o pull-right\"></i>\n\n\n\n    </div>\n  </div>\n</div>\n";
},"useData":true}));

Handlebars.registerPartial("ds-title-bar", this["ts"]["templates"]["ds-title-bar"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
    var stack1;

  return "<h3>"
    + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.title : stack1), depth0))
    + "</h3>";
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=depth0 != null ? depth0 : {};

  return container.escapeExpression((helpers["ds-edit-bar"] || (depth0 && depth0["ds-edit-bar"]) || helpers.helperMissing).call(alias1,(depth0 != null ? depth0.item : depth0),{"name":"ds-edit-bar","hash":{},"data":data}))
    + "\n<div class=\"row ds-title-bar\">\n  <div class=\"col-md-10\">\n    "
    + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.title : stack1),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\n  </div>\n  <div class=\"col-md-2\" align=\"right\">\n"
    + ((stack1 = container.invokePartial(partials["ds-action-menu"],depth0,{"name":"ds-action-menu","data":data,"indent":"    ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "")
    + "  </div>\n</div>\n";
},"usePartial":true,"useData":true}));

Handlebars.registerPartial("dashboard-metadata-panel", this["ts"]["templates"]["edit"]["dashboard-metadata-panel"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
    var stack1;

  return ((stack1 = container.invokePartial(partials["ds-dashboard-tag"],depth0,{"name":"ds-dashboard-tag","data":data,"indent":"            ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "");
},"3":function(container,depth0,helpers,partials,data) {
    var helper;

  return "          <tr>\n            <th>Imported From</th><td class=\"ds-editable\" id=ds-info-panel-edit-imported-from\" data-type=\"text\"><a href=\""
    + container.escapeExpression(((helper = (helper = helpers.imported_from || (depth0 != null ? depth0.imported_from : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"imported_from","hash":{},"data":data}) : helper)))
    + "\" target=\"_blank\">Link</a></td>\n          </tr>\n";
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;

  return "<div class=\"row ds-info-edit-panel\">\n  <!-- Column 1 -->\n  <div class=\"col-md-5\">\n    <h4>Properties</h4>\n\n    <table class=\"table-condensed\">\n      <tbody>\n        <tr>\n          <th>Title</th><td class=\"ds-editable\" id=\"ds-info-panel-edit-title\" data-type=\"text\">"
    + alias4(((helper = (helper = helpers.title || (depth0 != null ? depth0.title : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"title","hash":{},"data":data}) : helper)))
    + "</td>\n        </tr>\n\n        <tr>\n          <th>Category</th><td class=\"ds-editable\" id=\"ds-info-panel-edit-category\" data-type=\"text\">"
    + alias4(((helper = (helper = helpers.category || (depth0 != null ? depth0.category : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"category","hash":{},"data":data}) : helper)))
    + "</td>\n        </tr>\n\n        <tr>\n          <th>Summary</th><td class=\"ds-editable\" id=\"ds-info-panel-edit-summary\" data-type=\"text\">"
    + alias4(((helper = (helper = helpers.summary || (depth0 != null ? depth0.summary : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"summary","hash":{},"data":data}) : helper)))
    + "</td>\n        </tr>\n\n        <tr>\n          <th>Tags</th>\n          <td>\n            <!--\n"
    + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.tags : depth0),{"name":"each","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "            -->\n\n            <input id=\"ds-info-panel-edit-tags\" class=\"form-control tm-input tm-input-success tm-input-info\"/>\n\n          </td>\n        </tr>\n\n        <tr>\n          <th>Created</th><td>"
    + alias4((helpers.moment || (depth0 && depth0.moment) || alias2).call(alias1,"MMMM Do YYYY, h:mm:ss a",(depth0 != null ? depth0.creation_date : depth0),{"name":"moment","hash":{},"data":data}))
    + "</td>\n        </tr>\n        <tr>\n          <th>Last Modified</th><td>"
    + alias4((helpers.moment || (depth0 && depth0.moment) || alias2).call(alias1,"MMMM Do YYYY, h:mm:ss a",(depth0 != null ? depth0.last_modified_date : depth0),{"name":"moment","hash":{},"data":data}))
    + "</td>\n        </tr>\n\n"
    + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.imported_from : depth0),{"name":"if","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\n      </tbody>\n    </table>\n  </div> <!-- column -->\n\n  <!-- Column 2 -->\n  <div class=\"col-md-7\">\n    <h4>Description</h4>\n    <div class=\"ds-editable\"\n         id=\"ds-info-panel-edit-description\"\n         data-type=\"textarea\"\n         data-rows=\"9\"\n         data-showbuttons=\"bottom\"\n         data-inputclass=\"ds-dashboard-description\"\n         style=\"text-align:top;\">\n      "
    + alias4((helpers.markdown || (depth0 && depth0.markdown) || alias2).call(alias1,(depth0 != null ? depth0.description : depth0),{"name":"markdown","hash":{},"data":data}))
    + "\n    </div>\n  </div>\n\n</div>\n";
},"usePartial":true,"useData":true}));

Handlebars.registerPartial("dashboard-query-panel", this["ts"]["templates"]["edit"]["dashboard-query-panel"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
    var stack1;

  return ((stack1 = container.invokePartial(partials["dashboard-query-row"],depth0,{"name":"dashboard-query-row","data":data,"indent":"          ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "");
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=depth0 != null ? depth0 : {};

  return "<div class=\"ds-query-edit-panel\" id=\"ds-query-panel\">\n\n  <div class=\"row\">\n    <div class=\"col-md-12\">\n      <div class=\"btn-group btn-group-sm\">\n        "
    + container.escapeExpression((helpers.actions || (depth0 && depth0.actions) || helpers.helperMissing).call(alias1,"dashboard-queries","button",{"name":"actions","hash":{},"data":data}))
    + "\n      </div>\n      <br/>\n    </div>\n  </div>\n\n  <div class=\"row\">\n    <div class=\"col-md-12\">\n      <table class=\"table table-striped\">\n"
    + ((stack1 = helpers.each.call(alias1,((stack1 = (depth0 != null ? depth0.definition : depth0)) != null ? stack1.queries : stack1),{"name":"each","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "      </table>\n    </div>\n  </div>\n\n</div>\n";
},"usePartial":true,"useData":true}));

Handlebars.registerPartial("dashboard-query-row", this["ts"]["templates"]["edit"]["dashboard-query-row"] = Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;

  return "<tr data-ds-query-name=\""
    + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"name","hash":{},"data":data}) : helper)))
    + "\">\n  <th data-ds-query-name=\""
    + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"name","hash":{},"data":data}) : helper)))
    + "\" class=\"ds-query-name\">"
    + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"name","hash":{},"data":data}) : helper)))
    + "</th>\n  <td data-ds-query-name=\""
    + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"name","hash":{},"data":data}) : helper)))
    + "\" class=\"ds-query-target\">"
    + alias4(((helper = (helper = helpers.targets || (depth0 != null ? depth0.targets : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"targets","hash":{},"data":data}) : helper)))
    + "</td>\n  <td>\n      <button class=\"btn btn-default btn-small ds-duplicate-query-button\"\n              data-toggle=\"tooltip\"\n              title=\"Duplicate this query\"\n              data-ds-query-name=\""
    + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"name","hash":{},"data":data}) : helper)))
    + "\">\n        <i class=\"fa fa-copy fa-fw\"></i>\n      </button>\n      <button class=\"btn btn-default btn-small ds-delete-query-button\"\n              data-toggle=\"tooltip\"\n              title=\"Delete this query\"\n              data-ds-query-name=\""
    + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"name","hash":{},"data":data}) : helper)))
    + "\">\n        <i class=\"fa fa-trash-o fa-fw\"></i>\n      </button>\n  </td>\n</tr>\n";
},"useData":true}));

Handlebars.registerPartial("ds-item-property-sheet", this["ts"]["templates"]["edit"]["ds-item-property-sheet"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data,blockParams,depths) {
    var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;

  return "      <tr>\n        <td><span class=\"ds-property-category\">"
    + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.category : depth0),{"name":"if","hash":{},"fn":container.program(2, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "<span class=\"ds-property-name\">"
    + alias4(((helper = (helper = helpers.property_name || (depth0 != null ? depth0.property_name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"property_name","hash":{},"data":data}) : helper)))
    + "</span></td>\n        <td data-ds-property-name=\""
    + alias4(((helper = (helper = helpers.property_name || (depth0 != null ? depth0.property_name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"property_name","hash":{},"data":data}) : helper)))
    + "\">"
    + alias4((helpers.interactive_property || (depth0 && depth0.interactive_property) || alias2).call(alias1,depth0,(depths[1] != null ? depths[1].item : depths[1]),{"name":"interactive_property","hash":{},"data":data}))
    + "</td>\n      </tr>\n";
},"2":function(container,depth0,helpers,partials,data) {
    var helper;

  return container.escapeExpression(((helper = (helper = helpers.category || (depth0 != null ? depth0.category : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"category","hash":{},"data":data}) : helper)))
    + "</span> / ";
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data,blockParams,depths) {
    var stack1;

  return "<table class=\"ds-property-sheet\">\n  <tbody>\n    <tr><th>Property</th><th>Value</th></tr>\n"
    + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},((stack1 = ((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.meta : stack1)) != null ? stack1.interactive_properties : stack1),{"name":"each","hash":{},"fn":container.program(1, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "  </tbody>\n</table>\n";
},"useData":true,"useDepths":true}));

this["ts"]["templates"]["action_button"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
    return "";
},"3":function(container,depth0,helpers,partials,data) {
    var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=container.lambda, alias3=container.escapeExpression;

  return "  <button class=\"btn "
    + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.action : depth0)) != null ? stack1["class"] : stack1),{"name":"if","hash":{},"fn":container.program(4, data, 0),"inverse":container.program(6, data, 0),"data":data})) != null ? stack1 : "")
    + "\"\n    data-ds-action=\""
    + alias3(alias2(((stack1 = (depth0 != null ? depth0.action : depth0)) != null ? stack1.name : stack1), depth0))
    + "\"\n    data-ds-category=\""
    + alias3(((helper = (helper = helpers.category || (depth0 != null ? depth0.category : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(alias1,{"name":"category","hash":{},"data":data}) : helper)))
    + "\"\n    data-ds-show=\""
    + alias3(alias2(((stack1 = (depth0 != null ? depth0.action : depth0)) != null ? stack1.show : stack1), depth0))
    + "\"\n    data-ds-hide=\""
    + alias3(alias2(((stack1 = (depth0 != null ? depth0.action : depth0)) != null ? stack1.hide : stack1), depth0))
    + "\"\n    data-toggle=\"tooltip\"\n    title=\""
    + alias3(alias2(((stack1 = (depth0 != null ? depth0.action : depth0)) != null ? stack1.display : stack1), depth0))
    + "\">\n    <i class=\""
    + alias3(alias2(((stack1 = (depth0 != null ? depth0.action : depth0)) != null ? stack1.icon : stack1), depth0))
    + "\"></i>\n  </button>\n";
},"4":function(container,depth0,helpers,partials,data) {
    var stack1;

  return container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.action : depth0)) != null ? stack1.css : stack1), depth0));
},"6":function(container,depth0,helpers,partials,data) {
    return "btn-default";
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1;

  return ((stack1 = helpers["if"].call(depth0 != null ? depth0 : {},((stack1 = (depth0 != null ? depth0.action : depth0)) != null ? stack1.divider : stack1),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.program(3, data, 0),"data":data})) != null ? stack1 : "");
},"useData":true});

this["ts"]["templates"]["action-menu-button"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
    var stack1;

  return ((stack1 = helpers["if"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.divider : depth0),{"name":"if","hash":{},"fn":container.program(2, data, 0),"inverse":container.program(4, data, 0),"data":data})) != null ? stack1 : "");
},"2":function(container,depth0,helpers,partials,data) {
    var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;

  return "        <li class=\"divider\" data-ds-show=\""
    + alias4(((helper = (helper = helpers.show || (depth0 != null ? depth0.show : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"show","hash":{},"data":data}) : helper)))
    + "\" data-ds-hide=\""
    + alias4(((helper = (helper = helpers.hide || (depth0 != null ? depth0.hide : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"hide","hash":{},"data":data}) : helper)))
    + "\"/>\n";
},"4":function(container,depth0,helpers,partials,data) {
    var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;

  return "        <li class=\""
    + alias4(((helper = (helper = helpers.css || (depth0 != null ? depth0.css : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"css","hash":{},"data":data}) : helper)))
    + "\"\n          role=\"presentation\"\n          data-ds-action=\""
    + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"name","hash":{},"data":data}) : helper)))
    + "\"\n          data-ds-category=\""
    + alias4(((helper = (helper = helpers.category || (depth0 != null ? depth0.category : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"category","hash":{},"data":data}) : helper)))
    + "\"\n          data-ds-show=\""
    + alias4(((helper = (helper = helpers.show || (depth0 != null ? depth0.show : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"show","hash":{},"data":data}) : helper)))
    + "\"\n          data-ds-hide=\""
    + alias4(((helper = (helper = helpers.hide || (depth0 != null ? depth0.hide : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"hide","hash":{},"data":data}) : helper)))
    + "\">\n          <a role=\"menuitem\" href=\"#\"><i class=\"fa-fw "
    + alias4(((helper = (helper = helpers.icon || (depth0 != null ? depth0.icon : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"icon","hash":{},"data":data}) : helper)))
    + "\"></i> "
    + alias4(((helper = (helper = helpers.display || (depth0 != null ? depth0.display : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"display","hash":{},"data":data}) : helper)))
    + "</a>\n        </li>\n";
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=container.lambda, alias2=container.escapeExpression;

  return "<div class=\"btn-group btn-group-sm\" align=\"left\">\n  <button type=\"button\"\n    class=\"btn btn-default dropdown-toggle "
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.action : depth0)) != null ? stack1.css : stack1), depth0))
    + "\"\n    data-toggle=\"dropdown\"\n    title=\""
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.action : depth0)) != null ? stack1.display : stack1), depth0))
    + "\">\n    <i class=\""
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.action : depth0)) != null ? stack1.icon : stack1), depth0))
    + "\"></i> <span class=\"caret\"></span>\n  </button>\n  <ul class=\"dropdown-menu dropdown-menu-left ds-edit-menu\" role=\"menu\">\n"
    + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},((stack1 = (depth0 != null ? depth0.action : depth0)) != null ? stack1.actions : stack1),{"name":"each","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "  </ul>\n</div>\n";
},"useData":true});

this["ts"]["templates"]["action"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=container.lambda, alias2=container.escapeExpression;

  return "  <li class=\"divider\" data-ds-show=\""
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.action : depth0)) != null ? stack1.show : stack1), depth0))
    + "\" data-ds-hide=\""
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.action : depth0)) != null ? stack1.hide : stack1), depth0))
    + "\"/>\n";
},"3":function(container,depth0,helpers,partials,data) {
    var stack1, helper, alias1=container.lambda, alias2=container.escapeExpression;

  return "  <li role=\"presentation\"\n    class=\""
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.action : depth0)) != null ? stack1.css : stack1), depth0))
    + "\"\n    data-ds-action=\""
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.action : depth0)) != null ? stack1.name : stack1), depth0))
    + "\"\n    data-ds-category=\""
    + alias2(((helper = (helper = helpers.category || (depth0 != null ? depth0.category : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"category","hash":{},"data":data}) : helper)))
    + "\"\n    data-ds-show=\""
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.action : depth0)) != null ? stack1.show : stack1), depth0))
    + "\"\n    data-ds-hide=\""
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.action : depth0)) != null ? stack1.hide : stack1), depth0))
    + "\">\n    <a role=\"menuitem\" href=\"#\"><i class=\"fa fa-fw "
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.action : depth0)) != null ? stack1.icon : stack1), depth0))
    + "\"></i> "
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.action : depth0)) != null ? stack1.display : stack1), depth0))
    + "</a>\n  </li>\n";
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1;

  return ((stack1 = helpers["if"].call(depth0 != null ? depth0 : {},((stack1 = (depth0 != null ? depth0.action : depth0)) != null ? stack1.divider : stack1),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.program(3, data, 0),"data":data})) != null ? stack1 : "");
},"useData":true});

this["ts"]["templates"]["edit"]["dashboard_panel"] = Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1;

  return "<ul class=\"nav nav-pills\">\n  <li class=\"active\"><a href=\"#metadata\" data-toggle=\"tab\">Metadata</a></li>\n  <li><a href=\"#queries\" data-toggle=\"tab\" id=\"ds-edit-tab-queries\">Queries</a></li>\n</ul>\n\n<div class=\"tab-content\">\n  <div class=\"tab-pane active\" id=\"metadata\">\n"
    + ((stack1 = container.invokePartial(partials["dashboard-metadata-panel"],depth0,{"name":"dashboard-metadata-panel","data":data,"indent":"    ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "")
    + "  </div>\n  <div class=\"tab-pane\" id=\"queries\">\n"
    + ((stack1 = container.invokePartial(partials["dashboard-query-panel"],depth0,{"name":"dashboard-query-panel","data":data,"indent":"    ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "")
    + "  </div>\n\n</div>\n";
},"usePartial":true,"useData":true});

this["ts"]["templates"]["edit"]["item_source"] = Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    return "<div class=\"ds-item-source\">\n  <pre>"
    + container.escapeExpression((helpers.json || (depth0 && depth0.json) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.item : depth0),{"name":"json","hash":{},"data":data}))
    + "</pre>\n</div>\n";
},"useData":true});

this["ts"]["templates"]["edit"]["view_query"] = Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    return "<div class=\"ds-query-source\">\n  "
    + container.escapeExpression((helpers.markdown || (depth0 && depth0.markdown) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.source : depth0),{"name":"markdown","hash":{},"data":data}))
    + "\n</div>\n";
},"useData":true});

this["ts"]["templates"]["flot"]["discrete_bar_tooltip"] = Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, helper, alias1=container.lambda, alias2=container.escapeExpression;

  return "<table class=\"table-condensed\">\n  <tbody>\n    <tr>\n      <td class=\"ds-tooltip-label\">\n        <span class=\"badge\" style=\"background-color: "
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.series : depth0)) != null ? stack1.color : stack1), depth0))
    + "\"><i></i></span>\n        "
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.series : depth0)) != null ? stack1.label : stack1), depth0))
    + "\n      </td>\n      <td class=\"ds-tooltip-value\">\n        "
    + alias2(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"value","hash":{},"data":data}) : helper)))
    + "\n      </td>\n    </tr>\n  </tbody>\n</table>\n";
},"useData":true});

this["ts"]["templates"]["flot"]["donut_tooltip"] = Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, helper, alias1=container.lambda, alias2=container.escapeExpression, alias3=depth0 != null ? depth0 : {}, alias4=helpers.helperMissing, alias5="function";

  return "<table class=\"table-condensed\">\n  <tbody>\n    <tr>\n      <td class=\"ds-tooltip-label\">\n        <span class=\"badge\" style=\"background-color: "
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.series : depth0)) != null ? stack1.color : stack1), depth0))
    + "\"><i></i></span>\n        "
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.series : depth0)) != null ? stack1.label : stack1), depth0))
    + "\n      </td>\n      <td class=\"ds-tooltip-value\">\n        "
    + alias2(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : alias4),(typeof helper === alias5 ? helper.call(alias3,{"name":"value","hash":{},"data":data}) : helper)))
    + " / "
    + alias2(((helper = (helper = helpers.percent || (depth0 != null ? depth0.percent : depth0)) != null ? helper : alias4),(typeof helper === alias5 ? helper.call(alias3,{"name":"percent","hash":{},"data":data}) : helper)))
    + "\n      </td>\n    </tr>\n  </tbody>\n</table>\n";
},"useData":true});

this["ts"]["templates"]["flot"]["table_legend"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
    var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;

  return "      <tr data-series-index=\""
    + alias4(((helper = (helper = helpers.index || (data && data.index)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"index","hash":{},"data":data}) : helper)))
    + "\">\n        <td>\n          <span class=\"ds-summation-color-cell\" style=\"background:"
    + alias4(((helper = (helper = helpers.color || (depth0 != null ? depth0.color : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"color","hash":{},"data":data}) : helper)))
    + "\"></span> "
    + alias4(((helper = (helper = helpers.target || (depth0 != null ? depth0.target : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"target","hash":{},"data":data}) : helper)))
    + "\n        </td>\n        <td>"
    + alias4((helpers.format || (depth0 && depth0.format) || alias2).call(alias1,",.3s",((stack1 = (depth0 != null ? depth0.summation : depth0)) != null ? stack1.last : stack1),{"name":"format","hash":{},"data":data}))
    + "</td>\n        <td>"
    + alias4((helpers.format || (depth0 && depth0.format) || alias2).call(alias1,",.3s",((stack1 = (depth0 != null ? depth0.summation : depth0)) != null ? stack1.min : stack1),{"name":"format","hash":{},"data":data}))
    + "</td>\n        <td>"
    + alias4((helpers.format || (depth0 && depth0.format) || alias2).call(alias1,",.3s",((stack1 = (depth0 != null ? depth0.summation : depth0)) != null ? stack1.max : stack1),{"name":"format","hash":{},"data":data}))
    + "</td>\n        <td>"
    + alias4((helpers.format || (depth0 && depth0.format) || alias2).call(alias1,",.3s",((stack1 = (depth0 != null ? depth0.summation : depth0)) != null ? stack1.mean : stack1),{"name":"format","hash":{},"data":data}))
    + "</td>\n        <td>"
    + alias4((helpers.format || (depth0 && depth0.format) || alias2).call(alias1,",.3s",((stack1 = (depth0 != null ? depth0.summation : depth0)) != null ? stack1.median : stack1),{"name":"format","hash":{},"data":data}))
    + "</td>\n        <td>"
    + alias4((helpers.format || (depth0 && depth0.format) || alias2).call(alias1,",.3s",((stack1 = (depth0 != null ? depth0.summation : depth0)) != null ? stack1.sum : stack1),{"name":"format","hash":{},"data":data}))
    + "</td>\n      </tr>\n";
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1;

  return "<table class=\"table table-condensed table-hover\">\n  <thead>\n    <tr>\n      <th>&nbsp;</th>\n      <th>current</th>\n      <th>min</th>\n      <th>max</th>\n      <th>mean</th>\n      <th>median</th>\n      <th>sum</th>\n    </tr>\n  </thead>\n  <tbody>\n"
    + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.data : depth0),{"name":"each","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "  </tbody>\n</table>\n";
},"useData":true});

this["ts"]["templates"]["flot"]["tooltip"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
    var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=container.lambda, alias3=container.escapeExpression;

  return "      <tr "
    + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.series : depth0)) != null ? stack1.highlighted : stack1),{"name":"if","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + ">\n        <td class=\"ds-tooltip-label\">\n          <span class=\"badge\" style=\"background-color: "
    + alias3(alias2(((stack1 = (depth0 != null ? depth0.series : depth0)) != null ? stack1.color : stack1), depth0))
    + "\"><i></i></span>\n          "
    + alias3(alias2(((stack1 = (depth0 != null ? depth0.series : depth0)) != null ? stack1.label : stack1), depth0))
    + "\n        </td>\n        <td class=\"ds-tooltip-value\">\n          "
    + alias3(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(alias1,{"name":"value","hash":{},"data":data}) : helper)))
    + "\n        </td>\n      </tr>\n";
},"2":function(container,depth0,helpers,partials,data) {
    return "class=\"ds-tooltip-highlight\"";
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=depth0 != null ? depth0 : {};

  return "<table class=\"table-condensed\">\n  <tbody>\n    <tr>\n      <td>\n        <span class=\"ds-tooltip-time\">"
    + container.escapeExpression((helpers.moment || (depth0 && depth0.moment) || helpers.helperMissing).call(alias1,"dd, M-D-YYYY, h:mm A",(depth0 != null ? depth0.time : depth0),{"name":"moment","hash":{},"data":data}))
    + "</span>\n      </td>\n    </tr>\n"
    + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.items : depth0),{"name":"each","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "  </tbody>\n</table>\n";
},"useData":true});

this["ts"]["templates"]["listing"]["dashboard_list"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
    var stack1;

  return ((stack1 = container.invokePartial(partials["ds-dashboard-listing-entry"],depth0,{"name":"ds-dashboard-listing-entry","data":data,"indent":"      ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "");
},"3":function(container,depth0,helpers,partials,data) {
    return "      <tr><td><h3>No dashboards defined</h3></td></tr>\n";
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1;

  return "<table class=\"table table-hover table-condensed\">\n  <tbody>\n"
    + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.dashboards : depth0),{"name":"each","hash":{},"fn":container.program(1, data, 0),"inverse":container.program(3, data, 0),"data":data})) != null ? stack1 : "")
    + "  </tbody>\n</table>\n";
},"usePartial":true,"useData":true});

this["ts"]["templates"]["listing"]["dashboard_tag_list"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
    return "active";
},"3":function(container,depth0,helpers,partials,data) {
    var stack1;

  return ((stack1 = helpers["if"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.count : depth0),{"name":"if","hash":{},"fn":container.program(4, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "");
},"4":function(container,depth0,helpers,partials,data) {
    var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;

  return "      <li data-ds-tag=\""
    + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"name","hash":{},"data":data}) : helper)))
    + "\">\n        <a href=\"/dashboards/tagged/"
    + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"name","hash":{},"data":data}) : helper)))
    + "\">\n        "
    + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"name","hash":{},"data":data}) : helper)))
    + "\n        <span class=\"badge badge-primary pull-right\">"
    + alias4(((helper = (helper = helpers.count || (depth0 != null ? depth0.count : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"count","hash":{},"data":data}) : helper)))
    + "</span>\n        </a>\n      </li>\n";
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=depth0 != null ? depth0 : {};

  return "<ul class=\"nav nav-pills nav-stacked\">\n  <li class=\""
    + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.tag : depth0),{"name":"unless","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\">\n    <a href=\"/dashboards\">\n      All <span class=\"badge badge-primary pull-right\"></span>\n    </a>\n  </li>\n\n"
    + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.tags : depth0),{"name":"each","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "</ul>\n";
},"useData":true});

this["ts"]["templates"]["models"]["bar_chart"] = Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=container.escapeExpression, alias4=container.lambda;

  return "<div class=\"ds-item ds-graph ds-bar-chart "
    + alias3((helpers.css_class || (depth0 && depth0.css_class) || alias2).call(alias1,(depth0 != null ? depth0.item : depth0),{"name":"css_class","hash":{},"data":data}))
    + "\"\n  id=\""
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\">\n"
    + ((stack1 = container.invokePartial(partials["ds-title-bar"],depth0,{"name":"ds-title-bar","data":data,"indent":"  ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "")
    + "  <div class=\"ds-graph-holder "
    + alias3((helpers.height || (depth0 && depth0.height) || alias2).call(alias1,(depth0 != null ? depth0.item : depth0),{"name":"height","hash":{},"data":data}))
    + "\">\n    <svg class=\""
    + alias3((helpers.height || (depth0 && depth0.height) || alias2).call(alias1,(depth0 != null ? depth0.item : depth0),{"name":"height","hash":{},"data":data}))
    + "\"></svg>\n  </div>\n  <div class=\"ds-legend-holder\" id=\"ds-legend-"
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\">\n  </div>\n</div>\n";
},"usePartial":true,"useData":true});

this["ts"]["templates"]["models"]["cell"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
    var stack1;

  return " align=\""
    + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.align : stack1), depth0))
    + "\" ";
},"3":function(container,depth0,helpers,partials,data) {
    return "<div class=\""
    + container.escapeExpression((helpers.style_class || (depth0 && depth0.style_class) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.item : depth0),{"name":"style_class","hash":{},"data":data}))
    + "\">";
},"5":function(container,depth0,helpers,partials,data) {
    return "    "
    + container.escapeExpression((helpers.item || (depth0 && depth0.item) || helpers.helperMissing).call(depth0 != null ? depth0 : {},depth0,{"name":"item","hash":{},"data":data}))
    + "\n";
},"7":function(container,depth0,helpers,partials,data) {
    return "</div>";
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=container.escapeExpression, alias4=container.lambda;

  return "<div class=\"ds-cell "
    + alias3((helpers.span || (depth0 && depth0.span) || alias2).call(alias1,(depth0 != null ? depth0.item : depth0),{"name":"span","hash":{},"data":data}))
    + " "
    + alias3((helpers.offset || (depth0 && depth0.offset) || alias2).call(alias1,(depth0 != null ? depth0.item : depth0),{"name":"offset","hash":{},"data":data}))
    + " "
    + alias3((helpers.css_class || (depth0 && depth0.css_class) || alias2).call(alias1,(depth0 != null ? depth0.item : depth0),{"name":"css_class","hash":{},"data":data}))
    + " "
    + alias3((helpers.height || (depth0 && depth0.height) || alias2).call(alias1,(depth0 != null ? depth0.item : depth0),{"name":"height","hash":{},"data":data}))
    + "\"\n     "
    + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.align : stack1),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + " id=\""
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\"\n       >\n"
    + ((stack1 = container.invokePartial(partials["ds-edit-bar"],depth0,{"name":"ds-edit-bar","data":data,"indent":"       ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "")
    + "  "
    + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.style : stack1),{"name":"if","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\n\n"
    + ((stack1 = helpers.each.call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.items : stack1),{"name":"each","hash":{},"fn":container.program(5, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\n    "
    + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.style : stack1),{"name":"if","hash":{},"fn":container.program(7, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\n      <i data-ds-show=\"\"\n        style=\"display:none\"\n        title=\"Drag to resize\"\n        class=\"fa fa-arrows-alt pull-right ds-resize-handle\"\n        data-ds-item-id=\""
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\"></i>\n</div>\n";
},"usePartial":true,"useData":true});

this["ts"]["templates"]["models"]["comparison_summation_table_body"] = Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=container.escapeExpression, alias4=container.lambda;

  return "<!-- TODO: configure which rows to include. Sum doesnt make sense for rates -->\n<tr>\n  <th>Average</th>\n    <td>"
    + alias3((helpers.format || (depth0 && depth0.format) || alias2).call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.format : stack1),((stack1 = (depth0 != null ? depth0.then : depth0)) != null ? stack1.mean : stack1),{"name":"format","hash":{},"data":data}))
    + "</td>\n  <td>"
    + alias3((helpers.format || (depth0 && depth0.format) || alias2).call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.format : stack1),((stack1 = (depth0 != null ? depth0.now : depth0)) != null ? stack1.mean : stack1),{"name":"format","hash":{},"data":data}))
    + "</td>\n  <td class=\""
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.diff : depth0)) != null ? stack1.mean_class : stack1), depth0))
    + "\">\n    "
    + alias3((helpers.format || (depth0 && depth0.format) || alias2).call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.format : stack1),((stack1 = (depth0 != null ? depth0.diff : depth0)) != null ? stack1.mean : stack1),{"name":"format","hash":{},"data":data}))
    + "\n  </td>\n  <td class=\""
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.diff : depth0)) != null ? stack1.mean_class : stack1), depth0))
    + "\">\n    "
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.diff : depth0)) != null ? stack1.mean_pct : stack1), depth0))
    + "\n  </td>\n</tr>\n<tr>\n  <th>Min</th>\n  <td>"
    + alias3((helpers.format || (depth0 && depth0.format) || alias2).call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.format : stack1),((stack1 = (depth0 != null ? depth0.then : depth0)) != null ? stack1.min : stack1),{"name":"format","hash":{},"data":data}))
    + "</td>\n  <td>"
    + alias3((helpers.format || (depth0 && depth0.format) || alias2).call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.format : stack1),((stack1 = (depth0 != null ? depth0.now : depth0)) != null ? stack1.min : stack1),{"name":"format","hash":{},"data":data}))
    + "</td>\n  <td class=\""
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.diff : depth0)) != null ? stack1.min_class : stack1), depth0))
    + "\">\n    "
    + alias3((helpers.format || (depth0 && depth0.format) || alias2).call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.format : stack1),((stack1 = (depth0 != null ? depth0.diff : depth0)) != null ? stack1.min : stack1),{"name":"format","hash":{},"data":data}))
    + "\n  </td>\n  <td class=\""
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.diff : depth0)) != null ? stack1.min_class : stack1), depth0))
    + "\">\n    "
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.diff : depth0)) != null ? stack1.min_pct : stack1), depth0))
    + "\n  </td>\n</tr>\n<tr>\n  <th>Max</th>\n  <td>"
    + alias3((helpers.format || (depth0 && depth0.format) || alias2).call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.format : stack1),((stack1 = (depth0 != null ? depth0.then : depth0)) != null ? stack1.max : stack1),{"name":"format","hash":{},"data":data}))
    + "</td>\n  <td>"
    + alias3((helpers.format || (depth0 && depth0.format) || alias2).call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.format : stack1),((stack1 = (depth0 != null ? depth0.now : depth0)) != null ? stack1.max : stack1),{"name":"format","hash":{},"data":data}))
    + "</td>\n  <td class=\""
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.diff : depth0)) != null ? stack1.max_class : stack1), depth0))
    + "\">\n    "
    + alias3((helpers.format || (depth0 && depth0.format) || alias2).call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.format : stack1),((stack1 = (depth0 != null ? depth0.diff : depth0)) != null ? stack1.max : stack1),{"name":"format","hash":{},"data":data}))
    + "\n  </td>\n  <td class=\""
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.diff : depth0)) != null ? stack1.max_class : stack1), depth0))
    + "\">\n    "
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.diff : depth0)) != null ? stack1.max_pct : stack1), depth0))
    + "\n  </td>\n</tr>\n<tr>\n  <th>Sum</th>\n  <td>"
    + alias3((helpers.format || (depth0 && depth0.format) || alias2).call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.format : stack1),((stack1 = (depth0 != null ? depth0.then : depth0)) != null ? stack1.sum : stack1),{"name":"format","hash":{},"data":data}))
    + "</td>\n  <td>"
    + alias3((helpers.format || (depth0 && depth0.format) || alias2).call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.format : stack1),((stack1 = (depth0 != null ? depth0.now : depth0)) != null ? stack1.sum : stack1),{"name":"format","hash":{},"data":data}))
    + "</td>\n  <td class=\""
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.diff : depth0)) != null ? stack1.sum_class : stack1), depth0))
    + "\">\n    "
    + alias3((helpers.format || (depth0 && depth0.format) || alias2).call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.format : stack1),((stack1 = (depth0 != null ? depth0.diff : depth0)) != null ? stack1.sum : stack1),{"name":"format","hash":{},"data":data}))
    + "\n  </td>\n  <td class=\""
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.diff : depth0)) != null ? stack1.sum_class : stack1), depth0))
    + "\">\n    "
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.diff : depth0)) != null ? stack1.sum_pct : stack1), depth0))
    + "\n  </td>\n</tr>\n";
},"useData":true});

this["ts"]["templates"]["models"]["comparison_summation_table"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
    return "table-striped";
},"3":function(container,depth0,helpers,partials,data) {
    var stack1;

  return container.escapeExpression(container.lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.query_other : stack1)) != null ? stack1.name : stack1), depth0));
},"5":function(container,depth0,helpers,partials,data) {
    var stack1;

  return container.escapeExpression(container.lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.query : stack1)) != null ? stack1.name : stack1), depth0));
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=container.escapeExpression, alias2=depth0 != null ? depth0 : {}, alias3=helpers.helperMissing;

  return "<div class=\"ds-item\" id=\""
    + alias1(container.lambda(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\">\n"
    + ((stack1 = container.invokePartial(partials["ds-title-bar"],depth0,{"name":"ds-title-bar","data":data,"indent":"  ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "")
    + "  <table class=\"table table-condensed ds-timeshift-summation-table "
    + alias1((helpers.height || (depth0 && depth0.height) || alias3).call(alias2,(depth0 != null ? depth0.item : depth0),{"name":"height","hash":{},"data":data}))
    + " "
    + alias1((helpers.css_class || (depth0 && depth0.css_class) || alias3).call(alias2,(depth0 != null ? depth0.item : depth0),{"name":"css_class","hash":{},"data":data}))
    + "\n                "
    + ((stack1 = helpers["if"].call(alias2,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.striped : stack1),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\">\n    <thead>\n      <tr>\n        <th>&nbsp;</th>\n        <th>"
    + ((stack1 = helpers["if"].call(alias2,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.query_other : stack1),{"name":"if","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "</th>\n        <th>"
    + ((stack1 = helpers["if"].call(alias2,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.query : stack1),{"name":"if","hash":{},"fn":container.program(5, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "</th>\n        <th>Delta</th>\n        <th>%</th>\n      </tr>\n    </thead>\n    <tbody/>\n  </table>\n</div>\n";
},"usePartial":true,"useData":true});

this["ts"]["templates"]["models"]["definition"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
    return "    "
    + container.escapeExpression((helpers.item || (depth0 && depth0.item) || helpers.helperMissing).call(depth0 != null ? depth0 : {},depth0,{"name":"item","hash":{},"data":data}))
    + "\n";
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=depth0 != null ? depth0 : {}, alias2=container.escapeExpression;

  return "<div class=\""
    + alias2((helpers.css_class || (depth0 && depth0.css_class) || helpers.helperMissing).call(alias1,(depth0 != null ? depth0.item : depth0),{"name":"css_class","hash":{},"data":data}))
    + " ds-dashboard\" id=\""
    + alias2(container.lambda(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\">\n"
    + ((stack1 = container.invokePartial(partials["ds-edit-bar"],depth0,{"name":"ds-edit-bar","data":data,"indent":"  ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "")
    + ((stack1 = helpers.each.call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.items : stack1),{"name":"each","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "</div>\n";
},"usePartial":true,"useData":true});

this["ts"]["templates"]["models"]["discrete_bar_chart"] = Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=container.escapeExpression, alias4=container.lambda;

  return "<div class=\"ds-item ds-graph ds-discrete-bar-chart "
    + alias3((helpers.css_class || (depth0 && depth0.css_class) || alias2).call(alias1,(depth0 != null ? depth0.item : depth0),{"name":"css_class","hash":{},"data":data}))
    + "\"\n  id=\""
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\">\n"
    + ((stack1 = container.invokePartial(partials["ds-title-bar"],depth0,{"name":"ds-title-bar","data":data,"indent":"  ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "")
    + "  <div class=\"ds-graph-holder "
    + alias3((helpers.height || (depth0 && depth0.height) || alias2).call(alias1,(depth0 != null ? depth0.item : depth0),{"name":"height","hash":{},"data":data}))
    + "\">\n    <svg class=\""
    + alias3((helpers.height || (depth0 && depth0.height) || alias2).call(alias1,(depth0 != null ? depth0.item : depth0),{"name":"height","hash":{},"data":data}))
    + "\"></svg>\n  </div>\n  <div class=\"ds-legend-holder\" id=\"ds-legend-"
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\">\n  </div>\n</div>\n";
},"usePartial":true,"useData":true});

this["ts"]["templates"]["models"]["donut_chart"] = Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=container.escapeExpression, alias4=container.lambda;

  return "<div class=\"ds-item ds-graph ds-donut-chart "
    + alias3((helpers.css_class || (depth0 && depth0.css_class) || alias2).call(alias1,(depth0 != null ? depth0.item : depth0),{"name":"css_class","hash":{},"data":data}))
    + "\"\n  id=\""
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\">\n"
    + ((stack1 = container.invokePartial(partials["ds-title-bar"],depth0,{"name":"ds-title-bar","data":data,"indent":"  ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "")
    + "  <div class=\"ds-graph-holder "
    + alias3((helpers.height || (depth0 && depth0.height) || alias2).call(alias1,(depth0 != null ? depth0.item : depth0),{"name":"height","hash":{},"data":data}))
    + "\">\n    <svg class=\""
    + alias3((helpers.height || (depth0 && depth0.height) || alias2).call(alias1,(depth0 != null ? depth0.item : depth0),{"name":"height","hash":{},"data":data}))
    + "\"></svg>\n  </div>\n  <div class=\"ds-legend-holder\" id=\"ds-legend-"
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\">\n  </div>\n</div>\n";
},"usePartial":true,"useData":true});

this["ts"]["templates"]["models"]["heading"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
    var stack1;

  return "class=\""
    + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.css_class : stack1), depth0))
    + "\"";
},"3":function(container,depth0,helpers,partials,data) {
    var stack1;

  return "<small>"
    + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.description : stack1), depth0))
    + "</small>";
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=container.lambda, alias2=container.escapeExpression, alias3=depth0 != null ? depth0 : {};

  return "<div class=\"ds-item ds-heading\" id=\""
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\">\n  "
    + alias2((helpers["ds-edit-bar"] || (depth0 && depth0["ds-edit-bar"]) || helpers.helperMissing).call(alias3,(depth0 != null ? depth0.item : depth0),{"name":"ds-edit-bar","hash":{},"data":data}))
    + "\n  <h"
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.level : stack1), depth0))
    + " "
    + ((stack1 = helpers["if"].call(alias3,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.css_class : stack1),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + ">\n    "
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.text : stack1), depth0))
    + " "
    + ((stack1 = helpers["if"].call(alias3,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.description : stack1),{"name":"if","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\n      </h"
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.level : stack1), depth0))
    + ">\n</div>\n";
},"useData":true});

this["ts"]["templates"]["models"]["jumbotron_singlestat"] = Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=container.lambda, alias2=container.escapeExpression, alias3=depth0 != null ? depth0 : {}, alias4=helpers.helperMissing;

  return "<div class=\"ds-item ds-jumbotron-singlestat\" id=\""
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\">\n  "
    + alias2((helpers["ds-edit-bar"] || (depth0 && depth0["ds-edit-bar"]) || alias4).call(alias3,(depth0 != null ? depth0.item : depth0),{"name":"ds-edit-bar","hash":{},"data":data}))
    + "\n  <div class=\""
    + alias2((helpers.css_class || (depth0 && depth0.css_class) || alias4).call(alias3,(depth0 != null ? depth0.item : depth0),{"name":"css_class","hash":{},"data":data}))
    + "\">\n    <span class=\"value\"></span>\n    <div class=\"annotations-wrapper\">\n      <div class=\"annotations\">\n        <span class=\"diff\"></span>\n        <span class=\"unit\">"
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.units : stack1), depth0))
    + "</span>\n      </div>\n    </div>\n    <div><h3>"
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.title : stack1), depth0))
    + "</h3></div>\n  </div>\n</div>\n";
},"useData":true});

this["ts"]["templates"]["models"]["markdown"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
    var stack1;

  return "    <pre>"
    + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.text : stack1), depth0))
    + "</pre>\n";
},"3":function(container,depth0,helpers,partials,data) {
    var stack1;

  return "   "
    + ((stack1 = helpers["if"].call(depth0 != null ? depth0 : {},((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.expanded_text : stack1),{"name":"if","hash":{},"fn":container.program(4, data, 0),"inverse":container.program(6, data, 0),"data":data})) != null ? stack1 : "")
    + "\n";
},"4":function(container,depth0,helpers,partials,data) {
    var stack1;

  return container.escapeExpression((helpers.markdown || (depth0 && depth0.markdown) || helpers.helperMissing).call(depth0 != null ? depth0 : {},((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.expanded_text : stack1),{"name":"markdown","hash":{},"data":data}));
},"6":function(container,depth0,helpers,partials,data) {
    var stack1;

  return container.escapeExpression((helpers.markdown || (depth0 && depth0.markdown) || helpers.helperMissing).call(depth0 != null ? depth0 : {},((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.text : stack1),{"name":"markdown","hash":{},"data":data}));
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=container.escapeExpression;

  return "<div class=\"ds-item ds-markdown "
    + alias3((helpers.height || (depth0 && depth0.height) || alias2).call(alias1,(depth0 != null ? depth0.item : depth0),{"name":"height","hash":{},"data":data}))
    + " "
    + alias3((helpers.css_class || (depth0 && depth0.css_class) || alias2).call(alias1,(depth0 != null ? depth0.item : depth0),{"name":"css_class","hash":{},"data":data}))
    + "\" id=\""
    + alias3(container.lambda(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\">\n  "
    + alias3((helpers["ds-edit-bar"] || (depth0 && depth0["ds-edit-bar"]) || alias2).call(alias1,(depth0 != null ? depth0.item : depth0),{"name":"ds-edit-bar","hash":{},"data":data}))
    + "\n"
    + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.raw : stack1),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.program(3, data, 0),"data":data})) != null ? stack1 : "")
    + "</div>\n";
},"useData":true});

this["ts"]["templates"]["models"]["percentage_table_data"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
    return "table-striped";
},"3":function(container,depth0,helpers,partials,data,blockParams,depths) {
    var stack1, alias1=depth0 != null ? depth0 : {};

  return "    <thead>\n      <tr>\n        <th>&nbsp;</th>\n        <th>%</th>\n"
    + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.include_sums : stack1),{"name":"if","hash":{},"fn":container.program(4, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "      </tr>\n    </thead>\n\n    <tbody>\n"
    + ((stack1 = helpers.each.call(alias1,((stack1 = (depth0 != null ? depth0.query : depth0)) != null ? stack1.data : stack1),{"name":"each","hash":{},"fn":container.program(6, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\n"
    + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.include_sums : stack1),{"name":"if","hash":{},"fn":container.program(9, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "    </tbody>\n";
},"4":function(container,depth0,helpers,partials,data) {
    var stack1;

  return "          <th>"
    + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.transform : stack1), depth0))
    + "</th>\n";
},"6":function(container,depth0,helpers,partials,data,blockParams,depths) {
    var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=container.escapeExpression;

  return "        <tr>\n          <th>"
    + alias3(((helper = (helper = helpers.target || (depth0 != null ? depth0.target : depth0)) != null ? helper : alias2),(typeof helper === "function" ? helper.call(alias1,{"name":"target","hash":{},"data":data}) : helper)))
    + "</th>\n          <td>"
    + alias3((helpers.format || (depth0 && depth0.format) || alias2).call(alias1,",.2%",((stack1 = (depth0 != null ? depth0.summation : depth0)) != null ? stack1.percent : stack1),{"name":"format","hash":{},"data":data}))
    + "</td>\n"
    + ((stack1 = helpers["if"].call(alias1,((stack1 = (depths[1] != null ? depths[1].item : depths[1])) != null ? stack1.include_sums : stack1),{"name":"if","hash":{},"fn":container.program(7, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "        </tr>\n";
},"7":function(container,depth0,helpers,partials,data) {
    var stack1;

  return "            <td>"
    + container.escapeExpression((helpers.format || (depth0 && depth0.format) || helpers.helperMissing).call(depth0 != null ? depth0 : {},",.0f",((stack1 = (depth0 != null ? depth0.summation : depth0)) != null ? stack1.percent_value : stack1),{"name":"format","hash":{},"data":data}))
    + "</td>\n";
},"9":function(container,depth0,helpers,partials,data) {
    var stack1;

  return "        <tr>\n          <th>Total</th>\n          <td></td>\n          <td>"
    + container.escapeExpression((helpers.format || (depth0 && depth0.format) || helpers.helperMissing).call(depth0 != null ? depth0 : {},",.0f",((stack1 = ((stack1 = (depth0 != null ? depth0.query : depth0)) != null ? stack1.summation : stack1)) != null ? stack1.percent_value : stack1),{"name":"format","hash":{},"data":data}))
    + "</td>\n        </tr>\n";
},"11":function(container,depth0,helpers,partials,data,blockParams,depths) {
    var stack1, alias1=depth0 != null ? depth0 : {};

  return "    <thead>\n      <tr>\n"
    + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.include_sums : stack1),{"name":"if","hash":{},"fn":container.program(12, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + ((stack1 = helpers.each.call(alias1,((stack1 = (depth0 != null ? depth0.query : depth0)) != null ? stack1.data : stack1),{"name":"each","hash":{},"fn":container.program(14, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "      </tr>\n    </thead>\n\n    <tbody>\n      <tr>\n"
    + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.include_sums : stack1),{"name":"if","hash":{},"fn":container.program(16, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + ((stack1 = helpers.each.call(alias1,((stack1 = (depth0 != null ? depth0.query : depth0)) != null ? stack1.data : stack1),{"name":"each","hash":{},"fn":container.program(18, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "      </tr>\n\n"
    + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.include_sums : stack1),{"name":"if","hash":{},"fn":container.program(20, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "    </tbody>\n";
},"12":function(container,depth0,helpers,partials,data) {
    return "          <th>&nbsp;</th>\n          <th>Total</th>\n";
},"14":function(container,depth0,helpers,partials,data) {
    var helper;

  return "          <th>"
    + container.escapeExpression(((helper = (helper = helpers.target || (depth0 != null ? depth0.target : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"target","hash":{},"data":data}) : helper)))
    + "</th>\n";
},"16":function(container,depth0,helpers,partials,data) {
    return "          <th>%</th>\n          <th></th>\n";
},"18":function(container,depth0,helpers,partials,data) {
    var stack1;

  return "          <td>"
    + container.escapeExpression((helpers.format || (depth0 && depth0.format) || helpers.helperMissing).call(depth0 != null ? depth0 : {},",.2%",((stack1 = (depth0 != null ? depth0.summation : depth0)) != null ? stack1.percent : stack1),{"name":"format","hash":{},"data":data}))
    + "</td>\n";
},"20":function(container,depth0,helpers,partials,data,blockParams,depths) {
    var stack1, alias1=container.escapeExpression, alias2=depth0 != null ? depth0 : {};

  return "        <tr>\n          <th>"
    + alias1(container.lambda(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.transform : stack1), depth0))
    + "</th>\n          <td>"
    + alias1((helpers.format || (depth0 && depth0.format) || helpers.helperMissing).call(alias2,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.format : stack1),((stack1 = ((stack1 = (depth0 != null ? depth0.query : depth0)) != null ? stack1.summation : stack1)) != null ? stack1.percent_value : stack1),{"name":"format","hash":{},"data":data}))
    + "</td>\n"
    + ((stack1 = helpers.each.call(alias2,((stack1 = (depth0 != null ? depth0.query : depth0)) != null ? stack1.data : stack1),{"name":"each","hash":{},"fn":container.program(21, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "        </tr>\n";
},"21":function(container,depth0,helpers,partials,data,blockParams,depths) {
    var stack1;

  return "            <td>"
    + container.escapeExpression((helpers.format || (depth0 && depth0.format) || helpers.helperMissing).call(depth0 != null ? depth0 : {},((stack1 = (depths[1] != null ? depths[1].item : depths[1])) != null ? stack1.format : stack1),((stack1 = (depth0 != null ? depth0.summation : depth0)) != null ? stack1.percent_value : stack1),{"name":"format","hash":{},"data":data}))
    + "</td>\n";
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data,blockParams,depths) {
    var stack1, alias1=depth0 != null ? depth0 : {};

  return "<table class=\"table table-condensed ds-percentage-table "
    + container.escapeExpression((helpers.css_class || (depth0 && depth0.css_class) || helpers.helperMissing).call(alias1,(depth0 != null ? depth0.item : depth0),{"name":"css_class","hash":{},"data":data}))
    + "\n                "
    + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.striped : stack1),{"name":"if","hash":{},"fn":container.program(1, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\">\n\n"
    + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.invert_axes : stack1),{"name":"if","hash":{},"fn":container.program(3, data, 0, blockParams, depths),"inverse":container.program(11, data, 0, blockParams, depths),"data":data})) != null ? stack1 : "")
    + "\n</table>\n";
},"useData":true,"useDepths":true});

this["ts"]["templates"]["models"]["percentage_table"] = Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1;

  return "<div class=\"ds-item\" id=\""
    + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\">\n"
    + ((stack1 = container.invokePartial(partials["ds-title-bar"],depth0,{"name":"ds-title-bar","data":data,"indent":"  ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "")
    + "  <div class=\"ds-percentage-table-holder\">\n    <h4>No data</h4>\n  </div>\n</div>\n";
},"usePartial":true,"useData":true});

this["ts"]["templates"]["models"]["row"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
    return "<div class=\""
    + container.escapeExpression((helpers.style_class || (depth0 && depth0.style_class) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.item : depth0),{"name":"style_class","hash":{},"data":data}))
    + "\">";
},"3":function(container,depth0,helpers,partials,data) {
    return "        "
    + container.escapeExpression((helpers.item || (depth0 && depth0.item) || helpers.helperMissing).call(depth0 != null ? depth0 : {},depth0,{"name":"item","hash":{},"data":data}))
    + "\n";
},"5":function(container,depth0,helpers,partials,data) {
    return "</div>";
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=container.escapeExpression, alias2=depth0 != null ? depth0 : {};

  return "<div class=\"ds-row\" id=\""
    + alias1(container.lambda(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\">\n  "
    + ((stack1 = helpers["if"].call(alias2,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.style : stack1),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\n\n"
    + ((stack1 = container.invokePartial(partials["ds-edit-bar"],depth0,{"name":"ds-edit-bar","data":data,"indent":"    ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "")
    + "    <div class=\"row "
    + alias1((helpers.css_class || (depth0 && depth0.css_class) || helpers.helperMissing).call(alias2,(depth0 != null ? depth0.item : depth0),{"name":"css_class","hash":{},"data":data}))
    + "\">\n"
    + ((stack1 = helpers.each.call(alias2,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.items : stack1),{"name":"each","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "    </div>\n    "
    + ((stack1 = helpers["if"].call(alias2,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.style : stack1),{"name":"if","hash":{},"fn":container.program(5, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\n</div>\n";
},"usePartial":true,"useData":true});

this["ts"]["templates"]["models"]["scatter_plot"] = Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=container.escapeExpression, alias4=container.lambda;

  return "<div class=\"ds-item ds-graph ds-scatter-plot "
    + alias3((helpers.css_class || (depth0 && depth0.css_class) || alias2).call(alias1,(depth0 != null ? depth0.item : depth0),{"name":"css_class","hash":{},"data":data}))
    + "\"\n  id=\""
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\">\n"
    + ((stack1 = container.invokePartial(partials["ds-title-bar"],depth0,{"name":"ds-title-bar","data":data,"indent":"  ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "")
    + "  <div class=\"ds-graph-holder "
    + alias3((helpers.height || (depth0 && depth0.height) || alias2).call(alias1,(depth0 != null ? depth0.item : depth0),{"name":"height","hash":{},"data":data}))
    + "\">\n    <svg class=\""
    + alias3((helpers.height || (depth0 && depth0.height) || alias2).call(alias1,(depth0 != null ? depth0.item : depth0),{"name":"height","hash":{},"data":data}))
    + "\"></svg>\n  </div>\n  <div class=\"ds-legend-holder\" id=\"ds-legend-"
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\">\n  </div>\n</div>\n";
},"usePartial":true,"useData":true});

this["ts"]["templates"]["models"]["section"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
    return "<div class=\""
    + container.escapeExpression((helpers.style_class || (depth0 && depth0.style_class) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.item : depth0),{"name":"style_class","hash":{},"data":data}))
    + "\">";
},"3":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=container.lambda, alias2=container.escapeExpression;

  return "        <h"
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.level : stack1), depth0))
    + " class=\"ds-section-heading\">"
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.title : stack1), depth0))
    + "\n        "
    + ((stack1 = helpers["if"].call(depth0 != null ? depth0 : {},((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.description : stack1),{"name":"if","hash":{},"fn":container.program(4, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\n          </h"
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.level : stack1), depth0))
    + ">\n";
},"4":function(container,depth0,helpers,partials,data) {
    var stack1;

  return "<small>"
    + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.description : stack1), depth0))
    + "</small>";
},"6":function(container,depth0,helpers,partials,data) {
    return "        <hr/>\n";
},"8":function(container,depth0,helpers,partials,data) {
    return "      "
    + container.escapeExpression((helpers.item || (depth0 && depth0.item) || helpers.helperMissing).call(depth0 != null ? depth0 : {},depth0,{"name":"item","hash":{},"data":data}))
    + "\n";
},"10":function(container,depth0,helpers,partials,data) {
    return "</div>";
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=container.escapeExpression;

  return "<div class=\"ds-section "
    + alias3((helpers.container_class || (depth0 && depth0.container_class) || alias2).call(alias1,(depth0 != null ? depth0.item : depth0),{"name":"container_class","hash":{},"data":data}))
    + " "
    + alias3((helpers.css_class || (depth0 && depth0.css_class) || alias2).call(alias1,(depth0 != null ? depth0.item : depth0),{"name":"css_class","hash":{},"data":data}))
    + "\" id=\""
    + alias3(container.lambda(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\">\n"
    + ((stack1 = container.invokePartial(partials["ds-edit-bar"],depth0,{"name":"ds-edit-bar","data":data,"indent":"  ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "")
    + "  "
    + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.style : stack1),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\n    <div>\n"
    + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.title : stack1),{"name":"if","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.horizontal_rule : stack1),{"name":"if","hash":{},"fn":container.program(6, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "    </div>\n\n"
    + ((stack1 = helpers.each.call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.items : stack1),{"name":"each","hash":{},"fn":container.program(8, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\n    "
    + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.style : stack1),{"name":"if","hash":{},"fn":container.program(10, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\n</div>\n";
},"usePartial":true,"useData":true});

this["ts"]["templates"]["models"]["separator"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
    var stack1;

  return "class=\""
    + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.css_class : stack1), depth0))
    + "\"";
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=container.escapeExpression, alias2=depth0 != null ? depth0 : {};

  return "<div class=\"ds-item ds-separator\" id=\""
    + alias1(container.lambda(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\">\n  "
    + alias1((helpers["ds-edit-bar"] || (depth0 && depth0["ds-edit-bar"]) || helpers.helperMissing).call(alias2,(depth0 != null ? depth0.item : depth0),{"name":"ds-edit-bar","hash":{},"data":data}))
    + "\n  <hr "
    + ((stack1 = helpers["if"].call(alias2,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.css_class : stack1),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "></hr>\n</div>\n";
},"useData":true});

this["ts"]["templates"]["models"]["simple_time_series"] = Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=container.escapeExpression;

  return "<div class=\"ds-item ds-graph ds-simple-time-series "
    + alias3((helpers.css_class || (depth0 && depth0.css_class) || alias2).call(alias1,(depth0 != null ? depth0.item : depth0),{"name":"css_class","hash":{},"data":data}))
    + "\" id=\""
    + alias3(container.lambda(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\">\n"
    + ((stack1 = container.invokePartial(partials["ds-title-bar"],depth0,{"name":"ds-title-bar","data":data,"indent":"  ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "")
    + "  <div class=\"ds-graph-holder "
    + alias3((helpers.height || (depth0 && depth0.height) || alias2).call(alias1,(depth0 != null ? depth0.item : depth0),{"name":"height","hash":{},"data":data}))
    + "\">\n    <svg class=\""
    + alias3((helpers.height || (depth0 && depth0.height) || alias2).call(alias1,(depth0 != null ? depth0.item : depth0),{"name":"height","hash":{},"data":data}))
    + "\"></svg>\n  </div>\n</div>\n";
},"usePartial":true,"useData":true});

this["ts"]["templates"]["models"]["singlegraph_grid_item"] = Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression, alias5=container.lambda;

  return "<div class=\"col-md-"
    + alias4(((helper = (helper = helpers.colspan || (depth0 != null ? depth0.colspan : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"colspan","hash":{},"data":data}) : helper)))
    + "\">\n  <div class=\"ds-singlegraph "
    + alias4((helpers.css_class || (depth0 && depth0.css_class) || alias2).call(alias1,(depth0 != null ? depth0.item : depth0),{"name":"css_class","hash":{},"data":data}))
    + "\" id=\""
    + alias4(alias5(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "-"
    + alias4(((helper = (helper = helpers.index || (depth0 != null ? depth0.index : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"index","hash":{},"data":data}) : helper)))
    + "\">\n    <span class=\"ds-label\">"
    + alias4(((helper = (helper = helpers.label || (depth0 != null ? depth0.label : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"label","hash":{},"data":data}) : helper)))
    + "</span>\n    <div class=\"ds-graph-holder "
    + alias4((helpers.height || (depth0 && depth0.height) || alias2).call(alias1,(depth0 != null ? depth0.item : depth0),{"name":"height","hash":{},"data":data}))
    + "\"></div>\n    <span class=\"value\">"
    + alias4(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"value","hash":{},"data":data}) : helper)))
    + "</span>\n    <span class=\"transform\">"
    + alias4(alias5(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.transform : stack1), depth0))
    + "</span>\n  </div>\n</div>\n";
},"useData":true});

this["ts"]["templates"]["models"]["singlegraph_grid"] = Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=container.escapeExpression;

  return "<div class=\"ds-item ds-singlegraph-grid "
    + alias1((helpers.css_class || (depth0 && depth0.css_class) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.item : depth0),{"name":"css_class","hash":{},"data":data}))
    + "\" id=\""
    + alias1(container.lambda(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\">\n"
    + ((stack1 = container.invokePartial(partials["ds-title-bar"],depth0,{"name":"ds-title-bar","data":data,"indent":"  ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "")
    + "  <div class=\"row ds-singlegraph-grid-holder\"></div>\n</div>\n";
},"usePartial":true,"useData":true});

this["ts"]["templates"]["models"]["singlegraph"] = Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=container.escapeExpression, alias4=container.lambda;

  return "<div class=\"ds-item ds-singlegraph "
    + alias3((helpers.css_class || (depth0 && depth0.css_class) || alias2).call(alias1,(depth0 != null ? depth0.item : depth0),{"name":"css_class","hash":{},"data":data}))
    + "\" id=\""
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\">\n"
    + ((stack1 = container.invokePartial(partials["ds-title-bar"],depth0,{"name":"ds-title-bar","data":data,"indent":"  ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "")
    + "  <span class=\"ds-label\"></span>\n  <div class=\"ds-graph-holder "
    + alias3((helpers.height || (depth0 && depth0.height) || alias2).call(alias1,(depth0 != null ? depth0.item : depth0),{"name":"height","hash":{},"data":data}))
    + "\">\n    <svg class=\""
    + alias3((helpers.height || (depth0 && depth0.height) || alias2).call(alias1,(depth0 != null ? depth0.item : depth0),{"name":"height","hash":{},"data":data}))
    + "\"></svg>\n  </div>\n  <span class=\"value\"></span>\n  <span class=\"transform\">"
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.transform : stack1), depth0))
    + "</span>\n</div>\n";
},"usePartial":true,"useData":true});

this["ts"]["templates"]["models"]["singlestat"] = Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=container.lambda, alias2=container.escapeExpression, alias3=depth0 != null ? depth0 : {}, alias4=helpers.helperMissing;

  return "<div class=\"ds-item\" id=\""
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\">\n  "
    + alias2((helpers["ds-edit-bar"] || (depth0 && depth0["ds-edit-bar"]) || alias4).call(alias3,(depth0 != null ? depth0.item : depth0),{"name":"ds-edit-bar","hash":{},"data":data}))
    + "\n  <div class=\"ds-singlestat "
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.css_class : stack1), depth0))
    + " "
    + alias2((helpers.height || (depth0 && depth0.height) || alias4).call(alias3,(depth0 != null ? depth0.item : depth0),{"name":"height","hash":{},"data":data}))
    + "\">\n    <h3>"
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.title : stack1), depth0))
    + "</h3>\n    <p><span class=\"value\"></span><span class=\"unit\">"
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.units : stack1), depth0))
    + "</span><span class=\"diff\"></span></p>\n  </div>\n</div>\n";
},"useData":true});

this["ts"]["templates"]["models"]["standard_time_series"] = Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=container.escapeExpression, alias4=container.lambda;

  return "<div class=\"ds-item ds-graph ds-standard-time-series "
    + alias3((helpers.css_class || (depth0 && depth0.css_class) || alias2).call(alias1,(depth0 != null ? depth0.item : depth0),{"name":"css_class","hash":{},"data":data}))
    + "\"\n  id=\""
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\">\n"
    + ((stack1 = container.invokePartial(partials["ds-title-bar"],depth0,{"name":"ds-title-bar","data":data,"indent":"  ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "")
    + "  <div class=\"ds-graph-holder "
    + alias3((helpers.height || (depth0 && depth0.height) || alias2).call(alias1,(depth0 != null ? depth0.item : depth0),{"name":"height","hash":{},"data":data}))
    + "\">\n    <svg class=\""
    + alias3((helpers.height || (depth0 && depth0.height) || alias2).call(alias1,(depth0 != null ? depth0.item : depth0),{"name":"height","hash":{},"data":data}))
    + "\"></svg>\n  </div>\n  <div class=\"ds-legend-holder\" id=\"ds-legend-"
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\">\n  </div>\n</div>\n";
},"usePartial":true,"useData":true});

this["ts"]["templates"]["models"]["summation_table_row"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
    var stack1;

  return ((stack1 = helpers.unless.call(depth0 != null ? depth0 : {},((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.show_sparkline : stack1),{"name":"unless","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "");
},"2":function(container,depth0,helpers,partials,data) {
    var helper;

  return "        <span class=\"ds-summation-color-cell\" style=\"background:"
    + container.escapeExpression(((helper = (helper = helpers.color || (depth0 != null ? depth0.color : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"color","hash":{},"data":data}) : helper)))
    + "\"></span>\n";
},"4":function(container,depth0,helpers,partials,data) {
    var stack1;

  return "<td>"
    + container.escapeExpression((helpers.format || (depth0 && depth0.format) || helpers.helperMissing).call(depth0 != null ? depth0 : {},((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.format : stack1),((stack1 = ((stack1 = (depth0 != null ? depth0.series : depth0)) != null ? stack1.summation : stack1)) != null ? stack1.last : stack1),{"name":"format","hash":{},"data":data}))
    + "</td>";
},"6":function(container,depth0,helpers,partials,data) {
    var stack1;

  return "<td>"
    + container.escapeExpression((helpers.format || (depth0 && depth0.format) || helpers.helperMissing).call(depth0 != null ? depth0 : {},((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.format : stack1),((stack1 = ((stack1 = (depth0 != null ? depth0.series : depth0)) != null ? stack1.summation : stack1)) != null ? stack1.min : stack1),{"name":"format","hash":{},"data":data}))
    + "</td>";
},"8":function(container,depth0,helpers,partials,data) {
    var stack1;

  return "<td>"
    + container.escapeExpression((helpers.format || (depth0 && depth0.format) || helpers.helperMissing).call(depth0 != null ? depth0 : {},((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.format : stack1),((stack1 = ((stack1 = (depth0 != null ? depth0.series : depth0)) != null ? stack1.summation : stack1)) != null ? stack1.max : stack1),{"name":"format","hash":{},"data":data}))
    + "</td>";
},"10":function(container,depth0,helpers,partials,data) {
    var stack1;

  return "<td>"
    + container.escapeExpression((helpers.format || (depth0 && depth0.format) || helpers.helperMissing).call(depth0 != null ? depth0 : {},((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.format : stack1),((stack1 = ((stack1 = (depth0 != null ? depth0.series : depth0)) != null ? stack1.summation : stack1)) != null ? stack1.mean : stack1),{"name":"format","hash":{},"data":data}))
    + "</td>";
},"12":function(container,depth0,helpers,partials,data) {
    var stack1;

  return "<td>"
    + container.escapeExpression((helpers.format || (depth0 && depth0.format) || helpers.helperMissing).call(depth0 != null ? depth0 : {},((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.format : stack1),((stack1 = ((stack1 = (depth0 != null ? depth0.series : depth0)) != null ? stack1.summation : stack1)) != null ? stack1.median : stack1),{"name":"format","hash":{},"data":data}))
    + "</td>";
},"14":function(container,depth0,helpers,partials,data) {
    var stack1;

  return "<td>"
    + container.escapeExpression((helpers.format || (depth0 && depth0.format) || helpers.helperMissing).call(depth0 != null ? depth0 : {},((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.format : stack1),((stack1 = ((stack1 = (depth0 != null ? depth0.series : depth0)) != null ? stack1.summation : stack1)) != null ? stack1.sum : stack1),{"name":"format","hash":{},"data":data}))
    + "</td>";
},"16":function(container,depth0,helpers,partials,data) {
    var stack1, helper, alias1=container.escapeExpression;

  return "    <td>\n      <div class=\"ds-spark-table-graph\" id=\""
    + alias1(container.lambda(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "-sparkline-"
    + alias1(((helper = (helper = helpers.index || (depth0 != null ? depth0.index : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"index","hash":{},"data":data}) : helper)))
    + "\"></div>\n    </td>\n";
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=depth0 != null ? depth0 : {};

  return "<tr>\n  <th>\n"
    + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.show_color : stack1),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "    "
    + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.series : depth0)) != null ? stack1.target : stack1), depth0))
    + "\n  </th>\n  "
    + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.show_current : stack1),{"name":"if","hash":{},"fn":container.program(4, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\n  "
    + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.show_min : stack1),{"name":"if","hash":{},"fn":container.program(6, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\n  "
    + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.show_max : stack1),{"name":"if","hash":{},"fn":container.program(8, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\n  "
    + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.show_mean : stack1),{"name":"if","hash":{},"fn":container.program(10, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\n  "
    + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.show_median : stack1),{"name":"if","hash":{},"fn":container.program(12, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\n  "
    + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.show_sum : stack1),{"name":"if","hash":{},"fn":container.program(14, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\n"
    + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.show_sparkline : stack1),{"name":"if","hash":{},"fn":container.program(16, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "</tr>\n";
},"useData":true});

this["ts"]["templates"]["models"]["summation_table"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
    return "table-striped";
},"3":function(container,depth0,helpers,partials,data) {
    return "<col>";
},"5":function(container,depth0,helpers,partials,data) {
    return "<col class=\"ds-sparkline-col\">";
},"7":function(container,depth0,helpers,partials,data) {
    return "<th>current</th>";
},"9":function(container,depth0,helpers,partials,data) {
    return "<th>min</th>";
},"11":function(container,depth0,helpers,partials,data) {
    return "<th>max</th>";
},"13":function(container,depth0,helpers,partials,data) {
    return "<th>mean</th>";
},"15":function(container,depth0,helpers,partials,data) {
    return "<th>median</th>";
},"17":function(container,depth0,helpers,partials,data) {
    return "<th>sum</th>";
},"19":function(container,depth0,helpers,partials,data) {
    return "<th>&nbsp;</th>";
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=container.escapeExpression, alias2=depth0 != null ? depth0 : {}, alias3=helpers.helperMissing;

  return "<div class=\"ds-item\" id=\""
    + alias1(container.lambda(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\">\n"
    + ((stack1 = container.invokePartial(partials["ds-title-bar"],depth0,{"name":"ds-title-bar","data":data,"indent":"  ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "")
    + "  <table class=\"table table-condensed ds-summation-table "
    + alias1((helpers.height || (depth0 && depth0.height) || alias3).call(alias2,(depth0 != null ? depth0.item : depth0),{"name":"height","hash":{},"data":data}))
    + " "
    + alias1((helpers.css_class || (depth0 && depth0.css_class) || alias3).call(alias2,(depth0 != null ? depth0.item : depth0),{"name":"css_class","hash":{},"data":data}))
    + "\n                "
    + ((stack1 = helpers["if"].call(alias2,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.striped : stack1),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\">\n    <colgroup>\n      <col>\n      "
    + ((stack1 = helpers["if"].call(alias2,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.show_current : stack1),{"name":"if","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\n      "
    + ((stack1 = helpers["if"].call(alias2,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.show_min : stack1),{"name":"if","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\n      "
    + ((stack1 = helpers["if"].call(alias2,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.show_max : stack1),{"name":"if","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\n      "
    + ((stack1 = helpers["if"].call(alias2,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.show_mean : stack1),{"name":"if","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\n      "
    + ((stack1 = helpers["if"].call(alias2,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.show_median : stack1),{"name":"if","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\n      "
    + ((stack1 = helpers["if"].call(alias2,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.show_sum : stack1),{"name":"if","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\n      "
    + ((stack1 = helpers["if"].call(alias2,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.show_sparkline : stack1),{"name":"if","hash":{},"fn":container.program(5, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\n    </colgroup>\n    <thead>\n      <tr>\n        <th>&nbsp;</th>\n        "
    + ((stack1 = helpers["if"].call(alias2,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.show_current : stack1),{"name":"if","hash":{},"fn":container.program(7, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\n        "
    + ((stack1 = helpers["if"].call(alias2,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.show_min : stack1),{"name":"if","hash":{},"fn":container.program(9, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\n        "
    + ((stack1 = helpers["if"].call(alias2,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.show_max : stack1),{"name":"if","hash":{},"fn":container.program(11, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\n        "
    + ((stack1 = helpers["if"].call(alias2,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.show_mean : stack1),{"name":"if","hash":{},"fn":container.program(13, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\n        "
    + ((stack1 = helpers["if"].call(alias2,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.show_median : stack1),{"name":"if","hash":{},"fn":container.program(15, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\n        "
    + ((stack1 = helpers["if"].call(alias2,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.show_sum : stack1),{"name":"if","hash":{},"fn":container.program(17, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\n        "
    + ((stack1 = helpers["if"].call(alias2,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.show_sparkline : stack1),{"name":"if","hash":{},"fn":container.program(19, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\n      </tr>\n    </thead>\n    <tbody>\n    </tbody>\n  </table>\n</div>\n";
},"usePartial":true,"useData":true});

this["ts"]["templates"]["models"]["timerstat_body"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
    var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;

  return "  <span class=\"value\">"
    + alias4(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"value","hash":{},"data":data}) : helper)))
    + "</span><span class=\"unit\">"
    + alias4(((helper = (helper = helpers.unit || (depth0 != null ? depth0.unit : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"unit","hash":{},"data":data}) : helper)))
    + "</span>\n";
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1;

  return ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.parts : depth0),{"name":"each","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "");
},"useData":true});

this["ts"]["templates"]["models"]["timerstat"] = Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=container.lambda, alias2=container.escapeExpression, alias3=depth0 != null ? depth0 : {}, alias4=helpers.helperMissing;

  return "<div class=\"ds-item\" id=\""
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\">\n  "
    + alias2((helpers["ds-edit-bar"] || (depth0 && depth0["ds-edit-bar"]) || alias4).call(alias3,(depth0 != null ? depth0.item : depth0),{"name":"ds-edit-bar","hash":{},"data":data}))
    + "\n  <div class=\"ds-timerstat "
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.css_class : stack1), depth0))
    + " "
    + alias2((helpers.height || (depth0 && depth0.height) || alias4).call(alias3,(depth0 != null ? depth0.item : depth0),{"name":"height","hash":{},"data":data}))
    + "\">\n    <h3>"
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.title : stack1), depth0))
    + "</h3>\n    <p class=\"data\"></p>\n  </div>\n</div>\n";
},"useData":true});

this["ts"]["templates"]["models"]["timeshift_summation_table_body"] = Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=container.escapeExpression, alias4=container.lambda;

  return "<!-- TODO: configure which rows to include. Sum doesnt make sense for rates -->\n<tr>\n  <th>Average</th>\n  <td>"
    + alias3((helpers.format || (depth0 && depth0.format) || alias2).call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.format : stack1),((stack1 = (depth0 != null ? depth0.now : depth0)) != null ? stack1.mean : stack1),{"name":"format","hash":{},"data":data}))
    + "</td>\n  <td>"
    + alias3((helpers.format || (depth0 && depth0.format) || alias2).call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.format : stack1),((stack1 = (depth0 != null ? depth0.then : depth0)) != null ? stack1.mean : stack1),{"name":"format","hash":{},"data":data}))
    + "</td>\n  <td class=\""
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.diff : depth0)) != null ? stack1.mean_class : stack1), depth0))
    + "\">\n    "
    + alias3((helpers.format || (depth0 && depth0.format) || alias2).call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.format : stack1),((stack1 = (depth0 != null ? depth0.diff : depth0)) != null ? stack1.mean : stack1),{"name":"format","hash":{},"data":data}))
    + "\n  </td>\n  <td class=\""
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.diff : depth0)) != null ? stack1.mean_class : stack1), depth0))
    + "\">\n    "
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.diff : depth0)) != null ? stack1.mean_pct : stack1), depth0))
    + "\n  </td>\n</tr>\n<tr>\n  <th>Median</th>\n  <td>"
    + alias3((helpers.format || (depth0 && depth0.format) || alias2).call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.format : stack1),((stack1 = (depth0 != null ? depth0.now : depth0)) != null ? stack1.median : stack1),{"name":"format","hash":{},"data":data}))
    + "</td>\n  <td>"
    + alias3((helpers.format || (depth0 && depth0.format) || alias2).call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.format : stack1),((stack1 = (depth0 != null ? depth0.then : depth0)) != null ? stack1.median : stack1),{"name":"format","hash":{},"data":data}))
    + "</td>\n  <td class=\""
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.diff : depth0)) != null ? stack1.median_class : stack1), depth0))
    + "\">\n    "
    + alias3((helpers.format || (depth0 && depth0.format) || alias2).call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.format : stack1),((stack1 = (depth0 != null ? depth0.diff : depth0)) != null ? stack1.median : stack1),{"name":"format","hash":{},"data":data}))
    + "\n  </td>\n  <td class=\""
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.diff : depth0)) != null ? stack1.median_class : stack1), depth0))
    + "\">\n    "
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.diff : depth0)) != null ? stack1.median_pct : stack1), depth0))
    + "\n  </td>\n</tr>\n<tr>\n  <th>Min</th>\n  <td>"
    + alias3((helpers.format || (depth0 && depth0.format) || alias2).call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.format : stack1),((stack1 = (depth0 != null ? depth0.now : depth0)) != null ? stack1.min : stack1),{"name":"format","hash":{},"data":data}))
    + "</td>\n  <td>"
    + alias3((helpers.format || (depth0 && depth0.format) || alias2).call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.format : stack1),((stack1 = (depth0 != null ? depth0.then : depth0)) != null ? stack1.min : stack1),{"name":"format","hash":{},"data":data}))
    + "</td>\n  <td class=\""
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.diff : depth0)) != null ? stack1.min_class : stack1), depth0))
    + "\">\n    "
    + alias3((helpers.format || (depth0 && depth0.format) || alias2).call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.format : stack1),((stack1 = (depth0 != null ? depth0.diff : depth0)) != null ? stack1.min : stack1),{"name":"format","hash":{},"data":data}))
    + "\n  </td>\n  <td class=\""
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.diff : depth0)) != null ? stack1.min_class : stack1), depth0))
    + "\">\n    "
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.diff : depth0)) != null ? stack1.min_pct : stack1), depth0))
    + "\n  </td>\n</tr>\n<tr>\n  <th>Max</th>\n  <td>"
    + alias3((helpers.format || (depth0 && depth0.format) || alias2).call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.format : stack1),((stack1 = (depth0 != null ? depth0.now : depth0)) != null ? stack1.max : stack1),{"name":"format","hash":{},"data":data}))
    + "</td>\n  <td>"
    + alias3((helpers.format || (depth0 && depth0.format) || alias2).call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.format : stack1),((stack1 = (depth0 != null ? depth0.then : depth0)) != null ? stack1.max : stack1),{"name":"format","hash":{},"data":data}))
    + "</td>\n  <td class=\""
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.diff : depth0)) != null ? stack1.max_class : stack1), depth0))
    + "\">\n    "
    + alias3((helpers.format || (depth0 && depth0.format) || alias2).call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.format : stack1),((stack1 = (depth0 != null ? depth0.diff : depth0)) != null ? stack1.max : stack1),{"name":"format","hash":{},"data":data}))
    + "\n  </td>\n  <td class=\""
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.diff : depth0)) != null ? stack1.max_class : stack1), depth0))
    + "\">\n    "
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.diff : depth0)) != null ? stack1.max_pct : stack1), depth0))
    + "\n  </td>\n</tr>\n<tr>\n  <th>Sum</th>\n  <td>"
    + alias3((helpers.format || (depth0 && depth0.format) || alias2).call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.format : stack1),((stack1 = (depth0 != null ? depth0.now : depth0)) != null ? stack1.sum : stack1),{"name":"format","hash":{},"data":data}))
    + "</td>\n  <td>"
    + alias3((helpers.format || (depth0 && depth0.format) || alias2).call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.format : stack1),((stack1 = (depth0 != null ? depth0.then : depth0)) != null ? stack1.sum : stack1),{"name":"format","hash":{},"data":data}))
    + "</td>\n  <td class=\""
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.diff : depth0)) != null ? stack1.sum_class : stack1), depth0))
    + "\">\n    "
    + alias3((helpers.format || (depth0 && depth0.format) || alias2).call(alias1,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.format : stack1),((stack1 = (depth0 != null ? depth0.diff : depth0)) != null ? stack1.sum : stack1),{"name":"format","hash":{},"data":data}))
    + "\n  </td>\n  <td class=\""
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.diff : depth0)) != null ? stack1.sum_class : stack1), depth0))
    + "\">\n    "
    + alias3(alias4(((stack1 = (depth0 != null ? depth0.diff : depth0)) != null ? stack1.sum_pct : stack1), depth0))
    + "\n  </td>\n</tr>\n";
},"useData":true});

this["ts"]["templates"]["models"]["timeshift_summation_table"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
    return "table-striped";
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, alias1=container.lambda, alias2=container.escapeExpression, alias3=depth0 != null ? depth0 : {}, alias4=helpers.helperMissing;

  return "<div class=\"ds-item\" id=\""
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.item_id : stack1), depth0))
    + "\">\n"
    + ((stack1 = container.invokePartial(partials["ds-title-bar"],depth0,{"name":"ds-title-bar","data":data,"indent":"  ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "")
    + "  <table class=\"table table-condensed ds-timeshift-summation-table "
    + alias2((helpers.height || (depth0 && depth0.height) || alias4).call(alias3,(depth0 != null ? depth0.item : depth0),{"name":"height","hash":{},"data":data}))
    + " "
    + alias2((helpers.css_class || (depth0 && depth0.css_class) || alias4).call(alias3,(depth0 != null ? depth0.item : depth0),{"name":"css_class","hash":{},"data":data}))
    + "\n                "
    + ((stack1 = helpers["if"].call(alias3,((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.striped : stack1),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "\">\n    <thead>\n      <tr>\n        <th></th>\n        <th>Now</th>\n        <th>"
    + alias2(alias1(((stack1 = (depth0 != null ? depth0.item : depth0)) != null ? stack1.shift : stack1), depth0))
    + " Ago</th>\n        <th>Delta</th>\n        <th>%</th>\n      </tr>\n    </thead>\n    <tbody/>\n  </table>\n</div>\n";
},"usePartial":true,"useData":true});;(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.instance = exports.Application = exports.Mode = exports.Event = exports.config = undefined;

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

exports.refresh_mode = refresh_mode;
exports.switch_to_mode = switch_to_mode;
exports.toggle_mode = toggle_mode;
exports.add_mode_handler = add_mode_handler;
exports.uri = uri;
exports.context = context;
exports.set_config = set_config;

var _util = require('../util');

var _config = require('./config');

var _config2 = _interopRequireDefault(_config);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var log = (0, _util.logger)('app');
var ANIMATION_DELAY = 300;
var config = exports.config = new _config2.default();
/**
 * Some pre-defined events that we can register handlers for.
 */
var Event = exports.Event = {
    MODE_ENTER: 'ds-enter:',
    MODE_EXIT: 'ds-exit:',
    MODE_REFRESH: 'ds-refresh:',
    DASHBOARD_LOADED: 'ds-dashboard-loaded',
    DASHBOARD_RENDERED: 'ds-dashboard-rendered',
    RANGE_CHANGED: 'ds-range-changed',
    QUERIES_COMPLETE: 'ds-queries-complete'
};
/**
 * Valid user interface modes.
 */
var Mode = exports.Mode = {
    EDIT: 'edit',
    TRANSFORM: 'transform',
    DISPLAY: 'display',
    STANDARD: 'standard'
};
/**
 * The central application object. At present, its primary
 * responsibility is to handle switching between different application
 * modes, which is mainly about hiding & showing various elements in
 * the UI.
 */

var Application = exports.Application = function () {
    function Application() {
        _classCallCheck(this, Application);

        this.mode_stack = [];
        this.current_mode = 'standard';
    }
    /* Mode Handling ------------------------------------------ */


    _createClass(Application, [{
        key: '_do_exit_mode',
        value: function _do_exit_mode(mode) {
            log.debug('mode <- ' + mode);
            _util.events.fire(this, Event.MODE_EXIT + mode);
            var state = this.mode_stack.pop();
            if (state) {
                state.hidden.show(ANIMATION_DELAY);
                state.shown.hide(ANIMATION_DELAY);
            }
        }
    }, {
        key: '_do_enter_mode',
        value: function _do_enter_mode(mode) {
            log.debug('mode -> ' + mode);
            var hidden = $('[data-ds-hide~="' + mode + '"]').hide(ANIMATION_DELAY);
            var shown = $('[data-ds-show~="' + mode + '"]').show(ANIMATION_DELAY);
            this.current_mode = mode;
            this.mode_stack.push({
                mode: mode,
                hidden: hidden,
                shown: shown
            });
            _util.events.fire(this, Event.MODE_ENTER + mode);
        }
        /**
         * An alias for switch_to_mode(current_mode)
         */

    }, {
        key: 'refresh_mode',
        value: function refresh_mode() {
            this.switch_to_mode(this.current_mode, 0);
            _util.events.fire(this, Event.MODE_REFRESH + this.current_mode);
            return this;
        }
        /**
         * Switch to a named mode. This will first run the exit handlers
         * for the current mode, restoring any previously hidden elements
         * to visibility, before running the enter mode handlers for the
         * new mode and changing element visibility for the new mode.
         *
         * If the requested mode is already the current mode, the mode
         * will be 'refreshed' by re-evaluating what elements are hidden &
         * shown.
         *
         * @param mode {string} A mode name
         */

    }, {
        key: 'switch_to_mode',
        value: function switch_to_mode(mode) {
            var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ANIMATION_DELAY;

            if (this.current_mode === Mode.TRANSFORM && mode === Mode.EDIT) {
                log.debug("Can't switch from transform to edit.");
                return this;
            }
            if (mode === this.current_mode && this.mode_stack.length > 0) {
                var state = this.mode_stack[this.mode_stack.length - 1];
                state.hidden = $('[data-ds-hide~="' + mode + '"]').hide(delay);
                state.shown = $('[data-ds-show~="' + mode + '"]').show(delay);
            } else {
                this._do_exit_mode(this.current_mode);
                this._do_enter_mode(mode);
            }
            return this;
        }
        /**
         * Toggle between the named mode and 'standard'. Return true if
         * we've switched to mode, otherwise false if we've switched back
         * to 'standard'.
         *
         * @param mode {string} A mode name
         * @return true if switched to mode, else false
         */

    }, {
        key: 'toggle_mode',
        value: function toggle_mode(mode) {
            if (this.current_mode == mode) {
                this.switch_to_mode(Mode.STANDARD);
                return false;
            } else {
                this.switch_to_mode(mode);
                return true;
            }
        }
        /**
         * Register handlers to run on entrance to and/or exit from an
         * application mode.
         *
         * @param options An object with one or both of 'enter' and 'exit'
         *                attributes bound to functions which will be run
         *                on mode transitions.
         */

    }, {
        key: 'add_mode_handler',
        value: function add_mode_handler(mode, options) {
            if (options.enter && options.enter instanceof Function) {
                _util.events.on(this, Event.MODE_ENTER + mode, options.enter);
            }
            if (options.exit && options.exit instanceof Function) {
                _util.events.on(this, Event.MODE_EXIT + mode, options.exit);
            }
            if (options.refresh && options.refresh instanceof Function) {
                _util.events.on(this, Event.MODE_REFRESH + mode, options.refresh);
            }
            return this;
        }
    }]);

    return Application;
}();

var instance = exports.instance = new Application();
/* Compatibility interface ------------------------------------------ */
function refresh_mode() {
    return instance.refresh_mode();
}
function switch_to_mode(mode) {
    var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ANIMATION_DELAY;

    return instance.switch_to_mode(mode, delay);
}
function toggle_mode(mode) {
    return instance.toggle_mode(mode);
}
function add_mode_handler(mode, options) {
    return instance.add_mode_handler(mode, options);
}
/* Miscellany ------------------------------------------------------- */
function uri(path) {
    return config.APPLICATION_ROOT ? config.APPLICATION_ROOT + path : path;
}
/**
 * Return a context object based on the current URL.
 */
function context(context) {
    context = context || {};
    var url = new URI(window.location);
    var params = url.query(true);
    var variables = {};
    context.from = params.from || config.DEFAULT_FROM_TIME;
    context.until = params.until;
    for (var key in params) {
        /* compatibility w/gdash params */
        if (key.indexOf('p[') == 0) {
            var name = key.slice(2, -1);
            variables[name] = params[key];
        } else {
            variables[key] = params[key];
        }
    }
    variables.path = url.path();
    context.path = url.path();
    context.variables = variables;
    context.params = params;
    return context;
}
function set_config(cfg) {
    exports.config = config = cfg;
}


},{"../util":88,"./config":2}],2:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var Config = function Config(data) {
    _classCallCheck(this, Config);

    this.PROPSHEET_AUTOCLOSE_SECONDS = 3;
    this.APPLICATION_ROOT = null;
    this.DEFAULT_FROM_TIME = '-3h';
    this.DISPLAY_TIMEZONE = 'Etc/UTC';
    this.GRAPHITE_AUTH = null;
    this.GRAPHITE_URL = 'http://localhost:8080';
    if (data) {
        this.PROPSHEET_AUTOCLOSE_SECONDS = data.PROPSHEET_AUTOCLOSE_SECONDS || this.PROPSHEET_AUTOCLOSE_SECONDS;
        this.APPLICATION_ROOT = data.APPLICATION_ROOT;
        this.DEFAULT_FROM_TIME = data.DEFAULT_FROM_TIME || this.DEFAULT_FROM_TIME;
        this.DISPLAY_TIMEZONE = data.DISPLAY_TIMEZONE || this.DISPLAY_TIMEZONE;
        this.GRAPHITE_AUTH = data.GRAPHITE_AUTH;
        this.GRAPHITE_URL = data.GRAPHITE_URL || this.GRAPHITE_URL;
    }
};



exports.default = Config;

},{}],3:[function(require,module,exports){
'use strict';

window.onbeforeunload = function (e) {
    if (ts.manager.current && ts.manager.current.dashboard.dirty) {
        var msg = 'Dashboard has unsaved changes. Are you sure you want to leave?';
        e.returnValue = msg;
        return msg;
    }
    return null;
};


},{}],4:[function(require,module,exports){
'use strict';

var _dashboard = require('../../models/dashboard');

var _dashboard2 = _interopRequireDefault(_dashboard);

var _manager = require('../manager');

var _manager2 = _interopRequireDefault(_manager);

var _factory = require('../../models/items/factory');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/*
 * Logic for the dashboard-create.html template.
 */
$(document).ready(function () {
    var tags = $('#ds-dashboard-tags');
    if (tags.length) {
        tags.tagsManager({
            tagsContainer: '.ds-tag-holder',
            tagClass: 'badge badge-primary'
        });
    }
});
$(document).ready(function () {
    var form = $('#ds-dashboard-create-form');
    if (form.length) {
        form.bootstrapValidator();
    }
});
$(document).on('click', '#ds-new-dashboard-create', function (e) {
    var title = $('#ds-dashboard-title')[0].value;
    var category = $('#ds-dashboard-category')[0].value;
    var summary = $('#ds-dashboard-summary')[0].value;
    var description = $('#ds-dashboard-description')[0].value;
    var tags = $('#ds-dashboard-tags').tagsManager('tags');
    if (!$('#ds-dashboard-create-form').data('bootstrapValidator').validate().isValid()) {
        return;
    }
    var dashboard = new _dashboard2.default({
        title: title,
        category: category,
        summary: summary,
        description: description,
        tags: tags,
        definition: (0, _factory.make)('dashboard_definition')
    });
    _manager2.default.create(dashboard, function (rsp) {
        window.location = rsp.data.view_href;
    });
});
$(document).on('click', '#ds-new-dashboard-cancel', function (e) {
    window.history.back();
});


},{"../../models/dashboard":37,"../../models/items/factory":52,"../manager":16}],5:[function(require,module,exports){
'use strict';

var _util = require('../../util');

var util = _interopRequireWildcard(_util);

var _app = require('../app');

var app = _interopRequireWildcard(_app);

var _manager = require('../manager');

var _manager2 = _interopRequireDefault(_manager);

var _factory = require('../../models/items/factory');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

/*
 * Logic for the dashboard-toolbar.html template.
 */
app.add_mode_handler('edit', {
    enter: function enter() {
        $(".ds-dashboard-info-edit-panel").html(ts.templates.edit.dashboard_panel(_manager2.default.current.dashboard));
        $('#ds-edit-info-button').addClass('active');
        $.fn.editable.defaults.mode = 'inline';
        /** Title */
        $("#ds-info-panel-edit-title").editable({
            unsavedclass: null,
            success: function success(ignore, newValue) {
                _manager2.default.current.dashboard.title = newValue;
                _manager2.default.update(_manager2.default.current.dashboard);
            }
        });
        /** Category */
        $("#ds-info-panel-edit-category").editable({
            unsavedclass: null,
            success: function success(ignore, newValue) {
                _manager2.default.current.dashboard.category = newValue;
                _manager2.default.update(_manager2.default.current.dashboard);
            }
        });
        $("#ds-info-panel-edit-summary").editable({
            unsavedclass: null,
            success: function success(ignore, newValue) {
                _manager2.default.current.dashboard.summary = newValue;
                _manager2.default.update(_manager2.default.current.dashboard);
            }
        });
        $("#ds-info-panel-edit-description").editable({
            unsavedclass: null,
            value: _manager2.default.current.dashboard.description || '',
            success: function success(ignore, newValue) {
                _manager2.default.current.dashboard.description = newValue;
                _manager2.default.update(_manager2.default.current.dashboard);
            },
            display: function display(value, response) {
                $(this).html(marked(value));
            }
        });
        var tags = _manager2.default.current.dashboard.tags || [];
        $("#ds-info-panel-edit-tags").tagsManager({
            hiddenTagListName: 'ds-info-panel-edit-taglist',
            tagClass: 'badge badge-primary',
            prefilled: tags.map(function (tag) {
                return tag.name;
            })
        });
        /**
         * Handler for tag changes. This gets run each time a complete tag
         * is added or removed.
         */
        $('[name="ds-info-panel-edit-taglist"]').on('change', function (e) {
            var tags = $('#ds-info-panel-edit-tags').tagsManager('tags');
            _manager2.default.current.dashboard.set_tags(tags);
            _manager2.default.update(_manager2.default.current.dashboard);
        });
    },
    exit: function exit() {
        $('#ds-edit-info-button').removeClass('active');
    }
});
$(document).ready(function () {
    /**
     * Handlers for the Info Edit panel.
     */
    $(document).on('click', '#ds-edit-info-button', function (e) {
        app.toggle_mode(app.Mode.EDIT);
    });
    $(document).on('click', '#ds-export-button', function (e) {
        var dashboard = _manager2.default.current.dashboard;
        var data = util.json(dashboard);
        /* scrub query data */
        var _iteratorNormalCompletion = true;
        var _didIteratorError = false;
        var _iteratorError = undefined;

        try {
            for (var _iterator = Object.keys(data.definition.queries)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
                var name = _step.value;

                var query = data.definition.queries[name];
                delete query.data;
                delete query.summation;
            }
        } catch (err) {
            _didIteratorError = true;
            _iteratorError = err;
        } finally {
            try {
                if (!_iteratorNormalCompletion && _iterator.return) {
                    _iterator.return();
                }
            } finally {
                if (_didIteratorError) {
                    throw _iteratorError;
                }
            }
        }

        var json = JSON.stringify(data, null, '  ');
        var blob = new Blob([json], { type: 'application/json;charset=utf-8' });
        var now = moment().format();
        window.saveAs(blob, dashboard.title + ' ' + now);
    });
    $(document).on('click', '#ds-toggle-interactive-button', function (e) {
        if (_manager2.default.toggle_interactive_charts()) {
            $('#ds-toggle-interactive-button').removeClass('active');
        } else {
            $('#ds-toggle-interactive-button').addClass('active');
        }
    });
    $(document).on('click', '#ds-enter-fullscreen-button', function (e) {
        app.switch_to_mode(app.Mode.DISPLAY);
    });
    $(document).on('click', '#ds-exit-display-mode-button', function (e) {
        app.switch_to_mode(app.Mode.STANDARD);
    });
    $(document).on('click', '#ds-delete-dashboard-button', function (e) {
        _manager2.default.delete_current();
    });
    $(document).on('click', '#ds-remove-transform-button', function (e) {
        _manager2.default.remove_transform();
    });
    $(document).on('click', '#ds-save-dashboard-button', function (e) {
        _manager2.default.update_definition(_manager2.default.current.dashboard, function () {
            _manager2.default.success('Dashboard saved');
        });
    });
    $(document).on('click', '#ds-new-section-button', function (e) {
        var dash = _manager2.default.current.dashboard;
        dash.definition.add((0, _factory.make)('section'));
        dash.update_index();
    });
    $(document).on('click', '#ds-view-dashboard-source-button', function (e) {
        var dashboard = _manager2.default.current.dashboard;
        var selector = '#ds-dashboard-source';
        var source_elt = $(selector);
        if (!source_elt.length) {
            ts.manager.client.dashboard_get(dashboard.href, { definition: true }).then(function (data) {
                var contents = '<div id="ds-dashboard-source" class="container">' + ts.templates.edit.item_source({ item: data }) + '</div>';
                $('.ds-dashboard').hide();
                $('#dashboard').append(contents);
            });
        } else {
            source_elt.remove();
            $('.ds-dashboard').show();
        }
    });
    $(document).on('click', '#ds-favorite-button', function (e) {
        var dashboard = _manager2.default.current.dashboard;
        if (ts.user.toggle_favorite(dashboard)) {
            $('#ds-favorite-button').html('<i class="fa fa-star"></i>').addClass('ds-favorited');
        } else {
            $('#ds-favorite-button').html('<i class="fa fa-star-o"></i>').removeClass('ds-favorited');
        }
    });
    $(document).on('click', '.ds-favorite-indicator', function (e) {
        var element = $(e.target).parent()[0];
        var href = element.getAttribute('data-ds-href');
        var d = ts.manager.find(href);
        if (d) {
            // TODO -- all this rendering code should be triggered by events
            // on the user model
            if (ts.user.toggle_favorite(d)) {
                $('[data-ds-href="' + d.href + '"].ds-favorite-indicator').html('<i class="fa fa-lg fa-star"></i>');
                $('[data-ds-href="' + d.href + '"]').addClass('ds-favorited');
                $('tr[data-ds-href="' + d.href + '"]').addClass('active');
            } else {
                $('[data-ds-href="' + d.href + '"].ds-favorite-indicator').html('<i class="fa fa-lg fa-star-o"></i>');
                $('[data-ds-href="' + d.href + '"]').removeClass('ds-favorited');
                $('tr[data-ds-href="' + d.href + '"]').removeClass('active');
            }
        }
    });
});


},{"../../models/items/factory":52,"../../util":88,"../app":1,"../manager":16}],6:[function(require,module,exports){
'use strict';

var _manager = require('../manager');

var _manager2 = _interopRequireDefault(_manager);

var _app = require('../app');

var app = _interopRequireWildcard(_app);

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

app.add_mode_handler('display', {
    enter: function enter() {
        /* Make sure the fullscreen range indicator is correct */
        var range = app.context();
        var description = _manager2.default.getRangeDescription(range.from);
        if (description) {
            $("a.ds-fullscreen-range-indicator").text(description);
        }
        /* Update the header to match the dashboard if it's fluid */
        var fluid = false;
        _manager2.default.current.dashboard.definition.visit(function (item) {
            if (item.layout === 'fluid') fluid = true;
        });
        if (fluid) {
            $('.ds-header-container').removeClass('container');
            $('.ds-header-container').addClass('container-fluid');
        }
    },
    exit: function exit() {
        $('.ds-header-container').removeClass('container-fluid');
        $('.ds-header-container').addClass('container');
    }
});


},{"../app":1,"../manager":16}],7:[function(require,module,exports){
'use strict';

var _util = require('../../util');

var util = _interopRequireWildcard(_util);

var _action = require('../../core/action');

var _action2 = _interopRequireDefault(_action);

var _manager = require('../manager');

var _manager2 = _interopRequireDefault(_manager);

var _app = require('../app');

var app = _interopRequireWildcard(_app);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

/**
 * Actions that operate on dashboards in the listing page, and the
 * handler to invoke them from the dashboard-list.html template.
 */
_action.actions.register('dashboard-list-actions', [new _action2.default({
    name: 'open',
    display: 'Open',
    icon: 'fa fa-external-link',
    handler: function handler(action, context) {
        window.location = context.view_href;
    }
}), new _action2.default({
    name: 'edit',
    display: 'Edit...',
    icon: 'fa fa-edit',
    handler: function handler(action, context) {
        var url = new URI(context.view_href).setQuery('mode', app.Mode.EDIT).href();
        window.location = url;
    }
}), new _action2.default({
    name: 'duplicate',
    display: 'Duplicate...',
    icon: 'fa fa-copy',
    handler: function handler(action, context) {
        _manager2.default.duplicate(context.href, function () {
            window.location.reload();
        });
    }
}), new _action2.default({
    name: 'export',
    display: 'Export...',
    icon: 'fa fa-download',
    handler: function handler(action, context) {
        _manager2.default.client.dashboard_get(context.href, { definition: true }).then(function (data) {
            var json = JSON.stringify(util.json(data), null, '  ');
            var blob = new Blob([json], { type: 'application/json;charset=utf-8' });
            var now = moment().format();
            window.saveAs(blob, data.title + ' ' + now);
        });
    }
}), _action2.default.DIVIDER, new _action2.default({
    name: 'delete',
    display: 'Delete...',
    icon: 'fa fa-trash-o',
    handler: function handler(action, context) {
        _manager2.default.delete_with_confirmation(context.href, function () {
            $('tr[data-ds-href="' + context.href + '"]').remove();
            _manager2.default.success('Succesfully deleted dashboard ' + context.href);
        });
    }
})]);
$(document).on('click', 'ul.ds-dashboard-action-menu li', function (event) {
    var element = $(event.target).parent().parent()[0];
    var context = {
        href: element.getAttribute('data-ds-href'),
        view_href: element.getAttribute('data-ds-view-href')
    };
    var action = _action.actions.get('dashboard-list-actions', this.getAttribute('data-ds-action'));
    action.handler(action, context);
});


},{"../../core/action":26,"../../util":88,"../app":1,"../manager":16}],8:[function(require,module,exports){
'use strict';

/**
 * Handlers for the sort menu in the dashboard-list.html template.a
 */
$(document).on('click', 'ul.ds-dashboard-sort-menu li', function (e) {
    var column = e.target.getAttribute('data-ds-sort-col');
    var order = e.target.getAttribute('data-ds-sort-order');
    var url = new URI(window.location);
    if (column) {
        url.setQuery('sort', column);
    }
    if (order) {
        url.setQuery('order', order);
    }
    window.location.href = url.href();
});
$(document).ready(function () {
    var params = new URI(window.location).search(true);
    if (params.sort !== 'default') {
        $('ul.ds-dashboard-sort-menu li').removeClass('active');
        $('[data-ds-sort-col="' + params.sort + '"][data-ds-sort-order="' + (params.order || 'asc') + '"]').parent().addClass('active');
    }
});


},{}],9:[function(require,module,exports){
'use strict';

var _manager = require('../manager');

var _manager2 = _interopRequireDefault(_manager);

var _action = require('../../core/action');

var _action2 = _interopRequireDefault(_action);

var _graphite = require('../../charts/graphite');

var graphite = _interopRequireWildcard(_graphite);

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

_action.actions.register('presentation-actions', [new _action2.default({
    name: 'view-query',
    display: 'View query...',
    icon: 'fa-question',
    handler: function handler(action, item) {
        var query = item.query_override || item.query;
        var expr = query.targets[0];
        var source = '### Query: ' + item.query.name + '\n\n```\n' + expr + '\n```\n';
        bootbox.alert(ts.templates.edit.view_query({ source: source }));
    }
}), new _action2.default({
    name: 'open-in-graphite',
    display: 'Open in Graphite...',
    icon: 'fa-bar-chart-o',
    handler: function handler(action, item) {
        var composer_url = graphite.composer_url(item, item.query_override || item.query, {
            showTitle: true
        });
        window.open(composer_url.href());
    }
}), new _action2.default({
    name: 'export-png',
    display: 'Export PNG...',
    icon: 'fa-file-image-o',
    handler: function handler(action, item) {
        var image_url = graphite.chart_url(item, item.query_override || item.query, {
            showTitle: true
        });
        window.open(image_url.href());
    }
}), new _action2.default({
    name: 'export-svg',
    display: 'Export SVG...',
    icon: 'fa-file-code-o',
    handler: function handler(action, item) {
        var image_url = graphite.chart_url(item, item.query_override || item.query, {
            showTitle: true,
            format: 'svg'
        });
        window.open(image_url.href());
    }
}), new _action2.default({
    name: 'export-csv',
    display: 'Export CSV...',
    icon: 'fa-file-excel-o',
    handler: function handler(action, item) {
        var image_url = graphite.chart_url(item, item.query_override || item.query, {
            showTitle: true,
            format: 'csv'
        });
        window.open(image_url.href());
    }
})]);
$(document).on('click', 'ul.ds-action-menu li', function (event) {
    var presentation_id = $(this).parent().parent().parent().parent().parent()[0].id;
    var item = _manager2.default.current.dashboard.get_item(presentation_id);
    var action = _action.actions.get(this.getAttribute('data-ds-category'), this.getAttribute('data-ds-action'));
    action.handler(action, item);
    /* prevents resetting scroll position */
    return false;
});


},{"../../charts/graphite":19,"../../core/action":26,"../manager":16}],10:[function(require,module,exports){
'use strict';

var _manager = require('../manager');

var _manager2 = _interopRequireDefault(_manager);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

$(document).on('click', 'button.ds-refresh-button', function (e) {
    _manager2.default.refresh();
});
$(document).on('click', 'ul.ds-refresh-menu li', function (e) {
    var target = $(e.target).parent();
    if (target.attr('data-ds-range')) {
        var range = target.attr('data-ds-range');
        _manager2.default.set_time_range(range, null);
        $("ul.ds-refresh-menu li[data-ds-range]").removeClass('active');
        $("ul.ds-refresh-menu li[data-ds-range=" + range + "]").addClass('active');
    } else if (target.attr('data-ds-interval')) {
        var interval = target.attr('data-ds-interval');
        _manager2.default.set_refresh_interval(interval);
        $("ul.ds-refresh-menu li[data-ds-interval]").removeClass('active');
        $("ul.ds-refresh-menu li[data-ds-interval=" + interval + "]").addClass('active');
    }
    return false;
});


},{"../manager":16}],11:[function(require,module,exports){
'use strict';

var _manager = require('../manager');

var _manager2 = _interopRequireDefault(_manager);

var _app = require('../app');

var app = _interopRequireWildcard(_app);

var _SimpleGrid = require('../../models/transform/SimpleGrid');

var _SimpleGrid2 = _interopRequireDefault(_SimpleGrid);

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

$(document).on('click', 'ul.ds-rejigger-menu li a', function (e) {
    var target = $(e.target).parent();
    var cols = target.attr('data-ds-cols');
    var section_type = target.attr('data-ds-section-type');
    var layout = new _SimpleGrid2.default({
        section_type: section_type,
        columns: cols
    });
    _manager2.default.apply_transform(layout, _manager2.default.current.dashboard, false);
    app.refresh_mode();
    return false;
});


},{"../../models/transform/SimpleGrid":81,"../app":1,"../manager":16}],12:[function(require,module,exports){
'use strict';

var _manager = require('../manager');

var _manager2 = _interopRequireDefault(_manager);

var _app = require('../app');

var app = _interopRequireWildcard(_app);

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var GRAPHITE_FORMAT = 'HH:mm_YYYYMMDD';
var self = {};
self.null_handler = function () {};
self.update_handler = function () {
    var from = $('#ds-range-picker-from').data("DateTimePicker").date();
    var until = $('#ds-range-picker-until').data("DateTimePicker").date();
    if (from && until) {
        /**
         * Disable the handler, because the picker will re-raise events
         * when being set programmatically after the dashboard loads,
         * leading to looping.
         */
        self.disable_handler();
        _manager2.default.set_time_range(from.utc().format(GRAPHITE_FORMAT), until.utc().format(GRAPHITE_FORMAT));
    }
};
self.handler = self.null_handler;
self.enable_handler = function () {
    self.handler = self.update_handler;
};
self.disable_handler = function () {
    self.handler = self.null_handler;
};
/**
 * Ensure that we can't end up with inverted time ranges (i.e. with
 * the 'from' time later than the 'until' time).
 */
$(document).on('dp.change', '#ds-range-picker-from', function (e) {
    var picker = $('#ds-range-picker-to').data('DateTimePicker');
    if (picker) {
        picker.minDate(e.date);
    }
});
$(document).on('dp.change', '#ds-range-picker-to', function (e) {
    var picker = $('#ds-range-picker-from').data('DateTimePicker');
    if (picker) {
        picker.maxDate(e.date);
    }
});
/**
 * Main event handler for responding to changes in the picker.
 */
$(document).on('dp.change', '#ds-range-picker-from, #ds-range-picker-until', function (e) {
    self.handler(e);
});
$(document).on('click', '.ds-recent-range-picker li, .ds-recent-range-picker a, .ds-custom-range-picker ul li, .ds-custom-range-picker ul li a', function (e) {
    var range = $(e.target).attr('data-ds-range');
    if (range === 'custom') {
        $('.ds-recent-range-picker').hide();
        $('.ds-custom-range-picker').show();
        var now = moment.utc().startOf('minute').tz(app.config.DISPLAY_TIMEZONE);
        now.minute(Math.round(now.minute() / 15) * 15); // quantize to 15-min interval
        var from_picker = $('#ds-range-picker-from').data("DateTimePicker");
        from_picker.date(now.clone().subtract(3, 'hours').tz(app.config.DISPLAY_TIMEZONE));
        var until_picker = $('#ds-range-picker-until').data("DateTimePicker");
        until_picker.date(now);
        until_picker.maxDate(now);
        from_picker.maxDate(now);
        self.enable_handler();
    } else if (range === 'recent') {
        self.disable_handler();
        $('.ds-custom-range-picker').hide();
        $('.ds-recent-range-picker').show();
    } else {
        self.disable_handler();
        _manager2.default.set_time_range(range, null);
    }
    return false;
});
$(document).ready(function () {
    var picker = $('.ds-custom-range-entry');
    if (picker.length) {
        $('.ds-custom-range-entry').datetimepicker({
            showTodayButton: true,
            widgetPositioning: {
                vertical: 'bottom',
                horizontal: 'right'
            },
            sideBySide: true,
            stepping: 15,
            icons: {
                time: 'fa fa-clock-o',
                date: 'fa fa-calendar-o',
                up: 'fa fa-chevron-up',
                down: 'fa fa-chevron-down'
            }
        });
    }
    _manager2.default.onDashboardLoaded(function () {
        var params = new URI(window.location).search(true);
        if (params.from && params.until) {
            // Initialise the range date pickers with the values from the URL query parameters
            // TODO - don't do this for relative specifiers
            $('#ds-range-picker-from').data("DateTimePicker").date(moment.utc(params.from, GRAPHITE_FORMAT));
            $('#ds-range-picker-until').data("DateTimePicker").date(moment.utc(params.until, GRAPHITE_FORMAT));
            $('.ds-recent-range-picker').hide();
            $('.ds-custom-range-picker').show();
            self.enable_handler();
        }
    });
});


},{"../app":1,"../manager":16}],13:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.register_helpers = register_helpers;

var _action = require('../core/action');

var _action2 = _interopRequireDefault(_action);

var _chart = require('../models/items/chart');

var _chart2 = _interopRequireDefault(_chart);

var _app = require('./app');

var app = _interopRequireWildcard(_app);

var _manager = require('./manager');

var _manager2 = _interopRequireDefault(_manager);

var _util = require('../util');

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var log = (0, _util.logger)('helpers');
/**
 * Hook up syntax highlighting to marked' markdown processor, so code
 * blocks will be highlighted.
 */
marked.setOptions({
    highlight: function highlight(code) {
        return hljs.highlightAuto(code).value;
    }
});
function register_helpers() {
    /**
     * Render markdown content to HTML.
     */
    Handlebars.registerHelper('markdown', function (value) {
        if (!value) return '';
        return new Handlebars.SafeString(marked(value));
    });
    /**
     * Render an object to syntax-highlighted JSON.
     */
    Handlebars.registerHelper('json', function (value) {
        return new Handlebars.SafeString(hljs.highlightAuto(JSON.stringify(value, null, '  ')).value);
    });
    /**
     * Format a datetime value in the timezone configured for the current
     * tessera user.
     */
    Handlebars.registerHelper('moment', function (format, value) {
        if (!value) return '';
        if (format == 'fromNow') {
            return moment(value).tz(app.config.DISPLAY_TIMEZONE).fromNow();
        } else {
            return moment(value).tz(app.config.DISPLAY_TIMEZONE).format(format);
        }
    });
    Handlebars.registerHelper('format', function (format, value) {
        if (typeof value === 'undefined') return '';
        if (!format) return value;
        try {
            return d3.format(format)(value);
        } catch (e) {
            log.error('Error formatting ' + format + ' / ' + value + ': ' + e.message);
            return value;
        }
    });
    /**
     * Fetch the list of dashboards with a given tag and return a Markdown
     * list of links to them.
     */
    Handlebars.registerHelper('dashboards-tagged', function (tag) {
        var markdown = '';
        $.ajax({
            url: app.uri('/api/dashboard/tagged/' + tag),
            type: 'GET',
            async: false,
            success: function success(data) {
                var _iteratorNormalCompletion = true;
                var _didIteratorError = false;
                var _iteratorError = undefined;

                try {
                    for (var _iterator = data[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
                        var d = _step.value;

                        markdown += '  * [';
                        if (d.category && d.category !== '') {
                            markdown += d.category + ': ';
                        }
                        markdown += d.title + '](';
                        markdown += d.view_href + ')\n';
                    }
                } catch (err) {
                    _didIteratorError = true;
                    _iteratorError = err;
                } finally {
                    try {
                        if (!_iteratorNormalCompletion && _iterator.return) {
                            _iterator.return();
                        }
                    } finally {
                        if (_didIteratorError) {
                            throw _iteratorError;
                        }
                    }
                }
            },
            error: function error() {
                var error = 'Unable to retrieve list of dashboards tagged "' + tag + '"';
                _manager2.default.warning(error);
                markdown = error;
            }
        });
        return new Handlebars.SafeString(markdown);
    });
    /**
     * Insert a referenced named query, for query re-use.
     */
    Handlebars.registerHelper('query', function (name) {
        var queries = ts.manager.current.dashboard.definition.queries;
        var query = queries[name] || {};
        var targets = query['targets'] || [];
        return new Handlebars.SafeString(targets[0]);
    });
    /* -----------------------------------------------------------------------------
       Internal helpers
       ----------------------------------------------------------------------------- */
    Handlebars.registerHelper('height', function (item) {
        var height = item.height;
        if (item instanceof _chart2.default && !height) {
            height = 2;
        }
        return height ? 'ds-height' + height : '';
    });
    Handlebars.registerHelper('span', function (item) {
        return item.span ? 'col-md-' + item.span : '';
    });
    Handlebars.registerHelper('offset', function (item) {
        return item.offset ? 'col-md-offset-' + item.offset : '';
    });
    Handlebars.registerHelper('css_class', function (item) {
        return item.css_class ? item.css_class : '';
    });
    Handlebars.registerHelper('container_class', function (item) {
        switch (item.layout) {
            case 'fixed':
                return 'container';
            case 'fluid':
                return 'container-fluid';
            default:
                return '';
        }
    });
    /**
     * Render the edit bar for any dashboard item.
     */
    Handlebars.registerHelper('ds-edit-bar', function (item) {
        var context = { item: item };
        var template = undefined;
        if (item.item_type === 'cell') {
            template = ts.templates["ds-edit-bar-cell"];
        } else if (item.item_type === 'row') {
            template = ts.templates["ds-edit-bar-row"];
        } else if (item.item_type === 'section') {
            template = ts.templates["ds-edit-bar-section"];
        } else if (item.item_type === 'dashboard_definition') {
            template = ts.templates["ds-edit-bar-definition"];
        } else {
            template = ts.templates["ds-edit-bar-item"];
        }
        return template ? new Handlebars.SafeString(template(context)) : '';
    });
    Handlebars.registerHelper('style_class', function (item) {
        if (item.style) {
            switch (item.style) {
                case 'well':
                    return 'well';
                case 'callout_neutral':
                    return 'bs-callout bs-callout-neutral';
                case 'callout_info':
                    return 'bs-callout bs-callout-info';
                case 'callout_success':
                    return 'bs-callout bs-callout-success';
                case 'callout_warning':
                    return 'bs-callout bs-callout-warning';
                case 'callout_danger':
                    return 'bs-callout bs-callout-danger';
                case 'alert_neutral':
                    return 'alert alert-neutral';
                case 'alert_info':
                    return 'alert alert-info';
                case 'alert_success':
                    return 'alert alert-success';
                case 'alert_warning':
                    return 'alert alert-warning';
                case 'alert_danger':
                    return 'alert alert-danger';
                default:
                    return '';
            }
        } else {
            return '';
        }
    });
    /**
     * Handlebars helper to render a dashboard item, by calling its
     * `render()` method.
     */
    Handlebars.registerHelper('item', function (item) {
        if (!item) return '';
        return new Handlebars.SafeString(item.render());
    });
    /**
     * Render an individual property for a property sheet.
     */
    Handlebars.registerHelper('interactive_property', function (property, item) {
        return new Handlebars.SafeString(property.render(item));
    });
    /**
     * Render a list of actions. The actions are selected by category from
     * the global actions registry (`ts.actions`), and can be rendered
     * either as a button bar or a dropdown.
     */
    Handlebars.registerHelper('actions', function (category, type) {
        var template = type === 'button' ? ts.templates.action_button : ts.templates.action;
        var actions = _action.actions.list(category);
        if (actions && actions.length) {
            if (typeof type === 'boolean' && type) {
                actions = actions.slice();
                actions.unshift(_action2.default.DIVIDER);
            }
            var html = '';
            var _iteratorNormalCompletion2 = true;
            var _didIteratorError2 = false;
            var _iteratorError2 = undefined;

            try {
                for (var _iterator2 = actions[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
                    var action = _step2.value;

                    if (!action) continue;
                    var tmpl = template;
                    if (action.actions) {
                        tmpl = ts.templates["action-menu-button"];
                    }
                    html += tmpl({
                        category: category,
                        action: action
                    });
                }
            } catch (err) {
                _didIteratorError2 = true;
                _iteratorError2 = err;
            } finally {
                try {
                    if (!_iteratorNormalCompletion2 && _iterator2.return) {
                        _iterator2.return();
                    }
                } finally {
                    if (_didIteratorError2) {
                        throw _iteratorError2;
                    }
                }
            }

            return new Handlebars.SafeString(html);
        } else {
            return '';
        }
    });
}


},{"../core/action":26,"../models/items/chart":44,"../util":88,"./app":1,"./manager":16}],14:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _app = require('./app');

Object.defineProperty(exports, 'Event', {
  enumerable: true,
  get: function get() {
    return _app.Event;
  }
});
Object.defineProperty(exports, 'Mode', {
  enumerable: true,
  get: function get() {
    return _app.Mode;
  }
});
Object.defineProperty(exports, 'Application', {
  enumerable: true,
  get: function get() {
    return _app.Application;
  }
});
Object.defineProperty(exports, 'instance', {
  enumerable: true,
  get: function get() {
    return _app.instance;
  }
});
Object.defineProperty(exports, 'uri', {
  enumerable: true,
  get: function get() {
    return _app.uri;
  }
});
Object.defineProperty(exports, 'context', {
  enumerable: true,
  get: function get() {
    return _app.context;
  }
});
Object.defineProperty(exports, 'config', {
  enumerable: true,
  get: function get() {
    return _app.config;
  }
});
Object.defineProperty(exports, 'refresh_mode', {
  enumerable: true,
  get: function get() {
    return _app.refresh_mode;
  }
});
Object.defineProperty(exports, 'switch_to_mode', {
  enumerable: true,
  get: function get() {
    return _app.switch_to_mode;
  }
});
Object.defineProperty(exports, 'toggle_mode', {
  enumerable: true,
  get: function get() {
    return _app.toggle_mode;
  }
});
Object.defineProperty(exports, 'add_mode_handler', {
  enumerable: true,
  get: function get() {
    return _app.add_mode_handler;
  }
});

var _manager = require('./manager');

Object.defineProperty(exports, 'manager', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_manager).default;
  }
});

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

},{"./app":1,"./manager":16}],15:[function(require,module,exports){
'use strict';

var _app = require('./app');

var app = _interopRequireWildcard(_app);

var _manager = require('./manager');

var _manager2 = _interopRequireDefault(_manager);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

/* =============================================================================
   Keyboard Shortcuts
   ============================================================================= */
Mousetrap.bind('ctrl+shift+d', function (e) {
    app.toggle_mode(app.Mode.DISPLAY);
});
Mousetrap.bind('ctrl+shift+e', function (e) {
    app.toggle_mode(app.Mode.EDIT);
});
Mousetrap.bind('ctrl+shift+s', function (e) {
    _manager2.default.update_definition(_manager2.default.current.dashboard, function () {
        _manager2.default.success('Dashboard saved');
    });
});


},{"./app":1,"./manager":16}],16:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.Manager = undefined;

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); //
// TODO - all of this needs refactoring
//


var _util = require('../util');

var _app = require('./app');

var app = _interopRequireWildcard(_app);

var _core = require('../charts/core');

var charts = _interopRequireWildcard(_core);

var _client = require('../client');

var _client2 = _interopRequireDefault(_client);

var _dashboard = require('../models/dashboard');

var _dashboard2 = _interopRequireDefault(_dashboard);

var _item = require('../models/items/item');

var _item2 = _interopRequireDefault(_item);

var _container = require('../models/items/container');

var _container2 = _interopRequireDefault(_container);

var _query = require('../models/data/query');

var _query2 = _interopRequireDefault(_query);

var _transform = require('../models/transform/transform');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var log = (0, _util.logger)('manager');
var axios = require('axios');

var DashboardHolder = function () {
    function DashboardHolder(url, element) {
        _classCallCheck(this, DashboardHolder);

        this.url = url;
        this.element = element;
        this.dashboard = null;
    }

    _createClass(DashboardHolder, [{
        key: 'setRange',
        value: function setRange(from, until) {
            var url = new URI(this.url);
            if (from) {
                url.setQuery('from', from);
            }
            if (until) {
                url.setQuery('until', until);
            }
            this.url = url.href();
        }
    }]);

    return DashboardHolder;
}();

var Manager = exports.Manager = function () {
    function Manager(client) {
        _classCallCheck(this, Manager);

        this.intervalId = null;
        this.client = client ? client : new _client2.default();
    }

    _createClass(Manager, [{
        key: 'set_current',
        value: function set_current(value) {
            this.current = value;
            return this;
        }
    }, {
        key: 'find',
        value: function find(href) {
            if (!this.current_list) return null;
            return this.current_list.find(function (d) {
                return d.href === href;
            });
        }
        /**
         * Register an event handler for processing a dashboard once it's
         * loaded and ready.
         */

    }, {
        key: 'onDashboardLoaded',
        value: function onDashboardLoaded(handler) {
            _util.events.on(this, app.Event.DASHBOARD_LOADED, handler);
            return this;
        }
        /**
         * List all dashboards.
         */

    }, {
        key: 'list',
        value: function list(path, handler) {
            var _this = this;

            this.client.dashboard_list({ path: path }).then(handler).catch(function (error) {
                _this.error('Error listing dashboards. ' + error);
            });
        }
        // Web Components. I want Web Components. TBD.

    }, {
        key: 'render_dashboard_list',
        value: function render_dashboard_list(path, element, handler) {
            var _this2 = this;

            var mgr = this;
            var fn = function fn(data) {
                if (data && data.length) {
                    _this2.current_list = data;
                    if (handler) {
                        handler(data);
                    }
                    $(element).html(ts.templates.listing.dashboard_list({ dashboards: data }));
                    ts.user.list_favorites().forEach(function (d) {
                        $('[data-ds-href="' + d.href + '"].ds-favorite-indicator').html('<i class="fa fa-lg fa-star"></i>');
                        $('[data-ds-href="' + d.href + '"]').addClass('ds-favorited');
                        $('tr[data-ds-href="' + d.href + '"]').addClass('active');
                    });
                }
            };
            if (path instanceof Array) {
                fn(path);
            } else {
                this.list(path, fn);
            }
        }
    }, {
        key: 'default_error_handler',
        value: function default_error_handler(xhr, status, error) {
            console.log(xhr);
            console.log(status);
            console.log(error);
        }
    }, {
        key: 'error',
        value: function error(message) {
            var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

            options.type = options.type || 'danger';
            $.notify({
                message: message,
                title: 'Error',
                icon: 'fa fa-exclamation-circle'
            }, options);
        }
    }, {
        key: 'warning',
        value: function warning(message) {
            var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

            options.type = options.type || 'warning';
            $.notify({
                message: message,
                title: options.title || 'Warning',
                icon: options.icon || 'fa fa-exclamation-circle'
            }, options);
        }
    }, {
        key: 'success',
        value: function success(message) {
            var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

            options.type = options.type || 'success';
            $.notify({
                message: message,
                title: options.title || 'Success',
                icon: options.icon || 'fa fa-check-circle'
            }, options);
        }
        /**
         * Set up us the API call.
         */

    }, {
        key: '_prep_url',
        value: function _prep_url(base_url, options) {
            var url = new URI(base_url).setQuery('rendering', true);
            var context = app.context(url.query(true));
            context.from = options.from || context.from;
            context.until = context.until || options.until;
            url.setQuery('from', context.from);
            if (context.until) {
                url.setQuery('until', context.until);
            }
            context.url = url.href();
            if (typeof options.interactive != 'undefined') {
                context.interactive = options.interactive;
            } else if (context.params.interactive) {
                context.interactive = context.params.interactive != 'false';
            }
            return context;
        }
    }, {
        key: 'cleanup',
        value: function cleanup() {
            if (this.current && this.current.dashboard) {
                this.current.dashboard.visit(function (item) {
                    return item.cleanup();
                });
            }
        }
        /**
         * Load and render a dashboard.
         */

    }, {
        key: 'load',
        value: function load(url, element) {
            var _this3 = this;

            var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

            log.debug('load(): ' + url);
            this.cleanup();
            var holder = new DashboardHolder(url, element);
            var context = this._prep_url(url, options);
            this.set_current(holder);
            axios.get(context.url).catch(function (error) {
                return _this3.error('Error loading dashboard. ' + error);
            }).then(function (response) {
                var dashboard = new _dashboard2.default(response.data);
                holder.dashboard = dashboard;
                var r = context.variables.renderer || response.data.preferences.renderer;
                if (typeof context.variables.interactive != 'undefined') {
                    r = context.variables.interactive === 'false' ? 'graphite' : 'flot';
                }
                if (r) {
                    charts.set_renderer(r);
                }
                _util.events.fire(_this3, app.Event.DASHBOARD_LOADED, dashboard);
                // Expand any templatized queries or dashboard items
                dashboard.render_templates(context.variables);
                // Render the dashboard
                $(element).html(dashboard.definition.render());
                var currentURL = new URI(holder.url);
                _util.events.fire(_this3, app.Event.RANGE_CHANGED, {
                    from: currentURL.query('from'),
                    until: currentURL.query('until')
                });
                if (_this3.current_transform) {
                    _this3.apply_transform(_this3.current_transform.transform, _this3.current_transform.target, false, context);
                } else {
                    // Load the queries
                    dashboard.definition.load_all({
                        from: context.from,
                        until: context.until
                    });
                }
                _util.events.fire(_this3, app.Event.DASHBOARD_RENDERED, dashboard);
                if (context.params.mode) {
                    app.switch_to_mode(context.params.mode);
                } else {
                    app.refresh_mode();
                }
            });
            return this;
        }
        /**
         * Re-render a dashboard item and update its DOM representation.
         */

    }, {
        key: 'update_item_view',
        value: function update_item_view(item) {
            var element = $('#' + item.item_id);
            // REFACTOR - unchecked global reference
            var visible = ts.edit.details_visibility(item);
            element.replaceWith(item.render());
            if (visible) {
                // REFACTOR - unchecked global reference
                ts.edit.show_details(item.item_id);
            }
            item.visit(function (i) {
                var query = i.query_override || i.query;
                if (query && query instanceof _query2.default) {
                    log.debug('update_item_view(): reloading query ' + query.name);
                    query.load();
                }
            });
            app.refresh_mode();
        }
        /**
         * Execute a function with re-rendering of the DOM for dashboard
         * items disabled.
         */

    }, {
        key: 'without_updates',
        value: function without_updates(handler) {
            var fn = Manager.prototype.update_item_view;
            Manager.prototype.update_item_view = function () {};
            try {
                return handler();
            } finally {
                Manager.prototype.update_item_view = fn;
            }
        }
    }, {
        key: 'handle_popstate',
        value: function handle_popstate(event) {
            if (!event.state) {
                this.current_transform = undefined;
                this.refresh();
                app.switch_to_mode('standard');
            } else {
                if (event.state.transform) {
                    var item = this.current.dashboard.get_item(event.state.target.item_id);
                    this.apply_transform(event.state.transform.name, item, false);
                } else if (event.state.url) {
                    this.current_transform = undefined;
                    this.refresh();
                    app.switch_to_mode('standard');
                }
            }
        }
    }, {
        key: 'remove_transform',
        value: function remove_transform() {
            if (this.current && this.current_transform) {
                window.location = new URI(window.location).path(this.current.dashboard.view_href).href();
                this.current_transform = undefined;
            }
            return this;
        }
    }, {
        key: 'apply_transform',
        value: function apply_transform(transform, target) {
            var set_location = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
            var context = arguments[3];

            var dashboard = this.current.dashboard;
            if (typeof transform === 'string') transform = _transform.transforms.get(transform);
            log.debug('apply_transform(' + transform.name + ')');
            if (transform.transform_type == 'dashboard' && typeof target === 'undefined') {
                target = dashboard.definition;
            }
            /**
             * Set browser URL state
             */
            if (set_location) {
                var url = new URI(window.location);
                if (target.item_type != 'dashboard_definition') {
                    url.segment(target.item_id.toString());
                }
                url.segment('transform').segment(transform.name);
                window.history.pushState({ url: this.current.url,
                    element: this.current.element,
                    transform: transform.toJSON(),
                    target: target.toJSON() }, '', url.href());
            }
            /**
             * update_item_view() reloads queries, which we don't want to do
             * while processing the transform.
             */
            var result = this.without_updates(function () {
                return transform.transform(target);
            });
            result.visit(function (item) {
                item.set_dashboard(dashboard);
            });
            dashboard.definition.queries = result.get_queries(); // this could go in an observer
            dashboard.set_items([result]);
            $('#' + dashboard.definition.item_id).replaceWith(dashboard.render());
            dashboard.render_templates(app.context().variables);
            if (context) {
                dashboard.load_all({
                    from: context.from,
                    until: context.until
                });
            } else {
                dashboard.load_all();
            }
            if (transform.transform_type === 'presentation' && app.instance.current_mode != app.Mode.EDIT) {
                app.switch_to_mode('transform');
                this.current_transform = {
                    transform: transform,
                    target: target
                };
            }
            dashboard.dirty = false;
            return this;
        }
    }, {
        key: 'refresh',
        value: function refresh() {
            log.debug('refresh()');
            if (this.current && app.instance.current_mode != app.Mode.EDIT) {
                this.load(this.current.url, this.current.element);
            } else {
                log.debug('skipping reload; current mode: ' + app.instance.current_mode);
            }
        }
        // Definitely getting to the point we need some kind of reactive MVC
        // here

    }, {
        key: 'toggle_interactive_charts',
        value: function toggle_interactive_charts() {
            var _this4 = this;

            this.client.preferences_get().then(function (prefs) {
                var setting = prefs.renderer !== 'flot';
                var dashboard_url = new URI(_this4.current.url);
                var window_url = new URI(window.location);
                if (window_url.hasQuery('interactive', 'true')) {
                    setting = false;
                } else if (window_url.hasQuery('interactive', 'false')) {
                    setting = true;
                }
                dashboard_url.setQuery('interactive', setting);
                window_url.setQuery('interactive', setting);
                _this4.current.url = dashboard_url.href();
                window.history.pushState({ url: _this4.current.url, element: _this4.current.element }, '', window_url.href());
                _this4.refresh();
                return setting;
            });
        }
        /* -----------------------------------------------------------------------------
           Time range and auto-refresh
           ----------------------------------------------------------------------------- */

    }, {
        key: 'set_time_range',
        value: function set_time_range(from, until) {
            var uri = new URI(window.location);
            from ? uri.setQuery('from', from) : uri.removeQuery('from');
            until ? uri.setQuery('until', until) : uri.removeQuery('until');
            window.history.pushState({ url: this.current.url, element: this.current.element }, '', uri.href());
            this.current.setRange(from, until);
            _util.events.fire(this, app.Event.RANGE_CHANGED, {
                from: from, until: until
            });
            this.refresh();
        }
    }, {
        key: 'getRangeDescription',
        value: function getRangeDescription(range) {
            if (range in Manager.ranges) {
                return Manager.ranges[range];
            } else {
                return null;
            }
        }
    }, {
        key: 'onRangeChanged',
        value: function onRangeChanged(handler) {
            _util.events.on(this, app.Event.RANGE_CHANGED, handler);
        }
    }, {
        key: 'set_refresh_interval',
        value: function set_refresh_interval(value) {
            var _this5 = this;

            var intervalSeconds = parseInt(value);
            this.autoRefreshInterval = intervalSeconds;
            if (this.intervalId) {
                log.debug('clearing auto-refresh interval; intervalId: ' + this.intervalId);
                window.clearInterval(this.intervalId);
                this.intervalId = undefined;
            }
            if (intervalSeconds > 0) {
                this.intervalSeconds = intervalSeconds;
                this.intervalId = window.setInterval(function () {
                    _this5.refresh();
                }, intervalSeconds * 1000);
                log.debug('set auto-refresh interval; intervalId: ' + this.intervalId + '; seconds: ' + intervalSeconds);
            }
        }
    }, {
        key: 'delete_with_confirmation',
        value: function delete_with_confirmation(href, handler) {
            var _this6 = this;

            bootbox.dialog({
                message: "Are you really sure you want to delete this dashboard? Deletion is irrevocable.",
                title: "Confirm dashboard delete",
                backdrop: false,
                buttons: {
                    cancel: {
                        label: "Cancel",
                        className: "btn-default",
                        callback: function callback() {
                            // TODO - notification
                        }
                    },
                    confirm: {
                        label: "Delete",
                        className: "btn-danger",
                        callback: function callback() {
                            _this6.delete_dashboard(href, handler);
                        }
                    }
                }
            });
        }
    }, {
        key: 'delete_dashboard',
        value: function delete_dashboard(href, handler) {
            var _this7 = this;

            var done = handler || function () {
                window.location.href = '/dashboards';
                _this7.success('Successfully deleted dashboard ' + href);
            };
            this.client.dashboard_delete(href).then(done).catch(function (error) {
                _this7.error('Error deleting dashboard ' + href + '. ' + error);
            });
        }
    }, {
        key: 'delete_current',
        value: function delete_current() {
            this.delete_with_confirmation(this.current.dashboard.href);
        }
    }, {
        key: 'create',
        value: function create(input, handler) {
            var _this8 = this;

            var dashboard = null;
            if (typeof input === 'string') {
                var json = JSON.parse(input);
                dashboard = new _dashboard2.default(json);
            } else if (input instanceof _dashboard2.default) {
                dashboard = input;
            } else {
                dashboard = new _dashboard2.default(input);
            }
            this.client.dashboard_create(dashboard).then(handler).catch(function (error) {
                _this8.error('Error creating dashboard. ' + error);
            });
        }
    }, {
        key: 'update',
        value: function update(dashboard, handler) {
            var _this9 = this;

            this.client.dashboard_update(dashboard).then(handler).then(function () {
                dashboard.dirty = false;
            }).catch(function (error) {
                _this9.error('Error updating dashboard ' + dashboard.title + '. ' + error);
            });
        }
    }, {
        key: 'update_definition',
        value: function update_definition(dashboard, handler) {
            var _this10 = this;

            if (app.instance.current_mode === app.Mode.TRANSFORM) {
                this.warning('Unable to save dashboad while a transform is applied.\nRevert to standard mode in order to save changes.');
                return;
            }
            this.client.dashboard_update_definition(dashboard).then(handler).then(function () {
                dashboard.dirty = false;
            }).catch(function (error) {
                _this10.error('Error updating dashboard definition ' + dashboard.title + '. ' + error);
            });
        }
    }, {
        key: 'duplicate',
        value: function duplicate(href, handler) {
            var _this11 = this;

            var error_handler = function error_handler(error) {
                _this11.error('Error duplicating dashboard ' + href + '. ' + error);
            };
            this.client.dashboard_get(href, { definition: true }).then(function (db) {
                db.title = 'Copy of ' + db.title;
                db.id = null;
                _this11.client.dashboard_create(db).then(handler).catch(error_handler);
            }).catch(error_handler);
        }
    }]);

    return Manager;
}();

Manager.ranges = {
    // TODO - quick hack. Parse the range and generate on the fly
    // for maximum flexibiliy
    '-1h': 'Past Hour',
    '-2h': 'Past 2 Hours',
    '-3h': 'Past 3 Hours',
    '-4h': 'Past 4 Hours',
    '-6h': 'Past 6 Hours',
    '-12h': 'Past 12 Hours',
    '-1d': 'Past Day',
    '-7d': 'Past Week'
};
var manager = new Manager();
_util.events.on(_item2.default, 'update', function (e) {
    if (!e || !e.target) {
        log.warn('on:DashboardItem.update: item not bound');
    } else {
        var item = e.target;
        log.debug('on:DashboardItem.update: ' + item.item_type + ' / ' + item.item_id);
        if (item instanceof _container2.default && manager.current) {
            manager.current.dashboard.update_index();
        }
        manager.update_item_view(item);
    }
});
window.addEventListener('popstate', function (e) {
    manager.handle_popstate(e);
});
app.add_mode_handler(app.Mode.STANDARD, {
    enter: function enter() {
        manager.remove_transform();
    }
});
exports.default = manager;


},{"../charts/core":17,"../client":25,"../models/dashboard":37,"../models/data/query":38,"../models/items/container":48,"../models/items/item":54,"../models/transform/transform":84,"../util":88,"./app":1,"axios":93}],17:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.renderer = exports.renderers = exports.ChartRenderer = exports.StackMode = exports.DEFAULT_PALETTE = undefined;

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

exports.set_renderer = set_renderer;
exports.get_renderer = get_renderer;
exports.simple_line_chart = simple_line_chart;
exports.standard_line_chart = standard_line_chart;
exports.simple_area_chart = simple_area_chart;
exports.stacked_area_chart = stacked_area_chart;
exports.donut_chart = donut_chart;
exports.bar_chart = bar_chart;
exports.discrete_bar_chart = discrete_bar_chart;
exports.scatter_plot = scatter_plot;
exports.process_series = process_series;
exports.process_data = process_data;
exports.cleanup = cleanup;

var _util = require('../util');

var _item = require('../models/items/item');

var _item2 = _interopRequireDefault(_item);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var DEFAULT_PALETTE = exports.DEFAULT_PALETTE = 'spectrum6';
var log = (0, _util.logger)('charts');
var StackMode = exports.StackMode = {
    NONE: 'none',
    NORMAL: 'stack',
    PERCENT: 'percent',
    STREAM: 'stream'
};

var ChartRenderer = exports.ChartRenderer = function () {
    function ChartRenderer(data) {
        _classCallCheck(this, ChartRenderer);

        if (data) {
            this.name = data.name;
            this.is_interactive = !!data.is_interactive;
            this.description = data.description;
        }
    }

    _createClass(ChartRenderer, [{
        key: 'simple_line_chart',
        value: function simple_line_chart(selector, item, query) {}
    }, {
        key: 'standard_line_chart',
        value: function standard_line_chart(selector, item, query) {}
    }, {
        key: 'simple_area_chart',
        value: function simple_area_chart(selector, item, query) {}
    }, {
        key: 'stacked_area_chart',
        value: function stacked_area_chart(selector, item, query) {}
    }, {
        key: 'donut_chart',
        value: function donut_chart(selector, item, query) {}
    }, {
        key: 'bar_chart',
        value: function bar_chart(selector, item, query) {}
    }, {
        key: 'discrete_bar_chart',
        value: function discrete_bar_chart(selector, item, query) {}
    }, {
        key: 'scatter_plot',
        value: function scatter_plot(selector, item, query) {}
    }, {
        key: 'highlight_series',
        value: function highlight_series(item, index) {}
    }, {
        key: 'unhighlight_series',
        value: function unhighlight_series(item, index) {}
    }, {
        key: 'cleanup',
        value: function cleanup(item) {}
    }, {
        key: 'process_series',
        value: function process_series(series) {
            return series;
        }
    }, {
        key: 'process_data',
        value: function process_data(data) {
            var _this = this;

            if (!data) {
                return [];
            }
            if (data instanceof Array) {
                return data.map(function (series) {
                    return _this.process_series(series);
                });
            } else {
                return [this.process_series(data)];
            }
        }
    }]);

    return ChartRenderer;
}();

var renderers = exports.renderers = new _util.Registry({
    name: 'chart-renderers'
});
var renderer = exports.renderer = undefined;
function set_renderer(r) {
    log.debug('set_renderer(): ' + r);
    if (typeof r === 'string') {
        var _renderer = renderers.get(r);
        if (!_renderer) {
            log.error('Unknown renderer ' + r);
        } else {
            exports.renderer = renderer = _renderer;
        }
    } else {
        exports.renderer = renderer = r;
    }
}
/* =============================================================================
   Global delegates
   ============================================================================= */
function get_renderer(item) {
    if (!item) {
        return renderer;
    }
    var name = undefined;
    if (typeof item === 'string') {
        name = item;
    } else {
        name = item['renderer'];
    }
    if (item instanceof _item2.default) {
        if (!name && item.dashboard && item.dashboard.definition) {
            name = item.dashboard.definition.renderer;
        }
    }
    return renderers.get(name) || renderer;
}
function simple_line_chart(selector, item, query) {
    var r = get_renderer(item);
    if (r) {
        r.simple_line_chart(selector, item, query);
    }
}
function standard_line_chart(selector, item, query) {
    var r = get_renderer(item);
    if (r) {
        r.standard_line_chart(selector, item, query);
    }
}
function simple_area_chart(selector, item, query) {
    var r = get_renderer(item);
    if (r) {
        r.simple_area_chart(selector, item, query);
    }
}
function stacked_area_chart(selector, item, query) {
    var r = get_renderer(item);
    if (r) {
        r.stacked_area_chart(selector, item, query);
    }
}
function donut_chart(selector, item, query) {
    var r = get_renderer(item);
    if (r) {
        r.donut_chart(selector, item, query);
    }
}
function bar_chart(selector, item, query) {
    var r = get_renderer(item);
    if (r) {
        r.bar_chart(selector, item, query);
    }
}
function discrete_bar_chart(selector, item, query) {
    var r = get_renderer(item);
    if (r) {
        r.discrete_bar_chart(selector, item, query);
    }
}
function scatter_plot(selector, item, query) {
    var r = get_renderer(item);
    if (r) {
        r.scatter_plot(selector, item, query);
    }
}
function process_series(series, type) {
    var r = get_renderer(type);
    return r ? r.process_series(series) : series;
}
function process_data(data, type) {
    var r = get_renderer(type);
    return r ? r.process_data(data) : data;
}
function cleanup(item) {
    var r = get_renderer(item);
    if (r) {
        r.cleanup(item);
    }
}


},{"../models/items/item":54,"../util":88}],18:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _core = require('./core');

var charts = _interopRequireWildcard(_core);

var _items = require('../models/items');

var _axis = require('../models/axis');

var _util = require('./util');

var _util2 = require('../util');

var _app = require('../app/app');

var app = _interopRequireWildcard(_app);

var _legend = require('./legend');

var _xychart = require('../models/items/xychart');

var _xychart2 = _interopRequireDefault(_xychart);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var log = (0, _util2.logger)('charts.flot');
/* =============================================================================
   Helpers
   ============================================================================= */
var FORMAT_STRING_STANDARD = ',.3s';
var FORMAT_STANDARD = d3.format(FORMAT_STRING_STANDARD);
var FORMAT_PERCENT = d3.format('%');
var THREE_HOURS_MS = 1000 * 60 * 60 * 3;
var ONE_HOUR_MS = 1000 * 60 * 60 * 1;
var DEFAULT_LINE_WIDTH = 1.0;
var DEFAULT_FILL = 0.8;
function is_line_chart(item) {
    return item instanceof _items.StandardTimeSeries && item.stack_mode === charts.StackMode.NONE;
}
function is_area_chart(item) {
    return item instanceof _items.StandardTimeSeries && item.stack_mode !== charts.StackMode.NONE && item.stack_mode !== charts.StackMode.PERCENT;
}
function get_default_options() {
    var theme_colors = (0, _util.get_colors)();
    var default_options = {
        colors: (0, _util.get_palette)(),
        downsample: false,
        series: {
            lines: {
                show: true,
                lineWidth: ts.prefs.line_width || DEFAULT_LINE_WIDTH,
                steps: false,
                fill: false
            },
            valueLabels: { show: false },
            points: {
                show: false,
                fill: true,
                radius: 2,
                symbol: "circle"
            },
            bars: { lineWidth: ts.prefs.line_width || DEFAULT_LINE_WIDTH, show: false },
            stackD3: { show: false }
        },
        xaxis: {
            mode: "time",
            tickFormatter: function tickFormatter(value, axis) {
                // Take care of time series axis
                if (axis.tickSize && axis.tickSize.length === 2) {
                    if (axis.tickSize[1] === 'year' && axis.tickSize[0] >= 1) return moment(value).tz(app.config.DISPLAY_TIMEZONE).format('YYYY');
                    if (axis.tickSize[1] === 'month' && axis.tickSize[0] >= 1 || axis.tickSize[1] === 'year') return moment(value).tz(app.config.DISPLAY_TIMEZONE).format('MM-\'YY');
                    if (axis.tickSize[1] === 'day' && axis.tickSize[0] >= 1 || axis.tickSize[1] === 'month') return moment(value).tz(app.config.DISPLAY_TIMEZONE).format('MM/DD');
                    if (axis.tickSize[1] === 'hour' && axis.tickSize[0] >= 12) return moment(value).tz(app.config.DISPLAY_TIMEZONE).format('MM/DD hA');
                }
                return moment(value).tz(app.config.DISPLAY_TIMEZONE).format('h:mm A');
            },
            tickColor: theme_colors.minorGridLineColor,
            font: {
                color: theme_colors.fgcolor,
                size: 12
            }
        },
        yaxes: [{
            position: 'left',
            tickFormatter: FORMAT_STANDARD,
            reserveSpace: 30,
            labelWidth: 30,
            tickColor: theme_colors.minorGridLineColor,
            font: {
                color: theme_colors.fgcolor,
                size: 12
            }
        }, {
            position: 'right',
            tickFormatter: FORMAT_STANDARD,
            font: {
                color: theme_colors.fgcolor,
                size: 12
            }
        }],
        shadowSize: 0,
        legend: { show: false },
        grid: {
            borderWidth: 1,
            hoverable: true,
            clickable: true,
            autoHighlight: false,
            /* grid.color actually sets the color of the legend
             * text. WTH? */
            color: theme_colors.fgcolor,
            borderColor: theme_colors.minorGridLineColor
        },
        selection: {
            mode: "x",
            color: "red"
        },
        multihighlight: {
            mode: "x"
        },
        crosshair: {
            mode: "x",
            color: "#BBB",
            lineWidth: 1
        }
    };
    return default_options;
}
function log_transform(v) {
    return v === 0 ? v : Math.log1p(Math.abs(v)) / Math.LN10;
}
function get_flot_options(item, base) {
    var options = item.options || {};
    var flot_options = (0, _util2.extend)(true, {}, get_default_options(), base);
    flot_options.colors = (0, _util.get_palette)(options.palette);
    if (options.y1 && options.y1.min) flot_options.yaxes[0].min = options.y1.min;
    if (options.y2 && options.y2.min) flot_options.yaxes[1].min = options.y2.min;
    if (options.y1 && options.y1.max) flot_options.yaxes[0].max = options.y1.max;
    if (options.y2 && options.y2.max) flot_options.yaxes[1].max = options.y2.max;
    if (options.y1 && options.y1.label) flot_options.yaxes[0].axisLabel = options.y1.label;
    if (options.y2 && options.y2.label) flot_options.yaxes[1].axisLabel = options.y2.label;
    if (options.y1 && options.y1.scale === _axis.AxisScale.LOG) {
        flot_options.yaxes[0].transform = log_transform;
    }
    if (options.y2 && options.y2.scale === _axis.AxisScale.LOG) {
        flot_options.yaxes[1].transform = log_transform;
    }
    if (options.x && options.x.label) {
        flot_options.xaxis.axisLabel = options.x.label;
    }
    if (item.show_max_value || item.show_min_value || item.show_last_value) {
        flot_options.series.valueLabels = {
            show: true,
            showMaxValue: item.show_max_value,
            showMinValue: item.show_min_value,
            showLastValue: item.show_last_value,
            showAsHtml: true,
            labelFormatter: FORMAT_STANDARD,
            yoffset: -20
        };
    }
    return flot_options;
}
function show_tooltip(x, y, contents, offset) {
    var margin = 60;
    var top = y + (offset || 5);
    var left = x + (offset || 5);
    var el = $('<div id="ds-tooltip">' + contents + '</div>').css({
        position: 'absolute',
        display: 'none',
        top: top,
        left: left
    });
    el.appendTo("body").show();
    var width = el.outerWidth();
    if (left + width + margin > window.innerWidth) {
        el.css('left', x - (width + margin * 2));
    }
}
function setup_plugins(selector, context) {
    $(selector).bind("multihighlighted", function (event, pos, items) {
        if (!items) return;
        var is_percent = context.item['stack_mode'] && context.item['stack_mode'] === charts.StackMode.PERCENT;
        var data = context.plot.getData();
        var item = items[0];
        var point = data[item.serieIndex].data[item.dataIndex];
        var items_to_plot = items.map(function (i) {
            var s = data[i.serieIndex];
            if (context.item instanceof _items.Chart && context.item.hide_zero_series && s.summation.sum === 0) return null;
            var value = is_percent ? s.percents[i.dataIndex] : s.data[i.dataIndex][1];
            return {
                series: s,
                value: is_percent ? FORMAT_PERCENT(value) : FORMAT_STANDARD(value)
            };
        }).filter(function (i) {
            return !!i;
        });
        if (context.item['stack_mode'] && context.item['stack_mode'] !== charts.StackMode.NONE) items_to_plot.reverse();
        var contents = ts.templates.flot.tooltip({
            time: point[0],
            items: items_to_plot
        });
        $("#ds-tooltip").remove();
        show_tooltip(pos.pageX, pos.pageY, contents);
    });
    if (context.item instanceof _xychart2.default) {
        $(selector).bind('plothover', function (e, pos, event_item) {
            if (event_item) {
                context.renderer.highlight_series(context.item, event_item.seriesIndex);
            } else {
                context.renderer.unhighlight_series(context.item);
            }
        });
    }
    $(selector).bind("unmultihighlighted", function (event) {
        $("#ds-tooltip").remove();
    });
}
/* =============================================================================
   Chart renderer interface
   ============================================================================= */

var FlotChartRenderer = function (_charts$ChartRenderer) {
    _inherits(FlotChartRenderer, _charts$ChartRenderer);

    function FlotChartRenderer(data) {
        _classCallCheck(this, FlotChartRenderer);

        var _this = _possibleConstructorReturn(this, (FlotChartRenderer.__proto__ || Object.getPrototypeOf(FlotChartRenderer)).call(this, (0, _util2.extend)({}, data, {
            name: 'flot',
            is_interactive: true,
            description: 'flot renders interactive charts using HTML canvas.'
        })));

        _this.downsample = true;
        _this.downsampling_factor = 0.8;
        _this.connected_lines = false;
        if (data) {
            if (typeof data.downsample !== 'undefined') {
                _this.downsample = !!data.downsample;
            }
            if (typeof data.connected_lines !== 'undefined') {
                _this.connected_lines = !!data.connected_lines;
            }
            _this.downsampling_factor = data.downsampling_factor || _this.downsampling_factor;
        }
        return _this;
    }

    _createClass(FlotChartRenderer, [{
        key: 'sparkline',
        value: function sparkline(selector, item, query, index, opt) {
            var context = {
                plot: null,
                item: item,
                query: query,
                renderer: this
            };
            setup_plugins(selector, context);
            var data = [query.chart_data('flot')[index]];
            var options = (0, _util2.extend)(true, {}, {
                colors: (0, _util.get_palette)(),
                series: {
                    lines: {
                        show: true,
                        lineWidth: ts.prefs.line_width || DEFAULT_LINE_WIDTH,
                        fill: 0.2
                    }
                },
                grid: { show: false, hoverable: true },
                multihighlight: { mode: 'x' },
                crosshair: {
                    mode: "x",
                    color: "#BBB",
                    lineWidth: 1
                },
                legend: { show: false },
                shadowSize: 0,
                downsample: true
            }, opt);
            context.plot = $.plot($(selector), data, options);
            return context;
        }
    }, {
        key: 'render',
        value: function render(selector, item, query, options, data) {
            if (typeof data === 'undefined') data = query.chart_data('flot');
            var context = {
                plot: null,
                item: item,
                query: query,
                renderer: this
            };
            setup_plugins(selector, context);
            var e = $(selector);
            if (this.downsample && options.downsample) {
                options.series.downsample = {
                    threshold: Math.floor(e.width() * this.downsampling_factor)
                };
            } else {
                options.series.downsample = { threshold: 0 };
            }
            try {
                context.plot = $.plot(e, data, options);
            } catch (ex) {
                log.error('Error rendering item ' + item.item_id + ': ' + ex.message);
                log.error(ex.stack);
            }
            item.render_context = context;
            options.interactive_legend = true;
            (0, _legend.render_legend)(item, query, options);
            return context;
        }
    }, {
        key: 'cleanup',
        value: function cleanup(item) {
            if (item.render_context) {
                item.render_context.plot.shutdown();
                item.render_context.plot = null;
                item.render_context = null;
            }
        }
    }, {
        key: 'highlight_series',
        value: function highlight_series(item, index) {
            var _this2 = this;

            if (!item.render_context) return;
            var plot = item.render_context.plot;
            if (item instanceof _items.StandardTimeSeries) {
                (function () {
                    var sts = item;
                    var stacked = sts.stack_mode != charts.StackMode.NONE;
                    plot.getData().forEach(function (s, i) {
                        if (i == index) {
                            s.lines.lineWidth = sts.show_lines && !stacked ? 3 : 0;
                            s.points.radius = 3;
                            s.highlighted = true;
                            if (stacked) {
                                s.lines.fill = 0.8;
                            }
                        } else {
                            _this2.unhighlight_series(item, i);
                            if (stacked) {
                                s.lines.fill = 0.2;
                            }
                        }
                    });
                })();
            }
            plot.draw();
        }
        // TODO: simplify this too

    }, {
        key: 'unhighlight_series',
        value: function unhighlight_series(item, index) {
            if (!item.render_context) return;
            var plot = item.render_context.plot;
            if (item instanceof _items.StandardTimeSeries) {
                (function () {
                    var sts = item;
                    var stacked = sts.stack_mode != charts.StackMode.NONE;
                    if (index) {
                        var s = plot.getData()[index];
                        s.lines.lineWidth = sts.show_lines ? ts.prefs.line_width || DEFAULT_LINE_WIDTH : 0;
                        s.points.radius = 2;
                        if (stacked) {
                            s.lines.fill = item.fill || ts.prefs.opacity || DEFAULT_FILL;
                        }
                        s.highlighted = false;
                    } else {
                        plot.getData().forEach(function (s, i) {
                            s.lines.lineWidth = sts.show_lines ? ts.prefs.line_width || DEFAULT_LINE_WIDTH : 0;
                            s.points.radius = 2;
                            s.highlighted = false;
                            if (stacked) {
                                s.lines.fill = item.fill || ts.prefs.opacity || DEFAULT_FILL;
                            }
                        });
                    }
                })();
            }
            plot.draw();
        }
    }, {
        key: 'process_series',
        value: function process_series(series) {
            var result = {};
            if (series.summation) {
                result.summation = series.summation;
            }
            result.label = series.target;
            result.data = series.datapoints.map(function (point) {
                return [point[1] * 1000, point[0]];
            });
            if (this.connected_lines) {
                result.data = result.data.filter(function (point) {
                    return point[1] != null;
                });
            }
            return result;
        }
    }, {
        key: 'simple_line_chart',
        value: function simple_line_chart(selector, item, query) {
            var options = get_flot_options(item, {
                grid: { show: false },
                series: {
                    lines: {
                        fill: item.fill
                    }
                },
                downsample: true
            });
            return this.render(selector, item, query, options, [query.chart_data('flot')[0]]);
        }
    }, {
        key: 'standard_line_chart',
        value: function standard_line_chart(selector, item, query) {
            query.chart_data('flot').forEach(function (series) {
                // Hide series with no data from display
                if (series.summation.sum === 0) {
                    series.lines = {
                        lineWidth: 0,
                        fill: 0.0
                    };
                }
            });
            this.render(selector, item, query, get_flot_options(item, {
                downsample: true
            }));
        }
    }, {
        key: 'simple_area_chart',
        value: function simple_area_chart(selector, item, query) {
            var options = get_flot_options(item, {
                downsample: true,
                grid: { show: false },
                series: {
                    lines: { fill: item.fill || ts.prefs.opacity || DEFAULT_FILL },
                    grid: { show: false }
                }
            });
            return this.render(selector, item, query, options, [query.chart_data('flot')[0]]);
        }
    }, {
        key: 'stacked_area_chart',
        value: function stacked_area_chart(selector, item, query) {
            var options = get_flot_options(item, {
                downsample: true,
                series: {
                    lines: {
                        fill: item.fill || ts.prefs.opacity || DEFAULT_FILL || 1.0
                    },
                    stackD3: {
                        show: true,
                        offset: 'zero'
                    }
                }
            });
            if (item instanceof _items.StandardTimeSeries) {
                var sts = item;
                if (!sts.show_lines) options.series.lines.lineWidth = 0;
                options.series.points.show = sts.show_points;
            }
            if (item['stack_mode']) {
                var mode = item['stack_mode'];
                if (mode === charts.StackMode.PERCENT) {
                    options.series.stackD3.offset = 'expand';
                    options.yaxes[0].max = 1;
                    options.yaxes[0].min = 0;
                    options.yaxes[0].tickFormatter = FORMAT_PERCENT;
                } else if (mode == charts.StackMode.STREAM) {
                    options.series.stackD3.offset = 'wiggle';
                } else if (mode == charts.StackMode.NONE) {
                    options.series.stackD3.show = false;
                    options.series.lines.fill = 0.0;
                }
            }
            query.chart_data('flot').forEach(function (series, i) {
                if (series.summation.sum === 0) {
                    series.lines = {
                        lineWidth: 0
                    };
                }
                series.points = series.points || {};
                series.points.fillColor = options.colors[i % options.colors.length];
            });
            return this.render(selector, item, query, options);
        }
    }, {
        key: 'donut_chart',
        value: function donut_chart(selector, item, query) {
            var options = get_flot_options(item, {
                crosshair: { mode: null },
                multihighlight: { mode: null },
                series: {
                    lines: { show: false },
                    pie: {
                        show: true,
                        radius: 'auto',
                        innerRadius: item['is_pie'] ? 0 : 0.35,
                        label: { show: item['labels'] },
                        highlight: {
                            opacity: 0
                        }
                    }
                },
                grid: { show: false, hoverable: true }
            });
            var transform = item['transform'] || 'sum';
            var data = query.chart_data('flot').map(function (series) {
                if (item.hide_zero_series && series.summation.sum === 0) {
                    return undefined;
                }
                return {
                    label: series.label,
                    summation: series.summation,
                    data: [series.label, series.summation[transform]]
                };
            }).filter(function (item) {
                return item;
            });
            var context = this.render(selector, item, query, options, data);
            $(selector).bind('plothover', function (event, pos, event_item) {
                if (event_item) {
                    var contents = ts.templates.flot.donut_tooltip({
                        series: event_item.series,
                        value: FORMAT_STANDARD(event_item.datapoint[1][0][1]),
                        percent: FORMAT_PERCENT(event_item.series.percent / 100)
                    });
                    $("#ds-tooltip").remove();
                    show_tooltip(pos.pageX, pos.pageY, contents);
                } else {
                    $("#ds-tooltip").remove();
                }
            });
            return context;
        }
    }, {
        key: 'bar_chart',
        value: function bar_chart(selector, item, query) {
            var series = query.chart_data('flot')[0];
            var ts_start = series.data[0][0];
            var ts_end = series.data[series.data.length - 1][0];
            var ts_length = ts_end - ts_start;
            var sample_size = ts_length / series.data.length;
            var bar_scaling = 0.85;
            if (ts_length > THREE_HOURS_MS) {
                bar_scaling = 0.15;
            } else if (ts_length > ONE_HOUR_MS) {
                bar_scaling = 0.65;
            } else {
                bar_scaling = 0.85;
            }
            var options = get_flot_options(item, {
                series: {
                    lines: { show: false },
                    stackD3: {
                        show: true,
                        offset: 'zero'
                    },
                    bars: {
                        show: true,
                        fill: 0.8,
                        barWidth: sample_size * bar_scaling
                    }
                }
            });
            if (item['stack_mode']) {
                var mode = item['stack_mode'];
                if (mode === charts.StackMode.PERCENT) {
                    options.series.stackD3.offset = 'expand';
                    options.yaxes[0].max = 1;
                    options.yaxes[0].min = 0;
                    options.yaxes[0].tickFormatter = FORMAT_PERCENT;
                } else if (mode == charts.StackMode.STREAM) {
                    options.series.stackD3.offset = 'wiggle';
                } else if (mode == charts.StackMode.NONE) {
                    options.series.stackD3.show = false;
                    options.series.lines.fill = false;
                }
            }
            return this.render(selector, item, query, options);
        }
    }, {
        key: 'discrete_bar_chart',
        value: function discrete_bar_chart(selector, item, query) {
            var is_horizontal = item['orientation'] === 'horizontal';
            var format = d3.format(item['format'] || FORMAT_STRING_STANDARD);
            var options = get_flot_options(item, {
                xaxis: { mode: null },
                multihighlight: { mode: null },
                crosshair: { mode: null },
                grid: {
                    borderWidth: 0,
                    color: 'transparent',
                    borderColor: 'transparent',
                    labelMargin: 10
                },
                series: {
                    lines: { show: false },
                    bars: {
                        horizontal: is_horizontal,
                        show: true,
                        barWidth: 0.8,
                        align: 'center',
                        fill: item.fill || ts.prefs.opacity || DEFAULT_FILL,
                        numbers: {
                            show: item['show_numbers'],
                            font: '10pt Helvetica',
                            fontColor: '#f9f9f9',
                            formatter: format,
                            yAlign: function yAlign(y) {
                                return y;
                            },
                            xAlign: function xAlign(x) {
                                return x;
                            }
                        }
                    }
                }
            });
            var transform = item['transform'] || 'sum';
            var index = 0;
            var data = query.chart_data('flot').map(function (series) {
                if (item.hide_zero_series && series.summation.sum === 0) {
                    return undefined;
                }
                return {
                    label: series.label,
                    data: [is_horizontal ? [series.summation[transform], index] : [index, series.summation[transform]]],
                    color: options.colors[options.colors % index++]
                };
            }).filter(function (item) {
                return item;
            });
            index = 0;
            var ticks = data.map(function (series) {
                return [index++, series.label];
            });
            if (is_horizontal) {
                options.yaxes[0].tickLength = 0;
                options.yaxes[0].ticks = ticks;
                options.xaxis.tickFormatter = null;
                options.series.bars.numbers.xOffset = -18;
                if (item['show_grid']) {
                    options.xaxis.axisLabel = options.yaxes[0].axisLabel;
                    options.yaxes[0].axisLabel = transform.charAt(0).toUpperCase() + transform.substring(1);
                } else {
                    options.xaxis.ticks = [];
                    options.yaxes[0].axisLabel = null;
                }
            } else {
                options.xaxis.tickLength = 0;
                options.xaxis.ticks = ticks;
                options.series.bars.numbers.yOffset = 12;
                if (!item['show_grid']) {
                    options.yaxes[0].ticks = [];
                    options.yaxes[0].axisLabel = null;
                } else {
                    options.xaxis.axisLabel = transform.charAt(0).toUpperCase() + transform.substring(1);
                }
            }
            var context = this.render(selector, item, query, options, data);
            $(selector).bind('plothover', function (event, pos, event_item) {
                if (event_item) {
                    var contents = ts.templates.flot.discrete_bar_tooltip({
                        series: event_item.series,
                        value: format(event_item.datapoint[1])
                    });
                    $("#ds-tooltip").remove();
                    show_tooltip(pos.pageX, pos.pageY, contents);
                } else {
                    $("#ds-tooltip").remove();
                }
            });
            return context;
        }
    }, {
        key: 'scatter_plot',
        value: function scatter_plot(selector, item, query) {
            var options = get_flot_options(item, {
                series: {
                    lines: { show: true, lineWidth: 0 },
                    bars: { show: false },
                    points: {
                        show: true,
                        fill: true,
                        radius: 2,
                        symbol: "circle"
                    }
                }
            });
            options.series.points.fillColor = options.colors[0];
            options.xaxis.mode = null;
            options.xaxis.tickFormatter = null;
            var data = query.chart_data('flot');
            var series_x = data[0].data.map(function (d) {
                return d[1];
            });
            var series_y = data[1].data.map(function (d) {
                return d[1];
            });
            var series = series_x.map(function (e, i) {
                return [e, series_y[i]];
            });
            var scatter_data = [data[0]];
            scatter_data[0].data = series;
            return this.render(selector, item, query, options, scatter_data);
        }
    }]);

    return FlotChartRenderer;
}(charts.ChartRenderer);



exports.default = FlotChartRenderer;

},{"../app/app":1,"../models/axis":36,"../models/items":41,"../models/items/xychart":74,"../util":88,"./core":17,"./legend":21,"./util":24}],19:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

exports.composer_url = composer_url;
exports.chart_url = chart_url;

var _core = require('./core');

var charts = _interopRequireWildcard(_core);

var _axis = require('../models/axis');

var _util = require('./util');

var _util2 = require('../util');

var _legend = require('./legend');

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

function img(element, url) {
    element.html($('<img/>').attr('src', url.setQuery('cachebuster', new Date().getTime()).href()).height(element.height()).width(element.width()));
}
function set_scale(url, options) {
    if (options.y1 && options.y1.scale) {
        switch (options.y1.scale) {
            case _axis.AxisScale.LOG:
                url.setQuery('logBase', 10);
                break;
        }
    }
}
/**
 * Charts provider for Graphite's built-in static image
 * rendering. Also provides Graphite URL formatting for a number of
 * the UI's actions (Open in Graphite..., Export PNG..., etc...)
 */

var GraphiteChartRenderer = function (_charts$ChartRenderer) {
    _inherits(GraphiteChartRenderer, _charts$ChartRenderer);

    function GraphiteChartRenderer(data) {
        _classCallCheck(this, GraphiteChartRenderer);

        var _this = _possibleConstructorReturn(this, (GraphiteChartRenderer.__proto__ || Object.getPrototypeOf(GraphiteChartRenderer)).call(this, (0, _util2.extend)({}, data, {
            name: 'graphite',
            is_interactive: false,
            description: "Render graphs using Graphite's built-in static PNG rendering. " + "No interactive features will be available with this option, " + "and not all chart types will render with fidelity."
        })));

        _this.connected_lines = false;
        if (data) {
            _this.graphite_url = data.graphite_url;
            _this.connected_lines = !!data.connected_lines;
        }
        return _this;
    }

    _createClass(GraphiteChartRenderer, [{
        key: 'simple_line_chart',
        value: function simple_line_chart(selector, item, query) {
            var element = $(selector);
            var url = this.simple_line_chart_url(item, query, {
                height: element.height(),
                width: element.width()
            });
            img(element, url);
        }
    }, {
        key: 'simple_line_chart_url',
        value: function simple_line_chart_url(item, query, opt) {
            var options = (0, _util2.extend)({}, opt, item.options, (0, _util.get_colors)());
            var png_url = new URI(query.url({ base_url: this.graphite_url })).setQuery('format', options.format || 'png').setQuery('height', options.height || 600).setQuery('width', options.width || 1200).setQuery('bgcolor', options.bgcolor || GraphiteChartRenderer.DEFAULT_BGCOLOR).setQuery('fgcolor', options.fgcolor || 'white').setQuery('hideLegend', 'true').setQuery('hideAxes', 'true').setQuery('margin', '0').setQuery('colorList', (0, _util.get_palette)(options.palette).join()).setQuery('title', options.showTitle ? item.title : '');
            if (this.connected_lines) {
                png_url.setQuery('lineMode', 'connected');
            }
            if (options.y1 && options.y1.min) {
                png_url.setQuery('yMin', options.y1.min);
            }
            if (options.y1 && options.y1.max) {
                png_url.setQuery('yMax', options.y1.max);
            }
            set_scale(png_url, options);
            return png_url;
        }
    }, {
        key: 'standard_line_chart',
        value: function standard_line_chart(selector, item, query) {
            var element = $(selector);
            var url = this.standard_line_chart_url(item, query, {
                height: element.height(),
                width: element.width()
            });
            img(element, url);
            (0, _legend.render_legend)(item, query);
        }
    }, {
        key: 'standard_line_chart_url',
        value: function standard_line_chart_url(item, query, opt) {
            var options = (0, _util2.extend)({}, opt, item.options, (0, _util.get_colors)());
            var png_url = new URI(query.url({ base_url: this.graphite_url })).setQuery('format', options.format || 'png').setQuery('height', options.height || 600).setQuery('width', options.width || 1200).setQuery('bgcolor', options.bgcolor || GraphiteChartRenderer.DEFAULT_BGCOLOR).setQuery('fgcolor', options.fgcolor || 'black').setQuery('majorGridLineColor', options.majorGridLineColor || '#dddddd').setQuery('minorGridLineColor', options.minorGridLineColor || '#eeeeee').setQuery('hideLegend', 'true').setQuery('hideAxes', options.hideAxes || 'false').setQuery('colorList', (0, _util.get_palette)(options.palette).join()).setQuery('vtitle', options.y1 ? options.y1.label : options.yAxisLabel).setQuery('title', options.showTitle ? item.title : '').setQuery('lineMode', 'connected');
            if (options.y1 && options.y1.min) {
                png_url.setQuery('yMin', options.y1.min);
            }
            if (options.y1 && options.y1.max) {
                png_url.setQuery('yMax', options.y1.max);
            }
            set_scale(png_url, options);
            return png_url;
        }
    }, {
        key: 'simple_area_chart',
        value: function simple_area_chart(selector, item, query) {
            var element = $(selector);
            var url = this.simple_area_chart_url(item, query, {
                height: element.height(),
                width: element.width()
            });
            img(element, url);
        }
    }, {
        key: 'simple_area_chart_url',
        value: function simple_area_chart_url(item, query, opt) {
            var options = (0, _util2.extend)({}, opt, item.options, (0, _util.get_colors)());
            var png_url = new URI(query.url({ base_url: this.graphite_url })).setQuery('format', options.format || 'png').setQuery('height', options.height || 600).setQuery('width', options.width || 1200).setQuery('bgcolor', options.bgcolor || GraphiteChartRenderer.DEFAULT_BGCOLOR).setQuery('fgcolor', options.fgcolor || 'black').setQuery('majorGridLineColor', options.majorGridLineColor || '#dddddd').setQuery('minorGridLineColor', options.minorGridLineColor || '#eeeeee').setQuery('hideLegend', 'true').setQuery('hideAxes', 'true').setQuery('margin', '0').setQuery('colorList', (0, _util.get_palette)(options.palette).join()).setQuery('lineMode', 'connected');
            if (!query.is_stacked()) {
                png_url.setQuery('areaMode', 'stacked');
            }
            if (options.y1 && options.y1.min) {
                png_url.setQuery('yMin', options.y1.min);
            }
            if (options.y1 && options.y1.max) {
                png_url.setQuery('yMax', options.y1.max);
            }
            set_scale(png_url, options);
            return png_url;
        }
    }, {
        key: 'stacked_area_chart',
        value: function stacked_area_chart(selector, item, query) {
            var element = $(selector);
            var url = this.stacked_area_chart_url(item, query, {
                height: element.height(),
                width: element.width()
            });
            img(element, url);
            (0, _legend.render_legend)(item, query);
        }
    }, {
        key: 'stacked_area_chart_url',
        value: function stacked_area_chart_url(item, query, opt) {
            var options = (0, _util2.extend)({}, opt, item.options, (0, _util.get_colors)());
            var png_url = new URI(query.url({ base_url: this.graphite_url })).setQuery('format', options.format || 'png').setQuery('height', options.height || 600).setQuery('width', options.width || 1200).setQuery('bgcolor', options.bgcolor || GraphiteChartRenderer.DEFAULT_BGCOLOR).setQuery('fgcolor', options.fgcolor || 'black').setQuery('majorGridLineColor', options.majorGridLineColor || '#dddddd').setQuery('minorGridLineColor', options.minorGridLineColor || '#eeeeee').setQuery('hideLegend', 'true').setQuery('hideAxes', options.hideAxes || 'false').setQuery('colorList', (0, _util.get_palette)(options.palette).join()).setQuery('vtitle', options.y1 ? options.y1.label : options.yAxisLabel).setQuery('title', options.showTitle ? item.title : '').setQuery('lineMode', 'connected');
            if (item.hasOwnProperty('stack_mode')) {
                if (!query.is_stacked() && item['stack_mode'] != charts.StackMode.NONE) {
                    png_url.setQuery('areaMode', 'stacked');
                }
            }
            if (options.y1 && options.y1.min) {
                png_url.setQuery('yMin', options.y1.min);
            }
            if (options.y1 && options.y1.max) {
                png_url.setQuery('yMax', options.y1.max);
            }
            set_scale(png_url, options);
            return png_url;
        }
    }, {
        key: 'donut_chart_url',
        value: function donut_chart_url(item, query, opt) {
            var png_url = this.standard_line_chart_url(item, query, opt).setQuery('graphType', 'pie').setQuery('hideLegend', 'true');
            return png_url;
        }
    }, {
        key: 'donut_chart',
        value: function donut_chart(selector, item, query) {
            var element = $(selector);
            var url = this.donut_chart_url(item, query, {
                height: element.height(),
                width: element.width()
            });
            img(element, url);
            (0, _legend.render_legend)(item, query);
        }
    }, {
        key: 'bar_chart',
        value: function bar_chart(selector, item, query) {
            this.stacked_area_chart(selector, item, query);
        }
    }, {
        key: 'discrete_bar_chart',
        value: function discrete_bar_chart(selector, item, query) {
            this.donut_chart(selector, item, query);
        }
    }, {
        key: 'scatter_plot',
        value: function scatter_plot(selector, item, query) {}
    }, {
        key: 'chart_url',
        value: function chart_url(item, query, opt) {
            switch (item.item_type) {
                case 'simple_time_series':
                    return item['filled'] ? this.simple_area_chart_url(item, query, opt) : this.simple_line_chart_url(item, query, opt);
                case 'standard_time_series':
                    return this.standard_line_chart_url(item, query, opt);
                case 'stacked_area_chart':
                    return this.stacked_area_chart_url(item, query, opt);
                case 'singlegraph':
                    return this.simple_area_chart_url(item, query, opt);
                case 'donut_chart':
                    return this.donut_chart_url(item, query, opt);
            }
            return undefined;
        }
    }, {
        key: 'composer_url',
        value: function composer_url(item, query, opt) {
            var options = opt || {};
            var composer_url = new URI(query.url({ base_url: this.graphite_url })).filename('composer').removeQuery('format').setQuery('colorList', (0, _util.get_palette)(options.palette).join()).setQuery('vtitle', options.yAxisLabel).setQuery('title', options.showTitle ? item.title : '');
            if (item.item_type === 'stacked_area_chart' && !query.is_stacked()) {
                composer_url.setQuery('areaMode', 'stacked');
            }
            return composer_url;
        }
    }]);

    return GraphiteChartRenderer;
}(charts.ChartRenderer);

exports.default = GraphiteChartRenderer;

GraphiteChartRenderer.DEFAULT_BGCOLOR = 'ff000000';
function composer_url(item, query, options) {
    var g = charts.renderers.get('graphite');
    return g.composer_url(item, query, options);
}
function chart_url(item, query, options) {
    var g = charts.renderers.get('graphite');
    return g.chart_url(item, query, options);
}


},{"../models/axis":36,"../util":88,"./core":17,"./legend":21,"./util":24}],20:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _chart = require('../models/items/chart');

Object.defineProperty(exports, 'Chart', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_chart).default;
  }
});

var _core = require('./core');

Object.defineProperty(exports, 'ChartRenderer', {
  enumerable: true,
  get: function get() {
    return _core.ChartRenderer;
  }
});
Object.defineProperty(exports, 'get_renderer', {
  enumerable: true,
  get: function get() {
    return _core.get_renderer;
  }
});
Object.defineProperty(exports, 'set_renderer', {
  enumerable: true,
  get: function get() {
    return _core.set_renderer;
  }
});
Object.defineProperty(exports, 'renderers', {
  enumerable: true,
  get: function get() {
    return _core.renderers;
  }
});
Object.defineProperty(exports, 'StackMode', {
  enumerable: true,
  get: function get() {
    return _core.StackMode;
  }
});
Object.defineProperty(exports, 'simple_line_chart', {
  enumerable: true,
  get: function get() {
    return _core.simple_line_chart;
  }
});
Object.defineProperty(exports, 'standard_line_chart', {
  enumerable: true,
  get: function get() {
    return _core.standard_line_chart;
  }
});
Object.defineProperty(exports, 'simple_area_chart', {
  enumerable: true,
  get: function get() {
    return _core.simple_area_chart;
  }
});
Object.defineProperty(exports, 'stacked_area_chart', {
  enumerable: true,
  get: function get() {
    return _core.stacked_area_chart;
  }
});
Object.defineProperty(exports, 'donut_chart', {
  enumerable: true,
  get: function get() {
    return _core.donut_chart;
  }
});
Object.defineProperty(exports, 'bar_chart', {
  enumerable: true,
  get: function get() {
    return _core.bar_chart;
  }
});
Object.defineProperty(exports, 'discrete_bar_chart', {
  enumerable: true,
  get: function get() {
    return _core.discrete_bar_chart;
  }
});
Object.defineProperty(exports, 'scatter_plot', {
  enumerable: true,
  get: function get() {
    return _core.scatter_plot;
  }
});
Object.defineProperty(exports, 'process_series', {
  enumerable: true,
  get: function get() {
    return _core.process_series;
  }
});
Object.defineProperty(exports, 'process_data', {
  enumerable: true,
  get: function get() {
    return _core.process_data;
  }
});
Object.defineProperty(exports, 'cleanup', {
  enumerable: true,
  get: function get() {
    return _core.cleanup;
  }
});

var _flot = require('./flot');

Object.defineProperty(exports, 'FlotChartRenderer', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_flot).default;
  }
});

var _graphite = require('./graphite');

Object.defineProperty(exports, 'composer_url', {
  enumerable: true,
  get: function get() {
    return _graphite.composer_url;
  }
});
Object.defineProperty(exports, 'chart_url', {
  enumerable: true,
  get: function get() {
    return _graphite.chart_url;
  }
});
Object.defineProperty(exports, 'GraphiteChartRenderer', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_graphite).default;
  }
});

var _placeholder = require('./placeholder');

Object.defineProperty(exports, 'PlaceholderChartRenderer', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_placeholder).default;
  }
});

var _palettes = require('./palettes');

Object.defineProperty(exports, 'palettes', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_palettes).default;
  }
});

var _util = require('./util');

Object.defineProperty(exports, 'get_palette', {
  enumerable: true,
  get: function get() {
    return _util.get_palette;
  }
});
Object.defineProperty(exports, 'get_low_contrast_palette', {
  enumerable: true,
  get: function get() {
    return _util.get_low_contrast_palette;
  }
});

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

},{"../models/items/chart":44,"./core":17,"./flot":18,"./graphite":19,"./palettes":22,"./placeholder":23,"./util":24}],21:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.render_legend = render_legend;

var _chart = require('../models/items/chart');

var _util = require('./util');

var _core = require('./core');

function highlightSeries(item) {
    return function (e) {
        var index = e.currentTarget.dataset.seriesIndex;
        (0, _core.get_renderer)(item).highlight_series(item, index);
    };
}
function unhighlightSeries(item) {
    return function (e) {
        (0, _core.get_renderer)(item).unhighlight_series(item);
    };
}
function render_legend(item, query, options) {
    var legend_id = '#ds-legend-' + item.item_id;
    if (item.legend === _chart.ChartLegendType.SIMPLE) {
        render_simple_legend(legend_id, item, query, options);
    } else if (item.legend === _chart.ChartLegendType.TABLE) {
        render_table_legend(legend_id, item, query, options);
    }
}
function render_simple_legend(legend_id, item, query) {
    var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};

    var legend = '';
    var data = query.chart_data('flot');
    var theme_colors = (0, _util.get_colors)();
    var colors = (0, _util.get_palette)(options.palette || item.options.palette);
    for (var i = 0; i < data.length; i++) {
        var series = data[i];
        if (item.hide_zero_series && series.summation.sum === 0) {
            continue;
        }
        var label = series.label;
        var color = colors[i % colors.length];
        var cell = '<div class="ds-legend-cell" data-series-index="' + i + '">' + '<span class="color" style="background-color:' + color + '"></span>' + '<span class="label" style="color:' + theme_colors.fgcolor + '">' + label + '</span>' + '</div>';
        legend += cell;
    }
    var elt = $(legend_id);
    elt.html(legend);
    elt.equalize({ equalize: 'outerWidth', reset: true });
    if (options.interactive_legend) {
        var _elt = $(legend_id + ' .ds-legend-cell');
        _elt.on('mouseenter', highlightSeries(item));
        _elt.on('mouseenter', function (e) {
            $(e.currentTarget).addClass('highlighted');
        });
        _elt.on('mouseleave', unhighlightSeries(item));
        _elt.on('mouseleave', function (e) {
            $(e.currentTarget).removeClass('highlighted');
        });
    }
}
function render_table_legend(legend_id, item, query) {
    var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};

    var palette = (0, _util.get_palette)(item.options.palette || options.palette);
    query.data.forEach(function (series, i) {
        series['color'] = palette[i % palette.length];
    });
    var data = query.data;
    if (item.hide_zero_series) data = data.filter(function (s) {
        return s.summation.sum != 0;
    });
    var legend = ts.templates.flot.table_legend({
        item: item,
        data: data,
        opt: options
    });
    $(legend_id).html(legend);
    if (options.interactive_legend) {
        $(legend_id + ' > table > tbody > tr').on('mouseenter', highlightSeries(item));
        $(legend_id + ' > table > tbody > tr').on('mouseleave', unhighlightSeries(item));
    }
}


},{"../models/items/chart":44,"./core":17,"./util":24}],22:[function(require,module,exports){
"use strict";

Object.defineProperty(exports, "__esModule", {
    value: true
});
/**
 * Some color palettes", handily compiled by the Stanford Vis
 * Group for their Color Palette Analyzer project.
 * http://vis.stanford.edu/color-names/analyzer/
 */
exports.default = {
    applespectrum: ["#2d588a", "#58954c", "#e9a044", "#c12f32", "#723e77", "#7d807f"],
    appleblue: ["#4972a8", "#92b9d8", "#002d64", "#599bcf", "#134d8d"],
    applebrown: ["#8b6c4f", "#c8b68e", "#3b291d", "#ae8e5d", "#713f24"],
    applegrey: ["#717372", "#c0c2c1", "#2d2f2e", "#8c8e8d", "#484a49"],
    applegreen: ["#2d632f", "#90b879", "#0d2d16", "#599a48", "#00431a"],
    tableau10: ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf"],
    tableau20: ["#1f77b4", "#aec7e8", "#ff7f0e", "#ffbb78", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5", "#8c564b", "#c49c94", "#e377c2", "#f7b6d2", "#7f7f7f", "#c7c7c7", "#bcbd22", "#dbdb8d", "#17becf", "#9edae5"],
    manyeyes: ["#9c9ede", "#7375b5", "#4a5584", "#cedb9c", "#b5cf6b", "#8ca252", "#637939", "#e7cb94", "#e7ba52", "#bd9e39", "#8c6d31", "#e7969c", "#d6616b", "#ad494a", "#843c39", "#de9ed6", "#ce6dbd", "#a55194", "#7b4173"],
    numbers6: ["#2d588a", "#58954c", "#e9a044", "#c12f32", "#723e77", "#7d807f"],
    excel10: ["#365e96", "#983334", "#77973d", "#5d437c", "#36869f", "#d1702f", "#8197c5", "#c47f80", "#acc484", "#9887b0"],
    economist: ["#621e15", "#e59076", "#128dcd", "#083c52", "#64c5f2", "#61afaf", "#0f7369", "#9c9da1"],
    brewerq9: ["#e41a1c", "#377eb8", "#4daf4a", "#984ea3", "#ff7f00", "#ffff33", "#a65628", "#f781bf", "#999999"],
    brewerq10: ["#a6cee3", "#1f78b4", "#b2df8a", "#33a02c", "#fb9a99", "#e31a1c", "#fdbf6f", "#ff7f00", "#cab2d6", "#6a3d9a"],
    brewerq12: ["#8dd3c7", "#ffffb3", "#bebada", "#fb8072", "#80b1d3", "#fdb462", "#b3de69", "#fccde5", "#d9d9d9", "#bc80bd", "#ccebc5", "#ffed6f"],
    brewerdiv1: ["#8c510a", "#d8b365", "#f6e8c3", "#f5f5f5", "#c7eae5", "#5ab4ac", "#01665e"],
    brewerdiv2: ["#b2182b", "#ef8a62", "#fddbc7", "#f7f7f7", "#d1e5f0", "#67a9cf", "#2166ac"],
    brewerdiv3: ["#762a83", "#af8dc3", "#e7d4e8", "#f7f7f7", "#d9f0d3", "#7fbf7b", "#1b7837"],
    brewerdiv4: ["#d73027", "#fc8d59", "#fee090", "#ffffbf", "#e0f3f8", "#91bfdb", "#4575b4"],
    marketmap: ["#fa0007", "#ac0000", "#4e0300", "#000000", "#005101", "#06a200", "#07ff00"],
    // some more color palettes from rickshaw
    spectrum6: ["#e7cbe6", "#d8aad6", "#a888c2", "#9dc2d3", "#649eb9", "#387aa3"].reverse(),
    spectrum14: ["#ecb796", "#dc8f70", "#b2a470", "#92875a", "#716c49", "#d2ed82", "#bbe468", "#a1d05d", "#e7cbe6", "#d8aad6", "#a888c2", "#9dc2d3", "#649eb9", "#387aa3"].reverse(),
    spectrum2000: ["#57306f", "#514c76", "#646583", "#738394", "#6b9c7d", "#84b665", "#a7ca50", "#bfe746", "#e2f528", "#fff726", "#ecdd00", "#d4b11d", "#de8800", "#de4800", "#c91515", "#9a0000", "#7b0429", "#580839", "#31082b"],
    spectrum2001: ["#2f243f", "#3c2c55", "#4a3768", "#565270", "#6b6b7c", "#72957f", "#86ad6e", "#a1bc5e", "#b8d954", "#d3e04e", "#ccad2a", "#cc8412", "#c1521d", "#ad3821", "#8a1010", "#681717", "#531e1e", "#3d1818", "#320a1b"],
    classic9: ["#423d4f", "#4a6860", "#848f39", "#a2b73c", "#ddcb53", "#c5a32f", "#7d5836", "#963b20", "#7c2626", "#491d37", "#2f254a"].reverse(),
    colorwheel: ["#b5b6a9", "#858772", "#785f43", "#96557e", "#4682b4", "#65b9ac", "#73c03a", "#cb513a"].reverse(),
    cool: ["#5e9d2f", "#73c03a", "#4682b4", "#7bc3b8", "#a9884e", "#c1b266", "#a47493", "#c09fb5"],
    munin: ["#00cc00", "#0066b3", "#ff8000", "#ffcc00", "#330099", "#990099", "#ccff00", "#ff0000", "#808080", "#008f00", "#00487d", "#b35a00", "#b38f00", "#6b006b", "#8fb300", "#b30000", "#bebebe", "#80ff80", "#80c9ff", "#ffc080", "#ffe680", "#aa80ff", "#ee00cc", "#ff8080", "#666600", "#ffbfff", "#00ffcc", "#cc6699", "#999900"],
    // some more color palettes from d3.js
    d3category10: ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf"],
    d3category20: ["#1f77b4", "#aec7e8", "#ff7f0e", "#ffbb78", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5", "#8c564b", "#c49c94", "#e377c2", "#f7b6d2", "#7f7f7f", "#c7c7c7", "#bcbd22", "#dbdb8d", "#17becf", "#9edae5"],
    d3category20b: ["#393b79", "#5254a3", "#6b6ecf", "#9c9ede", "#637939", "#8ca252", "#b5cf6b", "#cedb9c", "#8c6d31", "#bd9e39", "#e7ba52", "#e7cb94", "#843c39", "#ad494a", "#d6616b", "#e7969c", "#7b4173", "#a55194", "#ce6dbd", "#de9ed6"],
    d3category20c: ["#3182bd", "#6baed6", "#9ecae1", "#c6dbef", "#e6550d", "#fd8d3c", "#fdae6b", "#fdd0a2", "#31a354", "#74c476", "#a1d99b", "#c7e9c0", "#756bb1", "#9e9ac8", "#bcbddc", "#dadaeb", "#636363", "#969696", "#bdbdbd", "#d9d9d9"],
    // Here are a couple of intentionally low-contrast palettes
    // which intended to allow computed series (like
    // averageSeries(), highestAverage(), mostDeviant(), etc...) to
    // stand out over the noise of a ton of metric instances when
    // assigned their own color with the color() function.
    low_contrast_gray: ["#BBBBBB", "#C8C8C8", "#D5D5D5", "#E1E1E1", "#EEEEEE"],
    low_contrast_blue: ["#AAAABB", "#B7B7C8", "#C4C4D5", "#D0D0E1", "#DDDDEE", "#EAEAFB"]
};


},{}],23:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _core = require('./core');

var charts = _interopRequireWildcard(_core);

var _util = require('../util');

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

function render(element, item) {
    element.html($('<img/>').attr('data-src', 'holder.js/100px100p').height(element.height()).width(element.width()));
}
/**
 * A chart renderer that uses Holder.js to render placeholder images.
 */

var PlaceholderChartRenderer = function (_charts$ChartRenderer) {
    _inherits(PlaceholderChartRenderer, _charts$ChartRenderer);

    function PlaceholderChartRenderer(data) {
        _classCallCheck(this, PlaceholderChartRenderer);

        return _possibleConstructorReturn(this, (PlaceholderChartRenderer.__proto__ || Object.getPrototypeOf(PlaceholderChartRenderer)).call(this, (0, _util.extend)({}, data, {
            name: 'placeholder',
            description: 'Render placeholder images in place of actual charts.',
            is_interactive: false
        })));
    }

    _createClass(PlaceholderChartRenderer, [{
        key: 'simple_line_chart',
        value: function simple_line_chart(element, item, query) {
            render(element, item);
        }
    }, {
        key: 'standard_line_chart',
        value: function standard_line_chart(element, item, query) {
            render(element, item);
        }
    }, {
        key: 'simple_area_chart',
        value: function simple_area_chart(element, item, query) {
            render(element, item);
        }
    }, {
        key: 'stacked_area_chart',
        value: function stacked_area_chart(element, item, query) {
            render(element, item);
        }
    }, {
        key: 'donut_chart',
        value: function donut_chart(element, item, query) {
            render(element, item);
        }
    }, {
        key: 'bar_chart',
        value: function bar_chart(element, item, query) {
            render(element, item);
        }
    }, {
        key: 'discrete_bar_chart',
        value: function discrete_bar_chart(element, item, query) {
            render(element, item);
        }
    }]);

    return PlaceholderChartRenderer;
}(charts.ChartRenderer);



exports.default = PlaceholderChartRenderer;

},{"../util":88,"./core":17}],24:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.DEFAULT_PALETTE = undefined;
exports.get_palette = get_palette;
exports.get_colors = get_colors;
exports.get_low_contrast_palette = get_low_contrast_palette;

var _palettes = require('./palettes');

var _palettes2 = _interopRequireDefault(_palettes);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var DEFAULT_PALETTE = exports.DEFAULT_PALETTE = 'd3category20';
function get_palette(name_or_palette) {
    if (name_or_palette instanceof Array) {
        return name_or_palette;
    } else if (typeof name_or_palette === 'string') {
        return _palettes2.default[name_or_palette] || _palettes2.default[DEFAULT_PALETTE];
    } else {
        return _palettes2.default[DEFAULT_PALETTE];
    }
}
/**
 * Return a set of colors for rendering graphs that are tuned to
 * the current UI color theme. Colors are derived from the
 * background color of the 'body' element.
 *
 * TODO: cache the results keyed by background color.
 *
 * TODO: if the model had back links to containers, we could walk
 * up the containment hierarchy to see if the chart is contained
 * in something that has a background style set (i.e. well, alert,
 * etc...) and get the colors based on that.
 *
 * Or we could just pre-compute them all based on the background
 * colors from the CSS.
 */
function get_colors() {
    var color = Color(window.getComputedStyle($('body')[0]).backgroundColor);
    if (color.dark()) {
        return {
            majorGridLineColor: color.clone().lighten(0.75).hexString(),
            minorGridLineColor: color.clone().lighten(0.5).hexString(),
            fgcolor: color.clone().lighten(3.0).hexString()
        };
    } else {
        return {
            majorGridLineColor: color.clone().darken(0.15).hexString(),
            minorGridLineColor: color.clone().darken(0.05).hexString(),
            fgcolor: color.clone().darken(0.75).hexString()
        };
    }
}
/**
 * Return a low contrast monochromatic color palette for
 * transforms like HighlightAverage, which de-emphasize a mass of
 * raw metrics in order to highlight computed series.
 */
function get_low_contrast_palette() {
    /* TODO: get from options parameter */
    var light_step = 0.1,
        dark_step = 0.05,
        count = 6,
        bg = Color(window.getComputedStyle($('body')[0]).backgroundColor),
        color = bg.dark() ? bg.clone().lighten(0.25) : bg.clone().darken(0.1);
    var palette = [];
    for (var i = 0; i < count; i++) {
        palette.push(color.hexString());
        bg.dark() ? color.lighten(light_step) : color.darken(dark_step);
    }
    return palette;
}


},{"./palettes":22}],25:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _util = require('./util');

var _models = require('./models');

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) {
            try {
                step(generator.next(value));
            } catch (e) {
                reject(e);
            }
        }
        function rejected(value) {
            try {
                step(generator["throw"](value));
            } catch (e) {
                reject(e);
            }
        }
        function step(result) {
            result.done ? resolve(result.value) : new P(function (resolve) {
                resolve(result.value);
            }).then(fulfilled, rejected);
        }
        step((generator = generator.apply(thisArg, _arguments)).next());
    });
};

var axios = require('axios');
var log = (0, _util.logger)('client');
/**
 * Client for the Tessera REST API.
 */

var Client = function () {
    function Client(data) {
        _classCallCheck(this, Client);

        if (data) {
            this.prefix = data.prefix;
        }
    }

    _createClass(Client, [{
        key: '_uri',
        value: function _uri(path) {
            return this.prefix && !path.startsWith(this.prefix) ? '' + this.prefix + path : path;
        }
    }, {
        key: '_get',
        value: function _get(path) {
            var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

            return __awaiter(this, void 0, void 0, regeneratorRuntime.mark(function _callee() {
                var uri;
                return regeneratorRuntime.wrap(function _callee$(_context) {
                    while (1) {
                        switch (_context.prev = _context.next) {
                            case 0:
                                uri = this._uri(path);

                                log.debug('GET ' + uri);
                                return _context.abrupt('return', axios.get(uri, options));

                            case 3:
                            case 'end':
                                return _context.stop();
                        }
                    }
                }, _callee, this);
            }));
        }
    }, {
        key: '_put',
        value: function _put(path, data) {
            return __awaiter(this, void 0, void 0, regeneratorRuntime.mark(function _callee2() {
                var uri;
                return regeneratorRuntime.wrap(function _callee2$(_context2) {
                    while (1) {
                        switch (_context2.prev = _context2.next) {
                            case 0:
                                uri = this._uri(path);

                                log.debug('PUT ' + uri);
                                return _context2.abrupt('return', axios.put(uri, (0, _util.json)(data), {
                                    headers: {
                                        'Content-Type': 'application/json'
                                    }
                                }));

                            case 3:
                            case 'end':
                                return _context2.stop();
                        }
                    }
                }, _callee2, this);
            }));
        }
    }, {
        key: '_post',
        value: function _post(path, data) {
            return __awaiter(this, void 0, void 0, regeneratorRuntime.mark(function _callee3() {
                var uri;
                return regeneratorRuntime.wrap(function _callee3$(_context3) {
                    while (1) {
                        switch (_context3.prev = _context3.next) {
                            case 0:
                                uri = this._uri(path);

                                log.debug('POST ' + uri);
                                return _context3.abrupt('return', axios.post(uri, (0, _util.json)(data), {
                                    headers: {
                                        'Content-Type': 'application/json'
                                    }
                                }));

                            case 3:
                            case 'end':
                                return _context3.stop();
                        }
                    }
                }, _callee3, this);
            }));
        }
    }, {
        key: '_delete',
        value: function _delete(path) {
            return __awaiter(this, void 0, void 0, regeneratorRuntime.mark(function _callee4() {
                var uri;
                return regeneratorRuntime.wrap(function _callee4$(_context4) {
                    while (1) {
                        switch (_context4.prev = _context4.next) {
                            case 0:
                                uri = this._uri(path);

                                log.debug('DELETE ' + uri);
                                return _context4.abrupt('return', axios.delete(uri));

                            case 3:
                            case 'end':
                                return _context4.stop();
                        }
                    }
                }, _callee4, this);
            }));
        }
        /* ----------------------------------------
           Dashboard API
           ---------------------------------------- */

    }, {
        key: 'dashboard_get',
        value: function dashboard_get(href) {
            var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

            return __awaiter(this, void 0, void 0, regeneratorRuntime.mark(function _callee5() {
                return regeneratorRuntime.wrap(function _callee5$(_context5) {
                    while (1) {
                        switch (_context5.prev = _context5.next) {
                            case 0:
                                return _context5.abrupt('return', this._get(href, { params: options }).then(function (response) {
                                    return new _models.Dashboard(response.data);
                                }));

                            case 1:
                            case 'end':
                                return _context5.stop();
                        }
                    }
                }, _callee5, this);
            }));
        }
    }, {
        key: 'dashboard_get_for_rendering',
        value: function dashboard_get_for_rendering(id) {
            return __awaiter(this, void 0, void 0, regeneratorRuntime.mark(function _callee6() {
                return regeneratorRuntime.wrap(function _callee6$(_context6) {
                    while (1) {
                        switch (_context6.prev = _context6.next) {
                            case 0:
                                return _context6.abrupt('return', this._get('/api/dashboard/' + id + '/for-rendering').then(function (response) {
                                    return new _models.DashboardTuple(response.data);
                                }));

                            case 1:
                            case 'end':
                                return _context6.stop();
                        }
                    }
                }, _callee6, this);
            }));
        }
    }, {
        key: 'dashboard_get_by_id',
        value: function dashboard_get_by_id(id) {
            var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

            return __awaiter(this, void 0, void 0, regeneratorRuntime.mark(function _callee7() {
                return regeneratorRuntime.wrap(function _callee7$(_context7) {
                    while (1) {
                        switch (_context7.prev = _context7.next) {
                            case 0:
                                return _context7.abrupt('return', this.dashboard_get('/api/dashboard/' + id, options));

                            case 1:
                            case 'end':
                                return _context7.stop();
                        }
                    }
                }, _callee7, this);
            }));
        }
    }, {
        key: 'dashboard_create',
        value: function dashboard_create(db) {
            return __awaiter(this, void 0, void 0, regeneratorRuntime.mark(function _callee8() {
                return regeneratorRuntime.wrap(function _callee8$(_context8) {
                    while (1) {
                        switch (_context8.prev = _context8.next) {
                            case 0:
                                return _context8.abrupt('return', this._post('/api/dashboard/', db));

                            case 1:
                            case 'end':
                                return _context8.stop();
                        }
                    }
                }, _callee8, this);
            }));
        }
    }, {
        key: 'dashboard_update',
        value: function dashboard_update(db) {
            return __awaiter(this, void 0, void 0, regeneratorRuntime.mark(function _callee9() {
                return regeneratorRuntime.wrap(function _callee9$(_context9) {
                    while (1) {
                        switch (_context9.prev = _context9.next) {
                            case 0:
                                return _context9.abrupt('return', this._put(db.href, db));

                            case 1:
                            case 'end':
                                return _context9.stop();
                        }
                    }
                }, _callee9, this);
            }));
        }
    }, {
        key: 'dashboard_update_definition',
        value: function dashboard_update_definition(db) {
            return __awaiter(this, void 0, void 0, regeneratorRuntime.mark(function _callee10() {
                return regeneratorRuntime.wrap(function _callee10$(_context10) {
                    while (1) {
                        switch (_context10.prev = _context10.next) {
                            case 0:
                                return _context10.abrupt('return', this._put(db.definition_href, db.definition));

                            case 1:
                            case 'end':
                                return _context10.stop();
                        }
                    }
                }, _callee10, this);
            }));
        }
        /**
         * Delete a dashboard.
         *
         * @param db A dashboard instance, href, or ID.
         */

    }, {
        key: 'dashboard_delete',
        value: function dashboard_delete(db) {
            return __awaiter(this, void 0, void 0, regeneratorRuntime.mark(function _callee11() {
                return regeneratorRuntime.wrap(function _callee11$(_context11) {
                    while (1) {
                        switch (_context11.prev = _context11.next) {
                            case 0:
                                if (!(typeof db === 'string')) {
                                    _context11.next = 4;
                                    break;
                                }

                                return _context11.abrupt('return', this._delete(db));

                            case 4:
                                if (!(typeof db === 'number')) {
                                    _context11.next = 8;
                                    break;
                                }

                                return _context11.abrupt('return', this._delete('/api/dashboard/' + db));

                            case 8:
                                if (!(db instanceof _models.Dashboard)) {
                                    _context11.next = 10;
                                    break;
                                }

                                return _context11.abrupt('return', this._delete(db.href));

                            case 10:
                            case 'end':
                                return _context11.stop();
                        }
                    }
                }, _callee11, this);
            }));
        }
        /**
         * List all dashboards, or dashboards filtered by tag or category.
         */

    }, {
        key: 'dashboard_list',
        value: function dashboard_list() {
            var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

            return __awaiter(this, void 0, void 0, regeneratorRuntime.mark(function _callee12() {
                return regeneratorRuntime.wrap(function _callee12$(_context12) {
                    while (1) {
                        switch (_context12.prev = _context12.next) {
                            case 0:
                                if (!options.tag) {
                                    _context12.next = 4;
                                    break;
                                }

                                return _context12.abrupt('return', this._get('/api/dashboard/tagged/' + options.tag).then(function (response) {
                                    return response.data.map(function (d) {
                                        return new _models.Dashboard(d);
                                    });
                                }));

                            case 4:
                                if (!options.category) {
                                    _context12.next = 8;
                                    break;
                                }

                                return _context12.abrupt('return', this._get('/api/dashboard/category/' + options.category).then(function (response) {
                                    return response.data.map(function (d) {
                                        return new _models.Dashboard(d);
                                    });
                                }));

                            case 8:
                                return _context12.abrupt('return', this._get(options.path || '/api/dashboard/').then(function (response) {
                                    return response.data.map(function (d) {
                                        return new _models.Dashboard(d);
                                    });
                                }));

                            case 9:
                            case 'end':
                                return _context12.stop();
                        }
                    }
                }, _callee12, this);
            }));
        }
        /**
         * List all dashboard categories.
         */

    }, {
        key: 'dashboard_categories',
        value: function dashboard_categories() {
            return __awaiter(this, void 0, void 0, regeneratorRuntime.mark(function _callee13() {
                return regeneratorRuntime.wrap(function _callee13$(_context13) {
                    while (1) {
                        switch (_context13.prev = _context13.next) {
                            case 0:
                                return _context13.abrupt('return', this._get('/api/dashboard/category/').then(function (response) {
                                    return response.data;
                                }));

                            case 1:
                            case 'end':
                                return _context13.stop();
                        }
                    }
                }, _callee13, this);
            }));
        }
        /* ----------------------------------------
           Tag API
           ---------------------------------------- */
        /**
         * List all tags.
         */

    }, {
        key: 'tag_list',
        value: function tag_list() {
            return __awaiter(this, void 0, void 0, regeneratorRuntime.mark(function _callee14() {
                return regeneratorRuntime.wrap(function _callee14$(_context14) {
                    while (1) {
                        switch (_context14.prev = _context14.next) {
                            case 0:
                                return _context14.abrupt('return', this._get('/api/tag/').then(function (response) {
                                    return response.data.map(function (d) {
                                        return new _models.Tag(d);
                                    });
                                }));

                            case 1:
                            case 'end':
                                return _context14.stop();
                        }
                    }
                }, _callee14, this);
            }));
        }
        /**
         * Get a tag by href.
         */

    }, {
        key: 'tag_get',
        value: function tag_get(href) {
            return __awaiter(this, void 0, void 0, regeneratorRuntime.mark(function _callee15() {
                return regeneratorRuntime.wrap(function _callee15$(_context15) {
                    while (1) {
                        switch (_context15.prev = _context15.next) {
                            case 0:
                                return _context15.abrupt('return', this._get(href).then(function (response) {
                                    return new _models.Tag(response.data[0]);
                                }));

                            case 1:
                            case 'end':
                                return _context15.stop();
                        }
                    }
                }, _callee15, this);
            }));
        }
        /**
         * Get a tag by ID.
         */

    }, {
        key: 'tag_get_by_id',
        value: function tag_get_by_id(id) {
            return __awaiter(this, void 0, void 0, regeneratorRuntime.mark(function _callee16() {
                return regeneratorRuntime.wrap(function _callee16$(_context16) {
                    while (1) {
                        switch (_context16.prev = _context16.next) {
                            case 0:
                                return _context16.abrupt('return', this._get('/api/tag/' + id).then(function (response) {
                                    return new _models.Tag(response.data[0]);
                                }));

                            case 1:
                            case 'end':
                                return _context16.stop();
                        }
                    }
                }, _callee16, this);
            }));
        }
        /* ----------------------------------------
           Preferences
           ---------------------------------------- */
        /**
         * Get the preferences for the current user.
         */

    }, {
        key: 'preferences_get',
        value: function preferences_get() {
            return __awaiter(this, void 0, void 0, regeneratorRuntime.mark(function _callee17() {
                return regeneratorRuntime.wrap(function _callee17$(_context17) {
                    while (1) {
                        switch (_context17.prev = _context17.next) {
                            case 0:
                                return _context17.abrupt('return', this._get('/api/preferences').then(function (response) {
                                    return new _models.Preferences(response.data);
                                }));

                            case 1:
                            case 'end':
                                return _context17.stop();
                        }
                    }
                }, _callee17, this);
            }));
        }
    }]);

    return Client;
}();



exports.default = Client;

},{"./models":40,"./util":88,"axios":93}],26:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.actions = undefined;

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _util = require('../util');

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 * An object describing a user-interface action. Actions may be
 * rendered as either a menu item in a dropdown or a button in a
 * button bar.
 */
var Action = function () {
    function Action(data) {
        _classCallCheck(this, Action);

        if (data) {
            this.name = data.name;
            this.display = data.display;
            this.icon = data.icon;
            this.options = data.options;
            this.handler = data.handler;
            this.show = data.show;
            this.hide = data.hide;
            this.divider = data.divider;
            this.css = data.css;
            this._actions = data.actions;
            this.category = data.category;
        }
    }

    _createClass(Action, [{
        key: 'actions',
        get: function get() {
            if (typeof this._actions === 'undefined') {
                return undefined;
            } else if (typeof this._actions === 'string') {
                return actions.list(this._actions);
            } else if (this._actions instanceof Array) {
                return this._actions;
            } else {
                var fn = this._actions;
                return fn();
            }
        }
    }]);

    return Action;
}();

exports.default = Action;

Action.DIVIDER = new Action({ divider: true, name: 'DIVIDER' });
var actions = exports.actions = new _util.Registry({
    name: 'actions',
    process: function process(data) {
        if (data instanceof Action) return data;
        return new Action(data);
    }
});


},{"../util":88}],27:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _action = require('./action');

Object.defineProperty(exports, 'actions', {
  enumerable: true,
  get: function get() {
    return _action.actions;
  }
});
Object.defineProperty(exports, 'Action', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_action).default;
  }
});

var _property = require('./property');

Object.defineProperty(exports, 'properties', {
  enumerable: true,
  get: function get() {
    return _property.properties;
  }
});
Object.defineProperty(exports, 'property', {
  enumerable: true,
  get: function get() {
    return _property.property;
  }
});
Object.defineProperty(exports, 'Property', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_property).default;
  }
});

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

},{"./action":26,"./property":28}],28:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.properties = exports.PropertyType = undefined;

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

exports.property = property;

var _util = require('../util');

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var log = (0, _util.logger)('property');
var PropertyType = exports.PropertyType = {
    SELECT: 'select',
    BOOLEAN: 'boolean',
    TEXT: 'text'
};

var Property = function () {
    function Property(data) {
        _classCallCheck(this, Property);

        this.name = data.name;
        this.property_name = data.property_name || this.name;
        this.category = data.category;
        this.type = data.type;
        this.edit_options = data.edit_options;
        this.template = new _util.Template(data.template);
    }
    /**
     * Render the basic display of the property's value.
     */


    _createClass(Property, [{
        key: 'render',
        value: function render(item) {
            log.debug('render(' + this.name + ' / ' + item.item_id + ')');
            var inner = undefined;
            if (this.template == null) {
                var value = item[this.property_name];
                inner = value ? value.toString() : '';
            } else {
                inner = this.template.render({ property: this, item: item });
            }
            return '<span id="' + item.item_id + this.property_name + '">' + inner + '</span>';
        }
        /**
         * Make the property editable by transforming its value display into
         * an in-line edit widget.
         */

    }, {
        key: 'edit',
        value: function edit(item) {
            var _this = this;

            log.debug('edit(' + this.name + ' / ' + item.item_id + ')');
            var default_options = {
                type: PropertyType.TEXT,
                value: item[this.property_name] || '',
                success: function success(ignore, newValue) {
                    log.debug('update(' + item.item_id + '.' + _this.property_name + ') => ' + newValue);
                    item[_this.property_name] = newValue;
                    if (item.updated) {
                        item.updated();
                    }
                }
            };
            var options = (0, _util.extend)({}, default_options, this.edit_options);
            if (this.type === PropertyType.BOOLEAN) {
                (0, _util.extend)(options, {
                    type: 'select',
                    source: [{ value: 'no', text: 'no' }, { value: 'yes', text: 'yes' }],
                    value: function value(item) {
                        var value = !!item[_this.property_name];
                        return value ? 'yes' : 'no';
                    },
                    success: function success(ignore, newValue) {
                        log.debug('boolean.success: ' + _this.property_name + ': ' + newValue + ' / ' + (typeof newValue === 'undefined' ? 'undefined' : _typeof(newValue)));
                        item[_this.property_name] = newValue === 'yes';
                        if (item.updated) {
                            item.updated();
                        }
                    }
                });
            } else if (this.type) {
                options.type = this.type;
            }
            if (this.type === 'select' && options.source instanceof Array) {
                options.source = options.source.map(function (value) {
                    if (value instanceof String) {
                        return { value: value, text: value };
                    } else if (typeof value === 'undefined') {
                        return { value: undefined, text: 'none' };
                    } else {
                        return value;
                    }
                });
            }
            if (options.source && options.source instanceof Function) {
                options.source = options.source();
            }
            if (options.value && options.value instanceof Function) {
                options.value = options.value(item);
            }
            if (options.update && options.update instanceof Function) {
                options.success = function (ignore, newValue) {
                    options.update(item, newValue);
                };
            }
            var selector = '#' + item.item_id + this.property_name;
            log.debug('editable(' + selector + ')');
            $(selector).editable(options);
            return this;
        }
    }]);

    return Property;
}();
/**
 * Registry of property definitions. Properties which have complex
 * handlers and are shared between multiple dashboard items should be
 * registered.
 */


exports.default = Property;
var properties = exports.properties = new _util.Registry({
    name: 'properties',
    ignore_categories: true,
    process: function process(data) {
        if (data instanceof Property) {
            return data;
        } else if (typeof data === 'string') {
            return new Property({ name: data });
        } else {
            return new Property(data);
        }
    }
});
/**
 * Canonicalize properties.
 */
function property(data) {
    if (data instanceof Property) {
        return data;
    } else if (typeof data === 'string') {
        var prop = properties.get(data);
        return prop ? prop : new Property({ name: data });
    } else {
        return new Property(data);
    }
}


},{"../util":88}],29:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();

exports.parse_raw = parse_raw;
exports.parse_raw_line = parse_raw_line;
/**
 * A TypeScript description of the graphite-web JSON data format.
 *
 * @see http://graphite.readthedocs.org/en/latest/render_api.html#data-display-formats
 */
/**
 * Parse Graphite's `raw` data format, which is a more compact
 * on-the-wire representation than JSON.
 *
 * ```
 * Targets are output one per line and are of the format <target
 * name>,<start timestamp>,<end timestamp>,<series step>|[data]*
 * ```
 */
function parse_raw(raw) {
    var lines = raw.split(/\r?\n/);
    return lines.map(function (line) {
        return parse_raw_line(line);
    });
}
/**
 * Parse a single line of Graphite's `raw` data format, which
 * represents a single data series.
 */
function parse_raw_line(line) {
    var _line$split = line.split('|'),
        _line$split2 = _slicedToArray(_line$split, 2),
        meta_string = _line$split2[0],
        values_string = _line$split2[1];

    var _meta_string$split = meta_string.split(','),
        _meta_string$split2 = _slicedToArray(_meta_string$split, 4),
        target = _meta_string$split2[0],
        _start = _meta_string$split2[1],
        _end = _meta_string$split2[2],
        _step = _meta_string$split2[3];

    var start = Number(_start);
    var end = Number(_end);
    var step = Number(_step);
    var series = {
        target: target,
        datapoints: []
    };
    var values = values_string.split(',');
    var timestamp = start;
    var _iteratorNormalCompletion = true;
    var _didIteratorError = false;
    var _iteratorError = undefined;

    try {
        for (var _iterator = values[Symbol.iterator](), _step2; !(_iteratorNormalCompletion = (_step2 = _iterator.next()).done); _iteratorNormalCompletion = true) {
            var v = _step2.value;

            var value = Number(v);
            if (Number.isNaN(value)) {
                value = null;
            }
            series.datapoints.push([value, timestamp]);
            timestamp += step;
        }
    } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
    } finally {
        try {
            if (!_iteratorNormalCompletion && _iterator.return) {
                _iterator.return();
            }
        } finally {
            if (_didIteratorError) {
                throw _iteratorError;
            }
        }
    }

    return series;
}


},{}],30:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _propertySheets = require('./property-sheets');

Object.keys(_propertySheets).forEach(function (key) {
    if (key === "default" || key === "__esModule") return;
    Object.defineProperty(exports, key, {
        enumerable: true,
        get: function get() {
            return _propertySheets[key];
        }
    });
});

var _core = require('../core');

var core = _interopRequireWildcard(_core);

var _app = require('../app/app');

var app = _interopRequireWildcard(_app);

var _manager = require('../app/manager');

var _manager2 = _interopRequireDefault(_manager);

var _axis = require('../models/axis');

var _axis2 = _interopRequireDefault(_axis);

var _container = require('../models/items/container');

var _container2 = _interopRequireDefault(_container);

var _cell = require('../models/items/cell');

var _cell2 = _interopRequireDefault(_cell);

var _row = require('../models/items/row');

var _row2 = _interopRequireDefault(_row);

var _factory = require('../models/items/factory');

var _util = require('../util');

var _queries = require('./queries');

var queries = _interopRequireWildcard(_queries);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

var log = (0, _util.logger)('edit');
/**
 * Toggle mode-specific CSS rules for dashboard structural elements.
 */
app.add_mode_handler(app.Mode.EDIT, {
    enter: function enter() {
        log.debug('mode_handler.enter()');
        $('.ds-dashboard .ds-section, .ds-cell, .ds-row').addClass('ds-edit');
    },
    exit: function exit() {
        log.debug('mode_handler.exit()');
        $('.ds-dashboard .ds-section, .ds-cell, .ds-row').removeClass('ds-edit');
    },
    refresh: function refresh() {
        log.debug('mode_handler.refresh()');
        $('.ds-dashboard .ds-section, .ds-cell, .ds-row').addClass('ds-edit');
    }
});
/* -----------------------------------------------------------------------------
   Item Actions
   ----------------------------------------------------------------------------- */
var duplicate_item_action = new core.Action({
    name: 'duplicate',
    display: 'Duplicate Item',
    icon: 'fa fa-copy',
    handler: function handler(action, item) {
        var dashboard = _manager2.default.current.dashboard;
        var parent = dashboard.find_parent(item);
        var dup = (0, _factory.make)(item.toJSON()).set_item_id(null);
        dup.visit(function (child) {
            child.item_id = null;
        });
        parent.add_after(item, dup);
        dashboard.update_index();
        _manager2.default.update_item_view(parent);
    }
});
var delete_action = new core.Action({
    name: 'delete',
    display: 'Delete item',
    icon: 'fa fa-trash-o',
    handler: function handler(action, item) {
        var parent = _manager2.default.current.dashboard.find_parent(item);
        if (!parent) {
            return;
        }
        if (parent && parent instanceof _container2.default && parent.remove(item)) {
            _manager2.default.update_item_view(parent);
        }
    }
});
var move_back_action = new core.Action({
    name: 'move-back',
    display: 'Move item back one place',
    icon: 'fa fa-caret-left',
    handler: function handler(action, item) {
        var parent = _manager2.default.current.dashboard.find_parent(item);
        if (parent instanceof _container2.default && parent.move(item, -1)) {
            _manager2.default.update_item_view(parent);
        }
    }
});
var move_forward_action = new core.Action({
    name: 'move-forward',
    display: 'Move item forward one place',
    icon: 'fa fa-caret-right',
    handler: function handler(action, item) {
        var parent = _manager2.default.current.dashboard.find_parent(item);
        if (parent instanceof _container2.default && parent.move(item, 1)) {
            _manager2.default.update_item_view(parent);
        }
    }
});
var view_definition_action = new core.Action({
    name: 'view-definition',
    display: 'View definition...',
    icon: 'fa fa-code',
    handler: function handler(action, item) {
        var contents = ts.templates.edit.item_source({ item: item });
        bootbox.alert({
            backdrop: false,
            message: contents
        });
    }
});
/* -----------------------------------------------------------------------------
   New from Graphite URL Action
   ----------------------------------------------------------------------------- */
function new_chart_from_graphite_url(url_string) {
    var dash = _manager2.default.current.dashboard;
    var url = new URI(url_string);
    var data = url.search(true);
    var query = queries.new_query(dash, data.target);
    var type = 'standard_time_series';
    if (data.areaMode && data.areaMode === 'stacked') {
        type = 'stacked_area_chart';
    } else if (data.graphType && data.graphType === 'pie') {
        type = 'donut_chart';
    }
    var chart = (0, _factory.make)(type).set_dashboard(dash).set_query(query.name).set_height(Math.min(8, Math.floor((data.height || 400) / 80))).set_title(data.title);
    chart.options = chart.options || {};
    if (data.vtitle) {
        if (!chart.options.y1) chart.options.y1 = new _axis2.default();
        chart.options.y1.label = data.vtitle;
    }
    if (data.yMin) {
        if (!chart.options.y1) chart.options.y1 = new _axis2.default();
        chart.options.y1.min = data.yMin;
    }
    if (data.yMax) {
        if (!chart.options.y1) chart.options.y1 = new _axis2.default();
        chart.options.y1.max = data.yMax;
    }
    if (data.template) {
        chart.options.palette = data.template;
    }
    return chart;
}
core.actions.register({
    name: 'new-chart-from-url',
    category: 'new-item-chart',
    display: 'Add new chart from Graphite URL',
    icon: 'fa fa-image',
    css: 'new-item',
    handler: function handler(action, container) {
        bootbox.prompt({
            title: "Enter a Graphite chart URL",
            backdrop: false,
            callback: function callback(result) {
                if (result) {
                    var item = new_chart_from_graphite_url(result);
                    if (item) {
                        container.add(item);
                    }
                }
            }
        });
    }
});
/* -----------------------------------------------------------------------------
   New item handling
   ----------------------------------------------------------------------------- */
function new_item_actions() {
    var list = [].concat(core.actions.get('new-item-structural', 'row'), core.Action.DIVIDER, core.actions.list('new-item-display').sort(function (a, b) {
        return a.icon.localeCompare(b.icon);
    }), core.Action.DIVIDER, core.actions.list('new-item-data-table').sort(function (a, b) {
        return a.icon.localeCompare(b.icon);
    }), core.Action.DIVIDER, core.actions.list('new-item-chart').sort(function (a, b) {
        return a.icon.localeCompare(b.icon);
    }));
    var other = core.actions.list('new-item');
    if (other && other.length) {
        list.concat(other.sort(function (a, b) {
            return a.icon.localeCompare(b.icon);
        }));
    }
    return list;
}
var new_item_action_for_cell = new core.Action({
    name: 'new-item',
    category: 'new-item',
    css: 'ds-new-item',
    display: 'Add new dashboard item...',
    icon: 'fa fa-plus',
    actions: new_item_actions
});
var new_item_action_for_section = new core.Action({
    name: 'new-item',
    category: 'new-item',
    css: 'ds-new-item',
    display: 'Add new dashboard item...',
    icon: 'fa fa-plus',
    actions: function actions() {
        return [].concat(core.actions.get('new-item-structural', 'section'), core.actions.get('new-item-structural', 'row'), core.Action.DIVIDER, core.actions.list('new-item-display').sort(function (a, b) {
            return a.icon.localeCompare(b.icon);
        }));
    }
});
var combinations = [[12], [], [6, 6], [4, 4, 4], [3, 3, 3, 3], [2, 2, 2, 2, 2, 2], [], [9, 3], [6, 3, 3], [3, 9], [3, 3, 6], [], [8, 4], [8, 2, 2], [4, 8], [2, 2, 8]];
core.actions.register('new-combination', combinations.map(function (combo) {
    if (!combo || !combo.length) {
        return core.Action.DIVIDER;
    }
    return new core.Action({
        category: 'new-combination',
        name: 'new-combination-' + combo.join('-'),
        display: '[' + combo.join(', ') + ']',
        icon: 'fa fa-columns',
        css: 'new-item',
        handler: function handler(action, container) {
            var row = new _row2.default();
            var _iteratorNormalCompletion = true;
            var _didIteratorError = false;
            var _iteratorError = undefined;

            try {
                for (var _iterator = combo[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
                    var span = _step.value;

                    row.add(new _cell2.default({ span: span }));
                }
            } catch (err) {
                _didIteratorError = true;
                _iteratorError = err;
            } finally {
                try {
                    if (!_iteratorNormalCompletion && _iterator.return) {
                        _iterator.return();
                    }
                } finally {
                    if (_didIteratorError) {
                        throw _iteratorError;
                    }
                }
            }

            container.add(row);
        }
    });
}));
var new_combinations_action_for_section = new core.Action({
    name: 'new-item-combination',
    category: 'new-item',
    css: 'ds-new-item',
    display: 'Add new row combination...',
    icon: 'fa fa-th',
    actions: function actions() {
        return core.actions.list('new-combination');
    }
});
$(document).on('click', 'li.new-item', function (event) {
    log.debug('li.new-item.click');
    var elt = $(this);
    var category = elt.attr('data-ds-category');
    var name = elt.attr('data-ds-action');
    var item_id = elt.parent().parent().parent().parent()[0].getAttribute('data-ds-item-id');
    var item = _manager2.default.current.dashboard.get_item(item_id);
    var action = core.actions.get(category, name);
    log.debug('li.new-item:click(): ' + item_id + ', ' + action + ', ' + category + '/' + name);
    action.handler(action, item);
    return false;
});
/* -----------------------------------------------------------------------------
   Section actions
   ----------------------------------------------------------------------------- */
core.actions.register('edit-bar-section', [new_item_action_for_section, new_combinations_action_for_section, duplicate_item_action, core.Action.DIVIDER, move_back_action, move_forward_action, core.Action.DIVIDER, delete_action]);
/* -----------------------------------------------------------------------------
   Row actions
   ----------------------------------------------------------------------------- */
core.actions.register('edit-bar-row', [new core.Action({
    name: 'new-cell',
    display: 'Add new Cell',
    icon: 'fa fa-plus',
    handler: function handler(action, container) {
        container.add('cell');
    }
}), duplicate_item_action, core.Action.DIVIDER, move_back_action, move_forward_action, core.Action.DIVIDER, delete_action]);
/* -----------------------------------------------------------------------------
   Cell actions
   ----------------------------------------------------------------------------- */
core.actions.register('edit-bar-cell', [new_item_action_for_cell, duplicate_item_action, core.Action.DIVIDER, move_back_action, move_forward_action, new core.Action({
    name: 'increase-span',
    display: 'Increase cell span by one',
    icon: 'fa fa-expand',
    handler: function handler(action, item) {
        if (item.span) {
            item.span += 1;
            _manager2.default.update_item_view(item);
        }
    }
}), new core.Action({
    name: 'decrease-span',
    display: 'Decrease cell span by one',
    icon: 'fa fa-compress',
    handler: function handler(action, item) {
        if (item.span) {
            item.span -= 1;
            _manager2.default.update_item_view(item);
        }
    }
}), core.Action.DIVIDER, delete_action]);
/* -----------------------------------------------------------------------------
   Item actions
   ----------------------------------------------------------------------------- */
core.actions.register('edit-bar-item', [duplicate_item_action, core.Action.DIVIDER, move_back_action, move_forward_action, view_definition_action, core.Action.DIVIDER, delete_action]);
/* -----------------------------------------------------------------------------
   Edit Bar Handler
   ----------------------------------------------------------------------------- */
$(document).on('click', '.ds-edit-bar button', function (event) {
    log.debug('click.ds-edit-bar button');
    var element = $(this)[0];
    var parent = $(this).parent()[0];
    var item_id = parent.getAttribute('data-ds-item-id');
    var name = element.getAttribute('data-ds-action');
    var category = element.getAttribute('data-ds-category');
    var action = core.actions.get(category, name);
    var item = _manager2.default.current.dashboard.get_item(item_id);
    if (action) {
        action.handler(action, item);
    }
});


},{"../app/app":1,"../app/manager":16,"../core":27,"../models/axis":36,"../models/items/cell":43,"../models/items/container":48,"../models/items/factory":52,"../models/items/row":59,"../util":88,"./property-sheets":31,"./queries":32}],31:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.hide_details = hide_details;
exports.show_details = show_details;
exports.toggle_details = toggle_details;
exports.details_visibility = details_visibility;

var _util = require('../util');

var _manager = require('../app/manager');

var _manager2 = _interopRequireDefault(_manager);

var _app = require('../app/app');

var app = _interopRequireWildcard(_app);

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var log = (0, _util.logger)('edit');
/* -----------------------------------------------------------------------------
   Property Sheets
   ----------------------------------------------------------------------------- */
/**
 * Helper functions to show & hide the action bar & property sheet
 * for dashboard items.
 */
function hide_details(item_id) {
    var details = $('#' + item_id + '-details');
    details.remove();
    $('.ds-edit-bar[data-ds-item-id="' + item_id + '"] .btn-group').hide();
    $('.ds-edit-bar[data-ds-item-id="' + item_id + '"] .badge').removeClass('ds-badge-highlight');
}
function show_details(item_id) {
    // Show the edit button bar across the top of the item
    $('.ds-edit-bar[data-ds-item-id="' + item_id + '"] .btn-group').show();
    var item = _manager2.default.current.dashboard.get_item(item_id);
    var bar_id = '.ds-edit-bar[data-ds-item-id="' + item_id + '"]';
    var details_id = '#' + item_id + '-details';
    if ($(details_id).length == 0) {
        // Render the item's property sheet
        var elt = $('.ds-edit-bar[data-ds-item-id="' + item_id + '"]');
        var details = ts.templates['ds-edit-bar-item-details']({ item: item });
        elt.append(details);
        if (item.meta.interactive_properties) {
            // Run the edit handlers for each property, which make them
            // editable and set up the callbacks for their updates
            var _iteratorNormalCompletion = true;
            var _didIteratorError = false;
            var _iteratorError = undefined;

            try {
                for (var _iterator = item.meta.interactive_properties[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
                    var prop = _step.value;

                    prop.edit(item);
                }
            } catch (err) {
                _didIteratorError = true;
                _iteratorError = err;
            } finally {
                try {
                    if (!_iteratorNormalCompletion && _iterator.return) {
                        _iterator.return();
                    }
                } finally {
                    if (_didIteratorError) {
                        throw _iteratorError;
                    }
                }
            }
        }
    }
}
function toggle_details(item_id) {
    var details = $('#' + item_id + '-details');
    if (details.is(':visible')) {
        hide_details(item_id);
        return false;
    } else {
        show_details(item_id);
        return true;
    }
}
function details_visibility(item) {
    return $('#' + item.item_id + '-details').is(':visible');
}
/* -----------------------------------------------------------------------------
   Property Sheets Event Handlers
   ----------------------------------------------------------------------------- */
/**
 * Event handlers to show & hide the action bar & property sheet for
 * dashboard items.
 */
$(document).on('click', '.ds-edit-bar .badge', function (event) {
    var $elt = $(this);
    var id = $elt.attr('data-ds-item-id');
    if (toggle_details(id)) {
        $elt.addClass('ds-badge-highlight');
    } else {
        $elt.removeClass('ds-badge-highlight');
    }
});
$(document).on('mouseenter', '.ds-edit-bar', function (event) {
    var timeout_id = $(this).attr('data-ds-timeout-id');
    if (timeout_id) {
        window.clearTimeout(timeout_id);
    }
});
$(document).on('mouseleave', '.ds-edit-bar', function (event) {
    var $elt = $(this);
    var id = $elt.attr('data-ds-item-id');
    var timeout = app.config.PROPSHEET_AUTOCLOSE_SECONDS;
    if (timeout) {
        var timeout_id = window.setTimeout(function () {
            hide_details(id);
        }, timeout * 1000);
        $elt.attr('data-ds-timeout-id', timeout_id);
    }
});


},{"../app/app":1,"../app/manager":16,"../util":88}],32:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.rename_query = rename_query;
exports.delete_query = delete_query;
exports.add_query = add_query;
exports.duplicate_query = duplicate_query;
exports.new_query = new_query;
exports.edit_queries = edit_queries;

var _util = require('../util');

var _core = require('../core');

var core = _interopRequireWildcard(_core);

var _query = require('../models/data/query');

var _query2 = _interopRequireDefault(_query);

var _manager = require('../app/manager');

var _manager2 = _interopRequireDefault(_manager);

var _app = require('../app/app');

var app = _interopRequireWildcard(_app);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

var log = (0, _util.logger)('edit');
/* -----------------------------------------------------------------------------
   Query Functions
   ----------------------------------------------------------------------------- */
/**
 * Rename a query and update the UI to reflect the change.
 */
function rename_query(dashboard, old_name, new_name) {
    log.debug('rename_query()');
    _manager2.default.without_updates(function () {
        var query = dashboard.definition.queries[old_name];
        var updated_items = dashboard.definition.rename_query(old_name, new_name);
        $('[data-ds-query-name="' + old_name + '"]').replaceWith(ts.templates.edit['dashboard-query-row'](query));
    });
    edit_queries();
    app.refresh_mode();
}
/**
 * Delete a query and remove it from the queries list in the UI.
 */
function delete_query(dashboard, query_name) {
    log.debug('delete_query()');
    dashboard.definition.delete_query(query_name);
    $('tr[data-ds-query-name="' + query_name + '"]').remove();
    edit_queries();
    app.refresh_mode();
}
/**
 * Add a new query to the dashboard and UI.
 */
function add_query(dashboard, name, target) {
    log.debug('add_query()');
    var query = new _query2.default({ name: name, targets: target });
    _manager2.default.without_updates(function () {
        dashboard.definition.add_query(query);
        $("#ds-query-panel table").append(ts.templates.edit['dashboard-query-row'](query));
        query.load();
    });
    edit_queries();
    return query;
}
function duplicate_query(dashboard, name) {
    log.debug('duplicate_query()');
    var new_name = 'Copy of ' + name + ' ' + Object.keys(dashboard.definition.queries).length;
    var source = dashboard.definition.queries[name];
    return add_query(dashboard, new_name, source.targets.slice(0));
}
/**
 * Add a new query object to the dashboard and UI with an
 * auto-generated unique name, and an optional set of targets. If
 * targets are not supplied, a function generating random data will
 * be used as a placeholder.
 */
function new_query(dashboard, targets) {
    log.debug('new_query()');
    var name = "query" + Object.keys(dashboard.definition.queries).length;
    return add_query(dashboard, name, targets || 'absolute(randomWalkFunction("' + name + '"))');
}
function edit_queries() {
    log.debug('edit_queries()');
    /* Query names */
    $('th.ds-query-name').each(function (index, e) {
        var element = $(e);
        var query_name = e.getAttribute('data-ds-query-name');
        element.editable({
            type: 'text',
            value: query_name,
            success: function success(ignore, newValue) {
                rename_query(_manager2.default.current.dashboard, query_name, newValue);
            }
        });
    });
    /* Query targets */
    $('td.ds-query-target').each(function (index, e) {
        var element = $(e);
        var query_name = e.getAttribute('data-ds-query-name');
        element.editable({
            type: 'textarea',
            inputclass: 'ds-source',
            value: element.text() || '',
            success: function success(ignore, newValue) {
                var target = newValue.trim();
                var query = _manager2.default.current.dashboard.definition.queries[query_name];
                _manager2.default.current.dashboard.definition.updated();
                query.targets = [target];
                query.render_templates(app.context().variables);
                query.load();
            }
        });
    });
}
/* -----------------------------------------------------------------------------
   Query Event Handlers
   ----------------------------------------------------------------------------- */
/* Query delete buttons */
$(document).on('click', 'button.ds-delete-query-button', function (e) {
    log.debug('click.delete-query');
    var $elt = $(this);
    var query_name = $elt.attr('data-ds-query-name');
    var dashboard = _manager2.default.current.dashboard;
    if (!dashboard.definition.queries[query_name]) {
        return true;
    }
    var queries_in_use = dashboard.definition.get_queries();
    if (queries_in_use[query_name]) {
        bootbox.dialog({
            backdrop: false,
            message: 'Query ' + query_name + ' is in use. Are you sure you want to delete it?',
            title: 'Confirm query delete',
            buttons: {
                cancel: {
                    label: 'Cancel',
                    className: 'btn-default'
                },
                confirm: {
                    label: 'Delete',
                    className: 'btn-danger',
                    callback: function callback() {
                        delete_query(dashboard, query_name);
                    }
                }
            }
        });
    } else {
        delete_query(dashboard, query_name);
    }
    return true;
});
/* Query duplicate buttons */
$(document).on('click', 'button.ds-duplicate-query-button', function (e) {
    log.debug('click.duplicate-query');
    var $elt = $(this);
    var query_name = $elt.attr('data-ds-query-name');
    var dashboard = _manager2.default.current.dashboard;
    if (!dashboard.definition.queries[query_name]) {
        return true;
    }
    duplicate_query(dashboard, query_name);
    return true;
});
$(document).on('shown.bs.tab', 'a[data-toggle="tab"]', function (e) {
    log.debug('shown.bs.tab ' + e.target.href);
    if (e.target.id == 'ds-edit-tab-queries') {
        edit_queries();
    }
});
/* -----------------------------------------------------------------------------
   Dashboard Query Panel
   ----------------------------------------------------------------------------- */
core.actions.register('dashboard-queries', [new core.Action({
    name: 'new-query',
    display: 'New Query...',
    icon: 'fa fa-plus',
    handler: function handler(action, dashboard) {
        new_query(dashboard);
    }
})]);
$(document).on('click', '#ds-query-panel button', function (event) {
    var element = $(this)[0];
    var name = element.getAttribute('data-ds-action');
    var action = core.actions.get('dashboard-queries', name);
    if (action) {
        action.handler(action, _manager2.default.current.dashboard);
    }
});


},{"../app/app":1,"../app/manager":16,"../core":27,"../models/data/query":38,"../util":88}],33:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();

exports.get_api_url = get_api_url;
exports.import_dashboard = import_dashboard;

var _app = require('../app');

var _models = require('../models');

var models = _interopRequireWildcard(_models);

var _util = require('../util');

var _charts = require('../charts');

var charts = _interopRequireWildcard(_charts);

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) {
            try {
                step(generator.next(value));
            } catch (e) {
                reject(e);
            }
        }
        function rejected(value) {
            try {
                step(generator["throw"](value));
            } catch (e) {
                reject(e);
            }
        }
        function step(result) {
            result.done ? resolve(result.value) : new P(function (resolve) {
                resolve(result.value);
            }).then(fulfilled, rejected);
        }
        step((generator = generator.apply(thisArg, _arguments)).next());
    });
};

var axios = require('axios');
var URI = require('urijs');
var inflection = require('inflection');
var log = (0, _util.logger)('importer.graphite');
function translate(gdash) {
    var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

    return _app.manager.without_updates(function () {
        var columns = opt.columns || 3;
        var span = 12 / columns;
        var section = new models.Section();
        var definition = new models.DashboardDefinition({
            items: [section]
        });
        var dash = new models.Dashboard({
            title: inflection.dasherize(gdash.name),
            category: 'Graphite',
            tags: ['imported'],
            definition: definition
        });
        var row = new models.Row();
        var _iteratorNormalCompletion = true;
        var _didIteratorError = false;
        var _iteratorError = undefined;

        try {
            for (var _iterator = gdash.graphs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
                var graph = _step.value;

                var _graph = _slicedToArray(graph, 3),
                    targets = _graph[0],
                    options = _graph[1],
                    render_url = _graph[2];

                var is_stacked = render_url.indexOf('stacked') > -1 || options.areaMode && options.areaMode === 'stacked';
                var query_name = 'q' + Object.keys(definition.queries).length;
                var query = new models.Query({
                    name: query_name,
                    targets: options.target || []
                });
                definition.add_query(query);
                var presentation = new models.StandardTimeSeries({
                    query: query,
                    title: options.title,
                    stack_mode: is_stacked ? charts.StackMode.NORMAL : charts.StackMode.NONE,
                    options: {
                        y1: {
                            label: options.vtitle,
                            max: options.yMax,
                            min: options.yMin
                        },
                        palette: options.template
                    }
                });
                row.add(new models.Cell({
                    span: span,
                    items: [presentation]
                }));
                if (row.items.length === columns) {
                    section.add(row);
                    row = new models.Row();
                }
            }
        } catch (err) {
            _didIteratorError = true;
            _iteratorError = err;
        } finally {
            try {
                if (!_iteratorNormalCompletion && _iterator.return) {
                    _iterator.return();
                }
            } finally {
                if (_didIteratorError) {
                    throw _iteratorError;
                }
            }
        }

        if (row && row.items && row.items.length) {
            section.items.push(row);
        }
        return dash;
    });
}
/**
 * Translate from a Graphite dashboard UI URL to an API URL to load
 * the JSON definition.
 */
function get_api_url(dash_url) {
    var uri = new URI(dash_url);
    return uri.segment('load').segment(uri.fragment()).fragment(null).toString();
}
/**
 * Fetch a Graphite dashboard definition, convert it to a Tessera
 * dashboard definition, and upload it to the Tessera server via the
 * API.
 */
function import_dashboard(url) {
    return __awaiter(this, void 0, void 0, regeneratorRuntime.mark(function _callee() {
        var api_url, axios_config, auth, _auth$split, _auth$split2, username, password;

        return regeneratorRuntime.wrap(function _callee$(_context) {
            while (1) {
                switch (_context.prev = _context.next) {
                    case 0:
                        api_url = get_api_url(url);

                        log.info('Importing dashboard from ' + api_url + '...');
                        // TODO: this is duplicated from query.ts
                        axios_config = {
                            url: api_url.toString(),
                            method: 'get'
                        };
                        auth = _app.config.GRAPHITE_AUTH ? _app.config.GRAPHITE_AUTH.trim() : '';

                        if (auth) {
                            _auth$split = auth.split(':'), _auth$split2 = _slicedToArray(_auth$split, 2), username = _auth$split2[0], password = _auth$split2[1];

                            axios_config.auth = {
                                username: username,
                                password: password
                            };
                            axios_config.withCredentials = true;
                        }
                        return _context.abrupt('return', axios(axios_config).then(function (response) {
                            return translate(response.data.state);
                        }).then(function (dash) {
                            return _app.manager.client.dashboard_create(dash).then(function (response) {
                                return response;
                            }).catch(function (error) {
                                _app.manager.error('Error creating dashboard. ' + error);
                            });
                        }));

                    case 6:
                    case 'end':
                        return _context.stop();
                }
            }
        }, _callee, this);
    }));
}


},{"../app":14,"../charts":20,"../models":40,"../util":88,"axios":93,"inflection":415,"urijs":419}],34:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.graphite = undefined;

var _graphite2 = require('./graphite');

var _graphite = _interopRequireWildcard(_graphite2);

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

var graphite = exports.graphite = _graphite;


},{"./graphite":33}],35:[function(require,module,exports){
'use strict';

require('babel-polyfill');

var _util = require('./util');

var _core = require('./core');

var core = _interopRequireWildcard(_core);

var _core2 = require('./charts/core');

var charts = _interopRequireWildcard(_core2);

var _factory = require('./models/items/factory');

var factory = _interopRequireWildcard(_factory);

var _app = require('./app/app');

var app = _interopRequireWildcard(_app);

var _edit = require('./edit/edit');

var edit = _interopRequireWildcard(_edit);

var _importer = require('./importer');

var importer = _interopRequireWildcard(_importer);

var _client = require('./client');

var _client2 = _interopRequireDefault(_client);

var _action = require('./core/action');

var _transform = require('./models/transform/transform');

var _user = require('./models/user');

var _user2 = _interopRequireDefault(_user);

var _manager = require('./app/manager');

var _manager2 = _interopRequireDefault(_manager);

var _graphite = require('./charts/graphite');

var _graphite2 = _interopRequireDefault(_graphite);

var _flot = require('./charts/flot');

var _flot2 = _interopRequireDefault(_flot);

var _helpers = require('./app/helpers');

var _items = require('./models/items');

var items = _interopRequireWildcard(_items);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

var log = (0, _util.logger)('main');
window.ts.init = function () {
    var config = window.ts.config;
    (0, _util.extend)(window.ts, {
        core: core,
        app: app,
        manager: _manager2.default,
        charts: charts,
        factory: factory,
        actions: _action.actions,
        edit: edit,
        transforms: _transform.transforms,
        importer: importer,
        user: new _user2.default()
    });
    app.set_config(window.ts.config);
    /* Set up the API client */
    window.ts.client = _manager2.default.client = new _client2.default({ prefix: config.APPLICATION_ROOT });
    /* Register all dashboard items */
    (0, _factory.register_dashboard_item)(items.DashboardDefinition);
    (0, _factory.register_dashboard_item)(items.Section);
    (0, _factory.register_dashboard_item)(items.Row);
    (0, _factory.register_dashboard_item)(items.Cell);
    (0, _factory.register_dashboard_item)(items.Markdown);
    (0, _factory.register_dashboard_item)(items.Heading);
    (0, _factory.register_dashboard_item)(items.Separator);
    (0, _factory.register_dashboard_item)(items.SummationTable);
    (0, _factory.register_dashboard_item)(items.PercentageTable);
    (0, _factory.register_dashboard_item)(items.TimeshiftSummationTable);
    (0, _factory.register_dashboard_item)(items.ComparisonSummationTable);
    (0, _factory.register_dashboard_item)(items.Singlestat);
    (0, _factory.register_dashboard_item)(items.TimeshiftSinglestat);
    (0, _factory.register_dashboard_item)(items.ComparisonSinglestat);
    (0, _factory.register_dashboard_item)(items.JumbotronSinglestat);
    (0, _factory.register_dashboard_item)(items.TimeshiftJumbotronSinglestat);
    (0, _factory.register_dashboard_item)(items.ComparisonJumbotronSinglestat);
    (0, _factory.register_dashboard_item)(items.Timerstat);
    (0, _factory.register_dashboard_item)(items.DonutChart);
    (0, _factory.register_dashboard_item)(items.BarChart);
    (0, _factory.register_dashboard_item)(items.DiscreteBarChart);
    (0, _factory.register_dashboard_item)(items.SimpleTimeSeries);
    (0, _factory.register_dashboard_item)(items.StandardTimeSeries);
    (0, _factory.register_dashboard_item)(items.Singlegraph);
    (0, _factory.register_dashboard_item)(items.SinglegraphGrid);
    (0, _factory.register_dashboard_item)(items.ScatterPlot);
    /* Register Handlebars helper functions */
    (0, _helpers.register_helpers)();
    /* Register chart renderers */
    charts.renderers.register(new _graphite2.default({
        graphite_url: config.GRAPHITE_URL
    }));
    charts.renderers.register(new _flot2.default());
};


},{"./app/app":1,"./app/helpers":13,"./app/manager":16,"./charts/core":17,"./charts/flot":18,"./charts/graphite":19,"./client":25,"./core":27,"./core/action":26,"./edit/edit":30,"./importer":34,"./models/items":41,"./models/items/factory":52,"./models/transform/transform":84,"./models/user":85,"./util":88,"babel-polyfill":118}],36:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.AxisScale = undefined;

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _model = require('./model');

var _model2 = _interopRequireDefault(_model);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var AxisScale = exports.AxisScale = {
    LINEAR: 'linear',
    LOG: 'log'
};

var Axis = function (_Model) {
    _inherits(Axis, _Model);

    function Axis(data) {
        _classCallCheck(this, Axis);

        var _this = _possibleConstructorReturn(this, (Axis.__proto__ || Object.getPrototypeOf(Axis)).call(this, data));

        if (data) {
            _this.visible = data.visible;
            _this.label = data.label;
            _this.label_distance = data.label_distance;
            _this.format = data.format;
            _this.min = data.min;
            _this.max = data.max;
            _this.scale = data.scale;
        }
        return _this;
    }

    _createClass(Axis, [{
        key: 'toJSON',
        value: function toJSON() {
            return {
                visible: this.visible,
                label: this.label,
                label_distance: this.label_distance,
                format: this.format,
                min: this.min,
                max: this.max,
                scale: this.scale
            };
        }
    }]);

    return Axis;
}(_model2.default);



exports.default = Axis;

},{"./model":75}],37:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.DashboardTuple = undefined;

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

var _util = require('../util');

var _model = require('./model');

var _model2 = _interopRequireDefault(_model);

var _tag = require('./tag');

var _tag2 = _interopRequireDefault(_tag);

var _container = require('./items/container');

var _container2 = _interopRequireDefault(_container);

var _item = require('./items/item');

var _item2 = _interopRequireDefault(_item);

var _preferences = require('./preferences');

var _preferences2 = _interopRequireDefault(_preferences);

var _factory = require('./items/factory');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) {
            try {
                step(generator.next(value));
            } catch (e) {
                reject(e);
            }
        }
        function rejected(value) {
            try {
                step(generator["throw"](value));
            } catch (e) {
                reject(e);
            }
        }
        function step(result) {
            result.done ? resolve(result.value) : new P(function (resolve) {
                resolve(result.value);
            }).then(fulfilled, rejected);
        }
        step((generator = generator.apply(thisArg, _arguments)).next());
    });
};

var log = (0, _util.logger)('models.dashboard');

var Dashboard = function (_Model) {
    _inherits(Dashboard, _Model);

    function Dashboard(data) {
        _classCallCheck(this, Dashboard);

        var _this = _possibleConstructorReturn(this, (Dashboard.__proto__ || Object.getPrototypeOf(Dashboard)).call(this, data));

        _this.index = {};
        _this.tags = [];
        _this.dirty = false;
        _this._next_id = 0;
        if (data) {
            _this.id = data.id;
            _this.title = data.title;
            _this.category = data.category;
            _this.summary = data.summary;
            _this.description = data.description;
            _this.definition = data.definition;
            _this.creation_date = data.creation_date;
            _this.last_modified_date = data.last_modified_date;
            _this.imported_from = data.imported_from;
            _this.href = data.href;
            _this.view_href = data.view_href;
            _this.definition_href = data.definition_href;
            if (data.definition) {
                _this.definition = (0, _factory.make)(data.definition);
            }
            if (data.tags && data.tags.length) {
                _this.tags = data.tags.map(function (t) {
                    return new _tag2.default(t);
                });
            }
            _this.visit(function (item) {
                _this._next_id++;
            });
            _this.next_id();
            _this.update_index();
        }
        if (!_this.title) {
            throw new Error("Missing required field 'title'");
        }
        return _this;
    }

    _createClass(Dashboard, [{
        key: 'set_tags',
        value: function set_tags(tags) {
            this.tags = tags.map(function (t) {
                return new _tag2.default(t);
            });
            return this;
        }
    }, {
        key: 'set_definition',
        value: function set_definition(definition) {
            this.definition = definition;
            this.update_index();
            return this;
        }
    }, {
        key: 'visit',
        value: function visit(visitor) {
            visitor(this);
            if (this.definition) {
                this.definition.visit(visitor);
            }
            return this;
        }
    }, {
        key: 'next_id',
        value: function next_id() {
            while (true) {
                var id = 'd' + this._next_id++;
                if (typeof this.index[id] === 'undefined') {
                    return id;
                }
            }
        }
    }, {
        key: 'reindex',
        value: function reindex() {
            var _this2 = this;

            this._next_id = 0;
            this.visit(function (item) {
                item.item_id = _this2.next_id();
            });
            return this;
        }
    }, {
        key: 'update_index',
        value: function update_index() {
            var _this3 = this;

            var index = {};
            this.visit(function (item) {
                if (item instanceof _item2.default) {
                    if (!item.item_id) {
                        item.item_id = _this3.next_id();
                    }
                    if (index[item.item_id]) {
                        log.error('ERROR: item_id ' + item.item_id + ' is already indexed.');
                    }
                    index[item.item_id] = item;
                    item.set_dashboard(_this3);
                }
            });
            this.index = index;
            return this;
        }
        /**
         * Operations
         */

    }, {
        key: 'get_item',
        value: function get_item(id) {
            return this.index[id];
        }
    }, {
        key: 'find_parent',
        value: function find_parent(item_or_id) {
            var parent = undefined;
            this.visit(function (item) {
                if (item instanceof _container2.default && item.contains(item_or_id)) {
                    parent = item;
                }
            });
            return parent;
        }
    }, {
        key: 'set_items',
        value: function set_items(items) {
            this.definition.items = items;
            this.update_index();
            return this;
        }
    }, {
        key: 'render',
        value: function render() {
            return this.definition.render();
        }
    }, {
        key: 'load_all',
        value: function load_all(options) {
            return __awaiter(this, void 0, void 0, regeneratorRuntime.mark(function _callee() {
                return regeneratorRuntime.wrap(function _callee$(_context) {
                    while (1) {
                        switch (_context.prev = _context.next) {
                            case 0:
                                return _context.abrupt('return', this.definition.load_all(options));

                            case 1:
                            case 'end':
                                return _context.stop();
                        }
                    }
                }, _callee, this);
            }));
        }
    }, {
        key: 'cleanup',
        value: function cleanup() {
            this.definition.cleanup();
        }
    }, {
        key: 'render_templates',
        value: function render_templates(context) {
            context.id = this.id;
            this.expanded_description = (0, _util.render_template)(this.description, context);
            this.expanded_title = (0, _util.render_template)(this.title, context);
            this.expanded_summary = (0, _util.render_template)(this.summary, context);
            if (this.definition) {
                this.definition.render_templates(context);
            }
            return this.fire('change', { target: this });
        }
    }, {
        key: 'flatten',
        value: function flatten() {
            return this.definition ? this.definition.flatten() : [];
        }
    }, {
        key: 'toJSON',
        value: function toJSON() {
            return (0, _util.extend)(_get(Dashboard.prototype.__proto__ || Object.getPrototypeOf(Dashboard.prototype), 'toJSON', this).call(this), {
                id: this.id,
                title: this.title,
                category: this.category,
                summary: this.summary,
                description: this.description,
                creation_date: this.creation_date,
                last_modified_date: this.last_modified_date,
                imported_from: this.imported_from,
                tags: this.tags.map(function (t) {
                    return t.toJSON();
                }),
                definition: this.definition ? this.definition.toJSON() : null,
                href: this.href,
                view_href: this.view_href,
                definition_href: this.definition_href
            });
        }
    }]);

    return Dashboard;
}(_model2.default);

exports.default = Dashboard;

var DashboardTuple = exports.DashboardTuple = function (_Model2) {
    _inherits(DashboardTuple, _Model2);

    function DashboardTuple(data) {
        _classCallCheck(this, DashboardTuple);

        var _this4 = _possibleConstructorReturn(this, (DashboardTuple.__proto__ || Object.getPrototypeOf(DashboardTuple)).call(this, data));

        if (data) {
            _this4.dashboard = new Dashboard(data.dashboard);
            _this4.preferences = new _preferences2.default(data.preferences);
        }
        return _this4;
    }

    _createClass(DashboardTuple, [{
        key: 'toJSON',
        value: function toJSON() {
            return {
                dashboard: this.dashboard.toJSON(),
                preferences: this.preferences.toJSON()
            };
        }
    }]);

    return DashboardTuple;
}(_model2.default);


},{"../util":88,"./items/container":48,"./items/factory":52,"./items/item":54,"./model":75,"./preferences":76,"./tag":77}],38:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

var _util = require('../../util');

var _summation = require('./summation');

var _summation2 = _interopRequireDefault(_summation);

var _model = require('../model');

var _model2 = _interopRequireDefault(_model);

var _app = require('../../app/app');

var app = _interopRequireWildcard(_app);

var _core = require('../../charts/core');

var charts = _interopRequireWildcard(_core);

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) {
            try {
                step(generator.next(value));
            } catch (e) {
                reject(e);
            }
        }
        function rejected(value) {
            try {
                step(generator["throw"](value));
            } catch (e) {
                reject(e);
            }
        }
        function step(result) {
            result.done ? resolve(result.value) : new P(function (resolve) {
                resolve(result.value);
            }).then(fulfilled, rejected);
        }
        step((generator = generator.apply(thisArg, _arguments)).next());
    });
};

var log = (0, _util.logger)('query');
var axios = require('axios');
var URI = require('urijs');

var Query = function (_Model) {
    _inherits(Query, _Model);

    function Query(data) {
        _classCallCheck(this, Query);

        var _this = _possibleConstructorReturn(this, (Query.__proto__ || Object.getPrototypeOf(Query)).call(this, data));

        _this.load_count = 0;
        _this.cache = new Map();
        if (data) {
            if (data instanceof Array) {
                _this.targets = data;
            } else if (typeof data === 'string') {
                _this.targets = [data];
            } else if (data.targets) {
                if (data.targets instanceof Array) {
                    _this.targets = data.targets;
                } else {
                    _this.targets = [data.targets];
                }
            }
            if (data.options) {
                _this.options = data.options;
            }
            _this.name = data.name;
        }
        return _this;
    }

    _createClass(Query, [{
        key: 'set_name',
        value: function set_name(name) {
            this.name = name;
            return this;
        }
    }, {
        key: 'set_options',
        value: function set_options(options) {
            this.options = options;
            return this;
        }
    }, {
        key: 'render_templates',
        value: function render_templates(context, override) {
            var targets = override && this.expanded_targets.length ? this.expanded_targets : this.targets;
            this.expanded_targets = targets.map(function (t) {
                return (0, _util.render_template)(t, context);
            });
        }
    }, {
        key: 'url',
        value: function url(opt) {
            var options = (0, _util.extend)({}, this.local_options, opt, this.options);
            var url = new URI(options.base_url || app.config.GRAPHITE_URL).segment('render').setQuery('format', options.format || 'png').setQuery('from', options.from || app.config.DEFAULT_FROM_TIME || Query.DEFAULT_FROM_TIME).setQuery('tz', app.config.DISPLAY_TIMEZONE);
            if (options.until) {
                url.setQuery('until', options.until);
            }
            var targets = this.expanded_targets || this.targets;
            var _iteratorNormalCompletion = true;
            var _didIteratorError = false;
            var _iteratorError = undefined;

            try {
                for (var _iterator = targets[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
                    var t = _step.value;

                    url.addQuery('target', t.replace(/(\r\n|\n|\r)/gm, ''));
                }
            } catch (err) {
                _didIteratorError = true;
                _iteratorError = err;
            } finally {
                try {
                    if (!_iteratorNormalCompletion && _iterator.return) {
                        _iterator.return();
                    }
                } finally {
                    if (_didIteratorError) {
                        throw _iteratorError;
                    }
                }
            }

            return url.href();
        }
        /**
         * Return true if the item's query has the graphite stacked()
         * function anywhere in it. If you have stacked() in the query and
         * areaMode=stack in the URL, bad shit will happen to your graph.
         */

    }, {
        key: 'is_stacked',
        value: function is_stacked() {
            var targets = this.expanded_targets || this.targets;
            if (typeof targets === 'undefined') return false;
            var stacked = false;
            this.targets.forEach(function (target) {
                if (target.indexOf('stacked') > -1) {
                    stacked = true;
                }
            });
            return stacked;
        }
        /**
         * Asynchronously load the data for this query from the graphite
         * server, notifying any listening consumers when the data is
         * available.
         *
         * @param {Object} opt Parameters for generating the URL to
         * load. Valid properties are:
         *   * base_url (required)
         *   * from
         *   * until
         *   * ready callback
         * @param {boolean} fire_only Just raise the event, without fetching
         *                            data.
         */

    }, {
        key: 'load',
        value: function load(opt) {
            var fire_only = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;

            return __awaiter(this, void 0, void 0, regeneratorRuntime.mark(function _callee() {
                var options, url, axios_config, auth, _auth$split, _auth$split2, username, password, response, msg;

                return regeneratorRuntime.wrap(function _callee$(_context) {
                    while (1) {
                        switch (_context.prev = _context.next) {
                            case 0:
                                this.local_options = (0, _util.extend)({}, this.local_options, opt);
                                options = (0, _util.extend)({}, this.local_options, opt, this.options);

                                if (!fire_only) {
                                    _context.next = 5;
                                    break;
                                }

                                _util.events.fire(this, 'ds-data-ready', this);
                                return _context.abrupt('return', Promise.resolve(this.data));

                            case 5:
                                this.cache.clear();
                                options.format = 'json';
                                url = this.url(options);

                                this.load_count += 1;
                                axios_config = {
                                    url: url,
                                    method: 'get'
                                };
                                auth = app.config.GRAPHITE_AUTH ? app.config.GRAPHITE_AUTH.trim() : '';

                                if (auth) {
                                    _auth$split = auth.split(':'), _auth$split2 = _slicedToArray(_auth$split, 2), username = _auth$split2[0], password = _auth$split2[1];

                                    axios_config.auth = {
                                        username: username,
                                        password: password
                                    };
                                    axios_config.withCredentials = true;
                                }
                                _context.prev = 12;

                                _util.events.fire(this, 'ds-data-loading');
                                _context.next = 16;
                                return axios(axios_config);

                            case 16:
                                response = _context.sent;

                                this._summarize(response.data);
                                _util.events.fire(this, 'ds-data-ready', this);
                                return _context.abrupt('return', this.data);

                            case 22:
                                _context.prev = 22;
                                _context.t0 = _context['catch'](12);
                                msg = 'Error loading query ' + this.name + ': ' + _context.t0.message;

                                log.error(msg);
                                console.log(_context.t0);
                                ts.manager.error(msg);

                            case 28:
                                return _context.abrupt('return', Promise.resolve(this.data));

                            case 29:
                            case 'end':
                                return _context.stop();
                        }
                    }
                }, _callee, this, [[12, 22]]);
            }));
        }
        /**
         * Register an event handler to be called when the query's data is
         * loaded.
         */

    }, {
        key: 'on_load',
        value: function on_load(handler) {
            log.debug('on(): ' + this.name);
            _util.events.on(this, 'ds-data-ready', handler);
        }
        /**
         * Remove all registered event handlers.
         */

    }, {
        key: 'off',
        value: function off() {
            log.debug('off(): ' + this.name);
            _util.events.off(this, 'ds-data-ready');
        }
    }, {
        key: 'cleanup',
        value: function cleanup() {
            this.off();
            this.cache.clear();
            this.data = null;
        }
    }, {
        key: '_group_targets',
        value: function _group_targets() {
            return this.targets.length > 1 ? 'group(' + this.targets.join(',') + ')' : this.targets[0];
        }
        /**
         * Return a new query with the targets timeshifted.
         */

    }, {
        key: 'shift',
        value: function shift(interval) {
            var group = this._group_targets();
            return new Query({
                name: this.name + '_shift_' + interval,
                targets: ['timeShift(' + group + ', "' + interval + '")']
            });
        }
        /**
         * Return a new query with the targets from this query and another
         * query joined into a 2-target array, for comparison presentations.
         */

    }, {
        key: 'join',
        value: function join(other) {
            var target_this = this._group_targets();
            var target_other = other._group_targets();
            return new Query({
                name: this.name + '_join_' + other.name,
                targets: [target_this, target_other]
            });
        }
        /**
         * Process the results of executing the query, transforming
         * the returned structure into something consumable by the
         * charting library, and calculating sums.
         */

    }, {
        key: '_summarize',
        value: function _summarize(response_data) {
            this.summation = new _summation2.default(response_data);
            this.data = response_data.map(function (series) {
                series.summation = new _summation2.default(series).toJSON();
                return series;
            });
            return this;
        }
        /**
         * Fetch data processed for use by a particular chart renderer, and
         * cache it in the query object so it's not re-processed over and
         * over.
         */

    }, {
        key: 'chart_data',
        value: function chart_data(type) {
            var cache_key = 'chart_data_' + type;
            if (!this.cache.has(cache_key)) {
                this.cache.set(cache_key, charts.process_data(this.data, type));
            }
            return this.cache.get(cache_key);
        }
    }, {
        key: 'toJSON',
        value: function toJSON() {
            return (0, _util.extend)(_get(Query.prototype.__proto__ || Object.getPrototypeOf(Query.prototype), 'toJSON', this).call(this), {
                name: this.name,
                targets: this.targets,
                data: this.data,
                summation: this.summation ? this.summation.toJSON() : undefined,
                options: this.options
            });
        }
    }]);

    return Query;
}(_model2.default);

exports.default = Query;

Query.DEFAULT_FROM_TIME = '-3h';


},{"../../app/app":1,"../../charts/core":17,"../../util":88,"../model":75,"./summation":39,"axios":93,"urijs":419}],39:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _model = require('../model');

var _model2 = _interopRequireDefault(_model);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

/**
 * Summarized stats for a data series or set of series. When
 * constructed with a data series, computes the sum, min, max, and
 * mean.
 *
 * The input format is assumed to be the JSON representation returned
 * by graphite-web.
 */
var Summation = function (_Model) {
    _inherits(Summation, _Model);

    function Summation(initial_data) {
        _classCallCheck(this, Summation);

        var _this = _possibleConstructorReturn(this, (Summation.__proto__ || Object.getPrototypeOf(Summation)).call(this, initial_data));

        _this.sum = 0;
        _this.min = Number.MAX_VALUE;
        _this.max = Number.MIN_VALUE;
        _this.mean = 0;
        _this.median = 0;
        _this.first = 0;
        _this.last = 0;
        _this.last_non_zero = 0;
        _this.count = 0;
        _this.percent = undefined;
        _this.percent_value = undefined;
        var datapoints = [];
        if (initial_data && initial_data instanceof Array && initial_data.length) {
            /* This assumes that all input series have the same number of data points */
            var length = initial_data[0].datapoints.length;
            for (var i = 0; i < length; i++) {
                var x = 0;
                for (var n = 0; n < initial_data.length; n++) {
                    /* ignore input series which are smaller than the first series */
                    if (typeof initial_data[n].datapoints[i] !== 'undefined') {
                        x += initial_data[n].datapoints[i][0];
                    }
                }
                datapoints.push([x, initial_data[0].datapoints[i][1]]);
            }
        } else if (initial_data && initial_data.datapoints && initial_data.datapoints.length) {
            datapoints = initial_data.datapoints;
        }
        if (datapoints && datapoints.length) {
            (function () {
                /* add simple-statistics methods */
                var values = ss.mixin(datapoints.map(function (point) {
                    return point[0];
                }));
                _this.median = values.median();
                _this.first = datapoints[0][0];
                _this.count = datapoints.length;
                if (_this.first == null) {
                    _this.first = 0;
                }
                var index = 0;
                datapoints.forEach(function (point) {
                    var value = point[0] || 0;
                    _this.last = value;
                    if (value != 0) _this.last_non_zero = value;
                    _this.sum = _this.sum + value;
                    if (value > _this.max) {
                        _this.max = value;
                        _this.max_index = index;
                    }
                    if (point[0] && value < _this.min) {
                        _this.min = value;
                        _this.min_index = index;
                    }
                    index++;
                });
                _this.mean = _this.sum / _this.count;
            })();
        } else if ((typeof initial_data === 'undefined' ? 'undefined' : _typeof(initial_data)) === 'object') {
            var if_defined = function if_defined(value, default_value) {
                return typeof value === 'undefined' ? default_value : value;
            };

            _this.sum = if_defined(initial_data.sum, _this.sum);
            _this.min = if_defined(initial_data.min, _this.min);
            _this.min_index = if_defined(initial_data.min, _this.min_index);
            _this.max = if_defined(initial_data.max, _this.max);
            _this.max_index = if_defined(initial_data.max, _this.max_index);
            _this.first = if_defined(initial_data.first, _this.first);
            _this.last = if_defined(initial_data.last, _this.last);
            _this.last_non_zero = if_defined(initial_data.last, _this.last_non_zero);
            _this.mean = if_defined(initial_data.mean, _this.mean);
            _this.mean = if_defined(initial_data.median, _this.median);
            _this.count = if_defined(initial_data.count, _this.count);
        }
        if (_this.sum === 0) {
            _this.min = 0;
            _this.max = 0;
        }
        return _this;
    } // end constructor()
    /**
     * Subtract other from this.
     */


    _createClass(Summation, [{
        key: 'subtract',
        value: function subtract(other) {
            return new Summation({
                sum: this.sum - other.sum,
                min: this.min - other.min,
                max: this.max - other.max,
                mean: this.mean - other.mean,
                median: this.median - other.median,
                first: this.first - other.first,
                last: this.last - other.last,
                count: this.count
            });
        }
    }, {
        key: 'toJSON',
        value: function toJSON() {
            return {
                sum: this.sum,
                min: this.min,
                min_index: this.min_index,
                max: this.max,
                max_index: this.max_index,
                mean: this.mean,
                median: this.median,
                first: this.first,
                last: this.last,
                last_non_zero: this.last_non_zero,
                count: this.count
            };
        }
    }]);

    return Summation;
}(_model2.default);



exports.default = Summation;

},{"../model":75}],40:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _model = require('./model');

Object.defineProperty(exports, 'Model', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_model).default;
  }
});

var _axis = require('./axis');

Object.defineProperty(exports, 'AxisScale', {
  enumerable: true,
  get: function get() {
    return _axis.AxisScale;
  }
});
Object.defineProperty(exports, 'Axis', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_axis).default;
  }
});

var _thresholds = require('./thresholds');

Object.defineProperty(exports, 'Thresholds', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_thresholds).default;
  }
});

var _tag = require('./tag');

Object.defineProperty(exports, 'Tag', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_tag).default;
  }
});

var _dashboard = require('./dashboard');

Object.defineProperty(exports, 'Dashboard', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_dashboard).default;
  }
});
Object.defineProperty(exports, 'DashboardTuple', {
  enumerable: true,
  get: function get() {
    return _dashboard.DashboardTuple;
  }
});

var _query = require('./data/query');

Object.defineProperty(exports, 'Query', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_query).default;
  }
});

var _summation = require('./data/summation');

Object.defineProperty(exports, 'Summation', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_summation).default;
  }
});

var _preferences = require('./preferences');

Object.defineProperty(exports, 'Preferences', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_preferences).default;
  }
});

var _items = require('./items');

Object.keys(_items).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function get() {
      return _items[key];
    }
  });
});


function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

},{"./axis":36,"./dashboard":37,"./data/query":38,"./data/summation":39,"./items":41,"./model":75,"./preferences":76,"./tag":77,"./thresholds":78}],41:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _item = require('./items/item');

Object.defineProperty(exports, 'ItemStyle', {
  enumerable: true,
  get: function get() {
    return _item.DashboardItemStyle;
  }
});
Object.defineProperty(exports, 'Transform', {
  enumerable: true,
  get: function get() {
    return _item.Transform;
  }
});
Object.defineProperty(exports, 'DashboardItem', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_item).default;
  }
});

var _dashboard_definition = require('./items/dashboard_definition');

Object.defineProperty(exports, 'DashboardDefinition', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_dashboard_definition).default;
  }
});

var _container = require('./items/container');

Object.defineProperty(exports, 'Container', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_container).default;
  }
});

var _section = require('./items/section');

Object.defineProperty(exports, 'Section', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_section).default;
  }
});

var _row = require('./items/row');

Object.defineProperty(exports, 'Row', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_row).default;
  }
});

var _cell = require('./items/cell');

Object.defineProperty(exports, 'Cell', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_cell).default;
  }
});

var _markdown = require('./items/markdown');

Object.defineProperty(exports, 'Markdown', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_markdown).default;
  }
});

var _heading = require('./items/heading');

Object.defineProperty(exports, 'Heading', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_heading).default;
  }
});

var _separator = require('./items/separator');

Object.defineProperty(exports, 'Separator', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_separator).default;
  }
});

var _presentation = require('./items/presentation');

Object.defineProperty(exports, 'Presentation', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_presentation).default;
  }
});

var _table_presentation = require('./items/table_presentation');

Object.defineProperty(exports, 'TablePresentation', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_table_presentation).default;
  }
});

var _summation_table = require('./items/summation_table');

Object.defineProperty(exports, 'SummationTable', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_summation_table).default;
  }
});

var _percentage_table = require('./items/percentage_table');

Object.defineProperty(exports, 'PercentageTable', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_percentage_table).default;
  }
});

var _timeshift_summation_table = require('./items/timeshift_summation_table');

Object.defineProperty(exports, 'TimeshiftSummationTable', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_timeshift_summation_table).default;
  }
});

var _comparison_summation_table = require('./items/comparison_summation_table');

Object.defineProperty(exports, 'ComparisonSummationTable', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_comparison_summation_table).default;
  }
});

var _singlestat = require('./items/singlestat');

Object.defineProperty(exports, 'Singlestat', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_singlestat).default;
  }
});

var _timeshift_singlestat = require('./items/timeshift_singlestat');

Object.defineProperty(exports, 'TimeshiftSinglestat', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_timeshift_singlestat).default;
  }
});

var _comparison_singlestat = require('./items/comparison_singlestat');

Object.defineProperty(exports, 'ComparisonSinglestat', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_comparison_singlestat).default;
  }
});

var _jumbotron_singlestat = require('./items/jumbotron_singlestat');

Object.defineProperty(exports, 'JumbotronSinglestat', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_jumbotron_singlestat).default;
  }
});

var _timeshift_jumbotron_singlestat = require('./items/timeshift_jumbotron_singlestat');

Object.defineProperty(exports, 'TimeshiftJumbotronSinglestat', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_timeshift_jumbotron_singlestat).default;
  }
});

var _comparison_jumbotron_singlestat = require('./items/comparison_jumbotron_singlestat');

Object.defineProperty(exports, 'ComparisonJumbotronSinglestat', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_comparison_jumbotron_singlestat).default;
  }
});

var _timerstat = require('./items/timerstat');

Object.defineProperty(exports, 'Timerstat', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_timerstat).default;
  }
});

var _chart = require('./items/chart');

Object.defineProperty(exports, 'Chart', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_chart).default;
  }
});
Object.defineProperty(exports, 'ChartLegendType', {
  enumerable: true,
  get: function get() {
    return _chart.ChartLegendType;
  }
});

var _donut_chart = require('./items/donut_chart');

Object.defineProperty(exports, 'DonutChart', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_donut_chart).default;
  }
});

var _bar_chart = require('./items/bar_chart');

Object.defineProperty(exports, 'BarChart', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_bar_chart).default;
  }
});

var _discrete_bar_chart = require('./items/discrete_bar_chart');

Object.defineProperty(exports, 'DiscreteBarChart', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_discrete_bar_chart).default;
  }
});

var _simple_time_series = require('./items/simple_time_series');

Object.defineProperty(exports, 'SimpleTimeSeries', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_simple_time_series).default;
  }
});

var _standard_time_series = require('./items/standard_time_series');

Object.defineProperty(exports, 'StandardTimeSeries', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_standard_time_series).default;
  }
});

var _singlegraph = require('./items/singlegraph');

Object.defineProperty(exports, 'Singlegraph', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_singlegraph).default;
  }
});

var _singlegraph_grid = require('./items/singlegraph_grid');

Object.defineProperty(exports, 'SinglegraphGrid', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_singlegraph_grid).default;
  }
});

var _scatter_plot = require('./items/scatter_plot');

Object.defineProperty(exports, 'ScatterPlot', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_scatter_plot).default;
  }
});

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

},{"./items/bar_chart":42,"./items/cell":43,"./items/chart":44,"./items/comparison_jumbotron_singlestat":45,"./items/comparison_singlestat":46,"./items/comparison_summation_table":47,"./items/container":48,"./items/dashboard_definition":49,"./items/discrete_bar_chart":50,"./items/donut_chart":51,"./items/heading":53,"./items/item":54,"./items/jumbotron_singlestat":55,"./items/markdown":56,"./items/percentage_table":57,"./items/presentation":58,"./items/row":59,"./items/scatter_plot":60,"./items/section":61,"./items/separator":62,"./items/simple_time_series":63,"./items/singlegraph":64,"./items/singlegraph_grid":65,"./items/singlestat":66,"./items/standard_time_series":67,"./items/summation_table":68,"./items/table_presentation":69,"./items/timerstat":70,"./items/timeshift_jumbotron_singlestat":71,"./items/timeshift_singlestat":72,"./items/timeshift_summation_table":73}],42:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

var _xychart = require('./xychart');

var _xychart2 = _interopRequireDefault(_xychart);

var _core = require('../../charts/core');

var charts = _interopRequireWildcard(_core);

var _util = require('../../util');

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var BarChart = function (_XYChart) {
    _inherits(BarChart, _XYChart);

    function BarChart(data) {
        _classCallCheck(this, BarChart);

        var _this = _possibleConstructorReturn(this, (BarChart.__proto__ || Object.getPrototypeOf(BarChart)).call(this, data));

        _this.stack_mode = charts.StackMode.NORMAL;
        if (data) {
            _this.stack_mode = data.stack_mode || _this.stack_mode;
        }
        return _this;
    }

    _createClass(BarChart, [{
        key: 'toJSON',
        value: function toJSON() {
            return (0, _util.extend)(_get(BarChart.prototype.__proto__ || Object.getPrototypeOf(BarChart.prototype), 'toJSON', this).call(this), {
                stack_mode: this.stack_mode
            });
        }
    }, {
        key: 'data_handler',
        value: function data_handler(query) {
            charts.bar_chart('#' + this.item_id + ' .ds-graph-holder', this, query);
        }
    }, {
        key: 'interactive_properties',
        value: function interactive_properties() {
            return _get(BarChart.prototype.__proto__ || Object.getPrototypeOf(BarChart.prototype), 'interactive_properties', this).call(this).concat([{
                name: 'stack_mode',
                type: 'select',
                edit_options: {
                    source: [charts.StackMode.NONE, charts.StackMode.NORMAL, charts.StackMode.PERCENT, charts.StackMode.STREAM]
                }
            }]);
        }
    }]);

    return BarChart;
}(_xychart2.default);

exports.default = BarChart;

BarChart.meta = {
    icon: 'fa fa-bar-chart'
};


},{"../../charts/core":17,"../../util":88,"./xychart":74}],43:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

var _container = require('./container');

var _container2 = _interopRequireDefault(_container);

var _util = require('../../util');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var Cell = function (_Container) {
    _inherits(Cell, _Container);

    function Cell(data) {
        _classCallCheck(this, Cell);

        var _this = _possibleConstructorReturn(this, (Cell.__proto__ || Object.getPrototypeOf(Cell)).call(this, data));

        _this.span = 3;
        if (data) {
            _this.span = data.span || _this.span;
            _this.offset = data.offset;
            _this.align = data.align;
        }
        return _this;
    }

    _createClass(Cell, [{
        key: 'set_span',
        value: function set_span(value) {
            this.span = value;
            return this.updated();
        }
    }, {
        key: 'set_offset',
        value: function set_offset(value) {
            this.offset = value;
            return this.updated();
        }
    }, {
        key: 'set_align',
        value: function set_align(value) {
            this.align = value;
            return this.updated();
        }
    }, {
        key: 'toJSON',
        value: function toJSON() {
            return (0, _util.extend)(_get(Cell.prototype.__proto__ || Object.getPrototypeOf(Cell.prototype), 'toJSON', this).call(this), {
                span: this.span,
                offset: this.offset,
                align: this.align
            });
        }
    }, {
        key: 'interactive_properties',
        value: function interactive_properties() {
            return _get(Cell.prototype.__proto__ || Object.getPrototypeOf(Cell.prototype), 'interactive_properties', this).call(this).concat(['style', {
                name: 'span',
                edit_options: {
                    type: 'select',
                    source: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
                }
            }, {
                name: 'offset',
                edit_options: {
                    type: 'select',
                    source: [{ value: undefined, text: 'none' }, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
                }
            }, {
                name: 'align',
                type: 'select',
                edit_options: {
                    source: [undefined, 'left', 'center', 'right']
                }
            }]);
        }
    }]);

    return Cell;
}(_container2.default);

exports.default = Cell;

Cell.meta = {
    category: 'structural'
};


},{"../../util":88,"./container":48}],44:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.ChartLegendType = undefined;

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

var _util = require('../../util');

var _presentation = require('./presentation');

var _presentation2 = _interopRequireDefault(_presentation);

var _axis = require('../axis');

var _axis2 = _interopRequireDefault(_axis);

var _core = require('../../core');

var _core2 = require('../../charts/core');

var charts = _interopRequireWildcard(_core2);

var _palettes = require('../../charts/palettes');

var _palettes2 = _interopRequireDefault(_palettes);

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }

_core.properties.register([{
    name: 'chart.palette',
    property_name: 'palette',
    category: 'chart',
    edit_options: {
        type: 'select',
        value: function value(item) {
            if (item.options && item.options.palette) {
                return item.options.palette;
            } else {
                return undefined;
            }
        },
        source: [{ text: 'None', value: undefined }].concat(Object.keys(_palettes2.default).map(function (value, index) {
            return { text: value, value: value };
        })),
        update: function update(item, newValue) {
            if (!item.options) {
                item.options = {};
            }
            item.options.palette = newValue;
            item.updated();
        }
    }
}, {
    name: 'chart.fill',
    property_name: 'fill',
    category: 'chart',
    type: 'select',
    edit_options: {
        source: [{ value: undefined, text: 'default' }, { value: 0.1, text: '10%' }, { value: 0.2, text: '20%' }, { value: 0.3, text: '30%' }, { value: 0.4, text: '40%' }, { value: 0.5, text: '50%' }, { value: 0.6, text: '60%' }, { value: 0.7, text: '70%' }, { value: 0.8, text: '80%' }, { value: 0.9, text: '90%' }, { value: 1.0, text: '100%' }],
        update: function update(item, value) {
            if (value) {
                item.set_fill(Number(value));
            }
        }
    }
}, {
    name: 'chart.renderer',
    property_name: 'renderer',
    category: 'chart',
    edit_options: {
        type: 'select',
        source: function source() {
            return [undefined].concat([].concat(_toConsumableArray(charts.renderers.list().map(function (r) {
                return r.name;
            }))));
        }
    }
}, {
    name: 'chart.legend',
    property_name: 'legend',
    category: 'chart',
    edit_options: {
        type: 'select',
        source: [{ value: undefined, text: 'none' }, 'simple', 'table']
    }
}]);
var ChartLegendType = exports.ChartLegendType = {
    SIMPLE: 'simple',
    TABLE: 'table'
};
/**
 * Base class for all chart presentation types
 */

var Chart = function (_Presentation) {
    _inherits(Chart, _Presentation);

    function Chart(data) {
        _classCallCheck(this, Chart);

        var _this = _possibleConstructorReturn(this, (Chart.__proto__ || Object.getPrototypeOf(Chart)).call(this, data));

        _this.legend = ChartLegendType.SIMPLE;
        _this.hide_zero_series = false;
        _this.options = {};
        if (data) {
            if (typeof data.legend !== 'undefined') {
                _this.legend = data.legend;
                if (typeof data.legend === 'boolean') _this.legend = data.legend ? ChartLegendType.SIMPLE : undefined;
            }
            _this.options = data.options || {};
            if (data.options && data.options.y1) {
                _this.options.y1 = new _axis2.default(data.options.y1);
            }
            if (data.options && data.options.y2) {
                _this.options.y2 = new _axis2.default(data.options.y2);
            }
            if (data.options && data.options.x) {
                _this.options.x = new _axis2.default(data.options.x);
            }
            if (_typeof(data.hide_zero_series !== 'undefined')) {
                _this.hide_zero_series = Boolean(data.hide_zero_series);
            }
            if (typeof data.fill === 'number') {
                _this.fill = data.fill;
            }
            _this.renderer = data.renderer;
        }
        return _this;
    }

    _createClass(Chart, [{
        key: 'cleanup',
        value: function cleanup() {
            charts.cleanup(this);
        }
    }, {
        key: 'set_renderer',
        value: function set_renderer(renderer) {
            this.renderer = renderer;
            return this.updated();
        }
    }, {
        key: 'set_fill',
        value: function set_fill(fill) {
            if (typeof fill === 'number') {
                this.fill = fill;
                return this.updated();
            }
        }
    }, {
        key: 'toJSON',
        value: function toJSON() {
            var data = (0, _util.extend)(_get(Chart.prototype.__proto__ || Object.getPrototypeOf(Chart.prototype), 'toJSON', this).call(this), {
                legend: this.legend,
                hide_zero_series: this.hide_zero_series,
                renderer: this.renderer
            });
            if (this.options) {
                data.options = (0, _util.extend)({}, this.options);
                if (this.options.y1) {
                    data.options.y1 = (0, _util.json)(this.options.y1);
                }
                if (this.options.y2) {
                    data.options.y2 = (0, _util.json)(this.options.y2);
                }
                if (this.options.x) {
                    data.options.x = (0, _util.json)(this.options.x);
                }
            }
            if (typeof this.fill === 'number') {
                data.fill = this.fill;
            }
            return data;
        }
        /**
         * Clearly, a bunch of this should be refactored into a common
         * model. Should probably make chart.options a property model object.
         */

    }, {
        key: 'interactive_properties',
        value: function interactive_properties() {
            var props = ['title', 'height', {
                name: 'hide_zero_series',
                type: 'boolean',
                category: 'chart'
            }, 'chart.renderer', 'chart.palette', 'chart.fill', 'chart.legend'];
            return _get(Chart.prototype.__proto__ || Object.getPrototypeOf(Chart.prototype), 'interactive_properties', this).call(this).concat(props);
        }
    }]);

    return Chart;
}(_presentation2.default);

exports.default = Chart;

Chart.meta = {
    category: 'chart'
};


},{"../../charts/core":17,"../../charts/palettes":22,"../../core":27,"../../util":88,"../axis":36,"./presentation":58}],45:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _comparison_singlestat = require('./comparison_singlestat');

var _comparison_singlestat2 = _interopRequireDefault(_comparison_singlestat);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var ComparisonJumbotronSinglestat = function (_ComparisonSinglestat) {
    _inherits(ComparisonJumbotronSinglestat, _ComparisonSinglestat);

    function ComparisonJumbotronSinglestat() {
        _classCallCheck(this, ComparisonJumbotronSinglestat);

        return _possibleConstructorReturn(this, (ComparisonJumbotronSinglestat.__proto__ || Object.getPrototypeOf(ComparisonJumbotronSinglestat)).apply(this, arguments));
    }

    return ComparisonJumbotronSinglestat;
}(_comparison_singlestat2.default);

exports.default = ComparisonJumbotronSinglestat;

ComparisonJumbotronSinglestat.meta = {
    template: ts.templates.models.jumbotron_singlestat
};


},{"./comparison_singlestat":46}],46:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

var _util = require('../../util');

var _app = require('../../app');

var app = _interopRequireWildcard(_app);

var _singlestat = require('./singlestat');

var _singlestat2 = _interopRequireDefault(_singlestat);

var _query = require('../data/query');

var _query2 = _interopRequireDefault(_query);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var log = (0, _util.logger)('models.comparison_singlestat');
var FORMAT_PERCENT = d3.format(',.1%');

var ComparisonSinglestat = function (_Singlestat) {
    _inherits(ComparisonSinglestat, _Singlestat);

    function ComparisonSinglestat(data) {
        _classCallCheck(this, ComparisonSinglestat);

        var _this = _possibleConstructorReturn(this, (ComparisonSinglestat.__proto__ || Object.getPrototypeOf(ComparisonSinglestat)).call(this, data));

        _this.percent = false;
        if (data) {
            if (_this.query_other instanceof _query2.default) {
                _this._query_other = data.query_other.name;
            } else {
                _this._query_other = data.query_other;
            }
            _this.percent = !!data.percent;
        }
        return _this;
    }

    _createClass(ComparisonSinglestat, [{
        key: '_update_query',
        value: function _update_query() {
            if (this._query && this.query_other && this.dashboard) {
                var query = this.dashboard.definition.queries[this._query];
                this.query_override = query.join(this.query_other).set_name(this.item_id + '_joined');
                this.query_override.render_templates(app.context().variables);
            }
        }
    }, {
        key: 'set_query_other',
        value: function set_query_other(value) {
            log.info('set_query_other: ' + value);
            if (typeof value === 'string') {
                this._query_other = value;
            } else {
                this._query_other = value.name;
            }
            return this.updated();
        }
    }, {
        key: 'toJSON',
        value: function toJSON() {
            return (0, _util.extend)(_get(ComparisonSinglestat.prototype.__proto__ || Object.getPrototypeOf(ComparisonSinglestat.prototype), 'toJSON', this).call(this), {
                query_other: this._query_other,
                percent: this.percent
            });
        }
    }, {
        key: 'render',
        value: function render() {
            this._update_query();
            return _get(ComparisonSinglestat.prototype.__proto__ || Object.getPrototypeOf(ComparisonSinglestat.prototype), 'render', this).call(this);
        }
    }, {
        key: 'data_handler',
        value: function data_handler(query) {
            if (query.data.length < 2) return;
            var value = query.data[0].summation[this.transform];
            var base = query.data[1].summation[this.transform];
            var diff = value - base;
            var pct = value / base - 1;
            var float_margin = 0.000001;
            var diff_elt = $('#' + this.item_id + ' span.diff');
            $('#' + this.item_id + ' span.value').text(d3.format(this.format)(value));
            if (diff > float_margin) diff_elt.addClass('ds-diff-plus');else if (diff < float_margin) diff_elt.addClass('ds-diff-minus');
            var diff_formatted = this.percent ? FORMAT_PERCENT(Math.abs(pct)) : d3.format(this.format)(Math.abs(diff));
            $('#' + this.item_id + ' span.diff').text(diff_formatted);
        }
    }, {
        key: 'interactive_properties',
        value: function interactive_properties() {
            return _get(ComparisonSinglestat.prototype.__proto__ || Object.getPrototypeOf(ComparisonSinglestat.prototype), 'interactive_properties', this).call(this).concat(['query_other', { name: 'percent', type: 'boolean' }]);
        }
    }, {
        key: 'query_other',
        get: function get() {
            if (!this.dashboard) {
                return null;
            }
            return this.dashboard.definition.queries[this._query_other];
        },
        set: function set(value) {
            this._query_other = value.name;
        }
    }]);

    return ComparisonSinglestat;
}(_singlestat2.default);

exports.default = ComparisonSinglestat;

ComparisonSinglestat.meta = {
    template: ts.templates.models.singlestat
};


},{"../../app":14,"../../util":88,"../data/query":38,"./singlestat":66}],47:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

var _table_presentation = require('./table_presentation');

var _table_presentation2 = _interopRequireDefault(_table_presentation);

var _util = require('../../util');

var _query = require('../data/query');

var _query2 = _interopRequireDefault(_query);

var _summation = require('../data/summation');

var _summation2 = _interopRequireDefault(_summation);

var _app = require('../../app/app');

var app = _interopRequireWildcard(_app);

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

/**
 * A summation table that compares two arbitrary queries.
 */
var ComparisonSummationTable = function (_TablePresentation) {
    _inherits(ComparisonSummationTable, _TablePresentation);

    function ComparisonSummationTable(data) {
        _classCallCheck(this, ComparisonSummationTable);

        var _this = _possibleConstructorReturn(this, (ComparisonSummationTable.__proto__ || Object.getPrototypeOf(ComparisonSummationTable)).call(this, data));

        if (data) {
            if (_this.query_other instanceof _query2.default) {
                _this._query_other = data.query_other.name;
            } else {
                _this._query_other = data.query_other;
            }
        }
        return _this;
    }

    _createClass(ComparisonSummationTable, [{
        key: '_update_query',
        value: function _update_query() {
            if (this._query && this.query_other && this.dashboard) {
                var query = this.dashboard.definition.queries[this._query];
                this.query_override = query.join(this.query_other).set_name(this.item_id + '_joined');
                this.query_override.render_templates(app.context().variables);
            }
        }
    }, {
        key: 'set_query_other',
        value: function set_query_other(value) {
            if (typeof value === 'string') {
                this._query_other = value;
            } else {
                this._query_other = value.name;
            }
            return this.updated();
        }
    }, {
        key: 'toJSON',
        value: function toJSON() {
            return (0, _util.extend)(_get(ComparisonSummationTable.prototype.__proto__ || Object.getPrototypeOf(ComparisonSummationTable.prototype), 'toJSON', this).call(this), {
                query_other: this._query_other
            });
        }
    }, {
        key: 'render',
        value: function render() {
            this._update_query();
            return _get(ComparisonSummationTable.prototype.__proto__ || Object.getPrototypeOf(ComparisonSummationTable.prototype), 'render', this).call(this);
        }
    }, {
        key: 'data_handler',
        value: function data_handler(query) {
            if (query.data.length < 2) return;
            var body = $('#' + this.item_id + ' tbody');
            var now = query.data[0].summation;
            var then = query.data[1].summation;
            var diff = new _summation2.default(now).subtract(then);
            var properties = ['mean', 'min', 'max', 'sum'];
            var float_margin = 0.000001;
            properties.forEach(function (prop) {
                var value = diff[prop];
                if (value > float_margin) diff[prop + '_class'] = 'ds-diff-plus';else if (value < -float_margin) diff[prop + '_class'] = 'ds-diff-minus';
                if (float_margin > value && value > -float_margin) value = 0.0;
                var pct = now[prop] / then[prop] - 1;
                pct = isNaN(pct) ? 0.0 : pct;
                diff[prop + '_pct'] = d3.format(',.2%')(Math.abs(pct));
                diff[prop] = Math.abs(value);
            });
            body.empty();
            body.append(ts.templates.models.comparison_summation_table_body({
                now: now,
                then: then,
                diff: diff,
                item: this
            }));
            if (this.sortable && !$.fn.dataTable.isDataTable(body.parent())) {
                body.parent().DataTable({
                    autoWidth: false,
                    paging: false,
                    searching: false,
                    info: false
                });
            }
        }
    }, {
        key: 'interactive_properties',
        value: function interactive_properties() {
            return _get(ComparisonSummationTable.prototype.__proto__ || Object.getPrototypeOf(ComparisonSummationTable.prototype), 'interactive_properties', this).call(this).concat(['query_other']);
        }
    }, {
        key: 'query_other',
        get: function get() {
            if (!this.dashboard) {
                return null;
            }
            return this.dashboard.definition.queries[this._query_other];
        },
        set: function set(value) {
            this._query_other = value.name;
        }
    }]);

    return ComparisonSummationTable;
}(_table_presentation2.default);



exports.default = ComparisonSummationTable;

},{"../../app/app":1,"../../util":88,"../data/query":38,"../data/summation":39,"./table_presentation":69}],48:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

var _item = require('./item');

var _item2 = _interopRequireDefault(_item);

var _util = require('../../util');

var _factory = require('./factory');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

/**
 * Base class for all dashboard items that contain other items.
 */
var Container = function (_DashboardItem) {
    _inherits(Container, _DashboardItem);

    function Container(data) {
        _classCallCheck(this, Container);

        var _this = _possibleConstructorReturn(this, (Container.__proto__ || Object.getPrototypeOf(Container)).call(this, data));

        _this.items = [];
        if (data && data.items) {
            _this.items = data.items.map(function (i) {
                return (0, _factory.make)(i);
            });
        }
        return _this;
    }

    _createClass(Container, [{
        key: 'find',

        /**
         * Find the index of a contained dashboard item.
         *
         * @return The numeric index (0-based) or -1 if not found.
         */
        value: function find(item_or_id) {
            var id = item_or_id;
            if (item_or_id instanceof _item2.default) {
                id = item_or_id.item_id;
            }
            for (var i = 0; i < this.items.length; i++) {
                if (this.items[i].item_id === id) {
                    return Number(i);
                }
            }
            return -1;
        }
    }, {
        key: 'contains',
        value: function contains(item_or_id) {
            return this.find(item_or_id) > -1;
        }
    }, {
        key: 'visit',
        value: function visit(visitor) {
            visitor(this);
            this.items.forEach(function (item) {
                if (item.visit && typeof item.visit === 'function') {
                    item.visit(visitor);
                } else {
                    visitor(item);
                }
            });
            return this;
        }
    }, {
        key: 'add',
        value: function add(item) {
            if (typeof item === 'string') {
                item = (0, _factory.make)(item);
            }
            this.items.push(item);
            return this.updated();
        }
    }, {
        key: 'add_after',
        value: function add_after(item, new_item) {
            var index = this.find(item);
            if (index === -1 || index === this.length - 1) {
                this.items.push(new_item);
            } else {
                this.items.splice(index + 1, 0, new_item);
            }
            return this.updated();
        }
    }, {
        key: 'remove',
        value: function remove(item) {
            var index = this.find(item);
            if (index < 0) {
                return false;
            }
            this.items.splice(index, 1);
            this.updated();
            return true;
        }
        /**
         * Move the position of a child item in the list, either up or
         * down one position. The position will not wrap - if the child
         * is a the beginning or end of the list, it will not be moved.
         *
         * @param item {object} A dashboard item. Must be a child of
         *                      this container.
         * @param increment {number} Either 1 to move the element up one
         *                           place, or -1 to move it back one
         *                           element.
         */

    }, {
        key: 'move',
        value: function move(item, increment) {
            var index = this.find(item);
            if (index < 0) {
                return false;
            }
            if (index == 0 && increment < 0) {
                return false;
            }
            if (index == this.length - 1 && increment > 0) {
                return false;
            }
            var target_index = index + increment;
            var tmp = this.items[target_index];
            this.items[target_index] = item;
            this.items[index] = tmp;
            this.updated();
            return true;
        }
    }, {
        key: 'toJSON',
        value: function toJSON() {
            return (0, _util.extend)(_get(Container.prototype.__proto__ || Object.getPrototypeOf(Container.prototype), 'toJSON', this).call(this), {
                items: this.items.map(function (i) {
                    return i.toJSON();
                })
            });
        }
    }, {
        key: 'length',
        get: function get() {
            return this.items ? this.items.length : 0;
        }
    }]);

    return Container;
}(_item2.default);



exports.default = Container;

},{"../../util":88,"./factory":52,"./item":54}],49:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

var _util = require('../../util');

var _container = require('./container');

var _container2 = _interopRequireDefault(_container);

var _presentation = require('./presentation');

var _presentation2 = _interopRequireDefault(_presentation);

var _query = require('../data/query');

var _query2 = _interopRequireDefault(_query);

var _core = require('../../charts/core');

var charts = _interopRequireWildcard(_core);

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) {
            try {
                step(generator.next(value));
            } catch (e) {
                reject(e);
            }
        }
        function rejected(value) {
            try {
                step(generator["throw"](value));
            } catch (e) {
                reject(e);
            }
        }
        function step(result) {
            result.done ? resolve(result.value) : new P(function (resolve) {
                resolve(result.value);
            }).then(fulfilled, rejected);
        }
        step((generator = generator.apply(thisArg, _arguments)).next());
    });
};

var log = (0, _util.logger)('models.dashboard_definition');

var DashboardDefinition = function (_Container) {
    _inherits(DashboardDefinition, _Container);

    function DashboardDefinition(data) {
        _classCallCheck(this, DashboardDefinition);

        var _this = _possibleConstructorReturn(this, (DashboardDefinition.__proto__ || Object.getPrototypeOf(DashboardDefinition)).call(this, data));

        _this.queries = {};
        _this.options = {};
        if (data) {
            _this.renderer = data.renderer;
            if (data.queries) {
                for (var key in data.queries) {
                    var query = data.queries[key];
                    _this.queries[key] = typeof query === 'string' || query instanceof Array ? new _query2.default({ name: key, targets: query }) : new _query2.default(query);
                }
            }
        }
        return _this;
    }
    /**
     * Operations
     */


    _createClass(DashboardDefinition, [{
        key: 'summarize',
        value: function summarize() {
            var counts = {};
            this.visit(function (item) {
                if (typeof counts[item.item_type] === 'undefined') {
                    counts[item.item_type] = 1;
                } else {
                    counts[item.item_type] = counts[item.item_type] + 1;
                }
            });
            return counts;
        }
    }, {
        key: 'render_templates',
        value: function render_templates(context) {
            var _this2 = this;

            for (var key in this.queries) {
                this.queries[key].render_templates(context);
            }
            // Render each query a second time to render any tags in
            // referenced queries.
            for (var _key in this.queries) {
                this.queries[_key].render_templates(context, true);
            }
            this.visit(function (item) {
                if (item !== _this2 && item.render_templates) {
                    item.render_templates(context);
                }
            });
        }
    }, {
        key: 'cleanup',
        value: function cleanup() {
            for (var key in this.queries) {
                this.queries[key].cleanup();
            }
        }
    }, {
        key: 'list_queries',
        value: function list_queries() {
            var _this3 = this;

            return Object.keys(this.queries).map(function (key) {
                return _this3.queries[key];
            });
        }
    }, {
        key: 'load_all',
        value: function load_all(options) {
            return __awaiter(this, void 0, void 0, regeneratorRuntime.mark(function _callee() {
                var _this4 = this;

                var queries_to_load, queries_to_fire, load_queries;
                return regeneratorRuntime.wrap(function _callee$(_context) {
                    while (1) {
                        switch (_context.prev = _context.next) {
                            case 0:
                                log.debug('load_all()');
                                this.options = options || this.options;
                                // First walk through the dashboard to collect the queries into
                                // two collections - those which need to have raw data loaded and
                                // those which don't.
                                queries_to_load = {};
                                queries_to_fire = {};

                                this.visit(function (item) {
                                    if (item instanceof _presentation2.default) {
                                        var query = item.query_override || item.query;
                                        if (query) {
                                            if (item.meta.requires_data || charts.get_renderer(item).is_interactive) {
                                                queries_to_load[query.name] = query;
                                                delete queries_to_fire[query.name];
                                            } else {
                                                if (!queries_to_load[query.name]) {
                                                    queries_to_fire[query.name] = query;
                                                }
                                            }
                                        }
                                    }
                                });

                                load_queries = function load_queries(query_map) {
                                    var fire_only = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;

                                    return Promise.all(Object.keys(query_map).map(function (key) {
                                        var query = query_map[key];
                                        return query ? query.load(_this4.options, fire_only) : Promise.resolve();
                                    }));
                                };

                                return _context.abrupt('return', Promise.all([load_queries(queries_to_load), load_queries(queries_to_fire, true)]).then(function () {
                                    _util.events.fire(ts.app.instance, ts.app.Event.QUERIES_COMPLETE);
                                    return Promise.resolve(true);
                                }));

                            case 7:
                            case 'end':
                                return _context.stop();
                        }
                    }
                }, _callee, this);
            }));
        }
    }, {
        key: 'add_query',
        value: function add_query(query) {
            this.queries[query.name] = query;
            query.options = this.options;
            return this.updated();
        }
        /**
         * Delete a query and null out any references to it.
         */

    }, {
        key: 'delete_query',
        value: function delete_query(query_name) {
            this.visit(function (item) {
                if (item instanceof _presentation2.default) {
                    if (item.query && item.query.name === query_name) {
                        item.query = undefined;
                    }
                }
            });
            delete this.queries[query_name];
            return this.updated();
        }
        /**
         * Rename a query and update any references to it.
         */

    }, {
        key: 'rename_query',
        value: function rename_query(old_name, new_name) {
            var query = this.queries[old_name];
            if (!query) return this;
            var updated = [];
            this.visit(function (item) {
                if (item instanceof _presentation2.default) {
                    if (item.query && item.query.name === old_name) {
                        item.set_query(new_name);
                        updated.push(item);
                    }
                }
            });
            query.name = new_name;
            this.add_query(query);
            delete this.queries[old_name];
            this.updated();
            return updated;
        }
    }, {
        key: 'interactive_properties',
        value: function interactive_properties() {
            return _get(DashboardDefinition.prototype.__proto__ || Object.getPrototypeOf(DashboardDefinition.prototype), 'interactive_properties', this).call(this).concat(['chart.renderer']);
        }
    }, {
        key: 'toJSON',
        value: function toJSON() {
            var q = {};
            for (var key in this.queries) {
                q[key] = this.queries[key].toJSON();
            }
            return (0, _util.extend)(_get(DashboardDefinition.prototype.__proto__ || Object.getPrototypeOf(DashboardDefinition.prototype), 'toJSON', this).call(this), {
                queries: q,
                renderer: this.renderer
            });
        }
    }]);

    return DashboardDefinition;
}(_container2.default); // end class DashboardDefinition


exports.default = DashboardDefinition;
DashboardDefinition.meta = {
    template: ts.templates.models.definition
};


},{"../../charts/core":17,"../../util":88,"../data/query":38,"./container":48,"./presentation":58}],50:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

var _chart = require('./chart');

var _chart2 = _interopRequireDefault(_chart);

var _core = require('../../charts/core');

var charts = _interopRequireWildcard(_core);

var _util = require('../../util');

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var DiscreteBarChart = function (_Chart) {
    _inherits(DiscreteBarChart, _Chart);

    function DiscreteBarChart(data) {
        _classCallCheck(this, DiscreteBarChart);

        var _this = _possibleConstructorReturn(this, (DiscreteBarChart.__proto__ || Object.getPrototypeOf(DiscreteBarChart)).call(this, data));

        _this.transform = 'sum';
        _this.orientation = 'vertical';
        _this.format = ',.3s';
        _this.show_grid = true;
        _this.show_numbers = true;
        if (data) {
            _this.legend = undefined;
            _this.transform = data.transform || _this.transform;
            _this.orientation = data.orientation || _this.orientation;
            _this.format = data.format || _this.format;
            if (typeof data.show_grid !== 'undefined') {
                _this.show_grid = Boolean(data.show_grid);
            }
            if (typeof data.show_numbers !== 'undefined') {
                _this.show_numbers = Boolean(data.show_numbers);
            }
        }
        return _this;
    }

    _createClass(DiscreteBarChart, [{
        key: 'toJSON',
        value: function toJSON() {
            return (0, _util.extend)(_get(DiscreteBarChart.prototype.__proto__ || Object.getPrototypeOf(DiscreteBarChart.prototype), 'toJSON', this).call(this), {
                orientation: this.orientation,
                transform: this.transform,
                format: this.format,
                show_grid: this.show_grid,
                show_numbers: this.show_numbers
            });
        }
    }, {
        key: 'data_handler',
        value: function data_handler(query) {
            charts.discrete_bar_chart('#' + this.item_id + ' .ds-graph-holder', this, query);
        }
    }, {
        key: 'interactive_properties',
        value: function interactive_properties() {
            return _get(DiscreteBarChart.prototype.__proto__ || Object.getPrototypeOf(DiscreteBarChart.prototype), 'interactive_properties', this).call(this).concat(['transform', 'format', 'chart.y-axis-label', { name: 'show_grid', type: 'boolean' }, { name: 'show_numbers', type: 'boolean' }, {
                name: 'orientation',
                type: 'select',
                edit_options: {
                    source: ['horizontal', 'vertical']
                }
            }]);
        }
    }]);

    return DiscreteBarChart;
}(_chart2.default);

exports.default = DiscreteBarChart;

DiscreteBarChart.meta = {
    display_name: 'Bar Chart (Discrete)',
    icon: 'fa fa-bar-chart'
};


},{"../../charts/core":17,"../../util":88,"./chart":44}],51:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

var _chart = require('./chart');

var _chart2 = _interopRequireDefault(_chart);

var _core = require('../../charts/core');

var charts = _interopRequireWildcard(_core);

var _util = require('../../util');

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var DonutChart = function (_Chart) {
    _inherits(DonutChart, _Chart);

    function DonutChart(data) {
        _classCallCheck(this, DonutChart);

        var _this = _possibleConstructorReturn(this, (DonutChart.__proto__ || Object.getPrototypeOf(DonutChart)).call(this, data));

        _this.labels = false;
        _this.is_pie = false;
        if (data) {
            if (typeof data.labels !== 'undefined') {
                _this.labels = Boolean(data.labels);
            }
            if (typeof data.is_pie !== 'undefined') {
                _this.is_pie = Boolean(data.is_pie);
            }
        }
        return _this;
    }

    _createClass(DonutChart, [{
        key: 'toJSON',
        value: function toJSON() {
            return (0, _util.extend)(_get(DonutChart.prototype.__proto__ || Object.getPrototypeOf(DonutChart.prototype), 'toJSON', this).call(this), {
                labels: this.labels,
                is_pie: this.is_pie
            });
        }
    }, {
        key: 'data_handler',
        value: function data_handler(query) {
            charts.donut_chart('#' + this.item_id + ' .ds-graph-holder', this, query);
        }
    }, {
        key: 'interactive_properties',
        value: function interactive_properties() {
            return _get(DonutChart.prototype.__proto__ || Object.getPrototypeOf(DonutChart.prototype), 'interactive_properties', this).call(this).concat([{ name: 'labels', type: 'boolean' }, { name: 'is_pie', type: 'boolean' }]);
        }
    }]);

    return DonutChart;
}(_chart2.default);

exports.default = DonutChart;

DonutChart.meta = {
    icon: 'fa fa-pie-chart'
};


},{"../../charts/core":17,"../../util":88,"./chart":44}],52:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.metadata = undefined;
exports.get_metadata_list = get_metadata_list;
exports.get_merged_metadata = get_merged_metadata;
exports.register_dashboard_item = register_dashboard_item;
exports.make = make;

var _util = require('../../util');

var _item = require('./item');

var _item2 = _interopRequireDefault(_item);

var _core = require('../../core');

var core = _interopRequireWildcard(_core);

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }

var inflection = require('inflection');
var log = (0, _util.logger)('models.factory');
var constructors = new Map();
var metadata = exports.metadata = new Map();
/**
 * Walk up a dashboard item's inheritance chain and produce a list
 * of metadata objects, ordered from least specific to most
 * specific.
 */
function get_metadata_list(item_class) {
    var metas = [];
    while (item_class && _item2.default.isPrototypeOf(item_class)) {
        if (item_class['meta']) {
            metas.push(item_class['meta']);
        }
        item_class = Object.getPrototypeOf(item_class);
    }
    return metas.reverse();
}
/**
 * Get the metadata for a dashboard item class, merged with the
 * metadata of its parent classes.
 */
function get_merged_metadata(item_class) {
    var metas = get_metadata_list(item_class);
    return _util.extend.apply(undefined, [{}].concat(_toConsumableArray(metas)));
}
/**
 * Register a dashboard item type.
 *
 * Each dashboard item class must have the following members:
 *   - A constructor with the signature `new(data?: any)`
 *   - Optionally a static `meta` property of type `DashboardItemMetadata`
 *
 * @see DashboardItemConstructor
 */
function register_dashboard_item(item_class) {
    //
    // First make sure the class has metadata, creating whatever we
    // can programmatically if it's not specified explicitly.
    //
    var meta = {};
    if (item_class.meta && item_class.hasOwnProperty('meta')) {
        meta = item_class.meta;
    } else {
        item_class.meta = meta;
    }
    // Set any missing metadata fields by munging the item type.
    if (!meta.item_type) {
        meta.item_type = inflection.underscore(item_class.name);
    }
    if (!meta.display_name) {
        meta.display_name = inflection.titleize(meta.item_type);
    }
    if (!meta.template && ts.templates.models[meta.item_type]) {
        meta.template = ts.templates.models[meta.item_type];
    }
    //
    // Merge the immediate metadata with any parent metadata.
    //
    item_class.meta = meta = get_merged_metadata(item_class);
    //
    // Compile the template if necessary.
    //
    if (meta.template && typeof meta.template === 'string') {
        meta.template = Handlebars.compile(meta.template);
    }
    //
    // Register any item-specific action
    //
    if (meta.actions && meta.actions.length) {
        core.actions.register(meta.item_type, meta.actions);
    }
    //
    // Create a test instance to fetch the complete list of
    // interactive properties, then sort them and cache them in the
    // meta object.
    //
    var instance = new item_class();
    var props = instance.interactive_properties().map(function (p) {
        return core.property(p);
    });
    props.sort(function (p1, p2) {
        if (p1.category === p2.category) {
            return p1.property_name.localeCompare(p2.property_name);
        } else {
            return (p1.category || '').localeCompare(p2.category || '');
        }
    });
    meta.interactive_properties = props;
    //
    // Create and register a new action to instantiate the dashboard
    // item type in the editor UI
    //
    var category = meta.category ? 'new-item-' + meta.category : 'new-item';
    core.actions.register({
        name: meta.item_type,
        category: category,
        display: 'Add new ' + (meta.display_name || meta.item_type),
        icon: meta.icon || '',
        css: 'new-item',
        handler: function handler(action, container) {
            container.add(new item_class());
        }
    });
    //
    // Cache the constructor and metadata globally.
    //
    metadata.set(meta.item_type, meta);
    constructors.set(meta.item_type, item_class);
    if (meta.alias) {
        metadata.set(meta.alias, meta);
        constructors.set(meta.alias, item_class);
    }
    log.debug('registered ' + meta.item_type);
}
function make(data, init) {
    if (data instanceof _item2.default) {
        return data;
    }
    if (typeof data === 'string' && constructors.has(data)) {
        return new (constructors.get(data))(init);
    }
    if (data.item_type && constructors.has(data.item_type)) {
        return new (constructors.get(data.item_type))(data);
    }
    log.error('Unknown item type ' + JSON.stringify(data));
    return null;
}


},{"../../core":27,"../../util":88,"./item":54,"inflection":415}],53:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

var _item = require('./item');

var _item2 = _interopRequireDefault(_item);

var _util = require('../../util');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var Heading = function (_DashboardItem) {
    _inherits(Heading, _DashboardItem);

    function Heading(data) {
        _classCallCheck(this, Heading);

        var _this = _possibleConstructorReturn(this, (Heading.__proto__ || Object.getPrototypeOf(Heading)).call(this, data));

        _this.level = 1;
        if (data) {
            _this.text = data.text;
            _this.level = data.level || _this.level;
            _this.description = data.description;
        }
        return _this;
    }

    _createClass(Heading, [{
        key: 'toJSON',
        value: function toJSON() {
            return (0, _util.extend)(_get(Heading.prototype.__proto__ || Object.getPrototypeOf(Heading.prototype), 'toJSON', this).call(this), {
                text: this.text,
                level: this.level,
                description: this.description
            });
        }
    }, {
        key: 'interactive_properties',
        value: function interactive_properties() {
            return ['text', {
                name: 'level',
                edit_options: {
                    type: 'select',
                    source: [1, 2, 3, 4, 5, 6]
                }
            }, 'description'];
        }
    }]);

    return Heading;
}(_item2.default);

exports.default = Heading;

Heading.meta = {
    icon: 'fa fa-header',
    category: 'display'
};


},{"../../util":88,"./item":54}],54:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.Transform = exports.DashboardItemStyle = undefined;

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _util = require('../../util');

var _core = require('../../core');

var core = _interopRequireWildcard(_core);

var _model = require('../model');

var _model2 = _interopRequireDefault(_model);

var _factory = require('./factory');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var log = (0, _util.logger)('item');
var DashboardItemStyle = exports.DashboardItemStyle = {
    WELL: 'well',
    CALLOUT_NEUTRAL: 'callout_neutral',
    CALLOUT_INFO: 'callout_info',
    CALLOUT_SUCCESS: 'callout_success',
    CALLOUT_WARNING: 'callout_warning',
    CALLOUT_DANGER: 'callout_danger',
    ALERT_NEUTRAL: 'alert_neutral',
    ALERT_INFO: 'alert_info',
    ALERT_SUCCESS: 'alert_success',
    ALERT_WARNING: 'alert_warning',
    ALERT_DANGER: 'alert_danger'
};
var Transform = exports.Transform = {
    SUM: 'sum',
    MIN: 'min',
    MAX: 'max',
    MEAN: 'mean',
    MEDIAN: 'median',
    FIRST: 'first',
    LAST: 'last',
    LAST_NON_ZERO: 'last_non_zero',
    COUNT: 'count'
};
core.properties.register([{
    name: 'style',
    type: 'select',
    edit_options: {
        source: [{ value: undefined, text: 'none' }, 'well', 'callout_neutral', 'callout_info', 'callout_success', 'callout_warning', 'callout_danger', 'alert_neutral', 'alert_info', 'alert_success', 'alert_warning', 'alert_danger']
    }
}, {
    name: 'height',
    category: 'base',
    type: 'select',
    edit_options: {
        source: [{ value: undefined, text: 'default' }, 1, 2, 3, 4, 5, 6, 7, 8],
        update: function update(item, value) {
            if (value) {
                item.set_height(Number(value));
            }
        }
    }
}, {
    name: 'title',
    category: 'base'
}]);
core.properties.register([{
    name: 'css_class', category: 'base'
}]);
/**
 * Base class for all things that can be displayed on a dashboard.
 */

var DashboardItem = function (_Model) {
    _inherits(DashboardItem, _Model);

    function DashboardItem(data) {
        _classCallCheck(this, DashboardItem);

        var _this = _possibleConstructorReturn(this, (DashboardItem.__proto__ || Object.getPrototypeOf(DashboardItem)).call(this, data));

        if (data) {
            if (data.item_id) {
                _this.item_id = data.item_id;
            }
            _this.title = data.title;
            _this.options = data.options;
            _this.css_class = data.css_class;
            _this.height = data.height;
            _this.style = data.style;
            _this.dashboard = data.dashboard;
        }
        return _this;
    }
    /**
     * Override in sub-classes to clean up any retained resources (such
     * as DOM references) prior to refreshing a dashboard.
     */


    _createClass(DashboardItem, [{
        key: 'cleanup',
        value: function cleanup() {}
        /* Metadata Accessors ------------------------------ */

    }, {
        key: 'updated',

        /* Events ----------------------------------------- */
        /**
         * Fire a centralized 'update' event. Parties interested in
         * receiving events when an item is updated can register handlers
         * using the class (DashboardItem) as the target. The specific item
         * updated will be passed as the event data.
         */
        value: function updated() {
            _util.events.fire(DashboardItem, 'update', { target: this });
            if (this.dashboard) {
                this.dashboard.dirty = true;
            }
            return this;
        }
        /* Chainable setters ------------------------------ */
        // These were created automatically by the old `limivorous`
        // observable object library. The could be created automatically
        // by a utility function here too, but we'd lose the benefit of
        // type-checking.

    }, {
        key: 'set_item_id',
        value: function set_item_id(value) {
            this.item_id = value;
            return this.updated();
        }
    }, {
        key: 'set_height',
        value: function set_height(value) {
            this.height = value;
            return this.updated();
        }
    }, {
        key: 'set_style',
        value: function set_style(value) {
            this.style = value;
            return this.updated();
        }
    }, {
        key: 'set_css_class',
        value: function set_css_class(value) {
            this.css_class = value;
            return this.updated();
        }
    }, {
        key: 'set_dashboard',
        value: function set_dashboard(value /* TODO */) {
            this.dashboard = value;
            return this;
        }
    }, {
        key: 'set_title',
        value: function set_title(value) {
            this.title = value;
            return this.updated();
        }
        /* Core methods ------------------------------ */
        /** Override this method in sub classes that have strings which
         * should be template-expanded before rendering. */

    }, {
        key: 'render_templates',
        value: function render_templates(context) {}
    }, {
        key: 'interactive_properties',
        value: function interactive_properties() {
            return ['css_class'];
        }
    }, {
        key: 'render',
        value: function render() {
            if (!this.meta.template) {
                return '<p>Item type <code>' + this.item_type + '</code> is missing a template.</p>';
            }
            return (0, _util.compile_template)(this.template)({ item: this });
        }
    }, {
        key: 'visit',
        value: function visit(visitor) {
            visitor(this);
            return this;
        }
    }, {
        key: 'clone',
        value: function clone() {
            return (0, _factory.make)(this.toJSON()).set_item_id(null);
        }
    }, {
        key: 'flatten',
        value: function flatten() {
            var flat = [];
            this.visit(function (item) {
                flat.push(item);
            });
            return flat;
        }
        // TODO - this should be moved out of the base class into a utility
        // module. It's only used by the manager object.

    }, {
        key: 'get_queries',
        value: function get_queries() {
            var queries = {};
            this.visit(function (item) {
                if (item['query']) {
                    var q = item['query_override'] || item['query'];
                    if (q) {
                        queries[q.name] = q;
                    }
                }
            });
            return queries;
        }
    }, {
        key: 'toJSON',
        value: function toJSON() {
            return {
                title: this.title,
                options: this.options,
                item_type: this.item_type,
                item_id: this.item_id,
                css_class: this.css_class,
                height: this.height,
                style: this.style
            };
        }
    }, {
        key: 'meta',
        get: function get() {
            return Object.getPrototypeOf(this).constructor.meta;
        }
    }, {
        key: 'item_type',
        get: function get() {
            return this.meta.item_type;
        }
    }, {
        key: 'item_category',
        get: function get() {
            return this.meta.category;
        }
    }, {
        key: 'display_name',
        get: function get() {
            return this.meta.display_name;
        }
    }, {
        key: 'template',
        get: function get() {
            return this.meta.template;
        }
    }, {
        key: 'icon',
        get: function get() {
            return this.meta.icon;
        }
    }, {
        key: 'requires_data',
        get: function get() {
            return this.meta.requires_data;
        }
    }]);

    return DashboardItem;
}(_model2.default);



exports.default = DashboardItem;

},{"../../core":27,"../../util":88,"../model":75,"./factory":52}],55:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _singlestat = require('./singlestat');

var _singlestat2 = _interopRequireDefault(_singlestat);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var JumbotronSinglestat = function (_Singlestat) {
  _inherits(JumbotronSinglestat, _Singlestat);

  function JumbotronSinglestat() {
    _classCallCheck(this, JumbotronSinglestat);

    return _possibleConstructorReturn(this, (JumbotronSinglestat.__proto__ || Object.getPrototypeOf(JumbotronSinglestat)).apply(this, arguments));
  }

  return JumbotronSinglestat;
}(_singlestat2.default);



exports.default = JumbotronSinglestat;

},{"./singlestat":66}],56:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

var _item = require('./item');

var _item2 = _interopRequireDefault(_item);

var _util = require('../../util');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var Markdown = function (_DashboardItem) {
    _inherits(Markdown, _DashboardItem);

    function Markdown(data) {
        _classCallCheck(this, Markdown);

        var _this = _possibleConstructorReturn(this, (Markdown.__proto__ || Object.getPrototypeOf(Markdown)).call(this, data));

        _this.raw = false;
        if (data) {
            _this.text = data.text;
            if (data.raw !== undefined) {
                _this.raw = data.raw;
            }
        }
        return _this;
    }

    _createClass(Markdown, [{
        key: 'set_text',
        value: function set_text(value) {
            this.text = value;
            return this.updated();
        }
    }, {
        key: 'render_templates',
        value: function render_templates(context) {
            try {
                this.expanded_text = (0, _util.render_template)(this.text, context);
            } catch (e) {
                this.expanded_text = e.toString();
            }
        }
    }, {
        key: 'toJSON',
        value: function toJSON() {
            return (0, _util.extend)(_get(Markdown.prototype.__proto__ || Object.getPrototypeOf(Markdown.prototype), 'toJSON', this).call(this), {
                text: this.text,
                raw: this.raw
            });
        }
    }, {
        key: 'interactive_properties',
        value: function interactive_properties() {
            return [{
                name: 'markdown.text',
                type: 'textarea',
                property_name: 'text'
            }, 'css_class'];
        }
    }]);

    return Markdown;
}(_item2.default);

exports.default = Markdown;

Markdown.meta = {
    icon: 'fa fa-code',
    category: 'display'
};


},{"../../util":88,"./item":54}],57:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

var _table_presentation = require('./table_presentation');

var _table_presentation2 = _interopRequireDefault(_table_presentation);

var _util = require('../../util');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var PercentageTable = function (_TablePresentation) {
    _inherits(PercentageTable, _TablePresentation);

    function PercentageTable(data) {
        _classCallCheck(this, PercentageTable);

        var _this = _possibleConstructorReturn(this, (PercentageTable.__proto__ || Object.getPrototypeOf(PercentageTable)).call(this, data));

        _this.include_sums = false;
        _this.invert_axes = false;
        _this.transform = 'sum';
        if (data) {
            _this.include_sums = data.include_sums;
            _this.invert_axes = data.invert_axes;
            _this.transform = data.transform || _this.transform;
        }
        return _this;
    }

    _createClass(PercentageTable, [{
        key: 'toJSON',
        value: function toJSON() {
            return (0, _util.extend)(_get(PercentageTable.prototype.__proto__ || Object.getPrototypeOf(PercentageTable.prototype), 'toJSON', this).call(this), {
                invert_axes: this.invert_axes,
                transform: this.transform,
                include_sums: this.include_sums
            });
        }
    }, {
        key: 'data_handler',
        value: function data_handler(query) {
            var _this2 = this;

            query.summation.percent_value = query.summation[this.transform];
            query.data.forEach(function (series) {
                series.summation.percent = 1 / (query.summation[_this2.transform] / series.summation[_this2.transform]);
                series.summation.percent_value = series.summation[_this2.transform];
            });
            var holder = $('#' + this.item_id + ' .ds-percentage-table-holder');
            holder.empty();
            holder.append(ts.templates.models.percentage_table_data({ item: this, query: query }));
            if (this.sortable) {
                var table = $('#' + this.item_id + ' .ds-percentage-table-holder table');
                if (!$.fn.dataTable.isDataTable(table)) {
                    table.DataTable({
                        order: [[2, "desc"]],
                        paging: false,
                        searching: false,
                        oLanguage: { sSearch: "" },
                        info: true
                    });
                }
            }
        }
    }, {
        key: 'interactive_properties',
        value: function interactive_properties() {
            return _get(PercentageTable.prototype.__proto__ || Object.getPrototypeOf(PercentageTable.prototype), 'interactive_properties', this).call(this).concat([{ name: 'invert_axes', type: 'boolean' }, { name: 'include_sums', type: 'boolean' }, 'transform']);
        }
    }]);

    return PercentageTable;
}(_table_presentation2.default);

exports.default = PercentageTable;

PercentageTable.meta = {
    icon: 'fa fa-table',
    category: 'data-table',
    requires_data: true
};


},{"../../util":88,"./table_presentation":69}],58:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

var _util = require('../../util');

var _core = require('../../core');

var core = _interopRequireWildcard(_core);

var _manager = require('../../app/manager');

var _manager2 = _interopRequireDefault(_manager);

var _item = require('./item');

var _item2 = _interopRequireDefault(_item);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var log = (0, _util.logger)('models.presentation');
core.properties.register([{
    name: 'query',
    category: 'base',
    template: '{{item.query.name}}',
    edit_options: {
        type: 'select',
        source: function source() {
            var queries = _manager2.default.current.dashboard.definition.queries;
            return Object.keys(queries).map(function (k) {
                return { value: k, text: k };
            });
        },
        value: function value(item) {
            return item.query ? item.query.name : undefined;
        },
        update: function update(item, value) {
            item.set_query(value);
        }
    }
}, {
    name: 'query_other',
    category: 'base',
    template: '{{item.query_other.name}}',
    edit_options: {
        type: 'select',
        source: function source() {
            var queries = _manager2.default.current.dashboard.definition.queries;
            return Object.keys(queries).map(function (k) {
                return { value: k, text: k };
            });
        },
        value: function value(item) {
            return item.query_other ? item.query_other.name : undefined;
        },
        update: function update(item, value) {
            item.set_query_other(value);
        }
    }
}, {
    name: 'transform',
    type: 'select',
    edit_options: {
        source: [{ value: undefined, text: 'default' }, 'sum', 'min', 'max', 'mean', 'median', 'first', 'last', 'last_non_zero', 'count']
    }
}]);
/**
 * The base class for all _presentations_, or dashboard items
 * which render data in some manner.
 */

var Presentation = function (_DashboardItem) {
    _inherits(Presentation, _DashboardItem);

    function Presentation(data) {
        _classCallCheck(this, Presentation);

        var _this = _possibleConstructorReturn(this, (Presentation.__proto__ || Object.getPrototypeOf(Presentation)).call(this, data));

        if (data) {
            if (data.query && data.query.name) {
                _this._query = data.query.name;
            } else {
                _this._query = data.query;
            }
        }
        return _this;
    }
    /* Query Accessors ------------------------------ */


    _createClass(Presentation, [{
        key: 'set_query',

        /* Chainable setters ------------------------------ */
        value: function set_query(value) {
            if (typeof value === 'string') {
                this._query = value;
            } else {
                this._query = value.name;
            }
            return this.updated();
        }
    }, {
        key: 'set_query_override',
        value: function set_query_override(value) {
            this.query_override = value;
            return this.updated();
        }
        /* Core methods ------------------------------ */
        /** Override this method in sub-classes to use query data to
         * render a dashboard element. */

    }, {
        key: 'data_handler',
        value: function data_handler(query) {}
    }, {
        key: 'interactive_properties',
        value: function interactive_properties() {
            return _get(Presentation.prototype.__proto__ || Object.getPrototypeOf(Presentation.prototype), 'interactive_properties', this).call(this).concat(['query']);
        }
    }, {
        key: 'render_templates',
        value: function render_templates(context) {
            _get(Presentation.prototype.__proto__ || Object.getPrototypeOf(Presentation.prototype), 'render_templates', this).call(this, context);
            /* No need to render this.query here, because they're shared,
             * and handled by dashboard_definition */
            if (this.query_override) {
                this.query_override.render_templates(context);
            }
        }
    }, {
        key: 'render',
        value: function render() {
            var _this2 = this;

            var query = this.query_override || this.query;
            if (query) {
                query.on_load(function (q) {
                    _this2.data_handler(q);
                });
            }
            return _get(Presentation.prototype.__proto__ || Object.getPrototypeOf(Presentation.prototype), 'render', this).call(this);
        }
    }, {
        key: 'toJSON',
        value: function toJSON() {
            return (0, _util.extend)(_get(Presentation.prototype.__proto__ || Object.getPrototypeOf(Presentation.prototype), 'toJSON', this).call(this), {
                query: this._query
            });
        }
    }, {
        key: 'query',
        get: function get() {
            if (!this.dashboard) {
                log.error('dashboard property not set on ' + this.item_type + ' / ' + this.item_id);
                return null;
            }
            return this.dashboard.definition.queries[this._query];
        },
        set: function set(value) {
            this._query = value.name;
        }
    }]);

    return Presentation;
}(_item2.default);



exports.default = Presentation;

},{"../../app/manager":16,"../../core":27,"../../util":88,"./item":54}],59:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _container = require('./container');

var _container2 = _interopRequireDefault(_container);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var Row = function (_Container) {
    _inherits(Row, _Container);

    function Row(data) {
        _classCallCheck(this, Row);

        return _possibleConstructorReturn(this, (Row.__proto__ || Object.getPrototypeOf(Row)).call(this, data));
    }

    _createClass(Row, [{
        key: 'interactive_properties',
        value: function interactive_properties() {
            return ['style', 'css_class'];
        }
    }]);

    return Row;
}(_container2.default);

exports.default = Row;

Row.meta = {
    category: 'structural'
};


},{"./container":48}],60:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

var _xychart = require('./xychart');

var _xychart2 = _interopRequireDefault(_xychart);

var _core = require('../../charts/core');

var charts = _interopRequireWildcard(_core);

var _app = require('../../app');

var app = _interopRequireWildcard(_app);

var _util = require('../../util');

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var ScatterPlot = function (_XYChart) {
    _inherits(ScatterPlot, _XYChart);

    function ScatterPlot(data) {
        _classCallCheck(this, ScatterPlot);

        var _this = _possibleConstructorReturn(this, (ScatterPlot.__proto__ || Object.getPrototypeOf(ScatterPlot)).call(this, data));

        if (data) {
            if (data.query_x && data.query_x.name) {
                _this._query_x = data.query_x.name;
            } else {
                _this._query_x = data.query_x;
            }
            if (data.query_y && data.query_y.name) {
                _this._query_y = data.query_y.name;
            } else {
                _this._query_y = data.query_y;
            }
        }
        // Override default legend type of 'simple' to 'none' if a legend
        // has not been set explicitly.
        if (!data || data && typeof data.legend === 'undefined') {
            _this.legend = undefined;
        }
        return _this;
    }

    _createClass(ScatterPlot, [{
        key: 'render_templates',
        value: function render_templates(context) {
            if (this.query_x) {
                this.query_x.render_templates(context);
            }
            if (this.query_y) {
                this.query_y.render_templates(context);
            }
        }
        /* Query Accessors ------------------------------ */

    }, {
        key: '_update_query',
        value: function _update_query() {
            if (this.query_x && this.query_y && this.dashboard) {
                this.query_override = this.query_x.join(this.query_y).set_name(this.item_id + '_joined');
                this.query_override.render_templates(app.context().variables);
            }
        }
    }, {
        key: 'set_query_x',
        value: function set_query_x(value) {
            if (typeof value === 'string') {
                this._query_x = value;
            } else {
                this._query_x = value.name;
            }
            return this.updated();
        }
    }, {
        key: 'set_query_y',
        value: function set_query_y(value) {
            if (typeof value === 'string') {
                this._query_y = value;
            } else {
                this._query_y = value.name;
            }
            return this.updated();
        }
    }, {
        key: 'toJSON',
        value: function toJSON() {
            var data = _get(ScatterPlot.prototype.__proto__ || Object.getPrototypeOf(ScatterPlot.prototype), 'toJSON', this).call(this);
            delete data['query'];
            return (0, _util.extend)(data, {
                query_x: this.query_x ? this.query_x.name : undefined,
                query_y: this.query_y ? this.query_y.name : undefined
            });
        }
    }, {
        key: 'render',
        value: function render() {
            this._update_query();
            console.log(this.query_override);
            return _get(ScatterPlot.prototype.__proto__ || Object.getPrototypeOf(ScatterPlot.prototype), 'render', this).call(this);
        }
    }, {
        key: 'data_handler',
        value: function data_handler(query) {
            console.log(query);
            charts.scatter_plot('#' + this.item_id + ' .ds-graph-holder', this, query);
        }
    }, {
        key: 'interactive_properties',
        value: function interactive_properties() {
            return ['height', 'title', 'css_class', 'chart.palette', 'chart.legend', 'chart.x-axis-label', 'chart.y-axis-min', 'chart.y-axis-max', 'chart.y-axis-scale', {
                name: 'query_x',
                template: new _util.Template('{{item.query_x.name}}'),
                edit_options: {
                    type: 'select',
                    source: function source() {
                        var queries = app.manager.current.dashboard.definition.queries;
                        return Object.keys(queries).map(function (k) {
                            return { value: k, text: k };
                        });
                    },
                    value: function value(item) {
                        return item.query_x ? item.query_x.name : undefined;
                    },
                    update: function update(item, value) {
                        item.set_query_x(value);
                    }
                }
            }, {
                name: 'query_y',
                template: new _util.Template('{{item.query_y.name}}'),
                edit_options: {
                    type: 'select',
                    source: function source() {
                        var queries = app.manager.current.dashboard.definition.queries;
                        return Object.keys(queries).map(function (k) {
                            return { value: k, text: k };
                        });
                    },
                    value: function value(item) {
                        return item.query_y ? item.query_y.name : undefined;
                    },
                    update: function update(item, value) {
                        item.set_query_y(value);
                    }
                }
            }];
        }
    }, {
        key: 'query_x',
        get: function get() {
            if (!this.dashboard) {
                return null;
            }
            return this.dashboard.definition.queries[this._query_x];
        },
        set: function set(value) {
            this._query_x = value.name;
            this._update_query();
        }
    }, {
        key: 'query_y',
        get: function get() {
            if (!this.dashboard) {
                return null;
            }
            return this.dashboard.definition.queries[this._query_y];
        },
        set: function set(value) {
            this._query_y = value.name;
            this._update_query();
        }
    }]);

    return ScatterPlot;
}(_xychart2.default);

exports.default = ScatterPlot;

ScatterPlot.meta = {
    icon: 'fa fa-circle'
};


},{"../../app":14,"../../charts/core":17,"../../util":88,"./xychart":74}],61:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

var _container = require('./container');

var _container2 = _interopRequireDefault(_container);

var _util = require('../../util');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var Section = function (_Container) {
    _inherits(Section, _Container);

    function Section(data) {
        _classCallCheck(this, Section);

        var _this = _possibleConstructorReturn(this, (Section.__proto__ || Object.getPrototypeOf(Section)).call(this, data));

        _this.level = 1;
        _this.horizontal_rule = false;
        _this.layout = 'fixed';
        if (data) {
            _this.description = data.description;
            _this.level = data.level || _this.level;
            if (typeof data.horizontal_rule !== 'undefined') _this.horizontal_rule = !!data.horizontal_rule;
            _this.layout = data.layout || _this.layout;
        }
        return _this;
    }

    _createClass(Section, [{
        key: 'set_layout',
        value: function set_layout(value) {
            this.layout = value;
            return this.updated();
        }
    }, {
        key: 'toJSON',
        value: function toJSON() {
            return (0, _util.extend)(_get(Section.prototype.__proto__ || Object.getPrototypeOf(Section.prototype), 'toJSON', this).call(this), {
                description: this.description,
                level: this.level,
                horizontal_rule: this.horizontal_rule,
                layout: this.layout
            });
        }
    }, {
        key: 'interactive_properties',
        value: function interactive_properties() {
            return [{ name: 'layout',
                type: 'select',
                edit_options: {
                    source: ['fixed', 'fluid', 'none']
                }
            }, 'style', 'css_class', 'title', 'description', {
                name: 'level',
                edit_options: {
                    type: 'select',
                    source: [1, 2, 3, 4, 5, 6]
                }
            }, { name: 'horizontal_rule', type: 'boolean' }];
        }
    }]);

    return Section;
}(_container2.default);

exports.default = Section;

Section.meta = {
    category: 'structural'
};


},{"../../util":88,"./container":48}],62:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _item = require('./item');

var _item2 = _interopRequireDefault(_item);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var Separator = function (_DashboardItem) {
    _inherits(Separator, _DashboardItem);

    function Separator(data) {
        _classCallCheck(this, Separator);

        return _possibleConstructorReturn(this, (Separator.__proto__ || Object.getPrototypeOf(Separator)).call(this, data));
    }

    _createClass(Separator, [{
        key: 'interactive_properties',
        value: function interactive_properties() {
            return ['css_class'];
        }
    }]);

    return Separator;
}(_item2.default);

exports.default = Separator;

Separator.meta = {
    item_type: 'separator',
    display_name: 'Separator',
    icon: 'fa fa-arrows-h',
    category: 'display'
};


},{"./item":54}],63:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

var _xychart = require('./xychart');

var _xychart2 = _interopRequireDefault(_xychart);

var _util = require('../../util');

var _core = require('../../charts/core');

var charts = _interopRequireWildcard(_core);

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var SimpleTimeSeries = function (_XYChart) {
    _inherits(SimpleTimeSeries, _XYChart);

    function SimpleTimeSeries(data) {
        _classCallCheck(this, SimpleTimeSeries);

        var _this = _possibleConstructorReturn(this, (SimpleTimeSeries.__proto__ || Object.getPrototypeOf(SimpleTimeSeries)).call(this, data));

        _this.filled = false;
        _this.show_max_value = false;
        _this.show_min_value = false;
        _this.show_last_value = false;
        if (data) {
            _this.legend = data.legend;
            _this.filled = !!data.filled;
            _this.show_max_value = !!data.show_max_value;
            _this.show_min_value = !!data.show_min_value;
            _this.show_last_value = !!data.show_last_value;
            if (!_this.height) {
                _this.height = 1;
            }
        }
        return _this;
    }

    _createClass(SimpleTimeSeries, [{
        key: 'toJSON',
        value: function toJSON() {
            return (0, _util.extend)(_get(SimpleTimeSeries.prototype.__proto__ || Object.getPrototypeOf(SimpleTimeSeries.prototype), 'toJSON', this).call(this), {
                filled: this.filled,
                show_max_value: this.show_max_value,
                show_min_value: this.show_min_value,
                show_last_value: this.show_last_value
            });
        }
    }, {
        key: 'data_handler',
        value: function data_handler(query) {
            var selector = '#' + this.item_id + ' .ds-graph-holder';
            if (this.filled) {
                charts.simple_area_chart(selector, this, query);
            } else {
                charts.simple_line_chart(selector, this, query);
            }
        }
    }, {
        key: 'interactive_properties',
        value: function interactive_properties() {
            return _get(SimpleTimeSeries.prototype.__proto__ || Object.getPrototypeOf(SimpleTimeSeries.prototype), 'interactive_properties', this).call(this).concat([{ name: 'filled', type: 'boolean' }, { name: 'show_max_value', type: 'boolean' }, { name: 'show_min_value', type: 'boolean' }, { name: 'show_last_value', type: 'boolean' }]);
        }
    }]);

    return SimpleTimeSeries;
}(_xychart2.default);

exports.default = SimpleTimeSeries;

SimpleTimeSeries.meta = {
    icon: 'fa fa-line-chart'
};


},{"../../charts/core":17,"../../util":88,"./xychart":74}],64:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

var _chart = require('./chart');

var _chart2 = _interopRequireDefault(_chart);

var _charts = require('../../charts');

var charts = _interopRequireWildcard(_charts);

var _util = require('../../util');

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var Singlegraph = function (_Chart) {
    _inherits(Singlegraph, _Chart);

    function Singlegraph(data) {
        _classCallCheck(this, Singlegraph);

        var _this = _possibleConstructorReturn(this, (Singlegraph.__proto__ || Object.getPrototypeOf(Singlegraph)).call(this, data));

        _this.format = ',.1s';
        _this.transform = 'mean';
        if (data) {
            _this.format = data.format || _this.format;
            _this.transform = data.transform || _this.transform;
            _this.index = data.index;
            if (!_this.height) _this.height = 1;
        }
        return _this;
    }

    _createClass(Singlegraph, [{
        key: 'toJSON',
        value: function toJSON() {
            return (0, _util.extend)(_get(Singlegraph.prototype.__proto__ || Object.getPrototypeOf(Singlegraph.prototype), 'toJSON', this).call(this), {
                format: this.format,
                transform: this.transform,
                index: this.index
            });
        }
    }, {
        key: 'data_handler',
        value: function data_handler(query) {
            if (!query.data) return;
            var flot = charts.renderers.get('flot');
            var options = {
                colors: charts.get_palette(this.options.palette)
            };
            flot.sparkline('#' + this.item_id + ' .ds-graph-holder', this, query, 0, options);
            this.options.margin = { top: 0, left: 0, bottom: 0, right: 0 };
            var label = query.data[this.index || 0].target;
            var value = query.summation[this.transform];
            if (this.index) {
                value = query.data[this.index].summation[this.transform];
            }
            $('#' + this.item_id + ' span.value').text(d3.format(this.format)(value));
            $('#' + this.item_id + ' span.ds-label').text(label);
        }
    }, {
        key: 'interactive_properties',
        value: function interactive_properties() {
            return _get(Singlegraph.prototype.__proto__ || Object.getPrototypeOf(Singlegraph.prototype), 'interactive_properties', this).call(this).concat(['format', 'transform']);
        }
    }]);

    return Singlegraph;
}(_chart2.default);

exports.default = Singlegraph;

Singlegraph.meta = {
    icon: 'fa fa-image',
    category: 'chart',
    requires_data: true
};


},{"../../charts":20,"../../util":88,"./chart":44}],65:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

var _chart = require('./chart');

var _chart2 = _interopRequireDefault(_chart);

var _charts = require('../../charts');

var charts = _interopRequireWildcard(_charts);

var _util = require('../../util');

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var SinglegraphGrid = function (_Chart) {
    _inherits(SinglegraphGrid, _Chart);

    function SinglegraphGrid(data) {
        _classCallCheck(this, SinglegraphGrid);

        var _this = _possibleConstructorReturn(this, (SinglegraphGrid.__proto__ || Object.getPrototypeOf(SinglegraphGrid)).call(this, data));

        _this.format = ',.1s';
        _this.transform = 'mean';
        _this.columns = 4;
        if (data) {
            _this.format = data.format || _this.format;
            _this.transform = data.transform || _this.transform;
            _this.columns = data.columns || _this.columns;
        }
        if (!_this.height) _this.height = 1;
        return _this;
    }

    _createClass(SinglegraphGrid, [{
        key: 'toJSON',
        value: function toJSON() {
            return (0, _util.extend)(_get(SinglegraphGrid.prototype.__proto__ || Object.getPrototypeOf(SinglegraphGrid.prototype), 'toJSON', this).call(this), {
                format: this.format,
                transform: this.transform,
                columns: this.columns
            });
        }
    }, {
        key: 'data_handler',
        value: function data_handler(query) {
            var _this2 = this;

            if (!query.data) return;
            var span = 12 / this.columns;
            var format = d3.format(this.format);
            var flot = charts.renderers.get('flot');
            var holder = $('#' + this.item_id + ' .ds-singlegraph-grid-holder');
            var options = {
                colors: charts.get_palette(this.options.palette)
            };
            holder.empty();
            query.data.forEach(function (series, i) {
                var value = series.summation[_this2.transform];
                holder.append(ts.templates.models.singlegraph_grid_item({
                    item: _this2,
                    index: i,
                    colspan: span,
                    value: format(value),
                    label: series.target
                }));
                flot.sparkline('#' + _this2.item_id + '-' + i + ' .ds-graph-holder', _this2, query, i, options);
            });
        }
    }, {
        key: 'interactive_properties',
        value: function interactive_properties() {
            return _get(SinglegraphGrid.prototype.__proto__ || Object.getPrototypeOf(SinglegraphGrid.prototype), 'interactive_properties', this).call(this).concat(['format', 'transform', {
                name: 'columns',
                edit_options: {
                    type: 'select',
                    source: [1, 2, 3, 4, 6, 12]
                }
            }]);
        }
    }]);

    return SinglegraphGrid;
}(_chart2.default);

exports.default = SinglegraphGrid;

SinglegraphGrid.meta = {
    icon: 'fa fa-image',
    category: 'chart',
    requires_data: true
};


},{"../../charts":20,"../../util":88,"./chart":44}],66:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

var _presentation = require('./presentation');

var _presentation2 = _interopRequireDefault(_presentation);

var _util = require('../../util');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var Singlestat = function (_Presentation) {
    _inherits(Singlestat, _Presentation);

    function Singlestat(data) {
        _classCallCheck(this, Singlestat);

        var _this = _possibleConstructorReturn(this, (Singlestat.__proto__ || Object.getPrototypeOf(Singlestat)).call(this, data));

        _this.format = ',.3s';
        _this.transform = 'mean';
        if (data) {
            _this.units = data.units;
            _this.format = data.format || _this.format;
            _this.index = data.index;
            _this.transform = data.transform || _this.transform;
        }
        return _this;
    }

    _createClass(Singlestat, [{
        key: 'set_transform',
        value: function set_transform(transform) {
            this.transform = transform;
            return this.updated();
        }
    }, {
        key: 'set_format',
        value: function set_format(format) {
            this.format = format;
            return this.updated();
        }
    }, {
        key: 'set_index',
        value: function set_index(index) {
            this.index = index;
            return this.updated();
        }
    }, {
        key: 'set_units',
        value: function set_units(units) {
            this.units = units;
            return this.updated();
        }
    }, {
        key: 'data_handler',
        value: function data_handler(query) {
            if (!query.summation) return;
            var element = $('#' + this.item_id + ' .value');
            var value = query.summation[this.transform];
            if (this.index) {
                value = query.data[this.index].summation[this.transform];
            }
            element.text(d3.format(this.format)(value));
        }
    }, {
        key: 'toJSON',
        value: function toJSON() {
            return (0, _util.extend)(_get(Singlestat.prototype.__proto__ || Object.getPrototypeOf(Singlestat.prototype), 'toJSON', this).call(this), {
                format: this.format,
                transform: this.transform,
                units: this.units,
                index: this.index
            });
        }
    }, {
        key: 'interactive_properties',
        value: function interactive_properties() {
            return _get(Singlestat.prototype.__proto__ || Object.getPrototypeOf(Singlestat.prototype), 'interactive_properties', this).call(this).concat(['units', 'format', 'title', { name: 'index', type: 'number' }, 'transform']);
        }
    }]);

    return Singlestat;
}(_presentation2.default);

exports.default = Singlestat;

Singlestat.meta = {
    category: 'data-table',
    icon: 'fa fa-subscript',
    requires_data: true
};


},{"../../util":88,"./presentation":58}],67:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

var _xychart = require('./xychart');

var _xychart2 = _interopRequireDefault(_xychart);

var _core = require('../../charts/core');

var charts = _interopRequireWildcard(_core);

var _util = require('../../util');

var _core2 = require('../../core');

var core = _interopRequireWildcard(_core2);

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var StandardTimeSeries = function (_XYChart) {
    _inherits(StandardTimeSeries, _XYChart);

    function StandardTimeSeries(data) {
        _classCallCheck(this, StandardTimeSeries);

        var _this = _possibleConstructorReturn(this, (StandardTimeSeries.__proto__ || Object.getPrototypeOf(StandardTimeSeries)).call(this, data));

        _this.stack_mode = charts.StackMode.NONE;
        _this.show_points = false;
        _this.show_lines = true;
        if (data) {
            // Set defaults based on whether we're initializing from a legacy
            // stacked_area_chart or not.
            if (data == 'stacked_area_chart' || data.item_type == 'stacked_area_chart') _this.stack_mode = data.stack_mode || charts.StackMode.NORMAL;else _this.stack_mode = data.stack_mode || _this.stack_mode;
            if (typeof data.show_points !== 'undefined') _this.show_points = !!data.show_points;
            if (typeof data.show_lines !== 'undefined') _this.show_lines = !!data.show_lines;else _this.show_lines = true;
        }
        return _this;
    }

    _createClass(StandardTimeSeries, [{
        key: 'toJSON',
        value: function toJSON() {
            return (0, _util.extend)(_get(StandardTimeSeries.prototype.__proto__ || Object.getPrototypeOf(StandardTimeSeries.prototype), 'toJSON', this).call(this), {
                stack_mode: this.stack_mode,
                show_points: this.show_points,
                show_lines: this.show_lines
            });
        }
    }, {
        key: 'data_handler',
        value: function data_handler(query) {
            charts.stacked_area_chart('#' + this.item_id + ' .ds-graph-holder', this, query);
        }
    }, {
        key: 'interactive_properties',
        value: function interactive_properties() {
            return _get(StandardTimeSeries.prototype.__proto__ || Object.getPrototypeOf(StandardTimeSeries.prototype), 'interactive_properties', this).call(this).concat([{
                name: 'stack_mode',
                type: 'select',
                edit_options: {
                    source: [charts.StackMode.NONE, charts.StackMode.NORMAL, charts.StackMode.PERCENT, charts.StackMode.STREAM]
                }
            }, {
                name: 'show_points',
                type: 'boolean'
            }, {
                name: 'show_lines',
                type: 'boolean'
            }]);
        }
    }]);

    return StandardTimeSeries;
}(_xychart2.default);

exports.default = StandardTimeSeries;

StandardTimeSeries.meta = {
    alias: 'stacked_area_chart',
    icon: 'fa fa-area-chart',
    actions: [new core.Action({
        name: 'stack_mode_none',
        display: 'Lines',
        icon: 'fa fa-line-chart',
        handler: function handler(action, item) {
            item.stack_mode = charts.StackMode.NONE;
            item.updated();
        }
    }), new core.Action({
        name: 'stack_mode_stacked',
        display: 'Stack',
        icon: 'fa fa-area-chart',
        handler: function handler(action, item) {
            item.stack_mode = charts.StackMode.NORMAL;
            item.updated();
        }
    }), new core.Action({
        name: 'stack_mode_stream',
        display: 'Stream',
        icon: 'fa fa-area-chart',
        handler: function handler(action, item) {
            item.stack_mode = charts.StackMode.STREAM;
            item.updated();
        }
    }), new core.Action({
        name: 'stack_mode_percent',
        display: 'Percent',
        icon: 'fa fa-area-chart',
        handler: function handler(action, item) {
            item.stack_mode = charts.StackMode.PERCENT;
            item.updated();
        }
    })]
};


},{"../../charts/core":17,"../../core":27,"../../util":88,"./xychart":74}],68:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

var _util = require('../../util');

var _table_presentation = require('./table_presentation');

var _table_presentation2 = _interopRequireDefault(_table_presentation);

var _charts = require('../../charts');

var charts = _interopRequireWildcard(_charts);

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var log = (0, _util.logger)('models.summation_table');

var SummationTable = function (_TablePresentation) {
    _inherits(SummationTable, _TablePresentation);

    function SummationTable(data) {
        _classCallCheck(this, SummationTable);

        var _this = _possibleConstructorReturn(this, (SummationTable.__proto__ || Object.getPrototypeOf(SummationTable)).call(this, data));

        _this.show_color = false;
        _this.show_min = true;
        _this.show_max = true;
        _this.show_mean = true;
        _this.show_median = true;
        _this.show_sum = true;
        _this.show_current = true;
        _this.show_sparkline = false;
        if (data) {
            _this.show_color = !!data.show_color;
            _this.options = data.options;
            _this.palette = data.palette;
            if (typeof data.show_min != 'undefined') _this.show_min = !!data.show_min;
            if (typeof data.show_max != 'undefined') _this.show_max = !!data.show_max;
            if (typeof data.show_mean != 'undefined') _this.show_mean = !!data.show_mean;
            if (typeof data.show_median != 'undefined') _this.show_median = !!data.show_median;
            if (typeof data.show_sum != 'undefined') _this.show_sum = !!data.show_sum;
            if (typeof data.show_current != 'undefined') _this.show_current = !!data.show_current;
            if (typeof data.show_sparkline != 'undefined') _this.show_sparkline = !!data.show_sparkline;
        }
        return _this;
    }

    _createClass(SummationTable, [{
        key: 'toJSON',
        value: function toJSON() {
            return (0, _util.extend)(_get(SummationTable.prototype.__proto__ || Object.getPrototypeOf(SummationTable.prototype), 'toJSON', this).call(this), {
                show_color: this.show_color,
                show_min: this.show_min,
                show_max: this.show_max,
                show_mean: this.show_mean,
                show_median: this.show_median,
                show_sum: this.show_sum,
                show_current: this.show_current,
                show_sparkline: this.show_sparkline,
                options: this.options,
                palette: this.palette
            });
        }
    }, {
        key: 'data_handler',
        value: function data_handler(query) {
            var _this2 = this;

            log.debug('data_handler(): ' + query.name + '/' + this.item_id);
            var options = this.options || {};
            var palette = charts.get_palette(options.palette || this.palette);
            var body = $('#' + this.item_id + ' table.ds-summation-table tbody');
            var flot = charts.renderers.get('flot');
            body.empty();
            query.data.forEach(function (series, i) {
                var color = palette[i % palette.length];
                body.append(ts.templates.models.summation_table_row({ series: series, item: _this2, color: color, index: i }));
                if (_this2.show_sparkline) {
                    var plot_div = $('#' + _this2.item_id + '-sparkline-' + i);
                    var _options = {
                        colors: _this2.show_color ? [color] : palette
                    };
                    flot.sparkline(plot_div, _this2, query, i, _options);
                }
            });
            if (this.sortable && !$.fn.dataTable.isDataTable(body.parent())) {
                body.parent().DataTable({
                    autoWidth: false,
                    paging: false,
                    searching: false,
                    info: false
                });
            }
        }
    }, {
        key: 'interactive_properties',
        value: function interactive_properties() {
            return _get(SummationTable.prototype.__proto__ || Object.getPrototypeOf(SummationTable.prototype), 'interactive_properties', this).call(this).concat([{ name: 'show_color', type: 'boolean', category: 'summation' }, { name: 'show_min', type: 'boolean', category: 'summation' }, { name: 'show_max', type: 'boolean', category: 'summation' }, { name: 'show_mean', type: 'boolean', category: 'summation' }, { name: 'show_median', type: 'boolean', category: 'summation' }, { name: 'show_sum', type: 'boolean', category: 'summation' }, { name: 'show_current', type: 'boolean', category: 'summation' }, { name: 'show_sparkline', type: 'boolean', category: 'summation' }, 'chart.palette', 'title']);
        }
    }]);

    return SummationTable;
}(_table_presentation2.default);



exports.default = SummationTable;

},{"../../charts":20,"../../util":88,"./table_presentation":69}],69:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

var _presentation = require('./presentation');

var _presentation2 = _interopRequireDefault(_presentation);

var _util = require('../../util');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var TablePresentation = function (_Presentation) {
    _inherits(TablePresentation, _Presentation);

    function TablePresentation(data) {
        _classCallCheck(this, TablePresentation);

        var _this = _possibleConstructorReturn(this, (TablePresentation.__proto__ || Object.getPrototypeOf(TablePresentation)).call(this, data));

        _this.striped = false;
        _this.sortable = false;
        _this.format = ',.3s';
        if (data) {
            _this.striped = !!data.striped;
            _this.sortable = !!data.sortable;
            _this.format = data.format || _this.format;
        }
        return _this;
    }

    _createClass(TablePresentation, [{
        key: 'toJSON',
        value: function toJSON() {
            return (0, _util.extend)(_get(TablePresentation.prototype.__proto__ || Object.getPrototypeOf(TablePresentation.prototype), 'toJSON', this).call(this), {
                striped: this.striped,
                sortable: this.sortable,
                format: this.format
            });
        }
    }, {
        key: 'cleanup',
        value: function cleanup() {
            var table = $('#' + this.item_id + ' table');
            if ($.fn.dataTable.isDataTable(table)) {
                table.DataTable().destroy();
            }
        }
    }, {
        key: 'interactive_properties',
        value: function interactive_properties() {
            return _get(TablePresentation.prototype.__proto__ || Object.getPrototypeOf(TablePresentation.prototype), 'interactive_properties', this).call(this).concat([{ name: 'striped', type: 'boolean' }, { name: 'sortable', type: 'boolean' }, 'format']);
        }
    }]);

    return TablePresentation;
}(_presentation2.default);

exports.default = TablePresentation;

TablePresentation.meta = {
    icon: 'fa fa-table',
    category: 'data-table',
    requires_data: true
};


},{"../../util":88,"./presentation":58}],70:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

var _presentation = require('./presentation');

var _presentation2 = _interopRequireDefault(_presentation);

var _util = require('../../util');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var ADDITIONAL_LANGUAGES = {
    minimal: {
        year: function year() {
            return "y";
        },
        month: function month() {
            return "mo";
        },
        week: function week() {
            return "w";
        },
        day: function day() {
            return "d";
        },
        hour: function hour() {
            return "h";
        },
        minute: function minute() {
            return "m";
        },
        second: function second() {
            return "s";
        },
        millisecond: function millisecond() {
            return "ms";
        }
    },
    compact: {
        year: function year() {
            return "yr";
        },
        month: function month() {
            return "mo";
        },
        week: function week() {
            return "wk";
        },
        day: function day() {
            return "day";
        },
        hour: function hour() {
            return "hr";
        },
        minute: function minute() {
            return "min";
        },
        second: function second() {
            return "sec";
        },
        millisecond: function millisecond() {
            return "ms";
        }
    }
};
var LANGUAGES = [undefined, 'minimal', 'compact'].concat(humanize_duration.getSupportedLanguages());
var DEFAULT_HUMANIZER = humanize_duration.humanizer({
    language: 'en'
});
var MINIMAL_HUMANIZER = humanize_duration.humanizer({
    language: 'minimal',
    languages: ADDITIONAL_LANGUAGES
});
var COMPACT_HUMANIZER = humanize_duration.humanizer({
    language: 'compact',
    languages: ADDITIONAL_LANGUAGES
});
/**
 * Render a summation value as a human-readable time span.
 *
 * TODO:
 * - This brings up the fact that we should now add a language user
 *   preference/global setting, similar to time zone.
 * - Expose more of the options from HumanizeDuration
 *
 * @see https://github.com/EvanHahn/HumanizeDuration.js
 */

var Timerstat = function (_Presentation) {
    _inherits(Timerstat, _Presentation);

    function Timerstat(data) {
        _classCallCheck(this, Timerstat);

        var _this = _possibleConstructorReturn(this, (Timerstat.__proto__ || Object.getPrototypeOf(Timerstat)).call(this, data));

        _this.transform = 'mean';
        _this.scale = 1;
        _this.precision = 2;
        _this.language = undefined;
        _this.humanizer = DEFAULT_HUMANIZER;
        if (data) {
            _this.transform = data.transform || _this.transform;
            _this.index = Number(data.index) || _this.index;
            _this.scale = Number(data.scale) || _this.scale;
            _this.precision = Number(data.precision) || _this.precision;
            _this.language = data.language;
            _this._updateHumanizer();
        }
        return _this;
    }

    _createClass(Timerstat, [{
        key: '_updateHumanizer',
        value: function _updateHumanizer() {
            if (this.language) {
                if (this.language === 'compact') {
                    this.humanizer = COMPACT_HUMANIZER;
                } else if (this.language === 'minimal') {
                    this.humanizer = MINIMAL_HUMANIZER;
                } else {
                    this.humanizer = humanize_duration.humanizer({
                        language: this.language
                    });
                }
            } else {
                this.humanizer = DEFAULT_HUMANIZER;
            }
        }
    }, {
        key: '_getMillis',
        value: function _getMillis(query) {
            var data = this.index ? query.data[this.index] : query;
            return data.summation[this.transform] * this.scale;
        }
    }, {
        key: '_getTimeParts',
        value: function _getTimeParts(millis) {
            var humanized = this.humanizer(millis, {
                round: true,
                delimiter: ' '
            });
            var tokens = humanized.split(' ').slice(0, this.precision * 2);
            var timeParts = [];
            for (var i = 0; i < tokens.length; i += 2) {
                timeParts.push({
                    value: tokens[i],
                    unit: tokens[i + 1]
                });
            }
            return timeParts;
        }
    }, {
        key: 'set_language',
        value: function set_language(language) {
            this.language = language === 'none' ? undefined : language;
            this._updateHumanizer();
            return this.updated();
        }
    }, {
        key: 'set_precision',
        value: function set_precision(value) {
            this.precision = value;
            return this.updated();
        }
    }, {
        key: 'data_handler',
        value: function data_handler(query) {
            var millis = this._getMillis(query);
            var timeParts = this._getTimeParts(millis);
            $('#' + this.item_id + ' .data').empty().append(ts.templates.models.timerstat_body({ parts: timeParts }));
        }
    }, {
        key: 'toJSON',
        value: function toJSON() {
            return (0, _util.extend)(_get(Timerstat.prototype.__proto__ || Object.getPrototypeOf(Timerstat.prototype), 'toJSON', this).call(this), {
                language: this.language,
                transform: this.transform,
                index: this.index,
                scale: this.scale,
                precision: this.precision
            });
        }
    }, {
        key: 'interactive_properties',
        value: function interactive_properties() {
            return _get(Timerstat.prototype.__proto__ || Object.getPrototypeOf(Timerstat.prototype), 'interactive_properties', this).call(this).concat(['title', { name: 'index', type: 'number' }, 'scale', {
                name: 'precision', type: 'select',
                edit_options: {
                    source: [1, 2, 3, 4, 5, 6],
                    update: function update(item, value) {
                        item.set_precision(value);
                    }
                }
            }, 'transform', {
                name: 'language', type: 'select',
                edit_options: {
                    source: LANGUAGES,
                    update: function update(item, value) {
                        item.set_language(value);
                    }
                }
            }]);
        }
    }]);

    return Timerstat;
}(_presentation2.default);

exports.default = Timerstat;

Timerstat.meta = {
    display_name: 'Timer Stat',
    category: 'data-table',
    icon: 'fa fa-clock-o',
    requires_data: true
};


},{"../../util":88,"./presentation":58}],71:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _timeshift_singlestat = require('./timeshift_singlestat');

var _timeshift_singlestat2 = _interopRequireDefault(_timeshift_singlestat);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var TimeshiftJumbotronSinglestat = function (_TimeshiftSinglestat) {
    _inherits(TimeshiftJumbotronSinglestat, _TimeshiftSinglestat);

    function TimeshiftJumbotronSinglestat() {
        _classCallCheck(this, TimeshiftJumbotronSinglestat);

        return _possibleConstructorReturn(this, (TimeshiftJumbotronSinglestat.__proto__ || Object.getPrototypeOf(TimeshiftJumbotronSinglestat)).apply(this, arguments));
    }

    return TimeshiftJumbotronSinglestat;
}(_timeshift_singlestat2.default);

exports.default = TimeshiftJumbotronSinglestat;

TimeshiftJumbotronSinglestat.meta = {
    template: ts.templates.models.jumbotron_singlestat
};


},{"./timeshift_singlestat":72}],72:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

var _util = require('../../util');

var _app = require('../../app');

var app = _interopRequireWildcard(_app);

var _singlestat = require('./singlestat');

var _singlestat2 = _interopRequireDefault(_singlestat);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var log = (0, _util.logger)('models.timeshift_singlestat');
var FORMAT_PERCENT = d3.format(',.1%');

var TimeshiftSinglestat = function (_Singlestat) {
    _inherits(TimeshiftSinglestat, _Singlestat);

    function TimeshiftSinglestat(data) {
        _classCallCheck(this, TimeshiftSinglestat);

        var _this = _possibleConstructorReturn(this, (TimeshiftSinglestat.__proto__ || Object.getPrototypeOf(TimeshiftSinglestat)).call(this, data));

        _this._shift = '1d';
        _this.percent = false;
        if (data) {
            _this._shift = data.shift || _this._shift;
            _this.percent = !!data.percent;
        }
        _this._update_query();
        return _this;
    }

    _createClass(TimeshiftSinglestat, [{
        key: '_update_query',
        value: function _update_query() {
            if (this._query && this.dashboard) {
                var query = this.dashboard.definition.queries[this._query];
                this.query_override = query.join(query.shift(this.shift)).set_name(this.item_id + '_shifted');
                this.query_override.render_templates(app.context().variables);
            }
        }
    }, {
        key: 'set_shift',
        value: function set_shift(value) {
            this.shift = value;
            return this.updated();
        }
    }, {
        key: 'toJSON',
        value: function toJSON() {
            return (0, _util.extend)(_get(TimeshiftSinglestat.prototype.__proto__ || Object.getPrototypeOf(TimeshiftSinglestat.prototype), 'toJSON', this).call(this), {
                shift: this.shift,
                percent: this.percent
            });
        }
    }, {
        key: 'render',
        value: function render() {
            this._update_query();
            return _get(TimeshiftSinglestat.prototype.__proto__ || Object.getPrototypeOf(TimeshiftSinglestat.prototype), 'render', this).call(this);
        }
    }, {
        key: 'data_handler',
        value: function data_handler(query) {
            var value = query.data[0].summation[this.transform];
            var base = query.data[1].summation[this.transform];
            var diff = value - base;
            var pct = value / base - 1;
            var float_margin = 0.000001;
            var diff_elt = $('#' + this.item_id + ' span.diff');
            $('#' + this.item_id + ' span.value').text(d3.format(this.format)(value));
            if (diff > float_margin) diff_elt.addClass('ds-diff-plus');else if (diff < float_margin) diff_elt.addClass('ds-diff-minus');
            var diff_formatted = this.percent ? FORMAT_PERCENT(Math.abs(pct)) : d3.format(this.format)(Math.abs(diff));
            $('#' + this.item_id + ' span.diff').text(diff_formatted);
        }
    }, {
        key: 'interactive_properties',
        value: function interactive_properties() {
            return _get(TimeshiftSinglestat.prototype.__proto__ || Object.getPrototypeOf(TimeshiftSinglestat.prototype), 'interactive_properties', this).call(this).concat(['shift', { name: 'percent', type: 'boolean' }]);
        }
    }, {
        key: 'shift',
        get: function get() {
            return this._shift;
        },
        set: function set(value) {
            this._shift = value;
        }
    }]);

    return TimeshiftSinglestat;
}(_singlestat2.default);

exports.default = TimeshiftSinglestat;

TimeshiftSinglestat.meta = {
    template: ts.templates.models.singlestat
};


},{"../../app":14,"../../util":88,"./singlestat":66}],73:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

var _util = require('../../util');

var _core = require('../../core');

var _table_presentation = require('./table_presentation');

var _table_presentation2 = _interopRequireDefault(_table_presentation);

var _summation = require('../data/summation');

var _summation2 = _interopRequireDefault(_summation);

var _app = require('../../app/app');

var app = _interopRequireWildcard(_app);

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

/**
 * This iteration of timeshift_summation_table takes a single query
 * and applies a timeShift() value to it. Another approach is to take
 * two arbitrary queries and compare them (so it's not strictly a
 * time-based comparison).
 *
 * This version is slightly simpler to implement, because we don't
 * need to join on two asynchronously fetched queries.
 */
var TimeshiftSummationTable = function (_TablePresentation) {
    _inherits(TimeshiftSummationTable, _TablePresentation);

    function TimeshiftSummationTable(data) {
        _classCallCheck(this, TimeshiftSummationTable);

        var _this = _possibleConstructorReturn(this, (TimeshiftSummationTable.__proto__ || Object.getPrototypeOf(TimeshiftSummationTable)).call(this, data));

        _this._shift = '1d';
        if (data) {
            _this._shift = data.shift || _this._shift;
        }
        _this._update_query();
        return _this;
    }

    _createClass(TimeshiftSummationTable, [{
        key: '_update_query',
        value: function _update_query() {
            if (this._query && this.dashboard) {
                var query = this.dashboard.definition.queries[this._query];
                this.query_override = query.join(query.shift(this.shift)).set_name(this.item_id + '_shifted');
                this.query_override.render_templates(app.context().variables);
            }
        }
    }, {
        key: 'set_shift',
        value: function set_shift(value) {
            this.shift = value;
            return this.updated();
        }
    }, {
        key: 'toJSON',
        value: function toJSON() {
            return (0, _util.extend)(_get(TimeshiftSummationTable.prototype.__proto__ || Object.getPrototypeOf(TimeshiftSummationTable.prototype), 'toJSON', this).call(this), {
                shift: this.shift
            });
        }
    }, {
        key: 'render',
        value: function render() {
            this._update_query();
            return _get(TimeshiftSummationTable.prototype.__proto__ || Object.getPrototypeOf(TimeshiftSummationTable.prototype), 'render', this).call(this);
        }
    }, {
        key: 'data_handler',
        value: function data_handler(query) {
            var body = $('#' + this.item_id + ' tbody');
            var now = query.data[0].summation;
            var then = query.data[1].summation;
            var diff = new _summation2.default(now).subtract(then);
            var properties = ['mean', 'median', 'min', 'max', 'sum'];
            var float_margin = 0.000001;
            properties.forEach(function (prop) {
                var value = diff[prop];
                if (value > float_margin) diff[prop + '_class'] = 'ds-diff-plus';else if (value < -float_margin) diff[prop + '_class'] = 'ds-diff-minus';
                if (float_margin > value && value > -float_margin) value = 0.0;
                var pct = now[prop] / then[prop] - 1;
                pct = isNaN(pct) ? 0.0 : pct;
                diff[prop + '_pct'] = d3.format(',.2%')(Math.abs(pct));
                diff[prop] = Math.abs(value);
            });
            body.empty();
            body.append(ts.templates.models.timeshift_summation_table_body({
                now: now,
                then: then,
                diff: diff,
                item: this
            }));
            if (this.sortable && !$.fn.dataTable.isDataTable(body.parent())) {
                body.parent().DataTable({
                    autoWidth: false,
                    paging: false,
                    searching: false,
                    info: false
                });
            }
        }
    }, {
        key: 'interactive_properties',
        value: function interactive_properties() {
            return _get(TimeshiftSummationTable.prototype.__proto__ || Object.getPrototypeOf(TimeshiftSummationTable.prototype), 'interactive_properties', this).call(this).concat(['shift']);
        }
    }, {
        key: 'shift',
        get: function get() {
            return this._shift;
        },
        set: function set(value) {
            this._shift = value;
        }
    }], [{
        key: 'timeshift_action',
        value: function timeshift_action(interval, label) {
            return new _core.Action({
                name: 'timeshift_' + interval,
                display: label,
                icon: 'fa fa-clock-o',
                handler: function handler(action, item) {
                    item.set_shift(interval);
                }
            });
        }
    }]);

    return TimeshiftSummationTable;
}(_table_presentation2.default);

exports.default = TimeshiftSummationTable;

TimeshiftSummationTable.meta = {
    actions: [TimeshiftSummationTable.timeshift_action('1h', '1 Hour Ago'), TimeshiftSummationTable.timeshift_action('1d', '1 Day Ago'), TimeshiftSummationTable.timeshift_action('1w', '1 Week Ago'), new _core.Action({
        name: 'timeshift_user_input',
        display: 'Pick interval...',
        icon: 'fa fa-clock-o',
        handler: function handler(action, item) {
            bootbox.prompt({
                backdrop: false,
                title: "Enter a time shift interval",
                callback: function callback(result) {
                    if (result) {
                        item.set_shift(result);
                    }
                }
            });
        }
    })]
};


},{"../../app/app":1,"../../core":27,"../../util":88,"../data/summation":39,"./table_presentation":69}],74:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

var _core = require('../../core');

var core = _interopRequireWildcard(_core);

var _chart = require('./chart');

var _chart2 = _interopRequireDefault(_chart);

var _axis = require('../axis');

var _axis2 = _interopRequireDefault(_axis);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

core.properties.register([{
    name: 'chart.y-axis-label',
    property_name: 'y-axis-label',
    category: 'chart',
    edit_options: {
        type: 'text',
        value: function value(item) {
            if (item.options && item.options.y1) {
                return item.options.y1.label;
            } else if (item.options) {
                /* legacy */
                return item.options.yAxisLabel;
            } else {
                return undefined;
            }
        },
        update: function update(item, newValue) {
            if (!item.options) {
                item.options = {};
            }
            if (!item.options.y1) {
                item.options.y1 = new _axis2.default();
            }
            item.options.y1.label = newValue;
            item.updated();
        }
    }
}, {
    name: 'chart.x-axis-label',
    property_name: 'x-axis-label',
    category: 'chart',
    edit_options: {
        type: 'text',
        value: function value(item) {
            if (item.options && item.options.x) {
                return item.options.x.label;
            } else {
                return undefined;
            }
        },
        update: function update(item, newValue) {
            if (!item.options) {
                item.options = {};
            }
            if (!item.options.x) {
                item.options.x = new _axis2.default();
            }
            item.options.x.label = newValue;
            item.updated();
        }
    }
}, {
    name: 'chart.y-axis-min',
    property_name: 'y-axis-min',
    category: 'chart',
    edit_options: {
        type: 'text',
        value: function value(item) {
            return item.options && item.options.y1 ? item.options.y1.min : undefined;
        },
        update: function update(item, newValue) {
            if (!item.options) {
                item.options = {};
            }
            if (!item.options.y1) {
                item.options.y1 = new _axis2.default();
            }
            item.options.y1.min = newValue;
            item.updated();
        }
    }
}, {
    name: 'chart.y-axis-max',
    property_name: 'y-axis-max',
    category: 'chart',
    edit_options: {
        type: 'text',
        value: function value(item) {
            return item.options && item.options.y1 ? item.options.y1.max : undefined;
        },
        update: function update(item, newValue) {
            if (!item.options) {
                item.options = {};
            }
            if (!item.options.y1) {
                item.options.y1 = new _axis2.default();
            }
            item.options.y1.max = newValue;
            item.updated();
        }
    }
}, {
    name: 'chart.y-axis-scale',
    property_name: 'y-axis-scale',
    category: 'chart',
    type: 'select',
    edit_options: {
        source: [_axis.AxisScale.LINEAR, _axis.AxisScale.LOG],
        value: function value(item) {
            var value = item.options && item.options.y1 ? item.options.y1.scale : undefined;
            return value ? value : _axis.AxisScale.LINEAR;
        },
        update: function update(item, newValue) {
            if (!item.options) {
                item.options = {};
            }
            if (!item.options.y1) {
                item.options.y1 = new _axis2.default();
            }
            item.options.y1.scale = newValue;
            item.updated();
        }
    }
}]);

var XYChart = function (_Chart) {
    _inherits(XYChart, _Chart);

    function XYChart(data) {
        _classCallCheck(this, XYChart);

        return _possibleConstructorReturn(this, (XYChart.__proto__ || Object.getPrototypeOf(XYChart)).call(this, data));
    }

    _createClass(XYChart, [{
        key: 'interactive_properties',
        value: function interactive_properties() {
            return _get(XYChart.prototype.__proto__ || Object.getPrototypeOf(XYChart.prototype), 'interactive_properties', this).call(this).concat(['chart.x-axis-label', 'chart.y-axis-label', 'chart.y-axis-min', 'chart.y-axis-max', 'chart.y-axis-scale']);
        }
    }]);

    return XYChart;
}(_chart2.default);



exports.default = XYChart;

},{"../../core":27,"../axis":36,"./chart":44}],75:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _eventSource = require('../util/event-source');

var _eventSource2 = _interopRequireDefault(_eventSource);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

/**
 * Base class for all API model classes
 */
var Model = function (_EventSource) {
    _inherits(Model, _EventSource);

    function Model(data) {
        _classCallCheck(this, Model);

        return _possibleConstructorReturn(this, (Model.__proto__ || Object.getPrototypeOf(Model)).call(this, data));
    }

    _createClass(Model, [{
        key: 'toJSON',
        value: function toJSON() {
            return {};
        }
    }]);

    return Model;
}(_eventSource2.default);



exports.default = Model;

},{"../util/event-source":86}],76:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _model = require('./model');

var _model2 = _interopRequireDefault(_model);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var Preferences = function (_Model) {
    _inherits(Preferences, _Model);

    function Preferences(data) {
        _classCallCheck(this, Preferences);

        var _this = _possibleConstructorReturn(this, (Preferences.__proto__ || Object.getPrototypeOf(Preferences)).call(this, data));

        _this.connected_lines = false;
        _this.default_from_time = '-3h';
        _this.downsample = true;
        _this.graphite_url = 'http://localhost:8080';
        _this.propsheet_autoclose_seconds = 3;
        _this.refresh = 60;
        _this.renderer = 'flot';
        _this.theme = 'light';
        _this.timezone = 'Etc/UTC';
        if (data) {
            if (typeof data.connected_lines != 'undefined') _this.connected_lines = !!data.connected_lines;
            _this.default_from_time = data.default_from_time || _this.default_from_time;
            if (typeof data.downsample != 'undefined') _this.downsample = !!data.downsample;
            _this.graphite_auth = data.graphite_auth;
            _this.graphite_url = data.graphite_url || _this.graphite_url;
            _this.propsheet_autoclose_seconds = Number(data.propsheet_autoclose_seconds) || _this.propsheet_autoclose_seconds;
            _this.refresh = Number(data.refresh) || _this.refresh;
            _this.renderer = data.renderer || _this.renderer;
            _this.theme = data.theme || _this.theme;
            _this.timezone = data.timezone || _this.timezone;
        }
        return _this;
    }

    _createClass(Preferences, [{
        key: 'toJSON',
        value: function toJSON() {
            return {
                connected_lines: this.connected_lines,
                default_from_time: this.default_from_time,
                downsample: this.downsample,
                graphite_auth: this.graphite_auth,
                graphite_url: this.graphite_url,
                propsheet_autoclose_seconds: this.propsheet_autoclose_seconds,
                refresh: this.refresh,
                renderer: this.renderer,
                theme: this.theme,
                timezone: this.timezone
            };
        }
    }]);

    return Preferences;
}(_model2.default);



exports.default = Preferences;

},{"./model":75}],77:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _model = require('./model');

var _model2 = _interopRequireDefault(_model);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var Tag = function (_Model) {
    _inherits(Tag, _Model);

    function Tag(data) {
        _classCallCheck(this, Tag);

        var _this = _possibleConstructorReturn(this, (Tag.__proto__ || Object.getPrototypeOf(Tag)).call(this, data));

        if (data) {
            if (typeof data === 'string') {
                _this.name = data;
            } else {
                _this.id = data.id;
                _this.href = data.href;
                _this.name = data.name;
                _this.description = data.description;
                _this.color = data.color;
                _this.count = data.count;
            }
        }
        return _this;
    }

    _createClass(Tag, [{
        key: 'toJSON',
        value: function toJSON() {
            return {
                id: this.id,
                href: this.href,
                name: this.name,
                description: this.description,
                color: this.color,
                count: this.count
            };
        }
    }]);

    return Tag;
}(_model2.default);



exports.default = Tag;

},{"./model":75}],78:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _model = require('./model');

var _model2 = _interopRequireDefault(_model);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var Thresholds = function (_Model) {
    _inherits(Thresholds, _Model);

    function Thresholds(data) {
        _classCallCheck(this, Thresholds);

        var _this = _possibleConstructorReturn(this, (Thresholds.__proto__ || Object.getPrototypeOf(Thresholds)).call(this, data));

        if (data) {
            _this.summation_type = data.summation_type || 'mean';
            _this.warning = data.warning;
            _this.danger = data.danger;
        }
        return _this;
    }

    _createClass(Thresholds, [{
        key: 'toJSON',
        value: function toJSON() {
            return {
                summation_type: this.summation_type,
                warning: this.warning,
                danger: this.danger
            };
        }
    }]);

    return Thresholds;
}(_model2.default);



exports.default = Thresholds;

},{"./model":75}],79:[function(require,module,exports){
'use strict';

var _transform = require('./transform');

var _factory = require('../items/factory');

var _query = require('../data/query');

var _query2 = _interopRequireDefault(_query);

var _util = require('../../charts/util');

var util = _interopRequireWildcard(_util);

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * Higlight the average, max average, and most deviant series. This
 * transform works best on line graphs with lots of metrics (for
 * example, CPU or disk usage across a cluster).
 *
 * TODO: enforcing that it not be used on stacked graphs would be
 * neat. Adding an `applicable_types` attribute or something could
 * control visibily of transforms, so they only appear for
 * presentations that they make sense for.
 */
_transform.transforms.register({
    name: 'HighlightAverages',
    display_name: 'Highlight Averages',
    transform_type: 'presentation',
    transform: function transform(item) {
        var query = item.query;
        var group = query.targets.length > 1 ? 'group(' + query.targets.join(',') + ')' : query.targets[0];
        var bg = Color(window.getComputedStyle($('body')[0]).backgroundColor);
        var palette = util.get_low_contrast_palette();
        /* Set up the modified queries */
        var query_averages = new _query2.default({
            name: query.name + '_averages',
            targets: [group, 'alias(lineWidth(color(averageSeries(' + group + '), "' + (bg.dark() ? bg.clone().lighten(4.0) : bg.clone().darken(1.0)).hexString() + '"), 2), "Avg")', 'alias(lineWidth(color(highestAverage(' + group + ', 1), "red"), 2), "Max Avg")']
        });
        var query_deviant = new _query2.default({
            name: query.name + '_deviant',
            targets: [group, 'alias(lineWidth(color(mostDeviant(' + group + ', 1), "red"), 2), "Most Deviant")']
        });
        /* Clone and modify the original */
        var item_averages = (0, _factory.make)('standard_time_series').set_height(6).set_renderer('graphite').set_title("Average & Max Average").set_query_override(query_averages);
        item_averages.options.palette = palette;
        item_averages.options.hideLegend = 'true';
        var item_deviant = (0, _factory.make)('standard_time_series').set_height(4).set_renderer('graphite').set_title('Most Deviant').set_query_override(query_deviant);
        item_deviant.options.palette = palette;
        /* And put it all together */
        return (0, _factory.make)('section').add((0, _factory.make)('row').add((0, _factory.make)('cell').set_span(12).set_style('well').add(item_averages))).add((0, _factory.make)('row').add((0, _factory.make)('cell').set_span(12).add(item_deviant))).add((0, _factory.make)('separator')).add((0, _factory.make)('row').add((0, _factory.make)('cell').set_span(12).add(item.set_title('Original'))));
    }
});


},{"../../charts/util":24,"../data/query":38,"../items/factory":52,"./transform":84}],80:[function(require,module,exports){
'use strict';

var _transform = require('./transform');

var _factory = require('../items/factory');

var _chart = require('../items/chart');

var _chart2 = _interopRequireDefault(_chart);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * Focus on a single presentation.
 */
_transform.transforms.register({
    name: 'Isolate',
    display_name: 'Isolate',
    transform_type: 'presentation',
    transform: function transform(item) {
        var options = item.options || {};
        if (item instanceof _chart2.default) {
            item.set_renderer('flot');
        }
        return (0, _factory.make)('section').add((0, _factory.make)('row').add((0, _factory.make)('cell').set_span(12).set_style('well').add(item.set_height(6)))).add((0, _factory.make)('row').add((0, _factory.make)('cell').set_span(12).add((0, _transform.render_query)(item.query)))).add((0, _factory.make)('row').add((0, _factory.make)('cell').set_span(12).add((0, _factory.make)({ item_type: 'summation_table',
            options: {
                palette: options.palette
            },
            show_color: true,
            sortable: true,
            format: ',.3f',
            query: item.query }))));
    }
});


},{"../items/chart":44,"../items/factory":52,"./transform":84}],81:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _transform = require('./transform');

var _transform2 = _interopRequireDefault(_transform);

var _factory = require('../items/factory');

var _util = require('../../util');

var _chart = require('../items/chart');

var _chart2 = _interopRequireDefault(_chart);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

/**
 * A transform which simply takes all presentations and arranges them in
 * a regular grid.
 */
var SimpleGrid = function (_Transform) {
    _inherits(SimpleGrid, _Transform);

    function SimpleGrid(data) {
        _classCallCheck(this, SimpleGrid);

        var _this = _possibleConstructorReturn(this, (SimpleGrid.__proto__ || Object.getPrototypeOf(SimpleGrid)).call(this, (0, _util.extend)({}, data, {
            display_name: 'Simple Grid',
            name: 'SimpleGrid',
            transform_type: _transform.TransformType.DASHBOARD
        })));

        _this._columns = 1;
        _this.span = 12;
        _this.section_type = 'fixed';
        _this.charts_only = false;
        if (data) {
            _this.columns = data.columns || _this.columns;
            _this.section_type = data.section_type || _this.section_type;
            _this.charts_only = !!data.charts_only;
        }
        _this.span = 12 / _this.columns;
        return _this;
    }
    /** Setter for the columns property recalculates the column
     * span to resize items to (based ona 12-column grid) */


    _createClass(SimpleGrid, [{
        key: 'transform',
        value: function transform(item) {
            var _this2 = this;

            var items = item.flatten();
            var section = (0, _factory.make)('section').set_layout(this.section_type);
            var current_row = (0, _factory.make)('row');
            items.forEach(function (item) {
                if (item.item_type === 'dashboard_definition' || item.item_type === 'cell' || item.item_type === 'row' || item.item_type === 'section' || _this2.charts_only && !(item instanceof _chart2.default)) {
                    return;
                }
                var cell = (0, _factory.make)('cell').set_span(_this2.span).add(item);
                if (current_row.add(cell).length == _this2.columns) {
                    section.add(current_row);
                    current_row = (0, _factory.make)('row');
                }
            });
            if (current_row.length > 0) {
                section.add(current_row);
            }
            return section;
        }
    }, {
        key: 'toJSON',
        value: function toJSON() {
            return {
                columns: this.columns,
                span: this.span,
                section_type: this.section_type,
                charts_only: this.charts_only,
                name: this.name
            };
        }
    }, {
        key: 'columns',
        set: function set(value) {
            this._columns = value;
            this.span = 12 / value;
        },
        get: function get() {
            return this._columns;
        }
    }]);

    return SimpleGrid;
}(_transform2.default);



exports.default = SimpleGrid;

},{"../../util":88,"../items/chart":44,"../items/factory":52,"./transform":84}],82:[function(require,module,exports){
'use strict';

var _transform = require('./transform');

var _factory = require('../items/factory');

/**
 * Transform a view of a single graph into viewing multiple of that
 * graph at the same temporal resolution but shifted by one or more
 * time periods.
 */
_transform.transforms.register({
    name: 'TimeShift',
    display_name: 'Time Shift',
    transform_type: 'presentation',
    icon: 'fa fa-clock-o',
    transform: function transform(item) {
        var query = item.query;
        var shifts = [{ shift: '-1h', title: 'One Hour Ago' }, { shift: '-12h', title: '12 Hours Ago' }, { shift: '-1d', title: 'One Day Ago' }, { shift: '-2d', title: 'Two Days Ago' }, { shift: '-1w', title: 'One Week Ago' }];
        var make_row = function make_row(query, item, style) {
            return (0, _factory.make)('row').set_style(style).add((0, _factory.make)('cell').set_span(10).add(item)).add((0, _factory.make)('cell').set_span(1).set_align('right').add((0, _factory.make)('singlestat').set_query(query).set_transform('sum').set_format(',.2s').set_title('Total'))).add((0, _factory.make)('cell').set_span(1).set_align('left').add((0, _factory.make)('singlestat').set_query(query).set_transform('mean').set_format(',.2s').set_title('Average')));
        };
        var section = (0, _factory.make)('section').add((0, _factory.make)({ item_type: 'heading',
            level: 2, text: item.title ? 'Time shift - ' + item.title : 'Time shift' })).add((0, _factory.make)('separator')).add(make_row(item.query, item, 'well')).add((0, _factory.make)('separator'));
        var _iteratorNormalCompletion = true;
        var _didIteratorError = false;
        var _iteratorError = undefined;

        try {
            for (var _iterator = shifts[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
                var shift = _step.value;

                var modified_query = query.shift(shift.shift);
                var modified_item = (0, _factory.make)(item.toJSON()).set_item_id(undefined).set_query_override(modified_query).set_title(shift.title);
                section.add(make_row(modified_query, modified_item));
            }
        } catch (err) {
            _didIteratorError = true;
            _iteratorError = err;
        } finally {
            try {
                if (!_iteratorNormalCompletion && _iterator.return) {
                    _iterator.return();
                }
            } finally {
                if (_didIteratorError) {
                    throw _iteratorError;
                }
            }
        }

        return section;
    }
});


},{"../items/factory":52,"./transform":84}],83:[function(require,module,exports){
'use strict';

var _transform = require('./transform');

var _factory = require('../items/factory');

var _util = require('../../util');

var _query = require('../data/query');

var _query2 = _interopRequireDefault(_query);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * Transform a view of a single graph into viewing that graph over
 * multiple time spans. The item being transformed should be a single
 * presentation, not a composite (i.e. not a cell, row, section, or
 * dashboard).
 *
 * The time periods can be customized by passing an array of objects
 * with from/until/title properties
 *
 * Input => A single presentation
 *
 * Output => A section with a list of copies of the presentation with
 *           immediate query objects that override the time period
 */
_transform.transforms.register({
    name: 'TimeSpans',
    display_name: 'View across time spans',
    transform_type: 'presentation',
    icon: '          fa fa-clock-o',
    transform: function transform(item) {
        var spans = [{ from: '-1h', title: 'Past Hour' }, { from: '-4h', title: 'Past 4 Hours' }, { from: '-1d', title: 'Past Day' }, { from: '-1w', title: 'Past Week' }];
        var columns = 1;
        var query = item.query;
        var colspan = 12 / columns;
        var section = (0, _factory.make)('section').add((0, _factory.make)('heading', {
            level: 2, text: item.title ? 'Time Spans - ' + item.title : 'Time Spans'
        })).add((0, _factory.make)('separator'));
        section.add((0, _factory.make)('cell').set_span(colspan).set_style('well').add(item.set_title('Original'))).add((0, _factory.make)('separator'));
        var _iteratorNormalCompletion = true;
        var _didIteratorError = false;
        var _iteratorError = undefined;

        try {
            for (var _iterator = spans[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
                var span = _step.value;

                var modified_query = new _query2.default(query.toJSON()).set_name(query.name + '/' + span.from + '/' + span.until).set_options((0, _util.extend)({}, query.options, {
                    from: span.from,
                    until: span.until
                }));
                var modified_item = (0, _factory.make)(item.toJSON()).set_item_id(undefined).set_query_override(modified_query).set_title(span.title);
                section.add((0, _factory.make)('cell').set_span(colspan).add(modified_item));
            }
        } catch (err) {
            _didIteratorError = true;
            _iteratorError = err;
        } finally {
            try {
                if (!_iteratorNormalCompletion && _iterator.return) {
                    _iterator.return();
                }
            } finally {
                if (_didIteratorError) {
                    throw _iteratorError;
                }
            }
        }

        return section;
    }
});


},{"../../util":88,"../data/query":38,"../items/factory":52,"./transform":84}],84:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.transforms = exports.TransformType = undefined;

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

exports.render_query = render_query;

var _util = require('../../util');

var _core = require('../../core');

var _manager = require('../../app/manager');

var _manager2 = _interopRequireDefault(_manager);

var _app = require('../../app/app');

var app = _interopRequireWildcard(_app);

var _factory = require('../items/factory');

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var TransformType = exports.TransformType = {
    DASHBOARD: 'dashboard',
    PRESENTATION: 'presentation'
};

var Transform = function () {
    function Transform(data) {
        _classCallCheck(this, Transform);

        if (data) {
            this.name = data.name;
            this.display_name = data.display_name;
            this.transform_type = data.transform_type;
            this._transform = data.transform;
            this.icon = data.icon;
        }
    }

    _createClass(Transform, [{
        key: 'action',
        value: function action() {
            var _this = this;

            return new _core.Action({
                name: this.name + '_action',
                display: this.display_name + '...',
                icon: this.icon || 'fa fa-eye',
                hide: app.Mode.TRANSFORM,
                handler: function handler(action, item) {
                    _manager2.default.apply_transform(_this, item);
                }
            });
        }
    }, {
        key: 'transform',
        value: function transform(item) {
            return this._transform ? this._transform(item) : item;
        }
    }, {
        key: 'toJSON',
        value: function toJSON() {
            return {
                name: this.name
            };
        }
    }]);

    return Transform;
}();

exports.default = Transform;
var transforms = exports.transforms = new _util.Registry({
    name: 'transforms',
    process: function process(input) {
        var transform = input instanceof Transform ? input : new Transform(input);
        var action_cat = transform.transform_type + '-transform-actions';
        _core.actions.register(action_cat, transform.action());
        return transform;
    }
});
function render_query(query) {
    var markdown = '\n#### Query: ' + query.name + '\n\n```\n' + query.targets[0] + '\n```\n';
    return (0, _factory.make)('markdown').set_text(markdown);
}


},{"../../app/app":1,"../../app/manager":16,"../../core":27,"../../util":88,"../items/factory":52}],85:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

var _util = require('../util');

var _model = require('./model');

var _model2 = _interopRequireDefault(_model);

var _dashboard = require('./dashboard');

var _dashboard2 = _interopRequireDefault(_dashboard);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var log = (0, _util.logger)('user');
var STORAGE_KEY = 'tessera.user';
/**
 * A very rudimentary user class. Since tessera doesn't have any
 * authentication yet, this basically represents the anonymous,
 * cookie-based session in the current browser. Eventually this will
 * represent a named user with real server-side persistence.
 */

var User = function (_Model) {
    _inherits(User, _Model);

    function User() {
        _classCallCheck(this, User);

        var _this = _possibleConstructorReturn(this, (User.__proto__ || Object.getPrototypeOf(User)).call(this));

        _this.favorites = new Map();
        var data = store.get(STORAGE_KEY);
        if (data && data.favorites) {
            data.favorites = data.favorites.map(function (pair) {
                var _pair = _slicedToArray(pair, 2),
                    key = _pair[0],
                    dashboard_data = _pair[1];

                return [key, new _dashboard2.default(dashboard_data)];
            });
            _this.favorites = new Map(data.favorites);
        }
        return _this;
    }

    _createClass(User, [{
        key: 'toJSON',
        value: function toJSON() {
            return (0, _util.extend)(_get(User.prototype.__proto__ || Object.getPrototypeOf(User.prototype), 'toJSON', this).call(this), {
                favorites: this.favorites
            });
        }
    }, {
        key: 'add_favorite',
        value: function add_favorite(d) {
            log.debug('add_favorite(' + d.href + ')');
            if (!this.favorites.has(d.href)) {
                // Make a copy of the dashboard without the definition, to
                // minimize the amount of data stored locally.
                var dash = new _dashboard2.default(d.toJSON()).set_definition(null);
                this.favorites.set(dash.href, dash);
                this.store();
            }
            return this;
        }
    }, {
        key: 'remove_favorite',
        value: function remove_favorite(d) {
            log.debug('remove_favorite(' + d.href + ')');
            if (this.favorites.has(d.href)) {
                this.favorites.delete(d.href);
                this.store();
            }
            return this.store();
        }
    }, {
        key: 'toggle_favorite',
        value: function toggle_favorite(d) {
            if (this.favorites.has(d.href)) {
                this.remove_favorite(d);
                return false;
            } else {
                this.add_favorite(d);
                return true;
            }
        }
    }, {
        key: 'list_favorites',
        value: function list_favorites() {
            return [].concat(_toConsumableArray(this.favorites.values()));
        }
    }, {
        key: 'store',
        value: function (_store) {
            function store() {
                return _store.apply(this, arguments);
            }

            store.toString = function () {
                return _store.toString();
            };

            return store;
        }(function () {
            store.set(STORAGE_KEY, this.toJSON());
            return this;
        })
    }]);

    return User;
}(_model2.default);



exports.default = User;

},{"../util":88,"./dashboard":37,"./model":75}],86:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _event = require('./event');

var _event2 = _interopRequireDefault(_event);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var EventSource = function () {
    function EventSource(data) {
        _classCallCheck(this, EventSource);
    }

    _createClass(EventSource, [{
        key: 'on',
        value: function on(event, handler) {
            _event2.default.on(this, event, handler);
        }
    }, {
        key: 'off',
        value: function off(event) {
            _event2.default.off(this, event);
        }
    }, {
        key: 'fire',
        value: function fire(event) {
            for (var _len = arguments.length, data = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
                data[_key - 1] = arguments[_key];
            }

            _event2.default.fire.apply(_event2.default, [this, event].concat(data));
            return this;
        }
    }]);

    return EventSource;
}();



exports.default = EventSource;

},{"./event":87}],87:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

exports.set_provider = set_provider;

var _log = require('./log');

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var log = (0, _log.logger)('events');
/**
 * A delegating event provider which just logs and forwards all calls
 * to another provider.
 */

var LoggingEventProvider = function () {
    function LoggingEventProvider(provider) {
        _classCallCheck(this, LoggingEventProvider);

        this.provider = provider;
    }

    _createClass(LoggingEventProvider, [{
        key: 'on',
        value: function on(target, event, handler) {
            log.debug('on(): ' + event);
            this.provider.on(target, event, handler);
        }
    }, {
        key: 'off',
        value: function off(target, event) {
            log.debug('off(): ' + event);
            this.provider.off(target, event);
        }
    }, {
        key: 'fire',
        value: function fire(target, event) {
            var _provider;

            log.debug('fire(): ' + event);

            for (var _len = arguments.length, data = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
                data[_key - 2] = arguments[_key];
            }

            (_provider = this.provider).fire.apply(_provider, [target, event].concat(data));
        }
    }]);

    return LoggingEventProvider;
}();
/**
 * Event provider that uses bean.js as the underlying event registry
 * and dispatcher.
 *
 * @see https://github.com/fat/bean
 */


var BeanEventProvider = function () {
    function BeanEventProvider() {
        _classCallCheck(this, BeanEventProvider);
    }

    _createClass(BeanEventProvider, [{
        key: 'on',
        value: function on(target, event, handler) {
            bean.on(target, event, handler);
        }
    }, {
        key: 'off',
        value: function off(target, event) {
            bean.off(target, event);
        }
    }, {
        key: 'fire',
        value: function fire(target, event) {
            var _bean;

            for (var _len2 = arguments.length, data = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
                data[_key2 - 2] = arguments[_key2];
            }

            (_bean = bean).fire.apply(_bean, [target, event].concat(data));
        }
    }]);

    return BeanEventProvider;
}();
/**
 * Global event provider instance.
 */


var provider;
function set_provider(value) {
    provider = new LoggingEventProvider(value);
    return provider;
}
set_provider(new BeanEventProvider());
exports.default = provider;


},{"./log":89}],88:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _util = require('./util');

Object.defineProperty(exports, 'json', {
  enumerable: true,
  get: function get() {
    return _util.json;
  }
});
Object.defineProperty(exports, 'extend', {
  enumerable: true,
  get: function get() {
    return _util.extend;
  }
});

var _log = require('./log');

Object.defineProperty(exports, 'logger', {
  enumerable: true,
  get: function get() {
    return _log.logger;
  }
});
Object.defineProperty(exports, 'LogLevel', {
  enumerable: true,
  get: function get() {
    return _log.Level;
  }
});
Object.defineProperty(exports, 'set_log_level', {
  enumerable: true,
  get: function get() {
    return _log.set_level;
  }
});

var _template = require('./template');

Object.defineProperty(exports, 'Template', {
  enumerable: true,
  get: function get() {
    return _template.Template;
  }
});
Object.defineProperty(exports, 'compile_template', {
  enumerable: true,
  get: function get() {
    return _template.compile_template;
  }
});
Object.defineProperty(exports, 'render_template', {
  enumerable: true,
  get: function get() {
    return _template.render_template;
  }
});

var _registry = require('./registry');

Object.defineProperty(exports, 'Registry', {
  enumerable: true,
  get: function get() {
    return _registry.Registry;
  }
});

var _event = require('./event');

Object.defineProperty(exports, 'events', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_event).default;
  }
});

var _eventSource = require('./event-source');

Object.defineProperty(exports, 'EventSource', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_eventSource).default;
  }
});

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

},{"./event":87,"./event-source":86,"./log":89,"./registry":90,"./template":91,"./util":92}],89:[function(require,module,exports){
"use strict";

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

exports.logger = logger;
exports.set_level = set_level;

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 * Provides a very simple implementation of the age-old log4j logging
 * pattern, supporting only output to `console` for now.
 */
var Level = exports.Level = undefined;
(function (Level) {
    Level[Level["OFF"] = 0] = "OFF";
    Level[Level["FATAL"] = 1] = "FATAL";
    Level[Level["ERROR"] = 2] = "ERROR";
    Level[Level["WARN"] = 3] = "WARN";
    Level[Level["INFO"] = 4] = "INFO";
    Level[Level["DEBUG"] = 5] = "DEBUG";
    Level[Level["TRACE"] = 6] = "TRACE";
})(Level || (exports.Level = Level = {}));
var default_name = 'root';
var default_time_format = 'YYYY-MM-DD hh:mm:ss A';
var default_level = Level.INFO;
var global_level = default_level;
function timestamp() {
    return moment().format(default_time_format);
}
/**
 * Loggers log logs.
 */

var Logger = exports.Logger = function () {
    function Logger(init) {
        _classCallCheck(this, Logger);

        this.level = global_level;
        if (typeof init === 'string') {
            this.name = init;
        } else {
            this.name = init.name || default_name;
            this.level = init.level || default_level;
        }
    }

    _createClass(Logger, [{
        key: "set_level",
        value: function set_level(level) {
            this.level = level;
            return this;
        }
    }, {
        key: "is_enabled",
        value: function is_enabled(level) {
            return level && level >= this.level;
        }
    }, {
        key: "format",
        value: function format(level, msg) {
            var ts = timestamp();
            var level_name = Level[level];
            return ts + " | " + level_name + " | " + this.name + " | " + msg;
        }
    }, {
        key: "log",
        value: function log(level, msg) {
            if (this.level >= level) {
                var statement = this.format(level, msg);
                if (level <= Level.WARN) {
                    console.error(statement);
                } else {
                    console.log(statement);
                }
            }
            return this;
        }
    }, {
        key: "fatal",
        value: function fatal(msg) {
            return this.log(Level.FATAL, msg);
        }
    }, {
        key: "error",
        value: function error(msg) {
            return this.log(Level.ERROR, msg);
        }
    }, {
        key: "warn",
        value: function warn(msg) {
            return this.log(Level.WARN, msg);
        }
    }, {
        key: "info",
        value: function info(msg) {
            return this.log(Level.INFO, msg);
        }
    }, {
        key: "debug",
        value: function debug(msg) {
            return this.log(Level.DEBUG, msg);
        }
    }, {
        key: "trace",
        value: function trace(msg) {
            return this.log(Level.TRACE, msg);
        }
    }]);

    return Logger;
}();
/**
 * Provide a typed map for caching loggers by name.
 */


var cache = new Map();
/**
 * Cached factory function for loggers, which avoids
 * instantiating duplicates with the same name.
 */
function logger(init) {
    var name = typeof init === 'string' ? init : init.name;
    if (!cache.has(name)) {
        cache.set(name, new Logger(init));
    }
    return cache.get(name);
}
/**
 * Set the default global level for new loggers, and change
 * the current logging level of all existing cached loggers.
 */
function set_level(level) {
    global_level = level;
    var _iteratorNormalCompletion = true;
    var _didIteratorError = false;
    var _iteratorError = undefined;

    try {
        for (var _iterator = cache.keys()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
            var key = _step.value;

            cache.get(key).level = level;
        }
    } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
    } finally {
        try {
            if (!_iteratorNormalCompletion && _iterator.return) {
                _iterator.return();
            }
        } finally {
            if (_didIteratorError) {
                throw _iteratorError;
            }
        }
    }
}


},{}],90:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.Registry = undefined;

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _log = require('./log');

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 * A registry of named objects which supports categorizing
 * those objects into one or more categories, listing them by
 * category, or looking up individual objects by category and
 * name.
 */
var Registry = exports.Registry = function () {
    function Registry(data) {
        _classCallCheck(this, Registry);

        this.name = data.name;
        this.process = data.process;
        this.ignore_categories = !!data.ignore_categories;
        this.data = {};
        this.log = (0, _log.logger)('registry.' + this.name);
    }

    _createClass(Registry, [{
        key: '_get_data',
        value: function _get_data(category) {
            if (!this.data[category]) {
                this.data[category] = {
                    list: [],
                    index: {}
                };
            }
            return this.data[category];
        }
    }, {
        key: 'register',
        value: function register(cat) {
            var dat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Registry.DEFAULT_CATEGORY;

            var data = void 0,
                category = void 0;
            if (arguments.length == 1) {
                data = cat;
                category = Registry.DEFAULT_CATEGORY;
            } else if (arguments.length == 2 && typeof cat === 'string') {
                category = cat;
                data = dat;
            }
            if (data instanceof Array) {
                var _iteratorNormalCompletion = true;
                var _didIteratorError = false;
                var _iteratorError = undefined;

                try {
                    for (var _iterator = data[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
                        var d = _step.value;

                        this.register(category, d);
                    }
                } catch (err) {
                    _didIteratorError = true;
                    _iteratorError = err;
                } finally {
                    try {
                        if (!_iteratorNormalCompletion && _iterator.return) {
                            _iterator.return();
                        }
                    } finally {
                        if (_didIteratorError) {
                            throw _iteratorError;
                        }
                    }
                }
            } else {
                if (this.ignore_categories) {
                    category = Registry.DEFAULT_CATEGORY;
                } else if (data.category && category == Registry.DEFAULT_CATEGORY) {
                    category = data.category;
                }
                var category_data = this._get_data(category);
                var thing = this.process ? this.process(data) : data;
                this.log.debug('Registering "' + category + '" / "' + thing.name + '"');
                if (!category_data.index[thing.name]) {
                    category_data.index[thing.name] = thing;
                }
                category_data.list.push(thing);
            }
            return this;
        }
        /**
         * Return a list of all values assigned to the named category. If no
         * category name is supplied, the values assigned to the default
         * category will be returned.
         */

    }, {
        key: 'list',
        value: function list() {
            var category = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Registry.DEFAULT_CATEGORY;

            return this.data[category] ? this.data[category].list : [];
        }
        /**
         * Retrieve a single value from a category by name. If only a name
         * is supplied, the default category will be used.
         */

    }, {
        key: 'get',
        value: function get(cat, nm) {
            var category = cat,
                name = nm;
            if (arguments.length == 1) {
                category = Registry.DEFAULT_CATEGORY;
                name = cat;
            }
            if (this.ignore_categories) {
                category = Registry.DEFAULT_CATEGORY;
            }
            return this.data[category] ? this.data[category].index[name] : null;
        }
        /**
         * Return a list of all registered categories.
         */

    }, {
        key: 'categories',
        value: function categories() {
            return Object.keys(this.data);
        }
    }]);

    return Registry;
}();
/** When no category is explicitly specified, this one will be used */


Registry.DEFAULT_CATEGORY = 'default';


},{"./log":89}],91:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.Template = undefined;

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

exports.compile_template = compile_template;
exports.render_template = render_template;

var _log = require('./log');

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var log = (0, _log.logger)('template');
function compile_template(tmpl) {
    if (typeof tmpl === 'string') {
        return Handlebars.compile(tmpl);
    } else {
        return tmpl;
    }
}
function _render_template(tmpl, context) {
    if (tmpl == null) {
        return '';
    }
    if (typeof tmpl === 'string') {
        if (tmpl.indexOf('{{') == -1) {
            return tmpl;
        } else {
            return Handlebars.compile(tmpl)(context);
        }
    } else {
        return tmpl(context);
    }
}
function render_template(tmpl, context) {
    try {
        return _render_template(tmpl, context);
    } catch (e) {
        log.error('render_template(): ' + e);
        if (typeof tmpl === 'string') {
            return tmpl;
        } else {
            return '';
        }
    }
}

var Template = exports.Template = function () {
    function Template(tmpl) {
        _classCallCheck(this, Template);

        this.tmpl = compile_template(tmpl);
    }

    _createClass(Template, [{
        key: 'render',
        value: function render(context) {
            return render_template(this.tmpl, context);
        }
    }]);

    return Template;
}();


},{"./log":89}],92:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.json = json;
function json(thing) {
    if (thing.toJSON && typeof thing.toJSON === 'function') {
        return thing.toJSON();
    } else {
        return thing;
    }
}
var extend = exports.extend = require('extend');


},{"extend":414}],93:[function(require,module,exports){
module.exports = require('./lib/axios');
},{"./lib/axios":95}],94:[function(require,module,exports){
(function (process){
'use strict';

var utils = require('./../utils');
var settle = require('./../core/settle');
var buildURL = require('./../helpers/buildURL');
var parseHeaders = require('./../helpers/parseHeaders');
var isURLSameOrigin = require('./../helpers/isURLSameOrigin');
var createError = require('../core/createError');
var btoa = (typeof window !== 'undefined' && window.btoa) || require('./../helpers/btoa');

module.exports = function xhrAdapter(config) {
  return new Promise(function dispatchXhrRequest(resolve, reject) {
    var requestData = config.data;
    var requestHeaders = config.headers;

    if (utils.isFormData(requestData)) {
      delete requestHeaders['Content-Type']; // Let the browser set it
    }

    var request = new XMLHttpRequest();
    var loadEvent = 'onreadystatechange';
    var xDomain = false;

    // For IE 8/9 CORS support
    // Only supports POST and GET calls and doesn't returns the response headers.
    // DON'T do this for testing b/c XMLHttpRequest is mocked, not XDomainRequest.
    if (process.env.NODE_ENV !== 'test' &&
        typeof window !== 'undefined' &&
        window.XDomainRequest && !('withCredentials' in request) &&
        !isURLSameOrigin(config.url)) {
      request = new window.XDomainRequest();
      loadEvent = 'onload';
      xDomain = true;
      request.onprogress = function handleProgress() {};
      request.ontimeout = function handleTimeout() {};
    }

    // HTTP basic authentication
    if (config.auth) {
      var username = config.auth.username || '';
      var password = config.auth.password || '';
      requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
    }

    request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);

    // Set the request timeout in MS
    request.timeout = config.timeout;

    // Listen for ready state
    request[loadEvent] = function handleLoad() {
      if (!request || (request.readyState !== 4 && !xDomain)) {
        return;
      }

      // The request errored out and we didn't get a response, this will be
      // handled by onerror instead
      // With one exception: request that using file: protocol, most browsers
      // will return status as 0 even though it's a successful request
      if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
        return;
      }

      // Prepare the response
      var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
      var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
      var response = {
        data: responseData,
        // IE sends 1223 instead of 204 (https://github.com/mzabriskie/axios/issues/201)
        status: request.status === 1223 ? 204 : request.status,
        statusText: request.status === 1223 ? 'No Content' : request.statusText,
        headers: responseHeaders,
        config: config,
        request: request
      };

      settle(resolve, reject, response);

      // Clean up request
      request = null;
    };

    // Handle low level network errors
    request.onerror = function handleError() {
      // Real errors are hidden from us by the browser
      // onerror should only fire if it's a network error
      reject(createError('Network Error', config));

      // Clean up request
      request = null;
    };

    // Handle timeout
    request.ontimeout = function handleTimeout() {
      reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED'));

      // Clean up request
      request = null;
    };

    // Add xsrf header
    // This is only done if running in a standard browser environment.
    // Specifically not if we're in a web worker, or react-native.
    if (utils.isStandardBrowserEnv()) {
      var cookies = require('./../helpers/cookies');

      // Add xsrf header
      var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ?
          cookies.read(config.xsrfCookieName) :
          undefined;

      if (xsrfValue) {
        requestHeaders[config.xsrfHeaderName] = xsrfValue;
      }
    }

    // Add headers to the request
    if ('setRequestHeader' in request) {
      utils.forEach(requestHeaders, function setRequestHeader(val, key) {
        if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
          // Remove Content-Type if data is undefined
          delete requestHeaders[key];
        } else {
          // Otherwise add header to the request
          request.setRequestHeader(key, val);
        }
      });
    }

    // Add withCredentials to request if needed
    if (config.withCredentials) {
      request.withCredentials = true;
    }

    // Add responseType to request if needed
    if (config.responseType) {
      try {
        request.responseType = config.responseType;
      } catch (e) {
        if (request.responseType !== 'json') {
          throw e;
        }
      }
    }

    // Handle progress if needed
    if (typeof config.onDownloadProgress === 'function') {
      request.addEventListener('progress', config.onDownloadProgress);
    }

    // Not all browsers support upload events
    if (typeof config.onUploadProgress === 'function' && request.upload) {
      request.upload.addEventListener('progress', config.onUploadProgress);
    }

    if (config.cancelToken) {
      // Handle cancellation
      config.cancelToken.promise.then(function onCanceled(cancel) {
        if (!request) {
          return;
        }

        request.abort();
        reject(cancel);
        // Clean up request
        request = null;
      });
    }

    if (requestData === undefined) {
      requestData = null;
    }

    // Send the request
    request.send(requestData);
  });
};

}).call(this,require('_process'))
},{"../core/createError":101,"./../core/settle":104,"./../helpers/btoa":108,"./../helpers/buildURL":109,"./../helpers/cookies":111,"./../helpers/isURLSameOrigin":113,"./../helpers/parseHeaders":115,"./../utils":117,"_process":416}],95:[function(require,module,exports){
'use strict';

var utils = require('./utils');
var bind = require('./helpers/bind');
var Axios = require('./core/Axios');

/**
 * Create an instance of Axios
 *
 * @param {Object} defaultConfig The default config for the instance
 * @return {Axios} A new instance of Axios
 */
function createInstance(defaultConfig) {
  var context = new Axios(defaultConfig);
  var instance = bind(Axios.prototype.request, context);

  // Copy axios.prototype to instance
  utils.extend(instance, Axios.prototype, context);

  // Copy context to instance
  utils.extend(instance, context);

  return instance;
}

// Create the default instance to be exported
var axios = createInstance();

// Expose Axios class to allow class inheritance
axios.Axios = Axios;

// Factory for creating new instances
axios.create = function create(defaultConfig) {
  return createInstance(defaultConfig);
};

// Expose Cancel & CancelToken
axios.Cancel = require('./cancel/Cancel');
axios.CancelToken = require('./cancel/CancelToken');
axios.isCancel = require('./cancel/isCancel');

// Expose all/spread
axios.all = function all(promises) {
  return Promise.all(promises);
};
axios.spread = require('./helpers/spread');

module.exports = axios;

// Allow use of default import syntax in TypeScript
module.exports.default = axios;

},{"./cancel/Cancel":96,"./cancel/CancelToken":97,"./cancel/isCancel":98,"./core/Axios":99,"./helpers/bind":107,"./helpers/spread":116,"./utils":117}],96:[function(require,module,exports){
'use strict';

/**
 * A `Cancel` is an object that is thrown when an operation is canceled.
 *
 * @class
 * @param {string=} message The message.
 */
function Cancel(message) {
  this.message = message;
}

Cancel.prototype.toString = function toString() {
  return 'Cancel' + (this.message ? ': ' + this.message : '');
};

Cancel.prototype.__CANCEL__ = true;

module.exports = Cancel;

},{}],97:[function(require,module,exports){
'use strict';

var Cancel = require('./Cancel');

/**
 * A `CancelToken` is an object that can be used to request cancellation of an operation.
 *
 * @class
 * @param {Function} executor The executor function.
 */
function CancelToken(executor) {
  if (typeof executor !== 'function') {
    throw new TypeError('executor must be a function.');
  }

  var resolvePromise;
  this.promise = new Promise(function promiseExecutor(resolve) {
    resolvePromise = resolve;
  });

  var token = this;
  executor(function cancel(message) {
    if (token.reason) {
      // Cancellation has already been requested
      return;
    }

    token.reason = new Cancel(message);
    resolvePromise(token.reason);
  });
}

/**
 * Throws a `Cancel` if cancellation has been requested.
 */
CancelToken.prototype.throwIfRequested = function throwIfRequested() {
  if (this.reason) {
    throw this.reason;
  }
};

/**
 * Returns an object that contains a new `CancelToken` and a function that, when called,
 * cancels the `CancelToken`.
 */
CancelToken.source = function source() {
  var cancel;
  var token = new CancelToken(function executor(c) {
    cancel = c;
  });
  return {
    token: token,
    cancel: cancel
  };
};

module.exports = CancelToken;

},{"./Cancel":96}],98:[function(require,module,exports){
'use strict';

module.exports = function isCancel(value) {
  return !!(value && value.__CANCEL__);
};

},{}],99:[function(require,module,exports){
'use strict';

var defaults = require('./../defaults');
var utils = require('./../utils');
var InterceptorManager = require('./InterceptorManager');
var dispatchRequest = require('./dispatchRequest');
var isAbsoluteURL = require('./../helpers/isAbsoluteURL');
var combineURLs = require('./../helpers/combineURLs');

/**
 * Create a new instance of Axios
 *
 * @param {Object} defaultConfig The default config for the instance
 */
function Axios(defaultConfig) {
  this.defaults = utils.merge(defaults, defaultConfig);
  this.interceptors = {
    request: new InterceptorManager(),
    response: new InterceptorManager()
  };
}

/**
 * Dispatch a request
 *
 * @param {Object} config The config specific for this request (merged with this.defaults)
 */
Axios.prototype.request = function request(config) {
  /*eslint no-param-reassign:0*/
  // Allow for axios('example/url'[, config]) a la fetch API
  if (typeof config === 'string') {
    config = utils.merge({
      url: arguments[0]
    }, arguments[1]);
  }

  config = utils.merge(defaults, this.defaults, { method: 'get' }, config);

  // Support baseURL config
  if (config.baseURL && !isAbsoluteURL(config.url)) {
    config.url = combineURLs(config.baseURL, config.url);
  }

  // Hook up interceptors middleware
  var chain = [dispatchRequest, undefined];
  var promise = Promise.resolve(config);

  this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
    chain.unshift(interceptor.fulfilled, interceptor.rejected);
  });

  this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
    chain.push(interceptor.fulfilled, interceptor.rejected);
  });

  while (chain.length) {
    promise = promise.then(chain.shift(), chain.shift());
  }

  return promise;
};

// Provide aliases for supported request methods
utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
  /*eslint func-names:0*/
  Axios.prototype[method] = function(url, config) {
    return this.request(utils.merge(config || {}, {
      method: method,
      url: url
    }));
  };
});

utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  /*eslint func-names:0*/
  Axios.prototype[method] = function(url, data, config) {
    return this.request(utils.merge(config || {}, {
      method: method,
      url: url,
      data: data
    }));
  };
});

module.exports = Axios;

},{"./../defaults":106,"./../helpers/combineURLs":110,"./../helpers/isAbsoluteURL":112,"./../utils":117,"./InterceptorManager":100,"./dispatchRequest":102}],100:[function(require,module,exports){
'use strict';

var utils = require('./../utils');

function InterceptorManager() {
  this.handlers = [];
}

/**
 * Add a new interceptor to the stack
 *
 * @param {Function} fulfilled The function to handle `then` for a `Promise`
 * @param {Function} rejected The function to handle `reject` for a `Promise`
 *
 * @return {Number} An ID used to remove interceptor later
 */
InterceptorManager.prototype.use = function use(fulfilled, rejected) {
  this.handlers.push({
    fulfilled: fulfilled,
    rejected: rejected
  });
  return this.handlers.length - 1;
};

/**
 * Remove an interceptor from the stack
 *
 * @param {Number} id The ID that was returned by `use`
 */
InterceptorManager.prototype.eject = function eject(id) {
  if (this.handlers[id]) {
    this.handlers[id] = null;
  }
};

/**
 * Iterate over all the registered interceptors
 *
 * This method is particularly useful for skipping over any
 * interceptors that may have become `null` calling `eject`.
 *
 * @param {Function} fn The function to call for each interceptor
 */
InterceptorManager.prototype.forEach = function forEach(fn) {
  utils.forEach(this.handlers, function forEachHandler(h) {
    if (h !== null) {
      fn(h);
    }
  });
};

module.exports = InterceptorManager;

},{"./../utils":117}],101:[function(require,module,exports){
'use strict';

var enhanceError = require('./enhanceError');

/**
 * Create an Error with the specified message, config, error code, and response.
 *
 * @param {string} message The error message.
 * @param {Object} config The config.
 * @param {string} [code] The error code (for example, 'ECONNABORTED').
 @ @param {Object} [response] The response.
 * @returns {Error} The created error.
 */
module.exports = function createError(message, config, code, response) {
  var error = new Error(message);
  return enhanceError(error, config, code, response);
};

},{"./enhanceError":103}],102:[function(require,module,exports){
'use strict';

var utils = require('./../utils');
var transformData = require('./transformData');
var isCancel = require('../cancel/isCancel');
var defaults = require('../defaults');

/**
 * Throws a `Cancel` if cancellation has been requested.
 */
function throwIfCancellationRequested(config) {
  if (config.cancelToken) {
    config.cancelToken.throwIfRequested();
  }
}

/**
 * Dispatch a request to the server using the configured adapter.
 *
 * @param {object} config The config that is to be used for the request
 * @returns {Promise} The Promise to be fulfilled
 */
module.exports = function dispatchRequest(config) {
  throwIfCancellationRequested(config);

  // Ensure headers exist
  config.headers = config.headers || {};

  // Transform request data
  config.data = transformData(
    config.data,
    config.headers,
    config.transformRequest
  );

  // Flatten headers
  config.headers = utils.merge(
    config.headers.common || {},
    config.headers[config.method] || {},
    config.headers || {}
  );

  utils.forEach(
    ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
    function cleanHeaderConfig(method) {
      delete config.headers[method];
    }
  );

  var adapter = config.adapter || defaults.adapter;

  return adapter(config).then(function onAdapterResolution(response) {
    throwIfCancellationRequested(config);

    // Transform response data
    response.data = transformData(
      response.data,
      response.headers,
      config.transformResponse
    );

    return response;
  }, function onAdapterRejection(reason) {
    if (!isCancel(reason)) {
      throwIfCancellationRequested(config);

      // Transform response data
      if (reason && reason.response) {
        reason.response.data = transformData(
          reason.response.data,
          reason.response.headers,
          config.transformResponse
        );
      }
    }

    return Promise.reject(reason);
  });
};

},{"../cancel/isCancel":98,"../defaults":106,"./../utils":117,"./transformData":105}],103:[function(require,module,exports){
'use strict';

/**
 * Update an Error with the specified config, error code, and response.
 *
 * @param {Error} error The error to update.
 * @param {Object} config The config.
 * @param {string} [code] The error code (for example, 'ECONNABORTED').
 @ @param {Object} [response] The response.
 * @returns {Error} The error.
 */
module.exports = function enhanceError(error, config, code, response) {
  error.config = config;
  if (code) {
    error.code = code;
  }
  error.response = response;
  return error;
};

},{}],104:[function(require,module,exports){
'use strict';

var createError = require('./createError');

/**
 * Resolve or reject a Promise based on response status.
 *
 * @param {Function} resolve A function that resolves the promise.
 * @param {Function} reject A function that rejects the promise.
 * @param {object} response The response.
 */
module.exports = function settle(resolve, reject, response) {
  var validateStatus = response.config.validateStatus;
  // Note: status is not exposed by XDomainRequest
  if (!response.status || !validateStatus || validateStatus(response.status)) {
    resolve(response);
  } else {
    reject(createError(
      'Request failed with status code ' + response.status,
      response.config,
      null,
      response
    ));
  }
};

},{"./createError":101}],105:[function(require,module,exports){
'use strict';

var utils = require('./../utils');

/**
 * Transform the data for a request or a response
 *
 * @param {Object|String} data The data to be transformed
 * @param {Array} headers The headers for the request or response
 * @param {Array|Function} fns A single function or Array of functions
 * @returns {*} The resulting transformed data
 */
module.exports = function transformData(data, headers, fns) {
  /*eslint no-param-reassign:0*/
  utils.forEach(fns, function transform(fn) {
    data = fn(data, headers);
  });

  return data;
};

},{"./../utils":117}],106:[function(require,module,exports){
(function (process){
'use strict';

var utils = require('./utils');
var normalizeHeaderName = require('./helpers/normalizeHeaderName');

var PROTECTION_PREFIX = /^\)\]\}',?\n/;
var DEFAULT_CONTENT_TYPE = {
  'Content-Type': 'application/x-www-form-urlencoded'
};

function setContentTypeIfUnset(headers, value) {
  if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
    headers['Content-Type'] = value;
  }
}

function getDefaultAdapter() {
  var adapter;
  if (typeof XMLHttpRequest !== 'undefined') {
    // For browsers use XHR adapter
    adapter = require('./adapters/xhr');
  } else if (typeof process !== 'undefined') {
    // For node use HTTP adapter
    adapter = require('./adapters/http');
  }
  return adapter;
}

module.exports = {
  adapter: getDefaultAdapter(),

  transformRequest: [function transformRequest(data, headers) {
    normalizeHeaderName(headers, 'Content-Type');
    if (utils.isFormData(data) ||
      utils.isArrayBuffer(data) ||
      utils.isStream(data) ||
      utils.isFile(data) ||
      utils.isBlob(data)
    ) {
      return data;
    }
    if (utils.isArrayBufferView(data)) {
      return data.buffer;
    }
    if (utils.isURLSearchParams(data)) {
      setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
      return data.toString();
    }
    if (utils.isObject(data)) {
      setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
      return JSON.stringify(data);
    }
    return data;
  }],

  transformResponse: [function transformResponse(data) {
    /*eslint no-param-reassign:0*/
    if (typeof data === 'string') {
      data = data.replace(PROTECTION_PREFIX, '');
      try {
        data = JSON.parse(data);
      } catch (e) { /* Ignore */ }
    }
    return data;
  }],

  headers: {
    common: {
      'Accept': 'application/json, text/plain, */*'
    },
    patch: utils.merge(DEFAULT_CONTENT_TYPE),
    post: utils.merge(DEFAULT_CONTENT_TYPE),
    put: utils.merge(DEFAULT_CONTENT_TYPE)
  },

  timeout: 0,

  xsrfCookieName: 'XSRF-TOKEN',
  xsrfHeaderName: 'X-XSRF-TOKEN',

  maxContentLength: -1,

  validateStatus: function validateStatus(status) {
    return status >= 200 && status < 300;
  }
};

}).call(this,require('_process'))
},{"./adapters/http":94,"./adapters/xhr":94,"./helpers/normalizeHeaderName":114,"./utils":117,"_process":416}],107:[function(require,module,exports){
'use strict';

module.exports = function bind(fn, thisArg) {
  return function wrap() {
    var args = new Array(arguments.length);
    for (var i = 0; i < args.length; i++) {
      args[i] = arguments[i];
    }
    return fn.apply(thisArg, args);
  };
};

},{}],108:[function(require,module,exports){
'use strict';

// btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js

var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';

function E() {
  this.message = 'String contains an invalid character';
}
E.prototype = new Error;
E.prototype.code = 5;
E.prototype.name = 'InvalidCharacterError';

function btoa(input) {
  var str = String(input);
  var output = '';
  for (
    // initialize result and counter
    var block, charCode, idx = 0, map = chars;
    // if the next str index does not exist:
    //   change the mapping table to "="
    //   check if d has no fractional digits
    str.charAt(idx | 0) || (map = '=', idx % 1);
    // "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8
    output += map.charAt(63 & block >> 8 - idx % 1 * 8)
  ) {
    charCode = str.charCodeAt(idx += 3 / 4);
    if (charCode > 0xFF) {
      throw new E();
    }
    block = block << 8 | charCode;
  }
  return output;
}

module.exports = btoa;

},{}],109:[function(require,module,exports){
'use strict';

var utils = require('./../utils');

function encode(val) {
  return encodeURIComponent(val).
    replace(/%40/gi, '@').
    replace(/%3A/gi, ':').
    replace(/%24/g, '$').
    replace(/%2C/gi, ',').
    replace(/%20/g, '+').
    replace(/%5B/gi, '[').
    replace(/%5D/gi, ']');
}

/**
 * Build a URL by appending params to the end
 *
 * @param {string} url The base of the url (e.g., http://www.google.com)
 * @param {object} [params] The params to be appended
 * @returns {string} The formatted url
 */
module.exports = function buildURL(url, params, paramsSerializer) {
  /*eslint no-param-reassign:0*/
  if (!params) {
    return url;
  }

  var serializedParams;
  if (paramsSerializer) {
    serializedParams = paramsSerializer(params);
  } else if (utils.isURLSearchParams(params)) {
    serializedParams = params.toString();
  } else {
    var parts = [];

    utils.forEach(params, function serialize(val, key) {
      if (val === null || typeof val === 'undefined') {
        return;
      }

      if (utils.isArray(val)) {
        key = key + '[]';
      }

      if (!utils.isArray(val)) {
        val = [val];
      }

      utils.forEach(val, function parseValue(v) {
        if (utils.isDate(v)) {
          v = v.toISOString();
        } else if (utils.isObject(v)) {
          v = JSON.stringify(v);
        }
        parts.push(encode(key) + '=' + encode(v));
      });
    });

    serializedParams = parts.join('&');
  }

  if (serializedParams) {
    url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  }

  return url;
};

},{"./../utils":117}],110:[function(require,module,exports){
'use strict';

/**
 * Creates a new URL by combining the specified URLs
 *
 * @param {string} baseURL The base URL
 * @param {string} relativeURL The relative URL
 * @returns {string} The combined URL
 */
module.exports = function combineURLs(baseURL, relativeURL) {
  return baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '');
};

},{}],111:[function(require,module,exports){
'use strict';

var utils = require('./../utils');

module.exports = (
  utils.isStandardBrowserEnv() ?

  // Standard browser envs support document.cookie
  (function standardBrowserEnv() {
    return {
      write: function write(name, value, expires, path, domain, secure) {
        var cookie = [];
        cookie.push(name + '=' + encodeURIComponent(value));

        if (utils.isNumber(expires)) {
          cookie.push('expires=' + new Date(expires).toGMTString());
        }

        if (utils.isString(path)) {
          cookie.push('path=' + path);
        }

        if (utils.isString(domain)) {
          cookie.push('domain=' + domain);
        }

        if (secure === true) {
          cookie.push('secure');
        }

        document.cookie = cookie.join('; ');
      },

      read: function read(name) {
        var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
        return (match ? decodeURIComponent(match[3]) : null);
      },

      remove: function remove(name) {
        this.write(name, '', Date.now() - 86400000);
      }
    };
  })() :

  // Non standard browser env (web workers, react-native) lack needed support.
  (function nonStandardBrowserEnv() {
    return {
      write: function write() {},
      read: function read() { return null; },
      remove: function remove() {}
    };
  })()
);

},{"./../utils":117}],112:[function(require,module,exports){
'use strict';

/**
 * Determines whether the specified URL is absolute
 *
 * @param {string} url The URL to test
 * @returns {boolean} True if the specified URL is absolute, otherwise false
 */
module.exports = function isAbsoluteURL(url) {
  // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  // by any combination of letters, digits, plus, period, or hyphen.
  return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
};

},{}],113:[function(require,module,exports){
'use strict';

var utils = require('./../utils');

module.exports = (
  utils.isStandardBrowserEnv() ?

  // Standard browser envs have full support of the APIs needed to test
  // whether the request URL is of the same origin as current location.
  (function standardBrowserEnv() {
    var msie = /(msie|trident)/i.test(navigator.userAgent);
    var urlParsingNode = document.createElement('a');
    var originURL;

    /**
    * Parse a URL to discover it's components
    *
    * @param {String} url The URL to be parsed
    * @returns {Object}
    */
    function resolveURL(url) {
      var href = url;

      if (msie) {
        // IE needs attribute set twice to normalize properties
        urlParsingNode.setAttribute('href', href);
        href = urlParsingNode.href;
      }

      urlParsingNode.setAttribute('href', href);

      // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
      return {
        href: urlParsingNode.href,
        protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
        host: urlParsingNode.host,
        search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
        hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
        hostname: urlParsingNode.hostname,
        port: urlParsingNode.port,
        pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
                  urlParsingNode.pathname :
                  '/' + urlParsingNode.pathname
      };
    }

    originURL = resolveURL(window.location.href);

    /**
    * Determine if a URL shares the same origin as the current location
    *
    * @param {String} requestURL The URL to test
    * @returns {boolean} True if URL shares the same origin, otherwise false
    */
    return function isURLSameOrigin(requestURL) {
      var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
      return (parsed.protocol === originURL.protocol &&
            parsed.host === originURL.host);
    };
  })() :

  // Non standard browser envs (web workers, react-native) lack needed support.
  (function nonStandardBrowserEnv() {
    return function isURLSameOrigin() {
      return true;
    };
  })()
);

},{"./../utils":117}],114:[function(require,module,exports){
'use strict';

var utils = require('../utils');

module.exports = function normalizeHeaderName(headers, normalizedName) {
  utils.forEach(headers, function processHeader(value, name) {
    if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
      headers[normalizedName] = value;
      delete headers[name];
    }
  });
};

},{"../utils":117}],115:[function(require,module,exports){
'use strict';

var utils = require('./../utils');

/**
 * Parse headers into an object
 *
 * ```
 * Date: Wed, 27 Aug 2014 08:58:49 GMT
 * Content-Type: application/json
 * Connection: keep-alive
 * Transfer-Encoding: chunked
 * ```
 *
 * @param {String} headers Headers needing to be parsed
 * @returns {Object} Headers parsed into an object
 */
module.exports = function parseHeaders(headers) {
  var parsed = {};
  var key;
  var val;
  var i;

  if (!headers) { return parsed; }

  utils.forEach(headers.split('\n'), function parser(line) {
    i = line.indexOf(':');
    key = utils.trim(line.substr(0, i)).toLowerCase();
    val = utils.trim(line.substr(i + 1));

    if (key) {
      parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
    }
  });

  return parsed;
};

},{"./../utils":117}],116:[function(require,module,exports){
'use strict';

/**
 * Syntactic sugar for invoking a function and expanding an array for arguments.
 *
 * Common use case would be to use `Function.prototype.apply`.
 *
 *  ```js
 *  function f(x, y, z) {}
 *  var args = [1, 2, 3];
 *  f.apply(null, args);
 *  ```
 *
 * With `spread` this example can be re-written.
 *
 *  ```js
 *  spread(function(x, y, z) {})([1, 2, 3]);
 *  ```
 *
 * @param {Function} callback
 * @returns {Function}
 */
module.exports = function spread(callback) {
  return function wrap(arr) {
    return callback.apply(null, arr);
  };
};

},{}],117:[function(require,module,exports){
'use strict';

var bind = require('./helpers/bind');

/*global toString:true*/

// utils is a library of generic helper functions non-specific to axios

var toString = Object.prototype.toString;

/**
 * Determine if a value is an Array
 *
 * @param {Object} val The value to test
 * @returns {boolean} True if value is an Array, otherwise false
 */
function isArray(val) {
  return toString.call(val) === '[object Array]';
}

/**
 * Determine if a value is an ArrayBuffer
 *
 * @param {Object} val The value to test
 * @returns {boolean} True if value is an ArrayBuffer, otherwise false
 */
function isArrayBuffer(val) {
  return toString.call(val) === '[object ArrayBuffer]';
}

/**
 * Determine if a value is a FormData
 *
 * @param {Object} val The value to test
 * @returns {boolean} True if value is an FormData, otherwise false
 */
function isFormData(val) {
  return (typeof FormData !== 'undefined') && (val instanceof FormData);
}

/**
 * Determine if a value is a view on an ArrayBuffer
 *
 * @param {Object} val The value to test
 * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
 */
function isArrayBufferView(val) {
  var result;
  if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
    result = ArrayBuffer.isView(val);
  } else {
    result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
  }
  return result;
}

/**
 * Determine if a value is a String
 *
 * @param {Object} val The value to test
 * @returns {boolean} True if value is a String, otherwise false
 */
function isString(val) {
  return typeof val === 'string';
}

/**
 * Determine if a value is a Number
 *
 * @param {Object} val The value to test
 * @returns {boolean} True if value is a Number, otherwise false
 */
function isNumber(val) {
  return typeof val === 'number';
}

/**
 * Determine if a value is undefined
 *
 * @param {Object} val The value to test
 * @returns {boolean} True if the value is undefined, otherwise false
 */
function isUndefined(val) {
  return typeof val === 'undefined';
}

/**
 * Determine if a value is an Object
 *
 * @param {Object} val The value to test
 * @returns {boolean} True if value is an Object, otherwise false
 */
function isObject(val) {
  return val !== null && typeof val === 'object';
}

/**
 * Determine if a value is a Date
 *
 * @param {Object} val The value to test
 * @returns {boolean} True if value is a Date, otherwise false
 */
function isDate(val) {
  return toString.call(val) === '[object Date]';
}

/**
 * Determine if a value is a File
 *
 * @param {Object} val The value to test
 * @returns {boolean} True if value is a File, otherwise false
 */
function isFile(val) {
  return toString.call(val) === '[object File]';
}

/**
 * Determine if a value is a Blob
 *
 * @param {Object} val The value to test
 * @returns {boolean} True if value is a Blob, otherwise false
 */
function isBlob(val) {
  return toString.call(val) === '[object Blob]';
}

/**
 * Determine if a value is a Function
 *
 * @param {Object} val The value to test
 * @returns {boolean} True if value is a Function, otherwise false
 */
function isFunction(val) {
  return toString.call(val) === '[object Function]';
}

/**
 * Determine if a value is a Stream
 *
 * @param {Object} val The value to test
 * @returns {boolean} True if value is a Stream, otherwise false
 */
function isStream(val) {
  return isObject(val) && isFunction(val.pipe);
}

/**
 * Determine if a value is a URLSearchParams object
 *
 * @param {Object} val The value to test
 * @returns {boolean} True if value is a URLSearchParams object, otherwise false
 */
function isURLSearchParams(val) {
  return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
}

/**
 * Trim excess whitespace off the beginning and end of a string
 *
 * @param {String} str The String to trim
 * @returns {String} The String freed of excess whitespace
 */
function trim(str) {
  return str.replace(/^\s*/, '').replace(/\s*$/, '');
}

/**
 * Determine if we're running in a standard browser environment
 *
 * This allows axios to run in a web worker, and react-native.
 * Both environments support XMLHttpRequest, but not fully standard globals.
 *
 * web workers:
 *  typeof window -> undefined
 *  typeof document -> undefined
 *
 * react-native:
 *  typeof document.createElement -> undefined
 */
function isStandardBrowserEnv() {
  return (
    typeof window !== 'undefined' &&
    typeof document !== 'undefined' &&
    typeof document.createElement === 'function'
  );
}

/**
 * Iterate over an Array or an Object invoking a function for each item.
 *
 * If `obj` is an Array callback will be called passing
 * the value, index, and complete array for each item.
 *
 * If 'obj' is an Object callback will be called passing
 * the value, key, and complete object for each property.
 *
 * @param {Object|Array} obj The object to iterate
 * @param {Function} fn The callback to invoke for each item
 */
function forEach(obj, fn) {
  // Don't bother if no value provided
  if (obj === null || typeof obj === 'undefined') {
    return;
  }

  // Force an array if not already something iterable
  if (typeof obj !== 'object' && !isArray(obj)) {
    /*eslint no-param-reassign:0*/
    obj = [obj];
  }

  if (isArray(obj)) {
    // Iterate over array values
    for (var i = 0, l = obj.length; i < l; i++) {
      fn.call(null, obj[i], i, obj);
    }
  } else {
    // Iterate over object keys
    for (var key in obj) {
      if (Object.prototype.hasOwnProperty.call(obj, key)) {
        fn.call(null, obj[key], key, obj);
      }
    }
  }
}

/**
 * Accepts varargs expecting each argument to be an object, then
 * immutably merges the properties of each object and returns result.
 *
 * When multiple objects contain the same key the later object in
 * the arguments list will take precedence.
 *
 * Example:
 *
 * ```js
 * var result = merge({foo: 123}, {foo: 456});
 * console.log(result.foo); // outputs 456
 * ```
 *
 * @param {Object} obj1 Object to merge
 * @returns {Object} Result of all merge properties
 */
function merge(/* obj1, obj2, obj3, ... */) {
  var result = {};
  function assignValue(val, key) {
    if (typeof result[key] === 'object' && typeof val === 'object') {
      result[key] = merge(result[key], val);
    } else {
      result[key] = val;
    }
  }

  for (var i = 0, l = arguments.length; i < l; i++) {
    forEach(arguments[i], assignValue);
  }
  return result;
}

/**
 * Extends object a by mutably adding to it the properties of object b.
 *
 * @param {Object} a The object to be extended
 * @param {Object} b The object to copy properties from
 * @param {Object} thisArg The object to bind function to
 * @return {Object} The resulting value of object a
 */
function extend(a, b, thisArg) {
  forEach(b, function assignValue(val, key) {
    if (thisArg && typeof val === 'function') {
      a[key] = bind(val, thisArg);
    } else {
      a[key] = val;
    }
  });
  return a;
}

module.exports = {
  isArray: isArray,
  isArrayBuffer: isArrayBuffer,
  isFormData: isFormData,
  isArrayBufferView: isArrayBufferView,
  isString: isString,
  isNumber: isNumber,
  isObject: isObject,
  isUndefined: isUndefined,
  isDate: isDate,
  isFile: isFile,
  isBlob: isBlob,
  isFunction: isFunction,
  isStream: isStream,
  isURLSearchParams: isURLSearchParams,
  isStandardBrowserEnv: isStandardBrowserEnv,
  forEach: forEach,
  merge: merge,
  extend: extend,
  trim: trim
};

},{"./helpers/bind":107}],118:[function(require,module,exports){
(function (global){
"use strict";

require("core-js/shim");

require("regenerator-runtime/runtime");

require("core-js/fn/regexp/escape");

if (global._babelPolyfill) {
  throw new Error("only one instance of babel-polyfill is allowed");
}
global._babelPolyfill = true;

var DEFINE_PROPERTY = "defineProperty";
function define(O, key, value) {
  O[key] || Object[DEFINE_PROPERTY](O, key, {
    writable: true,
    configurable: true,
    value: value
  });
}

define(String.prototype, "padLeft", "".padStart);
define(String.prototype, "padRight", "".padEnd);

"pop,reverse,shift,keys,values,entries,indexOf,every,some,forEach,map,filter,find,findIndex,includes,join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill".split(",").forEach(function (key) {
  [][key] && define(Array, key, Function.call.bind([][key]));
});
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"core-js/fn/regexp/escape":120,"core-js/shim":413,"regenerator-runtime/runtime":119}],119:[function(require,module,exports){
(function (process,global){
/**
 * Copyright (c) 2014, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * https://raw.github.com/facebook/regenerator/master/LICENSE file. An
 * additional grant of patent rights can be found in the PATENTS file in
 * the same directory.
 */

!(function(global) {
  "use strict";

  var hasOwn = Object.prototype.hasOwnProperty;
  var undefined; // More compressible than void 0.
  var $Symbol = typeof Symbol === "function" ? Symbol : {};
  var iteratorSymbol = $Symbol.iterator || "@@iterator";
  var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";

  var inModule = typeof module === "object";
  var runtime = global.regeneratorRuntime;
  if (runtime) {
    if (inModule) {
      // If regeneratorRuntime is defined globally and we're in a module,
      // make the exports object identical to regeneratorRuntime.
      module.exports = runtime;
    }
    // Don't bother evaluating the rest of this file if the runtime was
    // already defined globally.
    return;
  }

  // Define the runtime globally (as expected by generated code) as either
  // module.exports (if we're in a module) or a new, empty object.
  runtime = global.regeneratorRuntime = inModule ? module.exports : {};

  function wrap(innerFn, outerFn, self, tryLocsList) {
    // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
    var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
    var generator = Object.create(protoGenerator.prototype);
    var context = new Context(tryLocsList || []);

    // The ._invoke method unifies the implementations of the .next,
    // .throw, and .return methods.
    generator._invoke = makeInvokeMethod(innerFn, self, context);

    return generator;
  }
  runtime.wrap = wrap;

  // Try/catch helper to minimize deoptimizations. Returns a completion
  // record like context.tryEntries[i].completion. This interface could
  // have been (and was previously) designed to take a closure to be
  // invoked without arguments, but in all the cases we care about we
  // already have an existing method we want to call, so there's no need
  // to create a new function object. We can even get away with assuming
  // the method takes exactly one argument, since that happens to be true
  // in every case, so we don't have to touch the arguments object. The
  // only additional allocation required is the completion record, which
  // has a stable shape and so hopefully should be cheap to allocate.
  function tryCatch(fn, obj, arg) {
    try {
      return { type: "normal", arg: fn.call(obj, arg) };
    } catch (err) {
      return { type: "throw", arg: err };
    }
  }

  var GenStateSuspendedStart = "suspendedStart";
  var GenStateSuspendedYield = "suspendedYield";
  var GenStateExecuting = "executing";
  var GenStateCompleted = "completed";

  // Returning this object from the innerFn has the same effect as
  // breaking out of the dispatch switch statement.
  var ContinueSentinel = {};

  // Dummy constructor functions that we use as the .constructor and
  // .constructor.prototype properties for functions that return Generator
  // objects. For full spec compliance, you may wish to configure your
  // minifier not to mangle the names of these two functions.
  function Generator() {}
  function GeneratorFunction() {}
  function GeneratorFunctionPrototype() {}

  var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype;
  GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
  GeneratorFunctionPrototype.constructor = GeneratorFunction;
  GeneratorFunctionPrototype[toStringTagSymbol] = GeneratorFunction.displayName = "GeneratorFunction";

  // Helper for defining the .next, .throw, and .return methods of the
  // Iterator interface in terms of a single ._invoke method.
  function defineIteratorMethods(prototype) {
    ["next", "throw", "return"].forEach(function(method) {
      prototype[method] = function(arg) {
        return this._invoke(method, arg);
      };
    });
  }

  runtime.isGeneratorFunction = function(genFun) {
    var ctor = typeof genFun === "function" && genFun.constructor;
    return ctor
      ? ctor === GeneratorFunction ||
        // For the native GeneratorFunction constructor, the best we can
        // do is to check its .name property.
        (ctor.displayName || ctor.name) === "GeneratorFunction"
      : false;
  };

  runtime.mark = function(genFun) {
    if (Object.setPrototypeOf) {
      Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
    } else {
      genFun.__proto__ = GeneratorFunctionPrototype;
      if (!(toStringTagSymbol in genFun)) {
        genFun[toStringTagSymbol] = "GeneratorFunction";
      }
    }
    genFun.prototype = Object.create(Gp);
    return genFun;
  };

  // Within the body of any async function, `await x` is transformed to
  // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
  // `value instanceof AwaitArgument` to determine if the yielded value is
  // meant to be awaited. Some may consider the name of this method too
  // cutesy, but they are curmudgeons.
  runtime.awrap = function(arg) {
    return new AwaitArgument(arg);
  };

  function AwaitArgument(arg) {
    this.arg = arg;
  }

  function AsyncIterator(generator) {
    function invoke(method, arg, resolve, reject) {
      var record = tryCatch(generator[method], generator, arg);
      if (record.type === "throw") {
        reject(record.arg);
      } else {
        var result = record.arg;
        var value = result.value;
        if (value instanceof AwaitArgument) {
          return Promise.resolve(value.arg).then(function(value) {
            invoke("next", value, resolve, reject);
          }, function(err) {
            invoke("throw", err, resolve, reject);
          });
        }

        return Promise.resolve(value).then(function(unwrapped) {
          // When a yielded Promise is resolved, its final value becomes
          // the .value of the Promise<{value,done}> result for the
          // current iteration. If the Promise is rejected, however, the
          // result for this iteration will be rejected with the same
          // reason. Note that rejections of yielded Promises are not
          // thrown back into the generator function, as is the case
          // when an awaited Promise is rejected. This difference in
          // behavior between yield and await is important, because it
          // allows the consumer to decide what to do with the yielded
          // rejection (swallow it and continue, manually .throw it back
          // into the generator, abandon iteration, whatever). With
          // await, by contrast, there is no opportunity to examine the
          // rejection reason outside the generator function, so the
          // only option is to throw it from the await expression, and
          // let the generator function handle the exception.
          result.value = unwrapped;
          resolve(result);
        }, reject);
      }
    }

    if (typeof process === "object" && process.domain) {
      invoke = process.domain.bind(invoke);
    }

    var previousPromise;

    function enqueue(method, arg) {
      function callInvokeWithMethodAndArg() {
        return new Promise(function(resolve, reject) {
          invoke(method, arg, resolve, reject);
        });
      }

      return previousPromise =
        // If enqueue has been called before, then we want to wait until
        // all previous Promises have been resolved before calling invoke,
        // so that results are always delivered in the correct order. If
        // enqueue has not been called before, then it is important to
        // call invoke immediately, without waiting on a callback to fire,
        // so that the async generator function has the opportunity to do
        // any necessary setup in a predictable way. This predictability
        // is why the Promise constructor synchronously invokes its
        // executor callback, and why async functions synchronously
        // execute code before the first await. Since we implement simple
        // async functions in terms of async generators, it is especially
        // important to get this right, even though it requires care.
        previousPromise ? previousPromise.then(
          callInvokeWithMethodAndArg,
          // Avoid propagating failures to Promises returned by later
          // invocations of the iterator.
          callInvokeWithMethodAndArg
        ) : callInvokeWithMethodAndArg();
    }

    // Define the unified helper method that is used to implement .next,
    // .throw, and .return (see defineIteratorMethods).
    this._invoke = enqueue;
  }

  defineIteratorMethods(AsyncIterator.prototype);

  // Note that simple async functions are implemented on top of
  // AsyncIterator objects; they just return a Promise for the value of
  // the final result produced by the iterator.
  runtime.async = function(innerFn, outerFn, self, tryLocsList) {
    var iter = new AsyncIterator(
      wrap(innerFn, outerFn, self, tryLocsList)
    );

    return runtime.isGeneratorFunction(outerFn)
      ? iter // If outerFn is a generator, return the full iterator.
      : iter.next().then(function(result) {
          return result.done ? result.value : iter.next();
        });
  };

  function makeInvokeMethod(innerFn, self, context) {
    var state = GenStateSuspendedStart;

    return function invoke(method, arg) {
      if (state === GenStateExecuting) {
        throw new Error("Generator is already running");
      }

      if (state === GenStateCompleted) {
        if (method === "throw") {
          throw arg;
        }

        // Be forgiving, per 25.3.3.3.3 of the spec:
        // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
        return doneResult();
      }

      while (true) {
        var delegate = context.delegate;
        if (delegate) {
          if (method === "return" ||
              (method === "throw" && delegate.iterator[method] === undefined)) {
            // A return or throw (when the delegate iterator has no throw
            // method) always terminates the yield* loop.
            context.delegate = null;

            // If the delegate iterator has a return method, give it a
            // chance to clean up.
            var returnMethod = delegate.iterator["return"];
            if (returnMethod) {
              var record = tryCatch(returnMethod, delegate.iterator, arg);
              if (record.type === "throw") {
                // If the return method threw an exception, let that
                // exception prevail over the original return or throw.
                method = "throw";
                arg = record.arg;
                continue;
              }
            }

            if (method === "return") {
              // Continue with the outer return, now that the delegate
              // iterator has been terminated.
              continue;
            }
          }

          var record = tryCatch(
            delegate.iterator[method],
            delegate.iterator,
            arg
          );

          if (record.type === "throw") {
            context.delegate = null;

            // Like returning generator.throw(uncaught), but without the
            // overhead of an extra function call.
            method = "throw";
            arg = record.arg;
            continue;
          }

          // Delegate generator ran and handled its own exceptions so
          // regardless of what the method was, we continue as if it is
          // "next" with an undefined arg.
          method = "next";
          arg = undefined;

          var info = record.arg;
          if (info.done) {
            context[delegate.resultName] = info.value;
            context.next = delegate.nextLoc;
          } else {
            state = GenStateSuspendedYield;
            return info;
          }

          context.delegate = null;
        }

        if (method === "next") {
          // Setting context._sent for legacy support of Babel's
          // function.sent implementation.
          context.sent = context._sent = arg;

        } else if (method === "throw") {
          if (state === GenStateSuspendedStart) {
            state = GenStateCompleted;
            throw arg;
          }

          if (context.dispatchException(arg)) {
            // If the dispatched exception was caught by a catch block,
            // then let that catch block handle the exception normally.
            method = "next";
            arg = undefined;
          }

        } else if (method === "return") {
          context.abrupt("return", arg);
        }

        state = GenStateExecuting;

        var record = tryCatch(innerFn, self, context);
        if (record.type === "normal") {
          // If an exception is thrown from innerFn, we leave state ===
          // GenStateExecuting and loop back for another invocation.
          state = context.done
            ? GenStateCompleted
            : GenStateSuspendedYield;

          var info = {
            value: record.arg,
            done: context.done
          };

          if (record.arg === ContinueSentinel) {
            if (context.delegate && method === "next") {
              // Deliberately forget the last sent value so that we don't
              // accidentally pass it on to the delegate.
              arg = undefined;
            }
          } else {
            return info;
          }

        } else if (record.type === "throw") {
          state = GenStateCompleted;
          // Dispatch the exception by looping back around to the
          // context.dispatchException(arg) call above.
          method = "throw";
          arg = record.arg;
        }
      }
    };
  }

  // Define Generator.prototype.{next,throw,return} in terms of the
  // unified ._invoke helper method.
  defineIteratorMethods(Gp);

  Gp[iteratorSymbol] = function() {
    return this;
  };

  Gp[toStringTagSymbol] = "Generator";

  Gp.toString = function() {
    return "[object Generator]";
  };

  function pushTryEntry(locs) {
    var entry = { tryLoc: locs[0] };

    if (1 in locs) {
      entry.catchLoc = locs[1];
    }

    if (2 in locs) {
      entry.finallyLoc = locs[2];
      entry.afterLoc = locs[3];
    }

    this.tryEntries.push(entry);
  }

  function resetTryEntry(entry) {
    var record = entry.completion || {};
    record.type = "normal";
    delete record.arg;
    entry.completion = record;
  }

  function Context(tryLocsList) {
    // The root entry object (effectively a try statement without a catch
    // or a finally block) gives us a place to store values thrown from
    // locations where there is no enclosing try statement.
    this.tryEntries = [{ tryLoc: "root" }];
    tryLocsList.forEach(pushTryEntry, this);
    this.reset(true);
  }

  runtime.keys = function(object) {
    var keys = [];
    for (var key in object) {
      keys.push(key);
    }
    keys.reverse();

    // Rather than returning an object with a next method, we keep
    // things simple and return the next function itself.
    return function next() {
      while (keys.length) {
        var key = keys.pop();
        if (key in object) {
          next.value = key;
          next.done = false;
          return next;
        }
      }

      // To avoid creating an additional object, we just hang the .value
      // and .done properties off the next function object itself. This
      // also ensures that the minifier will not anonymize the function.
      next.done = true;
      return next;
    };
  };

  function values(iterable) {
    if (iterable) {
      var iteratorMethod = iterable[iteratorSymbol];
      if (iteratorMethod) {
        return iteratorMethod.call(iterable);
      }

      if (typeof iterable.next === "function") {
        return iterable;
      }

      if (!isNaN(iterable.length)) {
        var i = -1, next = function next() {
          while (++i < iterable.length) {
            if (hasOwn.call(iterable, i)) {
              next.value = iterable[i];
              next.done = false;
              return next;
            }
          }

          next.value = undefined;
          next.done = true;

          return next;
        };

        return next.next = next;
      }
    }

    // Return an iterator with no values.
    return { next: doneResult };
  }
  runtime.values = values;

  function doneResult() {
    return { value: undefined, done: true };
  }

  Context.prototype = {
    constructor: Context,

    reset: function(skipTempReset) {
      this.prev = 0;
      this.next = 0;
      // Resetting context._sent for legacy support of Babel's
      // function.sent implementation.
      this.sent = this._sent = undefined;
      this.done = false;
      this.delegate = null;

      this.tryEntries.forEach(resetTryEntry);

      if (!skipTempReset) {
        for (var name in this) {
          // Not sure about the optimal order of these conditions:
          if (name.charAt(0) === "t" &&
              hasOwn.call(this, name) &&
              !isNaN(+name.slice(1))) {
            this[name] = undefined;
          }
        }
      }
    },

    stop: function() {
      this.done = true;

      var rootEntry = this.tryEntries[0];
      var rootRecord = rootEntry.completion;
      if (rootRecord.type === "throw") {
        throw rootRecord.arg;
      }

      return this.rval;
    },

    dispatchException: function(exception) {
      if (this.done) {
        throw exception;
      }

      var context = this;
      function handle(loc, caught) {
        record.type = "throw";
        record.arg = exception;
        context.next = loc;
        return !!caught;
      }

      for (var i = this.tryEntries.length - 1; i >= 0; --i) {
        var entry = this.tryEntries[i];
        var record = entry.completion;

        if (entry.tryLoc === "root") {
          // Exception thrown outside of any try block that could handle
          // it, so set the completion value of the entire function to
          // throw the exception.
          return handle("end");
        }

        if (entry.tryLoc <= this.prev) {
          var hasCatch = hasOwn.call(entry, "catchLoc");
          var hasFinally = hasOwn.call(entry, "finallyLoc");

          if (hasCatch && hasFinally) {
            if (this.prev < entry.catchLoc) {
              return handle(entry.catchLoc, true);
            } else if (this.prev < entry.finallyLoc) {
              return handle(entry.finallyLoc);
            }

          } else if (hasCatch) {
            if (this.prev < entry.catchLoc) {
              return handle(entry.catchLoc, true);
            }

          } else if (hasFinally) {
            if (this.prev < entry.finallyLoc) {
              return handle(entry.finallyLoc);
            }

          } else {
            throw new Error("try statement without catch or finally");
          }
        }
      }
    },

    abrupt: function(type, arg) {
      for (var i = this.tryEntries.length - 1; i >= 0; --i) {
        var entry = this.tryEntries[i];
        if (entry.tryLoc <= this.prev &&
            hasOwn.call(entry, "finallyLoc") &&
            this.prev < entry.finallyLoc) {
          var finallyEntry = entry;
          break;
        }
      }

      if (finallyEntry &&
          (type === "break" ||
           type === "continue") &&
          finallyEntry.tryLoc <= arg &&
          arg <= finallyEntry.finallyLoc) {
        // Ignore the finally entry if control is not jumping to a
        // location outside the try/catch block.
        finallyEntry = null;
      }

      var record = finallyEntry ? finallyEntry.completion : {};
      record.type = type;
      record.arg = arg;

      if (finallyEntry) {
        this.next = finallyEntry.finallyLoc;
      } else {
        this.complete(record);
      }

      return ContinueSentinel;
    },

    complete: function(record, afterLoc) {
      if (record.type === "throw") {
        throw record.arg;
      }

      if (record.type === "break" ||
          record.type === "continue") {
        this.next = record.arg;
      } else if (record.type === "return") {
        this.rval = record.arg;
        this.next = "end";
      } else if (record.type === "normal" && afterLoc) {
        this.next = afterLoc;
      }
    },

    finish: function(finallyLoc) {
      for (var i = this.tryEntries.length - 1; i >= 0; --i) {
        var entry = this.tryEntries[i];
        if (entry.finallyLoc === finallyLoc) {
          this.complete(entry.completion, entry.afterLoc);
          resetTryEntry(entry);
          return ContinueSentinel;
        }
      }
    },

    "catch": function(tryLoc) {
      for (var i = this.tryEntries.length - 1; i >= 0; --i) {
        var entry = this.tryEntries[i];
        if (entry.tryLoc === tryLoc) {
          var record = entry.completion;
          if (record.type === "throw") {
            var thrown = record.arg;
            resetTryEntry(entry);
          }
          return thrown;
        }
      }

      // The context.catch method must only be called with a location
      // argument that corresponds to a known catch block.
      throw new Error("illegal catch attempt");
    },

    delegateYield: function(iterable, resultName, nextLoc) {
      this.delegate = {
        iterator: values(iterable),
        resultName: resultName,
        nextLoc: nextLoc
      };

      return ContinueSentinel;
    }
  };
})(
  // Among the various tricks for obtaining a reference to the global
  // object, this seems to be the most reliable technique that does not
  // use indirect eval (which violates Content Security Policy).
  typeof global === "object" ? global :
  typeof window === "object" ? window :
  typeof self === "object" ? self : this
);

}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"_process":416}],120:[function(require,module,exports){
require('../../modules/core.regexp.escape');
module.exports = require('../../modules/_core').RegExp.escape;
},{"../../modules/_core":141,"../../modules/core.regexp.escape":237}],121:[function(require,module,exports){
module.exports = function(it){
  if(typeof it != 'function')throw TypeError(it + ' is not a function!');
  return it;
};
},{}],122:[function(require,module,exports){
var cof = require('./_cof');
module.exports = function(it, msg){
  if(typeof it != 'number' && cof(it) != 'Number')throw TypeError(msg);
  return +it;
};
},{"./_cof":136}],123:[function(require,module,exports){
// 22.1.3.31 Array.prototype[@@unscopables]
var UNSCOPABLES = require('./_wks')('unscopables')
  , ArrayProto  = Array.prototype;
if(ArrayProto[UNSCOPABLES] == undefined)require('./_hide')(ArrayProto, UNSCOPABLES, {});
module.exports = function(key){
  ArrayProto[UNSCOPABLES][key] = true;
};
},{"./_hide":158,"./_wks":235}],124:[function(require,module,exports){
module.exports = function(it, Constructor, name, forbiddenField){
  if(!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)){
    throw TypeError(name + ': incorrect invocation!');
  } return it;
};
},{}],125:[function(require,module,exports){
var isObject = require('./_is-object');
module.exports = function(it){
  if(!isObject(it))throw TypeError(it + ' is not an object!');
  return it;
};
},{"./_is-object":167}],126:[function(require,module,exports){
// 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length)
'use strict';
var toObject = require('./_to-object')
  , toIndex  = require('./_to-index')
  , toLength = require('./_to-length');

module.exports = [].copyWithin || function copyWithin(target/*= 0*/, start/*= 0, end = @length*/){
  var O     = toObject(this)
    , len   = toLength(O.length)
    , to    = toIndex(target, len)
    , from  = toIndex(start, len)
    , end   = arguments.length > 2 ? arguments[2] : undefined
    , count = Math.min((end === undefined ? len : toIndex(end, len)) - from, len - to)
    , inc   = 1;
  if(from < to && to < from + count){
    inc  = -1;
    from += count - 1;
    to   += count - 1;
  }
  while(count-- > 0){
    if(from in O)O[to] = O[from];
    else delete O[to];
    to   += inc;
    from += inc;
  } return O;
};
},{"./_to-index":223,"./_to-length":226,"./_to-object":227}],127:[function(require,module,exports){
// 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length)
'use strict';
var toObject = require('./_to-object')
  , toIndex  = require('./_to-index')
  , toLength = require('./_to-length');
module.exports = function fill(value /*, start = 0, end = @length */){
  var O      = toObject(this)
    , length = toLength(O.length)
    , aLen   = arguments.length
    , index  = toIndex(aLen > 1 ? arguments[1] : undefined, length)
    , end    = aLen > 2 ? arguments[2] : undefined
    , endPos = end === undefined ? length : toIndex(end, length);
  while(endPos > index)O[index++] = value;
  return O;
};
},{"./_to-index":223,"./_to-length":226,"./_to-object":227}],128:[function(require,module,exports){
var forOf = require('./_for-of');

module.exports = function(iter, ITERATOR){
  var result = [];
  forOf(iter, false, result.push, result, ITERATOR);
  return result;
};

},{"./_for-of":155}],129:[function(require,module,exports){
// false -> Array#indexOf
// true  -> Array#includes
var toIObject = require('./_to-iobject')
  , toLength  = require('./_to-length')
  , toIndex   = require('./_to-index');
module.exports = function(IS_INCLUDES){
  return function($this, el, fromIndex){
    var O      = toIObject($this)
      , length = toLength(O.length)
      , index  = toIndex(fromIndex, length)
      , value;
    // Array#includes uses SameValueZero equality algorithm
    if(IS_INCLUDES && el != el)while(length > index){
      value = O[index++];
      if(value != value)return true;
    // Array#toIndex ignores holes, Array#includes - not
    } else for(;length > index; index++)if(IS_INCLUDES || index in O){
      if(O[index] === el)return IS_INCLUDES || index || 0;
    } return !IS_INCLUDES && -1;
  };
};
},{"./_to-index":223,"./_to-iobject":225,"./_to-length":226}],130:[function(require,module,exports){
// 0 -> Array#forEach
// 1 -> Array#map
// 2 -> Array#filter
// 3 -> Array#some
// 4 -> Array#every
// 5 -> Array#find
// 6 -> Array#findIndex
var ctx      = require('./_ctx')
  , IObject  = require('./_iobject')
  , toObject = require('./_to-object')
  , toLength = require('./_to-length')
  , asc      = require('./_array-species-create');
module.exports = function(TYPE, $create){
  var IS_MAP        = TYPE == 1
    , IS_FILTER     = TYPE == 2
    , IS_SOME       = TYPE == 3
    , IS_EVERY      = TYPE == 4
    , IS_FIND_INDEX = TYPE == 6
    , NO_HOLES      = TYPE == 5 || IS_FIND_INDEX
    , create        = $create || asc;
  return function($this, callbackfn, that){
    var O      = toObject($this)
      , self   = IObject(O)
      , f      = ctx(callbackfn, that, 3)
      , length = toLength(self.length)
      , index  = 0
      , result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined
      , val, res;
    for(;length > index; index++)if(NO_HOLES || index in self){
      val = self[index];
      res = f(val, index, O);
      if(TYPE){
        if(IS_MAP)result[index] = res;            // map
        else if(res)switch(TYPE){
          case 3: return true;                    // some
          case 5: return val;                     // find
          case 6: return index;                   // findIndex
          case 2: result.push(val);               // filter
        } else if(IS_EVERY)return false;          // every
      }
    }
    return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;
  };
};
},{"./_array-species-create":133,"./_ctx":143,"./_iobject":163,"./_to-length":226,"./_to-object":227}],131:[function(require,module,exports){
var aFunction = require('./_a-function')
  , toObject  = require('./_to-object')
  , IObject   = require('./_iobject')
  , toLength  = require('./_to-length');

module.exports = function(that, callbackfn, aLen, memo, isRight){
  aFunction(callbackfn);
  var O      = toObject(that)
    , self   = IObject(O)
    , length = toLength(O.length)
    , index  = isRight ? length - 1 : 0
    , i      = isRight ? -1 : 1;
  if(aLen < 2)for(;;){
    if(index in self){
      memo = self[index];
      index += i;
      break;
    }
    index += i;
    if(isRight ? index < 0 : length <= index){
      throw TypeError('Reduce of empty array with no initial value');
    }
  }
  for(;isRight ? index >= 0 : length > index; index += i)if(index in self){
    memo = callbackfn(memo, self[index], index, O);
  }
  return memo;
};
},{"./_a-function":121,"./_iobject":163,"./_to-length":226,"./_to-object":227}],132:[function(require,module,exports){
var isObject = require('./_is-object')
  , isArray  = require('./_is-array')
  , SPECIES  = require('./_wks')('species');

module.exports = function(original){
  var C;
  if(isArray(original)){
    C = original.constructor;
    // cross-realm fallback
    if(typeof C == 'function' && (C === Array || isArray(C.prototype)))C = undefined;
    if(isObject(C)){
      C = C[SPECIES];
      if(C === null)C = undefined;
    }
  } return C === undefined ? Array : C;
};
},{"./_is-array":165,"./_is-object":167,"./_wks":235}],133:[function(require,module,exports){
// 9.4.2.3 ArraySpeciesCreate(originalArray, length)
var speciesConstructor = require('./_array-species-constructor');

module.exports = function(original, length){
  return new (speciesConstructor(original))(length);
};
},{"./_array-species-constructor":132}],134:[function(require,module,exports){
'use strict';
var aFunction  = require('./_a-function')
  , isObject   = require('./_is-object')
  , invoke     = require('./_invoke')
  , arraySlice = [].slice
  , factories  = {};

var construct = function(F, len, args){
  if(!(len in factories)){
    for(var n = [], i = 0; i < len; i++)n[i] = 'a[' + i + ']';
    factories[len] = Function('F,a', 'return new F(' + n.join(',') + ')');
  } return factories[len](F, args);
};

module.exports = Function.bind || function bind(that /*, args... */){
  var fn       = aFunction(this)
    , partArgs = arraySlice.call(arguments, 1);
  var bound = function(/* args... */){
    var args = partArgs.concat(arraySlice.call(arguments));
    return this instanceof bound ? construct(fn, args.length, args) : invoke(fn, args, that);
  };
  if(isObject(fn.prototype))bound.prototype = fn.prototype;
  return bound;
};
},{"./_a-function":121,"./_invoke":162,"./_is-object":167}],135:[function(require,module,exports){
// getting tag from 19.1.3.6 Object.prototype.toString()
var cof = require('./_cof')
  , TAG = require('./_wks')('toStringTag')
  // ES3 wrong here
  , ARG = cof(function(){ return arguments; }()) == 'Arguments';

// fallback for IE11 Script Access Denied error
var tryGet = function(it, key){
  try {
    return it[key];
  } catch(e){ /* empty */ }
};

module.exports = function(it){
  var O, T, B;
  return it === undefined ? 'Undefined' : it === null ? 'Null'
    // @@toStringTag case
    : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T
    // builtinTag case
    : ARG ? cof(O)
    // ES3 arguments fallback
    : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
};
},{"./_cof":136,"./_wks":235}],136:[function(require,module,exports){
var toString = {}.toString;

module.exports = function(it){
  return toString.call(it).slice(8, -1);
};
},{}],137:[function(require,module,exports){
'use strict';
var dP          = require('./_object-dp').f
  , create      = require('./_object-create')
  , redefineAll = require('./_redefine-all')
  , ctx         = require('./_ctx')
  , anInstance  = require('./_an-instance')
  , defined     = require('./_defined')
  , forOf       = require('./_for-of')
  , $iterDefine = require('./_iter-define')
  , step        = require('./_iter-step')
  , setSpecies  = require('./_set-species')
  , DESCRIPTORS = require('./_descriptors')
  , fastKey     = require('./_meta').fastKey
  , SIZE        = DESCRIPTORS ? '_s' : 'size';

var getEntry = function(that, key){
  // fast case
  var index = fastKey(key), entry;
  if(index !== 'F')return that._i[index];
  // frozen object case
  for(entry = that._f; entry; entry = entry.n){
    if(entry.k == key)return entry;
  }
};

module.exports = {
  getConstructor: function(wrapper, NAME, IS_MAP, ADDER){
    var C = wrapper(function(that, iterable){
      anInstance(that, C, NAME, '_i');
      that._i = create(null); // index
      that._f = undefined;    // first entry
      that._l = undefined;    // last entry
      that[SIZE] = 0;         // size
      if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that);
    });
    redefineAll(C.prototype, {
      // 23.1.3.1 Map.prototype.clear()
      // 23.2.3.2 Set.prototype.clear()
      clear: function clear(){
        for(var that = this, data = that._i, entry = that._f; entry; entry = entry.n){
          entry.r = true;
          if(entry.p)entry.p = entry.p.n = undefined;
          delete data[entry.i];
        }
        that._f = that._l = undefined;
        that[SIZE] = 0;
      },
      // 23.1.3.3 Map.prototype.delete(key)
      // 23.2.3.4 Set.prototype.delete(value)
      'delete': function(key){
        var that  = this
          , entry = getEntry(that, key);
        if(entry){
          var next = entry.n
            , prev = entry.p;
          delete that._i[entry.i];
          entry.r = true;
          if(prev)prev.n = next;
          if(next)next.p = prev;
          if(that._f == entry)that._f = next;
          if(that._l == entry)that._l = prev;
          that[SIZE]--;
        } return !!entry;
      },
      // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
      // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
      forEach: function forEach(callbackfn /*, that = undefined */){
        anInstance(this, C, 'forEach');
        var f = ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3)
          , entry;
        while(entry = entry ? entry.n : this._f){
          f(entry.v, entry.k, this);
          // revert to the last existing entry
          while(entry && entry.r)entry = entry.p;
        }
      },
      // 23.1.3.7 Map.prototype.has(key)
      // 23.2.3.7 Set.prototype.has(value)
      has: function has(key){
        return !!getEntry(this, key);
      }
    });
    if(DESCRIPTORS)dP(C.prototype, 'size', {
      get: function(){
        return defined(this[SIZE]);
      }
    });
    return C;
  },
  def: function(that, key, value){
    var entry = getEntry(that, key)
      , prev, index;
    // change existing entry
    if(entry){
      entry.v = value;
    // create new entry
    } else {
      that._l = entry = {
        i: index = fastKey(key, true), // <- index
        k: key,                        // <- key
        v: value,                      // <- value
        p: prev = that._l,             // <- previous entry
        n: undefined,                  // <- next entry
        r: false                       // <- removed
      };
      if(!that._f)that._f = entry;
      if(prev)prev.n = entry;
      that[SIZE]++;
      // add to index
      if(index !== 'F')that._i[index] = entry;
    } return that;
  },
  getEntry: getEntry,
  setStrong: function(C, NAME, IS_MAP){
    // add .keys, .values, .entries, [@@iterator]
    // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11
    $iterDefine(C, NAME, function(iterated, kind){
      this._t = iterated;  // target
      this._k = kind;      // kind
      this._l = undefined; // previous
    }, function(){
      var that  = this
        , kind  = that._k
        , entry = that._l;
      // revert to the last existing entry
      while(entry && entry.r)entry = entry.p;
      // get next entry
      if(!that._t || !(that._l = entry = entry ? entry.n : that._t._f)){
        // or finish the iteration
        that._t = undefined;
        return step(1);
      }
      // return step by kind
      if(kind == 'keys'  )return step(0, entry.k);
      if(kind == 'values')return step(0, entry.v);
      return step(0, [entry.k, entry.v]);
    }, IS_MAP ? 'entries' : 'values' , !IS_MAP, true);

    // add [@@species], 23.1.2.2, 23.2.2.2
    setSpecies(NAME);
  }
};
},{"./_an-instance":124,"./_ctx":143,"./_defined":145,"./_descriptors":146,"./_for-of":155,"./_iter-define":171,"./_iter-step":173,"./_meta":180,"./_object-create":184,"./_object-dp":185,"./_redefine-all":204,"./_set-species":209}],138:[function(require,module,exports){
// https://github.com/DavidBruant/Map-Set.prototype.toJSON
var classof = require('./_classof')
  , from    = require('./_array-from-iterable');
module.exports = function(NAME){
  return function toJSON(){
    if(classof(this) != NAME)throw TypeError(NAME + "#toJSON isn't generic");
    return from(this);
  };
};
},{"./_array-from-iterable":128,"./_classof":135}],139:[function(require,module,exports){
'use strict';
var redefineAll       = require('./_redefine-all')
  , getWeak           = require('./_meta').getWeak
  , anObject          = require('./_an-object')
  , isObject          = require('./_is-object')
  , anInstance        = require('./_an-instance')
  , forOf             = require('./_for-of')
  , createArrayMethod = require('./_array-methods')
  , $has              = require('./_has')
  , arrayFind         = createArrayMethod(5)
  , arrayFindIndex    = createArrayMethod(6)
  , id                = 0;

// fallback for uncaught frozen keys
var uncaughtFrozenStore = function(that){
  return that._l || (that._l = new UncaughtFrozenStore);
};
var UncaughtFrozenStore = function(){
  this.a = [];
};
var findUncaughtFrozen = function(store, key){
  return arrayFind(store.a, function(it){
    return it[0] === key;
  });
};
UncaughtFrozenStore.prototype = {
  get: function(key){
    var entry = findUncaughtFrozen(this, key);
    if(entry)return entry[1];
  },
  has: function(key){
    return !!findUncaughtFrozen(this, key);
  },
  set: function(key, value){
    var entry = findUncaughtFrozen(this, key);
    if(entry)entry[1] = value;
    else this.a.push([key, value]);
  },
  'delete': function(key){
    var index = arrayFindIndex(this.a, function(it){
      return it[0] === key;
    });
    if(~index)this.a.splice(index, 1);
    return !!~index;
  }
};

module.exports = {
  getConstructor: function(wrapper, NAME, IS_MAP, ADDER){
    var C = wrapper(function(that, iterable){
      anInstance(that, C, NAME, '_i');
      that._i = id++;      // collection id
      that._l = undefined; // leak store for uncaught frozen objects
      if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that);
    });
    redefineAll(C.prototype, {
      // 23.3.3.2 WeakMap.prototype.delete(key)
      // 23.4.3.3 WeakSet.prototype.delete(value)
      'delete': function(key){
        if(!isObject(key))return false;
        var data = getWeak(key);
        if(data === true)return uncaughtFrozenStore(this)['delete'](key);
        return data && $has(data, this._i) && delete data[this._i];
      },
      // 23.3.3.4 WeakMap.prototype.has(key)
      // 23.4.3.4 WeakSet.prototype.has(value)
      has: function has(key){
        if(!isObject(key))return false;
        var data = getWeak(key);
        if(data === true)return uncaughtFrozenStore(this).has(key);
        return data && $has(data, this._i);
      }
    });
    return C;
  },
  def: function(that, key, value){
    var data = getWeak(anObject(key), true);
    if(data === true)uncaughtFrozenStore(that).set(key, value);
    else data[that._i] = value;
    return that;
  },
  ufstore: uncaughtFrozenStore
};
},{"./_an-instance":124,"./_an-object":125,"./_array-methods":130,"./_for-of":155,"./_has":157,"./_is-object":167,"./_meta":180,"./_redefine-all":204}],140:[function(require,module,exports){
'use strict';
var global            = require('./_global')
  , $export           = require('./_export')
  , redefine          = require('./_redefine')
  , redefineAll       = require('./_redefine-all')
  , meta              = require('./_meta')
  , forOf             = require('./_for-of')
  , anInstance        = require('./_an-instance')
  , isObject          = require('./_is-object')
  , fails             = require('./_fails')
  , $iterDetect       = require('./_iter-detect')
  , setToStringTag    = require('./_set-to-string-tag')
  , inheritIfRequired = require('./_inherit-if-required');

module.exports = function(NAME, wrapper, methods, common, IS_MAP, IS_WEAK){
  var Base  = global[NAME]
    , C     = Base
    , ADDER = IS_MAP ? 'set' : 'add'
    , proto = C && C.prototype
    , O     = {};
  var fixMethod = function(KEY){
    var fn = proto[KEY];
    redefine(proto, KEY,
      KEY == 'delete' ? function(a){
        return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a);
      } : KEY == 'has' ? function has(a){
        return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a);
      } : KEY == 'get' ? function get(a){
        return IS_WEAK && !isObject(a) ? undefined : fn.call(this, a === 0 ? 0 : a);
      } : KEY == 'add' ? function add(a){ fn.call(this, a === 0 ? 0 : a); return this; }
        : function set(a, b){ fn.call(this, a === 0 ? 0 : a, b); return this; }
    );
  };
  if(typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function(){
    new C().entries().next();
  }))){
    // create collection constructor
    C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);
    redefineAll(C.prototype, methods);
    meta.NEED = true;
  } else {
    var instance             = new C
      // early implementations not supports chaining
      , HASNT_CHAINING       = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance
      // V8 ~  Chromium 40- weak-collections throws on primitives, but should return false
      , THROWS_ON_PRIMITIVES = fails(function(){ instance.has(1); })
      // most early implementations doesn't supports iterables, most modern - not close it correctly
      , ACCEPT_ITERABLES     = $iterDetect(function(iter){ new C(iter); }) // eslint-disable-line no-new
      // for early implementations -0 and +0 not the same
      , BUGGY_ZERO = !IS_WEAK && fails(function(){
        // V8 ~ Chromium 42- fails only with 5+ elements
        var $instance = new C()
          , index     = 5;
        while(index--)$instance[ADDER](index, index);
        return !$instance.has(-0);
      });
    if(!ACCEPT_ITERABLES){ 
      C = wrapper(function(target, iterable){
        anInstance(target, C, NAME);
        var that = inheritIfRequired(new Base, target, C);
        if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that);
        return that;
      });
      C.prototype = proto;
      proto.constructor = C;
    }
    if(THROWS_ON_PRIMITIVES || BUGGY_ZERO){
      fixMethod('delete');
      fixMethod('has');
      IS_MAP && fixMethod('get');
    }
    if(BUGGY_ZERO || HASNT_CHAINING)fixMethod(ADDER);
    // weak collections should not contains .clear method
    if(IS_WEAK && proto.clear)delete proto.clear;
  }

  setToStringTag(C, NAME);

  O[NAME] = C;
  $export($export.G + $export.W + $export.F * (C != Base), O);

  if(!IS_WEAK)common.setStrong(C, NAME, IS_MAP);

  return C;
};
},{"./_an-instance":124,"./_export":150,"./_fails":152,"./_for-of":155,"./_global":156,"./_inherit-if-required":161,"./_is-object":167,"./_iter-detect":172,"./_meta":180,"./_redefine":205,"./_redefine-all":204,"./_set-to-string-tag":210}],141:[function(require,module,exports){
var core = module.exports = {version: '2.4.0'};
if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef
},{}],142:[function(require,module,exports){
'use strict';
var $defineProperty = require('./_object-dp')
  , createDesc      = require('./_property-desc');

module.exports = function(object, index, value){
  if(index in object)$defineProperty.f(object, index, createDesc(0, value));
  else object[index] = value;
};
},{"./_object-dp":185,"./_property-desc":203}],143:[function(require,module,exports){
// optional / simple context binding
var aFunction = require('./_a-function');
module.exports = function(fn, that, length){
  aFunction(fn);
  if(that === undefined)return fn;
  switch(length){
    case 1: return function(a){
      return fn.call(that, a);
    };
    case 2: return function(a, b){
      return fn.call(that, a, b);
    };
    case 3: return function(a, b, c){
      return fn.call(that, a, b, c);
    };
  }
  return function(/* ...args */){
    return fn.apply(that, arguments);
  };
};
},{"./_a-function":121}],144:[function(require,module,exports){
'use strict';
var anObject    = require('./_an-object')
  , toPrimitive = require('./_to-primitive')
  , NUMBER      = 'number';

module.exports = function(hint){
  if(hint !== 'string' && hint !== NUMBER && hint !== 'default')throw TypeError('Incorrect hint');
  return toPrimitive(anObject(this), hint != NUMBER);
};
},{"./_an-object":125,"./_to-primitive":228}],145:[function(require,module,exports){
// 7.2.1 RequireObjectCoercible(argument)
module.exports = function(it){
  if(it == undefined)throw TypeError("Can't call method on  " + it);
  return it;
};
},{}],146:[function(require,module,exports){
// Thank's IE8 for his funny defineProperty
module.exports = !require('./_fails')(function(){
  return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7;
});
},{"./_fails":152}],147:[function(require,module,exports){
var isObject = require('./_is-object')
  , document = require('./_global').document
  // in old IE typeof document.createElement is 'object'
  , is = isObject(document) && isObject(document.createElement);
module.exports = function(it){
  return is ? document.createElement(it) : {};
};
},{"./_global":156,"./_is-object":167}],148:[function(require,module,exports){
// IE 8- don't enum bug keys
module.exports = (
  'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
).split(',');
},{}],149:[function(require,module,exports){
// all enumerable object keys, includes symbols
var getKeys = require('./_object-keys')
  , gOPS    = require('./_object-gops')
  , pIE     = require('./_object-pie');
module.exports = function(it){
  var result     = getKeys(it)
    , getSymbols = gOPS.f;
  if(getSymbols){
    var symbols = getSymbols(it)
      , isEnum  = pIE.f
      , i       = 0
      , key;
    while(symbols.length > i)if(isEnum.call(it, key = symbols[i++]))result.push(key);
  } return result;
};
},{"./_object-gops":191,"./_object-keys":194,"./_object-pie":195}],150:[function(require,module,exports){
var global    = require('./_global')
  , core      = require('./_core')
  , hide      = require('./_hide')
  , redefine  = require('./_redefine')
  , ctx       = require('./_ctx')
  , PROTOTYPE = 'prototype';

var $export = function(type, name, source){
  var IS_FORCED = type & $export.F
    , IS_GLOBAL = type & $export.G
    , IS_STATIC = type & $export.S
    , IS_PROTO  = type & $export.P
    , IS_BIND   = type & $export.B
    , target    = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE]
    , exports   = IS_GLOBAL ? core : core[name] || (core[name] = {})
    , expProto  = exports[PROTOTYPE] || (exports[PROTOTYPE] = {})
    , key, own, out, exp;
  if(IS_GLOBAL)source = name;
  for(key in source){
    // contains in native
    own = !IS_FORCED && target && target[key] !== undefined;
    // export native or passed
    out = (own ? target : source)[key];
    // bind timers to global for call from export context
    exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
    // extend global
    if(target)redefine(target, key, out, type & $export.U);
    // export
    if(exports[key] != out)hide(exports, key, exp);
    if(IS_PROTO && expProto[key] != out)expProto[key] = out;
  }
};
global.core = core;
// type bitmap
$export.F = 1;   // forced
$export.G = 2;   // global
$export.S = 4;   // static
$export.P = 8;   // proto
$export.B = 16;  // bind
$export.W = 32;  // wrap
$export.U = 64;  // safe
$export.R = 128; // real proto method for `library` 
module.exports = $export;
},{"./_core":141,"./_ctx":143,"./_global":156,"./_hide":158,"./_redefine":205}],151:[function(require,module,exports){
var MATCH = require('./_wks')('match');
module.exports = function(KEY){
  var re = /./;
  try {
    '/./'[KEY](re);
  } catch(e){
    try {
      re[MATCH] = false;
      return !'/./'[KEY](re);
    } catch(f){ /* empty */ }
  } return true;
};
},{"./_wks":235}],152:[function(require,module,exports){
module.exports = function(exec){
  try {
    return !!exec();
  } catch(e){
    return true;
  }
};
},{}],153:[function(require,module,exports){
'use strict';
var hide     = require('./_hide')
  , redefine = require('./_redefine')
  , fails    = require('./_fails')
  , defined  = require('./_defined')
  , wks      = require('./_wks');

module.exports = function(KEY, length, exec){
  var SYMBOL   = wks(KEY)
    , fns      = exec(defined, SYMBOL, ''[KEY])
    , strfn    = fns[0]
    , rxfn     = fns[1];
  if(fails(function(){
    var O = {};
    O[SYMBOL] = function(){ return 7; };
    return ''[KEY](O) != 7;
  })){
    redefine(String.prototype, KEY, strfn);
    hide(RegExp.prototype, SYMBOL, length == 2
      // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
      // 21.2.5.11 RegExp.prototype[@@split](string, limit)
      ? function(string, arg){ return rxfn.call(string, this, arg); }
      // 21.2.5.6 RegExp.prototype[@@match](string)
      // 21.2.5.9 RegExp.prototype[@@search](string)
      : function(string){ return rxfn.call(string, this); }
    );
  }
};
},{"./_defined":145,"./_fails":152,"./_hide":158,"./_redefine":205,"./_wks":235}],154:[function(require,module,exports){
'use strict';
// 21.2.5.3 get RegExp.prototype.flags
var anObject = require('./_an-object');
module.exports = function(){
  var that   = anObject(this)
    , result = '';
  if(that.global)     result += 'g';
  if(that.ignoreCase) result += 'i';
  if(that.multiline)  result += 'm';
  if(that.unicode)    result += 'u';
  if(that.sticky)     result += 'y';
  return result;
};
},{"./_an-object":125}],155:[function(require,module,exports){
var ctx         = require('./_ctx')
  , call        = require('./_iter-call')
  , isArrayIter = require('./_is-array-iter')
  , anObject    = require('./_an-object')
  , toLength    = require('./_to-length')
  , getIterFn   = require('./core.get-iterator-method')
  , BREAK       = {}
  , RETURN      = {};
var exports = module.exports = function(iterable, entries, fn, that, ITERATOR){
  var iterFn = ITERATOR ? function(){ return iterable; } : getIterFn(iterable)
    , f      = ctx(fn, that, entries ? 2 : 1)
    , index  = 0
    , length, step, iterator, result;
  if(typeof iterFn != 'function')throw TypeError(iterable + ' is not iterable!');
  // fast case for arrays with default iterator
  if(isArrayIter(iterFn))for(length = toLength(iterable.length); length > index; index++){
    result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
    if(result === BREAK || result === RETURN)return result;
  } else for(iterator = iterFn.call(iterable); !(step = iterator.next()).done; ){
    result = call(iterator, f, step.value, entries);
    if(result === BREAK || result === RETURN)return result;
  }
};
exports.BREAK  = BREAK;
exports.RETURN = RETURN;
},{"./_an-object":125,"./_ctx":143,"./_is-array-iter":164,"./_iter-call":169,"./_to-length":226,"./core.get-iterator-method":236}],156:[function(require,module,exports){
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
var global = module.exports = typeof window != 'undefined' && window.Math == Math
  ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef
},{}],157:[function(require,module,exports){
var hasOwnProperty = {}.hasOwnProperty;
module.exports = function(it, key){
  return hasOwnProperty.call(it, key);
};
},{}],158:[function(require,module,exports){
var dP         = require('./_object-dp')
  , createDesc = require('./_property-desc');
module.exports = require('./_descriptors') ? function(object, key, value){
  return dP.f(object, key, createDesc(1, value));
} : function(object, key, value){
  object[key] = value;
  return object;
};
},{"./_descriptors":146,"./_object-dp":185,"./_property-desc":203}],159:[function(require,module,exports){
module.exports = require('./_global').document && document.documentElement;
},{"./_global":156}],160:[function(require,module,exports){
module.exports = !require('./_descriptors') && !require('./_fails')(function(){
  return Object.defineProperty(require('./_dom-create')('div'), 'a', {get: function(){ return 7; }}).a != 7;
});
},{"./_descriptors":146,"./_dom-create":147,"./_fails":152}],161:[function(require,module,exports){
var isObject       = require('./_is-object')
  , setPrototypeOf = require('./_set-proto').set;
module.exports = function(that, target, C){
  var P, S = target.constructor;
  if(S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && isObject(P) && setPrototypeOf){
    setPrototypeOf(that, P);
  } return that;
};
},{"./_is-object":167,"./_set-proto":208}],162:[function(require,module,exports){
// fast apply, http://jsperf.lnkit.com/fast-apply/5
module.exports = function(fn, args, that){
  var un = that === undefined;
  switch(args.length){
    case 0: return un ? fn()
                      : fn.call(that);
    case 1: return un ? fn(args[0])
                      : fn.call(that, args[0]);
    case 2: return un ? fn(args[0], args[1])
                      : fn.call(that, args[0], args[1]);
    case 3: return un ? fn(args[0], args[1], args[2])
                      : fn.call(that, args[0], args[1], args[2]);
    case 4: return un ? fn(args[0], args[1], args[2], args[3])
                      : fn.call(that, args[0], args[1], args[2], args[3]);
  } return              fn.apply(that, args);
};
},{}],163:[function(require,module,exports){
// fallback for non-array-like ES3 and non-enumerable old V8 strings
var cof = require('./_cof');
module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){
  return cof(it) == 'String' ? it.split('') : Object(it);
};
},{"./_cof":136}],164:[function(require,module,exports){
// check on default Array iterator
var Iterators  = require('./_iterators')
  , ITERATOR   = require('./_wks')('iterator')
  , ArrayProto = Array.prototype;

module.exports = function(it){
  return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
};
},{"./_iterators":174,"./_wks":235}],165:[function(require,module,exports){
// 7.2.2 IsArray(argument)
var cof = require('./_cof');
module.exports = Array.isArray || function isArray(arg){
  return cof(arg) == 'Array';
};
},{"./_cof":136}],166:[function(require,module,exports){
// 20.1.2.3 Number.isInteger(number)
var isObject = require('./_is-object')
  , floor    = Math.floor;
module.exports = function isInteger(it){
  return !isObject(it) && isFinite(it) && floor(it) === it;
};
},{"./_is-object":167}],167:[function(require,module,exports){
module.exports = function(it){
  return typeof it === 'object' ? it !== null : typeof it === 'function';
};
},{}],168:[function(require,module,exports){
// 7.2.8 IsRegExp(argument)
var isObject = require('./_is-object')
  , cof      = require('./_cof')
  , MATCH    = require('./_wks')('match');
module.exports = function(it){
  var isRegExp;
  return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp');
};
},{"./_cof":136,"./_is-object":167,"./_wks":235}],169:[function(require,module,exports){
// call something on iterator step with safe closing on error
var anObject = require('./_an-object');
module.exports = function(iterator, fn, value, entries){
  try {
    return entries ? fn(anObject(value)[0], value[1]) : fn(value);
  // 7.4.6 IteratorClose(iterator, completion)
  } catch(e){
    var ret = iterator['return'];
    if(ret !== undefined)anObject(ret.call(iterator));
    throw e;
  }
};
},{"./_an-object":125}],170:[function(require,module,exports){
'use strict';
var create         = require('./_object-create')
  , descriptor     = require('./_property-desc')
  , setToStringTag = require('./_set-to-string-tag')
  , IteratorPrototype = {};

// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
require('./_hide')(IteratorPrototype, require('./_wks')('iterator'), function(){ return this; });

module.exports = function(Constructor, NAME, next){
  Constructor.prototype = create(IteratorPrototype, {next: descriptor(1, next)});
  setToStringTag(Constructor, NAME + ' Iterator');
};
},{"./_hide":158,"./_object-create":184,"./_property-desc":203,"./_set-to-string-tag":210,"./_wks":235}],171:[function(require,module,exports){
'use strict';
var LIBRARY        = require('./_library')
  , $export        = require('./_export')
  , redefine       = require('./_redefine')
  , hide           = require('./_hide')
  , has            = require('./_has')
  , Iterators      = require('./_iterators')
  , $iterCreate    = require('./_iter-create')
  , setToStringTag = require('./_set-to-string-tag')
  , getPrototypeOf = require('./_object-gpo')
  , ITERATOR       = require('./_wks')('iterator')
  , BUGGY          = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next`
  , FF_ITERATOR    = '@@iterator'
  , KEYS           = 'keys'
  , VALUES         = 'values';

var returnThis = function(){ return this; };

module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){
  $iterCreate(Constructor, NAME, next);
  var getMethod = function(kind){
    if(!BUGGY && kind in proto)return proto[kind];
    switch(kind){
      case KEYS: return function keys(){ return new Constructor(this, kind); };
      case VALUES: return function values(){ return new Constructor(this, kind); };
    } return function entries(){ return new Constructor(this, kind); };
  };
  var TAG        = NAME + ' Iterator'
    , DEF_VALUES = DEFAULT == VALUES
    , VALUES_BUG = false
    , proto      = Base.prototype
    , $native    = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]
    , $default   = $native || getMethod(DEFAULT)
    , $entries   = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined
    , $anyNative = NAME == 'Array' ? proto.entries || $native : $native
    , methods, key, IteratorPrototype;
  // Fix native
  if($anyNative){
    IteratorPrototype = getPrototypeOf($anyNative.call(new Base));
    if(IteratorPrototype !== Object.prototype){
      // Set @@toStringTag to native iterators
      setToStringTag(IteratorPrototype, TAG, true);
      // fix for some old engines
      if(!LIBRARY && !has(IteratorPrototype, ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis);
    }
  }
  // fix Array#{values, @@iterator}.name in V8 / FF
  if(DEF_VALUES && $native && $native.name !== VALUES){
    VALUES_BUG = true;
    $default = function values(){ return $native.call(this); };
  }
  // Define iterator
  if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){
    hide(proto, ITERATOR, $default);
  }
  // Plug for library
  Iterators[NAME] = $default;
  Iterators[TAG]  = returnThis;
  if(DEFAULT){
    methods = {
      values:  DEF_VALUES ? $default : getMethod(VALUES),
      keys:    IS_SET     ? $default : getMethod(KEYS),
      entries: $entries
    };
    if(FORCED)for(key in methods){
      if(!(key in proto))redefine(proto, key, methods[key]);
    } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
  }
  return methods;
};
},{"./_export":150,"./_has":157,"./_hide":158,"./_iter-create":170,"./_iterators":174,"./_library":176,"./_object-gpo":192,"./_redefine":205,"./_set-to-string-tag":210,"./_wks":235}],172:[function(require,module,exports){
var ITERATOR     = require('./_wks')('iterator')
  , SAFE_CLOSING = false;

try {
  var riter = [7][ITERATOR]();
  riter['return'] = function(){ SAFE_CLOSING = true; };
  Array.from(riter, function(){ throw 2; });
} catch(e){ /* empty */ }

module.exports = function(exec, skipClosing){
  if(!skipClosing && !SAFE_CLOSING)return false;
  var safe = false;
  try {
    var arr  = [7]
      , iter = arr[ITERATOR]();
    iter.next = function(){ return {done: safe = true}; };
    arr[ITERATOR] = function(){ return iter; };
    exec(arr);
  } catch(e){ /* empty */ }
  return safe;
};
},{"./_wks":235}],173:[function(require,module,exports){
module.exports = function(done, value){
  return {value: value, done: !!done};
};
},{}],174:[function(require,module,exports){
module.exports = {};
},{}],175:[function(require,module,exports){
var getKeys   = require('./_object-keys')
  , toIObject = require('./_to-iobject');
module.exports = function(object, el){
  var O      = toIObject(object)
    , keys   = getKeys(O)
    , length = keys.length
    , index  = 0
    , key;
  while(length > index)if(O[key = keys[index++]] === el)return key;
};
},{"./_object-keys":194,"./_to-iobject":225}],176:[function(require,module,exports){
module.exports = false;
},{}],177:[function(require,module,exports){
// 20.2.2.14 Math.expm1(x)
var $expm1 = Math.expm1;
module.exports = (!$expm1
  // Old FF bug
  || $expm1(10) > 22025.465794806719 || $expm1(10) < 22025.4657948067165168
  // Tor Browser bug
  || $expm1(-2e-17) != -2e-17
) ? function expm1(x){
  return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : Math.exp(x) - 1;
} : $expm1;
},{}],178:[function(require,module,exports){
// 20.2.2.20 Math.log1p(x)
module.exports = Math.log1p || function log1p(x){
  return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : Math.log(1 + x);
};
},{}],179:[function(require,module,exports){
// 20.2.2.28 Math.sign(x)
module.exports = Math.sign || function sign(x){
  return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1;
};
},{}],180:[function(require,module,exports){
var META     = require('./_uid')('meta')
  , isObject = require('./_is-object')
  , has      = require('./_has')
  , setDesc  = require('./_object-dp').f
  , id       = 0;
var isExtensible = Object.isExtensible || function(){
  return true;
};
var FREEZE = !require('./_fails')(function(){
  return isExtensible(Object.preventExtensions({}));
});
var setMeta = function(it){
  setDesc(it, META, {value: {
    i: 'O' + ++id, // object ID
    w: {}          // weak collections IDs
  }});
};
var fastKey = function(it, create){
  // return primitive with prefix
  if(!isObject(it))return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
  if(!has(it, META)){
    // can't set metadata to uncaught frozen object
    if(!isExtensible(it))return 'F';
    // not necessary to add metadata
    if(!create)return 'E';
    // add missing metadata
    setMeta(it);
  // return object ID
  } return it[META].i;
};
var getWeak = function(it, create){
  if(!has(it, META)){
    // can't set metadata to uncaught frozen object
    if(!isExtensible(it))return true;
    // not necessary to add metadata
    if(!create)return false;
    // add missing metadata
    setMeta(it);
  // return hash weak collections IDs
  } return it[META].w;
};
// add metadata on freeze-family methods calling
var onFreeze = function(it){
  if(FREEZE && meta.NEED && isExtensible(it) && !has(it, META))setMeta(it);
  return it;
};
var meta = module.exports = {
  KEY:      META,
  NEED:     false,
  fastKey:  fastKey,
  getWeak:  getWeak,
  onFreeze: onFreeze
};
},{"./_fails":152,"./_has":157,"./_is-object":167,"./_object-dp":185,"./_uid":232}],181:[function(require,module,exports){
var Map     = require('./es6.map')
  , $export = require('./_export')
  , shared  = require('./_shared')('metadata')
  , store   = shared.store || (shared.store = new (require('./es6.weak-map')));

var getOrCreateMetadataMap = function(target, targetKey, create){
  var targetMetadata = store.get(target);
  if(!targetMetadata){
    if(!create)return undefined;
    store.set(target, targetMetadata = new Map);
  }
  var keyMetadata = targetMetadata.get(targetKey);
  if(!keyMetadata){
    if(!create)return undefined;
    targetMetadata.set(targetKey, keyMetadata = new Map);
  } return keyMetadata;
};
var ordinaryHasOwnMetadata = function(MetadataKey, O, P){
  var metadataMap = getOrCreateMetadataMap(O, P, false);
  return metadataMap === undefined ? false : metadataMap.has(MetadataKey);
};
var ordinaryGetOwnMetadata = function(MetadataKey, O, P){
  var metadataMap = getOrCreateMetadataMap(O, P, false);
  return metadataMap === undefined ? undefined : metadataMap.get(MetadataKey);
};
var ordinaryDefineOwnMetadata = function(MetadataKey, MetadataValue, O, P){
  getOrCreateMetadataMap(O, P, true).set(MetadataKey, MetadataValue);
};
var ordinaryOwnMetadataKeys = function(target, targetKey){
  var metadataMap = getOrCreateMetadataMap(target, targetKey, false)
    , keys        = [];
  if(metadataMap)metadataMap.forEach(function(_, key){ keys.push(key); });
  return keys;
};
var toMetaKey = function(it){
  return it === undefined || typeof it == 'symbol' ? it : String(it);
};
var exp = function(O){
  $export($export.S, 'Reflect', O);
};

module.exports = {
  store: store,
  map: getOrCreateMetadataMap,
  has: ordinaryHasOwnMetadata,
  get: ordinaryGetOwnMetadata,
  set: ordinaryDefineOwnMetadata,
  keys: ordinaryOwnMetadataKeys,
  key: toMetaKey,
  exp: exp
};
},{"./_export":150,"./_shared":212,"./es6.map":267,"./es6.weak-map":373}],182:[function(require,module,exports){
var global    = require('./_global')
  , macrotask = require('./_task').set
  , Observer  = global.MutationObserver || global.WebKitMutationObserver
  , process   = global.process
  , Promise   = global.Promise
  , isNode    = require('./_cof')(process) == 'process';

module.exports = function(){
  var head, last, notify;

  var flush = function(){
    var parent, fn;
    if(isNode && (parent = process.domain))parent.exit();
    while(head){
      fn   = head.fn;
      head = head.next;
      try {
        fn();
      } catch(e){
        if(head)notify();
        else last = undefined;
        throw e;
      }
    } last = undefined;
    if(parent)parent.enter();
  };

  // Node.js
  if(isNode){
    notify = function(){
      process.nextTick(flush);
    };
  // browsers with MutationObserver
  } else if(Observer){
    var toggle = true
      , node   = document.createTextNode('');
    new Observer(flush).observe(node, {characterData: true}); // eslint-disable-line no-new
    notify = function(){
      node.data = toggle = !toggle;
    };
  // environments with maybe non-completely correct, but existent Promise
  } else if(Promise && Promise.resolve){
    var promise = Promise.resolve();
    notify = function(){
      promise.then(flush);
    };
  // for other environments - macrotask based on:
  // - setImmediate
  // - MessageChannel
  // - window.postMessag
  // - onreadystatechange
  // - setTimeout
  } else {
    notify = function(){
      // strange IE + webpack dev server bug - use .call(global)
      macrotask.call(global, flush);
    };
  }

  return function(fn){
    var task = {fn: fn, next: undefined};
    if(last)last.next = task;
    if(!head){
      head = task;
      notify();
    } last = task;
  };
};
},{"./_cof":136,"./_global":156,"./_task":222}],183:[function(require,module,exports){
'use strict';
// 19.1.2.1 Object.assign(target, source, ...)
var getKeys  = require('./_object-keys')
  , gOPS     = require('./_object-gops')
  , pIE      = require('./_object-pie')
  , toObject = require('./_to-object')
  , IObject  = require('./_iobject')
  , $assign  = Object.assign;

// should work with symbols and should have deterministic property order (V8 bug)
module.exports = !$assign || require('./_fails')(function(){
  var A = {}
    , B = {}
    , S = Symbol()
    , K = 'abcdefghijklmnopqrst';
  A[S] = 7;
  K.split('').forEach(function(k){ B[k] = k; });
  return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
}) ? function assign(target, source){ // eslint-disable-line no-unused-vars
  var T     = toObject(target)
    , aLen  = arguments.length
    , index = 1
    , getSymbols = gOPS.f
    , isEnum     = pIE.f;
  while(aLen > index){
    var S      = IObject(arguments[index++])
      , keys   = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S)
      , length = keys.length
      , j      = 0
      , key;
    while(length > j)if(isEnum.call(S, key = keys[j++]))T[key] = S[key];
  } return T;
} : $assign;
},{"./_fails":152,"./_iobject":163,"./_object-gops":191,"./_object-keys":194,"./_object-pie":195,"./_to-object":227}],184:[function(require,module,exports){
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
var anObject    = require('./_an-object')
  , dPs         = require('./_object-dps')
  , enumBugKeys = require('./_enum-bug-keys')
  , IE_PROTO    = require('./_shared-key')('IE_PROTO')
  , Empty       = function(){ /* empty */ }
  , PROTOTYPE   = 'prototype';

// Create object with fake `null` prototype: use iframe Object with cleared prototype
var createDict = function(){
  // Thrash, waste and sodomy: IE GC bug
  var iframe = require('./_dom-create')('iframe')
    , i      = enumBugKeys.length
    , lt     = '<'
    , gt     = '>'
    , iframeDocument;
  iframe.style.display = 'none';
  require('./_html').appendChild(iframe);
  iframe.src = 'javascript:'; // eslint-disable-line no-script-url
  // createDict = iframe.contentWindow.Object;
  // html.removeChild(iframe);
  iframeDocument = iframe.contentWindow.document;
  iframeDocument.open();
  iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
  iframeDocument.close();
  createDict = iframeDocument.F;
  while(i--)delete createDict[PROTOTYPE][enumBugKeys[i]];
  return createDict();
};

module.exports = Object.create || function create(O, Properties){
  var result;
  if(O !== null){
    Empty[PROTOTYPE] = anObject(O);
    result = new Empty;
    Empty[PROTOTYPE] = null;
    // add "__proto__" for Object.getPrototypeOf polyfill
    result[IE_PROTO] = O;
  } else result = createDict();
  return Properties === undefined ? result : dPs(result, Properties);
};

},{"./_an-object":125,"./_dom-create":147,"./_enum-bug-keys":148,"./_html":159,"./_object-dps":186,"./_shared-key":211}],185:[function(require,module,exports){
var anObject       = require('./_an-object')
  , IE8_DOM_DEFINE = require('./_ie8-dom-define')
  , toPrimitive    = require('./_to-primitive')
  , dP             = Object.defineProperty;

exports.f = require('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes){
  anObject(O);
  P = toPrimitive(P, true);
  anObject(Attributes);
  if(IE8_DOM_DEFINE)try {
    return dP(O, P, Attributes);
  } catch(e){ /* empty */ }
  if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!');
  if('value' in Attributes)O[P] = Attributes.value;
  return O;
};
},{"./_an-object":125,"./_descriptors":146,"./_ie8-dom-define":160,"./_to-primitive":228}],186:[function(require,module,exports){
var dP       = require('./_object-dp')
  , anObject = require('./_an-object')
  , getKeys  = require('./_object-keys');

module.exports = require('./_descriptors') ? Object.defineProperties : function defineProperties(O, Properties){
  anObject(O);
  var keys   = getKeys(Properties)
    , length = keys.length
    , i = 0
    , P;
  while(length > i)dP.f(O, P = keys[i++], Properties[P]);
  return O;
};
},{"./_an-object":125,"./_descriptors":146,"./_object-dp":185,"./_object-keys":194}],187:[function(require,module,exports){
// Forced replacement prototype accessors methods
module.exports = require('./_library')|| !require('./_fails')(function(){
  var K = Math.random();
  // In FF throws only define methods
  __defineSetter__.call(null, K, function(){ /* empty */});
  delete require('./_global')[K];
});
},{"./_fails":152,"./_global":156,"./_library":176}],188:[function(require,module,exports){
var pIE            = require('./_object-pie')
  , createDesc     = require('./_property-desc')
  , toIObject      = require('./_to-iobject')
  , toPrimitive    = require('./_to-primitive')
  , has            = require('./_has')
  , IE8_DOM_DEFINE = require('./_ie8-dom-define')
  , gOPD           = Object.getOwnPropertyDescriptor;

exports.f = require('./_descriptors') ? gOPD : function getOwnPropertyDescriptor(O, P){
  O = toIObject(O);
  P = toPrimitive(P, true);
  if(IE8_DOM_DEFINE)try {
    return gOPD(O, P);
  } catch(e){ /* empty */ }
  if(has(O, P))return createDesc(!pIE.f.call(O, P), O[P]);
};
},{"./_descriptors":146,"./_has":157,"./_ie8-dom-define":160,"./_object-pie":195,"./_property-desc":203,"./_to-iobject":225,"./_to-primitive":228}],189:[function(require,module,exports){
// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
var toIObject = require('./_to-iobject')
  , gOPN      = require('./_object-gopn').f
  , toString  = {}.toString;

var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
  ? Object.getOwnPropertyNames(window) : [];

var getWindowNames = function(it){
  try {
    return gOPN(it);
  } catch(e){
    return windowNames.slice();
  }
};

module.exports.f = function getOwnPropertyNames(it){
  return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));
};

},{"./_object-gopn":190,"./_to-iobject":225}],190:[function(require,module,exports){
// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
var $keys      = require('./_object-keys-internal')
  , hiddenKeys = require('./_enum-bug-keys').concat('length', 'prototype');

exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O){
  return $keys(O, hiddenKeys);
};
},{"./_enum-bug-keys":148,"./_object-keys-internal":193}],191:[function(require,module,exports){
exports.f = Object.getOwnPropertySymbols;
},{}],192:[function(require,module,exports){
// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
var has         = require('./_has')
  , toObject    = require('./_to-object')
  , IE_PROTO    = require('./_shared-key')('IE_PROTO')
  , ObjectProto = Object.prototype;

module.exports = Object.getPrototypeOf || function(O){
  O = toObject(O);
  if(has(O, IE_PROTO))return O[IE_PROTO];
  if(typeof O.constructor == 'function' && O instanceof O.constructor){
    return O.constructor.prototype;
  } return O instanceof Object ? ObjectProto : null;
};
},{"./_has":157,"./_shared-key":211,"./_to-object":227}],193:[function(require,module,exports){
var has          = require('./_has')
  , toIObject    = require('./_to-iobject')
  , arrayIndexOf = require('./_array-includes')(false)
  , IE_PROTO     = require('./_shared-key')('IE_PROTO');

module.exports = function(object, names){
  var O      = toIObject(object)
    , i      = 0
    , result = []
    , key;
  for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key);
  // Don't enum bug & hidden keys
  while(names.length > i)if(has(O, key = names[i++])){
    ~arrayIndexOf(result, key) || result.push(key);
  }
  return result;
};
},{"./_array-includes":129,"./_has":157,"./_shared-key":211,"./_to-iobject":225}],194:[function(require,module,exports){
// 19.1.2.14 / 15.2.3.14 Object.keys(O)
var $keys       = require('./_object-keys-internal')
  , enumBugKeys = require('./_enum-bug-keys');

module.exports = Object.keys || function keys(O){
  return $keys(O, enumBugKeys);
};
},{"./_enum-bug-keys":148,"./_object-keys-internal":193}],195:[function(require,module,exports){
exports.f = {}.propertyIsEnumerable;
},{}],196:[function(require,module,exports){
// most Object methods by ES6 should accept primitives
var $export = require('./_export')
  , core    = require('./_core')
  , fails   = require('./_fails');
module.exports = function(KEY, exec){
  var fn  = (core.Object || {})[KEY] || Object[KEY]
    , exp = {};
  exp[KEY] = exec(fn);
  $export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp);
};
},{"./_core":141,"./_export":150,"./_fails":152}],197:[function(require,module,exports){
var getKeys   = require('./_object-keys')
  , toIObject = require('./_to-iobject')
  , isEnum    = require('./_object-pie').f;
module.exports = function(isEntries){
  return function(it){
    var O      = toIObject(it)
      , keys   = getKeys(O)
      , length = keys.length
      , i      = 0
      , result = []
      , key;
    while(length > i)if(isEnum.call(O, key = keys[i++])){
      result.push(isEntries ? [key, O[key]] : O[key]);
    } return result;
  };
};
},{"./_object-keys":194,"./_object-pie":195,"./_to-iobject":225}],198:[function(require,module,exports){
// all object keys, includes non-enumerable and symbols
var gOPN     = require('./_object-gopn')
  , gOPS     = require('./_object-gops')
  , anObject = require('./_an-object')
  , Reflect  = require('./_global').Reflect;
module.exports = Reflect && Reflect.ownKeys || function ownKeys(it){
  var keys       = gOPN.f(anObject(it))
    , getSymbols = gOPS.f;
  return getSymbols ? keys.concat(getSymbols(it)) : keys;
};
},{"./_an-object":125,"./_global":156,"./_object-gopn":190,"./_object-gops":191}],199:[function(require,module,exports){
var $parseFloat = require('./_global').parseFloat
  , $trim       = require('./_string-trim').trim;

module.exports = 1 / $parseFloat(require('./_string-ws') + '-0') !== -Infinity ? function parseFloat(str){
  var string = $trim(String(str), 3)
    , result = $parseFloat(string);
  return result === 0 && string.charAt(0) == '-' ? -0 : result;
} : $parseFloat;
},{"./_global":156,"./_string-trim":220,"./_string-ws":221}],200:[function(require,module,exports){
var $parseInt = require('./_global').parseInt
  , $trim     = require('./_string-trim').trim
  , ws        = require('./_string-ws')
  , hex       = /^[\-+]?0[xX]/;

module.exports = $parseInt(ws + '08') !== 8 || $parseInt(ws + '0x16') !== 22 ? function parseInt(str, radix){
  var string = $trim(String(str), 3);
  return $parseInt(string, (radix >>> 0) || (hex.test(string) ? 16 : 10));
} : $parseInt;
},{"./_global":156,"./_string-trim":220,"./_string-ws":221}],201:[function(require,module,exports){
'use strict';
var path      = require('./_path')
  , invoke    = require('./_invoke')
  , aFunction = require('./_a-function');
module.exports = function(/* ...pargs */){
  var fn     = aFunction(this)
    , length = arguments.length
    , pargs  = Array(length)
    , i      = 0
    , _      = path._
    , holder = false;
  while(length > i)if((pargs[i] = arguments[i++]) === _)holder = true;
  return function(/* ...args */){
    var that = this
      , aLen = arguments.length
      , j = 0, k = 0, args;
    if(!holder && !aLen)return invoke(fn, pargs, that);
    args = pargs.slice();
    if(holder)for(;length > j; j++)if(args[j] === _)args[j] = arguments[k++];
    while(aLen > k)args.push(arguments[k++]);
    return invoke(fn, args, that);
  };
};
},{"./_a-function":121,"./_invoke":162,"./_path":202}],202:[function(require,module,exports){
module.exports = require('./_global');
},{"./_global":156}],203:[function(require,module,exports){
module.exports = function(bitmap, value){
  return {
    enumerable  : !(bitmap & 1),
    configurable: !(bitmap & 2),
    writable    : !(bitmap & 4),
    value       : value
  };
};
},{}],204:[function(require,module,exports){
var redefine = require('./_redefine');
module.exports = function(target, src, safe){
  for(var key in src)redefine(target, key, src[key], safe);
  return target;
};
},{"./_redefine":205}],205:[function(require,module,exports){
var global    = require('./_global')
  , hide      = require('./_hide')
  , has       = require('./_has')
  , SRC       = require('./_uid')('src')
  , TO_STRING = 'toString'
  , $toString = Function[TO_STRING]
  , TPL       = ('' + $toString).split(TO_STRING);

require('./_core').inspectSource = function(it){
  return $toString.call(it);
};

(module.exports = function(O, key, val, safe){
  var isFunction = typeof val == 'function';
  if(isFunction)has(val, 'name') || hide(val, 'name', key);
  if(O[key] === val)return;
  if(isFunction)has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));
  if(O === global){
    O[key] = val;
  } else {
    if(!safe){
      delete O[key];
      hide(O, key, val);
    } else {
      if(O[key])O[key] = val;
      else hide(O, key, val);
    }
  }
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
})(Function.prototype, TO_STRING, function toString(){
  return typeof this == 'function' && this[SRC] || $toString.call(this);
});
},{"./_core":141,"./_global":156,"./_has":157,"./_hide":158,"./_uid":232}],206:[function(require,module,exports){
module.exports = function(regExp, replace){
  var replacer = replace === Object(replace) ? function(part){
    return replace[part];
  } : replace;
  return function(it){
    return String(it).replace(regExp, replacer);
  };
};
},{}],207:[function(require,module,exports){
// 7.2.9 SameValue(x, y)
module.exports = Object.is || function is(x, y){
  return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
};
},{}],208:[function(require,module,exports){
// Works with __proto__ only. Old v8 can't work with null proto objects.
/* eslint-disable no-proto */
var isObject = require('./_is-object')
  , anObject = require('./_an-object');
var check = function(O, proto){
  anObject(O);
  if(!isObject(proto) && proto !== null)throw TypeError(proto + ": can't set as prototype!");
};
module.exports = {
  set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line
    function(test, buggy, set){
      try {
        set = require('./_ctx')(Function.call, require('./_object-gopd').f(Object.prototype, '__proto__').set, 2);
        set(test, []);
        buggy = !(test instanceof Array);
      } catch(e){ buggy = true; }
      return function setPrototypeOf(O, proto){
        check(O, proto);
        if(buggy)O.__proto__ = proto;
        else set(O, proto);
        return O;
      };
    }({}, false) : undefined),
  check: check
};
},{"./_an-object":125,"./_ctx":143,"./_is-object":167,"./_object-gopd":188}],209:[function(require,module,exports){
'use strict';
var global      = require('./_global')
  , dP          = require('./_object-dp')
  , DESCRIPTORS = require('./_descriptors')
  , SPECIES     = require('./_wks')('species');

module.exports = function(KEY){
  var C = global[KEY];
  if(DESCRIPTORS && C && !C[SPECIES])dP.f(C, SPECIES, {
    configurable: true,
    get: function(){ return this; }
  });
};
},{"./_descriptors":146,"./_global":156,"./_object-dp":185,"./_wks":235}],210:[function(require,module,exports){
var def = require('./_object-dp').f
  , has = require('./_has')
  , TAG = require('./_wks')('toStringTag');

module.exports = function(it, tag, stat){
  if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag});
};
},{"./_has":157,"./_object-dp":185,"./_wks":235}],211:[function(require,module,exports){
var shared = require('./_shared')('keys')
  , uid    = require('./_uid');
module.exports = function(key){
  return shared[key] || (shared[key] = uid(key));
};
},{"./_shared":212,"./_uid":232}],212:[function(require,module,exports){
var global = require('./_global')
  , SHARED = '__core-js_shared__'
  , store  = global[SHARED] || (global[SHARED] = {});
module.exports = function(key){
  return store[key] || (store[key] = {});
};
},{"./_global":156}],213:[function(require,module,exports){
// 7.3.20 SpeciesConstructor(O, defaultConstructor)
var anObject  = require('./_an-object')
  , aFunction = require('./_a-function')
  , SPECIES   = require('./_wks')('species');
module.exports = function(O, D){
  var C = anObject(O).constructor, S;
  return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S);
};
},{"./_a-function":121,"./_an-object":125,"./_wks":235}],214:[function(require,module,exports){
var fails = require('./_fails');

module.exports = function(method, arg){
  return !!method && fails(function(){
    arg ? method.call(null, function(){}, 1) : method.call(null);
  });
};
},{"./_fails":152}],215:[function(require,module,exports){
var toInteger = require('./_to-integer')
  , defined   = require('./_defined');
// true  -> String#at
// false -> String#codePointAt
module.exports = function(TO_STRING){
  return function(that, pos){
    var s = String(defined(that))
      , i = toInteger(pos)
      , l = s.length
      , a, b;
    if(i < 0 || i >= l)return TO_STRING ? '' : undefined;
    a = s.charCodeAt(i);
    return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
      ? TO_STRING ? s.charAt(i) : a
      : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
  };
};
},{"./_defined":145,"./_to-integer":224}],216:[function(require,module,exports){
// helper for String#{startsWith, endsWith, includes}
var isRegExp = require('./_is-regexp')
  , defined  = require('./_defined');

module.exports = function(that, searchString, NAME){
  if(isRegExp(searchString))throw TypeError('String#' + NAME + " doesn't accept regex!");
  return String(defined(that));
};
},{"./_defined":145,"./_is-regexp":168}],217:[function(require,module,exports){
var $export = require('./_export')
  , fails   = require('./_fails')
  , defined = require('./_defined')
  , quot    = /"/g;
// B.2.3.2.1 CreateHTML(string, tag, attribute, value)
var createHTML = function(string, tag, attribute, value) {
  var S  = String(defined(string))
    , p1 = '<' + tag;
  if(attribute !== '')p1 += ' ' + attribute + '="' + String(value).replace(quot, '&quot;') + '"';
  return p1 + '>' + S + '</' + tag + '>';
};
module.exports = function(NAME, exec){
  var O = {};
  O[NAME] = exec(createHTML);
  $export($export.P + $export.F * fails(function(){
    var test = ''[NAME]('"');
    return test !== test.toLowerCase() || test.split('"').length > 3;
  }), 'String', O);
};
},{"./_defined":145,"./_export":150,"./_fails":152}],218:[function(require,module,exports){
// https://github.com/tc39/proposal-string-pad-start-end
var toLength = require('./_to-length')
  , repeat   = require('./_string-repeat')
  , defined  = require('./_defined');

module.exports = function(that, maxLength, fillString, left){
  var S            = String(defined(that))
    , stringLength = S.length
    , fillStr      = fillString === undefined ? ' ' : String(fillString)
    , intMaxLength = toLength(maxLength);
  if(intMaxLength <= stringLength || fillStr == '')return S;
  var fillLen = intMaxLength - stringLength
    , stringFiller = repeat.call(fillStr, Math.ceil(fillLen / fillStr.length));
  if(stringFiller.length > fillLen)stringFiller = stringFiller.slice(0, fillLen);
  return left ? stringFiller + S : S + stringFiller;
};

},{"./_defined":145,"./_string-repeat":219,"./_to-length":226}],219:[function(require,module,exports){
'use strict';
var toInteger = require('./_to-integer')
  , defined   = require('./_defined');

module.exports = function repeat(count){
  var str = String(defined(this))
    , res = ''
    , n   = toInteger(count);
  if(n < 0 || n == Infinity)throw RangeError("Count can't be negative");
  for(;n > 0; (n >>>= 1) && (str += str))if(n & 1)res += str;
  return res;
};
},{"./_defined":145,"./_to-integer":224}],220:[function(require,module,exports){
var $export = require('./_export')
  , defined = require('./_defined')
  , fails   = require('./_fails')
  , spaces  = require('./_string-ws')
  , space   = '[' + spaces + ']'
  , non     = '\u200b\u0085'
  , ltrim   = RegExp('^' + space + space + '*')
  , rtrim   = RegExp(space + space + '*$');

var exporter = function(KEY, exec, ALIAS){
  var exp   = {};
  var FORCE = fails(function(){
    return !!spaces[KEY]() || non[KEY]() != non;
  });
  var fn = exp[KEY] = FORCE ? exec(trim) : spaces[KEY];
  if(ALIAS)exp[ALIAS] = fn;
  $export($export.P + $export.F * FORCE, 'String', exp);
};

// 1 -> String#trimLeft
// 2 -> String#trimRight
// 3 -> String#trim
var trim = exporter.trim = function(string, TYPE){
  string = String(defined(string));
  if(TYPE & 1)string = string.replace(ltrim, '');
  if(TYPE & 2)string = string.replace(rtrim, '');
  return string;
};

module.exports = exporter;
},{"./_defined":145,"./_export":150,"./_fails":152,"./_string-ws":221}],221:[function(require,module,exports){
module.exports = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' +
  '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
},{}],222:[function(require,module,exports){
var ctx                = require('./_ctx')
  , invoke             = require('./_invoke')
  , html               = require('./_html')
  , cel                = require('./_dom-create')
  , global             = require('./_global')
  , process            = global.process
  , setTask            = global.setImmediate
  , clearTask          = global.clearImmediate
  , MessageChannel     = global.MessageChannel
  , counter            = 0
  , queue              = {}
  , ONREADYSTATECHANGE = 'onreadystatechange'
  , defer, channel, port;
var run = function(){
  var id = +this;
  if(queue.hasOwnProperty(id)){
    var fn = queue[id];
    delete queue[id];
    fn();
  }
};
var listener = function(event){
  run.call(event.data);
};
// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
if(!setTask || !clearTask){
  setTask = function setImmediate(fn){
    var args = [], i = 1;
    while(arguments.length > i)args.push(arguments[i++]);
    queue[++counter] = function(){
      invoke(typeof fn == 'function' ? fn : Function(fn), args);
    };
    defer(counter);
    return counter;
  };
  clearTask = function clearImmediate(id){
    delete queue[id];
  };
  // Node.js 0.8-
  if(require('./_cof')(process) == 'process'){
    defer = function(id){
      process.nextTick(ctx(run, id, 1));
    };
  // Browsers with MessageChannel, includes WebWorkers
  } else if(MessageChannel){
    channel = new MessageChannel;
    port    = channel.port2;
    channel.port1.onmessage = listener;
    defer = ctx(port.postMessage, port, 1);
  // Browsers with postMessage, skip WebWorkers
  // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
  } else if(global.addEventListener && typeof postMessage == 'function' && !global.importScripts){
    defer = function(id){
      global.postMessage(id + '', '*');
    };
    global.addEventListener('message', listener, false);
  // IE8-
  } else if(ONREADYSTATECHANGE in cel('script')){
    defer = function(id){
      html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function(){
        html.removeChild(this);
        run.call(id);
      };
    };
  // Rest old browsers
  } else {
    defer = function(id){
      setTimeout(ctx(run, id, 1), 0);
    };
  }
}
module.exports = {
  set:   setTask,
  clear: clearTask
};
},{"./_cof":136,"./_ctx":143,"./_dom-create":147,"./_global":156,"./_html":159,"./_invoke":162}],223:[function(require,module,exports){
var toInteger = require('./_to-integer')
  , max       = Math.max
  , min       = Math.min;
module.exports = function(index, length){
  index = toInteger(index);
  return index < 0 ? max(index + length, 0) : min(index, length);
};
},{"./_to-integer":224}],224:[function(require,module,exports){
// 7.1.4 ToInteger
var ceil  = Math.ceil
  , floor = Math.floor;
module.exports = function(it){
  return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
};
},{}],225:[function(require,module,exports){
// to indexed object, toObject with fallback for non-array-like ES3 strings
var IObject = require('./_iobject')
  , defined = require('./_defined');
module.exports = function(it){
  return IObject(defined(it));
};
},{"./_defined":145,"./_iobject":163}],226:[function(require,module,exports){
// 7.1.15 ToLength
var toInteger = require('./_to-integer')
  , min       = Math.min;
module.exports = function(it){
  return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
};
},{"./_to-integer":224}],227:[function(require,module,exports){
// 7.1.13 ToObject(argument)
var defined = require('./_defined');
module.exports = function(it){
  return Object(defined(it));
};
},{"./_defined":145}],228:[function(require,module,exports){
// 7.1.1 ToPrimitive(input [, PreferredType])
var isObject = require('./_is-object');
// instead of the ES6 spec version, we didn't implement @@toPrimitive case
// and the second argument - flag - preferred type is a string
module.exports = function(it, S){
  if(!isObject(it))return it;
  var fn, val;
  if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
  if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val;
  if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
  throw TypeError("Can't convert object to primitive value");
};
},{"./_is-object":167}],229:[function(require,module,exports){
'use strict';
if(require('./_descriptors')){
  var LIBRARY             = require('./_library')
    , global              = require('./_global')
    , fails               = require('./_fails')
    , $export             = require('./_export')
    , $typed              = require('./_typed')
    , $buffer             = require('./_typed-buffer')
    , ctx                 = require('./_ctx')
    , anInstance          = require('./_an-instance')
    , propertyDesc        = require('./_property-desc')
    , hide                = require('./_hide')
    , redefineAll         = require('./_redefine-all')
    , toInteger           = require('./_to-integer')
    , toLength            = require('./_to-length')
    , toIndex             = require('./_to-index')
    , toPrimitive         = require('./_to-primitive')
    , has                 = require('./_has')
    , same                = require('./_same-value')
    , classof             = require('./_classof')
    , isObject            = require('./_is-object')
    , toObject            = require('./_to-object')
    , isArrayIter         = require('./_is-array-iter')
    , create              = require('./_object-create')
    , getPrototypeOf      = require('./_object-gpo')
    , gOPN                = require('./_object-gopn').f
    , getIterFn           = require('./core.get-iterator-method')
    , uid                 = require('./_uid')
    , wks                 = require('./_wks')
    , createArrayMethod   = require('./_array-methods')
    , createArrayIncludes = require('./_array-includes')
    , speciesConstructor  = require('./_species-constructor')
    , ArrayIterators      = require('./es6.array.iterator')
    , Iterators           = require('./_iterators')
    , $iterDetect         = require('./_iter-detect')
    , setSpecies          = require('./_set-species')
    , arrayFill           = require('./_array-fill')
    , arrayCopyWithin     = require('./_array-copy-within')
    , $DP                 = require('./_object-dp')
    , $GOPD               = require('./_object-gopd')
    , dP                  = $DP.f
    , gOPD                = $GOPD.f
    , RangeError          = global.RangeError
    , TypeError           = global.TypeError
    , Uint8Array          = global.Uint8Array
    , ARRAY_BUFFER        = 'ArrayBuffer'
    , SHARED_BUFFER       = 'Shared' + ARRAY_BUFFER
    , BYTES_PER_ELEMENT   = 'BYTES_PER_ELEMENT'
    , PROTOTYPE           = 'prototype'
    , ArrayProto          = Array[PROTOTYPE]
    , $ArrayBuffer        = $buffer.ArrayBuffer
    , $DataView           = $buffer.DataView
    , arrayForEach        = createArrayMethod(0)
    , arrayFilter         = createArrayMethod(2)
    , arraySome           = createArrayMethod(3)
    , arrayEvery          = createArrayMethod(4)
    , arrayFind           = createArrayMethod(5)
    , arrayFindIndex      = createArrayMethod(6)
    , arrayIncludes       = createArrayIncludes(true)
    , arrayIndexOf        = createArrayIncludes(false)
    , arrayValues         = ArrayIterators.values
    , arrayKeys           = ArrayIterators.keys
    , arrayEntries        = ArrayIterators.entries
    , arrayLastIndexOf    = ArrayProto.lastIndexOf
    , arrayReduce         = ArrayProto.reduce
    , arrayReduceRight    = ArrayProto.reduceRight
    , arrayJoin           = ArrayProto.join
    , arraySort           = ArrayProto.sort
    , arraySlice          = ArrayProto.slice
    , arrayToString       = ArrayProto.toString
    , arrayToLocaleString = ArrayProto.toLocaleString
    , ITERATOR            = wks('iterator')
    , TAG                 = wks('toStringTag')
    , TYPED_CONSTRUCTOR   = uid('typed_constructor')
    , DEF_CONSTRUCTOR     = uid('def_constructor')
    , ALL_CONSTRUCTORS    = $typed.CONSTR
    , TYPED_ARRAY         = $typed.TYPED
    , VIEW                = $typed.VIEW
    , WRONG_LENGTH        = 'Wrong length!';

  var $map = createArrayMethod(1, function(O, length){
    return allocate(speciesConstructor(O, O[DEF_CONSTRUCTOR]), length);
  });

  var LITTLE_ENDIAN = fails(function(){
    return new Uint8Array(new Uint16Array([1]).buffer)[0] === 1;
  });

  var FORCED_SET = !!Uint8Array && !!Uint8Array[PROTOTYPE].set && fails(function(){
    new Uint8Array(1).set({});
  });

  var strictToLength = function(it, SAME){
    if(it === undefined)throw TypeError(WRONG_LENGTH);
    var number = +it
      , length = toLength(it);
    if(SAME && !same(number, length))throw RangeError(WRONG_LENGTH);
    return length;
  };

  var toOffset = function(it, BYTES){
    var offset = toInteger(it);
    if(offset < 0 || offset % BYTES)throw RangeError('Wrong offset!');
    return offset;
  };

  var validate = function(it){
    if(isObject(it) && TYPED_ARRAY in it)return it;
    throw TypeError(it + ' is not a typed array!');
  };

  var allocate = function(C, length){
    if(!(isObject(C) && TYPED_CONSTRUCTOR in C)){
      throw TypeError('It is not a typed array constructor!');
    } return new C(length);
  };

  var speciesFromList = function(O, list){
    return fromList(speciesConstructor(O, O[DEF_CONSTRUCTOR]), list);
  };

  var fromList = function(C, list){
    var index  = 0
      , length = list.length
      , result = allocate(C, length);
    while(length > index)result[index] = list[index++];
    return result;
  };

  var addGetter = function(it, key, internal){
    dP(it, key, {get: function(){ return this._d[internal]; }});
  };

  var $from = function from(source /*, mapfn, thisArg */){
    var O       = toObject(source)
      , aLen    = arguments.length
      , mapfn   = aLen > 1 ? arguments[1] : undefined
      , mapping = mapfn !== undefined
      , iterFn  = getIterFn(O)
      , i, length, values, result, step, iterator;
    if(iterFn != undefined && !isArrayIter(iterFn)){
      for(iterator = iterFn.call(O), values = [], i = 0; !(step = iterator.next()).done; i++){
        values.push(step.value);
      } O = values;
    }
    if(mapping && aLen > 2)mapfn = ctx(mapfn, arguments[2], 2);
    for(i = 0, length = toLength(O.length), result = allocate(this, length); length > i; i++){
      result[i] = mapping ? mapfn(O[i], i) : O[i];
    }
    return result;
  };

  var $of = function of(/*...items*/){
    var index  = 0
      , length = arguments.length
      , result = allocate(this, length);
    while(length > index)result[index] = arguments[index++];
    return result;
  };

  // iOS Safari 6.x fails here
  var TO_LOCALE_BUG = !!Uint8Array && fails(function(){ arrayToLocaleString.call(new Uint8Array(1)); });

  var $toLocaleString = function toLocaleString(){
    return arrayToLocaleString.apply(TO_LOCALE_BUG ? arraySlice.call(validate(this)) : validate(this), arguments);
  };

  var proto = {
    copyWithin: function copyWithin(target, start /*, end */){
      return arrayCopyWithin.call(validate(this), target, start, arguments.length > 2 ? arguments[2] : undefined);
    },
    every: function every(callbackfn /*, thisArg */){
      return arrayEvery(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
    },
    fill: function fill(value /*, start, end */){ // eslint-disable-line no-unused-vars
      return arrayFill.apply(validate(this), arguments);
    },
    filter: function filter(callbackfn /*, thisArg */){
      return speciesFromList(this, arrayFilter(validate(this), callbackfn,
        arguments.length > 1 ? arguments[1] : undefined));
    },
    find: function find(predicate /*, thisArg */){
      return arrayFind(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined);
    },
    findIndex: function findIndex(predicate /*, thisArg */){
      return arrayFindIndex(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined);
    },
    forEach: function forEach(callbackfn /*, thisArg */){
      arrayForEach(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
    },
    indexOf: function indexOf(searchElement /*, fromIndex */){
      return arrayIndexOf(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined);
    },
    includes: function includes(searchElement /*, fromIndex */){
      return arrayIncludes(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined);
    },
    join: function join(separator){ // eslint-disable-line no-unused-vars
      return arrayJoin.apply(validate(this), arguments);
    },
    lastIndexOf: function lastIndexOf(searchElement /*, fromIndex */){ // eslint-disable-line no-unused-vars
      return arrayLastIndexOf.apply(validate(this), arguments);
    },
    map: function map(mapfn /*, thisArg */){
      return $map(validate(this), mapfn, arguments.length > 1 ? arguments[1] : undefined);
    },
    reduce: function reduce(callbackfn /*, initialValue */){ // eslint-disable-line no-unused-vars
      return arrayReduce.apply(validate(this), arguments);
    },
    reduceRight: function reduceRight(callbackfn /*, initialValue */){ // eslint-disable-line no-unused-vars
      return arrayReduceRight.apply(validate(this), arguments);
    },
    reverse: function reverse(){
      var that   = this
        , length = validate(that).length
        , middle = Math.floor(length / 2)
        , index  = 0
        , value;
      while(index < middle){
        value         = that[index];
        that[index++] = that[--length];
        that[length]  = value;
      } return that;
    },
    some: function some(callbackfn /*, thisArg */){
      return arraySome(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
    },
    sort: function sort(comparefn){
      return arraySort.call(validate(this), comparefn);
    },
    subarray: function subarray(begin, end){
      var O      = validate(this)
        , length = O.length
        , $begin = toIndex(begin, length);
      return new (speciesConstructor(O, O[DEF_CONSTRUCTOR]))(
        O.buffer,
        O.byteOffset + $begin * O.BYTES_PER_ELEMENT,
        toLength((end === undefined ? length : toIndex(end, length)) - $begin)
      );
    }
  };

  var $slice = function slice(start, end){
    return speciesFromList(this, arraySlice.call(validate(this), start, end));
  };

  var $set = function set(arrayLike /*, offset */){
    validate(this);
    var offset = toOffset(arguments[1], 1)
      , length = this.length
      , src    = toObject(arrayLike)
      , len    = toLength(src.length)
      , index  = 0;
    if(len + offset > length)throw RangeError(WRONG_LENGTH);
    while(index < len)this[offset + index] = src[index++];
  };

  var $iterators = {
    entries: function entries(){
      return arrayEntries.call(validate(this));
    },
    keys: function keys(){
      return arrayKeys.call(validate(this));
    },
    values: function values(){
      return arrayValues.call(validate(this));
    }
  };

  var isTAIndex = function(target, key){
    return isObject(target)
      && target[TYPED_ARRAY]
      && typeof key != 'symbol'
      && key in target
      && String(+key) == String(key);
  };
  var $getDesc = function getOwnPropertyDescriptor(target, key){
    return isTAIndex(target, key = toPrimitive(key, true))
      ? propertyDesc(2, target[key])
      : gOPD(target, key);
  };
  var $setDesc = function defineProperty(target, key, desc){
    if(isTAIndex(target, key = toPrimitive(key, true))
      && isObject(desc)
      && has(desc, 'value')
      && !has(desc, 'get')
      && !has(desc, 'set')
      // TODO: add validation descriptor w/o calling accessors
      && !desc.configurable
      && (!has(desc, 'writable') || desc.writable)
      && (!has(desc, 'enumerable') || desc.enumerable)
    ){
      target[key] = desc.value;
      return target;
    } else return dP(target, key, desc);
  };

  if(!ALL_CONSTRUCTORS){
    $GOPD.f = $getDesc;
    $DP.f   = $setDesc;
  }

  $export($export.S + $export.F * !ALL_CONSTRUCTORS, 'Object', {
    getOwnPropertyDescriptor: $getDesc,
    defineProperty:           $setDesc
  });

  if(fails(function(){ arrayToString.call({}); })){
    arrayToString = arrayToLocaleString = function toString(){
      return arrayJoin.call(this);
    }
  }

  var $TypedArrayPrototype$ = redefineAll({}, proto);
  redefineAll($TypedArrayPrototype$, $iterators);
  hide($TypedArrayPrototype$, ITERATOR, $iterators.values);
  redefineAll($TypedArrayPrototype$, {
    slice:          $slice,
    set:            $set,
    constructor:    function(){ /* noop */ },
    toString:       arrayToString,
    toLocaleString: $toLocaleString
  });
  addGetter($TypedArrayPrototype$, 'buffer', 'b');
  addGetter($TypedArrayPrototype$, 'byteOffset', 'o');
  addGetter($TypedArrayPrototype$, 'byteLength', 'l');
  addGetter($TypedArrayPrototype$, 'length', 'e');
  dP($TypedArrayPrototype$, TAG, {
    get: function(){ return this[TYPED_ARRAY]; }
  });

  module.exports = function(KEY, BYTES, wrapper, CLAMPED){
    CLAMPED = !!CLAMPED;
    var NAME       = KEY + (CLAMPED ? 'Clamped' : '') + 'Array'
      , ISNT_UINT8 = NAME != 'Uint8Array'
      , GETTER     = 'get' + KEY
      , SETTER     = 'set' + KEY
      , TypedArray = global[NAME]
      , Base       = TypedArray || {}
      , TAC        = TypedArray && getPrototypeOf(TypedArray)
      , FORCED     = !TypedArray || !$typed.ABV
      , O          = {}
      , TypedArrayPrototype = TypedArray && TypedArray[PROTOTYPE];
    var getter = function(that, index){
      var data = that._d;
      return data.v[GETTER](index * BYTES + data.o, LITTLE_ENDIAN);
    };
    var setter = function(that, index, value){
      var data = that._d;
      if(CLAMPED)value = (value = Math.round(value)) < 0 ? 0 : value > 0xff ? 0xff : value & 0xff;
      data.v[SETTER](index * BYTES + data.o, value, LITTLE_ENDIAN);
    };
    var addElement = function(that, index){
      dP(that, index, {
        get: function(){
          return getter(this, index);
        },
        set: function(value){
          return setter(this, index, value);
        },
        enumerable: true
      });
    };
    if(FORCED){
      TypedArray = wrapper(function(that, data, $offset, $length){
        anInstance(that, TypedArray, NAME, '_d');
        var index  = 0
          , offset = 0
          , buffer, byteLength, length, klass;
        if(!isObject(data)){
          length     = strictToLength(data, true)
          byteLength = length * BYTES;
          buffer     = new $ArrayBuffer(byteLength);
        } else if(data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER){
          buffer = data;
          offset = toOffset($offset, BYTES);
          var $len = data.byteLength;
          if($length === undefined){
            if($len % BYTES)throw RangeError(WRONG_LENGTH);
            byteLength = $len - offset;
            if(byteLength < 0)throw RangeError(WRONG_LENGTH);
          } else {
            byteLength = toLength($length) * BYTES;
            if(byteLength + offset > $len)throw RangeError(WRONG_LENGTH);
          }
          length = byteLength / BYTES;
        } else if(TYPED_ARRAY in data){
          return fromList(TypedArray, data);
        } else {
          return $from.call(TypedArray, data);
        }
        hide(that, '_d', {
          b: buffer,
          o: offset,
          l: byteLength,
          e: length,
          v: new $DataView(buffer)
        });
        while(index < length)addElement(that, index++);
      });
      TypedArrayPrototype = TypedArray[PROTOTYPE] = create($TypedArrayPrototype$);
      hide(TypedArrayPrototype, 'constructor', TypedArray);
    } else if(!$iterDetect(function(iter){
      // V8 works with iterators, but fails in many other cases
      // https://code.google.com/p/v8/issues/detail?id=4552
      new TypedArray(null); // eslint-disable-line no-new
      new TypedArray(iter); // eslint-disable-line no-new
    }, true)){
      TypedArray = wrapper(function(that, data, $offset, $length){
        anInstance(that, TypedArray, NAME);
        var klass;
        // `ws` module bug, temporarily remove validation length for Uint8Array
        // https://github.com/websockets/ws/pull/645
        if(!isObject(data))return new Base(strictToLength(data, ISNT_UINT8));
        if(data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER){
          return $length !== undefined
            ? new Base(data, toOffset($offset, BYTES), $length)
            : $offset !== undefined
              ? new Base(data, toOffset($offset, BYTES))
              : new Base(data);
        }
        if(TYPED_ARRAY in data)return fromList(TypedArray, data);
        return $from.call(TypedArray, data);
      });
      arrayForEach(TAC !== Function.prototype ? gOPN(Base).concat(gOPN(TAC)) : gOPN(Base), function(key){
        if(!(key in TypedArray))hide(TypedArray, key, Base[key]);
      });
      TypedArray[PROTOTYPE] = TypedArrayPrototype;
      if(!LIBRARY)TypedArrayPrototype.constructor = TypedArray;
    }
    var $nativeIterator   = TypedArrayPrototype[ITERATOR]
      , CORRECT_ITER_NAME = !!$nativeIterator && ($nativeIterator.name == 'values' || $nativeIterator.name == undefined)
      , $iterator         = $iterators.values;
    hide(TypedArray, TYPED_CONSTRUCTOR, true);
    hide(TypedArrayPrototype, TYPED_ARRAY, NAME);
    hide(TypedArrayPrototype, VIEW, true);
    hide(TypedArrayPrototype, DEF_CONSTRUCTOR, TypedArray);

    if(CLAMPED ? new TypedArray(1)[TAG] != NAME : !(TAG in TypedArrayPrototype)){
      dP(TypedArrayPrototype, TAG, {
        get: function(){ return NAME; }
      });
    }

    O[NAME] = TypedArray;

    $export($export.G + $export.W + $export.F * (TypedArray != Base), O);

    $export($export.S, NAME, {
      BYTES_PER_ELEMENT: BYTES,
      from: $from,
      of: $of
    });

    if(!(BYTES_PER_ELEMENT in TypedArrayPrototype))hide(TypedArrayPrototype, BYTES_PER_ELEMENT, BYTES);

    $export($export.P, NAME, proto);

    setSpecies(NAME);

    $export($export.P + $export.F * FORCED_SET, NAME, {set: $set});

    $export($export.P + $export.F * !CORRECT_ITER_NAME, NAME, $iterators);

    $export($export.P + $export.F * (TypedArrayPrototype.toString != arrayToString), NAME, {toString: arrayToString});

    $export($export.P + $export.F * fails(function(){
      new TypedArray(1).slice();
    }), NAME, {slice: $slice});

    $export($export.P + $export.F * (fails(function(){
      return [1, 2].toLocaleString() != new TypedArray([1, 2]).toLocaleString()
    }) || !fails(function(){
      TypedArrayPrototype.toLocaleString.call([1, 2]);
    })), NAME, {toLocaleString: $toLocaleString});

    Iterators[NAME] = CORRECT_ITER_NAME ? $nativeIterator : $iterator;
    if(!LIBRARY && !CORRECT_ITER_NAME)hide(TypedArrayPrototype, ITERATOR, $iterator);
  };
} else module.exports = function(){ /* empty */ };
},{"./_an-instance":124,"./_array-copy-within":126,"./_array-fill":127,"./_array-includes":129,"./_array-methods":130,"./_classof":135,"./_ctx":143,"./_descriptors":146,"./_export":150,"./_fails":152,"./_global":156,"./_has":157,"./_hide":158,"./_is-array-iter":164,"./_is-object":167,"./_iter-detect":172,"./_iterators":174,"./_library":176,"./_object-create":184,"./_object-dp":185,"./_object-gopd":188,"./_object-gopn":190,"./_object-gpo":192,"./_property-desc":203,"./_redefine-all":204,"./_same-value":207,"./_set-species":209,"./_species-constructor":213,"./_to-index":223,"./_to-integer":224,"./_to-length":226,"./_to-object":227,"./_to-primitive":228,"./_typed":231,"./_typed-buffer":230,"./_uid":232,"./_wks":235,"./core.get-iterator-method":236,"./es6.array.iterator":248}],230:[function(require,module,exports){
'use strict';
var global         = require('./_global')
  , DESCRIPTORS    = require('./_descriptors')
  , LIBRARY        = require('./_library')
  , $typed         = require('./_typed')
  , hide           = require('./_hide')
  , redefineAll    = require('./_redefine-all')
  , fails          = require('./_fails')
  , anInstance     = require('./_an-instance')
  , toInteger      = require('./_to-integer')
  , toLength       = require('./_to-length')
  , gOPN           = require('./_object-gopn').f
  , dP             = require('./_object-dp').f
  , arrayFill      = require('./_array-fill')
  , setToStringTag = require('./_set-to-string-tag')
  , ARRAY_BUFFER   = 'ArrayBuffer'
  , DATA_VIEW      = 'DataView'
  , PROTOTYPE      = 'prototype'
  , WRONG_LENGTH   = 'Wrong length!'
  , WRONG_INDEX    = 'Wrong index!'
  , $ArrayBuffer   = global[ARRAY_BUFFER]
  , $DataView      = global[DATA_VIEW]
  , Math           = global.Math
  , RangeError     = global.RangeError
  , Infinity       = global.Infinity
  , BaseBuffer     = $ArrayBuffer
  , abs            = Math.abs
  , pow            = Math.pow
  , floor          = Math.floor
  , log            = Math.log
  , LN2            = Math.LN2
  , BUFFER         = 'buffer'
  , BYTE_LENGTH    = 'byteLength'
  , BYTE_OFFSET    = 'byteOffset'
  , $BUFFER        = DESCRIPTORS ? '_b' : BUFFER
  , $LENGTH        = DESCRIPTORS ? '_l' : BYTE_LENGTH
  , $OFFSET        = DESCRIPTORS ? '_o' : BYTE_OFFSET;

// IEEE754 conversions based on https://github.com/feross/ieee754
var packIEEE754 = function(value, mLen, nBytes){
  var buffer = Array(nBytes)
    , eLen   = nBytes * 8 - mLen - 1
    , eMax   = (1 << eLen) - 1
    , eBias  = eMax >> 1
    , rt     = mLen === 23 ? pow(2, -24) - pow(2, -77) : 0
    , i      = 0
    , s      = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0
    , e, m, c;
  value = abs(value)
  if(value != value || value === Infinity){
    m = value != value ? 1 : 0;
    e = eMax;
  } else {
    e = floor(log(value) / LN2);
    if(value * (c = pow(2, -e)) < 1){
      e--;
      c *= 2;
    }
    if(e + eBias >= 1){
      value += rt / c;
    } else {
      value += rt * pow(2, 1 - eBias);
    }
    if(value * c >= 2){
      e++;
      c /= 2;
    }
    if(e + eBias >= eMax){
      m = 0;
      e = eMax;
    } else if(e + eBias >= 1){
      m = (value * c - 1) * pow(2, mLen);
      e = e + eBias;
    } else {
      m = value * pow(2, eBias - 1) * pow(2, mLen);
      e = 0;
    }
  }
  for(; mLen >= 8; buffer[i++] = m & 255, m /= 256, mLen -= 8);
  e = e << mLen | m;
  eLen += mLen;
  for(; eLen > 0; buffer[i++] = e & 255, e /= 256, eLen -= 8);
  buffer[--i] |= s * 128;
  return buffer;
};
var unpackIEEE754 = function(buffer, mLen, nBytes){
  var eLen  = nBytes * 8 - mLen - 1
    , eMax  = (1 << eLen) - 1
    , eBias = eMax >> 1
    , nBits = eLen - 7
    , i     = nBytes - 1
    , s     = buffer[i--]
    , e     = s & 127
    , m;
  s >>= 7;
  for(; nBits > 0; e = e * 256 + buffer[i], i--, nBits -= 8);
  m = e & (1 << -nBits) - 1;
  e >>= -nBits;
  nBits += mLen;
  for(; nBits > 0; m = m * 256 + buffer[i], i--, nBits -= 8);
  if(e === 0){
    e = 1 - eBias;
  } else if(e === eMax){
    return m ? NaN : s ? -Infinity : Infinity;
  } else {
    m = m + pow(2, mLen);
    e = e - eBias;
  } return (s ? -1 : 1) * m * pow(2, e - mLen);
};

var unpackI32 = function(bytes){
  return bytes[3] << 24 | bytes[2] << 16 | bytes[1] << 8 | bytes[0];
};
var packI8 = function(it){
  return [it & 0xff];
};
var packI16 = function(it){
  return [it & 0xff, it >> 8 & 0xff];
};
var packI32 = function(it){
  return [it & 0xff, it >> 8 & 0xff, it >> 16 & 0xff, it >> 24 & 0xff];
};
var packF64 = function(it){
  return packIEEE754(it, 52, 8);
};
var packF32 = function(it){
  return packIEEE754(it, 23, 4);
};

var addGetter = function(C, key, internal){
  dP(C[PROTOTYPE], key, {get: function(){ return this[internal]; }});
};

var get = function(view, bytes, index, isLittleEndian){
  var numIndex = +index
    , intIndex = toInteger(numIndex);
  if(numIndex != intIndex || intIndex < 0 || intIndex + bytes > view[$LENGTH])throw RangeError(WRONG_INDEX);
  var store = view[$BUFFER]._b
    , start = intIndex + view[$OFFSET]
    , pack  = store.slice(start, start + bytes);
  return isLittleEndian ? pack : pack.reverse();
};
var set = function(view, bytes, index, conversion, value, isLittleEndian){
  var numIndex = +index
    , intIndex = toInteger(numIndex);
  if(numIndex != intIndex || intIndex < 0 || intIndex + bytes > view[$LENGTH])throw RangeError(WRONG_INDEX);
  var store = view[$BUFFER]._b
    , start = intIndex + view[$OFFSET]
    , pack  = conversion(+value);
  for(var i = 0; i < bytes; i++)store[start + i] = pack[isLittleEndian ? i : bytes - i - 1];
};

var validateArrayBufferArguments = function(that, length){
  anInstance(that, $ArrayBuffer, ARRAY_BUFFER);
  var numberLength = +length
    , byteLength   = toLength(numberLength);
  if(numberLength != byteLength)throw RangeError(WRONG_LENGTH);
  return byteLength;
};

if(!$typed.ABV){
  $ArrayBuffer = function ArrayBuffer(length){
    var byteLength = validateArrayBufferArguments(this, length);
    this._b       = arrayFill.call(Array(byteLength), 0);
    this[$LENGTH] = byteLength;
  };

  $DataView = function DataView(buffer, byteOffset, byteLength){
    anInstance(this, $DataView, DATA_VIEW);
    anInstance(buffer, $ArrayBuffer, DATA_VIEW);
    var bufferLength = buffer[$LENGTH]
      , offset       = toInteger(byteOffset);
    if(offset < 0 || offset > bufferLength)throw RangeError('Wrong offset!');
    byteLength = byteLength === undefined ? bufferLength - offset : toLength(byteLength);
    if(offset + byteLength > bufferLength)throw RangeError(WRONG_LENGTH);
    this[$BUFFER] = buffer;
    this[$OFFSET] = offset;
    this[$LENGTH] = byteLength;
  };

  if(DESCRIPTORS){
    addGetter($ArrayBuffer, BYTE_LENGTH, '_l');
    addGetter($DataView, BUFFER, '_b');
    addGetter($DataView, BYTE_LENGTH, '_l');
    addGetter($DataView, BYTE_OFFSET, '_o');
  }

  redefineAll($DataView[PROTOTYPE], {
    getInt8: function getInt8(byteOffset){
      return get(this, 1, byteOffset)[0] << 24 >> 24;
    },
    getUint8: function getUint8(byteOffset){
      return get(this, 1, byteOffset)[0];
    },
    getInt16: function getInt16(byteOffset /*, littleEndian */){
      var bytes = get(this, 2, byteOffset, arguments[1]);
      return (bytes[1] << 8 | bytes[0]) << 16 >> 16;
    },
    getUint16: function getUint16(byteOffset /*, littleEndian */){
      var bytes = get(this, 2, byteOffset, arguments[1]);
      return bytes[1] << 8 | bytes[0];
    },
    getInt32: function getInt32(byteOffset /*, littleEndian */){
      return unpackI32(get(this, 4, byteOffset, arguments[1]));
    },
    getUint32: function getUint32(byteOffset /*, littleEndian */){
      return unpackI32(get(this, 4, byteOffset, arguments[1])) >>> 0;
    },
    getFloat32: function getFloat32(byteOffset /*, littleEndian */){
      return unpackIEEE754(get(this, 4, byteOffset, arguments[1]), 23, 4);
    },
    getFloat64: function getFloat64(byteOffset /*, littleEndian */){
      return unpackIEEE754(get(this, 8, byteOffset, arguments[1]), 52, 8);
    },
    setInt8: function setInt8(byteOffset, value){
      set(this, 1, byteOffset, packI8, value);
    },
    setUint8: function setUint8(byteOffset, value){
      set(this, 1, byteOffset, packI8, value);
    },
    setInt16: function setInt16(byteOffset, value /*, littleEndian */){
      set(this, 2, byteOffset, packI16, value, arguments[2]);
    },
    setUint16: function setUint16(byteOffset, value /*, littleEndian */){
      set(this, 2, byteOffset, packI16, value, arguments[2]);
    },
    setInt32: function setInt32(byteOffset, value /*, littleEndian */){
      set(this, 4, byteOffset, packI32, value, arguments[2]);
    },
    setUint32: function setUint32(byteOffset, value /*, littleEndian */){
      set(this, 4, byteOffset, packI32, value, arguments[2]);
    },
    setFloat32: function setFloat32(byteOffset, value /*, littleEndian */){
      set(this, 4, byteOffset, packF32, value, arguments[2]);
    },
    setFloat64: function setFloat64(byteOffset, value /*, littleEndian */){
      set(this, 8, byteOffset, packF64, value, arguments[2]);
    }
  });
} else {
  if(!fails(function(){
    new $ArrayBuffer;     // eslint-disable-line no-new
  }) || !fails(function(){
    new $ArrayBuffer(.5); // eslint-disable-line no-new
  })){
    $ArrayBuffer = function ArrayBuffer(length){
      return new BaseBuffer(validateArrayBufferArguments(this, length));
    };
    var ArrayBufferProto = $ArrayBuffer[PROTOTYPE] = BaseBuffer[PROTOTYPE];
    for(var keys = gOPN(BaseBuffer), j = 0, key; keys.length > j; ){
      if(!((key = keys[j++]) in $ArrayBuffer))hide($ArrayBuffer, key, BaseBuffer[key]);
    };
    if(!LIBRARY)ArrayBufferProto.constructor = $ArrayBuffer;
  }
  // iOS Safari 7.x bug
  var view = new $DataView(new $ArrayBuffer(2))
    , $setInt8 = $DataView[PROTOTYPE].setInt8;
  view.setInt8(0, 2147483648);
  view.setInt8(1, 2147483649);
  if(view.getInt8(0) || !view.getInt8(1))redefineAll($DataView[PROTOTYPE], {
    setInt8: function setInt8(byteOffset, value){
      $setInt8.call(this, byteOffset, value << 24 >> 24);
    },
    setUint8: function setUint8(byteOffset, value){
      $setInt8.call(this, byteOffset, value << 24 >> 24);
    }
  }, true);
}
setToStringTag($ArrayBuffer, ARRAY_BUFFER);
setToStringTag($DataView, DATA_VIEW);
hide($DataView[PROTOTYPE], $typed.VIEW, true);
exports[ARRAY_BUFFER] = $ArrayBuffer;
exports[DATA_VIEW] = $DataView;
},{"./_an-instance":124,"./_array-fill":127,"./_descriptors":146,"./_fails":152,"./_global":156,"./_hide":158,"./_library":176,"./_object-dp":185,"./_object-gopn":190,"./_redefine-all":204,"./_set-to-string-tag":210,"./_to-integer":224,"./_to-length":226,"./_typed":231}],231:[function(require,module,exports){
var global = require('./_global')
  , hide   = require('./_hide')
  , uid    = require('./_uid')
  , TYPED  = uid('typed_array')
  , VIEW   = uid('view')
  , ABV    = !!(global.ArrayBuffer && global.DataView)
  , CONSTR = ABV
  , i = 0, l = 9, Typed;

var TypedArrayConstructors = (
  'Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array'
).split(',');

while(i < l){
  if(Typed = global[TypedArrayConstructors[i++]]){
    hide(Typed.prototype, TYPED, true);
    hide(Typed.prototype, VIEW, true);
  } else CONSTR = false;
}

module.exports = {
  ABV:    ABV,
  CONSTR: CONSTR,
  TYPED:  TYPED,
  VIEW:   VIEW
};
},{"./_global":156,"./_hide":158,"./_uid":232}],232:[function(require,module,exports){
var id = 0
  , px = Math.random();
module.exports = function(key){
  return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
};
},{}],233:[function(require,module,exports){
var global         = require('./_global')
  , core           = require('./_core')
  , LIBRARY        = require('./_library')
  , wksExt         = require('./_wks-ext')
  , defineProperty = require('./_object-dp').f;
module.exports = function(name){
  var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});
  if(name.charAt(0) != '_' && !(name in $Symbol))defineProperty($Symbol, name, {value: wksExt.f(name)});
};
},{"./_core":141,"./_global":156,"./_library":176,"./_object-dp":185,"./_wks-ext":234}],234:[function(require,module,exports){
exports.f = require('./_wks');
},{"./_wks":235}],235:[function(require,module,exports){
var store      = require('./_shared')('wks')
  , uid        = require('./_uid')
  , Symbol     = require('./_global').Symbol
  , USE_SYMBOL = typeof Symbol == 'function';

var $exports = module.exports = function(name){
  return store[name] || (store[name] =
    USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
};

$exports.store = store;
},{"./_global":156,"./_shared":212,"./_uid":232}],236:[function(require,module,exports){
var classof   = require('./_classof')
  , ITERATOR  = require('./_wks')('iterator')
  , Iterators = require('./_iterators');
module.exports = require('./_core').getIteratorMethod = function(it){
  if(it != undefined)return it[ITERATOR]
    || it['@@iterator']
    || Iterators[classof(it)];
};
},{"./_classof":135,"./_core":141,"./_iterators":174,"./_wks":235}],237:[function(require,module,exports){
// https://github.com/benjamingr/RexExp.escape
var $export = require('./_export')
  , $re     = require('./_replacer')(/[\\^$*+?.()|[\]{}]/g, '\\$&');

$export($export.S, 'RegExp', {escape: function escape(it){ return $re(it); }});

},{"./_export":150,"./_replacer":206}],238:[function(require,module,exports){
// 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length)
var $export = require('./_export');

$export($export.P, 'Array', {copyWithin: require('./_array-copy-within')});

require('./_add-to-unscopables')('copyWithin');
},{"./_add-to-unscopables":123,"./_array-copy-within":126,"./_export":150}],239:[function(require,module,exports){
'use strict';
var $export = require('./_export')
  , $every  = require('./_array-methods')(4);

$export($export.P + $export.F * !require('./_strict-method')([].every, true), 'Array', {
  // 22.1.3.5 / 15.4.4.16 Array.prototype.every(callbackfn [, thisArg])
  every: function every(callbackfn /* , thisArg */){
    return $every(this, callbackfn, arguments[1]);
  }
});
},{"./_array-methods":130,"./_export":150,"./_strict-method":214}],240:[function(require,module,exports){
// 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length)
var $export = require('./_export');

$export($export.P, 'Array', {fill: require('./_array-fill')});

require('./_add-to-unscopables')('fill');
},{"./_add-to-unscopables":123,"./_array-fill":127,"./_export":150}],241:[function(require,module,exports){
'use strict';
var $export = require('./_export')
  , $filter = require('./_array-methods')(2);

$export($export.P + $export.F * !require('./_strict-method')([].filter, true), 'Array', {
  // 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg])
  filter: function filter(callbackfn /* , thisArg */){
    return $filter(this, callbackfn, arguments[1]);
  }
});
},{"./_array-methods":130,"./_export":150,"./_strict-method":214}],242:[function(require,module,exports){
'use strict';
// 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined)
var $export = require('./_export')
  , $find   = require('./_array-methods')(6)
  , KEY     = 'findIndex'
  , forced  = true;
// Shouldn't skip holes
if(KEY in [])Array(1)[KEY](function(){ forced = false; });
$export($export.P + $export.F * forced, 'Array', {
  findIndex: function findIndex(callbackfn/*, that = undefined */){
    return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  }
});
require('./_add-to-unscopables')(KEY);
},{"./_add-to-unscopables":123,"./_array-methods":130,"./_export":150}],243:[function(require,module,exports){
'use strict';
// 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined)
var $export = require('./_export')
  , $find   = require('./_array-methods')(5)
  , KEY     = 'find'
  , forced  = true;
// Shouldn't skip holes
if(KEY in [])Array(1)[KEY](function(){ forced = false; });
$export($export.P + $export.F * forced, 'Array', {
  find: function find(callbackfn/*, that = undefined */){
    return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  }
});
require('./_add-to-unscopables')(KEY);
},{"./_add-to-unscopables":123,"./_array-methods":130,"./_export":150}],244:[function(require,module,exports){
'use strict';
var $export  = require('./_export')
  , $forEach = require('./_array-methods')(0)
  , STRICT   = require('./_strict-method')([].forEach, true);

$export($export.P + $export.F * !STRICT, 'Array', {
  // 22.1.3.10 / 15.4.4.18 Array.prototype.forEach(callbackfn [, thisArg])
  forEach: function forEach(callbackfn /* , thisArg */){
    return $forEach(this, callbackfn, arguments[1]);
  }
});
},{"./_array-methods":130,"./_export":150,"./_strict-method":214}],245:[function(require,module,exports){
'use strict';
var ctx            = require('./_ctx')
  , $export        = require('./_export')
  , toObject       = require('./_to-object')
  , call           = require('./_iter-call')
  , isArrayIter    = require('./_is-array-iter')
  , toLength       = require('./_to-length')
  , createProperty = require('./_create-property')
  , getIterFn      = require('./core.get-iterator-method');

$export($export.S + $export.F * !require('./_iter-detect')(function(iter){ Array.from(iter); }), 'Array', {
  // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)
  from: function from(arrayLike/*, mapfn = undefined, thisArg = undefined*/){
    var O       = toObject(arrayLike)
      , C       = typeof this == 'function' ? this : Array
      , aLen    = arguments.length
      , mapfn   = aLen > 1 ? arguments[1] : undefined
      , mapping = mapfn !== undefined
      , index   = 0
      , iterFn  = getIterFn(O)
      , length, result, step, iterator;
    if(mapping)mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2);
    // if object isn't iterable or it's array with default iterator - use simple case
    if(iterFn != undefined && !(C == Array && isArrayIter(iterFn))){
      for(iterator = iterFn.call(O), result = new C; !(step = iterator.next()).done; index++){
        createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value);
      }
    } else {
      length = toLength(O.length);
      for(result = new C(length); length > index; index++){
        createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);
      }
    }
    result.length = index;
    return result;
  }
});

},{"./_create-property":142,"./_ctx":143,"./_export":150,"./_is-array-iter":164,"./_iter-call":169,"./_iter-detect":172,"./_to-length":226,"./_to-object":227,"./core.get-iterator-method":236}],246:[function(require,module,exports){
'use strict';
var $export       = require('./_export')
  , $indexOf      = require('./_array-includes')(false)
  , $native       = [].indexOf
  , NEGATIVE_ZERO = !!$native && 1 / [1].indexOf(1, -0) < 0;

$export($export.P + $export.F * (NEGATIVE_ZERO || !require('./_strict-method')($native)), 'Array', {
  // 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex])
  indexOf: function indexOf(searchElement /*, fromIndex = 0 */){
    return NEGATIVE_ZERO
      // convert -0 to +0
      ? $native.apply(this, arguments) || 0
      : $indexOf(this, searchElement, arguments[1]);
  }
});
},{"./_array-includes":129,"./_export":150,"./_strict-method":214}],247:[function(require,module,exports){
// 22.1.2.2 / 15.4.3.2 Array.isArray(arg)
var $export = require('./_export');

$export($export.S, 'Array', {isArray: require('./_is-array')});
},{"./_export":150,"./_is-array":165}],248:[function(require,module,exports){
'use strict';
var addToUnscopables = require('./_add-to-unscopables')
  , step             = require('./_iter-step')
  , Iterators        = require('./_iterators')
  , toIObject        = require('./_to-iobject');

// 22.1.3.4 Array.prototype.entries()
// 22.1.3.13 Array.prototype.keys()
// 22.1.3.29 Array.prototype.values()
// 22.1.3.30 Array.prototype[@@iterator]()
module.exports = require('./_iter-define')(Array, 'Array', function(iterated, kind){
  this._t = toIObject(iterated); // target
  this._i = 0;                   // next index
  this._k = kind;                // kind
// 22.1.5.2.1 %ArrayIteratorPrototype%.next()
}, function(){
  var O     = this._t
    , kind  = this._k
    , index = this._i++;
  if(!O || index >= O.length){
    this._t = undefined;
    return step(1);
  }
  if(kind == 'keys'  )return step(0, index);
  if(kind == 'values')return step(0, O[index]);
  return step(0, [index, O[index]]);
}, 'values');

// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
Iterators.Arguments = Iterators.Array;

addToUnscopables('keys');
addToUnscopables('values');
addToUnscopables('entries');
},{"./_add-to-unscopables":123,"./_iter-define":171,"./_iter-step":173,"./_iterators":174,"./_to-iobject":225}],249:[function(require,module,exports){
'use strict';
// 22.1.3.13 Array.prototype.join(separator)
var $export   = require('./_export')
  , toIObject = require('./_to-iobject')
  , arrayJoin = [].join;

// fallback for not array-like strings
$export($export.P + $export.F * (require('./_iobject') != Object || !require('./_strict-method')(arrayJoin)), 'Array', {
  join: function join(separator){
    return arrayJoin.call(toIObject(this), separator === undefined ? ',' : separator);
  }
});
},{"./_export":150,"./_iobject":163,"./_strict-method":214,"./_to-iobject":225}],250:[function(require,module,exports){
'use strict';
var $export       = require('./_export')
  , toIObject     = require('./_to-iobject')
  , toInteger     = require('./_to-integer')
  , toLength      = require('./_to-length')
  , $native       = [].lastIndexOf
  , NEGATIVE_ZERO = !!$native && 1 / [1].lastIndexOf(1, -0) < 0;

$export($export.P + $export.F * (NEGATIVE_ZERO || !require('./_strict-method')($native)), 'Array', {
  // 22.1.3.14 / 15.4.4.15 Array.prototype.lastIndexOf(searchElement [, fromIndex])
  lastIndexOf: function lastIndexOf(searchElement /*, fromIndex = @[*-1] */){
    // convert -0 to +0
    if(NEGATIVE_ZERO)return $native.apply(this, arguments) || 0;
    var O      = toIObject(this)
      , length = toLength(O.length)
      , index  = length - 1;
    if(arguments.length > 1)index = Math.min(index, toInteger(arguments[1]));
    if(index < 0)index = length + index;
    for(;index >= 0; index--)if(index in O)if(O[index] === searchElement)return index || 0;
    return -1;
  }
});
},{"./_export":150,"./_strict-method":214,"./_to-integer":224,"./_to-iobject":225,"./_to-length":226}],251:[function(require,module,exports){
'use strict';
var $export = require('./_export')
  , $map    = require('./_array-methods')(1);

$export($export.P + $export.F * !require('./_strict-method')([].map, true), 'Array', {
  // 22.1.3.15 / 15.4.4.19 Array.prototype.map(callbackfn [, thisArg])
  map: function map(callbackfn /* , thisArg */){
    return $map(this, callbackfn, arguments[1]);
  }
});
},{"./_array-methods":130,"./_export":150,"./_strict-method":214}],252:[function(require,module,exports){
'use strict';
var $export        = require('./_export')
  , createProperty = require('./_create-property');

// WebKit Array.of isn't generic
$export($export.S + $export.F * require('./_fails')(function(){
  function F(){}
  return !(Array.of.call(F) instanceof F);
}), 'Array', {
  // 22.1.2.3 Array.of( ...items)
  of: function of(/* ...args */){
    var index  = 0
      , aLen   = arguments.length
      , result = new (typeof this == 'function' ? this : Array)(aLen);
    while(aLen > index)createProperty(result, index, arguments[index++]);
    result.length = aLen;
    return result;
  }
});
},{"./_create-property":142,"./_export":150,"./_fails":152}],253:[function(require,module,exports){
'use strict';
var $export = require('./_export')
  , $reduce = require('./_array-reduce');

$export($export.P + $export.F * !require('./_strict-method')([].reduceRight, true), 'Array', {
  // 22.1.3.19 / 15.4.4.22 Array.prototype.reduceRight(callbackfn [, initialValue])
  reduceRight: function reduceRight(callbackfn /* , initialValue */){
    return $reduce(this, callbackfn, arguments.length, arguments[1], true);
  }
});
},{"./_array-reduce":131,"./_export":150,"./_strict-method":214}],254:[function(require,module,exports){
'use strict';
var $export = require('./_export')
  , $reduce = require('./_array-reduce');

$export($export.P + $export.F * !require('./_strict-method')([].reduce, true), 'Array', {
  // 22.1.3.18 / 15.4.4.21 Array.prototype.reduce(callbackfn [, initialValue])
  reduce: function reduce(callbackfn /* , initialValue */){
    return $reduce(this, callbackfn, arguments.length, arguments[1], false);
  }
});
},{"./_array-reduce":131,"./_export":150,"./_strict-method":214}],255:[function(require,module,exports){
'use strict';
var $export    = require('./_export')
  , html       = require('./_html')
  , cof        = require('./_cof')
  , toIndex    = require('./_to-index')
  , toLength   = require('./_to-length')
  , arraySlice = [].slice;

// fallback for not array-like ES3 strings and DOM objects
$export($export.P + $export.F * require('./_fails')(function(){
  if(html)arraySlice.call(html);
}), 'Array', {
  slice: function slice(begin, end){
    var len   = toLength(this.length)
      , klass = cof(this);
    end = end === undefined ? len : end;
    if(klass == 'Array')return arraySlice.call(this, begin, end);
    var start  = toIndex(begin, len)
      , upTo   = toIndex(end, len)
      , size   = toLength(upTo - start)
      , cloned = Array(size)
      , i      = 0;
    for(; i < size; i++)cloned[i] = klass == 'String'
      ? this.charAt(start + i)
      : this[start + i];
    return cloned;
  }
});
},{"./_cof":136,"./_export":150,"./_fails":152,"./_html":159,"./_to-index":223,"./_to-length":226}],256:[function(require,module,exports){
'use strict';
var $export = require('./_export')
  , $some   = require('./_array-methods')(3);

$export($export.P + $export.F * !require('./_strict-method')([].some, true), 'Array', {
  // 22.1.3.23 / 15.4.4.17 Array.prototype.some(callbackfn [, thisArg])
  some: function some(callbackfn /* , thisArg */){
    return $some(this, callbackfn, arguments[1]);
  }
});
},{"./_array-methods":130,"./_export":150,"./_strict-method":214}],257:[function(require,module,exports){
'use strict';
var $export   = require('./_export')
  , aFunction = require('./_a-function')
  , toObject  = require('./_to-object')
  , fails     = require('./_fails')
  , $sort     = [].sort
  , test      = [1, 2, 3];

$export($export.P + $export.F * (fails(function(){
  // IE8-
  test.sort(undefined);
}) || !fails(function(){
  // V8 bug
  test.sort(null);
  // Old WebKit
}) || !require('./_strict-method')($sort)), 'Array', {
  // 22.1.3.25 Array.prototype.sort(comparefn)
  sort: function sort(comparefn){
    return comparefn === undefined
      ? $sort.call(toObject(this))
      : $sort.call(toObject(this), aFunction(comparefn));
  }
});
},{"./_a-function":121,"./_export":150,"./_fails":152,"./_strict-method":214,"./_to-object":227}],258:[function(require,module,exports){
require('./_set-species')('Array');
},{"./_set-species":209}],259:[function(require,module,exports){
// 20.3.3.1 / 15.9.4.4 Date.now()
var $export = require('./_export');

$export($export.S, 'Date', {now: function(){ return new Date().getTime(); }});
},{"./_export":150}],260:[function(require,module,exports){
'use strict';
// 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString()
var $export = require('./_export')
  , fails   = require('./_fails')
  , getTime = Date.prototype.getTime;

var lz = function(num){
  return num > 9 ? num : '0' + num;
};

// PhantomJS / old WebKit has a broken implementations
$export($export.P + $export.F * (fails(function(){
  return new Date(-5e13 - 1).toISOString() != '0385-07-25T07:06:39.999Z';
}) || !fails(function(){
  new Date(NaN).toISOString();
})), 'Date', {
  toISOString: function toISOString(){
    if(!isFinite(getTime.call(this)))throw RangeError('Invalid time value');
    var d = this
      , y = d.getUTCFullYear()
      , m = d.getUTCMilliseconds()
      , s = y < 0 ? '-' : y > 9999 ? '+' : '';
    return s + ('00000' + Math.abs(y)).slice(s ? -6 : -4) +
      '-' + lz(d.getUTCMonth() + 1) + '-' + lz(d.getUTCDate()) +
      'T' + lz(d.getUTCHours()) + ':' + lz(d.getUTCMinutes()) +
      ':' + lz(d.getUTCSeconds()) + '.' + (m > 99 ? m : '0' + lz(m)) + 'Z';
  }
});
},{"./_export":150,"./_fails":152}],261:[function(require,module,exports){
'use strict';
var $export     = require('./_export')
  , toObject    = require('./_to-object')
  , toPrimitive = require('./_to-primitive');

$export($export.P + $export.F * require('./_fails')(function(){
  return new Date(NaN).toJSON() !== null || Date.prototype.toJSON.call({toISOString: function(){ return 1; }}) !== 1;
}), 'Date', {
  toJSON: function toJSON(key){
    var O  = toObject(this)
      , pv = toPrimitive(O);
    return typeof pv == 'number' && !isFinite(pv) ? null : O.toISOString();
  }
});
},{"./_export":150,"./_fails":152,"./_to-object":227,"./_to-primitive":228}],262:[function(require,module,exports){
var TO_PRIMITIVE = require('./_wks')('toPrimitive')
  , proto        = Date.prototype;

if(!(TO_PRIMITIVE in proto))require('./_hide')(proto, TO_PRIMITIVE, require('./_date-to-primitive'));
},{"./_date-to-primitive":144,"./_hide":158,"./_wks":235}],263:[function(require,module,exports){
var DateProto    = Date.prototype
  , INVALID_DATE = 'Invalid Date'
  , TO_STRING    = 'toString'
  , $toString    = DateProto[TO_STRING]
  , getTime      = DateProto.getTime;
if(new Date(NaN) + '' != INVALID_DATE){
  require('./_redefine')(DateProto, TO_STRING, function toString(){
    var value = getTime.call(this);
    return value === value ? $toString.call(this) : INVALID_DATE;
  });
}
},{"./_redefine":205}],264:[function(require,module,exports){
// 19.2.3.2 / 15.3.4.5 Function.prototype.bind(thisArg, args...)
var $export = require('./_export');

$export($export.P, 'Function', {bind: require('./_bind')});
},{"./_bind":134,"./_export":150}],265:[function(require,module,exports){
'use strict';
var isObject       = require('./_is-object')
  , getPrototypeOf = require('./_object-gpo')
  , HAS_INSTANCE   = require('./_wks')('hasInstance')
  , FunctionProto  = Function.prototype;
// 19.2.3.6 Function.prototype[@@hasInstance](V)
if(!(HAS_INSTANCE in FunctionProto))require('./_object-dp').f(FunctionProto, HAS_INSTANCE, {value: function(O){
  if(typeof this != 'function' || !isObject(O))return false;
  if(!isObject(this.prototype))return O instanceof this;
  // for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this:
  while(O = getPrototypeOf(O))if(this.prototype === O)return true;
  return false;
}});
},{"./_is-object":167,"./_object-dp":185,"./_object-gpo":192,"./_wks":235}],266:[function(require,module,exports){
var dP         = require('./_object-dp').f
  , createDesc = require('./_property-desc')
  , has        = require('./_has')
  , FProto     = Function.prototype
  , nameRE     = /^\s*function ([^ (]*)/
  , NAME       = 'name';

var isExtensible = Object.isExtensible || function(){
  return true;
};

// 19.2.4.2 name
NAME in FProto || require('./_descriptors') && dP(FProto, NAME, {
  configurable: true,
  get: function(){
    try {
      var that = this
        , name = ('' + that).match(nameRE)[1];
      has(that, NAME) || !isExtensible(that) || dP(that, NAME, createDesc(5, name));
      return name;
    } catch(e){
      return '';
    }
  }
});
},{"./_descriptors":146,"./_has":157,"./_object-dp":185,"./_property-desc":203}],267:[function(require,module,exports){
'use strict';
var strong = require('./_collection-strong');

// 23.1 Map Objects
module.exports = require('./_collection')('Map', function(get){
  return function Map(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); };
}, {
  // 23.1.3.6 Map.prototype.get(key)
  get: function get(key){
    var entry = strong.getEntry(this, key);
    return entry && entry.v;
  },
  // 23.1.3.9 Map.prototype.set(key, value)
  set: function set(key, value){
    return strong.def(this, key === 0 ? 0 : key, value);
  }
}, strong, true);
},{"./_collection":140,"./_collection-strong":137}],268:[function(require,module,exports){
// 20.2.2.3 Math.acosh(x)
var $export = require('./_export')
  , log1p   = require('./_math-log1p')
  , sqrt    = Math.sqrt
  , $acosh  = Math.acosh;

$export($export.S + $export.F * !($acosh
  // V8 bug: https://code.google.com/p/v8/issues/detail?id=3509
  && Math.floor($acosh(Number.MAX_VALUE)) == 710
  // Tor Browser bug: Math.acosh(Infinity) -> NaN 
  && $acosh(Infinity) == Infinity
), 'Math', {
  acosh: function acosh(x){
    return (x = +x) < 1 ? NaN : x > 94906265.62425156
      ? Math.log(x) + Math.LN2
      : log1p(x - 1 + sqrt(x - 1) * sqrt(x + 1));
  }
});
},{"./_export":150,"./_math-log1p":178}],269:[function(require,module,exports){
// 20.2.2.5 Math.asinh(x)
var $export = require('./_export')
  , $asinh  = Math.asinh;

function asinh(x){
  return !isFinite(x = +x) || x == 0 ? x : x < 0 ? -asinh(-x) : Math.log(x + Math.sqrt(x * x + 1));
}

// Tor Browser bug: Math.asinh(0) -> -0 
$export($export.S + $export.F * !($asinh && 1 / $asinh(0) > 0), 'Math', {asinh: asinh});
},{"./_export":150}],270:[function(require,module,exports){
// 20.2.2.7 Math.atanh(x)
var $export = require('./_export')
  , $atanh  = Math.atanh;

// Tor Browser bug: Math.atanh(-0) -> 0 
$export($export.S + $export.F * !($atanh && 1 / $atanh(-0) < 0), 'Math', {
  atanh: function atanh(x){
    return (x = +x) == 0 ? x : Math.log((1 + x) / (1 - x)) / 2;
  }
});
},{"./_export":150}],271:[function(require,module,exports){
// 20.2.2.9 Math.cbrt(x)
var $export = require('./_export')
  , sign    = require('./_math-sign');

$export($export.S, 'Math', {
  cbrt: function cbrt(x){
    return sign(x = +x) * Math.pow(Math.abs(x), 1 / 3);
  }
});
},{"./_export":150,"./_math-sign":179}],272:[function(require,module,exports){
// 20.2.2.11 Math.clz32(x)
var $export = require('./_export');

$export($export.S, 'Math', {
  clz32: function clz32(x){
    return (x >>>= 0) ? 31 - Math.floor(Math.log(x + 0.5) * Math.LOG2E) : 32;
  }
});
},{"./_export":150}],273:[function(require,module,exports){
// 20.2.2.12 Math.cosh(x)
var $export = require('./_export')
  , exp     = Math.exp;

$export($export.S, 'Math', {
  cosh: function cosh(x){
    return (exp(x = +x) + exp(-x)) / 2;
  }
});
},{"./_export":150}],274:[function(require,module,exports){
// 20.2.2.14 Math.expm1(x)
var $export = require('./_export')
  , $expm1  = require('./_math-expm1');

$export($export.S + $export.F * ($expm1 != Math.expm1), 'Math', {expm1: $expm1});
},{"./_export":150,"./_math-expm1":177}],275:[function(require,module,exports){
// 20.2.2.16 Math.fround(x)
var $export   = require('./_export')
  , sign      = require('./_math-sign')
  , pow       = Math.pow
  , EPSILON   = pow(2, -52)
  , EPSILON32 = pow(2, -23)
  , MAX32     = pow(2, 127) * (2 - EPSILON32)
  , MIN32     = pow(2, -126);

var roundTiesToEven = function(n){
  return n + 1 / EPSILON - 1 / EPSILON;
};


$export($export.S, 'Math', {
  fround: function fround(x){
    var $abs  = Math.abs(x)
      , $sign = sign(x)
      , a, result;
    if($abs < MIN32)return $sign * roundTiesToEven($abs / MIN32 / EPSILON32) * MIN32 * EPSILON32;
    a = (1 + EPSILON32 / EPSILON) * $abs;
    result = a - (a - $abs);
    if(result > MAX32 || result != result)return $sign * Infinity;
    return $sign * result;
  }
});
},{"./_export":150,"./_math-sign":179}],276:[function(require,module,exports){
// 20.2.2.17 Math.hypot([value1[, value2[, … ]]])
var $export = require('./_export')
  , abs     = Math.abs;

$export($export.S, 'Math', {
  hypot: function hypot(value1, value2){ // eslint-disable-line no-unused-vars
    var sum  = 0
      , i    = 0
      , aLen = arguments.length
      , larg = 0
      , arg, div;
    while(i < aLen){
      arg = abs(arguments[i++]);
      if(larg < arg){
        div  = larg / arg;
        sum  = sum * div * div + 1;
        larg = arg;
      } else if(arg > 0){
        div  = arg / larg;
        sum += div * div;
      } else sum += arg;
    }
    return larg === Infinity ? Infinity : larg * Math.sqrt(sum);
  }
});
},{"./_export":150}],277:[function(require,module,exports){
// 20.2.2.18 Math.imul(x, y)
var $export = require('./_export')
  , $imul   = Math.imul;

// some WebKit versions fails with big numbers, some has wrong arity
$export($export.S + $export.F * require('./_fails')(function(){
  return $imul(0xffffffff, 5) != -5 || $imul.length != 2;
}), 'Math', {
  imul: function imul(x, y){
    var UINT16 = 0xffff
      , xn = +x
      , yn = +y
      , xl = UINT16 & xn
      , yl = UINT16 & yn;
    return 0 | xl * yl + ((UINT16 & xn >>> 16) * yl + xl * (UINT16 & yn >>> 16) << 16 >>> 0);
  }
});
},{"./_export":150,"./_fails":152}],278:[function(require,module,exports){
// 20.2.2.21 Math.log10(x)
var $export = require('./_export');

$export($export.S, 'Math', {
  log10: function log10(x){
    return Math.log(x) / Math.LN10;
  }
});
},{"./_export":150}],279:[function(require,module,exports){
// 20.2.2.20 Math.log1p(x)
var $export = require('./_export');

$export($export.S, 'Math', {log1p: require('./_math-log1p')});
},{"./_export":150,"./_math-log1p":178}],280:[function(require,module,exports){
// 20.2.2.22 Math.log2(x)
var $export = require('./_export');

$export($export.S, 'Math', {
  log2: function log2(x){
    return Math.log(x) / Math.LN2;
  }
});
},{"./_export":150}],281:[function(require,module,exports){
// 20.2.2.28 Math.sign(x)
var $export = require('./_export');

$export($export.S, 'Math', {sign: require('./_math-sign')});
},{"./_export":150,"./_math-sign":179}],282:[function(require,module,exports){
// 20.2.2.30 Math.sinh(x)
var $export = require('./_export')
  , expm1   = require('./_math-expm1')
  , exp     = Math.exp;

// V8 near Chromium 38 has a problem with very small numbers
$export($export.S + $export.F * require('./_fails')(function(){
  return !Math.sinh(-2e-17) != -2e-17;
}), 'Math', {
  sinh: function sinh(x){
    return Math.abs(x = +x) < 1
      ? (expm1(x) - expm1(-x)) / 2
      : (exp(x - 1) - exp(-x - 1)) * (Math.E / 2);
  }
});
},{"./_export":150,"./_fails":152,"./_math-expm1":177}],283:[function(require,module,exports){
// 20.2.2.33 Math.tanh(x)
var $export = require('./_export')
  , expm1   = require('./_math-expm1')
  , exp     = Math.exp;

$export($export.S, 'Math', {
  tanh: function tanh(x){
    var a = expm1(x = +x)
      , b = expm1(-x);
    return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(x) + exp(-x));
  }
});
},{"./_export":150,"./_math-expm1":177}],284:[function(require,module,exports){
// 20.2.2.34 Math.trunc(x)
var $export = require('./_export');

$export($export.S, 'Math', {
  trunc: function trunc(it){
    return (it > 0 ? Math.floor : Math.ceil)(it);
  }
});
},{"./_export":150}],285:[function(require,module,exports){
'use strict';
var global            = require('./_global')
  , has               = require('./_has')
  , cof               = require('./_cof')
  , inheritIfRequired = require('./_inherit-if-required')
  , toPrimitive       = require('./_to-primitive')
  , fails             = require('./_fails')
  , gOPN              = require('./_object-gopn').f
  , gOPD              = require('./_object-gopd').f
  , dP                = require('./_object-dp').f
  , $trim             = require('./_string-trim').trim
  , NUMBER            = 'Number'
  , $Number           = global[NUMBER]
  , Base              = $Number
  , proto             = $Number.prototype
  // Opera ~12 has broken Object#toString
  , BROKEN_COF        = cof(require('./_object-create')(proto)) == NUMBER
  , TRIM              = 'trim' in String.prototype;

// 7.1.3 ToNumber(argument)
var toNumber = function(argument){
  var it = toPrimitive(argument, false);
  if(typeof it == 'string' && it.length > 2){
    it = TRIM ? it.trim() : $trim(it, 3);
    var first = it.charCodeAt(0)
      , third, radix, maxCode;
    if(first === 43 || first === 45){
      third = it.charCodeAt(2);
      if(third === 88 || third === 120)return NaN; // Number('+0x1') should be NaN, old V8 fix
    } else if(first === 48){
      switch(it.charCodeAt(1)){
        case 66 : case 98  : radix = 2; maxCode = 49; break; // fast equal /^0b[01]+$/i
        case 79 : case 111 : radix = 8; maxCode = 55; break; // fast equal /^0o[0-7]+$/i
        default : return +it;
      }
      for(var digits = it.slice(2), i = 0, l = digits.length, code; i < l; i++){
        code = digits.charCodeAt(i);
        // parseInt parses a string to a first unavailable symbol
        // but ToNumber should return NaN if a string contains unavailable symbols
        if(code < 48 || code > maxCode)return NaN;
      } return parseInt(digits, radix);
    }
  } return +it;
};

if(!$Number(' 0o1') || !$Number('0b1') || $Number('+0x1')){
  $Number = function Number(value){
    var it = arguments.length < 1 ? 0 : value
      , that = this;
    return that instanceof $Number
      // check on 1..constructor(foo) case
      && (BROKEN_COF ? fails(function(){ proto.valueOf.call(that); }) : cof(that) != NUMBER)
        ? inheritIfRequired(new Base(toNumber(it)), that, $Number) : toNumber(it);
  };
  for(var keys = require('./_descriptors') ? gOPN(Base) : (
    // ES3:
    'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
    // ES6 (in case, if modules with ES6 Number statics required before):
    'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' +
    'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger'
  ).split(','), j = 0, key; keys.length > j; j++){
    if(has(Base, key = keys[j]) && !has($Number, key)){
      dP($Number, key, gOPD(Base, key));
    }
  }
  $Number.prototype = proto;
  proto.constructor = $Number;
  require('./_redefine')(global, NUMBER, $Number);
}
},{"./_cof":136,"./_descriptors":146,"./_fails":152,"./_global":156,"./_has":157,"./_inherit-if-required":161,"./_object-create":184,"./_object-dp":185,"./_object-gopd":188,"./_object-gopn":190,"./_redefine":205,"./_string-trim":220,"./_to-primitive":228}],286:[function(require,module,exports){
// 20.1.2.1 Number.EPSILON
var $export = require('./_export');

$export($export.S, 'Number', {EPSILON: Math.pow(2, -52)});
},{"./_export":150}],287:[function(require,module,exports){
// 20.1.2.2 Number.isFinite(number)
var $export   = require('./_export')
  , _isFinite = require('./_global').isFinite;

$export($export.S, 'Number', {
  isFinite: function isFinite(it){
    return typeof it == 'number' && _isFinite(it);
  }
});
},{"./_export":150,"./_global":156}],288:[function(require,module,exports){
// 20.1.2.3 Number.isInteger(number)
var $export = require('./_export');

$export($export.S, 'Number', {isInteger: require('./_is-integer')});
},{"./_export":150,"./_is-integer":166}],289:[function(require,module,exports){
// 20.1.2.4 Number.isNaN(number)
var $export = require('./_export');

$export($export.S, 'Number', {
  isNaN: function isNaN(number){
    return number != number;
  }
});
},{"./_export":150}],290:[function(require,module,exports){
// 20.1.2.5 Number.isSafeInteger(number)
var $export   = require('./_export')
  , isInteger = require('./_is-integer')
  , abs       = Math.abs;

$export($export.S, 'Number', {
  isSafeInteger: function isSafeInteger(number){
    return isInteger(number) && abs(number) <= 0x1fffffffffffff;
  }
});
},{"./_export":150,"./_is-integer":166}],291:[function(require,module,exports){
// 20.1.2.6 Number.MAX_SAFE_INTEGER
var $export = require('./_export');

$export($export.S, 'Number', {MAX_SAFE_INTEGER: 0x1fffffffffffff});
},{"./_export":150}],292:[function(require,module,exports){
// 20.1.2.10 Number.MIN_SAFE_INTEGER
var $export = require('./_export');

$export($export.S, 'Number', {MIN_SAFE_INTEGER: -0x1fffffffffffff});
},{"./_export":150}],293:[function(require,module,exports){
var $export     = require('./_export')
  , $parseFloat = require('./_parse-float');
// 20.1.2.12 Number.parseFloat(string)
$export($export.S + $export.F * (Number.parseFloat != $parseFloat), 'Number', {parseFloat: $parseFloat});
},{"./_export":150,"./_parse-float":199}],294:[function(require,module,exports){
var $export   = require('./_export')
  , $parseInt = require('./_parse-int');
// 20.1.2.13 Number.parseInt(string, radix)
$export($export.S + $export.F * (Number.parseInt != $parseInt), 'Number', {parseInt: $parseInt});
},{"./_export":150,"./_parse-int":200}],295:[function(require,module,exports){
'use strict';
var $export      = require('./_export')
  , toInteger    = require('./_to-integer')
  , aNumberValue = require('./_a-number-value')
  , repeat       = require('./_string-repeat')
  , $toFixed     = 1..toFixed
  , floor        = Math.floor
  , data         = [0, 0, 0, 0, 0, 0]
  , ERROR        = 'Number.toFixed: incorrect invocation!'
  , ZERO         = '0';

var multiply = function(n, c){
  var i  = -1
    , c2 = c;
  while(++i < 6){
    c2 += n * data[i];
    data[i] = c2 % 1e7;
    c2 = floor(c2 / 1e7);
  }
};
var divide = function(n){
  var i = 6
    , c = 0;
  while(--i >= 0){
    c += data[i];
    data[i] = floor(c / n);
    c = (c % n) * 1e7;
  }
};
var numToString = function(){
  var i = 6
    , s = '';
  while(--i >= 0){
    if(s !== '' || i === 0 || data[i] !== 0){
      var t = String(data[i]);
      s = s === '' ? t : s + repeat.call(ZERO, 7 - t.length) + t;
    }
  } return s;
};
var pow = function(x, n, acc){
  return n === 0 ? acc : n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc);
};
var log = function(x){
  var n  = 0
    , x2 = x;
  while(x2 >= 4096){
    n += 12;
    x2 /= 4096;
  }
  while(x2 >= 2){
    n  += 1;
    x2 /= 2;
  } return n;
};

$export($export.P + $export.F * (!!$toFixed && (
  0.00008.toFixed(3) !== '0.000' ||
  0.9.toFixed(0) !== '1' ||
  1.255.toFixed(2) !== '1.25' ||
  1000000000000000128..toFixed(0) !== '1000000000000000128'
) || !require('./_fails')(function(){
  // V8 ~ Android 4.3-
  $toFixed.call({});
})), 'Number', {
  toFixed: function toFixed(fractionDigits){
    var x = aNumberValue(this, ERROR)
      , f = toInteger(fractionDigits)
      , s = ''
      , m = ZERO
      , e, z, j, k;
    if(f < 0 || f > 20)throw RangeError(ERROR);
    if(x != x)return 'NaN';
    if(x <= -1e21 || x >= 1e21)return String(x);
    if(x < 0){
      s = '-';
      x = -x;
    }
    if(x > 1e-21){
      e = log(x * pow(2, 69, 1)) - 69;
      z = e < 0 ? x * pow(2, -e, 1) : x / pow(2, e, 1);
      z *= 0x10000000000000;
      e = 52 - e;
      if(e > 0){
        multiply(0, z);
        j = f;
        while(j >= 7){
          multiply(1e7, 0);
          j -= 7;
        }
        multiply(pow(10, j, 1), 0);
        j = e - 1;
        while(j >= 23){
          divide(1 << 23);
          j -= 23;
        }
        divide(1 << j);
        multiply(1, 1);
        divide(2);
        m = numToString();
      } else {
        multiply(0, z);
        multiply(1 << -e, 0);
        m = numToString() + repeat.call(ZERO, f);
      }
    }
    if(f > 0){
      k = m.length;
      m = s + (k <= f ? '0.' + repeat.call(ZERO, f - k) + m : m.slice(0, k - f) + '.' + m.slice(k - f));
    } else {
      m = s + m;
    } return m;
  }
});
},{"./_a-number-value":122,"./_export":150,"./_fails":152,"./_string-repeat":219,"./_to-integer":224}],296:[function(require,module,exports){
'use strict';
var $export      = require('./_export')
  , $fails       = require('./_fails')
  , aNumberValue = require('./_a-number-value')
  , $toPrecision = 1..toPrecision;

$export($export.P + $export.F * ($fails(function(){
  // IE7-
  return $toPrecision.call(1, undefined) !== '1';
}) || !$fails(function(){
  // V8 ~ Android 4.3-
  $toPrecision.call({});
})), 'Number', {
  toPrecision: function toPrecision(precision){
    var that = aNumberValue(this, 'Number#toPrecision: incorrect invocation!');
    return precision === undefined ? $toPrecision.call(that) : $toPrecision.call(that, precision); 
  }
});
},{"./_a-number-value":122,"./_export":150,"./_fails":152}],297:[function(require,module,exports){
// 19.1.3.1 Object.assign(target, source)
var $export = require('./_export');

$export($export.S + $export.F, 'Object', {assign: require('./_object-assign')});
},{"./_export":150,"./_object-assign":183}],298:[function(require,module,exports){
var $export = require('./_export')
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
$export($export.S, 'Object', {create: require('./_object-create')});
},{"./_export":150,"./_object-create":184}],299:[function(require,module,exports){
var $export = require('./_export');
// 19.1.2.3 / 15.2.3.7 Object.defineProperties(O, Properties)
$export($export.S + $export.F * !require('./_descriptors'), 'Object', {defineProperties: require('./_object-dps')});
},{"./_descriptors":146,"./_export":150,"./_object-dps":186}],300:[function(require,module,exports){
var $export = require('./_export');
// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
$export($export.S + $export.F * !require('./_descriptors'), 'Object', {defineProperty: require('./_object-dp').f});
},{"./_descriptors":146,"./_export":150,"./_object-dp":185}],301:[function(require,module,exports){
// 19.1.2.5 Object.freeze(O)
var isObject = require('./_is-object')
  , meta     = require('./_meta').onFreeze;

require('./_object-sap')('freeze', function($freeze){
  return function freeze(it){
    return $freeze && isObject(it) ? $freeze(meta(it)) : it;
  };
});
},{"./_is-object":167,"./_meta":180,"./_object-sap":196}],302:[function(require,module,exports){
// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
var toIObject                 = require('./_to-iobject')
  , $getOwnPropertyDescriptor = require('./_object-gopd').f;

require('./_object-sap')('getOwnPropertyDescriptor', function(){
  return function getOwnPropertyDescriptor(it, key){
    return $getOwnPropertyDescriptor(toIObject(it), key);
  };
});
},{"./_object-gopd":188,"./_object-sap":196,"./_to-iobject":225}],303:[function(require,module,exports){
// 19.1.2.7 Object.getOwnPropertyNames(O)
require('./_object-sap')('getOwnPropertyNames', function(){
  return require('./_object-gopn-ext').f;
});
},{"./_object-gopn-ext":189,"./_object-sap":196}],304:[function(require,module,exports){
// 19.1.2.9 Object.getPrototypeOf(O)
var toObject        = require('./_to-object')
  , $getPrototypeOf = require('./_object-gpo');

require('./_object-sap')('getPrototypeOf', function(){
  return function getPrototypeOf(it){
    return $getPrototypeOf(toObject(it));
  };
});
},{"./_object-gpo":192,"./_object-sap":196,"./_to-object":227}],305:[function(require,module,exports){
// 19.1.2.11 Object.isExtensible(O)
var isObject = require('./_is-object');

require('./_object-sap')('isExtensible', function($isExtensible){
  return function isExtensible(it){
    return isObject(it) ? $isExtensible ? $isExtensible(it) : true : false;
  };
});
},{"./_is-object":167,"./_object-sap":196}],306:[function(require,module,exports){
// 19.1.2.12 Object.isFrozen(O)
var isObject = require('./_is-object');

require('./_object-sap')('isFrozen', function($isFrozen){
  return function isFrozen(it){
    return isObject(it) ? $isFrozen ? $isFrozen(it) : false : true;
  };
});
},{"./_is-object":167,"./_object-sap":196}],307:[function(require,module,exports){
// 19.1.2.13 Object.isSealed(O)
var isObject = require('./_is-object');

require('./_object-sap')('isSealed', function($isSealed){
  return function isSealed(it){
    return isObject(it) ? $isSealed ? $isSealed(it) : false : true;
  };
});
},{"./_is-object":167,"./_object-sap":196}],308:[function(require,module,exports){
// 19.1.3.10 Object.is(value1, value2)
var $export = require('./_export');
$export($export.S, 'Object', {is: require('./_same-value')});
},{"./_export":150,"./_same-value":207}],309:[function(require,module,exports){
// 19.1.2.14 Object.keys(O)
var toObject = require('./_to-object')
  , $keys    = require('./_object-keys');

require('./_object-sap')('keys', function(){
  return function keys(it){
    return $keys(toObject(it));
  };
});
},{"./_object-keys":194,"./_object-sap":196,"./_to-object":227}],310:[function(require,module,exports){
// 19.1.2.15 Object.preventExtensions(O)
var isObject = require('./_is-object')
  , meta     = require('./_meta').onFreeze;

require('./_object-sap')('preventExtensions', function($preventExtensions){
  return function preventExtensions(it){
    return $preventExtensions && isObject(it) ? $preventExtensions(meta(it)) : it;
  };
});
},{"./_is-object":167,"./_meta":180,"./_object-sap":196}],311:[function(require,module,exports){
// 19.1.2.17 Object.seal(O)
var isObject = require('./_is-object')
  , meta     = require('./_meta').onFreeze;

require('./_object-sap')('seal', function($seal){
  return function seal(it){
    return $seal && isObject(it) ? $seal(meta(it)) : it;
  };
});
},{"./_is-object":167,"./_meta":180,"./_object-sap":196}],312:[function(require,module,exports){
// 19.1.3.19 Object.setPrototypeOf(O, proto)
var $export = require('./_export');
$export($export.S, 'Object', {setPrototypeOf: require('./_set-proto').set});
},{"./_export":150,"./_set-proto":208}],313:[function(require,module,exports){
'use strict';
// 19.1.3.6 Object.prototype.toString()
var classof = require('./_classof')
  , test    = {};
test[require('./_wks')('toStringTag')] = 'z';
if(test + '' != '[object z]'){
  require('./_redefine')(Object.prototype, 'toString', function toString(){
    return '[object ' + classof(this) + ']';
  }, true);
}
},{"./_classof":135,"./_redefine":205,"./_wks":235}],314:[function(require,module,exports){
var $export     = require('./_export')
  , $parseFloat = require('./_parse-float');
// 18.2.4 parseFloat(string)
$export($export.G + $export.F * (parseFloat != $parseFloat), {parseFloat: $parseFloat});
},{"./_export":150,"./_parse-float":199}],315:[function(require,module,exports){
var $export   = require('./_export')
  , $parseInt = require('./_parse-int');
// 18.2.5 parseInt(string, radix)
$export($export.G + $export.F * (parseInt != $parseInt), {parseInt: $parseInt});
},{"./_export":150,"./_parse-int":200}],316:[function(require,module,exports){
'use strict';
var LIBRARY            = require('./_library')
  , global             = require('./_global')
  , ctx                = require('./_ctx')
  , classof            = require('./_classof')
  , $export            = require('./_export')
  , isObject           = require('./_is-object')
  , aFunction          = require('./_a-function')
  , anInstance         = require('./_an-instance')
  , forOf              = require('./_for-of')
  , speciesConstructor = require('./_species-constructor')
  , task               = require('./_task').set
  , microtask          = require('./_microtask')()
  , PROMISE            = 'Promise'
  , TypeError          = global.TypeError
  , process            = global.process
  , $Promise           = global[PROMISE]
  , process            = global.process
  , isNode             = classof(process) == 'process'
  , empty              = function(){ /* empty */ }
  , Internal, GenericPromiseCapability, Wrapper;

var USE_NATIVE = !!function(){
  try {
    // correct subclassing with @@species support
    var promise     = $Promise.resolve(1)
      , FakePromise = (promise.constructor = {})[require('./_wks')('species')] = function(exec){ exec(empty, empty); };
    // unhandled rejections tracking support, NodeJS Promise without it fails @@species test
    return (isNode || typeof PromiseRejectionEvent == 'function') && promise.then(empty) instanceof FakePromise;
  } catch(e){ /* empty */ }
}();

// helpers
var sameConstructor = function(a, b){
  // with library wrapper special case
  return a === b || a === $Promise && b === Wrapper;
};
var isThenable = function(it){
  var then;
  return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
};
var newPromiseCapability = function(C){
  return sameConstructor($Promise, C)
    ? new PromiseCapability(C)
    : new GenericPromiseCapability(C);
};
var PromiseCapability = GenericPromiseCapability = function(C){
  var resolve, reject;
  this.promise = new C(function($$resolve, $$reject){
    if(resolve !== undefined || reject !== undefined)throw TypeError('Bad Promise constructor');
    resolve = $$resolve;
    reject  = $$reject;
  });
  this.resolve = aFunction(resolve);
  this.reject  = aFunction(reject);
};
var perform = function(exec){
  try {
    exec();
  } catch(e){
    return {error: e};
  }
};
var notify = function(promise, isReject){
  if(promise._n)return;
  promise._n = true;
  var chain = promise._c;
  microtask(function(){
    var value = promise._v
      , ok    = promise._s == 1
      , i     = 0;
    var run = function(reaction){
      var handler = ok ? reaction.ok : reaction.fail
        , resolve = reaction.resolve
        , reject  = reaction.reject
        , domain  = reaction.domain
        , result, then;
      try {
        if(handler){
          if(!ok){
            if(promise._h == 2)onHandleUnhandled(promise);
            promise._h = 1;
          }
          if(handler === true)result = value;
          else {
            if(domain)domain.enter();
            result = handler(value);
            if(domain)domain.exit();
          }
          if(result === reaction.promise){
            reject(TypeError('Promise-chain cycle'));
          } else if(then = isThenable(result)){
            then.call(result, resolve, reject);
          } else resolve(result);
        } else reject(value);
      } catch(e){
        reject(e);
      }
    };
    while(chain.length > i)run(chain[i++]); // variable length - can't use forEach
    promise._c = [];
    promise._n = false;
    if(isReject && !promise._h)onUnhandled(promise);
  });
};
var onUnhandled = function(promise){
  task.call(global, function(){
    var value = promise._v
      , abrupt, handler, console;
    if(isUnhandled(promise)){
      abrupt = perform(function(){
        if(isNode){
          process.emit('unhandledRejection', value, promise);
        } else if(handler = global.onunhandledrejection){
          handler({promise: promise, reason: value});
        } else if((console = global.console) && console.error){
          console.error('Unhandled promise rejection', value);
        }
      });
      // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
      promise._h = isNode || isUnhandled(promise) ? 2 : 1;
    } promise._a = undefined;
    if(abrupt)throw abrupt.error;
  });
};
var isUnhandled = function(promise){
  if(promise._h == 1)return false;
  var chain = promise._a || promise._c
    , i     = 0
    , reaction;
  while(chain.length > i){
    reaction = chain[i++];
    if(reaction.fail || !isUnhandled(reaction.promise))return false;
  } return true;
};
var onHandleUnhandled = function(promise){
  task.call(global, function(){
    var handler;
    if(isNode){
      process.emit('rejectionHandled', promise);
    } else if(handler = global.onrejectionhandled){
      handler({promise: promise, reason: promise._v});
    }
  });
};
var $reject = function(value){
  var promise = this;
  if(promise._d)return;
  promise._d = true;
  promise = promise._w || promise; // unwrap
  promise._v = value;
  promise._s = 2;
  if(!promise._a)promise._a = promise._c.slice();
  notify(promise, true);
};
var $resolve = function(value){
  var promise = this
    , then;
  if(promise._d)return;
  promise._d = true;
  promise = promise._w || promise; // unwrap
  try {
    if(promise === value)throw TypeError("Promise can't be resolved itself");
    if(then = isThenable(value)){
      microtask(function(){
        var wrapper = {_w: promise, _d: false}; // wrap
        try {
          then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1));
        } catch(e){
          $reject.call(wrapper, e);
        }
      });
    } else {
      promise._v = value;
      promise._s = 1;
      notify(promise, false);
    }
  } catch(e){
    $reject.call({_w: promise, _d: false}, e); // wrap
  }
};

// constructor polyfill
if(!USE_NATIVE){
  // 25.4.3.1 Promise(executor)
  $Promise = function Promise(executor){
    anInstance(this, $Promise, PROMISE, '_h');
    aFunction(executor);
    Internal.call(this);
    try {
      executor(ctx($resolve, this, 1), ctx($reject, this, 1));
    } catch(err){
      $reject.call(this, err);
    }
  };
  Internal = function Promise(executor){
    this._c = [];             // <- awaiting reactions
    this._a = undefined;      // <- checked in isUnhandled reactions
    this._s = 0;              // <- state
    this._d = false;          // <- done
    this._v = undefined;      // <- value
    this._h = 0;              // <- rejection state, 0 - default, 1 - handled, 2 - unhandled
    this._n = false;          // <- notify
  };
  Internal.prototype = require('./_redefine-all')($Promise.prototype, {
    // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)
    then: function then(onFulfilled, onRejected){
      var reaction    = newPromiseCapability(speciesConstructor(this, $Promise));
      reaction.ok     = typeof onFulfilled == 'function' ? onFulfilled : true;
      reaction.fail   = typeof onRejected == 'function' && onRejected;
      reaction.domain = isNode ? process.domain : undefined;
      this._c.push(reaction);
      if(this._a)this._a.push(reaction);
      if(this._s)notify(this, false);
      return reaction.promise;
    },
    // 25.4.5.1 Promise.prototype.catch(onRejected)
    'catch': function(onRejected){
      return this.then(undefined, onRejected);
    }
  });
  PromiseCapability = function(){
    var promise  = new Internal;
    this.promise = promise;
    this.resolve = ctx($resolve, promise, 1);
    this.reject  = ctx($reject, promise, 1);
  };
}

$export($export.G + $export.W + $export.F * !USE_NATIVE, {Promise: $Promise});
require('./_set-to-string-tag')($Promise, PROMISE);
require('./_set-species')(PROMISE);
Wrapper = require('./_core')[PROMISE];

// statics
$export($export.S + $export.F * !USE_NATIVE, PROMISE, {
  // 25.4.4.5 Promise.reject(r)
  reject: function reject(r){
    var capability = newPromiseCapability(this)
      , $$reject   = capability.reject;
    $$reject(r);
    return capability.promise;
  }
});
$export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, {
  // 25.4.4.6 Promise.resolve(x)
  resolve: function resolve(x){
    // instanceof instead of internal slot check because we should fix it without replacement native Promise core
    if(x instanceof $Promise && sameConstructor(x.constructor, this))return x;
    var capability = newPromiseCapability(this)
      , $$resolve  = capability.resolve;
    $$resolve(x);
    return capability.promise;
  }
});
$export($export.S + $export.F * !(USE_NATIVE && require('./_iter-detect')(function(iter){
  $Promise.all(iter)['catch'](empty);
})), PROMISE, {
  // 25.4.4.1 Promise.all(iterable)
  all: function all(iterable){
    var C          = this
      , capability = newPromiseCapability(C)
      , resolve    = capability.resolve
      , reject     = capability.reject;
    var abrupt = perform(function(){
      var values    = []
        , index     = 0
        , remaining = 1;
      forOf(iterable, false, function(promise){
        var $index        = index++
          , alreadyCalled = false;
        values.push(undefined);
        remaining++;
        C.resolve(promise).then(function(value){
          if(alreadyCalled)return;
          alreadyCalled  = true;
          values[$index] = value;
          --remaining || resolve(values);
        }, reject);
      });
      --remaining || resolve(values);
    });
    if(abrupt)reject(abrupt.error);
    return capability.promise;
  },
  // 25.4.4.4 Promise.race(iterable)
  race: function race(iterable){
    var C          = this
      , capability = newPromiseCapability(C)
      , reject     = capability.reject;
    var abrupt = perform(function(){
      forOf(iterable, false, function(promise){
        C.resolve(promise).then(capability.resolve, reject);
      });
    });
    if(abrupt)reject(abrupt.error);
    return capability.promise;
  }
});
},{"./_a-function":121,"./_an-instance":124,"./_classof":135,"./_core":141,"./_ctx":143,"./_export":150,"./_for-of":155,"./_global":156,"./_is-object":167,"./_iter-detect":172,"./_library":176,"./_microtask":182,"./_redefine-all":204,"./_set-species":209,"./_set-to-string-tag":210,"./_species-constructor":213,"./_task":222,"./_wks":235}],317:[function(require,module,exports){
// 26.1.1 Reflect.apply(target, thisArgument, argumentsList)
var $export   = require('./_export')
  , aFunction = require('./_a-function')
  , anObject  = require('./_an-object')
  , rApply    = (require('./_global').Reflect || {}).apply
  , fApply    = Function.apply;
// MS Edge argumentsList argument is optional
$export($export.S + $export.F * !require('./_fails')(function(){
  rApply(function(){});
}), 'Reflect', {
  apply: function apply(target, thisArgument, argumentsList){
    var T = aFunction(target)
      , L = anObject(argumentsList);
    return rApply ? rApply(T, thisArgument, L) : fApply.call(T, thisArgument, L);
  }
});
},{"./_a-function":121,"./_an-object":125,"./_export":150,"./_fails":152,"./_global":156}],318:[function(require,module,exports){
// 26.1.2 Reflect.construct(target, argumentsList [, newTarget])
var $export    = require('./_export')
  , create     = require('./_object-create')
  , aFunction  = require('./_a-function')
  , anObject   = require('./_an-object')
  , isObject   = require('./_is-object')
  , fails      = require('./_fails')
  , bind       = require('./_bind')
  , rConstruct = (require('./_global').Reflect || {}).construct;

// MS Edge supports only 2 arguments and argumentsList argument is optional
// FF Nightly sets third argument as `new.target`, but does not create `this` from it
var NEW_TARGET_BUG = fails(function(){
  function F(){}
  return !(rConstruct(function(){}, [], F) instanceof F);
});
var ARGS_BUG = !fails(function(){
  rConstruct(function(){});
});

$export($export.S + $export.F * (NEW_TARGET_BUG || ARGS_BUG), 'Reflect', {
  construct: function construct(Target, args /*, newTarget*/){
    aFunction(Target);
    anObject(args);
    var newTarget = arguments.length < 3 ? Target : aFunction(arguments[2]);
    if(ARGS_BUG && !NEW_TARGET_BUG)return rConstruct(Target, args, newTarget);
    if(Target == newTarget){
      // w/o altered newTarget, optimization for 0-4 arguments
      switch(args.length){
        case 0: return new Target;
        case 1: return new Target(args[0]);
        case 2: return new Target(args[0], args[1]);
        case 3: return new Target(args[0], args[1], args[2]);
        case 4: return new Target(args[0], args[1], args[2], args[3]);
      }
      // w/o altered newTarget, lot of arguments case
      var $args = [null];
      $args.push.apply($args, args);
      return new (bind.apply(Target, $args));
    }
    // with altered newTarget, not support built-in constructors
    var proto    = newTarget.prototype
      , instance = create(isObject(proto) ? proto : Object.prototype)
      , result   = Function.apply.call(Target, instance, args);
    return isObject(result) ? result : instance;
  }
});
},{"./_a-function":121,"./_an-object":125,"./_bind":134,"./_export":150,"./_fails":152,"./_global":156,"./_is-object":167,"./_object-create":184}],319:[function(require,module,exports){
// 26.1.3 Reflect.defineProperty(target, propertyKey, attributes)
var dP          = require('./_object-dp')
  , $export     = require('./_export')
  , anObject    = require('./_an-object')
  , toPrimitive = require('./_to-primitive');

// MS Edge has broken Reflect.defineProperty - throwing instead of returning false
$export($export.S + $export.F * require('./_fails')(function(){
  Reflect.defineProperty(dP.f({}, 1, {value: 1}), 1, {value: 2});
}), 'Reflect', {
  defineProperty: function defineProperty(target, propertyKey, attributes){
    anObject(target);
    propertyKey = toPrimitive(propertyKey, true);
    anObject(attributes);
    try {
      dP.f(target, propertyKey, attributes);
      return true;
    } catch(e){
      return false;
    }
  }
});
},{"./_an-object":125,"./_export":150,"./_fails":152,"./_object-dp":185,"./_to-primitive":228}],320:[function(require,module,exports){
// 26.1.4 Reflect.deleteProperty(target, propertyKey)
var $export  = require('./_export')
  , gOPD     = require('./_object-gopd').f
  , anObject = require('./_an-object');

$export($export.S, 'Reflect', {
  deleteProperty: function deleteProperty(target, propertyKey){
    var desc = gOPD(anObject(target), propertyKey);
    return desc && !desc.configurable ? false : delete target[propertyKey];
  }
});
},{"./_an-object":125,"./_export":150,"./_object-gopd":188}],321:[function(require,module,exports){
'use strict';
// 26.1.5 Reflect.enumerate(target)
var $export  = require('./_export')
  , anObject = require('./_an-object');
var Enumerate = function(iterated){
  this._t = anObject(iterated); // target
  this._i = 0;                  // next index
  var keys = this._k = []       // keys
    , key;
  for(key in iterated)keys.push(key);
};
require('./_iter-create')(Enumerate, 'Object', function(){
  var that = this
    , keys = that._k
    , key;
  do {
    if(that._i >= keys.length)return {value: undefined, done: true};
  } while(!((key = keys[that._i++]) in that._t));
  return {value: key, done: false};
});

$export($export.S, 'Reflect', {
  enumerate: function enumerate(target){
    return new Enumerate(target);
  }
});
},{"./_an-object":125,"./_export":150,"./_iter-create":170}],322:[function(require,module,exports){
// 26.1.7 Reflect.getOwnPropertyDescriptor(target, propertyKey)
var gOPD     = require('./_object-gopd')
  , $export  = require('./_export')
  , anObject = require('./_an-object');

$export($export.S, 'Reflect', {
  getOwnPropertyDescriptor: function getOwnPropertyDescriptor(target, propertyKey){
    return gOPD.f(anObject(target), propertyKey);
  }
});
},{"./_an-object":125,"./_export":150,"./_object-gopd":188}],323:[function(require,module,exports){
// 26.1.8 Reflect.getPrototypeOf(target)
var $export  = require('./_export')
  , getProto = require('./_object-gpo')
  , anObject = require('./_an-object');

$export($export.S, 'Reflect', {
  getPrototypeOf: function getPrototypeOf(target){
    return getProto(anObject(target));
  }
});
},{"./_an-object":125,"./_export":150,"./_object-gpo":192}],324:[function(require,module,exports){
// 26.1.6 Reflect.get(target, propertyKey [, receiver])
var gOPD           = require('./_object-gopd')
  , getPrototypeOf = require('./_object-gpo')
  , has            = require('./_has')
  , $export        = require('./_export')
  , isObject       = require('./_is-object')
  , anObject       = require('./_an-object');

function get(target, propertyKey/*, receiver*/){
  var receiver = arguments.length < 3 ? target : arguments[2]
    , desc, proto;
  if(anObject(target) === receiver)return target[propertyKey];
  if(desc = gOPD.f(target, propertyKey))return has(desc, 'value')
    ? desc.value
    : desc.get !== undefined
      ? desc.get.call(receiver)
      : undefined;
  if(isObject(proto = getPrototypeOf(target)))return get(proto, propertyKey, receiver);
}

$export($export.S, 'Reflect', {get: get});
},{"./_an-object":125,"./_export":150,"./_has":157,"./_is-object":167,"./_object-gopd":188,"./_object-gpo":192}],325:[function(require,module,exports){
// 26.1.9 Reflect.has(target, propertyKey)
var $export = require('./_export');

$export($export.S, 'Reflect', {
  has: function has(target, propertyKey){
    return propertyKey in target;
  }
});
},{"./_export":150}],326:[function(require,module,exports){
// 26.1.10 Reflect.isExtensible(target)
var $export       = require('./_export')
  , anObject      = require('./_an-object')
  , $isExtensible = Object.isExtensible;

$export($export.S, 'Reflect', {
  isExtensible: function isExtensible(target){
    anObject(target);
    return $isExtensible ? $isExtensible(target) : true;
  }
});
},{"./_an-object":125,"./_export":150}],327:[function(require,module,exports){
// 26.1.11 Reflect.ownKeys(target)
var $export = require('./_export');

$export($export.S, 'Reflect', {ownKeys: require('./_own-keys')});
},{"./_export":150,"./_own-keys":198}],328:[function(require,module,exports){
// 26.1.12 Reflect.preventExtensions(target)
var $export            = require('./_export')
  , anObject           = require('./_an-object')
  , $preventExtensions = Object.preventExtensions;

$export($export.S, 'Reflect', {
  preventExtensions: function preventExtensions(target){
    anObject(target);
    try {
      if($preventExtensions)$preventExtensions(target);
      return true;
    } catch(e){
      return false;
    }
  }
});
},{"./_an-object":125,"./_export":150}],329:[function(require,module,exports){
// 26.1.14 Reflect.setPrototypeOf(target, proto)
var $export  = require('./_export')
  , setProto = require('./_set-proto');

if(setProto)$export($export.S, 'Reflect', {
  setPrototypeOf: function setPrototypeOf(target, proto){
    setProto.check(target, proto);
    try {
      setProto.set(target, proto);
      return true;
    } catch(e){
      return false;
    }
  }
});
},{"./_export":150,"./_set-proto":208}],330:[function(require,module,exports){
// 26.1.13 Reflect.set(target, propertyKey, V [, receiver])
var dP             = require('./_object-dp')
  , gOPD           = require('./_object-gopd')
  , getPrototypeOf = require('./_object-gpo')
  , has            = require('./_has')
  , $export        = require('./_export')
  , createDesc     = require('./_property-desc')
  , anObject       = require('./_an-object')
  , isObject       = require('./_is-object');

function set(target, propertyKey, V/*, receiver*/){
  var receiver = arguments.length < 4 ? target : arguments[3]
    , ownDesc  = gOPD.f(anObject(target), propertyKey)
    , existingDescriptor, proto;
  if(!ownDesc){
    if(isObject(proto = getPrototypeOf(target))){
      return set(proto, propertyKey, V, receiver);
    }
    ownDesc = createDesc(0);
  }
  if(has(ownDesc, 'value')){
    if(ownDesc.writable === false || !isObject(receiver))return false;
    existingDescriptor = gOPD.f(receiver, propertyKey) || createDesc(0);
    existingDescriptor.value = V;
    dP.f(receiver, propertyKey, existingDescriptor);
    return true;
  }
  return ownDesc.set === undefined ? false : (ownDesc.set.call(receiver, V), true);
}

$export($export.S, 'Reflect', {set: set});
},{"./_an-object":125,"./_export":150,"./_has":157,"./_is-object":167,"./_object-dp":185,"./_object-gopd":188,"./_object-gpo":192,"./_property-desc":203}],331:[function(require,module,exports){
var global            = require('./_global')
  , inheritIfRequired = require('./_inherit-if-required')
  , dP                = require('./_object-dp').f
  , gOPN              = require('./_object-gopn').f
  , isRegExp          = require('./_is-regexp')
  , $flags            = require('./_flags')
  , $RegExp           = global.RegExp
  , Base              = $RegExp
  , proto             = $RegExp.prototype
  , re1               = /a/g
  , re2               = /a/g
  // "new" creates a new object, old webkit buggy here
  , CORRECT_NEW       = new $RegExp(re1) !== re1;

if(require('./_descriptors') && (!CORRECT_NEW || require('./_fails')(function(){
  re2[require('./_wks')('match')] = false;
  // RegExp constructor can alter flags and IsRegExp works correct with @@match
  return $RegExp(re1) != re1 || $RegExp(re2) == re2 || $RegExp(re1, 'i') != '/a/i';
}))){
  $RegExp = function RegExp(p, f){
    var tiRE = this instanceof $RegExp
      , piRE = isRegExp(p)
      , fiU  = f === undefined;
    return !tiRE && piRE && p.constructor === $RegExp && fiU ? p
      : inheritIfRequired(CORRECT_NEW
        ? new Base(piRE && !fiU ? p.source : p, f)
        : Base((piRE = p instanceof $RegExp) ? p.source : p, piRE && fiU ? $flags.call(p) : f)
      , tiRE ? this : proto, $RegExp);
  };
  var proxy = function(key){
    key in $RegExp || dP($RegExp, key, {
      configurable: true,
      get: function(){ return Base[key]; },
      set: function(it){ Base[key] = it; }
    });
  };
  for(var keys = gOPN(Base), i = 0; keys.length > i; )proxy(keys[i++]);
  proto.constructor = $RegExp;
  $RegExp.prototype = proto;
  require('./_redefine')(global, 'RegExp', $RegExp);
}

require('./_set-species')('RegExp');
},{"./_descriptors":146,"./_fails":152,"./_flags":154,"./_global":156,"./_inherit-if-required":161,"./_is-regexp":168,"./_object-dp":185,"./_object-gopn":190,"./_redefine":205,"./_set-species":209,"./_wks":235}],332:[function(require,module,exports){
// 21.2.5.3 get RegExp.prototype.flags()
if(require('./_descriptors') && /./g.flags != 'g')require('./_object-dp').f(RegExp.prototype, 'flags', {
  configurable: true,
  get: require('./_flags')
});
},{"./_descriptors":146,"./_flags":154,"./_object-dp":185}],333:[function(require,module,exports){
// @@match logic
require('./_fix-re-wks')('match', 1, function(defined, MATCH, $match){
  // 21.1.3.11 String.prototype.match(regexp)
  return [function match(regexp){
    'use strict';
    var O  = defined(this)
      , fn = regexp == undefined ? undefined : regexp[MATCH];
    return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));
  }, $match];
});
},{"./_fix-re-wks":153}],334:[function(require,module,exports){
// @@replace logic
require('./_fix-re-wks')('replace', 2, function(defined, REPLACE, $replace){
  // 21.1.3.14 String.prototype.replace(searchValue, replaceValue)
  return [function replace(searchValue, replaceValue){
    'use strict';
    var O  = defined(this)
      , fn = searchValue == undefined ? undefined : searchValue[REPLACE];
    return fn !== undefined
      ? fn.call(searchValue, O, replaceValue)
      : $replace.call(String(O), searchValue, replaceValue);
  }, $replace];
});
},{"./_fix-re-wks":153}],335:[function(require,module,exports){
// @@search logic
require('./_fix-re-wks')('search', 1, function(defined, SEARCH, $search){
  // 21.1.3.15 String.prototype.search(regexp)
  return [function search(regexp){
    'use strict';
    var O  = defined(this)
      , fn = regexp == undefined ? undefined : regexp[SEARCH];
    return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O));
  }, $search];
});
},{"./_fix-re-wks":153}],336:[function(require,module,exports){
// @@split logic
require('./_fix-re-wks')('split', 2, function(defined, SPLIT, $split){
  'use strict';
  var isRegExp   = require('./_is-regexp')
    , _split     = $split
    , $push      = [].push
    , $SPLIT     = 'split'
    , LENGTH     = 'length'
    , LAST_INDEX = 'lastIndex';
  if(
    'abbc'[$SPLIT](/(b)*/)[1] == 'c' ||
    'test'[$SPLIT](/(?:)/, -1)[LENGTH] != 4 ||
    'ab'[$SPLIT](/(?:ab)*/)[LENGTH] != 2 ||
    '.'[$SPLIT](/(.?)(.?)/)[LENGTH] != 4 ||
    '.'[$SPLIT](/()()/)[LENGTH] > 1 ||
    ''[$SPLIT](/.?/)[LENGTH]
  ){
    var NPCG = /()??/.exec('')[1] === undefined; // nonparticipating capturing group
    // based on es5-shim implementation, need to rework it
    $split = function(separator, limit){
      var string = String(this);
      if(separator === undefined && limit === 0)return [];
      // If `separator` is not a regex, use native split
      if(!isRegExp(separator))return _split.call(string, separator, limit);
      var output = [];
      var flags = (separator.ignoreCase ? 'i' : '') +
                  (separator.multiline ? 'm' : '') +
                  (separator.unicode ? 'u' : '') +
                  (separator.sticky ? 'y' : '');
      var lastLastIndex = 0;
      var splitLimit = limit === undefined ? 4294967295 : limit >>> 0;
      // Make `global` and avoid `lastIndex` issues by working with a copy
      var separatorCopy = new RegExp(separator.source, flags + 'g');
      var separator2, match, lastIndex, lastLength, i;
      // Doesn't need flags gy, but they don't hurt
      if(!NPCG)separator2 = new RegExp('^' + separatorCopy.source + '$(?!\\s)', flags);
      while(match = separatorCopy.exec(string)){
        // `separatorCopy.lastIndex` is not reliable cross-browser
        lastIndex = match.index + match[0][LENGTH];
        if(lastIndex > lastLastIndex){
          output.push(string.slice(lastLastIndex, match.index));
          // Fix browsers whose `exec` methods don't consistently return `undefined` for NPCG
          if(!NPCG && match[LENGTH] > 1)match[0].replace(separator2, function(){
            for(i = 1; i < arguments[LENGTH] - 2; i++)if(arguments[i] === undefined)match[i] = undefined;
          });
          if(match[LENGTH] > 1 && match.index < string[LENGTH])$push.apply(output, match.slice(1));
          lastLength = match[0][LENGTH];
          lastLastIndex = lastIndex;
          if(output[LENGTH] >= splitLimit)break;
        }
        if(separatorCopy[LAST_INDEX] === match.index)separatorCopy[LAST_INDEX]++; // Avoid an infinite loop
      }
      if(lastLastIndex === string[LENGTH]){
        if(lastLength || !separatorCopy.test(''))output.push('');
      } else output.push(string.slice(lastLastIndex));
      return output[LENGTH] > splitLimit ? output.slice(0, splitLimit) : output;
    };
  // Chakra, V8
  } else if('0'[$SPLIT](undefined, 0)[LENGTH]){
    $split = function(separator, limit){
      return separator === undefined && limit === 0 ? [] : _split.call(this, separator, limit);
    };
  }
  // 21.1.3.17 String.prototype.split(separator, limit)
  return [function split(separator, limit){
    var O  = defined(this)
      , fn = separator == undefined ? undefined : separator[SPLIT];
    return fn !== undefined ? fn.call(separator, O, limit) : $split.call(String(O), separator, limit);
  }, $split];
});
},{"./_fix-re-wks":153,"./_is-regexp":168}],337:[function(require,module,exports){
'use strict';
require('./es6.regexp.flags');
var anObject    = require('./_an-object')
  , $flags      = require('./_flags')
  , DESCRIPTORS = require('./_descriptors')
  , TO_STRING   = 'toString'
  , $toString   = /./[TO_STRING];

var define = function(fn){
  require('./_redefine')(RegExp.prototype, TO_STRING, fn, true);
};

// 21.2.5.14 RegExp.prototype.toString()
if(require('./_fails')(function(){ return $toString.call({source: 'a', flags: 'b'}) != '/a/b'; })){
  define(function toString(){
    var R = anObject(this);
    return '/'.concat(R.source, '/',
      'flags' in R ? R.flags : !DESCRIPTORS && R instanceof RegExp ? $flags.call(R) : undefined);
  });
// FF44- RegExp#toString has a wrong name
} else if($toString.name != TO_STRING){
  define(function toString(){
    return $toString.call(this);
  });
}
},{"./_an-object":125,"./_descriptors":146,"./_fails":152,"./_flags":154,"./_redefine":205,"./es6.regexp.flags":332}],338:[function(require,module,exports){
'use strict';
var strong = require('./_collection-strong');

// 23.2 Set Objects
module.exports = require('./_collection')('Set', function(get){
  return function Set(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); };
}, {
  // 23.2.3.1 Set.prototype.add(value)
  add: function add(value){
    return strong.def(this, value = value === 0 ? 0 : value, value);
  }
}, strong);
},{"./_collection":140,"./_collection-strong":137}],339:[function(require,module,exports){
'use strict';
// B.2.3.2 String.prototype.anchor(name)
require('./_string-html')('anchor', function(createHTML){
  return function anchor(name){
    return createHTML(this, 'a', 'name', name);
  }
});
},{"./_string-html":217}],340:[function(require,module,exports){
'use strict';
// B.2.3.3 String.prototype.big()
require('./_string-html')('big', function(createHTML){
  return function big(){
    return createHTML(this, 'big', '', '');
  }
});
},{"./_string-html":217}],341:[function(require,module,exports){
'use strict';
// B.2.3.4 String.prototype.blink()
require('./_string-html')('blink', function(createHTML){
  return function blink(){
    return createHTML(this, 'blink', '', '');
  }
});
},{"./_string-html":217}],342:[function(require,module,exports){
'use strict';
// B.2.3.5 String.prototype.bold()
require('./_string-html')('bold', function(createHTML){
  return function bold(){
    return createHTML(this, 'b', '', '');
  }
});
},{"./_string-html":217}],343:[function(require,module,exports){
'use strict';
var $export = require('./_export')
  , $at     = require('./_string-at')(false);
$export($export.P, 'String', {
  // 21.1.3.3 String.prototype.codePointAt(pos)
  codePointAt: function codePointAt(pos){
    return $at(this, pos);
  }
});
},{"./_export":150,"./_string-at":215}],344:[function(require,module,exports){
// 21.1.3.6 String.prototype.endsWith(searchString [, endPosition])
'use strict';
var $export   = require('./_export')
  , toLength  = require('./_to-length')
  , context   = require('./_string-context')
  , ENDS_WITH = 'endsWith'
  , $endsWith = ''[ENDS_WITH];

$export($export.P + $export.F * require('./_fails-is-regexp')(ENDS_WITH), 'String', {
  endsWith: function endsWith(searchString /*, endPosition = @length */){
    var that = context(this, searchString, ENDS_WITH)
      , endPosition = arguments.length > 1 ? arguments[1] : undefined
      , len    = toLength(that.length)
      , end    = endPosition === undefined ? len : Math.min(toLength(endPosition), len)
      , search = String(searchString);
    return $endsWith
      ? $endsWith.call(that, search, end)
      : that.slice(end - search.length, end) === search;
  }
});
},{"./_export":150,"./_fails-is-regexp":151,"./_string-context":216,"./_to-length":226}],345:[function(require,module,exports){
'use strict';
// B.2.3.6 String.prototype.fixed()
require('./_string-html')('fixed', function(createHTML){
  return function fixed(){
    return createHTML(this, 'tt', '', '');
  }
});
},{"./_string-html":217}],346:[function(require,module,exports){
'use strict';
// B.2.3.7 String.prototype.fontcolor(color)
require('./_string-html')('fontcolor', function(createHTML){
  return function fontcolor(color){
    return createHTML(this, 'font', 'color', color);
  }
});
},{"./_string-html":217}],347:[function(require,module,exports){
'use strict';
// B.2.3.8 String.prototype.fontsize(size)
require('./_string-html')('fontsize', function(createHTML){
  return function fontsize(size){
    return createHTML(this, 'font', 'size', size);
  }
});
},{"./_string-html":217}],348:[function(require,module,exports){
var $export        = require('./_export')
  , toIndex        = require('./_to-index')
  , fromCharCode   = String.fromCharCode
  , $fromCodePoint = String.fromCodePoint;

// length should be 1, old FF problem
$export($export.S + $export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', {
  // 21.1.2.2 String.fromCodePoint(...codePoints)
  fromCodePoint: function fromCodePoint(x){ // eslint-disable-line no-unused-vars
    var res  = []
      , aLen = arguments.length
      , i    = 0
      , code;
    while(aLen > i){
      code = +arguments[i++];
      if(toIndex(code, 0x10ffff) !== code)throw RangeError(code + ' is not a valid code point');
      res.push(code < 0x10000
        ? fromCharCode(code)
        : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00)
      );
    } return res.join('');
  }
});
},{"./_export":150,"./_to-index":223}],349:[function(require,module,exports){
// 21.1.3.7 String.prototype.includes(searchString, position = 0)
'use strict';
var $export  = require('./_export')
  , context  = require('./_string-context')
  , INCLUDES = 'includes';

$export($export.P + $export.F * require('./_fails-is-regexp')(INCLUDES), 'String', {
  includes: function includes(searchString /*, position = 0 */){
    return !!~context(this, searchString, INCLUDES)
      .indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined);
  }
});
},{"./_export":150,"./_fails-is-regexp":151,"./_string-context":216}],350:[function(require,module,exports){
'use strict';
// B.2.3.9 String.prototype.italics()
require('./_string-html')('italics', function(createHTML){
  return function italics(){
    return createHTML(this, 'i', '', '');
  }
});
},{"./_string-html":217}],351:[function(require,module,exports){
'use strict';
var $at  = require('./_string-at')(true);

// 21.1.3.27 String.prototype[@@iterator]()
require('./_iter-define')(String, 'String', function(iterated){
  this._t = String(iterated); // target
  this._i = 0;                // next index
// 21.1.5.2.1 %StringIteratorPrototype%.next()
}, function(){
  var O     = this._t
    , index = this._i
    , point;
  if(index >= O.length)return {value: undefined, done: true};
  point = $at(O, index);
  this._i += point.length;
  return {value: point, done: false};
});
},{"./_iter-define":171,"./_string-at":215}],352:[function(require,module,exports){
'use strict';
// B.2.3.10 String.prototype.link(url)
require('./_string-html')('link', function(createHTML){
  return function link(url){
    return createHTML(this, 'a', 'href', url);
  }
});
},{"./_string-html":217}],353:[function(require,module,exports){
var $export   = require('./_export')
  , toIObject = require('./_to-iobject')
  , toLength  = require('./_to-length');

$export($export.S, 'String', {
  // 21.1.2.4 String.raw(callSite, ...substitutions)
  raw: function raw(callSite){
    var tpl  = toIObject(callSite.raw)
      , len  = toLength(tpl.length)
      , aLen = arguments.length
      , res  = []
      , i    = 0;
    while(len > i){
      res.push(String(tpl[i++]));
      if(i < aLen)res.push(String(arguments[i]));
    } return res.join('');
  }
});
},{"./_export":150,"./_to-iobject":225,"./_to-length":226}],354:[function(require,module,exports){
var $export = require('./_export');

$export($export.P, 'String', {
  // 21.1.3.13 String.prototype.repeat(count)
  repeat: require('./_string-repeat')
});
},{"./_export":150,"./_string-repeat":219}],355:[function(require,module,exports){
'use strict';
// B.2.3.11 String.prototype.small()
require('./_string-html')('small', function(createHTML){
  return function small(){
    return createHTML(this, 'small', '', '');
  }
});
},{"./_string-html":217}],356:[function(require,module,exports){
// 21.1.3.18 String.prototype.startsWith(searchString [, position ])
'use strict';
var $export     = require('./_export')
  , toLength    = require('./_to-length')
  , context     = require('./_string-context')
  , STARTS_WITH = 'startsWith'
  , $startsWith = ''[STARTS_WITH];

$export($export.P + $export.F * require('./_fails-is-regexp')(STARTS_WITH), 'String', {
  startsWith: function startsWith(searchString /*, position = 0 */){
    var that   = context(this, searchString, STARTS_WITH)
      , index  = toLength(Math.min(arguments.length > 1 ? arguments[1] : undefined, that.length))
      , search = String(searchString);
    return $startsWith
      ? $startsWith.call(that, search, index)
      : that.slice(index, index + search.length) === search;
  }
});
},{"./_export":150,"./_fails-is-regexp":151,"./_string-context":216,"./_to-length":226}],357:[function(require,module,exports){
'use strict';
// B.2.3.12 String.prototype.strike()
require('./_string-html')('strike', function(createHTML){
  return function strike(){
    return createHTML(this, 'strike', '', '');
  }
});
},{"./_string-html":217}],358:[function(require,module,exports){
'use strict';
// B.2.3.13 String.prototype.sub()
require('./_string-html')('sub', function(createHTML){
  return function sub(){
    return createHTML(this, 'sub', '', '');
  }
});
},{"./_string-html":217}],359:[function(require,module,exports){
'use strict';
// B.2.3.14 String.prototype.sup()
require('./_string-html')('sup', function(createHTML){
  return function sup(){
    return createHTML(this, 'sup', '', '');
  }
});
},{"./_string-html":217}],360:[function(require,module,exports){
'use strict';
// 21.1.3.25 String.prototype.trim()
require('./_string-trim')('trim', function($trim){
  return function trim(){
    return $trim(this, 3);
  };
});
},{"./_string-trim":220}],361:[function(require,module,exports){
'use strict';
// ECMAScript 6 symbols shim
var global         = require('./_global')
  , has            = require('./_has')
  , DESCRIPTORS    = require('./_descriptors')
  , $export        = require('./_export')
  , redefine       = require('./_redefine')
  , META           = require('./_meta').KEY
  , $fails         = require('./_fails')
  , shared         = require('./_shared')
  , setToStringTag = require('./_set-to-string-tag')
  , uid            = require('./_uid')
  , wks            = require('./_wks')
  , wksExt         = require('./_wks-ext')
  , wksDefine      = require('./_wks-define')
  , keyOf          = require('./_keyof')
  , enumKeys       = require('./_enum-keys')
  , isArray        = require('./_is-array')
  , anObject       = require('./_an-object')
  , toIObject      = require('./_to-iobject')
  , toPrimitive    = require('./_to-primitive')
  , createDesc     = require('./_property-desc')
  , _create        = require('./_object-create')
  , gOPNExt        = require('./_object-gopn-ext')
  , $GOPD          = require('./_object-gopd')
  , $DP            = require('./_object-dp')
  , $keys          = require('./_object-keys')
  , gOPD           = $GOPD.f
  , dP             = $DP.f
  , gOPN           = gOPNExt.f
  , $Symbol        = global.Symbol
  , $JSON          = global.JSON
  , _stringify     = $JSON && $JSON.stringify
  , PROTOTYPE      = 'prototype'
  , HIDDEN         = wks('_hidden')
  , TO_PRIMITIVE   = wks('toPrimitive')
  , isEnum         = {}.propertyIsEnumerable
  , SymbolRegistry = shared('symbol-registry')
  , AllSymbols     = shared('symbols')
  , OPSymbols      = shared('op-symbols')
  , ObjectProto    = Object[PROTOTYPE]
  , USE_NATIVE     = typeof $Symbol == 'function'
  , QObject        = global.QObject;
// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;

// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
var setSymbolDesc = DESCRIPTORS && $fails(function(){
  return _create(dP({}, 'a', {
    get: function(){ return dP(this, 'a', {value: 7}).a; }
  })).a != 7;
}) ? function(it, key, D){
  var protoDesc = gOPD(ObjectProto, key);
  if(protoDesc)delete ObjectProto[key];
  dP(it, key, D);
  if(protoDesc && it !== ObjectProto)dP(ObjectProto, key, protoDesc);
} : dP;

var wrap = function(tag){
  var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);
  sym._k = tag;
  return sym;
};

var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function(it){
  return typeof it == 'symbol';
} : function(it){
  return it instanceof $Symbol;
};

var $defineProperty = function defineProperty(it, key, D){
  if(it === ObjectProto)$defineProperty(OPSymbols, key, D);
  anObject(it);
  key = toPrimitive(key, true);
  anObject(D);
  if(has(AllSymbols, key)){
    if(!D.enumerable){
      if(!has(it, HIDDEN))dP(it, HIDDEN, createDesc(1, {}));
      it[HIDDEN][key] = true;
    } else {
      if(has(it, HIDDEN) && it[HIDDEN][key])it[HIDDEN][key] = false;
      D = _create(D, {enumerable: createDesc(0, false)});
    } return setSymbolDesc(it, key, D);
  } return dP(it, key, D);
};
var $defineProperties = function defineProperties(it, P){
  anObject(it);
  var keys = enumKeys(P = toIObject(P))
    , i    = 0
    , l = keys.length
    , key;
  while(l > i)$defineProperty(it, key = keys[i++], P[key]);
  return it;
};
var $create = function create(it, P){
  return P === undefined ? _create(it) : $defineProperties(_create(it), P);
};
var $propertyIsEnumerable = function propertyIsEnumerable(key){
  var E = isEnum.call(this, key = toPrimitive(key, true));
  if(this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return false;
  return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true;
};
var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key){
  it  = toIObject(it);
  key = toPrimitive(key, true);
  if(it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return;
  var D = gOPD(it, key);
  if(D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key]))D.enumerable = true;
  return D;
};
var $getOwnPropertyNames = function getOwnPropertyNames(it){
  var names  = gOPN(toIObject(it))
    , result = []
    , i      = 0
    , key;
  while(names.length > i){
    if(!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META)result.push(key);
  } return result;
};
var $getOwnPropertySymbols = function getOwnPropertySymbols(it){
  var IS_OP  = it === ObjectProto
    , names  = gOPN(IS_OP ? OPSymbols : toIObject(it))
    , result = []
    , i      = 0
    , key;
  while(names.length > i){
    if(has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true))result.push(AllSymbols[key]);
  } return result;
};

// 19.4.1.1 Symbol([description])
if(!USE_NATIVE){
  $Symbol = function Symbol(){
    if(this instanceof $Symbol)throw TypeError('Symbol is not a constructor!');
    var tag = uid(arguments.length > 0 ? arguments[0] : undefined);
    var $set = function(value){
      if(this === ObjectProto)$set.call(OPSymbols, value);
      if(has(this, HIDDEN) && has(this[HIDDEN], tag))this[HIDDEN][tag] = false;
      setSymbolDesc(this, tag, createDesc(1, value));
    };
    if(DESCRIPTORS && setter)setSymbolDesc(ObjectProto, tag, {configurable: true, set: $set});
    return wrap(tag);
  };
  redefine($Symbol[PROTOTYPE], 'toString', function toString(){
    return this._k;
  });

  $GOPD.f = $getOwnPropertyDescriptor;
  $DP.f   = $defineProperty;
  require('./_object-gopn').f = gOPNExt.f = $getOwnPropertyNames;
  require('./_object-pie').f  = $propertyIsEnumerable;
  require('./_object-gops').f = $getOwnPropertySymbols;

  if(DESCRIPTORS && !require('./_library')){
    redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);
  }

  wksExt.f = function(name){
    return wrap(wks(name));
  }
}

$export($export.G + $export.W + $export.F * !USE_NATIVE, {Symbol: $Symbol});

for(var symbols = (
  // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14
  'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'
).split(','), i = 0; symbols.length > i; )wks(symbols[i++]);

for(var symbols = $keys(wks.store), i = 0; symbols.length > i; )wksDefine(symbols[i++]);

$export($export.S + $export.F * !USE_NATIVE, 'Symbol', {
  // 19.4.2.1 Symbol.for(key)
  'for': function(key){
    return has(SymbolRegistry, key += '')
      ? SymbolRegistry[key]
      : SymbolRegistry[key] = $Symbol(key);
  },
  // 19.4.2.5 Symbol.keyFor(sym)
  keyFor: function keyFor(key){
    if(isSymbol(key))return keyOf(SymbolRegistry, key);
    throw TypeError(key + ' is not a symbol!');
  },
  useSetter: function(){ setter = true; },
  useSimple: function(){ setter = false; }
});

$export($export.S + $export.F * !USE_NATIVE, 'Object', {
  // 19.1.2.2 Object.create(O [, Properties])
  create: $create,
  // 19.1.2.4 Object.defineProperty(O, P, Attributes)
  defineProperty: $defineProperty,
  // 19.1.2.3 Object.defineProperties(O, Properties)
  defineProperties: $defineProperties,
  // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
  getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
  // 19.1.2.7 Object.getOwnPropertyNames(O)
  getOwnPropertyNames: $getOwnPropertyNames,
  // 19.1.2.8 Object.getOwnPropertySymbols(O)
  getOwnPropertySymbols: $getOwnPropertySymbols
});

// 24.3.2 JSON.stringify(value [, replacer [, space]])
$JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function(){
  var S = $Symbol();
  // MS Edge converts symbol values to JSON as {}
  // WebKit converts symbol values to JSON as null
  // V8 throws on boxed symbols
  return _stringify([S]) != '[null]' || _stringify({a: S}) != '{}' || _stringify(Object(S)) != '{}';
})), 'JSON', {
  stringify: function stringify(it){
    if(it === undefined || isSymbol(it))return; // IE8 returns string on undefined
    var args = [it]
      , i    = 1
      , replacer, $replacer;
    while(arguments.length > i)args.push(arguments[i++]);
    replacer = args[1];
    if(typeof replacer == 'function')$replacer = replacer;
    if($replacer || !isArray(replacer))replacer = function(key, value){
      if($replacer)value = $replacer.call(this, key, value);
      if(!isSymbol(value))return value;
    };
    args[1] = replacer;
    return _stringify.apply($JSON, args);
  }
});

// 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)
$Symbol[PROTOTYPE][TO_PRIMITIVE] || require('./_hide')($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
// 19.4.3.5 Symbol.prototype[@@toStringTag]
setToStringTag($Symbol, 'Symbol');
// 20.2.1.9 Math[@@toStringTag]
setToStringTag(Math, 'Math', true);
// 24.3.3 JSON[@@toStringTag]
setToStringTag(global.JSON, 'JSON', true);
},{"./_an-object":125,"./_descriptors":146,"./_enum-keys":149,"./_export":150,"./_fails":152,"./_global":156,"./_has":157,"./_hide":158,"./_is-array":165,"./_keyof":175,"./_library":176,"./_meta":180,"./_object-create":184,"./_object-dp":185,"./_object-gopd":188,"./_object-gopn":190,"./_object-gopn-ext":189,"./_object-gops":191,"./_object-keys":194,"./_object-pie":195,"./_property-desc":203,"./_redefine":205,"./_set-to-string-tag":210,"./_shared":212,"./_to-iobject":225,"./_to-primitive":228,"./_uid":232,"./_wks":235,"./_wks-define":233,"./_wks-ext":234}],362:[function(require,module,exports){
'use strict';
var $export      = require('./_export')
  , $typed       = require('./_typed')
  , buffer       = require('./_typed-buffer')
  , anObject     = require('./_an-object')
  , toIndex      = require('./_to-index')
  , toLength     = require('./_to-length')
  , isObject     = require('./_is-object')
  , ArrayBuffer  = require('./_global').ArrayBuffer
  , speciesConstructor = require('./_species-constructor')
  , $ArrayBuffer = buffer.ArrayBuffer
  , $DataView    = buffer.DataView
  , $isView      = $typed.ABV && ArrayBuffer.isView
  , $slice       = $ArrayBuffer.prototype.slice
  , VIEW         = $typed.VIEW
  , ARRAY_BUFFER = 'ArrayBuffer';

$export($export.G + $export.W + $export.F * (ArrayBuffer !== $ArrayBuffer), {ArrayBuffer: $ArrayBuffer});

$export($export.S + $export.F * !$typed.CONSTR, ARRAY_BUFFER, {
  // 24.1.3.1 ArrayBuffer.isView(arg)
  isView: function isView(it){
    return $isView && $isView(it) || isObject(it) && VIEW in it;
  }
});

$export($export.P + $export.U + $export.F * require('./_fails')(function(){
  return !new $ArrayBuffer(2).slice(1, undefined).byteLength;
}), ARRAY_BUFFER, {
  // 24.1.4.3 ArrayBuffer.prototype.slice(start, end)
  slice: function slice(start, end){
    if($slice !== undefined && end === undefined)return $slice.call(anObject(this), start); // FF fix
    var len    = anObject(this).byteLength
      , first  = toIndex(start, len)
      , final  = toIndex(end === undefined ? len : end, len)
      , result = new (speciesConstructor(this, $ArrayBuffer))(toLength(final - first))
      , viewS  = new $DataView(this)
      , viewT  = new $DataView(result)
      , index  = 0;
    while(first < final){
      viewT.setUint8(index++, viewS.getUint8(first++));
    } return result;
  }
});

require('./_set-species')(ARRAY_BUFFER);
},{"./_an-object":125,"./_export":150,"./_fails":152,"./_global":156,"./_is-object":167,"./_set-species":209,"./_species-constructor":213,"./_to-index":223,"./_to-length":226,"./_typed":231,"./_typed-buffer":230}],363:[function(require,module,exports){
var $export = require('./_export');
$export($export.G + $export.W + $export.F * !require('./_typed').ABV, {
  DataView: require('./_typed-buffer').DataView
});
},{"./_export":150,"./_typed":231,"./_typed-buffer":230}],364:[function(require,module,exports){
require('./_typed-array')('Float32', 4, function(init){
  return function Float32Array(data, byteOffset, length){
    return init(this, data, byteOffset, length);
  };
});
},{"./_typed-array":229}],365:[function(require,module,exports){
require('./_typed-array')('Float64', 8, function(init){
  return function Float64Array(data, byteOffset, length){
    return init(this, data, byteOffset, length);
  };
});
},{"./_typed-array":229}],366:[function(require,module,exports){
require('./_typed-array')('Int16', 2, function(init){
  return function Int16Array(data, byteOffset, length){
    return init(this, data, byteOffset, length);
  };
});
},{"./_typed-array":229}],367:[function(require,module,exports){
require('./_typed-array')('Int32', 4, function(init){
  return function Int32Array(data, byteOffset, length){
    return init(this, data, byteOffset, length);
  };
});
},{"./_typed-array":229}],368:[function(require,module,exports){
require('./_typed-array')('Int8', 1, function(init){
  return function Int8Array(data, byteOffset, length){
    return init(this, data, byteOffset, length);
  };
});
},{"./_typed-array":229}],369:[function(require,module,exports){
require('./_typed-array')('Uint16', 2, function(init){
  return function Uint16Array(data, byteOffset, length){
    return init(this, data, byteOffset, length);
  };
});
},{"./_typed-array":229}],370:[function(require,module,exports){
require('./_typed-array')('Uint32', 4, function(init){
  return function Uint32Array(data, byteOffset, length){
    return init(this, data, byteOffset, length);
  };
});
},{"./_typed-array":229}],371:[function(require,module,exports){
require('./_typed-array')('Uint8', 1, function(init){
  return function Uint8Array(data, byteOffset, length){
    return init(this, data, byteOffset, length);
  };
});
},{"./_typed-array":229}],372:[function(require,module,exports){
require('./_typed-array')('Uint8', 1, function(init){
  return function Uint8ClampedArray(data, byteOffset, length){
    return init(this, data, byteOffset, length);
  };
}, true);
},{"./_typed-array":229}],373:[function(require,module,exports){
'use strict';
var each         = require('./_array-methods')(0)
  , redefine     = require('./_redefine')
  , meta         = require('./_meta')
  , assign       = require('./_object-assign')
  , weak         = require('./_collection-weak')
  , isObject     = require('./_is-object')
  , getWeak      = meta.getWeak
  , isExtensible = Object.isExtensible
  , uncaughtFrozenStore = weak.ufstore
  , tmp          = {}
  , InternalMap;

var wrapper = function(get){
  return function WeakMap(){
    return get(this, arguments.length > 0 ? arguments[0] : undefined);
  };
};

var methods = {
  // 23.3.3.3 WeakMap.prototype.get(key)
  get: function get(key){
    if(isObject(key)){
      var data = getWeak(key);
      if(data === true)return uncaughtFrozenStore(this).get(key);
      return data ? data[this._i] : undefined;
    }
  },
  // 23.3.3.5 WeakMap.prototype.set(key, value)
  set: function set(key, value){
    return weak.def(this, key, value);
  }
};

// 23.3 WeakMap Objects
var $WeakMap = module.exports = require('./_collection')('WeakMap', wrapper, methods, weak, true, true);

// IE11 WeakMap frozen keys fix
if(new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7){
  InternalMap = weak.getConstructor(wrapper);
  assign(InternalMap.prototype, methods);
  meta.NEED = true;
  each(['delete', 'has', 'get', 'set'], function(key){
    var proto  = $WeakMap.prototype
      , method = proto[key];
    redefine(proto, key, function(a, b){
      // store frozen objects on internal weakmap shim
      if(isObject(a) && !isExtensible(a)){
        if(!this._f)this._f = new InternalMap;
        var result = this._f[key](a, b);
        return key == 'set' ? this : result;
      // store all the rest on native weakmap
      } return method.call(this, a, b);
    });
  });
}
},{"./_array-methods":130,"./_collection":140,"./_collection-weak":139,"./_is-object":167,"./_meta":180,"./_object-assign":183,"./_redefine":205}],374:[function(require,module,exports){
'use strict';
var weak = require('./_collection-weak');

// 23.4 WeakSet Objects
require('./_collection')('WeakSet', function(get){
  return function WeakSet(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); };
}, {
  // 23.4.3.1 WeakSet.prototype.add(value)
  add: function add(value){
    return weak.def(this, value, true);
  }
}, weak, false, true);
},{"./_collection":140,"./_collection-weak":139}],375:[function(require,module,exports){
'use strict';
// https://github.com/tc39/Array.prototype.includes
var $export   = require('./_export')
  , $includes = require('./_array-includes')(true);

$export($export.P, 'Array', {
  includes: function includes(el /*, fromIndex = 0 */){
    return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
  }
});

require('./_add-to-unscopables')('includes');
},{"./_add-to-unscopables":123,"./_array-includes":129,"./_export":150}],376:[function(require,module,exports){
// https://github.com/rwaldron/tc39-notes/blob/master/es6/2014-09/sept-25.md#510-globalasap-for-enqueuing-a-microtask
var $export   = require('./_export')
  , microtask = require('./_microtask')()
  , process   = require('./_global').process
  , isNode    = require('./_cof')(process) == 'process';

$export($export.G, {
  asap: function asap(fn){
    var domain = isNode && process.domain;
    microtask(domain ? domain.bind(fn) : fn);
  }
});
},{"./_cof":136,"./_export":150,"./_global":156,"./_microtask":182}],377:[function(require,module,exports){
// https://github.com/ljharb/proposal-is-error
var $export = require('./_export')
  , cof     = require('./_cof');

$export($export.S, 'Error', {
  isError: function isError(it){
    return cof(it) === 'Error';
  }
});
},{"./_cof":136,"./_export":150}],378:[function(require,module,exports){
// https://github.com/DavidBruant/Map-Set.prototype.toJSON
var $export  = require('./_export');

$export($export.P + $export.R, 'Map', {toJSON: require('./_collection-to-json')('Map')});
},{"./_collection-to-json":138,"./_export":150}],379:[function(require,module,exports){
// https://gist.github.com/BrendanEich/4294d5c212a6d2254703
var $export = require('./_export');

$export($export.S, 'Math', {
  iaddh: function iaddh(x0, x1, y0, y1){
    var $x0 = x0 >>> 0
      , $x1 = x1 >>> 0
      , $y0 = y0 >>> 0;
    return $x1 + (y1 >>> 0) + (($x0 & $y0 | ($x0 | $y0) & ~($x0 + $y0 >>> 0)) >>> 31) | 0;
  }
});
},{"./_export":150}],380:[function(require,module,exports){
// https://gist.github.com/BrendanEich/4294d5c212a6d2254703
var $export = require('./_export');

$export($export.S, 'Math', {
  imulh: function imulh(u, v){
    var UINT16 = 0xffff
      , $u = +u
      , $v = +v
      , u0 = $u & UINT16
      , v0 = $v & UINT16
      , u1 = $u >> 16
      , v1 = $v >> 16
      , t  = (u1 * v0 >>> 0) + (u0 * v0 >>> 16);
    return u1 * v1 + (t >> 16) + ((u0 * v1 >>> 0) + (t & UINT16) >> 16);
  }
});
},{"./_export":150}],381:[function(require,module,exports){
// https://gist.github.com/BrendanEich/4294d5c212a6d2254703
var $export = require('./_export');

$export($export.S, 'Math', {
  isubh: function isubh(x0, x1, y0, y1){
    var $x0 = x0 >>> 0
      , $x1 = x1 >>> 0
      , $y0 = y0 >>> 0;
    return $x1 - (y1 >>> 0) - ((~$x0 & $y0 | ~($x0 ^ $y0) & $x0 - $y0 >>> 0) >>> 31) | 0;
  }
});
},{"./_export":150}],382:[function(require,module,exports){
// https://gist.github.com/BrendanEich/4294d5c212a6d2254703
var $export = require('./_export');

$export($export.S, 'Math', {
  umulh: function umulh(u, v){
    var UINT16 = 0xffff
      , $u = +u
      , $v = +v
      , u0 = $u & UINT16
      , v0 = $v & UINT16
      , u1 = $u >>> 16
      , v1 = $v >>> 16
      , t  = (u1 * v0 >>> 0) + (u0 * v0 >>> 16);
    return u1 * v1 + (t >>> 16) + ((u0 * v1 >>> 0) + (t & UINT16) >>> 16);
  }
});
},{"./_export":150}],383:[function(require,module,exports){
'use strict';
var $export         = require('./_export')
  , toObject        = require('./_to-object')
  , aFunction       = require('./_a-function')
  , $defineProperty = require('./_object-dp');

// B.2.2.2 Object.prototype.__defineGetter__(P, getter)
require('./_descriptors') && $export($export.P + require('./_object-forced-pam'), 'Object', {
  __defineGetter__: function __defineGetter__(P, getter){
    $defineProperty.f(toObject(this), P, {get: aFunction(getter), enumerable: true, configurable: true});
  }
});
},{"./_a-function":121,"./_descriptors":146,"./_export":150,"./_object-dp":185,"./_object-forced-pam":187,"./_to-object":227}],384:[function(require,module,exports){
'use strict';
var $export         = require('./_export')
  , toObject        = require('./_to-object')
  , aFunction       = require('./_a-function')
  , $defineProperty = require('./_object-dp');

// B.2.2.3 Object.prototype.__defineSetter__(P, setter)
require('./_descriptors') && $export($export.P + require('./_object-forced-pam'), 'Object', {
  __defineSetter__: function __defineSetter__(P, setter){
    $defineProperty.f(toObject(this), P, {set: aFunction(setter), enumerable: true, configurable: true});
  }
});
},{"./_a-function":121,"./_descriptors":146,"./_export":150,"./_object-dp":185,"./_object-forced-pam":187,"./_to-object":227}],385:[function(require,module,exports){
// https://github.com/tc39/proposal-object-values-entries
var $export  = require('./_export')
  , $entries = require('./_object-to-array')(true);

$export($export.S, 'Object', {
  entries: function entries(it){
    return $entries(it);
  }
});
},{"./_export":150,"./_object-to-array":197}],386:[function(require,module,exports){
// https://github.com/tc39/proposal-object-getownpropertydescriptors
var $export        = require('./_export')
  , ownKeys        = require('./_own-keys')
  , toIObject      = require('./_to-iobject')
  , gOPD           = require('./_object-gopd')
  , createProperty = require('./_create-property');

$export($export.S, 'Object', {
  getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object){
    var O       = toIObject(object)
      , getDesc = gOPD.f
      , keys    = ownKeys(O)
      , result  = {}
      , i       = 0
      , key;
    while(keys.length > i)createProperty(result, key = keys[i++], getDesc(O, key));
    return result;
  }
});
},{"./_create-property":142,"./_export":150,"./_object-gopd":188,"./_own-keys":198,"./_to-iobject":225}],387:[function(require,module,exports){
'use strict';
var $export                  = require('./_export')
  , toObject                 = require('./_to-object')
  , toPrimitive              = require('./_to-primitive')
  , getPrototypeOf           = require('./_object-gpo')
  , getOwnPropertyDescriptor = require('./_object-gopd').f;

// B.2.2.4 Object.prototype.__lookupGetter__(P)
require('./_descriptors') && $export($export.P + require('./_object-forced-pam'), 'Object', {
  __lookupGetter__: function __lookupGetter__(P){
    var O = toObject(this)
      , K = toPrimitive(P, true)
      , D;
    do {
      if(D = getOwnPropertyDescriptor(O, K))return D.get;
    } while(O = getPrototypeOf(O));
  }
});
},{"./_descriptors":146,"./_export":150,"./_object-forced-pam":187,"./_object-gopd":188,"./_object-gpo":192,"./_to-object":227,"./_to-primitive":228}],388:[function(require,module,exports){
'use strict';
var $export                  = require('./_export')
  , toObject                 = require('./_to-object')
  , toPrimitive              = require('./_to-primitive')
  , getPrototypeOf           = require('./_object-gpo')
  , getOwnPropertyDescriptor = require('./_object-gopd').f;

// B.2.2.5 Object.prototype.__lookupSetter__(P)
require('./_descriptors') && $export($export.P + require('./_object-forced-pam'), 'Object', {
  __lookupSetter__: function __lookupSetter__(P){
    var O = toObject(this)
      , K = toPrimitive(P, true)
      , D;
    do {
      if(D = getOwnPropertyDescriptor(O, K))return D.set;
    } while(O = getPrototypeOf(O));
  }
});
},{"./_descriptors":146,"./_export":150,"./_object-forced-pam":187,"./_object-gopd":188,"./_object-gpo":192,"./_to-object":227,"./_to-primitive":228}],389:[function(require,module,exports){
// https://github.com/tc39/proposal-object-values-entries
var $export = require('./_export')
  , $values = require('./_object-to-array')(false);

$export($export.S, 'Object', {
  values: function values(it){
    return $values(it);
  }
});
},{"./_export":150,"./_object-to-array":197}],390:[function(require,module,exports){
'use strict';
// https://github.com/zenparsing/es-observable
var $export     = require('./_export')
  , global      = require('./_global')
  , core        = require('./_core')
  , microtask   = require('./_microtask')()
  , OBSERVABLE  = require('./_wks')('observable')
  , aFunction   = require('./_a-function')
  , anObject    = require('./_an-object')
  , anInstance  = require('./_an-instance')
  , redefineAll = require('./_redefine-all')
  , hide        = require('./_hide')
  , forOf       = require('./_for-of')
  , RETURN      = forOf.RETURN;

var getMethod = function(fn){
  return fn == null ? undefined : aFunction(fn);
};

var cleanupSubscription = function(subscription){
  var cleanup = subscription._c;
  if(cleanup){
    subscription._c = undefined;
    cleanup();
  }
};

var subscriptionClosed = function(subscription){
  return subscription._o === undefined;
};

var closeSubscription = function(subscription){
  if(!subscriptionClosed(subscription)){
    subscription._o = undefined;
    cleanupSubscription(subscription);
  }
};

var Subscription = function(observer, subscriber){
  anObject(observer);
  this._c = undefined;
  this._o = observer;
  observer = new SubscriptionObserver(this);
  try {
    var cleanup      = subscriber(observer)
      , subscription = cleanup;
    if(cleanup != null){
      if(typeof cleanup.unsubscribe === 'function')cleanup = function(){ subscription.unsubscribe(); };
      else aFunction(cleanup);
      this._c = cleanup;
    }
  } catch(e){
    observer.error(e);
    return;
  } if(subscriptionClosed(this))cleanupSubscription(this);
};

Subscription.prototype = redefineAll({}, {
  unsubscribe: function unsubscribe(){ closeSubscription(this); }
});

var SubscriptionObserver = function(subscription){
  this._s = subscription;
};

SubscriptionObserver.prototype = redefineAll({}, {
  next: function next(value){
    var subscription = this._s;
    if(!subscriptionClosed(subscription)){
      var observer = subscription._o;
      try {
        var m = getMethod(observer.next);
        if(m)return m.call(observer, value);
      } catch(e){
        try {
          closeSubscription(subscription);
        } finally {
          throw e;
        }
      }
    }
  },
  error: function error(value){
    var subscription = this._s;
    if(subscriptionClosed(subscription))throw value;
    var observer = subscription._o;
    subscription._o = undefined;
    try {
      var m = getMethod(observer.error);
      if(!m)throw value;
      value = m.call(observer, value);
    } catch(e){
      try {
        cleanupSubscription(subscription);
      } finally {
        throw e;
      }
    } cleanupSubscription(subscription);
    return value;
  },
  complete: function complete(value){
    var subscription = this._s;
    if(!subscriptionClosed(subscription)){
      var observer = subscription._o;
      subscription._o = undefined;
      try {
        var m = getMethod(observer.complete);
        value = m ? m.call(observer, value) : undefined;
      } catch(e){
        try {
          cleanupSubscription(subscription);
        } finally {
          throw e;
        }
      } cleanupSubscription(subscription);
      return value;
    }
  }
});

var $Observable = function Observable(subscriber){
  anInstance(this, $Observable, 'Observable', '_f')._f = aFunction(subscriber);
};

redefineAll($Observable.prototype, {
  subscribe: function subscribe(observer){
    return new Subscription(observer, this._f);
  },
  forEach: function forEach(fn){
    var that = this;
    return new (core.Promise || global.Promise)(function(resolve, reject){
      aFunction(fn);
      var subscription = that.subscribe({
        next : function(value){
          try {
            return fn(value);
          } catch(e){
            reject(e);
            subscription.unsubscribe();
          }
        },
        error: reject,
        complete: resolve
      });
    });
  }
});

redefineAll($Observable, {
  from: function from(x){
    var C = typeof this === 'function' ? this : $Observable;
    var method = getMethod(anObject(x)[OBSERVABLE]);
    if(method){
      var observable = anObject(method.call(x));
      return observable.constructor === C ? observable : new C(function(observer){
        return observable.subscribe(observer);
      });
    }
    return new C(function(observer){
      var done = false;
      microtask(function(){
        if(!done){
          try {
            if(forOf(x, false, function(it){
              observer.next(it);
              if(done)return RETURN;
            }) === RETURN)return;
          } catch(e){
            if(done)throw e;
            observer.error(e);
            return;
          } observer.complete();
        }
      });
      return function(){ done = true; };
    });
  },
  of: function of(){
    for(var i = 0, l = arguments.length, items = Array(l); i < l;)items[i] = arguments[i++];
    return new (typeof this === 'function' ? this : $Observable)(function(observer){
      var done = false;
      microtask(function(){
        if(!done){
          for(var i = 0; i < items.length; ++i){
            observer.next(items[i]);
            if(done)return;
          } observer.complete();
        }
      });
      return function(){ done = true; };
    });
  }
});

hide($Observable.prototype, OBSERVABLE, function(){ return this; });

$export($export.G, {Observable: $Observable});

require('./_set-species')('Observable');
},{"./_a-function":121,"./_an-instance":124,"./_an-object":125,"./_core":141,"./_export":150,"./_for-of":155,"./_global":156,"./_hide":158,"./_microtask":182,"./_redefine-all":204,"./_set-species":209,"./_wks":235}],391:[function(require,module,exports){
var metadata                  = require('./_metadata')
  , anObject                  = require('./_an-object')
  , toMetaKey                 = metadata.key
  , ordinaryDefineOwnMetadata = metadata.set;

metadata.exp({defineMetadata: function defineMetadata(metadataKey, metadataValue, target, targetKey){
  ordinaryDefineOwnMetadata(metadataKey, metadataValue, anObject(target), toMetaKey(targetKey));
}});
},{"./_an-object":125,"./_metadata":181}],392:[function(require,module,exports){
var metadata               = require('./_metadata')
  , anObject               = require('./_an-object')
  , toMetaKey              = metadata.key
  , getOrCreateMetadataMap = metadata.map
  , store                  = metadata.store;

metadata.exp({deleteMetadata: function deleteMetadata(metadataKey, target /*, targetKey */){
  var targetKey   = arguments.length < 3 ? undefined : toMetaKey(arguments[2])
    , metadataMap = getOrCreateMetadataMap(anObject(target), targetKey, false);
  if(metadataMap === undefined || !metadataMap['delete'](metadataKey))return false;
  if(metadataMap.size)return true;
  var targetMetadata = store.get(target);
  targetMetadata['delete'](targetKey);
  return !!targetMetadata.size || store['delete'](target);
}});
},{"./_an-object":125,"./_metadata":181}],393:[function(require,module,exports){
var Set                     = require('./es6.set')
  , from                    = require('./_array-from-iterable')
  , metadata                = require('./_metadata')
  , anObject                = require('./_an-object')
  , getPrototypeOf          = require('./_object-gpo')
  , ordinaryOwnMetadataKeys = metadata.keys
  , toMetaKey               = metadata.key;

var ordinaryMetadataKeys = function(O, P){
  var oKeys  = ordinaryOwnMetadataKeys(O, P)
    , parent = getPrototypeOf(O);
  if(parent === null)return oKeys;
  var pKeys  = ordinaryMetadataKeys(parent, P);
  return pKeys.length ? oKeys.length ? from(new Set(oKeys.concat(pKeys))) : pKeys : oKeys;
};

metadata.exp({getMetadataKeys: function getMetadataKeys(target /*, targetKey */){
  return ordinaryMetadataKeys(anObject(target), arguments.length < 2 ? undefined : toMetaKey(arguments[1]));
}});
},{"./_an-object":125,"./_array-from-iterable":128,"./_metadata":181,"./_object-gpo":192,"./es6.set":338}],394:[function(require,module,exports){
var metadata               = require('./_metadata')
  , anObject               = require('./_an-object')
  , getPrototypeOf         = require('./_object-gpo')
  , ordinaryHasOwnMetadata = metadata.has
  , ordinaryGetOwnMetadata = metadata.get
  , toMetaKey              = metadata.key;

var ordinaryGetMetadata = function(MetadataKey, O, P){
  var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P);
  if(hasOwn)return ordinaryGetOwnMetadata(MetadataKey, O, P);
  var parent = getPrototypeOf(O);
  return parent !== null ? ordinaryGetMetadata(MetadataKey, parent, P) : undefined;
};

metadata.exp({getMetadata: function getMetadata(metadataKey, target /*, targetKey */){
  return ordinaryGetMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2]));
}});
},{"./_an-object":125,"./_metadata":181,"./_object-gpo":192}],395:[function(require,module,exports){
var metadata                = require('./_metadata')
  , anObject                = require('./_an-object')
  , ordinaryOwnMetadataKeys = metadata.keys
  , toMetaKey               = metadata.key;

metadata.exp({getOwnMetadataKeys: function getOwnMetadataKeys(target /*, targetKey */){
  return ordinaryOwnMetadataKeys(anObject(target), arguments.length < 2 ? undefined : toMetaKey(arguments[1]));
}});
},{"./_an-object":125,"./_metadata":181}],396:[function(require,module,exports){
var metadata               = require('./_metadata')
  , anObject               = require('./_an-object')
  , ordinaryGetOwnMetadata = metadata.get
  , toMetaKey              = metadata.key;

metadata.exp({getOwnMetadata: function getOwnMetadata(metadataKey, target /*, targetKey */){
  return ordinaryGetOwnMetadata(metadataKey, anObject(target)
    , arguments.length < 3 ? undefined : toMetaKey(arguments[2]));
}});
},{"./_an-object":125,"./_metadata":181}],397:[function(require,module,exports){
var metadata               = require('./_metadata')
  , anObject               = require('./_an-object')
  , getPrototypeOf         = require('./_object-gpo')
  , ordinaryHasOwnMetadata = metadata.has
  , toMetaKey              = metadata.key;

var ordinaryHasMetadata = function(MetadataKey, O, P){
  var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P);
  if(hasOwn)return true;
  var parent = getPrototypeOf(O);
  return parent !== null ? ordinaryHasMetadata(MetadataKey, parent, P) : false;
};

metadata.exp({hasMetadata: function hasMetadata(metadataKey, target /*, targetKey */){
  return ordinaryHasMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2]));
}});
},{"./_an-object":125,"./_metadata":181,"./_object-gpo":192}],398:[function(require,module,exports){
var metadata               = require('./_metadata')
  , anObject               = require('./_an-object')
  , ordinaryHasOwnMetadata = metadata.has
  , toMetaKey              = metadata.key;

metadata.exp({hasOwnMetadata: function hasOwnMetadata(metadataKey, target /*, targetKey */){
  return ordinaryHasOwnMetadata(metadataKey, anObject(target)
    , arguments.length < 3 ? undefined : toMetaKey(arguments[2]));
}});
},{"./_an-object":125,"./_metadata":181}],399:[function(require,module,exports){
var metadata                  = require('./_metadata')
  , anObject                  = require('./_an-object')
  , aFunction                 = require('./_a-function')
  , toMetaKey                 = metadata.key
  , ordinaryDefineOwnMetadata = metadata.set;

metadata.exp({metadata: function metadata(metadataKey, metadataValue){
  return function decorator(target, targetKey){
    ordinaryDefineOwnMetadata(
      metadataKey, metadataValue,
      (targetKey !== undefined ? anObject : aFunction)(target),
      toMetaKey(targetKey)
    );
  };
}});
},{"./_a-function":121,"./_an-object":125,"./_metadata":181}],400:[function(require,module,exports){
// https://github.com/DavidBruant/Map-Set.prototype.toJSON
var $export  = require('./_export');

$export($export.P + $export.R, 'Set', {toJSON: require('./_collection-to-json')('Set')});
},{"./_collection-to-json":138,"./_export":150}],401:[function(require,module,exports){
'use strict';
// https://github.com/mathiasbynens/String.prototype.at
var $export = require('./_export')
  , $at     = require('./_string-at')(true);

$export($export.P, 'String', {
  at: function at(pos){
    return $at(this, pos);
  }
});
},{"./_export":150,"./_string-at":215}],402:[function(require,module,exports){
'use strict';
// https://tc39.github.io/String.prototype.matchAll/
var $export     = require('./_export')
  , defined     = require('./_defined')
  , toLength    = require('./_to-length')
  , isRegExp    = require('./_is-regexp')
  , getFlags    = require('./_flags')
  , RegExpProto = RegExp.prototype;

var $RegExpStringIterator = function(regexp, string){
  this._r = regexp;
  this._s = string;
};

require('./_iter-create')($RegExpStringIterator, 'RegExp String', function next(){
  var match = this._r.exec(this._s);
  return {value: match, done: match === null};
});

$export($export.P, 'String', {
  matchAll: function matchAll(regexp){
    defined(this);
    if(!isRegExp(regexp))throw TypeError(regexp + ' is not a regexp!');
    var S     = String(this)
      , flags = 'flags' in RegExpProto ? String(regexp.flags) : getFlags.call(regexp)
      , rx    = new RegExp(regexp.source, ~flags.indexOf('g') ? flags : 'g' + flags);
    rx.lastIndex = toLength(regexp.lastIndex);
    return new $RegExpStringIterator(rx, S);
  }
});
},{"./_defined":145,"./_export":150,"./_flags":154,"./_is-regexp":168,"./_iter-create":170,"./_to-length":226}],403:[function(require,module,exports){
'use strict';
// https://github.com/tc39/proposal-string-pad-start-end
var $export = require('./_export')
  , $pad    = require('./_string-pad');

$export($export.P, 'String', {
  padEnd: function padEnd(maxLength /*, fillString = ' ' */){
    return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, false);
  }
});
},{"./_export":150,"./_string-pad":218}],404:[function(require,module,exports){
'use strict';
// https://github.com/tc39/proposal-string-pad-start-end
var $export = require('./_export')
  , $pad    = require('./_string-pad');

$export($export.P, 'String', {
  padStart: function padStart(maxLength /*, fillString = ' ' */){
    return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, true);
  }
});
},{"./_export":150,"./_string-pad":218}],405:[function(require,module,exports){
'use strict';
// https://github.com/sebmarkbage/ecmascript-string-left-right-trim
require('./_string-trim')('trimLeft', function($trim){
  return function trimLeft(){
    return $trim(this, 1);
  };
}, 'trimStart');
},{"./_string-trim":220}],406:[function(require,module,exports){
'use strict';
// https://github.com/sebmarkbage/ecmascript-string-left-right-trim
require('./_string-trim')('trimRight', function($trim){
  return function trimRight(){
    return $trim(this, 2);
  };
}, 'trimEnd');
},{"./_string-trim":220}],407:[function(require,module,exports){
require('./_wks-define')('asyncIterator');
},{"./_wks-define":233}],408:[function(require,module,exports){
require('./_wks-define')('observable');
},{"./_wks-define":233}],409:[function(require,module,exports){
// https://github.com/ljharb/proposal-global
var $export = require('./_export');

$export($export.S, 'System', {global: require('./_global')});
},{"./_export":150,"./_global":156}],410:[function(require,module,exports){
var $iterators    = require('./es6.array.iterator')
  , redefine      = require('./_redefine')
  , global        = require('./_global')
  , hide          = require('./_hide')
  , Iterators     = require('./_iterators')
  , wks           = require('./_wks')
  , ITERATOR      = wks('iterator')
  , TO_STRING_TAG = wks('toStringTag')
  , ArrayValues   = Iterators.Array;

for(var collections = ['NodeList', 'DOMTokenList', 'MediaList', 'StyleSheetList', 'CSSRuleList'], i = 0; i < 5; i++){
  var NAME       = collections[i]
    , Collection = global[NAME]
    , proto      = Collection && Collection.prototype
    , key;
  if(proto){
    if(!proto[ITERATOR])hide(proto, ITERATOR, ArrayValues);
    if(!proto[TO_STRING_TAG])hide(proto, TO_STRING_TAG, NAME);
    Iterators[NAME] = ArrayValues;
    for(key in $iterators)if(!proto[key])redefine(proto, key, $iterators[key], true);
  }
}
},{"./_global":156,"./_hide":158,"./_iterators":174,"./_redefine":205,"./_wks":235,"./es6.array.iterator":248}],411:[function(require,module,exports){
var $export = require('./_export')
  , $task   = require('./_task');
$export($export.G + $export.B, {
  setImmediate:   $task.set,
  clearImmediate: $task.clear
});
},{"./_export":150,"./_task":222}],412:[function(require,module,exports){
// ie9- setTimeout & setInterval additional parameters fix
var global     = require('./_global')
  , $export    = require('./_export')
  , invoke     = require('./_invoke')
  , partial    = require('./_partial')
  , navigator  = global.navigator
  , MSIE       = !!navigator && /MSIE .\./.test(navigator.userAgent); // <- dirty ie9- check
var wrap = function(set){
  return MSIE ? function(fn, time /*, ...args */){
    return set(invoke(
      partial,
      [].slice.call(arguments, 2),
      typeof fn == 'function' ? fn : Function(fn)
    ), time);
  } : set;
};
$export($export.G + $export.B + $export.F * MSIE, {
  setTimeout:  wrap(global.setTimeout),
  setInterval: wrap(global.setInterval)
});
},{"./_export":150,"./_global":156,"./_invoke":162,"./_partial":201}],413:[function(require,module,exports){
require('./modules/es6.symbol');
require('./modules/es6.object.create');
require('./modules/es6.object.define-property');
require('./modules/es6.object.define-properties');
require('./modules/es6.object.get-own-property-descriptor');
require('./modules/es6.object.get-prototype-of');
require('./modules/es6.object.keys');
require('./modules/es6.object.get-own-property-names');
require('./modules/es6.object.freeze');
require('./modules/es6.object.seal');
require('./modules/es6.object.prevent-extensions');
require('./modules/es6.object.is-frozen');
require('./modules/es6.object.is-sealed');
require('./modules/es6.object.is-extensible');
require('./modules/es6.object.assign');
require('./modules/es6.object.is');
require('./modules/es6.object.set-prototype-of');
require('./modules/es6.object.to-string');
require('./modules/es6.function.bind');
require('./modules/es6.function.name');
require('./modules/es6.function.has-instance');
require('./modules/es6.parse-int');
require('./modules/es6.parse-float');
require('./modules/es6.number.constructor');
require('./modules/es6.number.to-fixed');
require('./modules/es6.number.to-precision');
require('./modules/es6.number.epsilon');
require('./modules/es6.number.is-finite');
require('./modules/es6.number.is-integer');
require('./modules/es6.number.is-nan');
require('./modules/es6.number.is-safe-integer');
require('./modules/es6.number.max-safe-integer');
require('./modules/es6.number.min-safe-integer');
require('./modules/es6.number.parse-float');
require('./modules/es6.number.parse-int');
require('./modules/es6.math.acosh');
require('./modules/es6.math.asinh');
require('./modules/es6.math.atanh');
require('./modules/es6.math.cbrt');
require('./modules/es6.math.clz32');
require('./modules/es6.math.cosh');
require('./modules/es6.math.expm1');
require('./modules/es6.math.fround');
require('./modules/es6.math.hypot');
require('./modules/es6.math.imul');
require('./modules/es6.math.log10');
require('./modules/es6.math.log1p');
require('./modules/es6.math.log2');
require('./modules/es6.math.sign');
require('./modules/es6.math.sinh');
require('./modules/es6.math.tanh');
require('./modules/es6.math.trunc');
require('./modules/es6.string.from-code-point');
require('./modules/es6.string.raw');
require('./modules/es6.string.trim');
require('./modules/es6.string.iterator');
require('./modules/es6.string.code-point-at');
require('./modules/es6.string.ends-with');
require('./modules/es6.string.includes');
require('./modules/es6.string.repeat');
require('./modules/es6.string.starts-with');
require('./modules/es6.string.anchor');
require('./modules/es6.string.big');
require('./modules/es6.string.blink');
require('./modules/es6.string.bold');
require('./modules/es6.string.fixed');
require('./modules/es6.string.fontcolor');
require('./modules/es6.string.fontsize');
require('./modules/es6.string.italics');
require('./modules/es6.string.link');
require('./modules/es6.string.small');
require('./modules/es6.string.strike');
require('./modules/es6.string.sub');
require('./modules/es6.string.sup');
require('./modules/es6.date.now');
require('./modules/es6.date.to-json');
require('./modules/es6.date.to-iso-string');
require('./modules/es6.date.to-string');
require('./modules/es6.date.to-primitive');
require('./modules/es6.array.is-array');
require('./modules/es6.array.from');
require('./modules/es6.array.of');
require('./modules/es6.array.join');
require('./modules/es6.array.slice');
require('./modules/es6.array.sort');
require('./modules/es6.array.for-each');
require('./modules/es6.array.map');
require('./modules/es6.array.filter');
require('./modules/es6.array.some');
require('./modules/es6.array.every');
require('./modules/es6.array.reduce');
require('./modules/es6.array.reduce-right');
require('./modules/es6.array.index-of');
require('./modules/es6.array.last-index-of');
require('./modules/es6.array.copy-within');
require('./modules/es6.array.fill');
require('./modules/es6.array.find');
require('./modules/es6.array.find-index');
require('./modules/es6.array.species');
require('./modules/es6.array.iterator');
require('./modules/es6.regexp.constructor');
require('./modules/es6.regexp.to-string');
require('./modules/es6.regexp.flags');
require('./modules/es6.regexp.match');
require('./modules/es6.regexp.replace');
require('./modules/es6.regexp.search');
require('./modules/es6.regexp.split');
require('./modules/es6.promise');
require('./modules/es6.map');
require('./modules/es6.set');
require('./modules/es6.weak-map');
require('./modules/es6.weak-set');
require('./modules/es6.typed.array-buffer');
require('./modules/es6.typed.data-view');
require('./modules/es6.typed.int8-array');
require('./modules/es6.typed.uint8-array');
require('./modules/es6.typed.uint8-clamped-array');
require('./modules/es6.typed.int16-array');
require('./modules/es6.typed.uint16-array');
require('./modules/es6.typed.int32-array');
require('./modules/es6.typed.uint32-array');
require('./modules/es6.typed.float32-array');
require('./modules/es6.typed.float64-array');
require('./modules/es6.reflect.apply');
require('./modules/es6.reflect.construct');
require('./modules/es6.reflect.define-property');
require('./modules/es6.reflect.delete-property');
require('./modules/es6.reflect.enumerate');
require('./modules/es6.reflect.get');
require('./modules/es6.reflect.get-own-property-descriptor');
require('./modules/es6.reflect.get-prototype-of');
require('./modules/es6.reflect.has');
require('./modules/es6.reflect.is-extensible');
require('./modules/es6.reflect.own-keys');
require('./modules/es6.reflect.prevent-extensions');
require('./modules/es6.reflect.set');
require('./modules/es6.reflect.set-prototype-of');
require('./modules/es7.array.includes');
require('./modules/es7.string.at');
require('./modules/es7.string.pad-start');
require('./modules/es7.string.pad-end');
require('./modules/es7.string.trim-left');
require('./modules/es7.string.trim-right');
require('./modules/es7.string.match-all');
require('./modules/es7.symbol.async-iterator');
require('./modules/es7.symbol.observable');
require('./modules/es7.object.get-own-property-descriptors');
require('./modules/es7.object.values');
require('./modules/es7.object.entries');
require('./modules/es7.object.define-getter');
require('./modules/es7.object.define-setter');
require('./modules/es7.object.lookup-getter');
require('./modules/es7.object.lookup-setter');
require('./modules/es7.map.to-json');
require('./modules/es7.set.to-json');
require('./modules/es7.system.global');
require('./modules/es7.error.is-error');
require('./modules/es7.math.iaddh');
require('./modules/es7.math.isubh');
require('./modules/es7.math.imulh');
require('./modules/es7.math.umulh');
require('./modules/es7.reflect.define-metadata');
require('./modules/es7.reflect.delete-metadata');
require('./modules/es7.reflect.get-metadata');
require('./modules/es7.reflect.get-metadata-keys');
require('./modules/es7.reflect.get-own-metadata');
require('./modules/es7.reflect.get-own-metadata-keys');
require('./modules/es7.reflect.has-metadata');
require('./modules/es7.reflect.has-own-metadata');
require('./modules/es7.reflect.metadata');
require('./modules/es7.asap');
require('./modules/es7.observable');
require('./modules/web.timers');
require('./modules/web.immediate');
require('./modules/web.dom.iterable');
module.exports = require('./modules/_core');
},{"./modules/_core":141,"./modules/es6.array.copy-within":238,"./modules/es6.array.every":239,"./modules/es6.array.fill":240,"./modules/es6.array.filter":241,"./modules/es6.array.find":243,"./modules/es6.array.find-index":242,"./modules/es6.array.for-each":244,"./modules/es6.array.from":245,"./modules/es6.array.index-of":246,"./modules/es6.array.is-array":247,"./modules/es6.array.iterator":248,"./modules/es6.array.join":249,"./modules/es6.array.last-index-of":250,"./modules/es6.array.map":251,"./modules/es6.array.of":252,"./modules/es6.array.reduce":254,"./modules/es6.array.reduce-right":253,"./modules/es6.array.slice":255,"./modules/es6.array.some":256,"./modules/es6.array.sort":257,"./modules/es6.array.species":258,"./modules/es6.date.now":259,"./modules/es6.date.to-iso-string":260,"./modules/es6.date.to-json":261,"./modules/es6.date.to-primitive":262,"./modules/es6.date.to-string":263,"./modules/es6.function.bind":264,"./modules/es6.function.has-instance":265,"./modules/es6.function.name":266,"./modules/es6.map":267,"./modules/es6.math.acosh":268,"./modules/es6.math.asinh":269,"./modules/es6.math.atanh":270,"./modules/es6.math.cbrt":271,"./modules/es6.math.clz32":272,"./modules/es6.math.cosh":273,"./modules/es6.math.expm1":274,"./modules/es6.math.fround":275,"./modules/es6.math.hypot":276,"./modules/es6.math.imul":277,"./modules/es6.math.log10":278,"./modules/es6.math.log1p":279,"./modules/es6.math.log2":280,"./modules/es6.math.sign":281,"./modules/es6.math.sinh":282,"./modules/es6.math.tanh":283,"./modules/es6.math.trunc":284,"./modules/es6.number.constructor":285,"./modules/es6.number.epsilon":286,"./modules/es6.number.is-finite":287,"./modules/es6.number.is-integer":288,"./modules/es6.number.is-nan":289,"./modules/es6.number.is-safe-integer":290,"./modules/es6.number.max-safe-integer":291,"./modules/es6.number.min-safe-integer":292,"./modules/es6.number.parse-float":293,"./modules/es6.number.parse-int":294,"./modules/es6.number.to-fixed":295,"./modules/es6.number.to-precision":296,"./modules/es6.object.assign":297,"./modules/es6.object.create":298,"./modules/es6.object.define-properties":299,"./modules/es6.object.define-property":300,"./modules/es6.object.freeze":301,"./modules/es6.object.get-own-property-descriptor":302,"./modules/es6.object.get-own-property-names":303,"./modules/es6.object.get-prototype-of":304,"./modules/es6.object.is":308,"./modules/es6.object.is-extensible":305,"./modules/es6.object.is-frozen":306,"./modules/es6.object.is-sealed":307,"./modules/es6.object.keys":309,"./modules/es6.object.prevent-extensions":310,"./modules/es6.object.seal":311,"./modules/es6.object.set-prototype-of":312,"./modules/es6.object.to-string":313,"./modules/es6.parse-float":314,"./modules/es6.parse-int":315,"./modules/es6.promise":316,"./modules/es6.reflect.apply":317,"./modules/es6.reflect.construct":318,"./modules/es6.reflect.define-property":319,"./modules/es6.reflect.delete-property":320,"./modules/es6.reflect.enumerate":321,"./modules/es6.reflect.get":324,"./modules/es6.reflect.get-own-property-descriptor":322,"./modules/es6.reflect.get-prototype-of":323,"./modules/es6.reflect.has":325,"./modules/es6.reflect.is-extensible":326,"./modules/es6.reflect.own-keys":327,"./modules/es6.reflect.prevent-extensions":328,"./modules/es6.reflect.set":330,"./modules/es6.reflect.set-prototype-of":329,"./modules/es6.regexp.constructor":331,"./modules/es6.regexp.flags":332,"./modules/es6.regexp.match":333,"./modules/es6.regexp.replace":334,"./modules/es6.regexp.search":335,"./modules/es6.regexp.split":336,"./modules/es6.regexp.to-string":337,"./modules/es6.set":338,"./modules/es6.string.anchor":339,"./modules/es6.string.big":340,"./modules/es6.string.blink":341,"./modules/es6.string.bold":342,"./modules/es6.string.code-point-at":343,"./modules/es6.string.ends-with":344,"./modules/es6.string.fixed":345,"./modules/es6.string.fontcolor":346,"./modules/es6.string.fontsize":347,"./modules/es6.string.from-code-point":348,"./modules/es6.string.includes":349,"./modules/es6.string.italics":350,"./modules/es6.string.iterator":351,"./modules/es6.string.link":352,"./modules/es6.string.raw":353,"./modules/es6.string.repeat":354,"./modules/es6.string.small":355,"./modules/es6.string.starts-with":356,"./modules/es6.string.strike":357,"./modules/es6.string.sub":358,"./modules/es6.string.sup":359,"./modules/es6.string.trim":360,"./modules/es6.symbol":361,"./modules/es6.typed.array-buffer":362,"./modules/es6.typed.data-view":363,"./modules/es6.typed.float32-array":364,"./modules/es6.typed.float64-array":365,"./modules/es6.typed.int16-array":366,"./modules/es6.typed.int32-array":367,"./modules/es6.typed.int8-array":368,"./modules/es6.typed.uint16-array":369,"./modules/es6.typed.uint32-array":370,"./modules/es6.typed.uint8-array":371,"./modules/es6.typed.uint8-clamped-array":372,"./modules/es6.weak-map":373,"./modules/es6.weak-set":374,"./modules/es7.array.includes":375,"./modules/es7.asap":376,"./modules/es7.error.is-error":377,"./modules/es7.map.to-json":378,"./modules/es7.math.iaddh":379,"./modules/es7.math.imulh":380,"./modules/es7.math.isubh":381,"./modules/es7.math.umulh":382,"./modules/es7.object.define-getter":383,"./modules/es7.object.define-setter":384,"./modules/es7.object.entries":385,"./modules/es7.object.get-own-property-descriptors":386,"./modules/es7.object.lookup-getter":387,"./modules/es7.object.lookup-setter":388,"./modules/es7.object.values":389,"./modules/es7.observable":390,"./modules/es7.reflect.define-metadata":391,"./modules/es7.reflect.delete-metadata":392,"./modules/es7.reflect.get-metadata":394,"./modules/es7.reflect.get-metadata-keys":393,"./modules/es7.reflect.get-own-metadata":396,"./modules/es7.reflect.get-own-metadata-keys":395,"./modules/es7.reflect.has-metadata":397,"./modules/es7.reflect.has-own-metadata":398,"./modules/es7.reflect.metadata":399,"./modules/es7.set.to-json":400,"./modules/es7.string.at":401,"./modules/es7.string.match-all":402,"./modules/es7.string.pad-end":403,"./modules/es7.string.pad-start":404,"./modules/es7.string.trim-left":405,"./modules/es7.string.trim-right":406,"./modules/es7.symbol.async-iterator":407,"./modules/es7.symbol.observable":408,"./modules/es7.system.global":409,"./modules/web.dom.iterable":410,"./modules/web.immediate":411,"./modules/web.timers":412}],414:[function(require,module,exports){
'use strict';

var hasOwn = Object.prototype.hasOwnProperty;
var toStr = Object.prototype.toString;

var isArray = function isArray(arr) {
	if (typeof Array.isArray === 'function') {
		return Array.isArray(arr);
	}

	return toStr.call(arr) === '[object Array]';
};

var isPlainObject = function isPlainObject(obj) {
	if (!obj || toStr.call(obj) !== '[object Object]') {
		return false;
	}

	var hasOwnConstructor = hasOwn.call(obj, 'constructor');
	var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');
	// Not own constructor property must be Object
	if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {
		return false;
	}

	// Own properties are enumerated firstly, so to speed up,
	// if last one is own, then all properties are own.
	var key;
	for (key in obj) {/**/}

	return typeof key === 'undefined' || hasOwn.call(obj, key);
};

module.exports = function extend() {
	var options, name, src, copy, copyIsArray, clone,
		target = arguments[0],
		i = 1,
		length = arguments.length,
		deep = false;

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

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

				// Prevent never-ending loop
				if (target !== copy) {
					// Recurse if we're merging plain objects or arrays
					if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {
						if (copyIsArray) {
							copyIsArray = false;
							clone = src && isArray(src) ? src : [];
						} else {
							clone = src && isPlainObject(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;
};


},{}],415:[function(require,module,exports){
/*!
 * inflection
 * Copyright(c) 2011 Ben Lin <ben@dreamerslab.com>
 * MIT Licensed
 *
 * @fileoverview
 * A port of inflection-js to node.js module.
 */

( function ( root, factory ){
  if( typeof define === 'function' && define.amd ){
    define([], factory );
  }else if( typeof exports === 'object' ){
    module.exports = factory();
  }else{
    root.inflection = factory();
  }
}( this, function (){

  /**
   * @description This is a list of nouns that use the same form for both singular and plural.
   *              This list should remain entirely in lower case to correctly match Strings.
   * @private
   */
  var uncountable_words = [
    // 'access',
    'accommodation',
    'adulthood',
    'advertising',
    'advice',
    'aggression',
    'aid',
    'air',
    'aircraft',
    'alcohol',
    'anger',
    'applause',
    'arithmetic',
    // 'art',
    'assistance',
    'athletics',
    // 'attention',

    'bacon',
    'baggage',
    // 'ballet',
    // 'beauty',
    'beef',
    // 'beer',
    // 'behavior',
    'biology',
    // 'billiards',
    'blood',
    'botany',
    // 'bowels',
    'bread',
    // 'business',
    'butter',

    'carbon',
    'cardboard',
    'cash',
    'chalk',
    'chaos',
    'chess',
    'crossroads',
    'countryside',

    // 'damage',
    'dancing',
    // 'danger',
    'deer',
    // 'delight',
    // 'dessert',
    'dignity',
    'dirt',
    // 'distribution',
    'dust',

    'economics',
    'education',
    'electricity',
    // 'employment',
    // 'energy',
    'engineering',
    'enjoyment',
    // 'entertainment',
    'envy',
    'equipment',
    'ethics',
    'evidence',
    'evolution',

    // 'failure',
    // 'faith',
    'fame',
    'fiction',
    // 'fish',
    'flour',
    'flu',
    'food',
    // 'freedom',
    // 'fruit',
    'fuel',
    'fun',
    // 'funeral',
    'furniture',

    'gallows',
    'garbage',
    'garlic',
    // 'gas',
    'genetics',
    // 'glass',
    'gold',
    'golf',
    'gossip',
    'grammar',
    // 'grass',
    'gratitude',
    'grief',
    // 'ground',
    'guilt',
    'gymnastics',

    // 'hair',
    'happiness',
    'hardware',
    'harm',
    'hate',
    'hatred',
    'health',
    'heat',
    // 'height',
    'help',
    'homework',
    'honesty',
    'honey',
    'hospitality',
    'housework',
    'humour',
    'hunger',
    'hydrogen',

    'ice',
    'importance',
    'inflation',
    'information',
    // 'injustice',
    'innocence',
    // 'intelligence',
    'iron',
    'irony',

    'jam',
    // 'jealousy',
    // 'jelly',
    'jewelry',
    // 'joy',
    'judo',
    // 'juice',
    // 'justice',

    'karate',
    // 'kindness',
    'knowledge',

    // 'labour',
    'lack',
    // 'land',
    'laughter',
    'lava',
    'leather',
    'leisure',
    'lightning',
    'linguine',
    'linguini',
    'linguistics',
    'literature',
    'litter',
    'livestock',
    'logic',
    'loneliness',
    // 'love',
    'luck',
    'luggage',

    'macaroni',
    'machinery',
    'magic',
    // 'mail',
    'management',
    'mankind',
    'marble',
    'mathematics',
    'mayonnaise',
    'measles',
    // 'meat',
    // 'metal',
    'methane',
    'milk',
    'money',
    // 'moose',
    'mud',
    'music',
    'mumps',

    'nature',
    'news',
    'nitrogen',
    'nonsense',
    'nurture',
    'nutrition',

    'obedience',
    'obesity',
    // 'oil',
    'oxygen',

    // 'paper',
    // 'passion',
    'pasta',
    'patience',
    // 'permission',
    'physics',
    'poetry',
    'pollution',
    'poverty',
    // 'power',
    'pride',
    // 'production',
    // 'progress',
    // 'pronunciation',
    'psychology',
    'publicity',
    'punctuation',

    // 'quality',
    // 'quantity',
    'quartz',

    'racism',
    // 'rain',
    // 'recreation',
    'relaxation',
    'reliability',
    'research',
    'respect',
    'revenge',
    'rice',
    'rubbish',
    'rum',

    'safety',
    // 'salad',
    // 'salt',
    // 'sand',
    // 'satire',
    'scenery',
    'seafood',
    'seaside',
    'series',
    'shame',
    'sheep',
    'shopping',
    // 'silence',
    'sleep',
    // 'slang'
    'smoke',
    'smoking',
    'snow',
    'soap',
    'software',
    'soil',
    // 'sorrow',
    // 'soup',
    'spaghetti',
    // 'speed',
    'species',
    // 'spelling',
    // 'sport',
    'steam',
    // 'strength',
    'stuff',
    'stupidity',
    // 'success',
    // 'sugar',
    'sunshine',
    'symmetry',

    // 'tea',
    'tennis',
    'thirst',
    'thunder',
    'timber',
    // 'time',
    // 'toast',
    // 'tolerance',
    // 'trade',
    'traffic',
    'transportation',
    // 'travel',
    'trust',

    // 'understanding',
    'underwear',
    'unemployment',
    'unity',
    // 'usage',

    'validity',
    'veal',
    'vegetation',
    'vegetarianism',
    'vengeance',
    'violence',
    // 'vision',
    'vitality',

    'warmth',
    // 'water',
    'wealth',
    'weather',
    // 'weight',
    'welfare',
    'wheat',
    // 'whiskey',
    // 'width',
    'wildlife',
    // 'wine',
    'wisdom',
    // 'wood',
    // 'wool',
    // 'work',

    // 'yeast',
    'yoga',

    'zinc',
    'zoology'
  ];

  /**
   * @description These rules translate from the singular form of a noun to its plural form.
   * @private
   */

  var regex = {
    plural : {
      men       : new RegExp( '^(m|wom)en$'             , 'gi' ),
      people    : new RegExp( '(pe)ople$'               , 'gi' ),
      children  : new RegExp( '(child)ren$'             , 'gi' ),
      tia       : new RegExp( '([ti])a$'                , 'gi' ),
      analyses  : new RegExp( '((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$','gi' ),
      hives     : new RegExp( '(hi|ti)ves$'             , 'gi' ),
      curves    : new RegExp( '(curve)s$'               , 'gi' ),
      lrves     : new RegExp( '([lr])ves$'              , 'gi' ),
      foves     : new RegExp( '([^fo])ves$'             , 'gi' ),
      movies    : new RegExp( '(m)ovies$'               , 'gi' ),
      aeiouyies : new RegExp( '([^aeiouy]|qu)ies$'      , 'gi' ),
      series    : new RegExp( '(s)eries$'               , 'gi' ),
      xes       : new RegExp( '(x|ch|ss|sh)es$'         , 'gi' ),
      mice      : new RegExp( '([m|l])ice$'             , 'gi' ),
      buses     : new RegExp( '(bus)es$'                , 'gi' ),
      oes       : new RegExp( '(o)es$'                  , 'gi' ),
      shoes     : new RegExp( '(shoe)s$'                , 'gi' ),
      crises    : new RegExp( '(cris|ax|test)es$'       , 'gi' ),
      octopi    : new RegExp( '(octop|vir)i$'           , 'gi' ),
      aliases   : new RegExp( '(alias|canvas|status)es$', 'gi' ),
      summonses : new RegExp( '^(summons)es$'           , 'gi' ),
      oxen      : new RegExp( '^(ox)en'                 , 'gi' ),
      matrices  : new RegExp( '(matr)ices$'             , 'gi' ),
      vertices  : new RegExp( '(vert|ind)ices$'         , 'gi' ),
      feet      : new RegExp( '^feet$'                  , 'gi' ),
      teeth     : new RegExp( '^teeth$'                 , 'gi' ),
      geese     : new RegExp( '^geese$'                 , 'gi' ),
      quizzes   : new RegExp( '(quiz)zes$'              , 'gi' ),
      whereases : new RegExp( '^(whereas)es$'           , 'gi' ),
      criteria  : new RegExp( '^(criteri)a$'            , 'gi' ),
      ss        : new RegExp( 'ss$'                     , 'gi' ),
      s         : new RegExp( 's$'                      , 'gi' )
    },

    singular : {
      man     : new RegExp( '^(m|wom)an$'           , 'gi' ),
      person  : new RegExp( '(pe)rson$'             , 'gi' ),
      child   : new RegExp( '(child)$'              , 'gi' ),
      ox      : new RegExp( '^(ox)$'                , 'gi' ),
      axis    : new RegExp( '(ax|test)is$'          , 'gi' ),
      octopus : new RegExp( '(octop|vir)us$'        , 'gi' ),
      alias   : new RegExp( '(alias|status|canvas)$', 'gi' ),
      summons : new RegExp( '^(summons)$'           , 'gi' ),
      bus     : new RegExp( '(bu)s$'                , 'gi' ),
      buffalo : new RegExp( '(buffal|tomat|potat)o$', 'gi' ),
      tium    : new RegExp( '([ti])um$'             , 'gi' ),
      sis     : new RegExp( 'sis$'                  , 'gi' ),
      ffe     : new RegExp( '(?:([^f])fe|([lr])f)$' , 'gi' ),
      hive    : new RegExp( '(hi|ti)ve$'            , 'gi' ),
      aeiouyy : new RegExp( '([^aeiouy]|qu)y$'      , 'gi' ),
      x       : new RegExp( '(x|ch|ss|sh)$'         , 'gi' ),
      matrix  : new RegExp( '(matr)ix$'             , 'gi' ),
      vertex  : new RegExp( '(vert|ind)ex$'         , 'gi' ),
      mouse   : new RegExp( '([m|l])ouse$'          , 'gi' ),
      foot    : new RegExp( '^foot$'                , 'gi' ),
      tooth   : new RegExp( '^tooth$'               , 'gi' ),
      goose   : new RegExp( '^goose$'               , 'gi' ),
      quiz    : new RegExp( '(quiz)$'               , 'gi' ),
      whereas : new RegExp( '^(whereas)$'           , 'gi' ),
      criterion : new RegExp( '^(criteri)on$'       , 'gi' ),
      s       : new RegExp( 's$'                    , 'gi' ),
      common  : new RegExp( '$'                     , 'gi' )
    }
  };

  var plural_rules = [

    // do not replace if its already a plural word
    [ regex.plural.men       ],
    [ regex.plural.people    ],
    [ regex.plural.children  ],
    [ regex.plural.tia       ],
    [ regex.plural.analyses  ],
    [ regex.plural.hives     ],
    [ regex.plural.curves    ],
    [ regex.plural.lrves     ],
    [ regex.plural.foves     ],
    [ regex.plural.aeiouyies ],
    [ regex.plural.series    ],
    [ regex.plural.movies    ],
    [ regex.plural.xes       ],
    [ regex.plural.mice      ],
    [ regex.plural.buses     ],
    [ regex.plural.oes       ],
    [ regex.plural.shoes     ],
    [ regex.plural.crises    ],
    [ regex.plural.octopi    ],
    [ regex.plural.aliases   ],
    [ regex.plural.summonses ],
    [ regex.plural.oxen      ],
    [ regex.plural.matrices  ],
    [ regex.plural.feet      ],
    [ regex.plural.teeth     ],
    [ regex.plural.geese     ],
    [ regex.plural.quizzes   ],
    [ regex.plural.whereases ],
    [ regex.plural.criteria  ],

    // original rule
    [ regex.singular.man    , '$1en' ],
    [ regex.singular.person , '$1ople' ],
    [ regex.singular.child  , '$1ren' ],
    [ regex.singular.ox     , '$1en' ],
    [ regex.singular.axis   , '$1es' ],
    [ regex.singular.octopus, '$1i' ],
    [ regex.singular.alias  , '$1es' ],
    [ regex.singular.summons, '$1es' ],
    [ regex.singular.bus    , '$1ses' ],
    [ regex.singular.buffalo, '$1oes' ],
    [ regex.singular.tium   , '$1a' ],
    [ regex.singular.sis    , 'ses' ],
    [ regex.singular.ffe    , '$1$2ves' ],
    [ regex.singular.hive   , '$1ves' ],
    [ regex.singular.aeiouyy, '$1ies' ],
    [ regex.singular.matrix , '$1ices' ],
    [ regex.singular.vertex , '$1ices' ],
    [ regex.singular.x      , '$1es' ],
    [ regex.singular.mouse  , '$1ice' ],
    [ regex.singular.foot   , 'feet' ],
    [ regex.singular.tooth  , 'teeth' ],
    [ regex.singular.goose  , 'geese' ],
    [ regex.singular.quiz   , '$1zes' ],
    [ regex.singular.whereas, '$1es' ],
    [ regex.singular.criterion, '$1a' ],

    [ regex.singular.s     , 's' ],
    [ regex.singular.common, 's' ]
  ];

  /**
   * @description These rules translate from the plural form of a noun to its singular form.
   * @private
   */
  var singular_rules = [

    // do not replace if its already a singular word
    [ regex.singular.man     ],
    [ regex.singular.person  ],
    [ regex.singular.child   ],
    [ regex.singular.ox      ],
    [ regex.singular.axis    ],
    [ regex.singular.octopus ],
    [ regex.singular.alias   ],
    [ regex.singular.summons ],
    [ regex.singular.bus     ],
    [ regex.singular.buffalo ],
    [ regex.singular.tium    ],
    [ regex.singular.sis     ],
    [ regex.singular.ffe     ],
    [ regex.singular.hive    ],
    [ regex.singular.aeiouyy ],
    [ regex.singular.x       ],
    [ regex.singular.matrix  ],
    [ regex.singular.mouse   ],
    [ regex.singular.foot    ],
    [ regex.singular.tooth   ],
    [ regex.singular.goose   ],
    [ regex.singular.quiz    ],
    [ regex.singular.whereas ],
    [ regex.singular.criterion ],

    // original rule
    [ regex.plural.men      , '$1an' ],
    [ regex.plural.people   , '$1rson' ],
    [ regex.plural.children , '$1' ],
    [ regex.plural.criteria, '$1on'],
    [ regex.plural.tia      , '$1um' ],
    [ regex.plural.analyses , '$1$2sis' ],
    [ regex.plural.hives    , '$1ve' ],
    [ regex.plural.curves   , '$1' ],
    [ regex.plural.lrves    , '$1f' ],
    [ regex.plural.foves    , '$1fe' ],
    [ regex.plural.movies   , '$1ovie' ],
    [ regex.plural.aeiouyies, '$1y' ],
    [ regex.plural.series   , '$1eries' ],
    [ regex.plural.xes      , '$1' ],
    [ regex.plural.mice     , '$1ouse' ],
    [ regex.plural.buses    , '$1' ],
    [ regex.plural.oes      , '$1' ],
    [ regex.plural.shoes    , '$1' ],
    [ regex.plural.crises   , '$1is' ],
    [ regex.plural.octopi   , '$1us' ],
    [ regex.plural.aliases  , '$1' ],
    [ regex.plural.summonses, '$1' ],
    [ regex.plural.oxen     , '$1' ],
    [ regex.plural.matrices , '$1ix' ],
    [ regex.plural.vertices , '$1ex' ],
    [ regex.plural.feet     , 'foot' ],
    [ regex.plural.teeth    , 'tooth' ],
    [ regex.plural.geese    , 'goose' ],
    [ regex.plural.quizzes  , '$1' ],
    [ regex.plural.whereases, '$1' ],

    [ regex.plural.ss, 'ss' ],
    [ regex.plural.s , '' ]
  ];

  /**
   * @description This is a list of words that should not be capitalized for title case.
   * @private
   */
  var non_titlecased_words = [
    'and', 'or', 'nor', 'a', 'an', 'the', 'so', 'but', 'to', 'of', 'at','by',
    'from', 'into', 'on', 'onto', 'off', 'out', 'in', 'over', 'with', 'for'
  ];

  /**
   * @description These are regular expressions used for converting between String formats.
   * @private
   */
  var id_suffix         = new RegExp( '(_ids|_id)$', 'g' );
  var underbar          = new RegExp( '_', 'g' );
  var space_or_underbar = new RegExp( '[\ _]', 'g' );
  var uppercase         = new RegExp( '([A-Z])', 'g' );
  var underbar_prefix   = new RegExp( '^_' );

  var inflector = {

  /**
   * A helper method that applies rules based replacement to a String.
   * @private
   * @function
   * @param {String} str String to modify and return based on the passed rules.
   * @param {Array: [RegExp, String]} rules Regexp to match paired with String to use for replacement
   * @param {Array: [String]} skip Strings to skip if they match
   * @param {String} override String to return as though this method succeeded (used to conform to APIs)
   * @returns {String} Return passed String modified by passed rules.
   * @example
   *
   *     this._apply_rules( 'cows', singular_rules ); // === 'cow'
   */
    _apply_rules : function ( str, rules, skip, override ){
      if( override ){
        str = override;
      }else{
        var ignore = ( inflector.indexOf( skip, str.toLowerCase()) > -1 );

        if( !ignore ){
          var i = 0;
          var j = rules.length;

          for( ; i < j; i++ ){
            if( str.match( rules[ i ][ 0 ])){
              if( rules[ i ][ 1 ] !== undefined ){
                str = str.replace( rules[ i ][ 0 ], rules[ i ][ 1 ]);
              }
              break;
            }
          }
        }
      }

      return str;
    },



  /**
   * This lets us detect if an Array contains a given element.
   * @public
   * @function
   * @param {Array} arr The subject array.
   * @param {Object} item Object to locate in the Array.
   * @param {Number} from_index Starts checking from this position in the Array.(optional)
   * @param {Function} compare_func Function used to compare Array item vs passed item.(optional)
   * @returns {Number} Return index position in the Array of the passed item.
   * @example
   *
   *     var inflection = require( 'inflection' );
   *
   *     inflection.indexOf([ 'hi','there' ], 'guys' ); // === -1
   *     inflection.indexOf([ 'hi','there' ], 'hi' ); // === 0
   */
    indexOf : function ( arr, item, from_index, compare_func ){
      if( !from_index ){
        from_index = -1;
      }

      var index = -1;
      var i     = from_index;
      var j     = arr.length;

      for( ; i < j; i++ ){
        if( arr[ i ]  === item || compare_func && compare_func( arr[ i ], item )){
          index = i;
          break;
        }
      }

      return index;
    },



  /**
   * This function adds pluralization support to every String object.
   * @public
   * @function
   * @param {String} str The subject string.
   * @param {String} plural Overrides normal output with said String.(optional)
   * @returns {String} Singular English language nouns are returned in plural form.
   * @example
   *
   *     var inflection = require( 'inflection' );
   *
   *     inflection.pluralize( 'person' ); // === 'people'
   *     inflection.pluralize( 'octopus' ); // === 'octopi'
   *     inflection.pluralize( 'Hat' ); // === 'Hats'
   *     inflection.pluralize( 'person', 'guys' ); // === 'guys'
   */
    pluralize : function ( str, plural ){
      return inflector._apply_rules( str, plural_rules, uncountable_words, plural );
    },



  /**
   * This function adds singularization support to every String object.
   * @public
   * @function
   * @param {String} str The subject string.
   * @param {String} singular Overrides normal output with said String.(optional)
   * @returns {String} Plural English language nouns are returned in singular form.
   * @example
   *
   *     var inflection = require( 'inflection' );
   *
   *     inflection.singularize( 'people' ); // === 'person'
   *     inflection.singularize( 'octopi' ); // === 'octopus'
   *     inflection.singularize( 'Hats' ); // === 'Hat'
   *     inflection.singularize( 'guys', 'person' ); // === 'person'
   */
    singularize : function ( str, singular ){
      return inflector._apply_rules( str, singular_rules, uncountable_words, singular );
    },


  /**
   * This function will pluralize or singularlize a String appropriately based on an integer value
   * @public
   * @function
   * @param {String} str The subject string.
   * @param {Number} count The number to base pluralization off of.
   * @param {String} singular Overrides normal output with said String.(optional)
   * @param {String} plural Overrides normal output with said String.(optional)
   * @returns {String} English language nouns are returned in the plural or singular form based on the count.
   * @example
   *
   *     var inflection = require( 'inflection' );
   *
   *     inflection.inflect( 'people' 1 ); // === 'person'
   *     inflection.inflect( 'octopi' 1 ); // === 'octopus'
   *     inflection.inflect( 'Hats' 1 ); // === 'Hat'
   *     inflection.inflect( 'guys', 1 , 'person' ); // === 'person'
   *     inflection.inflect( 'person', 2 ); // === 'people'
   *     inflection.inflect( 'octopus', 2 ); // === 'octopi'
   *     inflection.inflect( 'Hat', 2 ); // === 'Hats'
   *     inflection.inflect( 'person', 2, null, 'guys' ); // === 'guys'
   */
    inflect : function ( str, count, singular, plural ){
      count = parseInt( count, 10 );

      if( isNaN( count )) return str;

      if( count === 0 || count > 1 ){
        return inflector._apply_rules( str, plural_rules, uncountable_words, plural );
      }else{
        return inflector._apply_rules( str, singular_rules, uncountable_words, singular );
      }
    },



  /**
   * This function adds camelization support to every String object.
   * @public
   * @function
   * @param {String} str The subject string.
   * @param {Boolean} low_first_letter Default is to capitalize the first letter of the results.(optional)
   *                                 Passing true will lowercase it.
   * @returns {String} Lower case underscored words will be returned in camel case.
   *                  additionally '/' is translated to '::'
   * @example
   *
   *     var inflection = require( 'inflection' );
   *
   *     inflection.camelize( 'message_properties' ); // === 'MessageProperties'
   *     inflection.camelize( 'message_properties', true ); // === 'messageProperties'
   */
    camelize : function ( str, low_first_letter ){
      var str_path = str.split( '/' );
      var i        = 0;
      var j        = str_path.length;
      var str_arr, init_x, k, l, first;

      for( ; i < j; i++ ){
        str_arr = str_path[ i ].split( '_' );
        k       = 0;
        l       = str_arr.length;

        for( ; k < l; k++ ){
          if( k !== 0 ){
            str_arr[ k ] = str_arr[ k ].toLowerCase();
          }

          first = str_arr[ k ].charAt( 0 );
          first = low_first_letter && i === 0 && k === 0
            ? first.toLowerCase() : first.toUpperCase();
          str_arr[ k ] = first + str_arr[ k ].substring( 1 );
        }

        str_path[ i ] = str_arr.join( '' );
      }

      return str_path.join( '::' );
    },



  /**
   * This function adds underscore support to every String object.
   * @public
   * @function
   * @param {String} str The subject string.
   * @param {Boolean} all_upper_case Default is to lowercase and add underscore prefix.(optional)
   *                  Passing true will return as entered.
   * @returns {String} Camel cased words are returned as lower cased and underscored.
   *                  additionally '::' is translated to '/'.
   * @example
   *
   *     var inflection = require( 'inflection' );
   *
   *     inflection.underscore( 'MessageProperties' ); // === 'message_properties'
   *     inflection.underscore( 'messageProperties' ); // === 'message_properties'
   *     inflection.underscore( 'MP', true ); // === 'MP'
   */
    underscore : function ( str, all_upper_case ){
      if( all_upper_case && str === str.toUpperCase()) return str;

      var str_path = str.split( '::' );
      var i        = 0;
      var j        = str_path.length;

      for( ; i < j; i++ ){
        str_path[ i ] = str_path[ i ].replace( uppercase, '_$1' );
        str_path[ i ] = str_path[ i ].replace( underbar_prefix, '' );
      }

      return str_path.join( '/' ).toLowerCase();
    },



  /**
   * This function adds humanize support to every String object.
   * @public
   * @function
   * @param {String} str The subject string.
   * @param {Boolean} low_first_letter Default is to capitalize the first letter of the results.(optional)
   *                                 Passing true will lowercase it.
   * @returns {String} Lower case underscored words will be returned in humanized form.
   * @example
   *
   *     var inflection = require( 'inflection' );
   *
   *     inflection.humanize( 'message_properties' ); // === 'Message properties'
   *     inflection.humanize( 'message_properties', true ); // === 'message properties'
   */
    humanize : function ( str, low_first_letter ){
      str = str.toLowerCase();
      str = str.replace( id_suffix, '' );
      str = str.replace( underbar, ' ' );

      if( !low_first_letter ){
        str = inflector.capitalize( str );
      }

      return str;
    },



  /**
   * This function adds capitalization support to every String object.
   * @public
   * @function
   * @param {String} str The subject string.
   * @returns {String} All characters will be lower case and the first will be upper.
   * @example
   *
   *     var inflection = require( 'inflection' );
   *
   *     inflection.capitalize( 'message_properties' ); // === 'Message_properties'
   *     inflection.capitalize( 'message properties', true ); // === 'Message properties'
   */
    capitalize : function ( str ){
      str = str.toLowerCase();

      return str.substring( 0, 1 ).toUpperCase() + str.substring( 1 );
    },



  /**
   * This function replaces underscores with dashes in the string.
   * @public
   * @function
   * @param {String} str The subject string.
   * @returns {String} Replaces all spaces or underscores with dashes.
   * @example
   *
   *     var inflection = require( 'inflection' );
   *
   *     inflection.dasherize( 'message_properties' ); // === 'message-properties'
   *     inflection.dasherize( 'Message Properties' ); // === 'Message-Properties'
   */
    dasherize : function ( str ){
      return str.replace( space_or_underbar, '-' );
    },



  /**
   * This function adds titleize support to every String object.
   * @public
   * @function
   * @param {String} str The subject string.
   * @returns {String} Capitalizes words as you would for a book title.
   * @example
   *
   *     var inflection = require( 'inflection' );
   *
   *     inflection.titleize( 'message_properties' ); // === 'Message Properties'
   *     inflection.titleize( 'message properties to keep' ); // === 'Message Properties to Keep'
   */
    titleize : function ( str ){
      str         = str.toLowerCase().replace( underbar, ' ' );
      var str_arr = str.split( ' ' );
      var i       = 0;
      var j       = str_arr.length;
      var d, k, l;

      for( ; i < j; i++ ){
        d = str_arr[ i ].split( '-' );
        k = 0;
        l = d.length;

        for( ; k < l; k++){
          if( inflector.indexOf( non_titlecased_words, d[ k ].toLowerCase()) < 0 ){
            d[ k ] = inflector.capitalize( d[ k ]);
          }
        }

        str_arr[ i ] = d.join( '-' );
      }

      str = str_arr.join( ' ' );
      str = str.substring( 0, 1 ).toUpperCase() + str.substring( 1 );

      return str;
    },



  /**
   * This function adds demodulize support to every String object.
   * @public
   * @function
   * @param {String} str The subject string.
   * @returns {String} Removes module names leaving only class names.(Ruby style)
   * @example
   *
   *     var inflection = require( 'inflection' );
   *
   *     inflection.demodulize( 'Message::Bus::Properties' ); // === 'Properties'
   */
    demodulize : function ( str ){
      var str_arr = str.split( '::' );

      return str_arr[ str_arr.length - 1 ];
    },



  /**
   * This function adds tableize support to every String object.
   * @public
   * @function
   * @param {String} str The subject string.
   * @returns {String} Return camel cased words into their underscored plural form.
   * @example
   *
   *     var inflection = require( 'inflection' );
   *
   *     inflection.tableize( 'MessageBusProperty' ); // === 'message_bus_properties'
   */
    tableize : function ( str ){
      str = inflector.underscore( str );
      str = inflector.pluralize( str );

      return str;
    },



  /**
   * This function adds classification support to every String object.
   * @public
   * @function
   * @param {String} str The subject string.
   * @returns {String} Underscored plural nouns become the camel cased singular form.
   * @example
   *
   *     var inflection = require( 'inflection' );
   *
   *     inflection.classify( 'message_bus_properties' ); // === 'MessageBusProperty'
   */
    classify : function ( str ){
      str = inflector.camelize( str );
      str = inflector.singularize( str );

      return str;
    },



  /**
   * This function adds foreign key support to every String object.
   * @public
   * @function
   * @param {String} str The subject string.
   * @param {Boolean} drop_id_ubar Default is to seperate id with an underbar at the end of the class name,
                                 you can pass true to skip it.(optional)
   * @returns {String} Underscored plural nouns become the camel cased singular form.
   * @example
   *
   *     var inflection = require( 'inflection' );
   *
   *     inflection.foreign_key( 'MessageBusProperty' ); // === 'message_bus_property_id'
   *     inflection.foreign_key( 'MessageBusProperty', true ); // === 'message_bus_propertyid'
   */
    foreign_key : function ( str, drop_id_ubar ){
      str = inflector.demodulize( str );
      str = inflector.underscore( str ) + (( drop_id_ubar ) ? ( '' ) : ( '_' )) + 'id';

      return str;
    },



  /**
   * This function adds ordinalize support to every String object.
   * @public
   * @function
   * @param {String} str The subject string.
   * @returns {String} Return all found numbers their sequence like '22nd'.
   * @example
   *
   *     var inflection = require( 'inflection' );
   *
   *     inflection.ordinalize( 'the 1 pitch' ); // === 'the 1st pitch'
   */
    ordinalize : function ( str ){
      var str_arr = str.split( ' ' );
      var i       = 0;
      var j       = str_arr.length;

      for( ; i < j; i++ ){
        var k = parseInt( str_arr[ i ], 10 );

        if( !isNaN( k )){
          var ltd = str_arr[ i ].substring( str_arr[ i ].length - 2 );
          var ld  = str_arr[ i ].substring( str_arr[ i ].length - 1 );
          var suf = 'th';

          if( ltd != '11' && ltd != '12' && ltd != '13' ){
            if( ld === '1' ){
              suf = 'st';
            }else if( ld === '2' ){
              suf = 'nd';
            }else if( ld === '3' ){
              suf = 'rd';
            }
          }

          str_arr[ i ] += suf;
        }
      }

      return str_arr.join( ' ' );
    },

  /**
   * This function performs multiple inflection methods on a string
   * @public
   * @function
   * @param {String} str The subject string.
   * @param {Array} arr An array of inflection methods.
   * @returns {String}
   * @example
   *
   *     var inflection = require( 'inflection' );
   *
   *     inflection.transform( 'all job', [ 'pluralize', 'capitalize', 'dasherize' ]); // === 'All-jobs'
   */
    transform : function ( str, arr ){
      var i = 0;
      var j = arr.length;

      for( ;i < j; i++ ){
        var method = arr[ i ];

        if( this.hasOwnProperty( method )){
          str = this[ method ]( str );
        }
      }

      return str;
    }
  };

/**
 * @public
 */
  inflector.version = '1.8.0';

  return inflector;
}));

},{}],416:[function(require,module,exports){
// shim for using process in browser
var process = module.exports = {};

// cached from whatever global is present so that test runners that stub it
// don't break things.  But we need to wrap it in a try catch in case it is
// wrapped in strict mode code which doesn't define any globals.  It's inside a
// function because try/catches deoptimize in certain engines.

var cachedSetTimeout;
var cachedClearTimeout;

function defaultSetTimout() {
    throw new Error('setTimeout has not been defined');
}
function defaultClearTimeout () {
    throw new Error('clearTimeout has not been defined');
}
(function () {
    try {
        if (typeof setTimeout === 'function') {
            cachedSetTimeout = setTimeout;
        } else {
            cachedSetTimeout = defaultSetTimout;
        }
    } catch (e) {
        cachedSetTimeout = defaultSetTimout;
    }
    try {
        if (typeof clearTimeout === 'function') {
            cachedClearTimeout = clearTimeout;
        } else {
            cachedClearTimeout = defaultClearTimeout;
        }
    } catch (e) {
        cachedClearTimeout = defaultClearTimeout;
    }
} ())
function runTimeout(fun) {
    if (cachedSetTimeout === setTimeout) {
        //normal enviroments in sane situations
        return setTimeout(fun, 0);
    }
    // if setTimeout wasn't available but was latter defined
    if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
        cachedSetTimeout = setTimeout;
        return setTimeout(fun, 0);
    }
    try {
        // when when somebody has screwed with setTimeout but no I.E. maddness
        return cachedSetTimeout(fun, 0);
    } catch(e){
        try {
            // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
            return cachedSetTimeout.call(null, fun, 0);
        } catch(e){
            // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
            return cachedSetTimeout.call(this, fun, 0);
        }
    }


}
function runClearTimeout(marker) {
    if (cachedClearTimeout === clearTimeout) {
        //normal enviroments in sane situations
        return clearTimeout(marker);
    }
    // if clearTimeout wasn't available but was latter defined
    if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
        cachedClearTimeout = clearTimeout;
        return clearTimeout(marker);
    }
    try {
        // when when somebody has screwed with setTimeout but no I.E. maddness
        return cachedClearTimeout(marker);
    } catch (e){
        try {
            // When we are in I.E. but the script has been evaled so I.E. doesn't  trust the global object when called normally
            return cachedClearTimeout.call(null, marker);
        } catch (e){
            // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
            // Some versions of I.E. have different rules for clearTimeout vs setTimeout
            return cachedClearTimeout.call(this, marker);
        }
    }



}
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;

function cleanUpNextTick() {
    if (!draining || !currentQueue) {
        return;
    }
    draining = false;
    if (currentQueue.length) {
        queue = currentQueue.concat(queue);
    } else {
        queueIndex = -1;
    }
    if (queue.length) {
        drainQueue();
    }
}

function drainQueue() {
    if (draining) {
        return;
    }
    var timeout = runTimeout(cleanUpNextTick);
    draining = true;

    var len = queue.length;
    while(len) {
        currentQueue = queue;
        queue = [];
        while (++queueIndex < len) {
            if (currentQueue) {
                currentQueue[queueIndex].run();
            }
        }
        queueIndex = -1;
        len = queue.length;
    }
    currentQueue = null;
    draining = false;
    runClearTimeout(timeout);
}

process.nextTick = function (fun) {
    var args = new Array(arguments.length - 1);
    if (arguments.length > 1) {
        for (var i = 1; i < arguments.length; i++) {
            args[i - 1] = arguments[i];
        }
    }
    queue.push(new Item(fun, args));
    if (queue.length === 1 && !draining) {
        runTimeout(drainQueue);
    }
};

// v8 likes predictible objects
function Item(fun, array) {
    this.fun = fun;
    this.array = array;
}
Item.prototype.run = function () {
    this.fun.apply(null, this.array);
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};

function noop() {}

process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;

process.binding = function (name) {
    throw new Error('process.binding is not supported');
};

process.cwd = function () { return '/' };
process.chdir = function (dir) {
    throw new Error('process.chdir is not supported');
};
process.umask = function() { return 0; };

},{}],417:[function(require,module,exports){
/*!
 * URI.js - Mutating URLs
 * IPv6 Support
 *
 * Version: 1.17.1
 *
 * Author: Rodney Rehm
 * Web: http://medialize.github.io/URI.js/
 *
 * Licensed under
 *   MIT License http://www.opensource.org/licenses/mit-license
 *
 */

(function (root, factory) {
  'use strict';
  // https://github.com/umdjs/umd/blob/master/returnExports.js
  if (typeof exports === 'object') {
    // Node
    module.exports = factory();
  } else if (typeof define === 'function' && define.amd) {
    // AMD. Register as an anonymous module.
    define(factory);
  } else {
    // Browser globals (root is window)
    root.IPv6 = factory(root);
  }
}(this, function (root) {
  'use strict';

  /*
  var _in = "fe80:0000:0000:0000:0204:61ff:fe9d:f156";
  var _out = IPv6.best(_in);
  var _expected = "fe80::204:61ff:fe9d:f156";

  console.log(_in, _out, _expected, _out === _expected);
  */

  // save current IPv6 variable, if any
  var _IPv6 = root && root.IPv6;

  function bestPresentation(address) {
    // based on:
    // Javascript to test an IPv6 address for proper format, and to
    // present the "best text representation" according to IETF Draft RFC at
    // http://tools.ietf.org/html/draft-ietf-6man-text-addr-representation-04
    // 8 Feb 2010 Rich Brown, Dartware, LLC
    // Please feel free to use this code as long as you provide a link to
    // http://www.intermapper.com
    // http://intermapper.com/support/tools/IPV6-Validator.aspx
    // http://download.dartware.com/thirdparty/ipv6validator.js

    var _address = address.toLowerCase();
    var segments = _address.split(':');
    var length = segments.length;
    var total = 8;

    // trim colons (:: or ::a:b:c… or …a:b:c::)
    if (segments[0] === '' && segments[1] === '' && segments[2] === '') {
      // must have been ::
      // remove first two items
      segments.shift();
      segments.shift();
    } else if (segments[0] === '' && segments[1] === '') {
      // must have been ::xxxx
      // remove the first item
      segments.shift();
    } else if (segments[length - 1] === '' && segments[length - 2] === '') {
      // must have been xxxx::
      segments.pop();
    }

    length = segments.length;

    // adjust total segments for IPv4 trailer
    if (segments[length - 1].indexOf('.') !== -1) {
      // found a "." which means IPv4
      total = 7;
    }

    // fill empty segments them with "0000"
    var pos;
    for (pos = 0; pos < length; pos++) {
      if (segments[pos] === '') {
        break;
      }
    }

    if (pos < total) {
      segments.splice(pos, 1, '0000');
      while (segments.length < total) {
        segments.splice(pos, 0, '0000');
      }

      length = segments.length;
    }

    // strip leading zeros
    var _segments;
    for (var i = 0; i < total; i++) {
      _segments = segments[i].split('');
      for (var j = 0; j < 3 ; j++) {
        if (_segments[0] === '0' && _segments.length > 1) {
          _segments.splice(0,1);
        } else {
          break;
        }
      }

      segments[i] = _segments.join('');
    }

    // find longest sequence of zeroes and coalesce them into one segment
    var best = -1;
    var _best = 0;
    var _current = 0;
    var current = -1;
    var inzeroes = false;
    // i; already declared

    for (i = 0; i < total; i++) {
      if (inzeroes) {
        if (segments[i] === '0') {
          _current += 1;
        } else {
          inzeroes = false;
          if (_current > _best) {
            best = current;
            _best = _current;
          }
        }
      } else {
        if (segments[i] === '0') {
          inzeroes = true;
          current = i;
          _current = 1;
        }
      }
    }

    if (_current > _best) {
      best = current;
      _best = _current;
    }

    if (_best > 1) {
      segments.splice(best, _best, '');
    }

    length = segments.length;

    // assemble remaining segments
    var result = '';
    if (segments[0] === '')  {
      result = ':';
    }

    for (i = 0; i < length; i++) {
      result += segments[i];
      if (i === length - 1) {
        break;
      }

      result += ':';
    }

    if (segments[length - 1] === '') {
      result += ':';
    }

    return result;
  }

  function noConflict() {
    /*jshint validthis: true */
    if (root.IPv6 === this) {
      root.IPv6 = _IPv6;
    }
  
    return this;
  }

  return {
    best: bestPresentation,
    noConflict: noConflict
  };
}));

},{}],418:[function(require,module,exports){
/*!
 * URI.js - Mutating URLs
 * Second Level Domain (SLD) Support
 *
 * Version: 1.17.1
 *
 * Author: Rodney Rehm
 * Web: http://medialize.github.io/URI.js/
 *
 * Licensed under
 *   MIT License http://www.opensource.org/licenses/mit-license
 *
 */

(function (root, factory) {
  'use strict';
  // https://github.com/umdjs/umd/blob/master/returnExports.js
  if (typeof exports === 'object') {
    // Node
    module.exports = factory();
  } else if (typeof define === 'function' && define.amd) {
    // AMD. Register as an anonymous module.
    define(factory);
  } else {
    // Browser globals (root is window)
    root.SecondLevelDomains = factory(root);
  }
}(this, function (root) {
  'use strict';

  // save current SecondLevelDomains variable, if any
  var _SecondLevelDomains = root && root.SecondLevelDomains;

  var SLD = {
    // list of known Second Level Domains
    // converted list of SLDs from https://github.com/gavingmiller/second-level-domains
    // ----
    // publicsuffix.org is more current and actually used by a couple of browsers internally.
    // downside is it also contains domains like "dyndns.org" - which is fine for the security
    // issues browser have to deal with (SOP for cookies, etc) - but is way overboard for URI.js
    // ----
    list: {
      'ac':' com gov mil net org ',
      'ae':' ac co gov mil name net org pro sch ',
      'af':' com edu gov net org ',
      'al':' com edu gov mil net org ',
      'ao':' co ed gv it og pb ',
      'ar':' com edu gob gov int mil net org tur ',
      'at':' ac co gv or ',
      'au':' asn com csiro edu gov id net org ',
      'ba':' co com edu gov mil net org rs unbi unmo unsa untz unze ',
      'bb':' biz co com edu gov info net org store tv ',
      'bh':' biz cc com edu gov info net org ',
      'bn':' com edu gov net org ',
      'bo':' com edu gob gov int mil net org tv ',
      'br':' adm adv agr am arq art ato b bio blog bmd cim cng cnt com coop ecn edu eng esp etc eti far flog fm fnd fot fst g12 ggf gov imb ind inf jor jus lel mat med mil mus net nom not ntr odo org ppg pro psc psi qsl rec slg srv tmp trd tur tv vet vlog wiki zlg ',
      'bs':' com edu gov net org ',
      'bz':' du et om ov rg ',
      'ca':' ab bc mb nb nf nl ns nt nu on pe qc sk yk ',
      'ck':' biz co edu gen gov info net org ',
      'cn':' ac ah bj com cq edu fj gd gov gs gx gz ha hb he hi hl hn jl js jx ln mil net nm nx org qh sc sd sh sn sx tj tw xj xz yn zj ',
      'co':' com edu gov mil net nom org ',
      'cr':' ac c co ed fi go or sa ',
      'cy':' ac biz com ekloges gov ltd name net org parliament press pro tm ',
      'do':' art com edu gob gov mil net org sld web ',
      'dz':' art asso com edu gov net org pol ',
      'ec':' com edu fin gov info med mil net org pro ',
      'eg':' com edu eun gov mil name net org sci ',
      'er':' com edu gov ind mil net org rochest w ',
      'es':' com edu gob nom org ',
      'et':' biz com edu gov info name net org ',
      'fj':' ac biz com info mil name net org pro ',
      'fk':' ac co gov net nom org ',
      'fr':' asso com f gouv nom prd presse tm ',
      'gg':' co net org ',
      'gh':' com edu gov mil org ',
      'gn':' ac com gov net org ',
      'gr':' com edu gov mil net org ',
      'gt':' com edu gob ind mil net org ',
      'gu':' com edu gov net org ',
      'hk':' com edu gov idv net org ',
      'hu':' 2000 agrar bolt casino city co erotica erotika film forum games hotel info ingatlan jogasz konyvelo lakas media news org priv reklam sex shop sport suli szex tm tozsde utazas video ',
      'id':' ac co go mil net or sch web ',
      'il':' ac co gov idf k12 muni net org ',
      'in':' ac co edu ernet firm gen gov i ind mil net nic org res ',
      'iq':' com edu gov i mil net org ',
      'ir':' ac co dnssec gov i id net org sch ',
      'it':' edu gov ',
      'je':' co net org ',
      'jo':' com edu gov mil name net org sch ',
      'jp':' ac ad co ed go gr lg ne or ',
      'ke':' ac co go info me mobi ne or sc ',
      'kh':' com edu gov mil net org per ',
      'ki':' biz com de edu gov info mob net org tel ',
      'km':' asso com coop edu gouv k medecin mil nom notaires pharmaciens presse tm veterinaire ',
      'kn':' edu gov net org ',
      'kr':' ac busan chungbuk chungnam co daegu daejeon es gangwon go gwangju gyeongbuk gyeonggi gyeongnam hs incheon jeju jeonbuk jeonnam k kg mil ms ne or pe re sc seoul ulsan ',
      'kw':' com edu gov net org ',
      'ky':' com edu gov net org ',
      'kz':' com edu gov mil net org ',
      'lb':' com edu gov net org ',
      'lk':' assn com edu gov grp hotel int ltd net ngo org sch soc web ',
      'lr':' com edu gov net org ',
      'lv':' asn com conf edu gov id mil net org ',
      'ly':' com edu gov id med net org plc sch ',
      'ma':' ac co gov m net org press ',
      'mc':' asso tm ',
      'me':' ac co edu gov its net org priv ',
      'mg':' com edu gov mil nom org prd tm ',
      'mk':' com edu gov inf name net org pro ',
      'ml':' com edu gov net org presse ',
      'mn':' edu gov org ',
      'mo':' com edu gov net org ',
      'mt':' com edu gov net org ',
      'mv':' aero biz com coop edu gov info int mil museum name net org pro ',
      'mw':' ac co com coop edu gov int museum net org ',
      'mx':' com edu gob net org ',
      'my':' com edu gov mil name net org sch ',
      'nf':' arts com firm info net other per rec store web ',
      'ng':' biz com edu gov mil mobi name net org sch ',
      'ni':' ac co com edu gob mil net nom org ',
      'np':' com edu gov mil net org ',
      'nr':' biz com edu gov info net org ',
      'om':' ac biz co com edu gov med mil museum net org pro sch ',
      'pe':' com edu gob mil net nom org sld ',
      'ph':' com edu gov i mil net ngo org ',
      'pk':' biz com edu fam gob gok gon gop gos gov net org web ',
      'pl':' art bialystok biz com edu gda gdansk gorzow gov info katowice krakow lodz lublin mil net ngo olsztyn org poznan pwr radom slupsk szczecin torun warszawa waw wroc wroclaw zgora ',
      'pr':' ac biz com edu est gov info isla name net org pro prof ',
      'ps':' com edu gov net org plo sec ',
      'pw':' belau co ed go ne or ',
      'ro':' arts com firm info nom nt org rec store tm www ',
      'rs':' ac co edu gov in org ',
      'sb':' com edu gov net org ',
      'sc':' com edu gov net org ',
      'sh':' co com edu gov net nom org ',
      'sl':' com edu gov net org ',
      'st':' co com consulado edu embaixada gov mil net org principe saotome store ',
      'sv':' com edu gob org red ',
      'sz':' ac co org ',
      'tr':' av bbs bel biz com dr edu gen gov info k12 name net org pol tel tsk tv web ',
      'tt':' aero biz cat co com coop edu gov info int jobs mil mobi museum name net org pro tel travel ',
      'tw':' club com ebiz edu game gov idv mil net org ',
      'mu':' ac co com gov net or org ',
      'mz':' ac co edu gov org ',
      'na':' co com ',
      'nz':' ac co cri geek gen govt health iwi maori mil net org parliament school ',
      'pa':' abo ac com edu gob ing med net nom org sld ',
      'pt':' com edu gov int net nome org publ ',
      'py':' com edu gov mil net org ',
      'qa':' com edu gov mil net org ',
      're':' asso com nom ',
      'ru':' ac adygeya altai amur arkhangelsk astrakhan bashkiria belgorod bir bryansk buryatia cbg chel chelyabinsk chita chukotka chuvashia com dagestan e-burg edu gov grozny int irkutsk ivanovo izhevsk jar joshkar-ola kalmykia kaluga kamchatka karelia kazan kchr kemerovo khabarovsk khakassia khv kirov koenig komi kostroma kranoyarsk kuban kurgan kursk lipetsk magadan mari mari-el marine mil mordovia mosreg msk murmansk nalchik net nnov nov novosibirsk nsk omsk orenburg org oryol penza perm pp pskov ptz rnd ryazan sakhalin samara saratov simbirsk smolensk spb stavropol stv surgut tambov tatarstan tom tomsk tsaritsyn tsk tula tuva tver tyumen udm udmurtia ulan-ude vladikavkaz vladimir vladivostok volgograd vologda voronezh vrn vyatka yakutia yamal yekaterinburg yuzhno-sakhalinsk ',
      'rw':' ac co com edu gouv gov int mil net ',
      'sa':' com edu gov med net org pub sch ',
      'sd':' com edu gov info med net org tv ',
      'se':' a ac b bd c d e f g h i k l m n o org p parti pp press r s t tm u w x y z ',
      'sg':' com edu gov idn net org per ',
      'sn':' art com edu gouv org perso univ ',
      'sy':' com edu gov mil net news org ',
      'th':' ac co go in mi net or ',
      'tj':' ac biz co com edu go gov info int mil name net nic org test web ',
      'tn':' agrinet com defense edunet ens fin gov ind info intl mincom nat net org perso rnrt rns rnu tourism ',
      'tz':' ac co go ne or ',
      'ua':' biz cherkassy chernigov chernovtsy ck cn co com crimea cv dn dnepropetrovsk donetsk dp edu gov if in ivano-frankivsk kh kharkov kherson khmelnitskiy kiev kirovograd km kr ks kv lg lugansk lutsk lviv me mk net nikolaev od odessa org pl poltava pp rovno rv sebastopol sumy te ternopil uzhgorod vinnica vn zaporizhzhe zhitomir zp zt ',
      'ug':' ac co go ne or org sc ',
      'uk':' ac bl british-library co cym gov govt icnet jet lea ltd me mil mod national-library-scotland nel net nhs nic nls org orgn parliament plc police sch scot soc ',
      'us':' dni fed isa kids nsn ',
      'uy':' com edu gub mil net org ',
      've':' co com edu gob info mil net org web ',
      'vi':' co com k12 net org ',
      'vn':' ac biz com edu gov health info int name net org pro ',
      'ye':' co com gov ltd me net org plc ',
      'yu':' ac co edu gov org ',
      'za':' ac agric alt bourse city co cybernet db edu gov grondar iaccess imt inca landesign law mil net ngo nis nom olivetti org pix school tm web ',
      'zm':' ac co com edu gov net org sch '
    },
    // gorhill 2013-10-25: Using indexOf() instead Regexp(). Significant boost
    // in both performance and memory footprint. No initialization required.
    // http://jsperf.com/uri-js-sld-regex-vs-binary-search/4
    // Following methods use lastIndexOf() rather than array.split() in order
    // to avoid any memory allocations.
    has: function(domain) {
      var tldOffset = domain.lastIndexOf('.');
      if (tldOffset <= 0 || tldOffset >= (domain.length-1)) {
        return false;
      }
      var sldOffset = domain.lastIndexOf('.', tldOffset-1);
      if (sldOffset <= 0 || sldOffset >= (tldOffset-1)) {
        return false;
      }
      var sldList = SLD.list[domain.slice(tldOffset+1)];
      if (!sldList) {
        return false;
      }
      return sldList.indexOf(' ' + domain.slice(sldOffset+1, tldOffset) + ' ') >= 0;
    },
    is: function(domain) {
      var tldOffset = domain.lastIndexOf('.');
      if (tldOffset <= 0 || tldOffset >= (domain.length-1)) {
        return false;
      }
      var sldOffset = domain.lastIndexOf('.', tldOffset-1);
      if (sldOffset >= 0) {
        return false;
      }
      var sldList = SLD.list[domain.slice(tldOffset+1)];
      if (!sldList) {
        return false;
      }
      return sldList.indexOf(' ' + domain.slice(0, tldOffset) + ' ') >= 0;
    },
    get: function(domain) {
      var tldOffset = domain.lastIndexOf('.');
      if (tldOffset <= 0 || tldOffset >= (domain.length-1)) {
        return null;
      }
      var sldOffset = domain.lastIndexOf('.', tldOffset-1);
      if (sldOffset <= 0 || sldOffset >= (tldOffset-1)) {
        return null;
      }
      var sldList = SLD.list[domain.slice(tldOffset+1)];
      if (!sldList) {
        return null;
      }
      if (sldList.indexOf(' ' + domain.slice(sldOffset+1, tldOffset) + ' ') < 0) {
        return null;
      }
      return domain.slice(sldOffset+1);
    },
    noConflict: function(){
      if (root.SecondLevelDomains === this) {
        root.SecondLevelDomains = _SecondLevelDomains;
      }
      return this;
    }
  };

  return SLD;
}));

},{}],419:[function(require,module,exports){
/*!
 * URI.js - Mutating URLs
 *
 * Version: 1.17.1
 *
 * Author: Rodney Rehm
 * Web: http://medialize.github.io/URI.js/
 *
 * Licensed under
 *   MIT License http://www.opensource.org/licenses/mit-license
 *
 */
(function (root, factory) {
  'use strict';
  // https://github.com/umdjs/umd/blob/master/returnExports.js
  if (typeof exports === 'object') {
    // Node
    module.exports = factory(require('./punycode'), require('./IPv6'), require('./SecondLevelDomains'));
  } else if (typeof define === 'function' && define.amd) {
    // AMD. Register as an anonymous module.
    define(['./punycode', './IPv6', './SecondLevelDomains'], factory);
  } else {
    // Browser globals (root is window)
    root.URI = factory(root.punycode, root.IPv6, root.SecondLevelDomains, root);
  }
}(this, function (punycode, IPv6, SLD, root) {
  'use strict';
  /*global location, escape, unescape */
  // FIXME: v2.0.0 renamce non-camelCase properties to uppercase
  /*jshint camelcase: false */

  // save current URI variable, if any
  var _URI = root && root.URI;

  function URI(url, base) {
    var _urlSupplied = arguments.length >= 1;
    var _baseSupplied = arguments.length >= 2;

    // Allow instantiation without the 'new' keyword
    if (!(this instanceof URI)) {
      if (_urlSupplied) {
        if (_baseSupplied) {
          return new URI(url, base);
        }

        return new URI(url);
      }

      return new URI();
    }

    if (url === undefined) {
      if (_urlSupplied) {
        throw new TypeError('undefined is not a valid argument for URI');
      }

      if (typeof location !== 'undefined') {
        url = location.href + '';
      } else {
        url = '';
      }
    }

    this.href(url);

    // resolve to base according to http://dvcs.w3.org/hg/url/raw-file/tip/Overview.html#constructor
    if (base !== undefined) {
      return this.absoluteTo(base);
    }

    return this;
  }

  URI.version = '1.17.1';

  var p = URI.prototype;
  var hasOwn = Object.prototype.hasOwnProperty;

  function escapeRegEx(string) {
    // https://github.com/medialize/URI.js/commit/85ac21783c11f8ccab06106dba9735a31a86924d#commitcomment-821963
    return string.replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
  }

  function getType(value) {
    // IE8 doesn't return [Object Undefined] but [Object Object] for undefined value
    if (value === undefined) {
      return 'Undefined';
    }

    return String(Object.prototype.toString.call(value)).slice(8, -1);
  }

  function isArray(obj) {
    return getType(obj) === 'Array';
  }

  function filterArrayValues(data, value) {
    var lookup = {};
    var i, length;

    if (getType(value) === 'RegExp') {
      lookup = null;
    } else if (isArray(value)) {
      for (i = 0, length = value.length; i < length; i++) {
        lookup[value[i]] = true;
      }
    } else {
      lookup[value] = true;
    }

    for (i = 0, length = data.length; i < length; i++) {
      /*jshint laxbreak: true */
      var _match = lookup && lookup[data[i]] !== undefined
        || !lookup && value.test(data[i]);
      /*jshint laxbreak: false */
      if (_match) {
        data.splice(i, 1);
        length--;
        i--;
      }
    }

    return data;
  }

  function arrayContains(list, value) {
    var i, length;

    // value may be string, number, array, regexp
    if (isArray(value)) {
      // Note: this can be optimized to O(n) (instead of current O(m * n))
      for (i = 0, length = value.length; i < length; i++) {
        if (!arrayContains(list, value[i])) {
          return false;
        }
      }

      return true;
    }

    var _type = getType(value);
    for (i = 0, length = list.length; i < length; i++) {
      if (_type === 'RegExp') {
        if (typeof list[i] === 'string' && list[i].match(value)) {
          return true;
        }
      } else if (list[i] === value) {
        return true;
      }
    }

    return false;
  }

  function arraysEqual(one, two) {
    if (!isArray(one) || !isArray(two)) {
      return false;
    }

    // arrays can't be equal if they have different amount of content
    if (one.length !== two.length) {
      return false;
    }

    one.sort();
    two.sort();

    for (var i = 0, l = one.length; i < l; i++) {
      if (one[i] !== two[i]) {
        return false;
      }
    }

    return true;
  }

  function trimSlashes(text) {
    var trim_expression = /^\/+|\/+$/g;
    return text.replace(trim_expression, '');
  }

  URI._parts = function() {
    return {
      protocol: null,
      username: null,
      password: null,
      hostname: null,
      urn: null,
      port: null,
      path: null,
      query: null,
      fragment: null,
      // state
      duplicateQueryParameters: URI.duplicateQueryParameters,
      escapeQuerySpace: URI.escapeQuerySpace
    };
  };
  // state: allow duplicate query parameters (a=1&a=1)
  URI.duplicateQueryParameters = false;
  // state: replaces + with %20 (space in query strings)
  URI.escapeQuerySpace = true;
  // static properties
  URI.protocol_expression = /^[a-z][a-z0-9.+-]*$/i;
  URI.idn_expression = /[^a-z0-9\.-]/i;
  URI.punycode_expression = /(xn--)/i;
  // well, 333.444.555.666 matches, but it sure ain't no IPv4 - do we care?
  URI.ip4_expression = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;
  // credits to Rich Brown
  // source: http://forums.intermapper.com/viewtopic.php?p=1096#1096
  // specification: http://www.ietf.org/rfc/rfc4291.txt
  URI.ip6_expression = /^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/;
  // expression used is "gruber revised" (@gruber v2) determined to be the
  // best solution in a regex-golf we did a couple of ages ago at
  // * http://mathiasbynens.be/demo/url-regex
  // * http://rodneyrehm.de/t/url-regex.html
  URI.find_uri_expression = /\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/ig;
  URI.findUri = {
    // valid "scheme://" or "www."
    start: /\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,
    // everything up to the next whitespace
    end: /[\s\r\n]|$/,
    // trim trailing punctuation captured by end RegExp
    trim: /[`!()\[\]{};:'".,<>?«»“”„‘’]+$/
  };
  // http://www.iana.org/assignments/uri-schemes.html
  // http://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers#Well-known_ports
  URI.defaultPorts = {
    http: '80',
    https: '443',
    ftp: '21',
    gopher: '70',
    ws: '80',
    wss: '443'
  };
  // allowed hostname characters according to RFC 3986
  // ALPHA DIGIT "-" "." "_" "~" "!" "$" "&" "'" "(" ")" "*" "+" "," ";" "=" %encoded
  // I've never seen a (non-IDN) hostname other than: ALPHA DIGIT . -
  URI.invalid_hostname_characters = /[^a-zA-Z0-9\.-]/;
  // map DOM Elements to their URI attribute
  URI.domAttributes = {
    'a': 'href',
    'blockquote': 'cite',
    'link': 'href',
    'base': 'href',
    'script': 'src',
    'form': 'action',
    'img': 'src',
    'area': 'href',
    'iframe': 'src',
    'embed': 'src',
    'source': 'src',
    'track': 'src',
    'input': 'src', // but only if type="image"
    'audio': 'src',
    'video': 'src'
  };
  URI.getDomAttribute = function(node) {
    if (!node || !node.nodeName) {
      return undefined;
    }

    var nodeName = node.nodeName.toLowerCase();
    // <input> should only expose src for type="image"
    if (nodeName === 'input' && node.type !== 'image') {
      return undefined;
    }

    return URI.domAttributes[nodeName];
  };

  function escapeForDumbFirefox36(value) {
    // https://github.com/medialize/URI.js/issues/91
    return escape(value);
  }

  // encoding / decoding according to RFC3986
  function strictEncodeURIComponent(string) {
    // see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURIComponent
    return encodeURIComponent(string)
      .replace(/[!'()*]/g, escapeForDumbFirefox36)
      .replace(/\*/g, '%2A');
  }
  URI.encode = strictEncodeURIComponent;
  URI.decode = decodeURIComponent;
  URI.iso8859 = function() {
    URI.encode = escape;
    URI.decode = unescape;
  };
  URI.unicode = function() {
    URI.encode = strictEncodeURIComponent;
    URI.decode = decodeURIComponent;
  };
  URI.characters = {
    pathname: {
      encode: {
        // RFC3986 2.1: For consistency, URI producers and normalizers should
        // use uppercase hexadecimal digits for all percent-encodings.
        expression: /%(24|26|2B|2C|3B|3D|3A|40)/ig,
        map: {
          // -._~!'()*
          '%24': '$',
          '%26': '&',
          '%2B': '+',
          '%2C': ',',
          '%3B': ';',
          '%3D': '=',
          '%3A': ':',
          '%40': '@'
        }
      },
      decode: {
        expression: /[\/\?#]/g,
        map: {
          '/': '%2F',
          '?': '%3F',
          '#': '%23'
        }
      }
    },
    reserved: {
      encode: {
        // RFC3986 2.1: For consistency, URI producers and normalizers should
        // use uppercase hexadecimal digits for all percent-encodings.
        expression: /%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/ig,
        map: {
          // gen-delims
          '%3A': ':',
          '%2F': '/',
          '%3F': '?',
          '%23': '#',
          '%5B': '[',
          '%5D': ']',
          '%40': '@',
          // sub-delims
          '%21': '!',
          '%24': '$',
          '%26': '&',
          '%27': '\'',
          '%28': '(',
          '%29': ')',
          '%2A': '*',
          '%2B': '+',
          '%2C': ',',
          '%3B': ';',
          '%3D': '='
        }
      }
    },
    urnpath: {
      // The characters under `encode` are the characters called out by RFC 2141 as being acceptable
      // for usage in a URN. RFC2141 also calls out "-", ".", and "_" as acceptable characters, but
      // these aren't encoded by encodeURIComponent, so we don't have to call them out here. Also
      // note that the colon character is not featured in the encoding map; this is because URI.js
      // gives the colons in URNs semantic meaning as the delimiters of path segements, and so it
      // should not appear unencoded in a segment itself.
      // See also the note above about RFC3986 and capitalalized hex digits.
      encode: {
        expression: /%(21|24|27|28|29|2A|2B|2C|3B|3D|40)/ig,
        map: {
          '%21': '!',
          '%24': '$',
          '%27': '\'',
          '%28': '(',
          '%29': ')',
          '%2A': '*',
          '%2B': '+',
          '%2C': ',',
          '%3B': ';',
          '%3D': '=',
          '%40': '@'
        }
      },
      // These characters are the characters called out by RFC2141 as "reserved" characters that
      // should never appear in a URN, plus the colon character (see note above).
      decode: {
        expression: /[\/\?#:]/g,
        map: {
          '/': '%2F',
          '?': '%3F',
          '#': '%23',
          ':': '%3A'
        }
      }
    }
  };
  URI.encodeQuery = function(string, escapeQuerySpace) {
    var escaped = URI.encode(string + '');
    if (escapeQuerySpace === undefined) {
      escapeQuerySpace = URI.escapeQuerySpace;
    }

    return escapeQuerySpace ? escaped.replace(/%20/g, '+') : escaped;
  };
  URI.decodeQuery = function(string, escapeQuerySpace) {
    string += '';
    if (escapeQuerySpace === undefined) {
      escapeQuerySpace = URI.escapeQuerySpace;
    }

    try {
      return URI.decode(escapeQuerySpace ? string.replace(/\+/g, '%20') : string);
    } catch(e) {
      // we're not going to mess with weird encodings,
      // give up and return the undecoded original string
      // see https://github.com/medialize/URI.js/issues/87
      // see https://github.com/medialize/URI.js/issues/92
      return string;
    }
  };
  // generate encode/decode path functions
  var _parts = {'encode':'encode', 'decode':'decode'};
  var _part;
  var generateAccessor = function(_group, _part) {
    return function(string) {
      try {
        return URI[_part](string + '').replace(URI.characters[_group][_part].expression, function(c) {
          return URI.characters[_group][_part].map[c];
        });
      } catch (e) {
        // we're not going to mess with weird encodings,
        // give up and return the undecoded original string
        // see https://github.com/medialize/URI.js/issues/87
        // see https://github.com/medialize/URI.js/issues/92
        return string;
      }
    };
  };

  for (_part in _parts) {
    URI[_part + 'PathSegment'] = generateAccessor('pathname', _parts[_part]);
    URI[_part + 'UrnPathSegment'] = generateAccessor('urnpath', _parts[_part]);
  }

  var generateSegmentedPathFunction = function(_sep, _codingFuncName, _innerCodingFuncName) {
    return function(string) {
      // Why pass in names of functions, rather than the function objects themselves? The
      // definitions of some functions (but in particular, URI.decode) will occasionally change due
      // to URI.js having ISO8859 and Unicode modes. Passing in the name and getting it will ensure
      // that the functions we use here are "fresh".
      var actualCodingFunc;
      if (!_innerCodingFuncName) {
        actualCodingFunc = URI[_codingFuncName];
      } else {
        actualCodingFunc = function(string) {
          return URI[_codingFuncName](URI[_innerCodingFuncName](string));
        };
      }

      var segments = (string + '').split(_sep);

      for (var i = 0, length = segments.length; i < length; i++) {
        segments[i] = actualCodingFunc(segments[i]);
      }

      return segments.join(_sep);
    };
  };

  // This takes place outside the above loop because we don't want, e.g., encodeUrnPath functions.
  URI.decodePath = generateSegmentedPathFunction('/', 'decodePathSegment');
  URI.decodeUrnPath = generateSegmentedPathFunction(':', 'decodeUrnPathSegment');
  URI.recodePath = generateSegmentedPathFunction('/', 'encodePathSegment', 'decode');
  URI.recodeUrnPath = generateSegmentedPathFunction(':', 'encodeUrnPathSegment', 'decode');

  URI.encodeReserved = generateAccessor('reserved', 'encode');

  URI.parse = function(string, parts) {
    var pos;
    if (!parts) {
      parts = {};
    }
    // [protocol"://"[username[":"password]"@"]hostname[":"port]"/"?][path]["?"querystring]["#"fragment]

    // extract fragment
    pos = string.indexOf('#');
    if (pos > -1) {
      // escaping?
      parts.fragment = string.substring(pos + 1) || null;
      string = string.substring(0, pos);
    }

    // extract query
    pos = string.indexOf('?');
    if (pos > -1) {
      // escaping?
      parts.query = string.substring(pos + 1) || null;
      string = string.substring(0, pos);
    }

    // extract protocol
    if (string.substring(0, 2) === '//') {
      // relative-scheme
      parts.protocol = null;
      string = string.substring(2);
      // extract "user:pass@host:port"
      string = URI.parseAuthority(string, parts);
    } else {
      pos = string.indexOf(':');
      if (pos > -1) {
        parts.protocol = string.substring(0, pos) || null;
        if (parts.protocol && !parts.protocol.match(URI.protocol_expression)) {
          // : may be within the path
          parts.protocol = undefined;
        } else if (string.substring(pos + 1, pos + 3) === '//') {
          string = string.substring(pos + 3);

          // extract "user:pass@host:port"
          string = URI.parseAuthority(string, parts);
        } else {
          string = string.substring(pos + 1);
          parts.urn = true;
        }
      }
    }

    // what's left must be the path
    parts.path = string;

    // and we're done
    return parts;
  };
  URI.parseHost = function(string, parts) {
    // Copy chrome, IE, opera backslash-handling behavior.
    // Back slashes before the query string get converted to forward slashes
    // See: https://github.com/joyent/node/blob/386fd24f49b0e9d1a8a076592a404168faeecc34/lib/url.js#L115-L124
    // See: https://code.google.com/p/chromium/issues/detail?id=25916
    // https://github.com/medialize/URI.js/pull/233
    string = string.replace(/\\/g, '/');

    // extract host:port
    var pos = string.indexOf('/');
    var bracketPos;
    var t;

    if (pos === -1) {
      pos = string.length;
    }

    if (string.charAt(0) === '[') {
      // IPv6 host - http://tools.ietf.org/html/draft-ietf-6man-text-addr-representation-04#section-6
      // I claim most client software breaks on IPv6 anyways. To simplify things, URI only accepts
      // IPv6+port in the format [2001:db8::1]:80 (for the time being)
      bracketPos = string.indexOf(']');
      parts.hostname = string.substring(1, bracketPos) || null;
      parts.port = string.substring(bracketPos + 2, pos) || null;
      if (parts.port === '/') {
        parts.port = null;
      }
    } else {
      var firstColon = string.indexOf(':');
      var firstSlash = string.indexOf('/');
      var nextColon = string.indexOf(':', firstColon + 1);
      if (nextColon !== -1 && (firstSlash === -1 || nextColon < firstSlash)) {
        // IPv6 host contains multiple colons - but no port
        // this notation is actually not allowed by RFC 3986, but we're a liberal parser
        parts.hostname = string.substring(0, pos) || null;
        parts.port = null;
      } else {
        t = string.substring(0, pos).split(':');
        parts.hostname = t[0] || null;
        parts.port = t[1] || null;
      }
    }

    if (parts.hostname && string.substring(pos).charAt(0) !== '/') {
      pos++;
      string = '/' + string;
    }

    return string.substring(pos) || '/';
  };
  URI.parseAuthority = function(string, parts) {
    string = URI.parseUserinfo(string, parts);
    return URI.parseHost(string, parts);
  };
  URI.parseUserinfo = function(string, parts) {
    // extract username:password
    var firstSlash = string.indexOf('/');
    var pos = string.lastIndexOf('@', firstSlash > -1 ? firstSlash : string.length - 1);
    var t;

    // authority@ must come before /path
    if (pos > -1 && (firstSlash === -1 || pos < firstSlash)) {
      t = string.substring(0, pos).split(':');
      parts.username = t[0] ? URI.decode(t[0]) : null;
      t.shift();
      parts.password = t[0] ? URI.decode(t.join(':')) : null;
      string = string.substring(pos + 1);
    } else {
      parts.username = null;
      parts.password = null;
    }

    return string;
  };
  URI.parseQuery = function(string, escapeQuerySpace) {
    if (!string) {
      return {};
    }

    // throw out the funky business - "?"[name"="value"&"]+
    string = string.replace(/&+/g, '&').replace(/^\?*&*|&+$/g, '');

    if (!string) {
      return {};
    }

    var items = {};
    var splits = string.split('&');
    var length = splits.length;
    var v, name, value;

    for (var i = 0; i < length; i++) {
      v = splits[i].split('=');
      name = URI.decodeQuery(v.shift(), escapeQuerySpace);
      // no "=" is null according to http://dvcs.w3.org/hg/url/raw-file/tip/Overview.html#collect-url-parameters
      value = v.length ? URI.decodeQuery(v.join('='), escapeQuerySpace) : null;

      if (hasOwn.call(items, name)) {
        if (typeof items[name] === 'string' || items[name] === null) {
          items[name] = [items[name]];
        }

        items[name].push(value);
      } else {
        items[name] = value;
      }
    }

    return items;
  };

  URI.build = function(parts) {
    var t = '';

    if (parts.protocol) {
      t += parts.protocol + ':';
    }

    if (!parts.urn && (t || parts.hostname)) {
      t += '//';
    }

    t += (URI.buildAuthority(parts) || '');

    if (typeof parts.path === 'string') {
      if (parts.path.charAt(0) !== '/' && typeof parts.hostname === 'string') {
        t += '/';
      }

      t += parts.path;
    }

    if (typeof parts.query === 'string' && parts.query) {
      t += '?' + parts.query;
    }

    if (typeof parts.fragment === 'string' && parts.fragment) {
      t += '#' + parts.fragment;
    }
    return t;
  };
  URI.buildHost = function(parts) {
    var t = '';

    if (!parts.hostname) {
      return '';
    } else if (URI.ip6_expression.test(parts.hostname)) {
      t += '[' + parts.hostname + ']';
    } else {
      t += parts.hostname;
    }

    if (parts.port) {
      t += ':' + parts.port;
    }

    return t;
  };
  URI.buildAuthority = function(parts) {
    return URI.buildUserinfo(parts) + URI.buildHost(parts);
  };
  URI.buildUserinfo = function(parts) {
    var t = '';

    if (parts.username) {
      t += URI.encode(parts.username);

      if (parts.password) {
        t += ':' + URI.encode(parts.password);
      }

      t += '@';
    }

    return t;
  };
  URI.buildQuery = function(data, duplicateQueryParameters, escapeQuerySpace) {
    // according to http://tools.ietf.org/html/rfc3986 or http://labs.apache.org/webarch/uri/rfc/rfc3986.html
    // being »-._~!$&'()*+,;=:@/?« %HEX and alnum are allowed
    // the RFC explicitly states ?/foo being a valid use case, no mention of parameter syntax!
    // URI.js treats the query string as being application/x-www-form-urlencoded
    // see http://www.w3.org/TR/REC-html40/interact/forms.html#form-content-type

    var t = '';
    var unique, key, i, length;
    for (key in data) {
      if (hasOwn.call(data, key) && key) {
        if (isArray(data[key])) {
          unique = {};
          for (i = 0, length = data[key].length; i < length; i++) {
            if (data[key][i] !== undefined && unique[data[key][i] + ''] === undefined) {
              t += '&' + URI.buildQueryParameter(key, data[key][i], escapeQuerySpace);
              if (duplicateQueryParameters !== true) {
                unique[data[key][i] + ''] = true;
              }
            }
          }
        } else if (data[key] !== undefined) {
          t += '&' + URI.buildQueryParameter(key, data[key], escapeQuerySpace);
        }
      }
    }

    return t.substring(1);
  };
  URI.buildQueryParameter = function(name, value, escapeQuerySpace) {
    // http://www.w3.org/TR/REC-html40/interact/forms.html#form-content-type -- application/x-www-form-urlencoded
    // don't append "=" for null values, according to http://dvcs.w3.org/hg/url/raw-file/tip/Overview.html#url-parameter-serialization
    return URI.encodeQuery(name, escapeQuerySpace) + (value !== null ? '=' + URI.encodeQuery(value, escapeQuerySpace) : '');
  };

  URI.addQuery = function(data, name, value) {
    if (typeof name === 'object') {
      for (var key in name) {
        if (hasOwn.call(name, key)) {
          URI.addQuery(data, key, name[key]);
        }
      }
    } else if (typeof name === 'string') {
      if (data[name] === undefined) {
        data[name] = value;
        return;
      } else if (typeof data[name] === 'string') {
        data[name] = [data[name]];
      }

      if (!isArray(value)) {
        value = [value];
      }

      data[name] = (data[name] || []).concat(value);
    } else {
      throw new TypeError('URI.addQuery() accepts an object, string as the name parameter');
    }
  };
  URI.removeQuery = function(data, name, value) {
    var i, length, key;

    if (isArray(name)) {
      for (i = 0, length = name.length; i < length; i++) {
        data[name[i]] = undefined;
      }
    } else if (getType(name) === 'RegExp') {
      for (key in data) {
        if (name.test(key)) {
          data[key] = undefined;
        }
      }
    } else if (typeof name === 'object') {
      for (key in name) {
        if (hasOwn.call(name, key)) {
          URI.removeQuery(data, key, name[key]);
        }
      }
    } else if (typeof name === 'string') {
      if (value !== undefined) {
        if (getType(value) === 'RegExp') {
          if (!isArray(data[name]) && value.test(data[name])) {
            data[name] = undefined;
          } else {
            data[name] = filterArrayValues(data[name], value);
          }
        } else if (data[name] === String(value) && (!isArray(value) || value.length === 1)) {
          data[name] = undefined;
        } else if (isArray(data[name])) {
          data[name] = filterArrayValues(data[name], value);
        }
      } else {
        data[name] = undefined;
      }
    } else {
      throw new TypeError('URI.removeQuery() accepts an object, string, RegExp as the first parameter');
    }
  };
  URI.hasQuery = function(data, name, value, withinArray) {
    switch (getType(name)) {
      case 'String':
        // Nothing to do here
        break;

      case 'RegExp':
        for (var key in data) {
          if (hasOwn.call(data, key)) {
            if (name.test(key) && (value === undefined || URI.hasQuery(data, key, value))) {
              return true;
            }
          }
        }

        return false;

      case 'Object':
        for (var _key in name) {
          if (hasOwn.call(name, _key)) {
            if (!URI.hasQuery(data, _key, name[_key])) {
              return false;
            }
          }
        }

        return true;

      default:
        throw new TypeError('URI.hasQuery() accepts a string, regular expression or object as the name parameter');
    }

    switch (getType(value)) {
      case 'Undefined':
        // true if exists (but may be empty)
        return name in data; // data[name] !== undefined;

      case 'Boolean':
        // true if exists and non-empty
        var _booly = Boolean(isArray(data[name]) ? data[name].length : data[name]);
        return value === _booly;

      case 'Function':
        // allow complex comparison
        return !!value(data[name], name, data);

      case 'Array':
        if (!isArray(data[name])) {
          return false;
        }

        var op = withinArray ? arrayContains : arraysEqual;
        return op(data[name], value);

      case 'RegExp':
        if (!isArray(data[name])) {
          return Boolean(data[name] && data[name].match(value));
        }

        if (!withinArray) {
          return false;
        }

        return arrayContains(data[name], value);

      case 'Number':
        value = String(value);
        /* falls through */
      case 'String':
        if (!isArray(data[name])) {
          return data[name] === value;
        }

        if (!withinArray) {
          return false;
        }

        return arrayContains(data[name], value);

      default:
        throw new TypeError('URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter');
    }
  };


  URI.commonPath = function(one, two) {
    var length = Math.min(one.length, two.length);
    var pos;

    // find first non-matching character
    for (pos = 0; pos < length; pos++) {
      if (one.charAt(pos) !== two.charAt(pos)) {
        pos--;
        break;
      }
    }

    if (pos < 1) {
      return one.charAt(0) === two.charAt(0) && one.charAt(0) === '/' ? '/' : '';
    }

    // revert to last /
    if (one.charAt(pos) !== '/' || two.charAt(pos) !== '/') {
      pos = one.substring(0, pos).lastIndexOf('/');
    }

    return one.substring(0, pos + 1);
  };

  URI.withinString = function(string, callback, options) {
    options || (options = {});
    var _start = options.start || URI.findUri.start;
    var _end = options.end || URI.findUri.end;
    var _trim = options.trim || URI.findUri.trim;
    var _attributeOpen = /[a-z0-9-]=["']?$/i;

    _start.lastIndex = 0;
    while (true) {
      var match = _start.exec(string);
      if (!match) {
        break;
      }

      var start = match.index;
      if (options.ignoreHtml) {
        // attribut(e=["']?$)
        var attributeOpen = string.slice(Math.max(start - 3, 0), start);
        if (attributeOpen && _attributeOpen.test(attributeOpen)) {
          continue;
        }
      }

      var end = start + string.slice(start).search(_end);
      var slice = string.slice(start, end).replace(_trim, '');
      if (options.ignore && options.ignore.test(slice)) {
        continue;
      }

      end = start + slice.length;
      var result = callback(slice, start, end, string);
      string = string.slice(0, start) + result + string.slice(end);
      _start.lastIndex = start + result.length;
    }

    _start.lastIndex = 0;
    return string;
  };

  URI.ensureValidHostname = function(v) {
    // Theoretically URIs allow percent-encoding in Hostnames (according to RFC 3986)
    // they are not part of DNS and therefore ignored by URI.js

    if (v.match(URI.invalid_hostname_characters)) {
      // test punycode
      if (!punycode) {
        throw new TypeError('Hostname "' + v + '" contains characters other than [A-Z0-9.-] and Punycode.js is not available');
      }

      if (punycode.toASCII(v).match(URI.invalid_hostname_characters)) {
        throw new TypeError('Hostname "' + v + '" contains characters other than [A-Z0-9.-]');
      }
    }
  };

  // noConflict
  URI.noConflict = function(removeAll) {
    if (removeAll) {
      var unconflicted = {
        URI: this.noConflict()
      };

      if (root.URITemplate && typeof root.URITemplate.noConflict === 'function') {
        unconflicted.URITemplate = root.URITemplate.noConflict();
      }

      if (root.IPv6 && typeof root.IPv6.noConflict === 'function') {
        unconflicted.IPv6 = root.IPv6.noConflict();
      }

      if (root.SecondLevelDomains && typeof root.SecondLevelDomains.noConflict === 'function') {
        unconflicted.SecondLevelDomains = root.SecondLevelDomains.noConflict();
      }

      return unconflicted;
    } else if (root.URI === this) {
      root.URI = _URI;
    }

    return this;
  };

  p.build = function(deferBuild) {
    if (deferBuild === true) {
      this._deferred_build = true;
    } else if (deferBuild === undefined || this._deferred_build) {
      this._string = URI.build(this._parts);
      this._deferred_build = false;
    }

    return this;
  };

  p.clone = function() {
    return new URI(this);
  };

  p.valueOf = p.toString = function() {
    return this.build(false)._string;
  };


  function generateSimpleAccessor(_part){
    return function(v, build) {
      if (v === undefined) {
        return this._parts[_part] || '';
      } else {
        this._parts[_part] = v || null;
        this.build(!build);
        return this;
      }
    };
  }

  function generatePrefixAccessor(_part, _key){
    return function(v, build) {
      if (v === undefined) {
        return this._parts[_part] || '';
      } else {
        if (v !== null) {
          v = v + '';
          if (v.charAt(0) === _key) {
            v = v.substring(1);
          }
        }

        this._parts[_part] = v;
        this.build(!build);
        return this;
      }
    };
  }

  p.protocol = generateSimpleAccessor('protocol');
  p.username = generateSimpleAccessor('username');
  p.password = generateSimpleAccessor('password');
  p.hostname = generateSimpleAccessor('hostname');
  p.port = generateSimpleAccessor('port');
  p.query = generatePrefixAccessor('query', '?');
  p.fragment = generatePrefixAccessor('fragment', '#');

  p.search = function(v, build) {
    var t = this.query(v, build);
    return typeof t === 'string' && t.length ? ('?' + t) : t;
  };
  p.hash = function(v, build) {
    var t = this.fragment(v, build);
    return typeof t === 'string' && t.length ? ('#' + t) : t;
  };

  p.pathname = function(v, build) {
    if (v === undefined || v === true) {
      var res = this._parts.path || (this._parts.hostname ? '/' : '');
      return v ? (this._parts.urn ? URI.decodeUrnPath : URI.decodePath)(res) : res;
    } else {
      if (this._parts.urn) {
        this._parts.path = v ? URI.recodeUrnPath(v) : '';
      } else {
        this._parts.path = v ? URI.recodePath(v) : '/';
      }
      this.build(!build);
      return this;
    }
  };
  p.path = p.pathname;
  p.href = function(href, build) {
    var key;

    if (href === undefined) {
      return this.toString();
    }

    this._string = '';
    this._parts = URI._parts();

    var _URI = href instanceof URI;
    var _object = typeof href === 'object' && (href.hostname || href.path || href.pathname);
    if (href.nodeName) {
      var attribute = URI.getDomAttribute(href);
      href = href[attribute] || '';
      _object = false;
    }

    // window.location is reported to be an object, but it's not the sort
    // of object we're looking for:
    // * location.protocol ends with a colon
    // * location.query != object.search
    // * location.hash != object.fragment
    // simply serializing the unknown object should do the trick
    // (for location, not for everything...)
    if (!_URI && _object && href.pathname !== undefined) {
      href = href.toString();
    }

    if (typeof href === 'string' || href instanceof String) {
      this._parts = URI.parse(String(href), this._parts);
    } else if (_URI || _object) {
      var src = _URI ? href._parts : href;
      for (key in src) {
        if (hasOwn.call(this._parts, key)) {
          this._parts[key] = src[key];
        }
      }
    } else {
      throw new TypeError('invalid input');
    }

    this.build(!build);
    return this;
  };

  // identification accessors
  p.is = function(what) {
    var ip = false;
    var ip4 = false;
    var ip6 = false;
    var name = false;
    var sld = false;
    var idn = false;
    var punycode = false;
    var relative = !this._parts.urn;

    if (this._parts.hostname) {
      relative = false;
      ip4 = URI.ip4_expression.test(this._parts.hostname);
      ip6 = URI.ip6_expression.test(this._parts.hostname);
      ip = ip4 || ip6;
      name = !ip;
      sld = name && SLD && SLD.has(this._parts.hostname);
      idn = name && URI.idn_expression.test(this._parts.hostname);
      punycode = name && URI.punycode_expression.test(this._parts.hostname);
    }

    switch (what.toLowerCase()) {
      case 'relative':
        return relative;

      case 'absolute':
        return !relative;

      // hostname identification
      case 'domain':
      case 'name':
        return name;

      case 'sld':
        return sld;

      case 'ip':
        return ip;

      case 'ip4':
      case 'ipv4':
      case 'inet4':
        return ip4;

      case 'ip6':
      case 'ipv6':
      case 'inet6':
        return ip6;

      case 'idn':
        return idn;

      case 'url':
        return !this._parts.urn;

      case 'urn':
        return !!this._parts.urn;

      case 'punycode':
        return punycode;
    }

    return null;
  };

  // component specific input validation
  var _protocol = p.protocol;
  var _port = p.port;
  var _hostname = p.hostname;

  p.protocol = function(v, build) {
    if (v !== undefined) {
      if (v) {
        // accept trailing ://
        v = v.replace(/:(\/\/)?$/, '');

        if (!v.match(URI.protocol_expression)) {
          throw new TypeError('Protocol "' + v + '" contains characters other than [A-Z0-9.+-] or doesn\'t start with [A-Z]');
        }
      }
    }
    return _protocol.call(this, v, build);
  };
  p.scheme = p.protocol;
  p.port = function(v, build) {
    if (this._parts.urn) {
      return v === undefined ? '' : this;
    }

    if (v !== undefined) {
      if (v === 0) {
        v = null;
      }

      if (v) {
        v += '';
        if (v.charAt(0) === ':') {
          v = v.substring(1);
        }

        if (v.match(/[^0-9]/)) {
          throw new TypeError('Port "' + v + '" contains characters other than [0-9]');
        }
      }
    }
    return _port.call(this, v, build);
  };
  p.hostname = function(v, build) {
    if (this._parts.urn) {
      return v === undefined ? '' : this;
    }

    if (v !== undefined) {
      var x = {};
      var res = URI.parseHost(v, x);
      if (res !== '/') {
        throw new TypeError('Hostname "' + v + '" contains characters other than [A-Z0-9.-]');
      }

      v = x.hostname;
    }
    return _hostname.call(this, v, build);
  };

  // compound accessors
  p.origin = function(v, build) {
    if (this._parts.urn) {
      return v === undefined ? '' : this;
    }

    if (v === undefined) {
      var protocol = this.protocol();
      var authority = this.authority();
      if (!authority) {
        return '';
      }

      return (protocol ? protocol + '://' : '') + this.authority();
    } else {
      var origin = URI(v);
      this
        .protocol(origin.protocol())
        .authority(origin.authority())
        .build(!build);
      return this;
    }
  };
  p.host = function(v, build) {
    if (this._parts.urn) {
      return v === undefined ? '' : this;
    }

    if (v === undefined) {
      return this._parts.hostname ? URI.buildHost(this._parts) : '';
    } else {
      var res = URI.parseHost(v, this._parts);
      if (res !== '/') {
        throw new TypeError('Hostname "' + v + '" contains characters other than [A-Z0-9.-]');
      }

      this.build(!build);
      return this;
    }
  };
  p.authority = function(v, build) {
    if (this._parts.urn) {
      return v === undefined ? '' : this;
    }

    if (v === undefined) {
      return this._parts.hostname ? URI.buildAuthority(this._parts) : '';
    } else {
      var res = URI.parseAuthority(v, this._parts);
      if (res !== '/') {
        throw new TypeError('Hostname "' + v + '" contains characters other than [A-Z0-9.-]');
      }

      this.build(!build);
      return this;
    }
  };
  p.userinfo = function(v, build) {
    if (this._parts.urn) {
      return v === undefined ? '' : this;
    }

    if (v === undefined) {
      if (!this._parts.username) {
        return '';
      }

      var t = URI.buildUserinfo(this._parts);
      return t.substring(0, t.length -1);
    } else {
      if (v[v.length-1] !== '@') {
        v += '@';
      }

      URI.parseUserinfo(v, this._parts);
      this.build(!build);
      return this;
    }
  };
  p.resource = function(v, build) {
    var parts;

    if (v === undefined) {
      return this.path() + this.search() + this.hash();
    }

    parts = URI.parse(v);
    this._parts.path = parts.path;
    this._parts.query = parts.query;
    this._parts.fragment = parts.fragment;
    this.build(!build);
    return this;
  };

  // fraction accessors
  p.subdomain = function(v, build) {
    if (this._parts.urn) {
      return v === undefined ? '' : this;
    }

    // convenience, return "www" from "www.example.org"
    if (v === undefined) {
      if (!this._parts.hostname || this.is('IP')) {
        return '';
      }

      // grab domain and add another segment
      var end = this._parts.hostname.length - this.domain().length - 1;
      return this._parts.hostname.substring(0, end) || '';
    } else {
      var e = this._parts.hostname.length - this.domain().length;
      var sub = this._parts.hostname.substring(0, e);
      var replace = new RegExp('^' + escapeRegEx(sub));

      if (v && v.charAt(v.length - 1) !== '.') {
        v += '.';
      }

      if (v) {
        URI.ensureValidHostname(v);
      }

      this._parts.hostname = this._parts.hostname.replace(replace, v);
      this.build(!build);
      return this;
    }
  };
  p.domain = function(v, build) {
    if (this._parts.urn) {
      return v === undefined ? '' : this;
    }

    if (typeof v === 'boolean') {
      build = v;
      v = undefined;
    }

    // convenience, return "example.org" from "www.example.org"
    if (v === undefined) {
      if (!this._parts.hostname || this.is('IP')) {
        return '';
      }

      // if hostname consists of 1 or 2 segments, it must be the domain
      var t = this._parts.hostname.match(/\./g);
      if (t && t.length < 2) {
        return this._parts.hostname;
      }

      // grab tld and add another segment
      var end = this._parts.hostname.length - this.tld(build).length - 1;
      end = this._parts.hostname.lastIndexOf('.', end -1) + 1;
      return this._parts.hostname.substring(end) || '';
    } else {
      if (!v) {
        throw new TypeError('cannot set domain empty');
      }

      URI.ensureValidHostname(v);

      if (!this._parts.hostname || this.is('IP')) {
        this._parts.hostname = v;
      } else {
        var replace = new RegExp(escapeRegEx(this.domain()) + '$');
        this._parts.hostname = this._parts.hostname.replace(replace, v);
      }

      this.build(!build);
      return this;
    }
  };
  p.tld = function(v, build) {
    if (this._parts.urn) {
      return v === undefined ? '' : this;
    }

    if (typeof v === 'boolean') {
      build = v;
      v = undefined;
    }

    // return "org" from "www.example.org"
    if (v === undefined) {
      if (!this._parts.hostname || this.is('IP')) {
        return '';
      }

      var pos = this._parts.hostname.lastIndexOf('.');
      var tld = this._parts.hostname.substring(pos + 1);

      if (build !== true && SLD && SLD.list[tld.toLowerCase()]) {
        return SLD.get(this._parts.hostname) || tld;
      }

      return tld;
    } else {
      var replace;

      if (!v) {
        throw new TypeError('cannot set TLD empty');
      } else if (v.match(/[^a-zA-Z0-9-]/)) {
        if (SLD && SLD.is(v)) {
          replace = new RegExp(escapeRegEx(this.tld()) + '$');
          this._parts.hostname = this._parts.hostname.replace(replace, v);
        } else {
          throw new TypeError('TLD "' + v + '" contains characters other than [A-Z0-9]');
        }
      } else if (!this._parts.hostname || this.is('IP')) {
        throw new ReferenceError('cannot set TLD on non-domain host');
      } else {
        replace = new RegExp(escapeRegEx(this.tld()) + '$');
        this._parts.hostname = this._parts.hostname.replace(replace, v);
      }

      this.build(!build);
      return this;
    }
  };
  p.directory = function(v, build) {
    if (this._parts.urn) {
      return v === undefined ? '' : this;
    }

    if (v === undefined || v === true) {
      if (!this._parts.path && !this._parts.hostname) {
        return '';
      }

      if (this._parts.path === '/') {
        return '/';
      }

      var end = this._parts.path.length - this.filename().length - 1;
      var res = this._parts.path.substring(0, end) || (this._parts.hostname ? '/' : '');

      return v ? URI.decodePath(res) : res;

    } else {
      var e = this._parts.path.length - this.filename().length;
      var directory = this._parts.path.substring(0, e);
      var replace = new RegExp('^' + escapeRegEx(directory));

      // fully qualifier directories begin with a slash
      if (!this.is('relative')) {
        if (!v) {
          v = '/';
        }

        if (v.charAt(0) !== '/') {
          v = '/' + v;
        }
      }

      // directories always end with a slash
      if (v && v.charAt(v.length - 1) !== '/') {
        v += '/';
      }

      v = URI.recodePath(v);
      this._parts.path = this._parts.path.replace(replace, v);
      this.build(!build);
      return this;
    }
  };
  p.filename = function(v, build) {
    if (this._parts.urn) {
      return v === undefined ? '' : this;
    }

    if (v === undefined || v === true) {
      if (!this._parts.path || this._parts.path === '/') {
        return '';
      }

      var pos = this._parts.path.lastIndexOf('/');
      var res = this._parts.path.substring(pos+1);

      return v ? URI.decodePathSegment(res) : res;
    } else {
      var mutatedDirectory = false;

      if (v.charAt(0) === '/') {
        v = v.substring(1);
      }

      if (v.match(/\.?\//)) {
        mutatedDirectory = true;
      }

      var replace = new RegExp(escapeRegEx(this.filename()) + '$');
      v = URI.recodePath(v);
      this._parts.path = this._parts.path.replace(replace, v);

      if (mutatedDirectory) {
        this.normalizePath(build);
      } else {
        this.build(!build);
      }

      return this;
    }
  };
  p.suffix = function(v, build) {
    if (this._parts.urn) {
      return v === undefined ? '' : this;
    }

    if (v === undefined || v === true) {
      if (!this._parts.path || this._parts.path === '/') {
        return '';
      }

      var filename = this.filename();
      var pos = filename.lastIndexOf('.');
      var s, res;

      if (pos === -1) {
        return '';
      }

      // suffix may only contain alnum characters (yup, I made this up.)
      s = filename.substring(pos+1);
      res = (/^[a-z0-9%]+$/i).test(s) ? s : '';
      return v ? URI.decodePathSegment(res) : res;
    } else {
      if (v.charAt(0) === '.') {
        v = v.substring(1);
      }

      var suffix = this.suffix();
      var replace;

      if (!suffix) {
        if (!v) {
          return this;
        }

        this._parts.path += '.' + URI.recodePath(v);
      } else if (!v) {
        replace = new RegExp(escapeRegEx('.' + suffix) + '$');
      } else {
        replace = new RegExp(escapeRegEx(suffix) + '$');
      }

      if (replace) {
        v = URI.recodePath(v);
        this._parts.path = this._parts.path.replace(replace, v);
      }

      this.build(!build);
      return this;
    }
  };
  p.segment = function(segment, v, build) {
    var separator = this._parts.urn ? ':' : '/';
    var path = this.path();
    var absolute = path.substring(0, 1) === '/';
    var segments = path.split(separator);

    if (segment !== undefined && typeof segment !== 'number') {
      build = v;
      v = segment;
      segment = undefined;
    }

    if (segment !== undefined && typeof segment !== 'number') {
      throw new Error('Bad segment "' + segment + '", must be 0-based integer');
    }

    if (absolute) {
      segments.shift();
    }

    if (segment < 0) {
      // allow negative indexes to address from the end
      segment = Math.max(segments.length + segment, 0);
    }

    if (v === undefined) {
      /*jshint laxbreak: true */
      return segment === undefined
        ? segments
        : segments[segment];
      /*jshint laxbreak: false */
    } else if (segment === null || segments[segment] === undefined) {
      if (isArray(v)) {
        segments = [];
        // collapse empty elements within array
        for (var i=0, l=v.length; i < l; i++) {
          if (!v[i].length && (!segments.length || !segments[segments.length -1].length)) {
            continue;
          }

          if (segments.length && !segments[segments.length -1].length) {
            segments.pop();
          }

          segments.push(trimSlashes(v[i]));
        }
      } else if (v || typeof v === 'string') {
        v = trimSlashes(v);
        if (segments[segments.length -1] === '') {
          // empty trailing elements have to be overwritten
          // to prevent results such as /foo//bar
          segments[segments.length -1] = v;
        } else {
          segments.push(v);
        }
      }
    } else {
      if (v) {
        segments[segment] = trimSlashes(v);
      } else {
        segments.splice(segment, 1);
      }
    }

    if (absolute) {
      segments.unshift('');
    }

    return this.path(segments.join(separator), build);
  };
  p.segmentCoded = function(segment, v, build) {
    var segments, i, l;

    if (typeof segment !== 'number') {
      build = v;
      v = segment;
      segment = undefined;
    }

    if (v === undefined) {
      segments = this.segment(segment, v, build);
      if (!isArray(segments)) {
        segments = segments !== undefined ? URI.decode(segments) : undefined;
      } else {
        for (i = 0, l = segments.length; i < l; i++) {
          segments[i] = URI.decode(segments[i]);
        }
      }

      return segments;
    }

    if (!isArray(v)) {
      v = (typeof v === 'string' || v instanceof String) ? URI.encode(v) : v;
    } else {
      for (i = 0, l = v.length; i < l; i++) {
        v[i] = URI.encode(v[i]);
      }
    }

    return this.segment(segment, v, build);
  };

  // mutating query string
  var q = p.query;
  p.query = function(v, build) {
    if (v === true) {
      return URI.parseQuery(this._parts.query, this._parts.escapeQuerySpace);
    } else if (typeof v === 'function') {
      var data = URI.parseQuery(this._parts.query, this._parts.escapeQuerySpace);
      var result = v.call(this, data);
      this._parts.query = URI.buildQuery(result || data, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace);
      this.build(!build);
      return this;
    } else if (v !== undefined && typeof v !== 'string') {
      this._parts.query = URI.buildQuery(v, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace);
      this.build(!build);
      return this;
    } else {
      return q.call(this, v, build);
    }
  };
  p.setQuery = function(name, value, build) {
    var data = URI.parseQuery(this._parts.query, this._parts.escapeQuerySpace);

    if (typeof name === 'string' || name instanceof String) {
      data[name] = value !== undefined ? value : null;
    } else if (typeof name === 'object') {
      for (var key in name) {
        if (hasOwn.call(name, key)) {
          data[key] = name[key];
        }
      }
    } else {
      throw new TypeError('URI.addQuery() accepts an object, string as the name parameter');
    }

    this._parts.query = URI.buildQuery(data, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace);
    if (typeof name !== 'string') {
      build = value;
    }

    this.build(!build);
    return this;
  };
  p.addQuery = function(name, value, build) {
    var data = URI.parseQuery(this._parts.query, this._parts.escapeQuerySpace);
    URI.addQuery(data, name, value === undefined ? null : value);
    this._parts.query = URI.buildQuery(data, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace);
    if (typeof name !== 'string') {
      build = value;
    }

    this.build(!build);
    return this;
  };
  p.removeQuery = function(name, value, build) {
    var data = URI.parseQuery(this._parts.query, this._parts.escapeQuerySpace);
    URI.removeQuery(data, name, value);
    this._parts.query = URI.buildQuery(data, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace);
    if (typeof name !== 'string') {
      build = value;
    }

    this.build(!build);
    return this;
  };
  p.hasQuery = function(name, value, withinArray) {
    var data = URI.parseQuery(this._parts.query, this._parts.escapeQuerySpace);
    return URI.hasQuery(data, name, value, withinArray);
  };
  p.setSearch = p.setQuery;
  p.addSearch = p.addQuery;
  p.removeSearch = p.removeQuery;
  p.hasSearch = p.hasQuery;

  // sanitizing URLs
  p.normalize = function() {
    if (this._parts.urn) {
      return this
        .normalizeProtocol(false)
        .normalizePath(false)
        .normalizeQuery(false)
        .normalizeFragment(false)
        .build();
    }

    return this
      .normalizeProtocol(false)
      .normalizeHostname(false)
      .normalizePort(false)
      .normalizePath(false)
      .normalizeQuery(false)
      .normalizeFragment(false)
      .build();
  };
  p.normalizeProtocol = function(build) {
    if (typeof this._parts.protocol === 'string') {
      this._parts.protocol = this._parts.protocol.toLowerCase();
      this.build(!build);
    }

    return this;
  };
  p.normalizeHostname = function(build) {
    if (this._parts.hostname) {
      if (this.is('IDN') && punycode) {
        this._parts.hostname = punycode.toASCII(this._parts.hostname);
      } else if (this.is('IPv6') && IPv6) {
        this._parts.hostname = IPv6.best(this._parts.hostname);
      }

      this._parts.hostname = this._parts.hostname.toLowerCase();
      this.build(!build);
    }

    return this;
  };
  p.normalizePort = function(build) {
    // remove port of it's the protocol's default
    if (typeof this._parts.protocol === 'string' && this._parts.port === URI.defaultPorts[this._parts.protocol]) {
      this._parts.port = null;
      this.build(!build);
    }

    return this;
  };
  p.normalizePath = function(build) {
    var _path = this._parts.path;
    if (!_path) {
      return this;
    }

    if (this._parts.urn) {
      this._parts.path = URI.recodeUrnPath(this._parts.path);
      this.build(!build);
      return this;
    }

    if (this._parts.path === '/') {
      return this;
    }

    _path = URI.recodePath(_path);

    var _was_relative;
    var _leadingParents = '';
    var _parent, _pos;

    // handle relative paths
    if (_path.charAt(0) !== '/') {
      _was_relative = true;
      _path = '/' + _path;
    }

    // handle relative files (as opposed to directories)
    if (_path.slice(-3) === '/..' || _path.slice(-2) === '/.') {
      _path += '/';
    }

    // resolve simples
    _path = _path
      .replace(/(\/(\.\/)+)|(\/\.$)/g, '/')
      .replace(/\/{2,}/g, '/');

    // remember leading parents
    if (_was_relative) {
      _leadingParents = _path.substring(1).match(/^(\.\.\/)+/) || '';
      if (_leadingParents) {
        _leadingParents = _leadingParents[0];
      }
    }

    // resolve parents
    while (true) {
      _parent = _path.search(/\/\.\.(\/|$)/);
      if (_parent === -1) {
        // no more ../ to resolve
        break;
      } else if (_parent === 0) {
        // top level cannot be relative, skip it
        _path = _path.substring(3);
        continue;
      }

      _pos = _path.substring(0, _parent).lastIndexOf('/');
      if (_pos === -1) {
        _pos = _parent;
      }
      _path = _path.substring(0, _pos) + _path.substring(_parent + 3);
    }

    // revert to relative
    if (_was_relative && this.is('relative')) {
      _path = _leadingParents + _path.substring(1);
    }

    this._parts.path = _path;
    this.build(!build);
    return this;
  };
  p.normalizePathname = p.normalizePath;
  p.normalizeQuery = function(build) {
    if (typeof this._parts.query === 'string') {
      if (!this._parts.query.length) {
        this._parts.query = null;
      } else {
        this.query(URI.parseQuery(this._parts.query, this._parts.escapeQuerySpace));
      }

      this.build(!build);
    }

    return this;
  };
  p.normalizeFragment = function(build) {
    if (!this._parts.fragment) {
      this._parts.fragment = null;
      this.build(!build);
    }

    return this;
  };
  p.normalizeSearch = p.normalizeQuery;
  p.normalizeHash = p.normalizeFragment;

  p.iso8859 = function() {
    // expect unicode input, iso8859 output
    var e = URI.encode;
    var d = URI.decode;

    URI.encode = escape;
    URI.decode = decodeURIComponent;
    try {
      this.normalize();
    } finally {
      URI.encode = e;
      URI.decode = d;
    }
    return this;
  };

  p.unicode = function() {
    // expect iso8859 input, unicode output
    var e = URI.encode;
    var d = URI.decode;

    URI.encode = strictEncodeURIComponent;
    URI.decode = unescape;
    try {
      this.normalize();
    } finally {
      URI.encode = e;
      URI.decode = d;
    }
    return this;
  };

  p.readable = function() {
    var uri = this.clone();
    // removing username, password, because they shouldn't be displayed according to RFC 3986
    uri.username('').password('').normalize();
    var t = '';
    if (uri._parts.protocol) {
      t += uri._parts.protocol + '://';
    }

    if (uri._parts.hostname) {
      if (uri.is('punycode') && punycode) {
        t += punycode.toUnicode(uri._parts.hostname);
        if (uri._parts.port) {
          t += ':' + uri._parts.port;
        }
      } else {
        t += uri.host();
      }
    }

    if (uri._parts.hostname && uri._parts.path && uri._parts.path.charAt(0) !== '/') {
      t += '/';
    }

    t += uri.path(true);
    if (uri._parts.query) {
      var q = '';
      for (var i = 0, qp = uri._parts.query.split('&'), l = qp.length; i < l; i++) {
        var kv = (qp[i] || '').split('=');
        q += '&' + URI.decodeQuery(kv[0], this._parts.escapeQuerySpace)
          .replace(/&/g, '%26');

        if (kv[1] !== undefined) {
          q += '=' + URI.decodeQuery(kv[1], this._parts.escapeQuerySpace)
            .replace(/&/g, '%26');
        }
      }
      t += '?' + q.substring(1);
    }

    t += URI.decodeQuery(uri.hash(), true);
    return t;
  };

  // resolving relative and absolute URLs
  p.absoluteTo = function(base) {
    var resolved = this.clone();
    var properties = ['protocol', 'username', 'password', 'hostname', 'port'];
    var basedir, i, p;

    if (this._parts.urn) {
      throw new Error('URNs do not have any generally defined hierarchical components');
    }

    if (!(base instanceof URI)) {
      base = new URI(base);
    }

    if (!resolved._parts.protocol) {
      resolved._parts.protocol = base._parts.protocol;
    }

    if (this._parts.hostname) {
      return resolved;
    }

    for (i = 0; (p = properties[i]); i++) {
      resolved._parts[p] = base._parts[p];
    }

    if (!resolved._parts.path) {
      resolved._parts.path = base._parts.path;
      if (!resolved._parts.query) {
        resolved._parts.query = base._parts.query;
      }
    } else if (resolved._parts.path.substring(-2) === '..') {
      resolved._parts.path += '/';
    }

    if (resolved.path().charAt(0) !== '/') {
      basedir = base.directory();
      basedir = basedir ? basedir : base.path().indexOf('/') === 0 ? '/' : '';
      resolved._parts.path = (basedir ? (basedir + '/') : '') + resolved._parts.path;
      resolved.normalizePath();
    }

    resolved.build();
    return resolved;
  };
  p.relativeTo = function(base) {
    var relative = this.clone().normalize();
    var relativeParts, baseParts, common, relativePath, basePath;

    if (relative._parts.urn) {
      throw new Error('URNs do not have any generally defined hierarchical components');
    }

    base = new URI(base).normalize();
    relativeParts = relative._parts;
    baseParts = base._parts;
    relativePath = relative.path();
    basePath = base.path();

    if (relativePath.charAt(0) !== '/') {
      throw new Error('URI is already relative');
    }

    if (basePath.charAt(0) !== '/') {
      throw new Error('Cannot calculate a URI relative to another relative URI');
    }

    if (relativeParts.protocol === baseParts.protocol) {
      relativeParts.protocol = null;
    }

    if (relativeParts.username !== baseParts.username || relativeParts.password !== baseParts.password) {
      return relative.build();
    }

    if (relativeParts.protocol !== null || relativeParts.username !== null || relativeParts.password !== null) {
      return relative.build();
    }

    if (relativeParts.hostname === baseParts.hostname && relativeParts.port === baseParts.port) {
      relativeParts.hostname = null;
      relativeParts.port = null;
    } else {
      return relative.build();
    }

    if (relativePath === basePath) {
      relativeParts.path = '';
      return relative.build();
    }

    // determine common sub path
    common = URI.commonPath(relativePath, basePath);

    // If the paths have nothing in common, return a relative URL with the absolute path.
    if (!common) {
      return relative.build();
    }

    var parents = baseParts.path
      .substring(common.length)
      .replace(/[^\/]*$/, '')
      .replace(/.*?\//g, '../');

    relativeParts.path = (parents + relativeParts.path.substring(common.length)) || './';

    return relative.build();
  };

  // comparing URIs
  p.equals = function(uri) {
    var one = this.clone();
    var two = new URI(uri);
    var one_map = {};
    var two_map = {};
    var checked = {};
    var one_query, two_query, key;

    one.normalize();
    two.normalize();

    // exact match
    if (one.toString() === two.toString()) {
      return true;
    }

    // extract query string
    one_query = one.query();
    two_query = two.query();
    one.query('');
    two.query('');

    // definitely not equal if not even non-query parts match
    if (one.toString() !== two.toString()) {
      return false;
    }

    // query parameters have the same length, even if they're permuted
    if (one_query.length !== two_query.length) {
      return false;
    }

    one_map = URI.parseQuery(one_query, this._parts.escapeQuerySpace);
    two_map = URI.parseQuery(two_query, this._parts.escapeQuerySpace);

    for (key in one_map) {
      if (hasOwn.call(one_map, key)) {
        if (!isArray(one_map[key])) {
          if (one_map[key] !== two_map[key]) {
            return false;
          }
        } else if (!arraysEqual(one_map[key], two_map[key])) {
          return false;
        }

        checked[key] = true;
      }
    }

    for (key in two_map) {
      if (hasOwn.call(two_map, key)) {
        if (!checked[key]) {
          // two contains a parameter not present in one
          return false;
        }
      }
    }

    return true;
  };

  // state
  p.duplicateQueryParameters = function(v) {
    this._parts.duplicateQueryParameters = !!v;
    return this;
  };

  p.escapeQuerySpace = function(v) {
    this._parts.escapeQuerySpace = !!v;
    return this;
  };

  return URI;
}));

},{"./IPv6":417,"./SecondLevelDomains":418,"./punycode":420}],420:[function(require,module,exports){
(function (global){
/*! https://mths.be/punycode v1.4.0 by @mathias */
;(function(root) {

	/** Detect free variables */
	var freeExports = typeof exports == 'object' && exports &&
		!exports.nodeType && exports;
	var freeModule = typeof module == 'object' && module &&
		!module.nodeType && module;
	var freeGlobal = typeof global == 'object' && global;
	if (
		freeGlobal.global === freeGlobal ||
		freeGlobal.window === freeGlobal ||
		freeGlobal.self === freeGlobal
	) {
		root = freeGlobal;
	}

	/**
	 * The `punycode` object.
	 * @name punycode
	 * @type Object
	 */
	var punycode,

	/** Highest positive signed 32-bit float value */
	maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1

	/** Bootstring parameters */
	base = 36,
	tMin = 1,
	tMax = 26,
	skew = 38,
	damp = 700,
	initialBias = 72,
	initialN = 128, // 0x80
	delimiter = '-', // '\x2D'

	/** Regular expressions */
	regexPunycode = /^xn--/,
	regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars
	regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators

	/** Error messages */
	errors = {
		'overflow': 'Overflow: input needs wider integers to process',
		'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
		'invalid-input': 'Invalid input'
	},

	/** Convenience shortcuts */
	baseMinusTMin = base - tMin,
	floor = Math.floor,
	stringFromCharCode = String.fromCharCode,

	/** Temporary variable */
	key;

	/*--------------------------------------------------------------------------*/

	/**
	 * A generic error utility function.
	 * @private
	 * @param {String} type The error type.
	 * @returns {Error} Throws a `RangeError` with the applicable error message.
	 */
	function error(type) {
		throw new RangeError(errors[type]);
	}

	/**
	 * A generic `Array#map` utility function.
	 * @private
	 * @param {Array} array The array to iterate over.
	 * @param {Function} callback The function that gets called for every array
	 * item.
	 * @returns {Array} A new array of values returned by the callback function.
	 */
	function map(array, fn) {
		var length = array.length;
		var result = [];
		while (length--) {
			result[length] = fn(array[length]);
		}
		return result;
	}

	/**
	 * A simple `Array#map`-like wrapper to work with domain name strings or email
	 * addresses.
	 * @private
	 * @param {String} domain The domain name or email address.
	 * @param {Function} callback The function that gets called for every
	 * character.
	 * @returns {Array} A new string of characters returned by the callback
	 * function.
	 */
	function mapDomain(string, fn) {
		var parts = string.split('@');
		var result = '';
		if (parts.length > 1) {
			// In email addresses, only the domain name should be punycoded. Leave
			// the local part (i.e. everything up to `@`) intact.
			result = parts[0] + '@';
			string = parts[1];
		}
		// Avoid `split(regex)` for IE8 compatibility. See #17.
		string = string.replace(regexSeparators, '\x2E');
		var labels = string.split('.');
		var encoded = map(labels, fn).join('.');
		return result + encoded;
	}

	/**
	 * Creates an array containing the numeric code points of each Unicode
	 * character in the string. While JavaScript uses UCS-2 internally,
	 * this function will convert a pair of surrogate halves (each of which
	 * UCS-2 exposes as separate characters) into a single code point,
	 * matching UTF-16.
	 * @see `punycode.ucs2.encode`
	 * @see <https://mathiasbynens.be/notes/javascript-encoding>
	 * @memberOf punycode.ucs2
	 * @name decode
	 * @param {String} string The Unicode input string (UCS-2).
	 * @returns {Array} The new array of code points.
	 */
	function ucs2decode(string) {
		var output = [],
		    counter = 0,
		    length = string.length,
		    value,
		    extra;
		while (counter < length) {
			value = string.charCodeAt(counter++);
			if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
				// high surrogate, and there is a next character
				extra = string.charCodeAt(counter++);
				if ((extra & 0xFC00) == 0xDC00) { // low surrogate
					output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
				} else {
					// unmatched surrogate; only append this code unit, in case the next
					// code unit is the high surrogate of a surrogate pair
					output.push(value);
					counter--;
				}
			} else {
				output.push(value);
			}
		}
		return output;
	}

	/**
	 * Creates a string based on an array of numeric code points.
	 * @see `punycode.ucs2.decode`
	 * @memberOf punycode.ucs2
	 * @name encode
	 * @param {Array} codePoints The array of numeric code points.
	 * @returns {String} The new Unicode string (UCS-2).
	 */
	function ucs2encode(array) {
		return map(array, function(value) {
			var output = '';
			if (value > 0xFFFF) {
				value -= 0x10000;
				output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
				value = 0xDC00 | value & 0x3FF;
			}
			output += stringFromCharCode(value);
			return output;
		}).join('');
	}

	/**
	 * Converts a basic code point into a digit/integer.
	 * @see `digitToBasic()`
	 * @private
	 * @param {Number} codePoint The basic numeric code point value.
	 * @returns {Number} The numeric value of a basic code point (for use in
	 * representing integers) in the range `0` to `base - 1`, or `base` if
	 * the code point does not represent a value.
	 */
	function basicToDigit(codePoint) {
		if (codePoint - 48 < 10) {
			return codePoint - 22;
		}
		if (codePoint - 65 < 26) {
			return codePoint - 65;
		}
		if (codePoint - 97 < 26) {
			return codePoint - 97;
		}
		return base;
	}

	/**
	 * Converts a digit/integer into a basic code point.
	 * @see `basicToDigit()`
	 * @private
	 * @param {Number} digit The numeric value of a basic code point.
	 * @returns {Number} The basic code point whose value (when used for
	 * representing integers) is `digit`, which needs to be in the range
	 * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
	 * used; else, the lowercase form is used. The behavior is undefined
	 * if `flag` is non-zero and `digit` has no uppercase form.
	 */
	function digitToBasic(digit, flag) {
		//  0..25 map to ASCII a..z or A..Z
		// 26..35 map to ASCII 0..9
		return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
	}

	/**
	 * Bias adaptation function as per section 3.4 of RFC 3492.
	 * https://tools.ietf.org/html/rfc3492#section-3.4
	 * @private
	 */
	function adapt(delta, numPoints, firstTime) {
		var k = 0;
		delta = firstTime ? floor(delta / damp) : delta >> 1;
		delta += floor(delta / numPoints);
		for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
			delta = floor(delta / baseMinusTMin);
		}
		return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
	}

	/**
	 * Converts a Punycode string of ASCII-only symbols to a string of Unicode
	 * symbols.
	 * @memberOf punycode
	 * @param {String} input The Punycode string of ASCII-only symbols.
	 * @returns {String} The resulting string of Unicode symbols.
	 */
	function decode(input) {
		// Don't use UCS-2
		var output = [],
		    inputLength = input.length,
		    out,
		    i = 0,
		    n = initialN,
		    bias = initialBias,
		    basic,
		    j,
		    index,
		    oldi,
		    w,
		    k,
		    digit,
		    t,
		    /** Cached calculation results */
		    baseMinusT;

		// Handle the basic code points: let `basic` be the number of input code
		// points before the last delimiter, or `0` if there is none, then copy
		// the first basic code points to the output.

		basic = input.lastIndexOf(delimiter);
		if (basic < 0) {
			basic = 0;
		}

		for (j = 0; j < basic; ++j) {
			// if it's not a basic code point
			if (input.charCodeAt(j) >= 0x80) {
				error('not-basic');
			}
			output.push(input.charCodeAt(j));
		}

		// Main decoding loop: start just after the last delimiter if any basic code
		// points were copied; start at the beginning otherwise.

		for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {

			// `index` is the index of the next character to be consumed.
			// Decode a generalized variable-length integer into `delta`,
			// which gets added to `i`. The overflow checking is easier
			// if we increase `i` as we go, then subtract off its starting
			// value at the end to obtain `delta`.
			for (oldi = i, w = 1, k = base; /* no condition */; k += base) {

				if (index >= inputLength) {
					error('invalid-input');
				}

				digit = basicToDigit(input.charCodeAt(index++));

				if (digit >= base || digit > floor((maxInt - i) / w)) {
					error('overflow');
				}

				i += digit * w;
				t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);

				if (digit < t) {
					break;
				}

				baseMinusT = base - t;
				if (w > floor(maxInt / baseMinusT)) {
					error('overflow');
				}

				w *= baseMinusT;

			}

			out = output.length + 1;
			bias = adapt(i - oldi, out, oldi == 0);

			// `i` was supposed to wrap around from `out` to `0`,
			// incrementing `n` each time, so we'll fix that now:
			if (floor(i / out) > maxInt - n) {
				error('overflow');
			}

			n += floor(i / out);
			i %= out;

			// Insert `n` at position `i` of the output
			output.splice(i++, 0, n);

		}

		return ucs2encode(output);
	}

	/**
	 * Converts a string of Unicode symbols (e.g. a domain name label) to a
	 * Punycode string of ASCII-only symbols.
	 * @memberOf punycode
	 * @param {String} input The string of Unicode symbols.
	 * @returns {String} The resulting Punycode string of ASCII-only symbols.
	 */
	function encode(input) {
		var n,
		    delta,
		    handledCPCount,
		    basicLength,
		    bias,
		    j,
		    m,
		    q,
		    k,
		    t,
		    currentValue,
		    output = [],
		    /** `inputLength` will hold the number of code points in `input`. */
		    inputLength,
		    /** Cached calculation results */
		    handledCPCountPlusOne,
		    baseMinusT,
		    qMinusT;

		// Convert the input in UCS-2 to Unicode
		input = ucs2decode(input);

		// Cache the length
		inputLength = input.length;

		// Initialize the state
		n = initialN;
		delta = 0;
		bias = initialBias;

		// Handle the basic code points
		for (j = 0; j < inputLength; ++j) {
			currentValue = input[j];
			if (currentValue < 0x80) {
				output.push(stringFromCharCode(currentValue));
			}
		}

		handledCPCount = basicLength = output.length;

		// `handledCPCount` is the number of code points that have been handled;
		// `basicLength` is the number of basic code points.

		// Finish the basic string - if it is not empty - with a delimiter
		if (basicLength) {
			output.push(delimiter);
		}

		// Main encoding loop:
		while (handledCPCount < inputLength) {

			// All non-basic code points < n have been handled already. Find the next
			// larger one:
			for (m = maxInt, j = 0; j < inputLength; ++j) {
				currentValue = input[j];
				if (currentValue >= n && currentValue < m) {
					m = currentValue;
				}
			}

			// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
			// but guard against overflow
			handledCPCountPlusOne = handledCPCount + 1;
			if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
				error('overflow');
			}

			delta += (m - n) * handledCPCountPlusOne;
			n = m;

			for (j = 0; j < inputLength; ++j) {
				currentValue = input[j];

				if (currentValue < n && ++delta > maxInt) {
					error('overflow');
				}

				if (currentValue == n) {
					// Represent delta as a generalized variable-length integer
					for (q = delta, k = base; /* no condition */; k += base) {
						t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
						if (q < t) {
							break;
						}
						qMinusT = q - t;
						baseMinusT = base - t;
						output.push(
							stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
						);
						q = floor(qMinusT / baseMinusT);
					}

					output.push(stringFromCharCode(digitToBasic(q, 0)));
					bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
					delta = 0;
					++handledCPCount;
				}
			}

			++delta;
			++n;

		}
		return output.join('');
	}

	/**
	 * Converts a Punycode string representing a domain name or an email address
	 * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
	 * it doesn't matter if you call it on a string that has already been
	 * converted to Unicode.
	 * @memberOf punycode
	 * @param {String} input The Punycoded domain name or email address to
	 * convert to Unicode.
	 * @returns {String} The Unicode representation of the given Punycode
	 * string.
	 */
	function toUnicode(input) {
		return mapDomain(input, function(string) {
			return regexPunycode.test(string)
				? decode(string.slice(4).toLowerCase())
				: string;
		});
	}

	/**
	 * Converts a Unicode string representing a domain name or an email address to
	 * Punycode. Only the non-ASCII parts of the domain name will be converted,
	 * i.e. it doesn't matter if you call it with a domain that's already in
	 * ASCII.
	 * @memberOf punycode
	 * @param {String} input The domain name or email address to convert, as a
	 * Unicode string.
	 * @returns {String} The Punycode representation of the given domain name or
	 * email address.
	 */
	function toASCII(input) {
		return mapDomain(input, function(string) {
			return regexNonASCII.test(string)
				? 'xn--' + encode(string)
				: string;
		});
	}

	/*--------------------------------------------------------------------------*/

	/** Define the public API */
	punycode = {
		/**
		 * A string representing the current Punycode.js version number.
		 * @memberOf punycode
		 * @type String
		 */
		'version': '1.3.2',
		/**
		 * An object of methods to convert from JavaScript's internal character
		 * representation (UCS-2) to Unicode code points, and back.
		 * @see <https://mathiasbynens.be/notes/javascript-encoding>
		 * @memberOf punycode
		 * @type Object
		 */
		'ucs2': {
			'decode': ucs2decode,
			'encode': ucs2encode
		},
		'decode': decode,
		'encode': encode,
		'toASCII': toASCII,
		'toUnicode': toUnicode
	};

	/** Expose `punycode` */
	// Some AMD build optimizers, like r.js, check for specific condition patterns
	// like the following:
	if (
		typeof define == 'function' &&
		typeof define.amd == 'object' &&
		define.amd
	) {
		define('punycode', function() {
			return punycode;
		});
	} else if (freeExports && freeModule) {
		if (module.exports == freeExports) {
			// in Node.js, io.js, or RingoJS v0.8.0+
			freeModule.exports = punycode;
		} else {
			// in Narwhal or RingoJS v0.7.0-
			for (key in punycode) {
				punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
			}
		}
	} else {
		// in Rhino or a web browser
		root.punycode = punycode;
	}

}(this));

}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{}]},{},[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,65,64,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92]);
