// @svizzle/time_region_value v0.5.0 - © 2021 nestauk (https://www.nesta.org.uk/)
'use strict';

var format = require('./format-a62f401a.js');
var config = require('./config-4746d33b.js');
var indicator = require('./indicator-34e8d898.js');

function max(values, valueof) {
  let max;
  if (valueof === undefined) {
    for (const value of values) {
      if (value != null
          && (max < value || (max === undefined && value >= value))) {
        max = value;
      }
    }
  } else {
    let index = -1;
    for (let value of values) {
      if ((value = valueof(value, ++index, values)) != null
          && (max < value || (max === undefined && value >= value))) {
        max = value;
      }
    }
  }
  return max;
}

function tree_add(d) {
  const x = +this._x.call(null, d),
      y = +this._y.call(null, d);
  return add(this.cover(x, y), x, y, d);
}
function add(tree, x, y, d) {
  if (isNaN(x) || isNaN(y)) return tree;
  var parent,
      node = tree._root,
      leaf = {data: d},
      x0 = tree._x0,
      y0 = tree._y0,
      x1 = tree._x1,
      y1 = tree._y1,
      xm,
      ym,
      xp,
      yp,
      right,
      bottom,
      i,
      j;
  if (!node) return tree._root = leaf, tree;
  while (node.length) {
    if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm;
    if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym;
    if (parent = node, !(node = node[i = bottom << 1 | right])) return parent[i] = leaf, tree;
  }
  xp = +tree._x.call(null, node.data);
  yp = +tree._y.call(null, node.data);
  if (x === xp && y === yp) return leaf.next = node, parent ? parent[i] = leaf : tree._root = leaf, tree;
  do {
    parent = parent ? parent[i] = new Array(4) : tree._root = new Array(4);
    if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm;
    if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym;
  } while ((i = bottom << 1 | right) === (j = (yp >= ym) << 1 | (xp >= xm)));
  return parent[j] = node, parent[i] = leaf, tree;
}
function addAll(data) {
  var d, i, n = data.length,
      x,
      y,
      xz = new Array(n),
      yz = new Array(n),
      x0 = Infinity,
      y0 = Infinity,
      x1 = -Infinity,
      y1 = -Infinity;
  for (i = 0; i < n; ++i) {
    if (isNaN(x = +this._x.call(null, d = data[i])) || isNaN(y = +this._y.call(null, d))) continue;
    xz[i] = x;
    yz[i] = y;
    if (x < x0) x0 = x;
    if (x > x1) x1 = x;
    if (y < y0) y0 = y;
    if (y > y1) y1 = y;
  }
  if (x0 > x1 || y0 > y1) return this;
  this.cover(x0, y0).cover(x1, y1);
  for (i = 0; i < n; ++i) {
    add(this, xz[i], yz[i], data[i]);
  }
  return this;
}

function tree_cover(x, y) {
  if (isNaN(x = +x) || isNaN(y = +y)) return this;
  var x0 = this._x0,
      y0 = this._y0,
      x1 = this._x1,
      y1 = this._y1;
  if (isNaN(x0)) {
    x1 = (x0 = Math.floor(x)) + 1;
    y1 = (y0 = Math.floor(y)) + 1;
  }
  else {
    var z = x1 - x0 || 1,
        node = this._root,
        parent,
        i;
    while (x0 > x || x >= x1 || y0 > y || y >= y1) {
      i = (y < y0) << 1 | (x < x0);
      parent = new Array(4), parent[i] = node, node = parent, z *= 2;
      switch (i) {
        case 0: x1 = x0 + z, y1 = y0 + z; break;
        case 1: x0 = x1 - z, y1 = y0 + z; break;
        case 2: x1 = x0 + z, y0 = y1 - z; break;
        case 3: x0 = x1 - z, y0 = y1 - z; break;
      }
    }
    if (this._root && this._root.length) this._root = node;
  }
  this._x0 = x0;
  this._y0 = y0;
  this._x1 = x1;
  this._y1 = y1;
  return this;
}

function tree_data() {
  var data = [];
  this.visit(function(node) {
    if (!node.length) do data.push(node.data); while (node = node.next)
  });
  return data;
}

function tree_extent(_) {
  return arguments.length
      ? this.cover(+_[0][0], +_[0][1]).cover(+_[1][0], +_[1][1])
      : isNaN(this._x0) ? undefined : [[this._x0, this._y0], [this._x1, this._y1]];
}

function Quad(node, x0, y0, x1, y1) {
  this.node = node;
  this.x0 = x0;
  this.y0 = y0;
  this.x1 = x1;
  this.y1 = y1;
}

function tree_find(x, y, radius) {
  var data,
      x0 = this._x0,
      y0 = this._y0,
      x1,
      y1,
      x2,
      y2,
      x3 = this._x1,
      y3 = this._y1,
      quads = [],
      node = this._root,
      q,
      i;
  if (node) quads.push(new Quad(node, x0, y0, x3, y3));
  if (radius == null) radius = Infinity;
  else {
    x0 = x - radius, y0 = y - radius;
    x3 = x + radius, y3 = y + radius;
    radius *= radius;
  }
  while (q = quads.pop()) {
    if (!(node = q.node)
        || (x1 = q.x0) > x3
        || (y1 = q.y0) > y3
        || (x2 = q.x1) < x0
        || (y2 = q.y1) < y0) continue;
    if (node.length) {
      var xm = (x1 + x2) / 2,
          ym = (y1 + y2) / 2;
      quads.push(
        new Quad(node[3], xm, ym, x2, y2),
        new Quad(node[2], x1, ym, xm, y2),
        new Quad(node[1], xm, y1, x2, ym),
        new Quad(node[0], x1, y1, xm, ym)
      );
      if (i = (y >= ym) << 1 | (x >= xm)) {
        q = quads[quads.length - 1];
        quads[quads.length - 1] = quads[quads.length - 1 - i];
        quads[quads.length - 1 - i] = q;
      }
    }
    else {
      var dx = x - +this._x.call(null, node.data),
          dy = y - +this._y.call(null, node.data),
          d2 = dx * dx + dy * dy;
      if (d2 < radius) {
        var d = Math.sqrt(radius = d2);
        x0 = x - d, y0 = y - d;
        x3 = x + d, y3 = y + d;
        data = node.data;
      }
    }
  }
  return data;
}

function tree_remove(d) {
  if (isNaN(x = +this._x.call(null, d)) || isNaN(y = +this._y.call(null, d))) return this;
  var parent,
      node = this._root,
      retainer,
      previous,
      next,
      x0 = this._x0,
      y0 = this._y0,
      x1 = this._x1,
      y1 = this._y1,
      x,
      y,
      xm,
      ym,
      right,
      bottom,
      i,
      j;
  if (!node) return this;
  if (node.length) while (true) {
    if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm;
    if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym;
    if (!(parent = node, node = node[i = bottom << 1 | right])) return this;
    if (!node.length) break;
    if (parent[(i + 1) & 3] || parent[(i + 2) & 3] || parent[(i + 3) & 3]) retainer = parent, j = i;
  }
  while (node.data !== d) if (!(previous = node, node = node.next)) return this;
  if (next = node.next) delete node.next;
  if (previous) return (next ? previous.next = next : delete previous.next), this;
  if (!parent) return this._root = next, this;
  next ? parent[i] = next : delete parent[i];
  if ((node = parent[0] || parent[1] || parent[2] || parent[3])
      && node === (parent[3] || parent[2] || parent[1] || parent[0])
      && !node.length) {
    if (retainer) retainer[j] = node;
    else this._root = node;
  }
  return this;
}
function removeAll(data) {
  for (var i = 0, n = data.length; i < n; ++i) this.remove(data[i]);
  return this;
}

function tree_root() {
  return this._root;
}

function tree_size() {
  var size = 0;
  this.visit(function(node) {
    if (!node.length) do ++size; while (node = node.next)
  });
  return size;
}

function tree_visit(callback) {
  var quads = [], q, node = this._root, child, x0, y0, x1, y1;
  if (node) quads.push(new Quad(node, this._x0, this._y0, this._x1, this._y1));
  while (q = quads.pop()) {
    if (!callback(node = q.node, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1) && node.length) {
      var xm = (x0 + x1) / 2, ym = (y0 + y1) / 2;
      if (child = node[3]) quads.push(new Quad(child, xm, ym, x1, y1));
      if (child = node[2]) quads.push(new Quad(child, x0, ym, xm, y1));
      if (child = node[1]) quads.push(new Quad(child, xm, y0, x1, ym));
      if (child = node[0]) quads.push(new Quad(child, x0, y0, xm, ym));
    }
  }
  return this;
}

function tree_visitAfter(callback) {
  var quads = [], next = [], q;
  if (this._root) quads.push(new Quad(this._root, this._x0, this._y0, this._x1, this._y1));
  while (q = quads.pop()) {
    var node = q.node;
    if (node.length) {
      var child, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1, xm = (x0 + x1) / 2, ym = (y0 + y1) / 2;
      if (child = node[0]) quads.push(new Quad(child, x0, y0, xm, ym));
      if (child = node[1]) quads.push(new Quad(child, xm, y0, x1, ym));
      if (child = node[2]) quads.push(new Quad(child, x0, ym, xm, y1));
      if (child = node[3]) quads.push(new Quad(child, xm, ym, x1, y1));
    }
    next.push(q);
  }
  while (q = next.pop()) {
    callback(q.node, q.x0, q.y0, q.x1, q.y1);
  }
  return this;
}

function defaultX(d) {
  return d[0];
}
function tree_x(_) {
  return arguments.length ? (this._x = _, this) : this._x;
}

function defaultY(d) {
  return d[1];
}
function tree_y(_) {
  return arguments.length ? (this._y = _, this) : this._y;
}

function quadtree(nodes, x, y) {
  var tree = new Quadtree(x == null ? defaultX : x, y == null ? defaultY : y, NaN, NaN, NaN, NaN);
  return nodes == null ? tree : tree.addAll(nodes);
}
function Quadtree(x, y, x0, y0, x1, y1) {
  this._x = x;
  this._y = y;
  this._x0 = x0;
  this._y0 = y0;
  this._x1 = x1;
  this._y1 = y1;
  this._root = undefined;
}
function leaf_copy(leaf) {
  var copy = {data: leaf.data}, next = copy;
  while (leaf = leaf.next) next = next.next = {data: leaf.data};
  return copy;
}
var treeProto = quadtree.prototype = Quadtree.prototype;
treeProto.copy = function() {
  var copy = new Quadtree(this._x, this._y, this._x0, this._y0, this._x1, this._y1),
      node = this._root,
      nodes,
      child;
  if (!node) return copy;
  if (!node.length) return copy._root = leaf_copy(node), copy;
  nodes = [{source: node, target: copy._root = new Array(4)}];
  while (node = nodes.pop()) {
    for (var i = 0; i < 4; ++i) {
      if (child = node.source[i]) {
        if (child.length) nodes.push({source: child, target: node.target[i] = new Array(4)});
        else node.target[i] = leaf_copy(child);
      }
    }
  }
  return copy;
};
treeProto.add = tree_add;
treeProto.addAll = addAll;
treeProto.cover = tree_cover;
treeProto.data = tree_data;
treeProto.extent = tree_extent;
treeProto.find = tree_find;
treeProto.remove = tree_remove;
treeProto.removeAll = removeAll;
treeProto.root = tree_root;
treeProto.size = tree_size;
treeProto.visit = tree_visit;
treeProto.visitAfter = tree_visitAfter;
treeProto.x = tree_x;
treeProto.y = tree_y;

const pi = Math.PI,
    tau = 2 * pi,
    epsilon = 1e-6,
    tauEpsilon = tau - epsilon;
function Path() {
  this._x0 = this._y0 =
  this._x1 = this._y1 = null;
  this._ = "";
}
function path() {
  return new Path;
}
Path.prototype = path.prototype = {
  constructor: Path,
  moveTo: function(x, y) {
    this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y);
  },
  closePath: function() {
    if (this._x1 !== null) {
      this._x1 = this._x0, this._y1 = this._y0;
      this._ += "Z";
    }
  },
  lineTo: function(x, y) {
    this._ += "L" + (this._x1 = +x) + "," + (this._y1 = +y);
  },
  quadraticCurveTo: function(x1, y1, x, y) {
    this._ += "Q" + (+x1) + "," + (+y1) + "," + (this._x1 = +x) + "," + (this._y1 = +y);
  },
  bezierCurveTo: function(x1, y1, x2, y2, x, y) {
    this._ += "C" + (+x1) + "," + (+y1) + "," + (+x2) + "," + (+y2) + "," + (this._x1 = +x) + "," + (this._y1 = +y);
  },
  arcTo: function(x1, y1, x2, y2, r) {
    x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;
    var x0 = this._x1,
        y0 = this._y1,
        x21 = x2 - x1,
        y21 = y2 - y1,
        x01 = x0 - x1,
        y01 = y0 - y1,
        l01_2 = x01 * x01 + y01 * y01;
    if (r < 0) throw new Error("negative radius: " + r);
    if (this._x1 === null) {
      this._ += "M" + (this._x1 = x1) + "," + (this._y1 = y1);
    }
    else if (!(l01_2 > epsilon));
    else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) {
      this._ += "L" + (this._x1 = x1) + "," + (this._y1 = y1);
    }
    else {
      var x20 = x2 - x0,
          y20 = y2 - y0,
          l21_2 = x21 * x21 + y21 * y21,
          l20_2 = x20 * x20 + y20 * y20,
          l21 = Math.sqrt(l21_2),
          l01 = Math.sqrt(l01_2),
          l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2),
          t01 = l / l01,
          t21 = l / l21;
      if (Math.abs(t01 - 1) > epsilon) {
        this._ += "L" + (x1 + t01 * x01) + "," + (y1 + t01 * y01);
      }
      this._ += "A" + r + "," + r + ",0,0," + (+(y01 * x20 > x01 * y20)) + "," + (this._x1 = x1 + t21 * x21) + "," + (this._y1 = y1 + t21 * y21);
    }
  },
  arc: function(x, y, r, a0, a1, ccw) {
    x = +x, y = +y, r = +r, ccw = !!ccw;
    var dx = r * Math.cos(a0),
        dy = r * Math.sin(a0),
        x0 = x + dx,
        y0 = y + dy,
        cw = 1 ^ ccw,
        da = ccw ? a0 - a1 : a1 - a0;
    if (r < 0) throw new Error("negative radius: " + r);
    if (this._x1 === null) {
      this._ += "M" + x0 + "," + y0;
    }
    else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) {
      this._ += "L" + x0 + "," + y0;
    }
    if (!r) return;
    if (da < 0) da = da % tau + tau;
    if (da > tauEpsilon) {
      this._ += "A" + r + "," + r + ",0,1," + cw + "," + (x - dx) + "," + (y - dy) + "A" + r + "," + r + ",0,1," + cw + "," + (this._x1 = x0) + "," + (this._y1 = y0);
    }
    else if (da > epsilon) {
      this._ += "A" + r + "," + r + ",0," + (+(da >= pi)) + "," + cw + "," + (this._x1 = x + r * Math.cos(a1)) + "," + (this._y1 = y + r * Math.sin(a1));
    }
  },
  rect: function(x, y, w, h) {
    this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y) + "h" + (+w) + "v" + (+h) + "h" + (-w) + "Z";
  },
  toString: function() {
    return this._;
  }
};

function constant(x) {
  return function constant() {
    return x;
  };
}

function array(x) {
  return typeof x === "object" && "length" in x
    ? x
    : Array.from(x);
}

function Linear(context) {
  this._context = context;
}
Linear.prototype = {
  areaStart: function() {
    this._line = 0;
  },
  areaEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._point = 0;
  },
  lineEnd: function() {
    if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
    this._line = 1 - this._line;
  },
  point: function(x, y) {
    x = +x, y = +y;
    switch (this._point) {
      case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
      case 1: this._point = 2;
      default: this._context.lineTo(x, y); break;
    }
  }
};
function curveLinear(context) {
  return new Linear(context);
}

function x(p) {
  return p[0];
}
function y(p) {
  return p[1];
}

function line(x$1, y$1) {
  var defined = constant(true),
      context = null,
      curve = curveLinear,
      output = null;
  x$1 = typeof x$1 === "function" ? x$1 : (x$1 === undefined) ? x : constant(x$1);
  y$1 = typeof y$1 === "function" ? y$1 : (y$1 === undefined) ? y : constant(y$1);
  function line(data) {
    var i,
        n = (data = array(data)).length,
        d,
        defined0 = false,
        buffer;
    if (context == null) output = curve(buffer = path());
    for (i = 0; i <= n; ++i) {
      if (!(i < n && defined(d = data[i], i, data)) === defined0) {
        if (defined0 = !defined0) output.lineStart();
        else output.lineEnd();
      }
      if (defined0) output.point(+x$1(d, i, data), +y$1(d, i, data));
    }
    if (buffer) return output = null, buffer + "" || null;
  }
  line.x = function(_) {
    return arguments.length ? (x$1 = typeof _ === "function" ? _ : constant(+_), line) : x$1;
  };
  line.y = function(_) {
    return arguments.length ? (y$1 = typeof _ === "function" ? _ : constant(+_), line) : y$1;
  };
  line.defined = function(_) {
    return arguments.length ? (defined = typeof _ === "function" ? _ : constant(!!_), line) : defined;
  };
  line.curve = function(_) {
    return arguments.length ? (curve = _, context != null && (output = curve(context)), line) : curve;
  };
  line.context = function(_) {
    return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context;
  };
  return line;
}

function sign(x) {
  return x < 0 ? -1 : 1;
}
function slope3(that, x2, y2) {
  var h0 = that._x1 - that._x0,
      h1 = x2 - that._x1,
      s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0),
      s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0),
      p = (s0 * h1 + s1 * h0) / (h0 + h1);
  return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0;
}
function slope2(that, t) {
  var h = that._x1 - that._x0;
  return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t;
}
function point(that, t0, t1) {
  var x0 = that._x0,
      y0 = that._y0,
      x1 = that._x1,
      y1 = that._y1,
      dx = (x1 - x0) / 3;
  that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1);
}
function MonotoneX(context) {
  this._context = context;
}
MonotoneX.prototype = {
  areaStart: function() {
    this._line = 0;
  },
  areaEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._x0 = this._x1 =
    this._y0 = this._y1 =
    this._t0 = NaN;
    this._point = 0;
  },
  lineEnd: function() {
    switch (this._point) {
      case 2: this._context.lineTo(this._x1, this._y1); break;
      case 3: point(this, this._t0, slope2(this, this._t0)); break;
    }
    if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
    this._line = 1 - this._line;
  },
  point: function(x, y) {
    var t1 = NaN;
    x = +x, y = +y;
    if (x === this._x1 && y === this._y1) return;
    switch (this._point) {
      case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
      case 1: this._point = 2; break;
      case 2: this._point = 3; point(this, slope2(this, t1 = slope3(this, x, y)), t1); break;
      default: point(this, this._t0, t1 = slope3(this, x, y)); break;
    }
    this._x0 = this._x1, this._x1 = x;
    this._y0 = this._y1, this._y1 = y;
    this._t0 = t1;
  }
};
(Object.create(MonotoneX.prototype)).point = function(x, y) {
  MonotoneX.prototype.point.call(this, y, x);
};
function monotoneX(context) {
  return new MonotoneX(context);
}

const makeTrends = format.pipe([
	format.groupBy(format.getPath('region.id')),
	format.mapValuesWith(indicator.sortAscByYear),
	format.objectToKeyValueArray
]);
const _trends = format.derived(indicator._selectedData, makeTrends);

/* src/node_modules/components/TrendsG.svelte generated by Svelte v3.44.2 */

function add_css$2(target) {
	format.append_styles(target, "svelte-1qm22pe", ".sensor.svelte-1qm22pe.svelte-1qm22pe.svelte-1qm22pe{fill-opacity:0}.ref.svelte-1qm22pe line.svelte-1qm22pe.svelte-1qm22pe{stroke:var(--colorRefLight);pointer-events:none}.x.svelte-1qm22pe line.svelte-1qm22pe.svelte-1qm22pe{stroke-dasharray:2 2;pointer-events:none}text.svelte-1qm22pe.svelte-1qm22pe.svelte-1qm22pe{fill:var(--colorRef);dominant-baseline:middle;font-weight:var(--dimFontWeight);stroke:none;pointer-events:none}text.label.svelte-1qm22pe.svelte-1qm22pe.svelte-1qm22pe,text.message.svelte-1qm22pe.svelte-1qm22pe.svelte-1qm22pe{text-anchor:middle;dominant-baseline:middle}text.label.svelte-1qm22pe tspan.svelte-1qm22pe.svelte-1qm22pe:nth-child(1){font-weight:bold}text.label.svelte-1qm22pe tspan.svelte-1qm22pe.svelte-1qm22pe:nth-child(2){font-style:italic}.left.svelte-1qm22pe text.svelte-1qm22pe.svelte-1qm22pe{text-anchor:end}.right.svelte-1qm22pe text.svelte-1qm22pe.svelte-1qm22pe{text-anchor:start}path.svelte-1qm22pe.svelte-1qm22pe.svelte-1qm22pe{fill:none;pointer-events:none}path.focused.svelte-1qm22pe.svelte-1qm22pe.svelte-1qm22pe{stroke-width:3;stroke-opacity:1 !important;stroke-dasharray:10 4}path.dimmed.svelte-1qm22pe.svelte-1qm22pe.svelte-1qm22pe{stroke-opacity:0.6}path.deselected.svelte-1qm22pe.svelte-1qm22pe.svelte-1qm22pe{stroke-width:0.75;stroke-opacity:0.25}circle.svelte-1qm22pe.svelte-1qm22pe.svelte-1qm22pe{fill:var(--colorWhite);stroke:var(--colorBlack);stroke-width:1.5;pointer-events:none}.marker.svelte-1qm22pe text.svelte-1qm22pe.svelte-1qm22pe{fill:var(--colorBlack);dominant-baseline:middle;pointer-events:none}.marker.svelte-1qm22pe text.bkg.svelte-1qm22pe.svelte-1qm22pe{fill:none;stroke:var(--colorWhite);stroke-width:5;stroke-linecap:round;stroke-linecap:round}.marker.svelte-1qm22pe .right.svelte-1qm22pe text.svelte-1qm22pe{text-anchor:end}");
}

function get_each_context(ctx, list, i) {
	const child_ctx = ctx.slice();
	child_ctx[39] = list[i].value;
	return child_ctx;
}

function get_each_context_1(ctx, list, i) {
	const child_ctx = ctx.slice();
	child_ctx[42] = list[i];
	return child_ctx;
}

function get_each_context_2(ctx, list, i) {
	const child_ctx = ctx.slice();
	child_ctx[45] = list[i].key;
	child_ctx[46] = list[i].value.path;
	child_ctx[47] = list[i].value.isSelected;
	return child_ctx;
}

function get_each_context_3(ctx, list, i) {
	const child_ctx = ctx.slice();
	child_ctx[50] = list[i].label;
	child_ctx[51] = list[i].y;
	return child_ctx;
}

function get_each_context_4(ctx, list, i) {
	const child_ctx = ctx.slice();
	child_ctx[50] = list[i].label;
	child_ctx[51] = list[i].y;
	return child_ctx;
}

function get_each_context_5(ctx, list, i) {
	const child_ctx = ctx.slice();
	child_ctx[56] = list[i];
	return child_ctx;
}

function get_each_context_6(ctx, list, i) {
	const child_ctx = ctx.slice();
	child_ctx[45] = list[i].key;
	child_ctx[39] = list[i].value;
	return child_ctx;
}

function get_each_context_7(ctx, list, i) {
	const child_ctx = ctx.slice();
	child_ctx[61] = list[i].offset;
	child_ctx[62] = list[i].stopColor;
	return child_ctx;
}

// (276:1) {:else}
function create_else_block$1(ctx) {
	let text_1;
	let t;
	let text_1_x_value;
	let text_1_y_value;

	return {
		c() {
			text_1 = format.svg_element("text");
			t = format.text("No data");
			format.attr(text_1, "class", "message svelte-1qm22pe");
			format.attr(text_1, "x", text_1_x_value = /*width*/ ctx[1] / 2);
			format.attr(text_1, "y", text_1_y_value = /*height*/ ctx[0] / 2);
		},
		m(target, anchor) {
			format.insert(target, text_1, anchor);
			format.append(text_1, t);
		},
		p(ctx, dirty) {
			if (dirty[0] & /*width*/ 2 && text_1_x_value !== (text_1_x_value = /*width*/ ctx[1] / 2)) {
				format.attr(text_1, "x", text_1_x_value);
			}

			if (dirty[0] & /*height*/ 1 && text_1_y_value !== (text_1_y_value = /*height*/ ctx[0] / 2)) {
				format.attr(text_1, "y", text_1_y_value);
			}
		},
		d(detaching) {
			if (detaching) format.detach(text_1);
		}
	};
}

// (168:1) {#if $_trends.length}
function create_if_block$2(ctx) {
	let defs;
	let g3;
	let text_1;
	let tspan;
	let t0;
	let t1;
	let g0;
	let g1;
	let g1_transform_value;
	let g2;
	let g2_transform_value;
	let g4;
	let if_block1_anchor;
	let if_block2_anchor;
	let each_value_6 = /*gradients*/ ctx[12];
	let each_blocks_4 = [];

	for (let i = 0; i < each_value_6.length; i += 1) {
		each_blocks_4[i] = create_each_block_6(get_each_context_6(ctx, each_value_6, i));
	}

	let if_block0 = /*labelUnit*/ ctx[15] && create_if_block_3$1(ctx);
	let each_value_5 = /*$_availableYears*/ ctx[18];
	let each_blocks_3 = [];

	for (let i = 0; i < each_value_5.length; i += 1) {
		each_blocks_3[i] = create_each_block_5(get_each_context_5(ctx, each_value_5, i));
	}

	let each_value_4 = /*ticks*/ ctx[14];
	let each_blocks_2 = [];

	for (let i = 0; i < each_value_4.length; i += 1) {
		each_blocks_2[i] = create_each_block_4(get_each_context_4(ctx, each_value_4, i));
	}

	let each_value_3 = /*ticks*/ ctx[14];
	let each_blocks_1 = [];

	for (let i = 0; i < each_value_3.length; i += 1) {
		each_blocks_1[i] = create_each_block_3(get_each_context_3(ctx, each_value_3, i));
	}

	let each_value_2 = /*trendLines*/ ctx[13];
	let each_blocks = [];

	for (let i = 0; i < each_value_2.length; i += 1) {
		each_blocks[i] = create_each_block_2(get_each_context_2(ctx, each_value_2, i));
	}

	let if_block1 = /*$_availableYears*/ ctx[18].length === 1 && create_if_block_2$1(ctx);
	let if_block2 = /*$_tooltip*/ ctx[19].isVisible && create_if_block_1$1(ctx);

	return {
		c() {
			defs = format.svg_element("defs");

			for (let i = 0; i < each_blocks_4.length; i += 1) {
				each_blocks_4[i].c();
			}

			g3 = format.svg_element("g");
			text_1 = format.svg_element("text");
			tspan = format.svg_element("tspan");
			t0 = format.text(/*chartTitle*/ ctx[11]);
			t1 = format.space();
			if (if_block0) if_block0.c();
			g0 = format.svg_element("g");

			for (let i = 0; i < each_blocks_3.length; i += 1) {
				each_blocks_3[i].c();
			}

			g1 = format.svg_element("g");

			for (let i = 0; i < each_blocks_2.length; i += 1) {
				each_blocks_2[i].c();
			}

			g2 = format.svg_element("g");

			for (let i = 0; i < each_blocks_1.length; i += 1) {
				each_blocks_1[i].c();
			}

			g4 = format.svg_element("g");

			for (let i = 0; i < each_blocks.length; i += 1) {
				each_blocks[i].c();
			}

			if (if_block1) if_block1.c();
			if_block1_anchor = format.empty();
			if (if_block2) if_block2.c();
			if_block2_anchor = format.empty();
			format.attr(tspan, "class", "svelte-1qm22pe");
			format.attr(text_1, "class", "label svelte-1qm22pe");
			format.attr(text_1, "x", /*xMed*/ ctx[17]);
			format.attr(text_1, "y", /*yLabel*/ ctx[16]);
			format.attr(text_1, "font-size", labelFontSize);
			format.attr(g0, "class", "ref x svelte-1qm22pe");
			format.attr(g1, "class", "ref left svelte-1qm22pe");
			format.attr(g1, "transform", g1_transform_value = "translate(" + /*x1*/ ctx[7] + ",0)");
			format.attr(g2, "class", "ref right svelte-1qm22pe");
			format.attr(g2, "transform", g2_transform_value = "translate(" + /*x2*/ ctx[6] + ",0)");
			format.attr(g3, "class", "axes");
			format.attr(g4, "class", "curves");
		},
		m(target, anchor) {
			format.insert(target, defs, anchor);

			for (let i = 0; i < each_blocks_4.length; i += 1) {
				each_blocks_4[i].m(defs, null);
			}

			format.insert(target, g3, anchor);
			format.append(g3, text_1);
			format.append(text_1, tspan);
			format.append(tspan, t0);
			format.append(text_1, t1);
			if (if_block0) if_block0.m(text_1, null);
			format.append(g3, g0);

			for (let i = 0; i < each_blocks_3.length; i += 1) {
				each_blocks_3[i].m(g0, null);
			}

			format.append(g3, g1);

			for (let i = 0; i < each_blocks_2.length; i += 1) {
				each_blocks_2[i].m(g1, null);
			}

			format.append(g3, g2);

			for (let i = 0; i < each_blocks_1.length; i += 1) {
				each_blocks_1[i].m(g2, null);
			}

			format.insert(target, g4, anchor);

			for (let i = 0; i < each_blocks.length; i += 1) {
				each_blocks[i].m(g4, null);
			}

			if (if_block1) if_block1.m(target, anchor);
			format.insert(target, if_block1_anchor, anchor);
			if (if_block2) if_block2.m(target, anchor);
			format.insert(target, if_block2_anchor, anchor);
		},
		p(ctx, dirty) {
			if (dirty[0] & /*gradients*/ 4096) {
				each_value_6 = /*gradients*/ ctx[12];
				let i;

				for (i = 0; i < each_value_6.length; i += 1) {
					const child_ctx = get_each_context_6(ctx, each_value_6, i);

					if (each_blocks_4[i]) {
						each_blocks_4[i].p(child_ctx, dirty);
					} else {
						each_blocks_4[i] = create_each_block_6(child_ctx);
						each_blocks_4[i].c();
						each_blocks_4[i].m(defs, null);
					}
				}

				for (; i < each_blocks_4.length; i += 1) {
					each_blocks_4[i].d(1);
				}

				each_blocks_4.length = each_value_6.length;
			}

			if (dirty[0] & /*chartTitle*/ 2048) format.set_data(t0, /*chartTitle*/ ctx[11]);

			if (/*labelUnit*/ ctx[15]) {
				if (if_block0) {
					if_block0.p(ctx, dirty);
				} else {
					if_block0 = create_if_block_3$1(ctx);
					if_block0.c();
					if_block0.m(text_1, null);
				}
			} else if (if_block0) {
				if_block0.d(1);
				if_block0 = null;
			}

			if (dirty[0] & /*xMed*/ 131072) {
				format.attr(text_1, "x", /*xMed*/ ctx[17]);
			}

			if (dirty[0] & /*yLabel*/ 65536) {
				format.attr(text_1, "y", /*yLabel*/ ctx[16]);
			}

			if (dirty[0] & /*$_layout, $_availableYears, yMin, yMax*/ 262668) {
				each_value_5 = /*$_availableYears*/ ctx[18];
				let i;

				for (i = 0; i < each_value_5.length; i += 1) {
					const child_ctx = get_each_context_5(ctx, each_value_5, i);

					if (each_blocks_3[i]) {
						each_blocks_3[i].p(child_ctx, dirty);
					} else {
						each_blocks_3[i] = create_each_block_5(child_ctx);
						each_blocks_3[i].c();
						each_blocks_3[i].m(g0, null);
					}
				}

				for (; i < each_blocks_3.length; i += 1) {
					each_blocks_3[i].d(1);
				}

				each_blocks_3.length = each_value_5.length;
			}

			if (dirty[0] & /*ticks*/ 16384) {
				each_value_4 = /*ticks*/ ctx[14];
				let i;

				for (i = 0; i < each_value_4.length; i += 1) {
					const child_ctx = get_each_context_4(ctx, each_value_4, i);

					if (each_blocks_2[i]) {
						each_blocks_2[i].p(child_ctx, dirty);
					} else {
						each_blocks_2[i] = create_each_block_4(child_ctx);
						each_blocks_2[i].c();
						each_blocks_2[i].m(g1, null);
					}
				}

				for (; i < each_blocks_2.length; i += 1) {
					each_blocks_2[i].d(1);
				}

				each_blocks_2.length = each_value_4.length;
			}

			if (dirty[0] & /*x1*/ 128 && g1_transform_value !== (g1_transform_value = "translate(" + /*x1*/ ctx[7] + ",0)")) {
				format.attr(g1, "transform", g1_transform_value);
			}

			if (dirty[0] & /*ticks*/ 16384) {
				each_value_3 = /*ticks*/ ctx[14];
				let i;

				for (i = 0; i < each_value_3.length; i += 1) {
					const child_ctx = get_each_context_3(ctx, each_value_3, i);

					if (each_blocks_1[i]) {
						each_blocks_1[i].p(child_ctx, dirty);
					} else {
						each_blocks_1[i] = create_each_block_3(child_ctx);
						each_blocks_1[i].c();
						each_blocks_1[i].m(g2, null);
					}
				}

				for (; i < each_blocks_1.length; i += 1) {
					each_blocks_1[i].d(1);
				}

				each_blocks_1.length = each_value_3.length;
			}

			if (dirty[0] & /*x2*/ 64 && g2_transform_value !== (g2_transform_value = "translate(" + /*x2*/ ctx[6] + ",0)")) {
				format.attr(g2, "transform", g2_transform_value);
			}

			if (dirty[0] & /*trendLines, $_tooltip, highlightedId*/ 533504) {
				each_value_2 = /*trendLines*/ ctx[13];
				let i;

				for (i = 0; i < each_value_2.length; i += 1) {
					const child_ctx = get_each_context_2(ctx, each_value_2, i);

					if (each_blocks[i]) {
						each_blocks[i].p(child_ctx, dirty);
					} else {
						each_blocks[i] = create_each_block_2(child_ctx);
						each_blocks[i].c();
						each_blocks[i].m(g4, null);
					}
				}

				for (; i < each_blocks.length; i += 1) {
					each_blocks[i].d(1);
				}

				each_blocks.length = each_value_2.length;
			}

			if (/*$_availableYears*/ ctx[18].length === 1) {
				if (if_block1) {
					if_block1.p(ctx, dirty);
				} else {
					if_block1 = create_if_block_2$1(ctx);
					if_block1.c();
					if_block1.m(if_block1_anchor.parentNode, if_block1_anchor);
				}
			} else if (if_block1) {
				if_block1.d(1);
				if_block1 = null;
			}

			if (/*$_tooltip*/ ctx[19].isVisible) {
				if (if_block2) {
					if_block2.p(ctx, dirty);
				} else {
					if_block2 = create_if_block_1$1(ctx);
					if_block2.c();
					if_block2.m(if_block2_anchor.parentNode, if_block2_anchor);
				}
			} else if (if_block2) {
				if_block2.d(1);
				if_block2 = null;
			}
		},
		d(detaching) {
			if (detaching) format.detach(defs);
			format.destroy_each(each_blocks_4, detaching);
			if (detaching) format.detach(g3);
			if (if_block0) if_block0.d();
			format.destroy_each(each_blocks_3, detaching);
			format.destroy_each(each_blocks_2, detaching);
			format.destroy_each(each_blocks_1, detaching);
			if (detaching) format.detach(g4);
			format.destroy_each(each_blocks, detaching);
			if (if_block1) if_block1.d(detaching);
			if (detaching) format.detach(if_block1_anchor);
			if (if_block2) if_block2.d(detaching);
			if (detaching) format.detach(if_block2_anchor);
		}
	};
}

// (175:5) {#each value as {offset, stopColor}}
function create_each_block_7(ctx) {
	let stop;
	let stop_offset_value;
	let stop_stop_color_value;

	return {
		c() {
			stop = format.svg_element("stop");
			format.attr(stop, "offset", stop_offset_value = /*offset*/ ctx[61]);
			format.attr(stop, "stop-color", stop_stop_color_value = /*stopColor*/ ctx[62]);
		},
		m(target, anchor) {
			format.insert(target, stop, anchor);
		},
		p(ctx, dirty) {
			if (dirty[0] & /*gradients*/ 4096 && stop_offset_value !== (stop_offset_value = /*offset*/ ctx[61])) {
				format.attr(stop, "offset", stop_offset_value);
			}

			if (dirty[0] & /*gradients*/ 4096 && stop_stop_color_value !== (stop_stop_color_value = /*stopColor*/ ctx[62])) {
				format.attr(stop, "stop-color", stop_stop_color_value);
			}
		},
		d(detaching) {
			if (detaching) format.detach(stop);
		}
	};
}

// (170:3) {#each gradients as {key, value}}
function create_each_block_6(ctx) {
	let linearGradient;
	let linearGradient_id_value;
	let each_value_7 = /*value*/ ctx[39];
	let each_blocks = [];

	for (let i = 0; i < each_value_7.length; i += 1) {
		each_blocks[i] = create_each_block_7(get_each_context_7(ctx, each_value_7, i));
	}

	return {
		c() {
			linearGradient = format.svg_element("linearGradient");

			for (let i = 0; i < each_blocks.length; i += 1) {
				each_blocks[i].c();
			}

			format.attr(linearGradient, "id", linearGradient_id_value = /*key*/ ctx[45]);
			format.attr(linearGradient, "gradientUnits", "userSpaceOnUse");
		},
		m(target, anchor) {
			format.insert(target, linearGradient, anchor);

			for (let i = 0; i < each_blocks.length; i += 1) {
				each_blocks[i].m(linearGradient, null);
			}
		},
		p(ctx, dirty) {
			if (dirty[0] & /*gradients*/ 4096) {
				each_value_7 = /*value*/ ctx[39];
				let i;

				for (i = 0; i < each_value_7.length; i += 1) {
					const child_ctx = get_each_context_7(ctx, each_value_7, i);

					if (each_blocks[i]) {
						each_blocks[i].p(child_ctx, dirty);
					} else {
						each_blocks[i] = create_each_block_7(child_ctx);
						each_blocks[i].c();
						each_blocks[i].m(linearGradient, null);
					}
				}

				for (; i < each_blocks.length; i += 1) {
					each_blocks[i].d(1);
				}

				each_blocks.length = each_value_7.length;
			}

			if (dirty[0] & /*gradients*/ 4096 && linearGradient_id_value !== (linearGradient_id_value = /*key*/ ctx[45])) {
				format.attr(linearGradient, "id", linearGradient_id_value);
			}
		},
		d(detaching) {
			if (detaching) format.detach(linearGradient);
			format.destroy_each(each_blocks, detaching);
		}
	};
}

// (192:4) {#if labelUnit}
function create_if_block_3$1(ctx) {
	let tspan;
	let t0;
	let t1;
	let t2;

	return {
		c() {
			tspan = format.svg_element("tspan");
			t0 = format.text("[");
			t1 = format.text(/*labelUnit*/ ctx[15]);
			t2 = format.text("]");
			format.attr(tspan, "class", "svelte-1qm22pe");
		},
		m(target, anchor) {
			format.insert(target, tspan, anchor);
			format.append(tspan, t0);
			format.append(tspan, t1);
			format.append(tspan, t2);
		},
		p(ctx, dirty) {
			if (dirty[0] & /*labelUnit*/ 32768) format.set_data(t1, /*labelUnit*/ ctx[15]);
		},
		d(detaching) {
			if (detaching) format.detach(tspan);
		}
	};
}

// (197:4) {#each $_availableYears as year}
function create_each_block_5(ctx) {
	let line_1;
	let line_1_x__value;
	let line_1_x__value_1;

	return {
		c() {
			line_1 = format.svg_element("line");
			format.attr(line_1, "x1", line_1_x__value = /*$_layout*/ ctx[9].scaleX(/*year*/ ctx[56]));
			format.attr(line_1, "x2", line_1_x__value_1 = /*$_layout*/ ctx[9].scaleX(/*year*/ ctx[56]));
			format.attr(line_1, "y1", /*yMin*/ ctx[3]);
			format.attr(line_1, "y2", /*yMax*/ ctx[2]);
			format.attr(line_1, "class", "svelte-1qm22pe");
		},
		m(target, anchor) {
			format.insert(target, line_1, anchor);
		},
		p(ctx, dirty) {
			if (dirty[0] & /*$_layout, $_availableYears*/ 262656 && line_1_x__value !== (line_1_x__value = /*$_layout*/ ctx[9].scaleX(/*year*/ ctx[56]))) {
				format.attr(line_1, "x1", line_1_x__value);
			}

			if (dirty[0] & /*$_layout, $_availableYears*/ 262656 && line_1_x__value_1 !== (line_1_x__value_1 = /*$_layout*/ ctx[9].scaleX(/*year*/ ctx[56]))) {
				format.attr(line_1, "x2", line_1_x__value_1);
			}

			if (dirty[0] & /*yMin*/ 8) {
				format.attr(line_1, "y1", /*yMin*/ ctx[3]);
			}

			if (dirty[0] & /*yMax*/ 4) {
				format.attr(line_1, "y2", /*yMax*/ ctx[2]);
			}
		},
		d(detaching) {
			if (detaching) format.detach(line_1);
		}
	};
}

// (210:4) {#each ticks as {label, y}}
function create_each_block_4(ctx) {
	let line_1;
	let line_1_y__value;
	let line_1_y__value_1;
	let text_1;
	let t_value = /*label*/ ctx[50] + "";
	let t;
	let text_1_dy_value;

	return {
		c() {
			line_1 = format.svg_element("line");
			text_1 = format.svg_element("text");
			t = format.text(t_value);
			format.attr(line_1, "x2", "-10");
			format.attr(line_1, "y1", line_1_y__value = /*y*/ ctx[51]);
			format.attr(line_1, "y2", line_1_y__value_1 = /*y*/ ctx[51]);
			format.attr(line_1, "class", "svelte-1qm22pe");
			format.attr(text_1, "dx", "-15");
			format.attr(text_1, "dy", text_1_dy_value = /*y*/ ctx[51]);
			format.attr(text_1, "font-size", axisFontSize);
			format.attr(text_1, "class", "svelte-1qm22pe");
		},
		m(target, anchor) {
			format.insert(target, line_1, anchor);
			format.insert(target, text_1, anchor);
			format.append(text_1, t);
		},
		p(ctx, dirty) {
			if (dirty[0] & /*ticks*/ 16384 && line_1_y__value !== (line_1_y__value = /*y*/ ctx[51])) {
				format.attr(line_1, "y1", line_1_y__value);
			}

			if (dirty[0] & /*ticks*/ 16384 && line_1_y__value_1 !== (line_1_y__value_1 = /*y*/ ctx[51])) {
				format.attr(line_1, "y2", line_1_y__value_1);
			}

			if (dirty[0] & /*ticks*/ 16384 && t_value !== (t_value = /*label*/ ctx[50] + "")) format.set_data(t, t_value);

			if (dirty[0] & /*ticks*/ 16384 && text_1_dy_value !== (text_1_dy_value = /*y*/ ctx[51])) {
				format.attr(text_1, "dy", text_1_dy_value);
			}
		},
		d(detaching) {
			if (detaching) format.detach(line_1);
			if (detaching) format.detach(text_1);
		}
	};
}

// (219:4) {#each ticks as {label, y}}
function create_each_block_3(ctx) {
	let line_1;
	let line_1_y__value;
	let line_1_y__value_1;
	let text_1;
	let t_value = /*label*/ ctx[50] + "";
	let t;
	let text_1_dy_value;

	return {
		c() {
			line_1 = format.svg_element("line");
			text_1 = format.svg_element("text");
			t = format.text(t_value);
			format.attr(line_1, "x2", "10");
			format.attr(line_1, "y1", line_1_y__value = /*y*/ ctx[51]);
			format.attr(line_1, "y2", line_1_y__value_1 = /*y*/ ctx[51]);
			format.attr(line_1, "class", "svelte-1qm22pe");
			format.attr(text_1, "dx", "15");
			format.attr(text_1, "dy", text_1_dy_value = /*y*/ ctx[51]);
			format.attr(text_1, "font-size", axisFontSize);
			format.attr(text_1, "class", "svelte-1qm22pe");
		},
		m(target, anchor) {
			format.insert(target, line_1, anchor);
			format.insert(target, text_1, anchor);
			format.append(text_1, t);
		},
		p(ctx, dirty) {
			if (dirty[0] & /*ticks*/ 16384 && line_1_y__value !== (line_1_y__value = /*y*/ ctx[51])) {
				format.attr(line_1, "y1", line_1_y__value);
			}

			if (dirty[0] & /*ticks*/ 16384 && line_1_y__value_1 !== (line_1_y__value_1 = /*y*/ ctx[51])) {
				format.attr(line_1, "y2", line_1_y__value_1);
			}

			if (dirty[0] & /*ticks*/ 16384 && t_value !== (t_value = /*label*/ ctx[50] + "")) format.set_data(t, t_value);

			if (dirty[0] & /*ticks*/ 16384 && text_1_dy_value !== (text_1_dy_value = /*y*/ ctx[51])) {
				format.attr(text_1, "dy", text_1_dy_value);
			}
		},
		d(detaching) {
			if (detaching) format.detach(line_1);
			if (detaching) format.detach(text_1);
		}
	};
}

// (229:3) {#each trendLines as {key, value: {path, isSelected}}}
function create_each_block_2(ctx) {
	let path;
	let path_d_value;
	let path_stroke_value;

	return {
		c() {
			path = format.svg_element("path");
			format.attr(path, "d", path_d_value = /*path*/ ctx[46]);
			format.attr(path, "stroke", path_stroke_value = "url(#" + /*key*/ ctx[45] + ")");
			format.attr(path, "class", "svelte-1qm22pe");
			format.toggle_class(path, "deselected", !/*isSelected*/ ctx[47]);
			format.toggle_class(path, "dimmed", /*$_tooltip*/ ctx[19].isVisible && /*highlightedId*/ ctx[10] !== /*key*/ ctx[45]);
			format.toggle_class(path, "focused", /*$_tooltip*/ ctx[19].isVisible && /*highlightedId*/ ctx[10] === /*key*/ ctx[45]);
		},
		m(target, anchor) {
			format.insert(target, path, anchor);
		},
		p(ctx, dirty) {
			if (dirty[0] & /*trendLines*/ 8192 && path_d_value !== (path_d_value = /*path*/ ctx[46])) {
				format.attr(path, "d", path_d_value);
			}

			if (dirty[0] & /*trendLines*/ 8192 && path_stroke_value !== (path_stroke_value = "url(#" + /*key*/ ctx[45] + ")")) {
				format.attr(path, "stroke", path_stroke_value);
			}

			if (dirty[0] & /*trendLines*/ 8192) {
				format.toggle_class(path, "deselected", !/*isSelected*/ ctx[47]);
			}

			if (dirty[0] & /*$_tooltip, highlightedId, trendLines*/ 533504) {
				format.toggle_class(path, "dimmed", /*$_tooltip*/ ctx[19].isVisible && /*highlightedId*/ ctx[10] !== /*key*/ ctx[45]);
			}

			if (dirty[0] & /*$_tooltip, highlightedId, trendLines*/ 533504) {
				format.toggle_class(path, "focused", /*$_tooltip*/ ctx[19].isVisible && /*highlightedId*/ ctx[10] === /*key*/ ctx[45]);
			}
		},
		d(detaching) {
			if (detaching) format.detach(path);
		}
	};
}

// (242:2) {#if $_availableYears.length === 1}
function create_if_block_2$1(ctx) {
	let g;
	let each_value = /*$_trends*/ ctx[8];
	let each_blocks = [];

	for (let i = 0; i < each_value.length; i += 1) {
		each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i));
	}

	return {
		c() {
			g = format.svg_element("g");

			for (let i = 0; i < each_blocks.length; i += 1) {
				each_blocks[i].c();
			}
		},
		m(target, anchor) {
			format.insert(target, g, anchor);

			for (let i = 0; i < each_blocks.length; i += 1) {
				each_blocks[i].m(g, null);
			}
		},
		p(ctx, dirty) {
			if (dirty[0] & /*$_trends, getX, getY, $_layout*/ 816) {
				each_value = /*$_trends*/ ctx[8];
				let i;

				for (i = 0; i < each_value.length; i += 1) {
					const child_ctx = get_each_context(ctx, each_value, i);

					if (each_blocks[i]) {
						each_blocks[i].p(child_ctx, dirty);
					} else {
						each_blocks[i] = create_each_block(child_ctx);
						each_blocks[i].c();
						each_blocks[i].m(g, null);
					}
				}

				for (; i < each_blocks.length; i += 1) {
					each_blocks[i].d(1);
				}

				each_blocks.length = each_value.length;
			}
		},
		d(detaching) {
			if (detaching) format.detach(g);
			format.destroy_each(each_blocks, detaching);
		}
	};
}

// (245:5) {#each value as d}
function create_each_block_1(ctx) {
	let circle;
	let circle_cx_value;
	let circle_cy_value;
	let circle_r_value;

	return {
		c() {
			circle = format.svg_element("circle");
			format.attr(circle, "cx", circle_cx_value = /*getX*/ ctx[5](/*d*/ ctx[42]));
			format.attr(circle, "cy", circle_cy_value = /*getY*/ ctx[4](/*d*/ ctx[42]));
			format.attr(circle, "r", circle_r_value = /*$_layout*/ ctx[9].radius);
			format.attr(circle, "class", "svelte-1qm22pe");
		},
		m(target, anchor) {
			format.insert(target, circle, anchor);
		},
		p(ctx, dirty) {
			if (dirty[0] & /*getX, $_trends*/ 288 && circle_cx_value !== (circle_cx_value = /*getX*/ ctx[5](/*d*/ ctx[42]))) {
				format.attr(circle, "cx", circle_cx_value);
			}

			if (dirty[0] & /*getY, $_trends*/ 272 && circle_cy_value !== (circle_cy_value = /*getY*/ ctx[4](/*d*/ ctx[42]))) {
				format.attr(circle, "cy", circle_cy_value);
			}

			if (dirty[0] & /*$_layout*/ 512 && circle_r_value !== (circle_r_value = /*$_layout*/ ctx[9].radius)) {
				format.attr(circle, "r", circle_r_value);
			}
		},
		d(detaching) {
			if (detaching) format.detach(circle);
		}
	};
}

// (244:4) {#each $_trends as {value}}
function create_each_block(ctx) {
	let each_1_anchor;
	let each_value_1 = /*value*/ ctx[39];
	let each_blocks = [];

	for (let i = 0; i < each_value_1.length; i += 1) {
		each_blocks[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i));
	}

	return {
		c() {
			for (let i = 0; i < each_blocks.length; i += 1) {
				each_blocks[i].c();
			}

			each_1_anchor = format.empty();
		},
		m(target, anchor) {
			for (let i = 0; i < each_blocks.length; i += 1) {
				each_blocks[i].m(target, anchor);
			}

			format.insert(target, each_1_anchor, anchor);
		},
		p(ctx, dirty) {
			if (dirty[0] & /*getX, $_trends, getY, $_layout*/ 816) {
				each_value_1 = /*value*/ ctx[39];
				let i;

				for (i = 0; i < each_value_1.length; i += 1) {
					const child_ctx = get_each_context_1(ctx, each_value_1, i);

					if (each_blocks[i]) {
						each_blocks[i].p(child_ctx, dirty);
					} else {
						each_blocks[i] = create_each_block_1(child_ctx);
						each_blocks[i].c();
						each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
					}
				}

				for (; i < each_blocks.length; i += 1) {
					each_blocks[i].d(1);
				}

				each_blocks.length = each_value_1.length;
			}
		},
		d(detaching) {
			format.destroy_each(each_blocks, detaching);
			if (detaching) format.detach(each_1_anchor);
		}
	};
}

// (258:2) {#if $_tooltip.isVisible}
function create_if_block_1$1(ctx) {
	let g1;
	let circle;
	let circle_r_value;
	let g0;
	let text0;
	let t0_value = /*$_tooltip*/ ctx[19].value + "";
	let t0;
	let text0_dy_value;
	let text1;
	let t1_value = /*$_tooltip*/ ctx[19].value + "";
	let t1;
	let text1_dy_value;
	let text2;
	let t2_value = /*$_tooltip*/ ctx[19].label + "";
	let t2;
	let text3;
	let t3_value = /*$_tooltip*/ ctx[19].label + "";
	let t3;
	let g0_transform_value;
	let g1_transform_value;

	return {
		c() {
			g1 = format.svg_element("g");
			circle = format.svg_element("circle");
			g0 = format.svg_element("g");
			text0 = format.svg_element("text");
			t0 = format.text(t0_value);
			text1 = format.svg_element("text");
			t1 = format.text(t1_value);
			text2 = format.svg_element("text");
			t2 = format.text(t2_value);
			text3 = format.svg_element("text");
			t3 = format.text(t3_value);
			format.attr(circle, "r", circle_r_value = /*$_layout*/ ctx[9].radius);
			format.attr(circle, "class", "svelte-1qm22pe");
			format.attr(text0, "dy", text0_dy_value = -/*tooltipShift*/ ctx[20]);
			format.attr(text0, "class", "bkg svelte-1qm22pe");
			format.attr(text1, "dy", text1_dy_value = -/*tooltipShift*/ ctx[20]);
			format.attr(text1, "class", "svelte-1qm22pe");
			format.attr(text2, "dy", /*tooltipShift*/ ctx[20]);
			format.attr(text2, "class", "bkg svelte-1qm22pe");
			format.attr(text3, "dy", /*tooltipShift*/ ctx[20]);
			format.attr(text3, "class", "svelte-1qm22pe");
			format.attr(g0, "transform", g0_transform_value = "translate(" + /*$_tooltip*/ ctx[19].shiftX + "," + /*$_tooltip*/ ctx[19].shiftY + ")");
			format.attr(g0, "class", "svelte-1qm22pe");
			format.toggle_class(g0, "right", /*$_tooltip*/ ctx[19].isRight);
			format.attr(g1, "class", "marker svelte-1qm22pe");
			format.attr(g1, "transform", g1_transform_value = "translate(" + /*$_tooltip*/ ctx[19].dotX + "," + /*$_tooltip*/ ctx[19].dotY + ")");
		},
		m(target, anchor) {
			format.insert(target, g1, anchor);
			format.append(g1, circle);
			format.append(g1, g0);
			format.append(g0, text0);
			format.append(text0, t0);
			format.append(g0, text1);
			format.append(text1, t1);
			format.append(g0, text2);
			format.append(text2, t2);
			format.append(g0, text3);
			format.append(text3, t3);
		},
		p(ctx, dirty) {
			if (dirty[0] & /*$_layout*/ 512 && circle_r_value !== (circle_r_value = /*$_layout*/ ctx[9].radius)) {
				format.attr(circle, "r", circle_r_value);
			}

			if (dirty[0] & /*$_tooltip*/ 524288 && t0_value !== (t0_value = /*$_tooltip*/ ctx[19].value + "")) format.set_data(t0, t0_value);
			if (dirty[0] & /*$_tooltip*/ 524288 && t1_value !== (t1_value = /*$_tooltip*/ ctx[19].value + "")) format.set_data(t1, t1_value);
			if (dirty[0] & /*$_tooltip*/ 524288 && t2_value !== (t2_value = /*$_tooltip*/ ctx[19].label + "")) format.set_data(t2, t2_value);
			if (dirty[0] & /*$_tooltip*/ 524288 && t3_value !== (t3_value = /*$_tooltip*/ ctx[19].label + "")) format.set_data(t3, t3_value);

			if (dirty[0] & /*$_tooltip*/ 524288 && g0_transform_value !== (g0_transform_value = "translate(" + /*$_tooltip*/ ctx[19].shiftX + "," + /*$_tooltip*/ ctx[19].shiftY + ")")) {
				format.attr(g0, "transform", g0_transform_value);
			}

			if (dirty[0] & /*$_tooltip*/ 524288) {
				format.toggle_class(g0, "right", /*$_tooltip*/ ctx[19].isRight);
			}

			if (dirty[0] & /*$_tooltip*/ 524288 && g1_transform_value !== (g1_transform_value = "translate(" + /*$_tooltip*/ ctx[19].dotX + "," + /*$_tooltip*/ ctx[19].dotY + ")")) {
				format.attr(g1, "transform", g1_transform_value);
			}
		},
		d(detaching) {
			if (detaching) format.detach(g1);
		}
	};
}

function create_fragment$2(ctx) {
	let g;
	let rect;
	let mounted;
	let dispose;

	function select_block_type(ctx, dirty) {
		if (/*$_trends*/ ctx[8].length) return create_if_block$2;
		return create_else_block$1;
	}

	let current_block_type = select_block_type(ctx);
	let if_block = current_block_type(ctx);

	return {
		c() {
			g = format.svg_element("g");
			rect = format.svg_element("rect");
			if_block.c();
			format.attr(rect, "height", /*height*/ ctx[0]);
			format.attr(rect, "width", /*width*/ ctx[1]);
			format.attr(rect, "class", "sensor svelte-1qm22pe");
			format.attr(g, "class", "TrendsG");
		},
		m(target, anchor) {
			format.insert(target, g, anchor);
			format.append(g, rect);
			if_block.m(g, null);

			if (!mounted) {
				dispose = [
					format.listen(rect, "mouseleave", /*onMouseLeave*/ ctx[23]),
					format.listen(rect, "mousemove", /*onMouseMove*/ ctx[22])
				];

				mounted = true;
			}
		},
		p(ctx, dirty) {
			if (dirty[0] & /*height*/ 1) {
				format.attr(rect, "height", /*height*/ ctx[0]);
			}

			if (dirty[0] & /*width*/ 2) {
				format.attr(rect, "width", /*width*/ ctx[1]);
			}

			if (current_block_type === (current_block_type = select_block_type(ctx)) && if_block) {
				if_block.p(ctx, dirty);
			} else {
				if_block.d(1);
				if_block = current_block_type(ctx);

				if (if_block) {
					if_block.c();
					if_block.m(g, null);
				}
			}
		},
		i: format.noop,
		o: format.noop,
		d(detaching) {
			if (detaching) format.detach(g);
			if_block.d();
			mounted = false;
			format.run_all(dispose);
		}
	};
}

const gap = 4;
const labelFontSize = 14;
const axisFontSize = 12;
const tooltipFontSize = 10;
const tooltipPadding = 5;

function instance$2($$self, $$props, $$invalidate) {
	let maxOrder;
	let X1;
	let X2;
	let x1;
	let x2;
	let xMed;
	let yMin;
	let yMax;
	let yLabel;
	let labelUnit;
	let scaleY;
	let ticks;
	let getX;
	let getY;
	let lineGenerator;
	let trendLines;
	let getStopOffset;
	let gradients;
	let chartTitle;
	let quadTree;
	let $_trends;
	let $_layout;
	let $_availableYears;
	let $_tooltip;
	format.component_subscribe($$self, _trends, $$value => $$invalidate(8, $_trends = $$value));
	format.component_subscribe($$self, format._timelineLayout, $$value => $$invalidate(9, $_layout = $$value));
	format.component_subscribe($$self, indicator._availableYears, $$value => $$invalidate(18, $_availableYears = $$value));
	const tooltipShift = 1.5 * tooltipPadding + 0.5 * tooltipFontSize;
	let { colorScale = null } = $$props;
	let { data = null } = $$props;
	let { formatFn = null } = $$props;
	let { getIndicatorValue = null } = $$props;
	let { height = null } = $$props;
	let { schema = null } = $$props;
	let { types = null } = $$props;
	let { useRankScale = false } = $$props;
	let { width = null } = $$props;

	/* local vars */
	let highlightedId;

	const tooltipDefault = { isVisible: false };
	const _tooltip = format.writable(tooltipDefault);
	format.component_subscribe($$self, _tooltip, value => $$invalidate(19, $_tooltip = value));

	const onMouseMove = event => {
		const { offsetX, offsetY } = event;

		if (offsetX < x1 || offsetX > x2 || !quadTree) {
			_tooltip.set(tooltipDefault);
			return;
		}

		const datum = quadTree.find(offsetX, offsetY);
		const { region_id, region: { id, name } } = datum;
		$$invalidate(10, highlightedId = id);
		const dotX = getX(datum);
		const dotY = getY(datum);
		const isRight = dotX > (X1 + X2) / 2;
		const shiftX = isRight ? -tooltipShift : tooltipShift;
		const shiftY = Math.max(yMin + tooltipShift, Math.min(dotY, yMax - tooltipShift)) - dotY;

		_tooltip.update(indicator.mergeObj({
			...datum,
			dotX,
			dotY,
			isRight,
			isVisible: true,
			label: `${name} (${region_id})`,
			shiftX,
			shiftY,
			value: formatFn(getIndicatorValue(datum))
		}));
	};

	const onMouseLeave = () => {
		_tooltip.set(tooltipDefault);
	};

	$$self.$$set = $$props => {
		if ('colorScale' in $$props) $$invalidate(24, colorScale = $$props.colorScale);
		if ('data' in $$props) $$invalidate(25, data = $$props.data);
		if ('formatFn' in $$props) $$invalidate(26, formatFn = $$props.formatFn);
		if ('getIndicatorValue' in $$props) $$invalidate(27, getIndicatorValue = $$props.getIndicatorValue);
		if ('height' in $$props) $$invalidate(0, height = $$props.height);
		if ('schema' in $$props) $$invalidate(28, schema = $$props.schema);
		if ('types' in $$props) $$invalidate(29, types = $$props.types);
		if ('useRankScale' in $$props) $$invalidate(30, useRankScale = $$props.useRankScale);
		if ('width' in $$props) $$invalidate(1, width = $$props.width);
	};

	$$self.$$.update = () => {
		if ($$self.$$.dirty[0] & /*data*/ 33554432) {
			/* reactive vars */
			// data
			$$invalidate(34, maxOrder = max(data.rankedData, indicator.getOrder));
		}

		if ($$self.$$.dirty[0] & /*$_layout, data*/ 33554944) {
			// layout
			X1 = $_layout.fullScaleX(data.year_extent[0]);
		}

		if ($$self.$$.dirty[0] & /*$_layout, data*/ 33554944) {
			X2 = $_layout.fullScaleX(data.year_extent[1]);
		}

		if ($$self.$$.dirty[0] & /*$_layout, data*/ 33554944) {
			$$invalidate(7, x1 = $_layout.scaleX(data.year_extent[0]));
		}

		if ($$self.$$.dirty[0] & /*$_layout, data*/ 33554944) {
			$$invalidate(6, x2 = $_layout.scaleX(data.year_extent[1]));
		}

		if ($$self.$$.dirty[0] & /*x1, x2*/ 192) {
			$$invalidate(17, xMed = (x1 + x2) / 2);
		}

		if ($$self.$$.dirty[0] & /*$_layout*/ 512) {
			$$invalidate(3, yMin = $_layout.radius + 2 * gap + labelFontSize);
		}

		if ($$self.$$.dirty[0] & /*height, $_layout*/ 513) {
			$$invalidate(2, yMax = height - Math.max($_layout.radius, axisFontSize / 2) - gap);
		}

		if ($$self.$$.dirty[0] & /*schema, types*/ 805306368) {
			$$invalidate(15, labelUnit = schema.value.unit_string || schema.value.type && format.has(types, schema.value.type) && format.has(types[schema.value.type], 'unit_string') && types[schema.value.type].unit_string);
		}

		if ($$self.$$.dirty[0] & /*useRankScale, yMin, yMax, data*/ 1107296268 | $$self.$$.dirty[1] & /*maxOrder*/ 8) {
			$$invalidate(33, scaleY = useRankScale
			? indicator.linear().domain([0, maxOrder]).range([yMin, yMax])
			: indicator.linear().domain(data.valueExtext).range([yMax, yMin]));
		}

		if ($$self.$$.dirty[0] & /*useRankScale, formatFn*/ 1140850688 | $$self.$$.dirty[1] & /*scaleY*/ 4) {
			$$invalidate(14, ticks = scaleY && scaleY.ticks().map(value => ({
				label: useRankScale ? value + 1 : formatFn(value),
				y: scaleY(value)
			})));
		}

		if ($$self.$$.dirty[0] & /*$_layout*/ 512) {
			$$invalidate(5, getX = d => $_layout.scaleX(d.year));
		}

		if ($$self.$$.dirty[0] & /*useRankScale, getIndicatorValue*/ 1207959552 | $$self.$$.dirty[1] & /*scaleY*/ 4) {
			$$invalidate(4, getY = d => useRankScale
			? scaleY(d.order)
			: scaleY(getIndicatorValue(d)));
		}

		if ($$self.$$.dirty[0] & /*getX, getY*/ 48) {
			$$invalidate(32, lineGenerator = line().x(getX).y(getY).curve(monotoneX));
		}

		if ($$self.$$.dirty[0] & /*$_trends*/ 256 | $$self.$$.dirty[1] & /*lineGenerator*/ 2) {
			$$invalidate(13, trendLines = format.map($_trends, indicator.transformValues({
				key: Number,
				value: indicator.applyFnMap({
					path: lineGenerator,
					isSelected: points => points[0].isSelected
				}), // all points have same `id`, so same selection status
				
			})));
		}

		if ($$self.$$.dirty[0] & /*$_layout, width*/ 514) {
			// color
			$$invalidate(31, getStopOffset = d => `${100 * $_layout.scaleX(d.year) / width}%`);
		}

		if ($$self.$$.dirty[0] & /*$_trends, getIndicatorValue, colorScale*/ 150995200 | $$self.$$.dirty[1] & /*getStopOffset*/ 1) {
			$$invalidate(12, gradients = format.map($_trends, indicator.transformValues({
				value: format.mapWith(indicator.applyFnMap({
					offset: getStopOffset,
					stopColor: format.pipe([getIndicatorValue, colorScale])
				}))
			})));
		}

		if ($$self.$$.dirty[0] & /*useRankScale, schema*/ 1342177280) {
			$$invalidate(11, chartTitle = `${useRankScale ? 'Ranking by ' : ''}${schema.value.label}`);
		}

		if ($$self.$$.dirty[0] & /*data, getX, getY, x1, x2, height*/ 33554673) {
			// tooltip
			quadTree = format.isIterableNotEmpty(data.selectedData) && quadtree().x(getX).y(getY).addAll(data.selectedData).extent([[x1, 0], [x2, height]]);
		}
	};

	$$invalidate(16, yLabel = gap + labelFontSize / 2);

	return [
		height,
		width,
		yMax,
		yMin,
		getY,
		getX,
		x2,
		x1,
		$_trends,
		$_layout,
		highlightedId,
		chartTitle,
		gradients,
		trendLines,
		ticks,
		labelUnit,
		yLabel,
		xMed,
		$_availableYears,
		$_tooltip,
		tooltipShift,
		_tooltip,
		onMouseMove,
		onMouseLeave,
		colorScale,
		data,
		formatFn,
		getIndicatorValue,
		schema,
		types,
		useRankScale,
		getStopOffset,
		lineGenerator,
		scaleY,
		maxOrder
	];
}

class TrendsG extends format.SvelteComponent {
	constructor(options) {
		super();

		format.init(
			this,
			options,
			instance$2,
			create_fragment$2,
			format.safe_not_equal,
			{
				colorScale: 24,
				data: 25,
				formatFn: 26,
				getIndicatorValue: 27,
				height: 0,
				schema: 28,
				types: 29,
				useRankScale: 30,
				width: 1
			},
			add_css$2,
			[-1, -1, -1]
		);
	}
}

/* src/node_modules/components/TrendsDiv.svelte generated by Svelte v3.44.2 */

function add_css$1(target) {
	format.append_styles(target, "svelte-1h0p8pj", ".TrendsDiv.svelte-1h0p8pj{height:100%;width:100%}");
}

// (21:1) {#if data && width && height}
function create_if_block$1(ctx) {
	let svg;
	let trendsg;
	let current;

	trendsg = new TrendsG({
			props: {
				colorScale: /*colorScale*/ ctx[0],
				data: /*data*/ ctx[1],
				formatFn: /*formatFn*/ ctx[2],
				getIndicatorValue: /*getIndicatorValue*/ ctx[3],
				schema: /*schema*/ ctx[4],
				types: /*types*/ ctx[5],
				useRankScale: /*useRankScale*/ ctx[6],
				height: /*height*/ ctx[7],
				width: /*width*/ ctx[8]
			}
		});

	return {
		c() {
			svg = format.svg_element("svg");
			format.create_component(trendsg.$$.fragment);
			format.attr(svg, "height", /*height*/ ctx[7]);
			format.attr(svg, "width", /*width*/ ctx[8]);
		},
		m(target, anchor) {
			format.insert(target, svg, anchor);
			format.mount_component(trendsg, svg, null);
			current = true;
		},
		p(ctx, dirty) {
			const trendsg_changes = {};
			if (dirty & /*colorScale*/ 1) trendsg_changes.colorScale = /*colorScale*/ ctx[0];
			if (dirty & /*data*/ 2) trendsg_changes.data = /*data*/ ctx[1];
			if (dirty & /*formatFn*/ 4) trendsg_changes.formatFn = /*formatFn*/ ctx[2];
			if (dirty & /*getIndicatorValue*/ 8) trendsg_changes.getIndicatorValue = /*getIndicatorValue*/ ctx[3];
			if (dirty & /*schema*/ 16) trendsg_changes.schema = /*schema*/ ctx[4];
			if (dirty & /*types*/ 32) trendsg_changes.types = /*types*/ ctx[5];
			if (dirty & /*useRankScale*/ 64) trendsg_changes.useRankScale = /*useRankScale*/ ctx[6];
			if (dirty & /*height*/ 128) trendsg_changes.height = /*height*/ ctx[7];
			if (dirty & /*width*/ 256) trendsg_changes.width = /*width*/ ctx[8];
			trendsg.$set(trendsg_changes);

			if (!current || dirty & /*height*/ 128) {
				format.attr(svg, "height", /*height*/ ctx[7]);
			}

			if (!current || dirty & /*width*/ 256) {
				format.attr(svg, "width", /*width*/ ctx[8]);
			}
		},
		i(local) {
			if (current) return;
			format.transition_in(trendsg.$$.fragment, local);
			current = true;
		},
		o(local) {
			format.transition_out(trendsg.$$.fragment, local);
			current = false;
		},
		d(detaching) {
			if (detaching) format.detach(svg);
			format.destroy_component(trendsg);
		}
	};
}

function create_fragment$1(ctx) {
	let div;
	let div_resize_listener;
	let current;
	let if_block = /*data*/ ctx[1] && /*width*/ ctx[8] && /*height*/ ctx[7] && create_if_block$1(ctx);

	return {
		c() {
			div = format.element("div");
			if (if_block) if_block.c();
			format.attr(div, "class", "TrendsDiv svelte-1h0p8pj");
			format.add_render_callback(() => /*div_elementresize_handler*/ ctx[9].call(div));
		},
		m(target, anchor) {
			format.insert(target, div, anchor);
			if (if_block) if_block.m(div, null);
			div_resize_listener = format.add_resize_listener(div, /*div_elementresize_handler*/ ctx[9].bind(div));
			current = true;
		},
		p(ctx, [dirty]) {
			if (/*data*/ ctx[1] && /*width*/ ctx[8] && /*height*/ ctx[7]) {
				if (if_block) {
					if_block.p(ctx, dirty);

					if (dirty & /*data, width, height*/ 386) {
						format.transition_in(if_block, 1);
					}
				} else {
					if_block = create_if_block$1(ctx);
					if_block.c();
					format.transition_in(if_block, 1);
					if_block.m(div, null);
				}
			} else if (if_block) {
				format.group_outros();

				format.transition_out(if_block, 1, 1, () => {
					if_block = null;
				});

				format.check_outros();
			}
		},
		i(local) {
			if (current) return;
			format.transition_in(if_block);
			current = true;
		},
		o(local) {
			format.transition_out(if_block);
			current = false;
		},
		d(detaching) {
			if (detaching) format.detach(div);
			if (if_block) if_block.d();
			div_resize_listener();
		}
	};
}

function instance$1($$self, $$props, $$invalidate) {
	let { colorScale = null } = $$props;
	let { data = null } = $$props;
	let { formatFn = null } = $$props;
	let { getIndicatorValue = null } = $$props;
	let { schema = null } = $$props;
	let { types = null } = $$props;
	let { useRankScale = false } = $$props;
	let height;
	let width;

	function div_elementresize_handler() {
		height = this.clientHeight;
		width = this.clientWidth;
		$$invalidate(7, height);
		$$invalidate(8, width);
	}

	$$self.$$set = $$props => {
		if ('colorScale' in $$props) $$invalidate(0, colorScale = $$props.colorScale);
		if ('data' in $$props) $$invalidate(1, data = $$props.data);
		if ('formatFn' in $$props) $$invalidate(2, formatFn = $$props.formatFn);
		if ('getIndicatorValue' in $$props) $$invalidate(3, getIndicatorValue = $$props.getIndicatorValue);
		if ('schema' in $$props) $$invalidate(4, schema = $$props.schema);
		if ('types' in $$props) $$invalidate(5, types = $$props.types);
		if ('useRankScale' in $$props) $$invalidate(6, useRankScale = $$props.useRankScale);
	};

	return [
		colorScale,
		data,
		formatFn,
		getIndicatorValue,
		schema,
		types,
		useRankScale,
		height,
		width,
		div_elementresize_handler
	];
}

class TrendsDiv extends format.SvelteComponent {
	constructor(options) {
		super();

		format.init(
			this,
			options,
			instance$1,
			create_fragment$1,
			format.safe_not_equal,
			{
				colorScale: 0,
				data: 1,
				formatFn: 2,
				getIndicatorValue: 3,
				schema: 4,
				types: 5,
				useRankScale: 6
			},
			add_css$1
		);
	}
}

/* src/routes/[id]/index.svelte generated by Svelte v3.44.2 */

function add_css(target) {
	format.append_styles(target, "svelte-4u2au9", ".time_region_value_IdIndex.svelte-4u2au9.svelte-4u2au9{display:grid;grid-template-columns:100%;grid-template-rows:min-content 1fr;height:100%;width:100%}.viewport.svelte-4u2au9.svelte-4u2au9{display:grid;grid-template-rows:100%;height:100%;position:relative}.small.svelte-4u2au9 .viewport.svelte-4u2au9{grid-template-areas:'trends info settings';grid-template-columns:33.333% 33.333% 33.333%;overflow-y:hidden;width:300%}.small.svelte-4u2au9 .viewport.trends.svelte-4u2au9{transform:translate(0%, 0px)}.small.svelte-4u2au9 .viewport.info.svelte-4u2au9{transform:translate(-33.333%, 0px);padding:1.5rem}.small.svelte-4u2au9 .viewport.settings.svelte-4u2au9{transform:translate(-66.666%, 0px)}.view.noData.svelte-4u2au9.svelte-4u2au9{display:block !important}.view.svelte-4u2au9.svelte-4u2au9{height:100%;width:100%;padding:0 var(--dimPadding)}.view.trends.svelte-4u2au9.svelte-4u2au9{display:grid;grid-area:trends;grid-template-areas:'topbox' 'content';grid-template-columns:100%;grid-template-rows:15% 85%}.view.trends.svelte-4u2au9 .topbox.svelte-4u2au9{grid-area:topbox}.view.trends.svelte-4u2au9 .content.svelte-4u2au9{grid-area:content;position:relative}.view.info.svelte-4u2au9.svelte-4u2au9{grid-area:info}.view.settings.svelte-4u2au9.svelte-4u2au9{grid-area:settings}.medium.svelte-4u2au9 .viewport.svelte-4u2au9{grid-template-areas:'topbox' 'content';grid-template-columns:100%;grid-template-rows:10% 90%;padding:0 var(--dimPadding) var(--dimPadding) var(--dimPadding);position:relative;width:100%}.medium.svelte-4u2au9 .viewport .topbox.svelte-4u2au9{grid-area:topbox}.medium.svelte-4u2au9 .viewport .content.svelte-4u2au9{grid-area:content}.medium.svelte-4u2au9 .viewport .content.noData.svelte-4u2au9{display:block}");
}

// (237:2) {:else}
function create_else_block_1(ctx) {
	let div0;
	let settingsrow;
	let t0;
	let div1;
	let current_block_type_index;
	let if_block0;
	let t1;
	let div1_resize_listener;
	let t2;
	let if_block2_anchor;
	let current;

	settingsrow = new config.SettingsRow({
			props: {
				flags: {
					doFilter: /*$_doFilterRegions*/ ctx[25],
					isGeoModalVisible: /*$_geoModal*/ ctx[34].isVisible,
					isRegionsSelectionDirty: /*$_isRegionsSelectionDirty*/ ctx[35],
					showRankingControl: true
				},
				handlers: {
					setLevel: /*setLevel*/ ctx[37],
					toggledFiltering: /*toggledFiltering*/ ctx[38],
					toggledRanking: /*toggledRanking*/ ctx[39],
					toggledGeoModal: config.toggleGeoModal
				}
			}
		});

	const if_block_creators = [create_if_block_4, create_if_block_5];
	const if_blocks = [];

	function select_block_type_2(ctx, dirty) {
		if (/*$_noData*/ ctx[27]) return 0;
		if (/*trendsData*/ ctx[7] && /*mediumTrendsWidth*/ ctx[4] && /*mediumTrendsHeight*/ ctx[1]) return 1;
		return -1;
	}

	if (~(current_block_type_index = select_block_type_2(ctx))) {
		if_block0 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
	}

	let if_block1 = /*$_geoModal*/ ctx[34].isVisible && create_if_block_3();
	let if_block2 = /*$_infoModal*/ ctx[36].isVisible && create_if_block_2(ctx);

	return {
		c() {
			div0 = format.element("div");
			format.create_component(settingsrow.$$.fragment);
			t0 = format.space();
			div1 = format.element("div");
			if (if_block0) if_block0.c();
			t1 = format.space();
			if (if_block1) if_block1.c();
			t2 = format.space();
			if (if_block2) if_block2.c();
			if_block2_anchor = format.empty();
			format.attr(div0, "class", "topbox svelte-4u2au9");
			format.attr(div1, "class", "content svelte-4u2au9");
			format.add_render_callback(() => /*div1_elementresize_handler*/ ctx[46].call(div1));
			format.toggle_class(div1, "noData", /*$_noData*/ ctx[27]);
		},
		m(target, anchor) {
			format.insert(target, div0, anchor);
			format.mount_component(settingsrow, div0, null);
			format.insert(target, t0, anchor);
			format.insert(target, div1, anchor);

			if (~current_block_type_index) {
				if_blocks[current_block_type_index].m(div1, null);
			}

			format.append(div1, t1);
			if (if_block1) if_block1.m(div1, null);
			div1_resize_listener = format.add_resize_listener(div1, /*div1_elementresize_handler*/ ctx[46].bind(div1));
			format.insert(target, t2, anchor);
			if (if_block2) if_block2.m(target, anchor);
			format.insert(target, if_block2_anchor, anchor);
			current = true;
		},
		p(ctx, dirty) {
			const settingsrow_changes = {};

			if (dirty[0] & /*$_doFilterRegions*/ 33554432 | dirty[1] & /*$_geoModal, $_isRegionsSelectionDirty*/ 24) settingsrow_changes.flags = {
				doFilter: /*$_doFilterRegions*/ ctx[25],
				isGeoModalVisible: /*$_geoModal*/ ctx[34].isVisible,
				isRegionsSelectionDirty: /*$_isRegionsSelectionDirty*/ ctx[35],
				showRankingControl: true
			};

			settingsrow.$set(settingsrow_changes);
			let previous_block_index = current_block_type_index;
			current_block_type_index = select_block_type_2(ctx);

			if (current_block_type_index === previous_block_index) {
				if (~current_block_type_index) {
					if_blocks[current_block_type_index].p(ctx, dirty);
				}
			} else {
				if (if_block0) {
					format.group_outros();

					format.transition_out(if_blocks[previous_block_index], 1, 1, () => {
						if_blocks[previous_block_index] = null;
					});

					format.check_outros();
				}

				if (~current_block_type_index) {
					if_block0 = if_blocks[current_block_type_index];

					if (!if_block0) {
						if_block0 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
						if_block0.c();
					} else {
						if_block0.p(ctx, dirty);
					}

					format.transition_in(if_block0, 1);
					if_block0.m(div1, t1);
				} else {
					if_block0 = null;
				}
			}

			if (/*$_geoModal*/ ctx[34].isVisible) {
				if (if_block1) {
					if_block1.p(ctx, dirty);

					if (dirty[1] & /*$_geoModal*/ 8) {
						format.transition_in(if_block1, 1);
					}
				} else {
					if_block1 = create_if_block_3();
					if_block1.c();
					format.transition_in(if_block1, 1);
					if_block1.m(div1, null);
				}
			} else if (if_block1) {
				format.group_outros();

				format.transition_out(if_block1, 1, 1, () => {
					if_block1 = null;
				});

				format.check_outros();
			}

			if (dirty[0] & /*$_noData*/ 134217728) {
				format.toggle_class(div1, "noData", /*$_noData*/ ctx[27]);
			}

			if (/*$_infoModal*/ ctx[36].isVisible) {
				if (if_block2) {
					if_block2.p(ctx, dirty);

					if (dirty[1] & /*$_infoModal*/ 32) {
						format.transition_in(if_block2, 1);
					}
				} else {
					if_block2 = create_if_block_2(ctx);
					if_block2.c();
					format.transition_in(if_block2, 1);
					if_block2.m(if_block2_anchor.parentNode, if_block2_anchor);
				}
			} else if (if_block2) {
				format.group_outros();

				format.transition_out(if_block2, 1, 1, () => {
					if_block2 = null;
				});

				format.check_outros();
			}
		},
		i(local) {
			if (current) return;
			format.transition_in(settingsrow.$$.fragment, local);
			format.transition_in(if_block0);
			format.transition_in(if_block1);
			format.transition_in(if_block2);
			current = true;
		},
		o(local) {
			format.transition_out(settingsrow.$$.fragment, local);
			format.transition_out(if_block0);
			format.transition_out(if_block1);
			format.transition_out(if_block2);
			current = false;
		},
		d(detaching) {
			if (detaching) format.detach(div0);
			format.destroy_component(settingsrow);
			if (detaching) format.detach(t0);
			if (detaching) format.detach(div1);

			if (~current_block_type_index) {
				if_blocks[current_block_type_index].d();
			}

			if (if_block1) if_block1.d();
			div1_resize_listener();
			if (detaching) format.detach(t2);
			if (if_block2) if_block2.d(detaching);
			if (detaching) format.detach(if_block2_anchor);
		}
	};
}

// (153:2) {#if $_isSmallScreen}
function create_if_block(ctx) {
	let div0;
	let current_block_type_index;
	let if_block;
	let t0;
	let div1;
	let infoview;
	let t1;
	let div2;
	let settingsview;
	let current;
	const if_block_creators = [create_if_block_1, create_else_block];
	const if_blocks = [];

	function select_block_type_1(ctx, dirty) {
		if (/*$_noData*/ ctx[27]) return 0;
		return 1;
	}

	current_block_type_index = select_block_type_1(ctx);
	if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);

	infoview = new config.InfoView({
			props: {
				api_doc_url: /*api_doc_url*/ ctx[24],
				api_type: /*api_type*/ ctx[23],
				auth_provider: /*auth_provider*/ ctx[22],
				data_date: /*data_date*/ ctx[21],
				description: /*description*/ ctx[20],
				endpoint_url: /*endpoint_url*/ ctx[19],
				is_experimental: /*is_experimental*/ ctx[18],
				is_public: /*is_public*/ ctx[17],
				query: /*query*/ ctx[16],
				region_types: /*region_types*/ ctx[15],
				source_name: /*source_name*/ ctx[13],
				source_url: /*source_url*/ ctx[12],
				url: /*url*/ ctx[9],
				warning: /*warning*/ ctx[8],
				year_extent: /*year_extent*/ ctx[2]
			}
		});

	settingsview = new config.SettingsView({
			props: {
				flags: {
					doFilter: /*$_doFilterRegions*/ ctx[25],
					showRankingControl: true
				},
				handlers: {
					setLevel: /*setLevel*/ ctx[37],
					toggledFiltering: /*toggledFiltering*/ ctx[38],
					toggledRanking: /*toggledRanking*/ ctx[39]
				}
			}
		});

	return {
		c() {
			div0 = format.element("div");
			if_block.c();
			t0 = format.space();
			div1 = format.element("div");
			format.create_component(infoview.$$.fragment);
			t1 = format.space();
			div2 = format.element("div");
			format.create_component(settingsview.$$.fragment);
			format.attr(div0, "class", "view trends svelte-4u2au9");
			format.toggle_class(div0, "noData", /*$_noData*/ ctx[27]);
			format.attr(div1, "class", "view info svelte-4u2au9");
			format.attr(div2, "class", "view settings svelte-4u2au9");
		},
		m(target, anchor) {
			format.insert(target, div0, anchor);
			if_blocks[current_block_type_index].m(div0, null);
			format.insert(target, t0, anchor);
			format.insert(target, div1, anchor);
			format.mount_component(infoview, div1, null);
			format.insert(target, t1, anchor);
			format.insert(target, div2, anchor);
			format.mount_component(settingsview, div2, null);
			current = true;
		},
		p(ctx, dirty) {
			let previous_block_index = current_block_type_index;
			current_block_type_index = select_block_type_1(ctx);

			if (current_block_type_index === previous_block_index) {
				if_blocks[current_block_type_index].p(ctx, dirty);
			} else {
				format.group_outros();

				format.transition_out(if_blocks[previous_block_index], 1, 1, () => {
					if_blocks[previous_block_index] = null;
				});

				format.check_outros();
				if_block = if_blocks[current_block_type_index];

				if (!if_block) {
					if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
					if_block.c();
				} else {
					if_block.p(ctx, dirty);
				}

				format.transition_in(if_block, 1);
				if_block.m(div0, null);
			}

			if (dirty[0] & /*$_noData*/ 134217728) {
				format.toggle_class(div0, "noData", /*$_noData*/ ctx[27]);
			}

			const infoview_changes = {};
			if (dirty[0] & /*api_doc_url*/ 16777216) infoview_changes.api_doc_url = /*api_doc_url*/ ctx[24];
			if (dirty[0] & /*api_type*/ 8388608) infoview_changes.api_type = /*api_type*/ ctx[23];
			if (dirty[0] & /*auth_provider*/ 4194304) infoview_changes.auth_provider = /*auth_provider*/ ctx[22];
			if (dirty[0] & /*data_date*/ 2097152) infoview_changes.data_date = /*data_date*/ ctx[21];
			if (dirty[0] & /*description*/ 1048576) infoview_changes.description = /*description*/ ctx[20];
			if (dirty[0] & /*endpoint_url*/ 524288) infoview_changes.endpoint_url = /*endpoint_url*/ ctx[19];
			if (dirty[0] & /*is_experimental*/ 262144) infoview_changes.is_experimental = /*is_experimental*/ ctx[18];
			if (dirty[0] & /*is_public*/ 131072) infoview_changes.is_public = /*is_public*/ ctx[17];
			if (dirty[0] & /*query*/ 65536) infoview_changes.query = /*query*/ ctx[16];
			if (dirty[0] & /*region_types*/ 32768) infoview_changes.region_types = /*region_types*/ ctx[15];
			if (dirty[0] & /*source_name*/ 8192) infoview_changes.source_name = /*source_name*/ ctx[13];
			if (dirty[0] & /*source_url*/ 4096) infoview_changes.source_url = /*source_url*/ ctx[12];
			if (dirty[0] & /*url*/ 512) infoview_changes.url = /*url*/ ctx[9];
			if (dirty[0] & /*warning*/ 256) infoview_changes.warning = /*warning*/ ctx[8];
			if (dirty[0] & /*year_extent*/ 4) infoview_changes.year_extent = /*year_extent*/ ctx[2];
			infoview.$set(infoview_changes);
			const settingsview_changes = {};

			if (dirty[0] & /*$_doFilterRegions*/ 33554432) settingsview_changes.flags = {
				doFilter: /*$_doFilterRegions*/ ctx[25],
				showRankingControl: true
			};

			settingsview.$set(settingsview_changes);
		},
		i(local) {
			if (current) return;
			format.transition_in(if_block);
			format.transition_in(infoview.$$.fragment, local);
			format.transition_in(settingsview.$$.fragment, local);
			current = true;
		},
		o(local) {
			format.transition_out(if_block);
			format.transition_out(infoview.$$.fragment, local);
			format.transition_out(settingsview.$$.fragment, local);
			current = false;
		},
		d(detaching) {
			if (detaching) format.detach(div0);
			if_blocks[current_block_type_index].d();
			if (detaching) format.detach(t0);
			if (detaching) format.detach(div1);
			format.destroy_component(infoview);
			if (detaching) format.detach(t1);
			if (detaching) format.detach(div2);
			format.destroy_component(settingsview);
		}
	};
}

// (270:68) 
function create_if_block_5(ctx) {
	let svg;
	let trendsg;
	let g;
	let colorbinsg;
	let g_transform_value;
	let current;

	trendsg = new TrendsG({
			props: {
				schema: /*schema*/ ctx[14],
				types: /*types*/ ctx[0],
				useRankScale: /*useRankScale*/ ctx[5],
				colorScale: /*$_colorScale*/ ctx[32],
				data: /*trendsData*/ ctx[7],
				formatFn: /*$_formatFn*/ ctx[31],
				getIndicatorValue: /*$_getIndicatorValue*/ ctx[33],
				height: /*mediumTrendsHeight*/ ctx[1],
				width: /*mediumTrendsWidth*/ ctx[4]
			}
		});

	colorbinsg = new config.ColorBinsG({
			props: {
				bins: /*$_colorBins*/ ctx[29],
				flags: { isVertical: true, withBackground: true },
				height: /*mediumLegendHeight*/ ctx[6],
				theme: {
					backgroundColor: /*$_theme*/ ctx[30].colorWhite,
					backgroundOpacity: 0.5
				},
				ticksFormatFn: /*$_formatFn*/ ctx[31],
				width: legendBarThickness
			}
		});

	return {
		c() {
			svg = format.svg_element("svg");
			format.create_component(trendsg.$$.fragment);
			g = format.svg_element("g");
			format.create_component(colorbinsg.$$.fragment);
			format.attr(g, "transform", g_transform_value = "translate(0," + /*mediumLegendHeight*/ ctx[6] + ")");
			format.attr(svg, "height", /*mediumTrendsHeight*/ ctx[1]);
			format.attr(svg, "width", /*mediumTrendsWidth*/ ctx[4]);
		},
		m(target, anchor) {
			format.insert(target, svg, anchor);
			format.mount_component(trendsg, svg, null);
			format.append(svg, g);
			format.mount_component(colorbinsg, g, null);
			current = true;
		},
		p(ctx, dirty) {
			const trendsg_changes = {};
			if (dirty[0] & /*schema*/ 16384) trendsg_changes.schema = /*schema*/ ctx[14];
			if (dirty[0] & /*types*/ 1) trendsg_changes.types = /*types*/ ctx[0];
			if (dirty[0] & /*useRankScale*/ 32) trendsg_changes.useRankScale = /*useRankScale*/ ctx[5];
			if (dirty[1] & /*$_colorScale*/ 2) trendsg_changes.colorScale = /*$_colorScale*/ ctx[32];
			if (dirty[0] & /*trendsData*/ 128) trendsg_changes.data = /*trendsData*/ ctx[7];
			if (dirty[1] & /*$_formatFn*/ 1) trendsg_changes.formatFn = /*$_formatFn*/ ctx[31];
			if (dirty[1] & /*$_getIndicatorValue*/ 4) trendsg_changes.getIndicatorValue = /*$_getIndicatorValue*/ ctx[33];
			if (dirty[0] & /*mediumTrendsHeight*/ 2) trendsg_changes.height = /*mediumTrendsHeight*/ ctx[1];
			if (dirty[0] & /*mediumTrendsWidth*/ 16) trendsg_changes.width = /*mediumTrendsWidth*/ ctx[4];
			trendsg.$set(trendsg_changes);
			const colorbinsg_changes = {};
			if (dirty[0] & /*$_colorBins*/ 536870912) colorbinsg_changes.bins = /*$_colorBins*/ ctx[29];
			if (dirty[0] & /*mediumLegendHeight*/ 64) colorbinsg_changes.height = /*mediumLegendHeight*/ ctx[6];

			if (dirty[0] & /*$_theme*/ 1073741824) colorbinsg_changes.theme = {
				backgroundColor: /*$_theme*/ ctx[30].colorWhite,
				backgroundOpacity: 0.5
			};

			if (dirty[1] & /*$_formatFn*/ 1) colorbinsg_changes.ticksFormatFn = /*$_formatFn*/ ctx[31];
			colorbinsg.$set(colorbinsg_changes);

			if (!current || dirty[0] & /*mediumLegendHeight*/ 64 && g_transform_value !== (g_transform_value = "translate(0," + /*mediumLegendHeight*/ ctx[6] + ")")) {
				format.attr(g, "transform", g_transform_value);
			}

			if (!current || dirty[0] & /*mediumTrendsHeight*/ 2) {
				format.attr(svg, "height", /*mediumTrendsHeight*/ ctx[1]);
			}

			if (!current || dirty[0] & /*mediumTrendsWidth*/ 16) {
				format.attr(svg, "width", /*mediumTrendsWidth*/ ctx[4]);
			}
		},
		i(local) {
			if (current) return;
			format.transition_in(trendsg.$$.fragment, local);
			format.transition_in(colorbinsg.$$.fragment, local);
			current = true;
		},
		o(local) {
			format.transition_out(trendsg.$$.fragment, local);
			format.transition_out(colorbinsg.$$.fragment, local);
			current = false;
		},
		d(detaching) {
			if (detaching) format.detach(svg);
			format.destroy_component(trendsg);
			format.destroy_component(colorbinsg);
		}
	};
}

// (268:4) {#if $_noData}
function create_if_block_4(ctx) {
	let messageview;
	let current;
	messageview = new config.MessageView({ props: { text: "No data" } });

	return {
		c() {
			format.create_component(messageview.$$.fragment);
		},
		m(target, anchor) {
			format.mount_component(messageview, target, anchor);
			current = true;
		},
		p: format.noop,
		i(local) {
			if (current) return;
			format.transition_in(messageview.$$.fragment, local);
			current = true;
		},
		o(local) {
			format.transition_out(messageview.$$.fragment, local);
			current = false;
		},
		d(detaching) {
			format.destroy_component(messageview, detaching);
		}
	};
}

// (313:4) {#if $_geoModal.isVisible}
function create_if_block_3(ctx) {
	let geofiltermodal;
	let current;
	geofiltermodal = new config.GeoFilterModal({});
	geofiltermodal.$on("click", config.toggleGeoModal);

	return {
		c() {
			format.create_component(geofiltermodal.$$.fragment);
		},
		m(target, anchor) {
			format.mount_component(geofiltermodal, target, anchor);
			current = true;
		},
		p: format.noop,
		i(local) {
			if (current) return;
			format.transition_in(geofiltermodal.$$.fragment, local);
			current = true;
		},
		o(local) {
			format.transition_out(geofiltermodal.$$.fragment, local);
			current = false;
		},
		d(detaching) {
			format.destroy_component(geofiltermodal, detaching);
		}
	};
}

// (321:3) {#if $_infoModal.isVisible}
function create_if_block_2(ctx) {
	let infomodal;
	let current;

	infomodal = new config.InfoModal({
			props: {
				api_doc_url: /*api_doc_url*/ ctx[24],
				api_type: /*api_type*/ ctx[23],
				auth_provider: /*auth_provider*/ ctx[22],
				data_date: /*data_date*/ ctx[21],
				description: /*description*/ ctx[20],
				endpoint_url: /*endpoint_url*/ ctx[19],
				is_public: /*is_public*/ ctx[17],
				is_experimental: /*is_experimental*/ ctx[18],
				query: /*query*/ ctx[16],
				region_types: /*region_types*/ ctx[15],
				source_name: /*source_name*/ ctx[13],
				source_url: /*source_url*/ ctx[12],
				url: /*url*/ ctx[9],
				warning: /*warning*/ ctx[8],
				year_extent: /*year_extent*/ ctx[2]
			}
		});

	infomodal.$on("click", config.toggleInfoModal);

	return {
		c() {
			format.create_component(infomodal.$$.fragment);
		},
		m(target, anchor) {
			format.mount_component(infomodal, target, anchor);
			current = true;
		},
		p(ctx, dirty) {
			const infomodal_changes = {};
			if (dirty[0] & /*api_doc_url*/ 16777216) infomodal_changes.api_doc_url = /*api_doc_url*/ ctx[24];
			if (dirty[0] & /*api_type*/ 8388608) infomodal_changes.api_type = /*api_type*/ ctx[23];
			if (dirty[0] & /*auth_provider*/ 4194304) infomodal_changes.auth_provider = /*auth_provider*/ ctx[22];
			if (dirty[0] & /*data_date*/ 2097152) infomodal_changes.data_date = /*data_date*/ ctx[21];
			if (dirty[0] & /*description*/ 1048576) infomodal_changes.description = /*description*/ ctx[20];
			if (dirty[0] & /*endpoint_url*/ 524288) infomodal_changes.endpoint_url = /*endpoint_url*/ ctx[19];
			if (dirty[0] & /*is_public*/ 131072) infomodal_changes.is_public = /*is_public*/ ctx[17];
			if (dirty[0] & /*is_experimental*/ 262144) infomodal_changes.is_experimental = /*is_experimental*/ ctx[18];
			if (dirty[0] & /*query*/ 65536) infomodal_changes.query = /*query*/ ctx[16];
			if (dirty[0] & /*region_types*/ 32768) infomodal_changes.region_types = /*region_types*/ ctx[15];
			if (dirty[0] & /*source_name*/ 8192) infomodal_changes.source_name = /*source_name*/ ctx[13];
			if (dirty[0] & /*source_url*/ 4096) infomodal_changes.source_url = /*source_url*/ ctx[12];
			if (dirty[0] & /*url*/ 512) infomodal_changes.url = /*url*/ ctx[9];
			if (dirty[0] & /*warning*/ 256) infomodal_changes.warning = /*warning*/ ctx[8];
			if (dirty[0] & /*year_extent*/ 4) infomodal_changes.year_extent = /*year_extent*/ ctx[2];
			infomodal.$set(infomodal_changes);
		},
		i(local) {
			if (current) return;
			format.transition_in(infomodal.$$.fragment, local);
			current = true;
		},
		o(local) {
			format.transition_out(infomodal.$$.fragment, local);
			current = false;
		},
		d(detaching) {
			format.destroy_component(infomodal, detaching);
		}
	};
}

// (165:4) {:else}
function create_else_block(ctx) {
	let div0;
	let colorbinsdiv;
	let t;
	let div1;
	let trendsdiv;
	let current;

	colorbinsdiv = new config.ColorBinsDiv({
			props: {
				bins: /*$_colorBins*/ ctx[29],
				geometry: { barThickness: 15, left: 30, right: 30 },
				flags: {
					withBackground: true,
					showTicksExtentOnly: true
				},
				theme: {
					backgroundColor: /*$_theme*/ ctx[30].colorWhite,
					backgroundOpacity: 0.5
				},
				ticksFormatFn: /*$_formatFn*/ ctx[31]
			}
		});

	trendsdiv = new TrendsDiv({
			props: {
				schema: /*schema*/ ctx[14],
				types: /*types*/ ctx[0],
				useRankScale: /*useRankScale*/ ctx[5],
				colorScale: /*$_colorScale*/ ctx[32],
				data: /*trendsData*/ ctx[7],
				formatFn: /*$_formatFn*/ ctx[31],
				getIndicatorValue: /*$_getIndicatorValue*/ ctx[33]
			}
		});

	return {
		c() {
			div0 = format.element("div");
			format.create_component(colorbinsdiv.$$.fragment);
			t = format.space();
			div1 = format.element("div");
			format.create_component(trendsdiv.$$.fragment);
			format.attr(div0, "class", "topbox svelte-4u2au9");
			format.attr(div1, "class", "content svelte-4u2au9");
		},
		m(target, anchor) {
			format.insert(target, div0, anchor);
			format.mount_component(colorbinsdiv, div0, null);
			format.insert(target, t, anchor);
			format.insert(target, div1, anchor);
			format.mount_component(trendsdiv, div1, null);
			current = true;
		},
		p(ctx, dirty) {
			const colorbinsdiv_changes = {};
			if (dirty[0] & /*$_colorBins*/ 536870912) colorbinsdiv_changes.bins = /*$_colorBins*/ ctx[29];

			if (dirty[0] & /*$_theme*/ 1073741824) colorbinsdiv_changes.theme = {
				backgroundColor: /*$_theme*/ ctx[30].colorWhite,
				backgroundOpacity: 0.5
			};

			if (dirty[1] & /*$_formatFn*/ 1) colorbinsdiv_changes.ticksFormatFn = /*$_formatFn*/ ctx[31];
			colorbinsdiv.$set(colorbinsdiv_changes);
			const trendsdiv_changes = {};
			if (dirty[0] & /*schema*/ 16384) trendsdiv_changes.schema = /*schema*/ ctx[14];
			if (dirty[0] & /*types*/ 1) trendsdiv_changes.types = /*types*/ ctx[0];
			if (dirty[0] & /*useRankScale*/ 32) trendsdiv_changes.useRankScale = /*useRankScale*/ ctx[5];
			if (dirty[1] & /*$_colorScale*/ 2) trendsdiv_changes.colorScale = /*$_colorScale*/ ctx[32];
			if (dirty[0] & /*trendsData*/ 128) trendsdiv_changes.data = /*trendsData*/ ctx[7];
			if (dirty[1] & /*$_formatFn*/ 1) trendsdiv_changes.formatFn = /*$_formatFn*/ ctx[31];
			if (dirty[1] & /*$_getIndicatorValue*/ 4) trendsdiv_changes.getIndicatorValue = /*$_getIndicatorValue*/ ctx[33];
			trendsdiv.$set(trendsdiv_changes);
		},
		i(local) {
			if (current) return;
			format.transition_in(colorbinsdiv.$$.fragment, local);
			format.transition_in(trendsdiv.$$.fragment, local);
			current = true;
		},
		o(local) {
			format.transition_out(colorbinsdiv.$$.fragment, local);
			format.transition_out(trendsdiv.$$.fragment, local);
			current = false;
		},
		d(detaching) {
			if (detaching) format.detach(div0);
			format.destroy_component(colorbinsdiv);
			if (detaching) format.detach(t);
			if (detaching) format.detach(div1);
			format.destroy_component(trendsdiv);
		}
	};
}

// (163:4) {#if $_noData}
function create_if_block_1(ctx) {
	let messageview;
	let current;
	messageview = new config.MessageView({ props: { text: config.config.noDataMessage } });

	return {
		c() {
			format.create_component(messageview.$$.fragment);
		},
		m(target, anchor) {
			format.mount_component(messageview, target, anchor);
			current = true;
		},
		p: format.noop,
		i(local) {
			if (current) return;
			format.transition_in(messageview.$$.fragment, local);
			current = true;
		},
		o(local) {
			format.transition_out(messageview.$$.fragment, local);
			current = false;
		},
		d(detaching) {
			format.destroy_component(messageview, detaching);
		}
	};
}

function create_fragment(ctx) {
	let div1;
	let header;
	let t;
	let div0;
	let current_block_type_index;
	let if_block;
	let div0_class_value;
	let div1_class_value;
	let current;

	header = new config.Header({
			props: {
				subtitle: /*subtitle*/ ctx[11],
				title: /*title*/ ctx[10]
			}
		});

	header.$on("click", config.toggleInfoModal);
	const if_block_creators = [create_if_block, create_else_block_1];
	const if_blocks = [];

	function select_block_type(ctx, dirty) {
		if (/*$_isSmallScreen*/ ctx[3]) return 0;
		return 1;
	}

	current_block_type_index = select_block_type(ctx);
	if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);

	return {
		c() {
			div1 = format.element("div");
			format.create_component(header.$$.fragment);
			t = format.space();
			div0 = format.element("div");
			if_block.c();
			format.attr(div0, "class", div0_class_value = "viewport " + /*$_viewsClasses*/ ctx[28] + " svelte-4u2au9");
			format.toggle_class(div0, "noData", /*$_noData*/ ctx[27]);
			format.attr(div1, "class", div1_class_value = "time_region_value_IdIndex " + /*$_screenClasses*/ ctx[26] + " svelte-4u2au9");
		},
		m(target, anchor) {
			format.insert(target, div1, anchor);
			format.mount_component(header, div1, null);
			format.append(div1, t);
			format.append(div1, div0);
			if_blocks[current_block_type_index].m(div0, null);
			current = true;
		},
		p(ctx, dirty) {
			const header_changes = {};
			if (dirty[0] & /*subtitle*/ 2048) header_changes.subtitle = /*subtitle*/ ctx[11];
			if (dirty[0] & /*title*/ 1024) header_changes.title = /*title*/ ctx[10];
			header.$set(header_changes);
			let previous_block_index = current_block_type_index;
			current_block_type_index = select_block_type(ctx);

			if (current_block_type_index === previous_block_index) {
				if_blocks[current_block_type_index].p(ctx, dirty);
			} else {
				format.group_outros();

				format.transition_out(if_blocks[previous_block_index], 1, 1, () => {
					if_blocks[previous_block_index] = null;
				});

				format.check_outros();
				if_block = if_blocks[current_block_type_index];

				if (!if_block) {
					if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
					if_block.c();
				} else {
					if_block.p(ctx, dirty);
				}

				format.transition_in(if_block, 1);
				if_block.m(div0, null);
			}

			if (!current || dirty[0] & /*$_viewsClasses*/ 268435456 && div0_class_value !== (div0_class_value = "viewport " + /*$_viewsClasses*/ ctx[28] + " svelte-4u2au9")) {
				format.attr(div0, "class", div0_class_value);
			}

			if (dirty[0] & /*$_viewsClasses, $_noData*/ 402653184) {
				format.toggle_class(div0, "noData", /*$_noData*/ ctx[27]);
			}

			if (!current || dirty[0] & /*$_screenClasses*/ 67108864 && div1_class_value !== (div1_class_value = "time_region_value_IdIndex " + /*$_screenClasses*/ ctx[26] + " svelte-4u2au9")) {
				format.attr(div1, "class", div1_class_value);
			}
		},
		i(local) {
			if (current) return;
			format.transition_in(header.$$.fragment, local);
			format.transition_in(if_block);
			current = true;
		},
		o(local) {
			format.transition_out(header.$$.fragment, local);
			format.transition_out(if_block);
			current = false;
		},
		d(detaching) {
			if (detaching) format.detach(div1);
			format.destroy_component(header);
			if_blocks[current_block_type_index].d();
		}
	};
}

const legendBarThickness = 40;

function instance($$self, $$props, $$invalidate) {
	let api_doc_url;
	let api_type;
	let auth_provider;
	let data_date;
	let description;
	let endpoint_url;
	let is_experimental;
	let is_public;
	let query;
	let region_types;
	let schema;
	let source_name;
	let source_url;
	let subtitle;
	let title;
	let url;
	let warning;
	let year_extent;
	let trendsData;
	let mediumLegendHeight;
	let $_doFilterRegions;
	let $_valueExtext;
	let $_rankedData;
	let $_selectedData;
	let $_lookup;
	let $_isSmallScreen;
	let $_screenClasses;
	let $_noData;
	let $_viewsClasses;
	let $_colorBins;
	let $_theme;
	let $_formatFn;
	let $_colorScale;
	let $_getIndicatorValue;
	let $_geoModal;
	let $_isRegionsSelectionDirty;
	let $_infoModal;
	format.component_subscribe($$self, indicator._doFilterRegions, $$value => $$invalidate(25, $_doFilterRegions = $$value));
	format.component_subscribe($$self, indicator._valueExtext, $$value => $$invalidate(42, $_valueExtext = $$value));
	format.component_subscribe($$self, indicator._rankedData, $$value => $$invalidate(43, $_rankedData = $$value));
	format.component_subscribe($$self, indicator._selectedData, $$value => $$invalidate(44, $_selectedData = $$value));
	format.component_subscribe($$self, format._lookup, $$value => $$invalidate(45, $_lookup = $$value));
	format.component_subscribe($$self, format._isSmallScreen, $$value => $$invalidate(3, $_isSmallScreen = $$value));
	format.component_subscribe($$self, format._screenClasses, $$value => $$invalidate(26, $_screenClasses = $$value));
	format.component_subscribe($$self, indicator._noData, $$value => $$invalidate(27, $_noData = $$value));
	format.component_subscribe($$self, format._viewsClasses, $$value => $$invalidate(28, $_viewsClasses = $$value));
	format.component_subscribe($$self, indicator._colorBins, $$value => $$invalidate(29, $_colorBins = $$value));
	format.component_subscribe($$self, indicator._theme, $$value => $$invalidate(30, $_theme = $$value));
	format.component_subscribe($$self, indicator._formatFn, $$value => $$invalidate(31, $_formatFn = $$value));
	format.component_subscribe($$self, indicator._colorScale, $$value => $$invalidate(32, $_colorScale = $$value));
	format.component_subscribe($$self, indicator._getIndicatorValue, $$value => $$invalidate(33, $_getIndicatorValue = $$value));
	format.component_subscribe($$self, config._geoModal, $$value => $$invalidate(34, $_geoModal = $$value));
	format.component_subscribe($$self, indicator._isRegionsSelectionDirty, $$value => $$invalidate(35, $_isRegionsSelectionDirty = $$value));
	format.component_subscribe($$self, config._infoModal, $$value => $$invalidate(36, $_infoModal = $$value));
	let { data = null } = $$props;
	let { id = null } = $$props;
	let { types = null } = $$props;

	/* init */
	format.onMount(() => {
		format.setRoute('Id');
	});

	/* local vars */
	// bound
	let mediumTrendsHeight;

	let mediumTrendsWidth;

	// rest
	let useRankScale = false;

	/* event handlers */
	const setLevel = ({ detail: level }) => indicator.setCurrentLevel(level);

	const toggledFiltering = ({ detail }) => {
		format.set_store_value(indicator._doFilterRegions, $_doFilterRegions = detail === 'Filter', $_doFilterRegions);
	};

	const toggledRanking = ({ detail }) => {
		$$invalidate(5, useRankScale = detail === 'Ranking');
	};

	function div1_elementresize_handler() {
		mediumTrendsHeight = this.clientHeight;
		mediumTrendsWidth = this.clientWidth;
		$$invalidate(1, mediumTrendsHeight);
		$$invalidate(4, mediumTrendsWidth);
	}

	$$self.$$set = $$props => {
		if ('data' in $$props) $$invalidate(40, data = $$props.data);
		if ('id' in $$props) $$invalidate(41, id = $$props.id);
		if ('types' in $$props) $$invalidate(0, types = $$props.types);
	};

	$$self.$$.update = () => {
		if ($$self.$$.dirty[0] & /*$_isSmallScreen*/ 8) {
			/* reactive vars */
			// navigation
			$_isSmallScreen && config.hideGeoModal();
		}

		if ($$self.$$.dirty[0] & /*$_isSmallScreen*/ 8) {
			$_isSmallScreen && config.hideInfoModal();
		}

		if ($$self.$$.dirty[1] & /*id*/ 1024) {
			id && format.showView('trends');
		}

		if ($$self.$$.dirty[1] & /*id*/ 1024) {
			id && format.resetSelectedYear();
		}

		if ($$self.$$.dirty[1] & /*id, data*/ 1536) {
			id && data && indicator._indicator.set({ data, id });
		}

		if ($$self.$$.dirty[1] & /*$_lookup, id*/ 17408) {
			$$invalidate(24, { api_doc_url, api_type, auth_provider, data_date, description, endpoint_url, is_experimental, is_public, query, region_types, schema, source_name, source_url, subtitle, title, url, warning, year_extent } = $_lookup[id] || {}, api_doc_url, (($$invalidate(23, api_type), $$invalidate(45, $_lookup)), $$invalidate(41, id)), (($$invalidate(22, auth_provider), $$invalidate(45, $_lookup)), $$invalidate(41, id)), (($$invalidate(21, data_date), $$invalidate(45, $_lookup)), $$invalidate(41, id)), (($$invalidate(20, description), $$invalidate(45, $_lookup)), $$invalidate(41, id)), (($$invalidate(19, endpoint_url), $$invalidate(45, $_lookup)), $$invalidate(41, id)), (($$invalidate(18, is_experimental), $$invalidate(45, $_lookup)), $$invalidate(41, id)), (($$invalidate(17, is_public), $$invalidate(45, $_lookup)), $$invalidate(41, id)), (($$invalidate(16, query), $$invalidate(45, $_lookup)), $$invalidate(41, id)), (($$invalidate(15, region_types), $$invalidate(45, $_lookup)), $$invalidate(41, id)), (($$invalidate(14, schema), $$invalidate(45, $_lookup)), $$invalidate(41, id)), (($$invalidate(13, source_name), $$invalidate(45, $_lookup)), $$invalidate(41, id)), (($$invalidate(12, source_url), $$invalidate(45, $_lookup)), $$invalidate(41, id)), (($$invalidate(11, subtitle), $$invalidate(45, $_lookup)), $$invalidate(41, id)), (($$invalidate(10, title), $$invalidate(45, $_lookup)), $$invalidate(41, id)), (($$invalidate(9, url), $$invalidate(45, $_lookup)), $$invalidate(41, id)), (($$invalidate(8, warning), $$invalidate(45, $_lookup)), $$invalidate(41, id)), (($$invalidate(2, year_extent), $$invalidate(45, $_lookup)), $$invalidate(41, id)));
		}

		if ($$self.$$.dirty[0] & /*year_extent*/ 4 | $$self.$$.dirty[1] & /*$_selectedData, $_rankedData, $_valueExtext*/ 14336) {
			// selection
			$$invalidate(7, trendsData = {
				selectedData: $_selectedData,
				rankedData: $_rankedData,
				valueExtext: $_valueExtext,
				year_extent
			});
		}

		if ($$self.$$.dirty[0] & /*mediumTrendsHeight*/ 2) {
			// layout
			$$invalidate(6, mediumLegendHeight = mediumTrendsHeight / 3);
		}
	};

	return [
		types,
		mediumTrendsHeight,
		year_extent,
		$_isSmallScreen,
		mediumTrendsWidth,
		useRankScale,
		mediumLegendHeight,
		trendsData,
		warning,
		url,
		title,
		subtitle,
		source_url,
		source_name,
		schema,
		region_types,
		query,
		is_public,
		is_experimental,
		endpoint_url,
		description,
		data_date,
		auth_provider,
		api_type,
		api_doc_url,
		$_doFilterRegions,
		$_screenClasses,
		$_noData,
		$_viewsClasses,
		$_colorBins,
		$_theme,
		$_formatFn,
		$_colorScale,
		$_getIndicatorValue,
		$_geoModal,
		$_isRegionsSelectionDirty,
		$_infoModal,
		setLevel,
		toggledFiltering,
		toggledRanking,
		data,
		id,
		$_valueExtext,
		$_rankedData,
		$_selectedData,
		$_lookup,
		div1_elementresize_handler
	];
}

class U5Bidu5D extends format.SvelteComponent {
	constructor(options) {
		super();
		format.init(this, options, instance, create_fragment, format.safe_not_equal, { data: 40, id: 41, types: 0 }, add_css, [-1, -1]);
	}
}

module.exports = U5Bidu5D;
