#!/usr/bin/env python

# Copyright (c) 2018, DIANA-HEP
# All rights reserved.
# 
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 
# * Redistributions of source code must retain the above copyright notice, this
#   list of conditions and the following disclaimer.
# 
# * Redistributions in binary form must reproduce the above copyright notice,
#   this list of conditions and the following disclaimer in the documentation
#   and/or other materials provided with the distribution.
# 
# * Neither the name of the copyright holder nor the names of its
#   contributors may be used to endorse or promote products derived from
#   this software without specific prior written permission.
# 
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import argparse
import errno
import getpass
import json
import os
import re
import socket
import sys
import threading
import time
import webbrowser

if sys.version_info[0] < 3:
    import SimpleHTTPServer
    import SocketServer
    from urllib2 import urlopen
    from urlparse import urlparse
    class BrokenPipeError(Exception): pass
else:
    import http.server as SimpleHTTPServer
    import socketserver as SocketServer
    from urllib.request import urlopen
    from urllib.parse import urlparse
    unicode = str

__version__ = "1.0.7"
version = __version__
version_info = tuple(re.split(r"[-\.]", __version__))

class Canvas(object):
    """A general Vega canvas that can be viewed anywhere on the internet.

    Args:
        title (string or None): title for this canvas, can be changed, used as a file name for saved graphics.
        initial (string, dict, or None; URL or JSON): first Vega graphic to display, defaults to logo.
        host (string): host name to bind to, default is "0.0.0.0" for any address.
        port (integer): port to bind to, default is 0 for any open port.
        verbose (boolean): if True (default), print messages when web browsers connect or disconnect.

    Attributes:
        connection (dict): web browser URL and possibly terminal command (for TunnelCanvas).
        title (string): current title.
        spec (string or dict; URL or JSON): current Vega graphic.
        httpd (socketserver.ThreadingTCPServer): web server object.
        ip (string): IP address of server as seen from outside ("localhost" for LocalCanvas and TunnelCanvas).
        host (string): actual host used by web server.
        port (string): actual port used by web server.
        thread (threading.Thread): thread in which the web server is running.
        connected (list of strings): currently connected web browser clients.
        closed (boolean): True if the server has shut down, False otherwise.
    """

    def __init__(self, title=None, initial=None, host="0.0.0.0", port=0, verbose=True):
        self._lock = threading.Lock()

        if title is None:
            self._title = "VegaScope"
        else:
            self._title = title

        if initial is None:
            self.spec = Canvas._default
        else:
            self.spec = initial

        self._action = None
        self._actionevent = threading.Event()

        canvas = self

        class FakeFile(object):
            @property
            def closed(self):
                return True
            def close(self):
                pass
            def flush(self):
                pass

        class HTTPHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
            def do_HEAD(self):
                pass

            def do_GET(self):
                if self.path == "/":
                    self.send_response(200)
                    self.send_header("Content-type", "text/html")
                    self.end_headers()
                    page = canvas._template.replace("VEGAVIEW", "#vegaview").replace("TITLE", canvas._title).replace("SPEC", canvas._spec).encode("utf-8")
                    self.wfile.write(page)

                elif self.path == "/update":
                    self.send_response(200)
                    self.send_header("Content-type", "text/event-stream")
                    self.end_headers()
                    client = self.client_address[0]
                    canvas._connected.add(client)
                    if canvas.verbose:
                        sys.stdout.write("{0} connected\n".format(client))
                        sys.stdout.flush()

                    title = canvas._title
                    spec = canvas._spec
                    try:
                        while not self.wfile.closed:
                            time.sleep(0.1)
                            with canvas._lock:
                                if canvas._spec is None:
                                    break
                                elif spec != canvas._spec or title != canvas._title or canvas._action is not None:
                                    spec = canvas._spec
                                    title = canvas._title
                                    self.wfile.write(b"data: " + json.dumps({"title": title, "spec": json.loads(spec), "action": canvas._action}).encode("utf-8") + b"\n\n")
                                    canvas._action = None
                                    canvas._actionevent.set()
                                else:
                                    self.wfile.write(":\n\n".encode("utf-8"))
                            self.wfile.flush()
                            
                    except socket.error as err:
                        if isinstance(err, BrokenPipeError) or err[0] == errno.EPIPE:
                            self.wfile = FakeFile()
                        else:
                            raise

                    finally:
                        canvas._connected.discard(client)
                        if canvas.verbose:
                            sys.stdout.write("{0} disconnected\n".format(client))
                            sys.stdout.flush()

                elif self.path == "/vega.min.js":
                    self.send_response(200)
                    self.send_header("Content-type", "application/javascript")
                    self.end_headers()
                    self.wfile.write(canvas._vega)

                elif self.path == "/vega-lite.min.js":
                    self.send_response(200)
                    self.send_header("Content-type", "application/javascript")
                    self.end_headers()
                    self.wfile.write(canvas._vegalite)

                elif self.path == "/vega-embed.min.js":
                    self.send_response(200)
                    self.send_header("Content-type", "application/javascript")
                    self.end_headers()
                    self.wfile.write(canvas._vegaembed)

            def log_request(self, code="-", size="-"):
                pass

            def log_error(self, format, *args):
                pass

            def log_message(self, format, *args):
                pass

        self._httpd = SocketServer.ThreadingTCPServer((host, port), HTTPHandler)
        self._httpd.daemon_threads = True
        self._host, self._port = self._httpd.server_address

        self._thread = threading.Thread(name=self._title, target=self._httpd.serve_forever)
        self._thread.daemon = True
        self._thread.start()

        self.verbose = verbose
        self._connected = set()

        self._launch()

    def _launch(self):
        if self.verbose:
            self.how()

    @property
    def title(self):
        return self._title

    @title.setter
    def title(self, value):
        self._specify(value, None, None)

    @property
    def spec(self):
        return self._spec

    @spec.setter
    def spec(self, value):
        self._specify(None, value, None)

    def __call__(self, spec):
        """Update the Vega graphic to spec (string or dict; URL or JSON).
        """
        self._specify(None, spec, None)

    def png(self, spec, title=None):
        """Update the Vega graphic to spec, optionally set a title, and make connected web clients save the image as PNG.

        Note that pop-up blockers won't let remote servers save files on your computer without your permission. You will probably have to respond to the pop-up blocker's notice to enable pop-ups and try again (once per host/port combination).

        This method blocks until the PNG request has been sent, so it can be called in a loop to make lots of files.

        Args:
            spec (string or dict; URL or JSON): new Vega graphic.
            title (string or None): new title.
        """
        self._specify(title, spec, "png")
        self._actionevent.wait()

    def svg(self, spec, title=None):
        """Update the Vega graphic to spec, optionally set a title, and make connected web clients save the image as SVG.

        Note that pop-up blockers won't let remote servers save files on your computer without your permission. You will probably have to respond to the pop-up blocker's notice to enable pop-ups and try again (once per host/port combination).

        This method blocks until the SVG request has been sent, so it can be called in a loop to make lots of files.

        SVG files can be converted into clean, rescalable PDFs.

        Args:
            spec (string or dict; URL or JSON): new Vega graphic.
            title (string or None): new title.
        """
        self._specify(title, spec, "svg")
        self._actionevent.wait()

    def _specify(self, title, spec, action):
        with self._lock:
            if title is not None:
                if isinstance(title, (unicode, str)):
                    self._title = title
                else:
                    raise TypeError("title must be a string")

            if spec is not None:
                if isinstance(spec, bytes):
                    spec = spec.decode("utf-8")

                if isinstance(spec, (unicode, str)):
                    p = urlparse(spec)
                    if p.scheme != "":
                        self._spec = json.dumps(spec)                                 # spec is a URL; wrap it with quotes for JSON
                    else:
                        self._spec = json.dumps(json.loads(spec), allow_nan=False)    # not a URL; ensure that it's JSON and a one-liner
                else:
                    # PdVega
                    if spec.__class__.__module__.startswith("pdvega") and hasattr(spec, "spec"):
                        spec = spec.spec
                    # Altair
                    elif hasattr(spec, "to_json") and callable(spec.to_json):
                        spec = json.loads(spec.to_json())

                    self._spec = json.dumps(spec, allow_nan=False)                    # spec is an object; encode it as JSON

            if action is not None:
                self._action = action

    @property
    def httpd(self):
        return self._httpd

    @property
    def host(self):
        return self._host

    @property
    def port(self):
        return self._port

    @property
    def thread(self):
        return self._thread

    @property
    def connected(self):
        return sorted(self._connected)

    def close(self):
        """Shut down the web server, disconnecting all client browsers.
        """
        self._spec = None
        if hasattr(self, "_httpd"):
            self._httpd.shutdown()
            self._httpd.server_close()

    @property
    def closed(self):
        return self._spec is None

    def __del__(self):
        if not self.closed:
            self.close()

    def __enter__(self, *args, **kwds):
        return self

    def __exit__(self, *args, **kwds):
        if not self.closed:
            self.close()

    @property
    def connection(self):
        return {"browser": "http://{ip}:{port}".format(ip=self.ip, port=self._port)}

    def how(self):
        """Print instructions for connecting to the web server.

        Called automatically by the constructor unless verbose=False.
        """
        connection = self.connection
        if "terminal" in connection:
            sys.stdout.write("Type into terminal:   " + connection["terminal"] + "\n")
        sys.stdout.write("Point web browser at: " + connection["browser"] + "\n")
        sys.stdout.flush()
        
    @property
    def ip(self):
        return urlopen("https://v4.ident.me").read().decode("ascii").strip()

class LocalCanvas(Canvas):
    """A Vega canvas that can only be viewed by the machine on which it is running.
    """
    __doc__ += "\n".join(Canvas.__doc__.split("\n")[1:])

    def __init__(self, title=None, initial=None, port=0, verbose=True, newtab=True):
        self._newtab = newtab
        super(LocalCanvas, self).__init__(title=title, initial=initial, host="localhost", port=port, verbose=verbose)

    def _launch(self):
        if self.verbose and not self._newtab:
            self.how()
        if self._newtab:
            webbrowser.open_new_tab(self.connection["browser"])

    @property
    def ip(self):
        return "localhost"

class TunnelCanvas(Canvas):
    """A Vega canvas that can only be viewed by the machine on which it is running or through an ssh tunnel.
    """
    __doc__ += "\n".join(Canvas.__doc__.split("\n")[1:])

    def __init__(self, title=None, initial=None, port=0, verbose=True):
        super(TunnelCanvas, self).__init__(title=title, initial=initial, host="localhost", port=port, verbose=verbose)

    @property
    def connection(self):
        return {"terminal": "ssh -L {port}:localhost:{port} {user}@{ip}".format(port=self._port, user=getpass.getuser(), ip=self.ip),
                "browser": "http://localhost:{port}".format(port=self._port)}

# This is the global canvas instance used by entrypoint-based renderers
_entrypoint_renderer_canvas = None

def _vegalite_renderer_entry_point(spec, embed_options=None):
    global _entrypoint_renderer_canvas

    if embed_options is not None:
        import warnings
        warnings.warn("embed_options is not yet supported & will be ignored")

    if _entrypoint_renderer_canvas is None:
        _entrypoint_renderer_canvas = LocalCanvas()

    _entrypoint_renderer_canvas(spec)
    browser = _entrypoint_renderer_canvas.connection['browser']
    return {'text/plain': 'Rendered at {0}'.format(browser)}

Canvas._default = {
  "$schema": "https://vega.github.io/schema/vega-lite/v2.json",
  "data": {"values": [{"x": "plot goes here"}]},
  "mark": "text",
  "encoding": {"text": {"field": "x"}},
  "config": {"text": {"baseline": "middle", "align": "center"}}
}

Canvas._template = u"""
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <script src="vega.min.js"></script>
    <script src="vega-lite.min.js"></script>
    <script src="vega-embed.min.js"></script>
    <title id="title">TITLE</title>
  </head>
  <body>
    <div style="text-align: center">
      <div style="display: inline-block; text-align: center">
        <div style="display: inline-block; width: 500px; margin-top: 10px; margin-bottom: 10px;">
          <button id="png" style="float: left; margin-right: 5px">Save as PNG</button>
          <button id="svg" style="float: left">as SVG</button>
          <button id="plus">+</button>
          <input  id="zoom" type="text" value="100" size="4" style="text-align: right">%
          <button id="minus">\u2212</button>
          <button id="editor" style="float: right; margin-left: 5px">in editor</button>
          <button id="source" style="float: right">View source</button>
        </div>

        <div id="viewer" style="transform: scale(1.0); transform-origin: 50% 0%">
          <div id="vegaview"></div>
        </div>
      </div>
    </div>
    <div id="screen" style="position: fixed; padding: 0; margin: 0; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; background: rgba(255, 255, 255, 0.0);"></div>
    <script type="text/javascript">

function setzoom() {
    var s = Number(document.getElementById("zoom").value);
    if (isNaN(s)  ||  s <= 0) {
        document.getElementById("zoom").value = 100;
        s = 100;
    }
    document.getElementById("viewer").style.transform = "scale(" + (s / 100.0) + ")";
}

document.getElementById("plus").addEventListener("click", function(event) {
    document.getElementById("zoom").value = (Math.round(Number(document.getElementById("zoom").value) / 20.0) + 1) * 20;
    setzoom();
});

document.getElementById("minus").addEventListener("click", function(event) {
    document.getElementById("zoom").value = Math.max(20, (Math.round(Number(document.getElementById("zoom").value) / 20.0) - 1) * 20);
    setzoom();
});

document.getElementById("zoom").addEventListener("keyup", function(event) {
    event.preventDefault();
    if (event.keyCode === 13) {
        setzoom();
    }
});

var title = document.getElementById("title").innerHTML;
var spec;
var view;
var mode;

function setspec(x) {
    spec = x;
    vegaEmbed("VEGAVIEW", x, {
        renderer: "svg",
        actions: false
    }).then(function(x) {
        view = x.view;
        var s = x.spec.$schema.split("/")
        if (s.indexOf("vega") > -1) {
            mode = "vega";
        }
        else if (s.indexOf("vega-lite") > -1) {
            mode = "vega-lite";
        }
        else {
            mode = "unknown";
        }
    }).catch(function(error) { alert(error); });
}

setspec(SPEC);

function savePNG(event) {
    view.toImageURL("png").then(function(url) {
        var link = document.createElement("a");
        link.setAttribute("href", url);
        link.setAttribute("target", "_blank");
        link.setAttribute("download", title + ".png");
        link.dispatchEvent(new MouseEvent("click"));
    }).catch(function(error) { alert(error); });
}

document.getElementById("png").addEventListener("click", savePNG);

function saveSVG(event) {
    view.toImageURL("svg").then(function(url) {
        var link = document.createElement("a");
        link.setAttribute("href", url);
        link.setAttribute("target", "_blank");
        link.setAttribute("download", title + ".svg");
        link.dispatchEvent(new MouseEvent("click"));
    }).catch(function(error) { alert(error); });
}

document.getElementById("svg").addEventListener("click", saveSVG);

document.getElementById("source").addEventListener("click", function(event) {
    var w = window.open("");
    w.document.write("<html><head><title>" + title + ' (source)</title></head><body><pre><code class="json">' + JSON.stringify(spec, null, 2) + "</code></body></html>");
});

document.getElementById("editor").addEventListener("click", function(event) {
    var w = window.open("https://vega.github.io/editor");
    var wait = 10000;
    var step = 250;
    var count = ~~(wait / step);

    function listen(event) {
        if (event.source == w) {
            count = 0;
            window.removeEventListener("message", listen, false);
        }
    }
    window.addEventListener("message", listen, false);

    var specstring = JSON.stringify(spec, null, 2);

    function send() {
        if (count <= 0) {
            return;
        }
        w.postMessage({"mode": mode, "spec": specstring}, "*");
        setTimeout(send, step);
        count -= 1;
    }
    setTimeout(send, step);
});

var eventSource = new EventSource("/update");

eventSource.onmessage = function(event) {
    document.getElementById("screen").style.background = "rgba(255, 255, 255, 0.0)";
    var data = JSON.parse(event.data);
    title = data["title"];
    document.getElementById("title").innerHTML = title;
    setspec(data["spec"]);
    if (data["action"] == "png") {
        savePNG(null);
    }
    if (data["action"] == "svg") {
        saveSVG(null);
    }
};

eventSource.onerror = function(event) {
    document.getElementById("screen").style.background = "rgba(255, 255, 255, 0.75)";
};

eventSource.onopen = function() {
    document.getElementById("screen").style.background = "rgba(255, 255, 255, 0.0)";
};

    </script>
  </body>
</html>
"""

# vega-3.2.1.min.js
Canvas._vega = b'!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.vega=t.vega||{})}(this,function(y){"use strict";var g=function(t,e,n){return t.fields=e||[],t.fname=n,t};function M(t){return null==t?null:t.fname}function x(t){return null==t?null:t.fields}var rt=function(t){throw Error(t)},m=function(t){var e,n,r,i=[],a=null,o=0,u=t.length,s="";function f(){i.push(s+t.substring(e,n)),s="",e=n+1}for(t+="",e=n=0;n<u;++n)if("\\\\"===(r=t[n]))s+=t.substring(e,n),e=++n;else if(r===a)f(),a=null,o=-1;else{if(a)continue;e===o&&\'"\'===r?(e=n+1,a=r):e===o&&"\'"===r?(e=n+1,a=r):"."!==r||o?"["===r?(e<n&&f(),o=e=n+1):"]"===r&&(o||rt("Access path missing open bracket: "+t),0<o&&f(),o=0,e=n+1):e<n?f():e=n+1}return o&&rt("Access path missing closing bracket: "+t),a&&rt("Access path missing closing quote: "+t),e<n&&(n++,f()),i},d=Array.isArray,J=function(t){return t===Object(t)},p=function(t){return"string"==typeof t};function Z(t){return d(t)?"["+t.map(Z)+"]":J(t)||p(t)?JSON.stringify(t).replace("\\u2028","\\\\u2028").replace("\\u2029","\\\\u2029"):t}var l=function(t,e){var n=m(t),r="return _["+n.map(Z).join("][")+"];";return g(Function("_",r),[t=1===n.length?n[0]:t],e||t)},t=[],f=l("id"),c=g(function(t){return t},t,"identity"),w=g(function(){return 0},t,"zero"),b=g(function(){return 1},t,"one"),v=g(function(){return!0},t,"true"),h=g(function(){return!1},t,"false");function n(t,e,n){var r=[e].concat([].slice.call(n));console[t].apply(console,r)}var r=1,_=3,k=4,e=function(t){var e=t||0;return{level:function(t){return arguments.length?(e=+t,this):e},error:function(){return r<=e&&n("error","ERROR",arguments),this},warn:function(){return 2<=e&&n("warn","WARN",arguments),this},info:function(){return _<=e&&n("log","INFO",arguments),this},debug:function(){return k<=e&&n("log","DEBUG",arguments),this}}},E=function(t){return t[t.length-1]},S=function(t){return null==t||""===t?null:+t};function i(e){return function(t){return e*Math.exp(t)}}function a(e){return function(t){return Math.log(e*t)}}function o(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function u(t,e,n,r){var i=n(t[0]),a=n(E(t)),o=(a-i)*e;return[r(i-o),r(a-o)]}function s(t,e){return u(t,e,S,c)}function A(t,e){var n=Math.sign(t[0]);return u(t,e,a(n),i(n))}function C(t,e,n){return u(t,e,o(n),o(1/n))}function z(t,e,n,r,i){var a=r(t[0]),o=r(E(t)),u=null!=e?r(e):(a+o)/2;return[i(u+(a-u)*n),i(u+(o-u)*n)]}function D(t,e,n){return z(t,e,n,S,c)}function O(t,e,n){var r=Math.sign(t[0]);return z(t,e,n,a(r),i(r))}function N(t,e,n,r){return z(t,e,n,o(r),o(1/r))}var Q=function(t){return null!=t?d(t)?t:[t]:[]},R=function(t){return"function"==typeof t},T=function(t,e){var n,r,i,a,o,u,s,f,c,l=[],h=(t=Q(t)).map(function(t,e){return null==t?null:(l.push(e),R(t)?t:m(t).map(Z).join("]["))}),d=l.length-1,p=Q(e),v="var u,v;return ";if(d<0)return null;for(r=0;r<=d;++r)i=h[n=l[r]],R(i)?(a="(u=this."+(u="f"+n)+"(a))",o="(v=this."+u+"(b))",(s=s||{})[u]=i):(a="(u=a["+i+"])",o="(v=b["+i+"])"),u="((v=v instanceof Date?+v:v),(u=u instanceof Date?+u:u))","descending"!==p[n]?f=-(c=1):(c=-1,f=1),v+="("+a+"<"+o+"||u==null)&&v!=null?"+f+":(u>v||v==null)&&u!=null?"+c+":"+u+"!==u&&v===v?"+f+":v!==v&&u===u?"+c+(n<d?":":":0");return i=Function("a","b",v+";"),s&&(i=i.bind(s)),t=t.reduce(function(e,t){return R(t)?(x(t)||[]).forEach(function(t){e[t]=1}):null!=t&&(e[t+""]=1),e},{}),g(i,Object.keys(t))},P=function(t){return R(t)?t:function(){return t}},L=function(e,t){var n,r;function i(){t(r),n=r=null}return function(t){r=t,n&&clearTimeout(n),n=setTimeout(i,e)}},Wt=function(t){for(var e,n,r=1,i=arguments.length;r<i;++r)for(n in e=arguments[r])t[n]=e[n];return t},q=function(t,e){var n,r,i,a,o,u=-1,s=t.length;if(null==e){for(;++u<s;)if(null!=(r=t[u])&&r<=r){n=i=r;break}for(a=o=u;++u<s;)null!=(r=t[u])&&(r<n&&(n=r,a=u),i<r&&(i=r,o=u))}else{for(;++u<s;)if(null!=(r=e(t[u],u,t))&&r<=r){n=i=r;break}for(a=o=u;++u<s;)null!=(r=e(t[u],u,t))&&(r<n&&(n=r,a=u),i<r&&(i=r,o=u))}return[a,o]},U={},F=function(e){var i,a,o={};function n(t){return o.hasOwnProperty(t)&&o[t]!==U}return i={size:0,empty:0,object:o,has:n,get:function(t){return n(t)?o[t]:void 0},set:function(t,e){return n(t)||(++i.size,o[t]===U&&--i.empty),o[t]=e,this},delete:function(t){return n(t)&&(--i.size,++i.empty,o[t]=U),this},clear:function(){i.size=i.empty=0,i.object=o={}},test:function(t){return arguments.length?(a=t,i):a},clean:function(){var t,e,n={},r=0;for(t in o)(e=o[t])===U||a&&a(e)||(n[t]=e,++r);i.size=r,i.empty=0,i.object=o=n}},e&&Object.keys(e).forEach(function(t){i.set(t,e[t])}),i},j=function(t,e){var n=t.prototype=Object.create(e.prototype);return n.constructor=t,n},I=function(t){return"boolean"==typeof t},$=function(t){return"[object Date]"===Object.prototype.toString.call(t)},B=function(t){return"number"==typeof t},W=function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},Y=function(t,e){t&&(t=e?Q(t).map(function(t){return t.replace(/\\\\(.)/g,"$1")}):Q(t));var n=t&&t.length?Function("_","return \'\'+"+t.map(function(t){return"_["+(e?Z(t):m(t).map(Z).join("]["))+"]"}).join("+\'|\'+")+";"):function(){return""};return g(n,t,"key")},H=function(t,e,n,r){var i=e.length,a=n.length;if(!a)return e;if(!i)return n;for(var o=r||new e.constructor(i+a),u=0,s=0,f=0;u<i&&s<a;++f)o[f]=0<t(e[u],n[s])?n[s++]:e[u++];for(;u<i;++u,++f)o[f]=e[u];for(;s<a;++s,++f)o[f]=n[s];return o},G=function(t,e){for(var n="";0<=--e;)n+=t;return n},V=function(t,e,n,r){var i=n||" ",a=t+"",o=e-a.length;return o<=0?a:"left"===r?G(i,o)+a:"center"===r?G(i,~~(o/2))+a+G(i,Math.ceil(o/2)):a+G(i,o)},X=function(t){return null==t||""===t?null:!(!t||"false"===t||"0"===t)&&!!t};function K(t){return B(t)?t:$(t)?t:Date.parse(t)}var tt=function(t,e){return e=e||K,null==t||""===t?null:e(t)},et=function(t){return null==t||""===t?null:t+""},nt=function(t){for(var e={},n=0,r=t.length;n<r;++n)e[t[n]]=!0;return e},it=function(t,e,n,r){var i=null!=r?r:"\xe2\x80\xa6",a=t+"",o=a.length,u=Math.max(0,e-i.length);return o<=e?a:"left"===n?i+a.slice(o-u):"center"===n?a.slice(0,Math.ceil(u/2))+i+a.slice(o-~~(u/2)):a.slice(0,u)+i},at=function(t,e,n){if(t){var r,i=0,a=t.length;if(e)for(;i<a;++i)(r=e(t[i]))&&n(r,i,t);else t.forEach(n)}};function ot(t){var r=t||c,i=[],a={};return i.add=function(t){var e=r(t);return a[e]||(a[e]=1,i.push(t)),i},i.remove=function(t){var e,n=r(t);return a[n]&&(a[n]=0)<=(e=i.indexOf(t))&&i.splice(e,1),i},i}var ut=Symbol("vega_id"),st=1;function ft(t){return!(!t||!ct(t))}function ct(t){return t[ut]}function lt(t,e){return t[ut]=e,t}function ht(t){var e=t===Object(t)?t:{data:t};return ct(e)?e:lt(e,st++)}function dt(t){return pt(t,ht({}))}function pt(t,e){for(var n in t)e[n]=t[n];return e}function vt(t,e){return lt(e,ct(t))}function gt(t){return t&&t.constructor===mt}function mt(){var c=[],l=[],h=[],d=[],p=[],v=!1;return{constructor:mt,insert:function(t){for(var e=Q(t),n=0,r=e.length;n<r;++n)c.push(e[n]);return this},remove:function(t){for(var e=R(t)?d:l,n=Q(t),r=0,i=n.length;r<i;++r)e.push(n[r]);return this},modify:function(t,e,n){var r={field:e,value:P(n)};return R(t)?(r.filter=t,p.push(r)):(r.tuple=t,h.push(r)),this},encode:function(t,e){return R(t)?p.push({filter:t,field:e}):h.push({tuple:t,field:e}),this},reflow:function(){return v=!0,this},pulse:function(r,t){var i,e,n,a,o,u,s;for(e=0,n=c.length;e<n;++e)r.add.push(ht(c[e]));for(i={},e=0,n=l.length;e<n;++e)i[ct(u=l[e])]=u;for(e=0,n=d.length;e<n;++e)o=d[e],t.forEach(function(t){o(t)&&(i[ct(t)]=t)});for(s in i)r.rem.push(i[s]);function f(t,e,n){n?t[e]=n(t):r.encode=e,v||(i[ct(t)]=t)}for(i={},e=0,n=h.length;e<n;++e)f((a=h[e]).tuple,a.field,a.value),r.modifies(a.field);for(e=0,n=p.length;e<n;++e)a=p[e],o=a.filter,t.forEach(function(t){o(t)&&f(t,a.field,a.value)}),r.modifies(a.field);if(v)r.mod=l.length||d.length?t.filter(function(t){return i.hasOwnProperty(ct(t))}):t.slice();else for(s in i)r.mod.push(i[s]);return r}}}var yt="_:mod:_";function bt(){Object.defineProperty(this,yt,{writable:!0,value:{}})}var _t=bt.prototype;_t.set=function(t,e,n,r){var i=this[t],a=this[yt];return null!=e&&0<=e?(i[e]!==n||r)&&(i[e]=n,a[e+":"+t]=-1,a[t]=-1):(i!==n||r)&&(this[t]=n,a[t]=d(n)?1+n.length:-1),this},_t.modified=function(t,e){var n,r=this[yt];if(!arguments.length){for(n in r)if(r[n])return!0;return!1}if(d(t)){for(n=0;n<t.length;++n)if(r[t[n]])return!0;return!1}return null!=e&&0<=e?e+1<r[t]||!!r[e+":"+t]:!!r[t]},_t.clear=function(){return this[yt]={},this};var xt=0,wt=new bt;function Mt(t,e,n,r){this.id=++xt,this.value=t,this.stamp=-1,this.rank=-1,this.qrank=-1,this.flags=0,e&&(this._update=e),n&&this.parameters(n,r)}var kt=Mt.prototype;function Et(n){return function(t){var e=this.flags;return 0===arguments.length?!!(e&n):(this.flags=t?e|n:e&~n,this)}}kt.targets=function(){return this._targets||(this._targets=ot(f))},kt.set=function(t){return this.value!==t?(this.value=t,1):0},kt.skip=Et(1),kt.modified=Et(2),kt.parameters=function(t,r){r=!1!==r;var e,n,i,a,o=this,u=o._argval=o._argval||new bt,s=o._argops=o._argops||[],f=[];function c(t,e,n){n instanceof Mt?(n!==o&&(r&&n.targets().add(o),f.push(n)),s.push({op:n,name:t,index:e})):u.set(t,e,n)}for(e in t)if(n=t[e],"pulse"===e)Q(n).forEach(function(t){t instanceof Mt?t!==o&&(t.targets().add(o),f.push(t)):rt("Pulse parameters must be operator instances.")}),o.source=n;else if(d(n))for(u.set(e,-1,Array(i=n.length)),a=0;a<i;++a)c(e,a,n[a]);else c(e,-1,n);return this.marshall().clear(),f},kt.marshall=function(t){var e,n,r,i,a,o=this._argval||wt,u=this._argops;if(u&&(r=u.length))for(n=0;n<r;++n)a=(i=(e=u[n]).op).modified()&&i.stamp===t,o.set(e.name,e.index,i.value,a);return o},kt.evaluate=function(t){if(this._update){var e=this.marshall(t.stamp),n=this._update(e,t);if(e.clear(),n!==this.value)this.value=n;else if(!this.modified())return t.StopPropagation}},kt.run=function(t){return t.stamp<=this.stamp?t.StopPropagation:(this.skip()?(this.skip(!1),e=0):e=this.evaluate(t),this.stamp=t.stamp,(this.pulse=e)||t);var e};var St=0;function At(t,e,n){this.id=++St,this.value=null,n&&(this.receive=n),t&&(this._filter=t),e&&(this._apply=e)}function Ct(t,e,n){return new At(t,e,n)}var zt=At.prototype;zt._filter=v,zt._apply=c,zt.targets=function(){return this._targets||(this._targets=ot(f))},zt.consume=function(t){return arguments.length?(this._consume=!!t,this):!!this._consume},zt.receive=function(t){if(this._filter(t)){for(var e=this.value=this._apply(t),n=this._targets,r=n?n.length:0,i=0;i<r;++i)n[i].receive(e);this._consume&&(t.preventDefault(),t.stopPropagation())}},zt.filter=function(t){var e=Ct(t);return this.targets().add(e),e},zt.apply=function(t){var e=Ct(null,t);return this.targets().add(e),e},zt.merge=function(){var t=Ct();this.targets().add(t);for(var e=0,n=arguments.length;e<n;++e)arguments[e].targets().add(t);return t},zt.throttle=function(e){var n=-1;return this.filter(function(){var t=Date.now();return e<t-n?(n=t,1):0})},zt.debounce=function(t){var n=Ct();return this.targets().add(Ct(null,null,L(t,function(t){var e=t.dataflow;n.receive(t),e&&e.run&&e.run()}))),n},zt.between=function(t,e){var n=!1;return t.targets().add(Ct(null,null,function(){n=!0})),e.targets().add(Ct(null,null,function(){n=!1})),this.filter(function(){return n})};var Dt="$";function Ot(){}function Nt(t,e){var n=new Ot;if(t instanceof Ot)t.each(function(t,e){n.set(e,t)});else if(Array.isArray(t)){var r,i=-1,a=t.length;if(null==e)for(;++i<a;)n.set(i,t[i]);else for(;++i<a;)n.set(e(r=t[i],i,t),r)}else if(t)for(var o in t)n.set(o,t[o]);return n}Ot.prototype=Nt.prototype={constructor:Ot,has:function(t){return Dt+t in this},get:function(t){return this[Dt+t]},set:function(t,e){return this[Dt+t]=e,this},remove:function(t){var e=Dt+t;return e in this&&delete this[e]},clear:function(){for(var t in this)t[0]===Dt&&delete this[t]},keys:function(){var t=[];for(var e in this)e[0]===Dt&&t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)e[0]===Dt&&t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)e[0]===Dt&&t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)e[0]===Dt&&++t;return t},empty:function(){for(var t in this)if(t[0]===Dt)return!1;return!0},each:function(t){for(var e in this)e[0]===Dt&&t(this[e],e.slice(1),this)}};var Rt=function(){var h,d,e,p=[],o=[];function v(t,n,r,i){if(n>=p.length)return null!=h&&t.sort(h),null!=d?d(t):t;for(var e,a,o,u=-1,s=t.length,f=p[n++],c=Nt(),l=r();++u<s;)(o=c.get(e=f(a=t[u])+""))?o.push(a):c.set(e,[a]);return c.each(function(t,e){i(l,e,v(t,n,r,i))}),l}return e={object:function(t){return v(t,0,Tt,Pt)},map:function(t){return v(t,0,Lt,qt)},entries:function(t){return function n(t,r){if(++r>p.length)return t;var i,a=o[r-1];return null!=d&&r>=p.length?i=t.entries():(i=[],t.each(function(t,e){i.push({key:e,values:n(t,r)})})),null!=a?i.sort(function(t,e){return a(t.key,e.key)}):i}(v(t,0,Lt,qt),0)},key:function(t){return p.push(t),e},sortKeys:function(t){return o[p.length-1]=t,e},sortValues:function(t){return h=t,e},rollup:function(t){return d=t,e}}};function Tt(){return{}}function Pt(t,e,n){t[e]=n}function Lt(){return Nt()}function qt(t,e,n){t.set(e,n)}function Ut(){}var Ft=Nt.prototype;Ut.prototype=function(t,e){var n=new Ut;if(t instanceof Ut)t.each(function(t){n.add(t)});else if(t){var r=-1,i=t.length;if(null==e)for(;++r<i;)n.add(t[r]);else for(;++r<i;)n.add(e(t[r],r,t))}return n}.prototype={constructor:Ut,has:Ft.has,add:function(t){return this[Dt+(t+="")]=t,this},remove:Ft.remove,clear:Ft.clear,values:Ft.keys,size:Ft.size,empty:Ft.empty,each:Ft.each};var jt={value:function(){}};function It(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r)throw new Error("illegal type: "+t);r[t]=[]}return new $t(r)}function $t(t){this._=t}function Bt(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function Yt(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=jt,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}$t.prototype=It.prototype={constructor:$t,on:function(t,e){var n,r,i=this._,a=(r=i,(t+"").trim().split(/^|\\s+/).map(function(t){var e="",n=t.indexOf(".");if(0<=n&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})),o=-1,u=a.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++o<u;)if(n=(t=a[o]).type)i[n]=Yt(i[n],t.name,e);else if(null==e)for(n in i)i[n]=Yt(i[n],t.name,null);return this}for(;++o<u;)if((n=(t=a[o]).type)&&(n=Bt(i[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new $t(t)},call:function(t,e){if(0<(n=arguments.length-2))for(var n,r,i=new Array(n),a=0;a<n;++a)i[a]=arguments[a+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(a=0,n=(r=this._[t]).length;a<n;++a)r[a].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,a=r.length;i<a;++i)r[i].value.apply(e,n)}};var Ht=function(i,t){var a,o,u,s,f=It("beforesend","progress","load","error"),c=Nt(),l=new XMLHttpRequest,h=null,d=null,p=0;function e(t){var e,n,r,i=l.status;if(!i&&((r=(n=l).responseType)&&"text"!==r?n.response:n.responseText)||200<=i&&i<300||304===i){if(u)try{e=u.call(a,l)}catch(t){return void f.call("error",a,t)}else e=l;f.call("load",a,e)}else f.call("error",a,t)}if("undefined"==typeof XDomainRequest||"withCredentials"in l||!/^(http(s)?:)?\\/\\//.test(i)||(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=l.ontimeout=e:l.onreadystatechange=function(t){3<l.readyState&&e(t)},l.onprogress=function(t){f.call("progress",a,t)},a={header:function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?c.get(t):(null==e?c.remove(t):c.set(t,e+""),a)},mimeType:function(t){return arguments.length?(o=null==t?null:t+"",a):o},responseType:function(t){return arguments.length?(s=t,a):s},timeout:function(t){return arguments.length?(p=+t,a):p},user:function(t){return arguments.length<1?h:(h=null==t?null:t+"",a)},password:function(t){return arguments.length<1?d:(d=null==t?null:t+"",a)},response:function(t){return u=t,a},get:function(t,e){return a.send("GET",t,e)},post:function(t,e){return a.send("POST",t,e)},send:function(t,e,n){var r;return l.open(t,i,!0,h,d),null==o||c.has("accept")||c.set("accept",o+",*/*"),l.setRequestHeader&&c.each(function(t,e){l.setRequestHeader(e,t)}),null!=o&&l.overrideMimeType&&l.overrideMimeType(o),null!=s&&(l.responseType=s),0<p&&(l.timeout=p),null==n&&"function"==typeof e&&(n=e,e=null),null!=n&&1===n.length&&(r=n,n=function(t,e){r(null==t?e:null)}),null!=n&&a.on("error",n).on("load",function(t){n(null,t)}),f.call("beforesend",a,l),l.send(null==e?null:e),a},abort:function(){return l.abort(),a},on:function(){var t=f.on.apply(f,arguments);return t===f?a:t}},null!=t){if("function"!=typeof t)throw new Error("invalid callback: "+t);return a.get(t)}return a};var Gt={},Vt={},Xt=34,Jt=10,Zt=13;function Qt(t){return new Function("d","return {"+t.map(function(t,e){return JSON.stringify(t)+": d["+e+"]"}).join(",")+"}")}var Kt=function(a){var e=new RegExp(\'["\'+a+"\\n\\r]"),l=a.charCodeAt(0);function n(r,t){var e,n=[],i=r.length,a=0,o=0,u=i<=0,s=!1;function f(){if(u)return Vt;if(s)return s=!1,Gt;var t,e,n=a;if(r.charCodeAt(n)===Xt){for(;a++<i&&r.charCodeAt(a)!==Xt||r.charCodeAt(++a)===Xt;);return(t=a)>=i?u=!0:(e=r.charCodeAt(a++))===Jt?s=!0:e===Zt&&(s=!0,r.charCodeAt(a)===Jt&&++a),r.slice(n+1,t-1).replace(/""/g,\'"\')}for(;a<i;){if((e=r.charCodeAt(t=a++))===Jt)s=!0;else if(e===Zt)s=!0,r.charCodeAt(a)===Jt&&++a;else if(e!==l)continue;return r.slice(n,t)}return u=!0,r.slice(n,i)}for(r.charCodeAt(i-1)===Jt&&--i,r.charCodeAt(i-1)===Zt&&--i;(e=f())!==Vt;){for(var c=[];e!==Gt&&e!==Vt;)c.push(e),e=f();t&&null==(c=t(c,o++))||n.push(c)}return n}function r(t){return t.map(o).join(a)}function o(t){return null==t?"":e.test(t+="")?\'"\'+t.replace(/"/g,\'""\')+\'"\':t}return{parse:function(t,a){var o,u,e=n(t,function(t,e){if(o)return o(t,e-1);var n,r,i;u=t,o=a?(r=a,i=Qt(n=t),function(t,e){return r(i(t),e,n)}):Qt(t)});return e.columns=u||[],e},parseRows:n,format:function(t,n){var e,r,i;return null==n&&(e=t,r=Object.create(null),i=[],e.forEach(function(t){for(var e in t)e in r||i.push(r[e]=e)}),n=i),[n.map(o).join(a)].concat(t.map(function(e){return n.map(function(t){return o(e[t])}).join(a)})).join("\\n")},formatRows:function(t){return t.map(r).join("\\n")}}},te=(Kt(","),Kt("\\t"),/^([A-Za-z]+:)?\\/\\//),ee="file://",ne=["mimeType","responseType","user","password"],re=function(t){return{options:t||{},sanitize:oe,load:ae,file:se,http:ue}};function ie(t,e){return Wt({},t.options,e)}function ae(t,n){var r=this;return r.sanitize(t,n).then(function(t){var e=t.href;return t.localFile?r.file(e):r.http(e,n)})}function oe(u,s){return s=ie(this,s),new Promise(function(t,e){var n,r,i,a,o={href:null};null!=u&&"string"==typeof u?(r=te.test(u),(a=s.baseURL)&&!r&&(ce(u,"/")||"/"===a[a.length-1]||(u="/"+u),u=a+u),i=(n=ce(u,ee))||"file"===s.mode||"http"!==s.mode&&!r&&fe(),n?u=u.slice(ee.length):ce(u,"//")&&("file"===s.defaultProtocol?(u=u.slice(2),i=!0):u=(s.defaultProtocol||"http")+":"+u),Object.defineProperty(o,"localFile",{value:!!i}),o.href=u,s.target&&(o.target=s.target+""),t(o)):e("Sanitize failure, invalid URI: "+Z(u))})}function ue(i,a){return a=ie(this,a),new Promise(function(n,r){var t,e=Ht(i);for(t in a.headers)e.header(t,a.headers[t]);ne.forEach(function(t){a[t]&&e[t](a[t])}),e.on("error",function(t){r(t||"Error loading URL: "+i)}).on("load",function(t){var e=t&&t.responseText;t&&0!==t.status?n(e):r(e||"Error")}).get()})}function se(e){return new Promise(function(n,r){var t=fe();t?t.readFile(e,function(t,e){t?r(t):n(e)}):r("No file system access for "+e)})}function fe(){var t="function"==typeof require&&require("fs");return t&&R(t.readFile)?t:null}function ce(t,e){return null!=t&&0===t.lastIndexOf(e,0)}var le={boolean:X,integer:S,number:S,date:tt,string:et,unknown:c},he=[function(t){return"true"===t||"false"===t||!0===t||!1===t},function(t){return ge(t)&&(t=+t)==~~t},ge,function(t){return!isNaN(Date.parse(t))}],de=["boolean","integer","number","date"];function pe(t,e){if(!t||!t.length)return"unknown";var n,r,i,a,o,u=he.slice();for(r=0,i=t.length;r<i;++r){for(n=e?t[r][e]:t[r],a=0;a<u.length;++a)null==(o=n)||o!=o||u[a](n)||(u.splice(a,1),--a);if(0===u.length)return"string"}return de[he.indexOf(u[0])]}function ve(n,t){return t.reduce(function(t,e){return t[e]=pe(n,e),t},{})}function ge(t){return!(isNaN(+t)||t instanceof Date)}function me(r){return function(t,e){var n={delimiter:r};return ye(t,e?Wt(e,n):n)}}function ye(t,e){return e.header&&(t=e.header.map(Z).join(e.delimiter)+"\\n"+t),Kt(e.delimiter).parse(t+"")}var be=function(t,e){var n,r,i,a=e&&e.property?l(e.property):c;return!J(t)||(i=t,"function"==typeof Buffer&&R(Buffer.isBuffer)&&Buffer.isBuffer(i))?a(JSON.parse(t)):(n=a(t),r&&r.copy?JSON.parse(JSON.stringify(n)):n)};var _e=function(t){return t},xe=function(t){if(null==t)return _e;var a,o,u=t.scale[0],s=t.scale[1],f=t.translate[0],c=t.translate[1];return function(t,e){e||(a=o=0);var n=2,r=t.length,i=new Array(r);for(i[0]=(a+=t[0])*u+f,i[1]=(o+=t[1])*s+c;n<r;)i[n]=t[n],++n;return i}},we=function(t,e){for(var n,r=t.length,i=r-e;i<--r;)n=t[i],t[i++]=t[r],t[r]=n},Me=function(e,t){return"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map(function(t){return ke(e,t)})}:ke(e,t)};function ke(t,e){var n=e.id,r=e.bbox,i=null==e.properties?{}:e.properties,a=Ee(t,e);return null==n&&null==r?{type:"Feature",properties:i,geometry:a}:null==r?{type:"Feature",id:n,properties:i,geometry:a}:{type:"Feature",id:n,bbox:r,properties:i,geometry:a}}function Ee(t,e){var a=xe(t.transform),o=t.arcs;function i(t,e){e.length&&e.pop();for(var n=o[t<0?~t:t],r=0,i=n.length;r<i;++r)e.push(a(n[r],r));t<0&&we(e,i)}function u(t){return a(t)}function s(t){for(var e=[],n=0,r=t.length;n<r;++n)i(t[n],e);return e.length<2&&e.push(e[0]),e}function n(t){for(var e=s(t);e.length<4;)e.push(e[0]);return e}function f(t){return t.map(n)}return function t(e){var n,r=e.type;switch(r){case"GeometryCollection":return{type:r,geometries:e.geometries.map(t)};case"Point":n=u(e.coordinates);break;case"MultiPoint":n=e.coordinates.map(u);break;case"LineString":n=s(e.arcs);break;case"MultiLineString":n=e.arcs.map(s);break;case"Polygon":n=f(e.arcs);break;case"MultiPolygon":n=e.arcs.map(f);break;default:return null}return{type:r,coordinates:n}}(e)}var Se=function(s,i){var a={},f={},c={},o=[],u=-1;function t(t,e){for(var n in t){var r=t[n];delete e[r.start],delete r.start,delete r.end,r.forEach(function(t){a[t<0?~t:t]=1}),o.push(r)}}return i.forEach(function(t,e){var n,r=s.arcs[t<0?~t:t];r.length<3&&!r[1][0]&&!r[1][1]&&(n=i[++u],i[u]=t,i[e]=n)}),i.forEach(function(t){var e,n,r=function(t){var e,n=s.arcs[t<0?~t:t],r=n[0];s.transform?(e=[0,0],n.forEach(function(t){e[0]+=t[0],e[1]+=t[1]})):e=n[n.length-1];return t<0?[e,r]:[r,e]}(t),i=r[0],a=r[1];if(e=c[i])if(delete c[e.end],e.push(t),e.end=a,n=f[a]){delete f[n.start];var o=n===e?e:e.concat(n);f[o.start=e.start]=c[o.end=n.end]=o}else f[e.start]=c[e.end]=e;else if(e=f[a])if(delete f[e.start],e.unshift(t),e.start=i,n=c[i]){delete c[n.end];var u=n===e?e:n.concat(e);f[u.start=n.start]=c[u.end=e.end]=u}else f[e.start]=c[e.end]=e;else f[(e=[t]).start=i]=c[e.end=a]=e}),t(c,f),t(f,c),i.forEach(function(t){a[t<0?~t:t]||o.push([t])}),o},Ae=function(t){return Ee(t,function(t,e,n){var r,i,a;if(1<arguments.length)r=function(t,e,n){var r,i=[],a=[];function o(t){var e=t<0?~t:t;(a[e]||(a[e]=[])).push({i:t,g:r})}function u(t){t.forEach(o)}function s(t){t.forEach(u)}return function t(e){switch((r=e).type){case"GeometryCollection":e.geometries.forEach(t);break;case"LineString":u(e.arcs);break;case"MultiLineString":case"Polygon":s(e.arcs);break;case"MultiPolygon":e.arcs.forEach(s)}}(e),a.forEach(null==n?function(t){i.push(t[0].i)}:function(t){n(t[0].g,t[t.length-1].g)&&i.push(t[0].i)}),i}(0,e,n);else for(i=0,r=new Array(a=t.arcs.length);i<a;++i)r[i]=i;return{type:"MultiLineString",arcs:Se(t,r)}}.apply(this,arguments))};var Ce={dsv:ye,csv:me(","),tsv:me("\\t"),json:be,topojson:function(t,e){var n,r,i;return t=be(t,e),n=e&&(i=e.feature)?Me:e&&(i=e.mesh)?Ae:rt("Missing TopoJSON feature or mesh parameter."),(r=(r=t.objects[i])?n(t,r):rt("Invalid TopoJSON object: "+i))&&r.features||[r]}},ze=function(t,e){return 1<arguments.length?(Ce[t]=e,this):Ce.hasOwnProperty(t)?Ce[t]:null},De=new Date,Oe=new Date;function Ne(a,o,n,r){function u(t){return a(t=new Date(+t)),t}return(u.floor=u).ceil=function(t){return a(t=new Date(t-1)),o(t,1),a(t),t},u.round=function(t){var e=u(t),n=u.ceil(t);return t-e<n-t?e:n},u.offset=function(t,e){return o(t=new Date(+t),null==e?1:Math.floor(e)),t},u.range=function(t,e,n){var r,i=[];if(t=u.ceil(t),n=null==n?1:Math.floor(n),!(t<e&&0<n))return i;for(;i.push(r=new Date(+t)),o(t,n),a(t),r<t&&t<e;);return i},u.filter=function(n){return Ne(function(t){if(t<=t)for(;a(t),!n(t);)t.setTime(t-1)},function(t,e){if(t<=t)if(e<0)for(;++e<=0;)for(;o(t,-1),!n(t););else for(;0<=--e;)for(;o(t,1),!n(t););})},n&&(u.count=function(t,e){return De.setTime(+t),Oe.setTime(+e),a(De),a(Oe),Math.floor(n(De,Oe))},u.every=function(e){return e=Math.floor(e),isFinite(e)&&0<e?1<e?u.filter(r?function(t){return r(t)%e==0}:function(t){return u.count(0,t)%e==0}):u:null}),u}var Re=Ne(function(){},function(t,e){t.setTime(+t+e)},function(t,e){return e-t});Re.every=function(n){return n=Math.floor(n),isFinite(n)&&0<n?1<n?Ne(function(t){t.setTime(Math.floor(t/n)*n)},function(t,e){t.setTime(+t+e*n)},function(t,e){return(e-t)/n}):Re:null};var Te=6e4,Pe=36e5,Le=6048e5,qe=Ne(function(t){t.setTime(1e3*Math.floor(t/1e3))},function(t,e){t.setTime(+t+1e3*e)},function(t,e){return(e-t)/1e3},function(t){return t.getUTCSeconds()}),Ue=Ne(function(t){t.setTime(Math.floor(t/Te)*Te)},function(t,e){t.setTime(+t+e*Te)},function(t,e){return(e-t)/Te},function(t){return t.getMinutes()}),Fe=Ne(function(t){var e=t.getTimezoneOffset()*Te%Pe;e<0&&(e+=Pe),t.setTime(Math.floor((+t-e)/Pe)*Pe+e)},function(t,e){t.setTime(+t+e*Pe)},function(t,e){return(e-t)/Pe},function(t){return t.getHours()}),je=Ne(function(t){t.setHours(0,0,0,0)},function(t,e){t.setDate(t.getDate()+e)},function(t,e){return(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Te)/864e5},function(t){return t.getDate()-1});function Ie(e){return Ne(function(t){t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},function(t,e){t.setDate(t.getDate()+7*e)},function(t,e){return(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Te)/Le})}var $e=Ie(0),Be=Ie(1),We=(Ie(2),Ie(3),Ie(4)),Ye=(Ie(5),Ie(6),Ne(function(t){t.setDate(1),t.setHours(0,0,0,0)},function(t,e){t.setMonth(t.getMonth()+e)},function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())},function(t){return t.getMonth()})),He=Ne(function(t){t.setMonth(0,1),t.setHours(0,0,0,0)},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t,e){return e.getFullYear()-t.getFullYear()},function(t){return t.getFullYear()});He.every=function(n){return isFinite(n=Math.floor(n))&&0<n?Ne(function(t){t.setFullYear(Math.floor(t.getFullYear()/n)*n),t.setMonth(0,1),t.setHours(0,0,0,0)},function(t,e){t.setFullYear(t.getFullYear()+e*n)}):null};var Ge=Ne(function(t){t.setUTCSeconds(0,0)},function(t,e){t.setTime(+t+e*Te)},function(t,e){return(e-t)/Te},function(t){return t.getUTCMinutes()}),Ve=Ne(function(t){t.setUTCMinutes(0,0,0)},function(t,e){t.setTime(+t+e*Pe)},function(t,e){return(e-t)/Pe},function(t){return t.getUTCHours()}),Xe=Ne(function(t){t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCDate(t.getUTCDate()+e)},function(t,e){return(e-t)/864e5},function(t){return t.getUTCDate()-1});function Je(e){return Ne(function(t){t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCDate(t.getUTCDate()+7*e)},function(t,e){return(e-t)/Le})}var Ze=Je(0),Qe=Je(1),Ke=(Je(2),Je(3),Je(4)),tn=(Je(5),Je(6),Ne(function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCMonth(t.getUTCMonth()+e)},function(t,e){return e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())},function(t){return t.getUTCMonth()})),en=Ne(function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)},function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()},function(t){return t.getUTCFullYear()});function nn(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function rn(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function an(t){return{y:t,m:0,d:1,H:0,M:0,S:0,L:0}}en.every=function(n){return isFinite(n=Math.floor(n))&&0<n?Ne(function(t){t.setUTCFullYear(Math.floor(t.getUTCFullYear()/n)*n),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e*n)}):null};var on,un,sn,fn,cn,ln={"-":"",_:" ",0:"0"},hn=/^\\s*\\d+/,dn=/^%/,pn=/[\\\\^$*+?|[\\]().{}]/g;function vn(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",a=i.length;return r+(a<n?new Array(n-a+1).join(e)+i:i)}function gn(t){return t.replace(pn,"\\\\$&")}function mn(t){return new RegExp("^(?:"+t.map(gn).join("|")+")","i")}function yn(t){for(var e={},n=-1,r=t.length;++n<r;)e[t[n].toLowerCase()]=n;return e}function bn(t,e,n){var r=hn.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function _n(t,e,n){var r=hn.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function xn(t,e,n){var r=hn.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function wn(t,e,n){var r=hn.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function Mn(t,e,n){var r=hn.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function kn(t,e,n){var r=hn.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function En(t,e,n){var r=hn.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(68<+r[0]?1900:2e3),n+r[0].length):-1}function Sn(t,e,n){var r=/^(Z)|([+-]\\d\\d)(?::?(\\d\\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function An(t,e,n){var r=hn.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function Cn(t,e,n){var r=hn.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function zn(t,e,n){var r=hn.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Dn(t,e,n){var r=hn.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function On(t,e,n){var r=hn.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function Nn(t,e,n){var r=hn.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function Rn(t,e,n){var r=hn.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Tn(t,e,n){var r=hn.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Pn(t,e,n){var r=dn.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Ln(t,e,n){var r=hn.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function qn(t,e,n){var r=hn.exec(e.slice(n));return r?(t.Q=1e3*+r[0],n+r[0].length):-1}function Un(t,e){return vn(t.getDate(),e,2)}function Fn(t,e){return vn(t.getHours(),e,2)}function jn(t,e){return vn(t.getHours()%12||12,e,2)}function In(t,e){return vn(1+je.count(He(t),t),e,3)}function $n(t,e){return vn(t.getMilliseconds(),e,3)}function Bn(t,e){return $n(t,e)+"000"}function Wn(t,e){return vn(t.getMonth()+1,e,2)}function Yn(t,e){return vn(t.getMinutes(),e,2)}function Hn(t,e){return vn(t.getSeconds(),e,2)}function Gn(t){var e=t.getDay();return 0===e?7:e}function Vn(t,e){return vn($e.count(He(t),t),e,2)}function Xn(t,e){var n=t.getDay();return t=4<=n||0===n?We(t):We.ceil(t),vn(We.count(He(t),t)+(4===He(t).getDay()),e,2)}function Jn(t){return t.getDay()}function Zn(t,e){return vn(Be.count(He(t),t),e,2)}function Qn(t,e){return vn(t.getFullYear()%100,e,2)}function Kn(t,e){return vn(t.getFullYear()%1e4,e,4)}function tr(t){var e=t.getTimezoneOffset();return(0<e?"-":(e*=-1,"+"))+vn(e/60|0,"0",2)+vn(e%60,"0",2)}function er(t,e){return vn(t.getUTCDate(),e,2)}function nr(t,e){return vn(t.getUTCHours(),e,2)}function rr(t,e){return vn(t.getUTCHours()%12||12,e,2)}function ir(t,e){return vn(1+Xe.count(en(t),t),e,3)}function ar(t,e){return vn(t.getUTCMilliseconds(),e,3)}function or(t,e){return ar(t,e)+"000"}function ur(t,e){return vn(t.getUTCMonth()+1,e,2)}function sr(t,e){return vn(t.getUTCMinutes(),e,2)}function fr(t,e){return vn(t.getUTCSeconds(),e,2)}function cr(t){var e=t.getUTCDay();return 0===e?7:e}function lr(t,e){return vn(Ze.count(en(t),t),e,2)}function hr(t,e){var n=t.getUTCDay();return t=4<=n||0===n?Ke(t):Ke.ceil(t),vn(Ke.count(en(t),t)+(4===en(t).getUTCDay()),e,2)}function dr(t){return t.getUTCDay()}function pr(t,e){return vn(Qe.count(en(t),t),e,2)}function vr(t,e){return vn(t.getUTCFullYear()%100,e,2)}function gr(t,e){return vn(t.getUTCFullYear()%1e4,e,4)}function mr(){return"+0000"}function yr(){return"%"}function br(t){return+t}function _r(t){return Math.floor(+t/1e3)}function xr(t){return on=function(t){var r=t.dateTime,i=t.date,a=t.time,e=t.periods,n=t.days,o=t.shortDays,u=t.months,s=t.shortMonths,f=mn(e),c=yn(e),l=mn(n),h=yn(n),d=mn(o),p=yn(o),v=mn(u),g=yn(u),m=mn(s),y=yn(s),b={a:function(t){return o[t.getDay()]},A:function(t){return n[t.getDay()]},b:function(t){return s[t.getMonth()]},B:function(t){return u[t.getMonth()]},c:null,d:Un,e:Un,f:Bn,H:Fn,I:jn,j:In,L:$n,m:Wn,M:Yn,p:function(t){return e[+(12<=t.getHours())]},Q:br,s:_r,S:Hn,u:Gn,U:Vn,V:Xn,w:Jn,W:Zn,x:null,X:null,y:Qn,Y:Kn,Z:tr,"%":yr},_={a:function(t){return o[t.getUTCDay()]},A:function(t){return n[t.getUTCDay()]},b:function(t){return s[t.getUTCMonth()]},B:function(t){return u[t.getUTCMonth()]},c:null,d:er,e:er,f:or,H:nr,I:rr,j:ir,L:ar,m:ur,M:sr,p:function(t){return e[+(12<=t.getUTCHours())]},Q:br,s:_r,S:fr,u:cr,U:lr,V:hr,w:dr,W:pr,x:null,X:null,y:vr,Y:gr,Z:mr,"%":yr},x={a:function(t,e,n){var r=d.exec(e.slice(n));return r?(t.w=p[r[0].toLowerCase()],n+r[0].length):-1},A:function(t,e,n){var r=l.exec(e.slice(n));return r?(t.w=h[r[0].toLowerCase()],n+r[0].length):-1},b:function(t,e,n){var r=m.exec(e.slice(n));return r?(t.m=y[r[0].toLowerCase()],n+r[0].length):-1},B:function(t,e,n){var r=v.exec(e.slice(n));return r?(t.m=g[r[0].toLowerCase()],n+r[0].length):-1},c:function(t,e,n){return k(t,r,e,n)},d:Cn,e:Cn,f:Tn,H:Dn,I:Dn,j:zn,L:Rn,m:An,M:On,p:function(t,e,n){var r=f.exec(e.slice(n));return r?(t.p=c[r[0].toLowerCase()],n+r[0].length):-1},Q:Ln,s:qn,S:Nn,u:_n,U:xn,V:wn,w:bn,W:Mn,x:function(t,e,n){return k(t,i,e,n)},X:function(t,e,n){return k(t,a,e,n)},y:En,Y:kn,Z:Sn,"%":Pn};function w(s,f){return function(t){var e,n,r,i=[],a=-1,o=0,u=s.length;for(t instanceof Date||(t=new Date(+t));++a<u;)37===s.charCodeAt(a)&&(i.push(s.slice(o,a)),null!=(n=ln[e=s.charAt(++a)])?e=s.charAt(++a):n="e"===e?" ":"0",(r=f[e])&&(e=r(t,n)),i.push(e),o=a+1);return i.push(s.slice(o,a)),i.join("")}}function M(i,a){return function(t){var e,n,r=an(1900);if(k(r,i,t+="",0)!=t.length)return null;if("Q"in r)return new Date(r.Q);if("p"in r&&(r.H=r.H%12+12*r.p),"V"in r){if(r.V<1||53<r.V)return null;"w"in r||(r.w=1),"Z"in r?(e=4<(n=(e=rn(an(r.y))).getUTCDay())||0===n?Qe.ceil(e):Qe(e),e=Xe.offset(e,7*(r.V-1)),r.y=e.getUTCFullYear(),r.m=e.getUTCMonth(),r.d=e.getUTCDate()+(r.w+6)%7):(e=4<(n=(e=a(an(r.y))).getDay())||0===n?Be.ceil(e):Be(e),e=je.offset(e,7*(r.V-1)),r.y=e.getFullYear(),r.m=e.getMonth(),r.d=e.getDate()+(r.w+6)%7)}else("W"in r||"U"in r)&&("w"in r||(r.w="u"in r?r.u%7:"W"in r?1:0),n="Z"in r?rn(an(r.y)).getUTCDay():a(an(r.y)).getDay(),r.m=0,r.d="W"in r?(r.w+6)%7+7*r.W-(n+5)%7:r.w+7*r.U-(n+6)%7);return"Z"in r?(r.H+=r.Z/100|0,r.M+=r.Z%100,rn(r)):a(r)}}function k(t,e,n,r){for(var i,a,o=0,u=e.length,s=n.length;o<u;){if(s<=r)return-1;if(37===(i=e.charCodeAt(o++))){if(i=e.charAt(o++),!(a=x[i in ln?e.charAt(o++):i])||(r=a(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return b.x=w(i,b),b.X=w(a,b),b.c=w(r,b),_.x=w(i,_),_.X=w(a,_),_.c=w(r,_),{format:function(t){var e=w(t+="",b);return e.toString=function(){return t},e},parse:function(t){var e=M(t+="",nn);return e.toString=function(){return t},e},utcFormat:function(t){var e=w(t+="",_);return e.toString=function(){return t},e},utcParse:function(t){var e=M(t,rn);return e.toString=function(){return t},e}}}(t),un=on.format,sn=on.parse,fn=on.utcFormat,cn=on.utcParse,on}xr({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});var wr="%Y-%m-%dT%H:%M:%S.%LZ";Date.prototype.toISOString||fn(wr);+new Date("2000-01-01T00:00:00.000Z")||cn(wr);var Mr=function(t,e,n){var r=ze((e=e||{}).type||"json");return r||rt("Unknown data format type: "+e.type),t=r(t,e),e.parse&&function(t,i,a){if(!t.length)return;a=a||sn;var e,n,r,o,u,s,f,c=t.columns||Object.keys(t[0]);"auto"===i&&(i=ve(t,c));for(c=Object.keys(i),e=c.map(function(t){var e,n,r=i[t];if(r&&(0===r.indexOf("date:")||0===r.indexOf("utc:")))return("\'"===(n=(e=r.split(/:(.+)?/,2))[1])[0]&&"\'"===n[n.length-1]||\'"\'===n[0]&&\'"\'===n[n.length-1])&&(n=n.slice(1,-1)),"utc"===e[0]?cn(n):a(n);if(!le[r])throw Error("Illegal format pattern: "+t+":"+r);return le[r]}),o=0,s=t.length,f=c.length;o<s;++o)for(n=t[o],u=0;u<f;++u)r=c[u],n[r]=e[u](n[r])}(t,e.parse,n),t.hasOwnProperty("columns")&&delete t.columns,t};var kr={skip:!0};function Er(r,t,i,e,n,a){var o,u,s=Wt({},a,kr);R(i)||(i=P(i)),void 0===e?o=function(t){r.touch(i(t))}:R(e)?(u=new Mt(null,e,n,!1),o=function(t){var e,n=i(t);u.evaluate(t),gt(e=u.value)?r.pulse(n,e,a):r.update(n,e,s)}):o=function(t){r.update(i(t),e,s)},t.apply(o)}function Sr(t,e,r,n,i,a){var o,u;void 0===n?u=r:(o=R(n)?n:P(n),(u=new Mt(null,n=r?function(t,e){var n=o(t,e);return r.skip()?n:r.skip(!0).value=n}:o,i,!1)).modified(a&&a.force),u.rank=0,r&&(u.skip(!0),u.value=r.value,u.targets().add(r))),e.targets().add(u)}var Ar={};function Cr(t,e,n){this.dataflow=t,this.stamp=null==e?-1:e,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=n||null}var zr=Cr.prototype;function Dr(n,r){return n?function(t,e){return n(t,e)&&r(t,e)}:r}function Or(t,e){var n=[];return at(t,e,function(t){n.push(t)}),n}function Nr(t,e){var n={};return t.visit(e,function(t){n[ct(t)]=1}),function(t){return n[ct(t)]?null:t}}function Rr(t,e,n,r){var i,a,o,u,s,f=0;for(this.dataflow=t,this.stamp=e,this.fields=null,this.encode=r||null,o=0,u=(this.pulses=n).length;o<u;++o)if((i=n[o]).stamp===e){if(i.fields)for(s in a=this.fields||(this.fields={}),i.fields)a[s]=1;i.changed(this.ADD)&&(f|=this.ADD),i.changed(this.REM)&&(f|=this.REM),i.changed(this.MOD)&&(f|=this.MOD)}this.changes=f}zr.StopPropagation=Ar,zr.ADD=1,zr.REM=2,zr.MOD=4,zr.ADD_REM=3,zr.ADD_MOD=5,zr.ALL=7,zr.REFLOW=8,zr.SOURCE=16,zr.NO_SOURCE=32,zr.NO_FIELDS=64,zr.fork=function(t){return new Cr(this.dataflow).init(this,t)},zr.addAll=function(){var t=this;return this.source&&this.source.length!==this.add.length&&((t=new Cr(this.dataflow).init(this)).add=t.source),t},zr.init=function(t,e){var n=this;return n.stamp=t.stamp,n.encode=t.encode,!t.fields||64&e||(n.fields=t.fields),1&e?(n.addF=t.addF,n.add=t.add):(n.addF=null,n.add=[]),2&e?(n.remF=t.remF,n.rem=t.rem):(n.remF=null,n.rem=[]),4&e?(n.modF=t.modF,n.mod=t.mod):(n.modF=null,n.mod=[]),32&e?(n.srcF=null,n.source=null):(n.srcF=t.srcF,n.source=t.source),n},zr.runAfter=function(t){this.dataflow.runAfter(t)},zr.changed=function(t){var e=t||7;return 1&e&&this.add.length||2&e&&this.rem.length||4&e&&this.mod.length},zr.reflow=function(t){if(t)return this.fork(7).reflow();var e=this.add.length,n=this.source&&this.source.length;return n&&n!==e&&(this.mod=this.source,e&&this.filter(4,Nr(this,1))),this},zr.modifies=function(t){var e=Q(t),n=this.fields||(this.fields={});return e.forEach(function(t){n[t]=!0}),this},zr.modified=function(t){var e=this.fields;return!(!this.mod.length||!e)&&(arguments.length?d(t)?t.some(function(t){return e[t]}):e[t]:!!e)},zr.filter=function(t,e){return 1&t&&(this.addF=Dr(this.addF,e)),2&t&&(this.remF=Dr(this.remF,e)),4&t&&(this.modF=Dr(this.modF,e)),16&t&&(this.srcF=Dr(this.srcF,e)),this},zr.materialize=function(t){var e=this;return 1&(t=t||7)&&e.addF&&(e.add=Or(e.add,e.addF),e.addF=null),2&t&&e.remF&&(e.rem=Or(e.rem,e.remF),e.remF=null),4&t&&e.modF&&(e.mod=Or(e.mod,e.modF),e.modF=null),16&t&&e.srcF&&(e.source=e.source.filter(e.srcF),e.srcF=null),e},zr.visit=function(t,e){var n,r,i=this,a=e;return 16&t?at(i.source,i.srcF,a):(1&t&&at(i.add,i.addF,a),2&t&&at(i.rem,i.remF,a),4&t&&at(i.mod,i.modF,a),8&t&&(n=i.source)&&((r=i.add.length+i.mod.length)===n.length||at(n,r?Nr(i,5):i.srcF,a))),i};var Tr=j(Rr,Cr);function Pr(e,t){try{t(e)}catch(t){e.error(t)}}Tr.fork=function(t){var e=new Cr(this.dataflow).init(this,t&this.NO_FIELDS);return void 0!==t&&(t&e.ADD&&this.visit(e.ADD,function(t){return e.add.push(t)}),t&e.REM&&this.visit(e.REM,function(t){return e.rem.push(t)}),t&e.MOD&&this.visit(e.MOD,function(t){return e.mod.push(t)})),e},Tr.changed=function(t){return this.changes&t},Tr.modified=function(t){var e=this.fields;return e&&this.changes&this.MOD?d(t)?t.some(function(t){return e[t]}):e[t]:0},Tr.filter=function(){rt("MultiPulse does not support filtering.")},Tr.materialize=function(){rt("MultiPulse does not support materialization.")},Tr.visit=function(t,e){var n=this.pulses,r=n.length,i=0;if(t&this.SOURCE)for(;i<r;++i)n[i].visit(t,e);else for(;i<r;++i)n[i].stamp===this.stamp&&n[i].visit(t,e);return this};var Lr={skip:!1,force:!1};function qr(t){this.cmp=t,this.nodes=[]}var Ur=qr.prototype;function Fr(t,e,n,r){var i,a,o;for(i=t[n];e<n&&r(i,a=t[o=n-1>>1])<0;)t[n]=a,n=o;return t[n]=i}function jr(t,e,n){for(var r,i=e,a=t.length,o=t[e],u=2*e+1;u<a;)(r=u+1)<a&&0<=n(t[u],t[r])&&(u=r),t[e]=t[u],u=2*(e=u)+1;return t[e]=o,Fr(t,i,e,n)}function Ir(){this._log=e(),this.logLevel(r),this._clock=0,this._rank=0;try{this._loader=re()}catch(t){}this._touched=ot(f),this._pulses={},this._pulse=null,this._heap=new qr(function(t,e){return t.qrank-e.qrank}),this._postrun=[]}Ur.size=function(){return this.nodes.length},Ur.clear=function(){return this.nodes=[],this},Ur.peek=function(){return this.nodes[0]},Ur.push=function(t){var e=this.nodes;return e.push(t),Fr(e,0,e.length-1,this.cmp)},Ur.pop=function(){var t,e=this.nodes,n=e.pop();return e.length?(t=e[0],e[0]=n,jr(e,0,this.cmp)):t=n,t},Ur.replace=function(t){var e=this.nodes,n=e[0];return e[0]=t,jr(e,0,this.cmp),n},Ur.pushpop=function(t){var e=this.nodes,n=e[0];return e.length&&this.cmp(n,t)<0&&(e[0]=t,t=n,jr(e,0,this.cmp)),t};var $r=Ir.prototype;function Br(t){return function(){return this._log[t].apply(this,arguments)}}function Wr(t,e){Mt.call(this,t,null,e)}$r.stamp=function(){return this._clock},$r.loader=function(t){return arguments.length?(this._loader=t,this):this._loader},$r.cleanThreshold=1e4,$r.add=function(t,e,n,r){var i,a=1;return t instanceof Mt?i=t:t&&t.prototype instanceof Mt?i=new t:R(t)?i=new Mt(null,t):(a=0,i=new Mt(t,e)),this.rank(i),a&&(r=n,n=e),n&&this.connect(i,i.parameters(n,r)),this.touch(i),i},$r.connect=function(t,e){var n,r,i=t.rank;for(n=0,r=e.length;n<r;++n)if(i<e[n].rank)return void this.rerank(t)},$r.rank=function(t){t.rank=++this._rank},$r.rerank=function(t){for(var e,n,r,i=[t];i.length;)if(this.rank(e=i.pop()),n=e._targets)for(r=n.length;0<=--r;)i.push(e=n[r]),e===t&&rt("Cycle detected in dataflow graph.")},$r.pulse=function(t,e,n){this.touch(t,n||Lr);var r=new Cr(this,this._clock+(this._pulse?0:1)),i=t.pulse&&t.pulse.source||[];return r.target=t,this._pulses[t.id]=e.pulse(r,i),this},$r.touch=function(t,e){var n=e||Lr;return this._pulse?this._enqueue(t):this._touched.add(t),n.skip&&t.skip(!0),this},$r.update=function(t,e,n){var r=n||Lr;return(t.set(e)||r.force)&&this.touch(t,r),this},$r.changeset=mt,$r.ingest=function(t,e,n){return this.pulse(t,this.changeset().insert(Mr(e,n)))},$r.request=function(e,n,r){var t,i,a,o,u=this,s=u._pending||(t=u,(o=new Promise(function(t,e){i=t,a=e})).requests=0,o.done=function(){0==--o.requests&&t.runAfter(function(){t._pending=null;try{t.run(),i(t)}catch(t){a(t)}})},t._pending=o);s.requests+=1,u.loader().load(n,{context:"dataflow"}).then(function(t){u.ingest(e,t,r)},function(t){u.error("Loading failed",n,t)}).catch(function(t){u.error("Data ingestion failed",n,t)}).then(s.done,s.done)},$r.events=function(t,e,n,r){for(var i,a=this,o=Ct(n,r),u=function(t){t.dataflow=a;try{o.receive(t)}catch(t){a.error(t)}finally{a.run()}},s=0,f=(i="string"==typeof t&&"undefined"!=typeof document?document.querySelectorAll(t):Q(t)).length;s<f;++s)i[s].addEventListener(e,u);return o},$r.on=function(t,e,n,r,i){return(t instanceof Mt?Sr:Er)(this,t,e,n,r,i),this},$r.run=function(t){var e,n,r,i,a=this,o=0,u=a.logLevel();if(a._pending)return a.info("Awaiting requests, delaying dataflow run."),0;if(a._pulse)return a.error("Dataflow invoked recursively. Use the runAfter method to queue invocation."),0;if(!a._touched.length)return a.info("Dataflow invoked, but nothing to do."),0;a._pulse=new Cr(a,++a._clock,t),_<=u&&(r=Date.now(),a.debug("-- START PROPAGATION ("+a._clock+") -----")),a._touched.forEach(function(t){a._enqueue(t,!0)}),a._touched=ot(f);try{for(;0<a._heap.size();)(e=a._heap.pop()).rank===e.qrank?(n=e.run(a._getPulse(e,t)),k<=u&&a.debug(e.id,n===Ar?"STOP":n,e),n!==Ar&&(a._pulse=n,e._targets&&e._targets.forEach(function(t){a._enqueue(t)})),++o):a._enqueue(e,!0)}catch(t){i=t}if(a._pulses={},a._pulse=null,_<=u&&(r=Date.now()-r,a.info("> Pulse "+a._clock+": "+o+" operators; "+r+"ms")),i&&(a._postrun=[],a.error(i)),a._onrun)try{a._onrun(a,o,i)}catch(t){a.error(t)}if(a._postrun.length){var s=a._postrun;a._postrun=[],s.sort(function(t,e){return e.priority-t.priority}).forEach(function(t){Pr(a,t.callback)})}return o},$r.runAsync=function(){return this._pending||Promise.resolve(this.run())},$r.runAfter=function(t,e,n){this._pulse||e?this._postrun.push({priority:n||0,callback:t}):Pr(this,t)},$r._enqueue=function(t,e){var n=!this._pulses[t.id];n&&(this._pulses[t.id]=this._pulse),(n||e)&&(t.qrank=t.rank,this._heap.push(t))},$r._getPulse=function(t,e){var n,r=t.source,i=this._clock;return r&&d(r)?new Rr(this,i,n=r.map(function(t){return t.pulse}),e):(n=this._pulses[t.id],r&&((r=r.pulse)&&r!==Ar?r.stamp===i&&n.target!==t?n=r:n.source=r.source:n.source=[]),n)},$r.error=Br("error"),$r.warn=Br("warn"),$r.info=Br("info"),$r.debug=Br("debug"),$r.logLevel=Br("level");var Yr=j(Wr,Mt);Yr.run=function(t){return t.stamp<=this.stamp?t.StopPropagation:(this.skip()?this.skip(!1):e=this.evaluate(t),(e=e||t)!==t.StopPropagation&&(this.pulse=e),this.stamp=t.stamp,e);var e},Yr.evaluate=function(t){var e=this.marshall(t.stamp),n=this.transform(e,t);return e.clear(),n},Yr.transform=function(){};var Hr={};function Gr(t){var e=Vr(t);return e&&e.Definition||null}function Vr(t){return t=t&&t.toLowerCase(),Hr.hasOwnProperty(t)?Hr[t]:null}function Xr(t){return t&&t.length?1===t.length?t[0]:(i=t,function(t){for(var e=i.length,n=1,r=String(i[0](t));n<e;++n)r+="|"+i[n](t);return r}):function(){return""};var i}function Jr(t,e,n){return n||t+(e?"_"+e:"")}var Zr={values:ti({name:"values",init:"cell.store = true;",set:"cell.data.values()",idx:-1}),count:ti({name:"count",set:"cell.num"}),__count__:ti({name:"count",set:"this.missing + this.valid"}),missing:ti({name:"missing",set:"this.missing"}),valid:ti({name:"valid",set:"this.valid"}),sum:ti({name:"sum",init:"this.sum = 0;",add:"this.sum += v;",rem:"this.sum -= v;",set:"this.sum"}),mean:ti({name:"mean",init:"this.mean = 0;",add:"var d = v - this.mean; this.mean += d / this.valid;",rem:"var d = v - this.mean; this.mean -= this.valid ? d / this.valid : this.mean;",set:"this.mean"}),average:ti({name:"average",set:"this.mean",req:["mean"],idx:1}),variance:ti({name:"variance",init:"this.dev = 0;",add:"this.dev += d * (v - this.mean);",rem:"this.dev -= d * (v - this.mean);",set:"this.valid > 1 ? this.dev / (this.valid-1) : 0",req:["mean"],idx:1}),variancep:ti({name:"variancep",set:"this.valid > 1 ? this.dev / this.valid : 0",req:["variance"],idx:2}),stdev:ti({name:"stdev",set:"this.valid > 1 ? Math.sqrt(this.dev / (this.valid-1)) : 0",req:["variance"],idx:2}),stdevp:ti({name:"stdevp",set:"this.valid > 1 ? Math.sqrt(this.dev / this.valid) : 0",req:["variance"],idx:2}),stderr:ti({name:"stderr",set:"this.valid > 1 ? Math.sqrt(this.dev / (this.valid * (this.valid-1))) : 0",req:["variance"],idx:2}),distinct:ti({name:"distinct",set:"cell.data.distinct(this.get)",req:["values"],idx:3}),ci0:ti({name:"ci0",set:"cell.data.ci0(this.get)",req:["values"],idx:3}),ci1:ti({name:"ci1",set:"cell.data.ci1(this.get)",req:["values"],idx:3}),median:ti({name:"median",set:"cell.data.q2(this.get)",req:["values"],idx:3}),q1:ti({name:"q1",set:"cell.data.q1(this.get)",req:["values"],idx:3}),q3:ti({name:"q3",set:"cell.data.q3(this.get)",req:["values"],idx:3}),argmin:ti({name:"argmin",init:"this.argmin = null;",add:"if (v < this.min) this.argmin = t;",rem:"if (v <= this.min) this.argmin = null;",set:"this.argmin || cell.data.argmin(this.get)",req:["min"],str:["values"],idx:3}),argmax:ti({name:"argmax",init:"this.argmax = null;",add:"if (v > this.max) this.argmax = t;",rem:"if (v >= this.max) this.argmax = null;",set:"this.argmax || cell.data.argmax(this.get)",req:["max"],str:["values"],idx:3}),min:ti({name:"min",init:"this.min = null;",add:"if (v < this.min || this.min === null) this.min = v;",rem:"if (v <= this.min) this.min = NaN;",set:"this.min = (isNaN(this.min) ? cell.data.min(this.get) : this.min)",str:["values"],idx:4}),max:ti({name:"max",init:"this.max = null;",add:"if (v > this.max || this.max === null) this.max = v;",rem:"if (v >= this.max) this.max = NaN;",set:"this.max = (isNaN(this.max) ? cell.data.max(this.get) : this.max)",str:["values"],idx:4})},Qr=Object.keys(Zr);function Kr(t,e){return Zr[t](e)}function ti(n){return function(t){var e=Wt({init:"",add:"",rem:"",idx:0},n);return e.out=t||n.name,e}}function ei(t,e){return t.idx-e.idx}function ni(t,e){var n=e||c,r=function(t,i){var e,n=t.reduce(function e(n,t){function r(t){n[t]||e(n,n[t]=Zr[t]())}return t.req&&t.req.forEach(r),i&&t.str&&t.str.forEach(r),n},t.reduce(function(t,e){return t[e.name]=e,t},{})),r=[];for(e in n)r.push(n[e]);return r.sort(ei)}(t,!0),i="var cell = this.cell; this.valid = 0; this.missing = 0;",a="this.cell = cell; this.init();",o="if(v==null){++this.missing; return;} if(v!==v) return; ++this.valid;",u="if(v==null){--this.missing; return;} if(v!==v) return; --this.valid;",s="var cell = this.cell;";return r.forEach(function(t){i+=t.init,o+=t.add,u+=t.rem}),t.slice().sort(ei).forEach(function(t){s+="t[\'"+t.out+"\']="+t.set+";"}),s+="return t;",(a=Function("cell",a)).prototype.init=Function(i),a.prototype.add=Function("v","t",o),a.prototype.rem=Function("v","t",u),a.prototype.set=Function("t",s),a.prototype.get=n,a.fields=t.map(function(t){return t.out}),a}var ri=function(t){var e,n,r,i,a,o,u,s,f=t.maxbins||20,c=t.base||10,l=Math.log(c),h=t.divide||[5,2],d=t.extent[0],p=t.extent[1],v=p-d;if(t.step)e=t.step;else if(t.steps){for(a=v/f,o=0,u=t.steps.length;o<u&&t.steps[o]<a;++o);e=t.steps[Math.max(0,o-1)]}else{for(n=Math.ceil(Math.log(f)/l),r=t.minstep||0,e=Math.max(r,Math.pow(c,Math.round(Math.log(v)/l)-n));Math.ceil(v/e)>f;)e*=c;for(o=0,u=h.length;o<u;++o)r<=(a=e/h[o])&&v/a<=f&&(e=a)}return i=0<=(a=Math.log(e))?0:1+~~(-a/l),s=Math.pow(c,-i-1),(t.nice||void 0===t.nice)&&(d=d<(a=Math.floor(d/e+s)*e)?a-e:a,p=Math.ceil(p/e)*e),{start:d,stop:p,step:e}},ii=function(t,e){var n,r=[],i=t.length,a=-1;if(null==e)for(;++a<i;)isNaN(n=ai(t[a]))||r.push(n);else for(;++a<i;)isNaN(n=ai(e(t[a],a,t)))||r.push(n);return r};function ai(t){return null===t?NaN:+t}y.random=Math.random;var oi=function(t,e){return t<e?-1:e<t?1:e<=t?0:NaN},ui=function(a){var n;return 1===a.length&&(n=a,a=function(t,e){return oi(n(t),e)}),{left:function(t,e,n,r){for(null==n&&(n=0),null==r&&(r=t.length);n<r;){var i=n+r>>>1;a(t[i],e)<0?n=i+1:r=i}return n},right:function(t,e,n,r){for(null==n&&(n=0),null==r&&(r=t.length);n<r;){var i=n+r>>>1;0<a(t[i],e)?r=i:n=i+1}return n}}};var si=ui(oi),fi=si.right,ci=si.left;var li=function(t){return null===t?NaN:+t},hi=function(t,e){var n,r,i=t.length,a=0,o=-1,u=0,s=0;if(null==e)for(;++o<i;)isNaN(n=li(t[o]))||(s+=(r=n-u)*(n-(u+=r/++a)));else for(;++o<i;)isNaN(n=li(e(t[o],o,t)))||(s+=(r=n-u)*(n-(u+=r/++a)));if(1<a)return s/(a-1)},di=function(t,e){var n,r,i,a=t.length,o=-1;if(null==e){for(;++o<a;)if(null!=(n=t[o])&&n<=n)for(r=i=n;++o<a;)null!=(n=t[o])&&(n<r&&(r=n),i<n&&(i=n))}else for(;++o<a;)if(null!=(n=e(t[o],o,t))&&n<=n)for(r=i=n;++o<a;)null!=(n=e(t[o],o,t))&&(n<r&&(r=n),i<n&&(i=n));return[r,i]},pi=function(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((e-t)/n)),a=new Array(i);++r<i;)a[r]=t+r*n;return a},vi=Math.sqrt(50),gi=Math.sqrt(10),mi=Math.sqrt(2),yi=function(t,e,n){var r,i,a,o,u=-1;if(n=+n,(t=+t)===(e=+e)&&0<n)return[t];if((r=e<t)&&(i=t,t=e,e=i),0===(o=bi(t,e,n))||!isFinite(o))return[];if(0<o)for(t=Math.ceil(t/o),e=Math.floor(e/o),a=new Array(i=Math.ceil(e-t+1));++u<i;)a[u]=(t+u)*o;else for(t=Math.floor(t*o),e=Math.ceil(e*o),a=new Array(i=Math.ceil(t-e+1));++u<i;)a[u]=(t-u)/o;return r&&a.reverse(),a};function bi(t,e,n){var r=(e-t)/Math.max(0,n),i=Math.floor(Math.log(r)/Math.LN10),a=r/Math.pow(10,i);return 0<=i?(vi<=a?10:gi<=a?5:mi<=a?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(vi<=a?10:gi<=a?5:mi<=a?2:1)}function _i(t,e,n){var r=Math.abs(e-t)/Math.max(0,n),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),a=r/i;return vi<=a?i*=10:gi<=a?i*=5:mi<=a&&(i*=2),e<t?-i:i}var xi=function(t){return Math.ceil(Math.log(t.length)/Math.LN2)+1},wi=function(t,e,n){if(null==n&&(n=li),r=t.length){if((e=+e)<=0||r<2)return+n(t[0],0,t);if(1<=e)return+n(t[r-1],r-1,t);var r,i=(r-1)*e,a=Math.floor(i),o=+n(t[a],a,t);return o+(+n(t[a+1],a+1,t)-o)*(i-a)}},Mi=function(t,e){var n,r,i=t.length,a=-1;if(null==e){for(;++a<i;)if(null!=(n=t[a])&&n<=n)for(r=n;++a<i;)null!=(n=t[a])&&r<n&&(r=n)}else for(;++a<i;)if(null!=(n=e(t[a],a,t))&&n<=n)for(r=n;++a<i;)null!=(n=e(t[a],a,t))&&r<n&&(r=n);return r},ki=function(t){for(var e,n,r,i=t.length,a=-1,o=0;++a<i;)o+=t[a].length;for(n=new Array(o);0<=--i;)for(e=(r=t[i]).length;0<=--e;)n[--o]=r[e];return n},Ei=function(t,e){for(var n=e.length,r=new Array(n);n--;)r[n]=t[e[n]];return r};var Si=function(t,e,n,r){var i,a,o,u,s=ii(t,r),f=s.length,c=e;for(o=0,u=Array(c);o<c;++o){for(a=i=0;a<f;++a)i+=s[~~(y.random()*f)];u[o]=i/f}return[wi(u.sort(oi),n/2),wi(u,1-n/2)]},Ai=function(t,e){var n=ii(t,e);return[wi(n.sort(oi),.25),wi(n,.5),wi(n,.75)]},Ci=function(t,e){var o,u,i=NaN,n={mean:function(t){return arguments.length?(o=t||0,i=NaN,n):o},stdev:function(t){return arguments.length?(u=null==t?1:t,i=NaN,n):u},sample:function(){var t,e,n=0,r=0;if(i==i)return n=i,i=NaN,n;for(;0===(t=(n=2*y.random()-1)*n+(r=2*y.random()-1)*r)||1<t;);return e=Math.sqrt(-2*Math.log(t)/t),i=o+r*e*u,o+n*e*u},pdf:function(t){var e=Math.exp(Math.pow(t-o,2)/(-2*Math.pow(u,2)));return 1/(u*Math.sqrt(2*Math.PI))*e},cdf:function(t){var e,n=(t-o)/u,r=Math.abs(n);if(37<r)e=0;else{var i=Math.exp(-r*r/2);r<7.07106781186547?(e=i*((((((.0352624965998911*r+.700383064443688)*r+6.37396220353165)*r+33.912866078383)*r+112.079291497871)*r+221.213596169931)*r+220.206867912376),e/=((((((.0883883476483184*r+1.75566716318264)*r+16.064177579207)*r+86.7807322029461)*r+296.564248779674)*r+637.333633378831)*r+793.826512519948)*r+440.413735824752):e=i/(r+1/(r+2/(r+3/(r+4/(r+.65)))))/2.506628274631}return 0<n?1-e:e},icdf:function(t){if(t<=0||1<=t)return NaN;var e=2*t-1,n=8*(Math.PI-3)/(3*Math.PI*(4-Math.PI)),r=2/(Math.PI*n)+Math.log(1-Math.pow(e,2))/2,i=Math.log(1-e*e)/n,a=(0<e?1:-1)*Math.sqrt(Math.sqrt(r*r-i)-r);return o+u*Math.SQRT2*a}};return n.mean(t).stdev(e)},zi=function(a,o){var r=Ci(),u={},i=0;return u.data=function(t){return arguments.length?(i=(a=t)?t.length:0,u.bandwidth(o)):a},u.bandwidth=function(t){return arguments.length?(!(o=t)&&a&&(n=(e=a).length,r=Ai(e),i=(r[2]-r[0])/1.34,o=1.06*Math.min(Math.sqrt(hi(e)),i)*Math.pow(n,-.2)),u):o;var e,n,r,i},u.sample=function(){return a[~~(y.random()*i)]+o*r.sample()},u.pdf=function(t){for(var e=0,n=0;n<i;++n)e+=r.pdf((t-a[n])/o);return e/o/i},u.cdf=function(t){for(var e=0,n=0;n<i;++n)e+=r.cdf((t-a[n])/o);return e/i},u.icdf=function(){throw Error("KDE icdf not supported.")},u.data(a)};var Di=function(i,e){var a,n={},o=0;return n.weights=function(t){return arguments.length?(a=function(t){var e,n=[],r=0;for(e=0;e<o;++e)r+=n[e]=null==t[e]?1:+t[e];for(e=0;e<o;++e)n[e]/=r;return n}(e=t||[]),n):e},n.distributions=function(t){return arguments.length?(t?(o=t.length,i=t):(o=0,i=[]),n.weights(e)):i},n.sample=function(){for(var t=y.random(),e=i[o-1],n=a[0],r=0;r<o-1;n+=a[++r])if(t<n){e=i[r];break}return e.sample()},n.pdf=function(t){for(var e=0,n=0;n<o;++n)e+=a[n]*i[n].pdf(t);return e},n.cdf=function(t){for(var e=0,n=0;n<o;++n)e+=a[n]*i[n].cdf(t);return e},n.icdf=function(){throw Error("Mixture icdf not supported.")},n.distributions(i).weights(e)},Oi=function(t,e){null==e&&(e=null==t?1:t,t=0);var n,r,i,a={};return a.min=function(t){return arguments.length?(i=r-(n=t||0),a):n},a.max=function(t){return arguments.length?(i=(r=t||0)-n,a):r},a.sample=function(){return n+i*y.random()},a.pdf=function(t){return n<=t&&t<=r?1/i:0},a.cdf=function(t){return t<n?0:r<t?1:(t-n)/i},a.icdf=function(t){return 0<=t&&t<=1?n+t*i:NaN},a.min(t).max(e)};function Ni(t){this._key=t?l(t):ct,this.reset()}var Ri=Ni.prototype;function Ti(t){Wr.call(this,null,t),this._adds=[],this._mods=[],this._alen=0,this._mlen=0,this._drop=!0,this._cross=!1,this._dims=[],this._dnames=[],this._measures=[],this._countOnly=!1,this._counts=null,this._prev=null,this._inputs=null,this._outputs=null}Ri.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},Ri.add=function(t){this._add.push(t)},Ri.rem=function(t){this._rem.push(t)},Ri.values=function(){if(this._get=null,0===this._rem.length)return this._add;var t,e,n,r=this._add,i=this._rem,a=this._key,o=r.length,u=i.length,s=Array(o-u),f={};for(t=0;t<u;++t)f[a(i[t])]=1;for(e=t=0;t<o;++t)f[a(n=r[t])]?f[a(n)]=0:s[e++]=n;return this._rem=[],this._add=s},Ri.distinct=function(t){for(var e,n=this.values(),r=n.length,i={},a=0;0<=--r;)e=t(n[r])+"",i.hasOwnProperty(e)||(i[e]=1,++a);return a},Ri.extent=function(t){if(this._get!==t||!this._ext){var e=this.values(),n=q(e,t);this._ext=[e[n[0]],e[n[1]]],this._get=t}return this._ext},Ri.argmin=function(t){return this.extent(t)[0]||{}},Ri.argmax=function(t){return this.extent(t)[1]||{}},Ri.min=function(t){var e=this.extent(t)[0];return null!=e?t(e):1/0},Ri.max=function(t){var e=this.extent(t)[1];return null!=e?t(e):-1/0},Ri.quartile=function(t){return this._get===t&&this._q||(this._q=Ai(this.values(),t),this._get=t),this._q},Ri.q1=function(t){return this.quartile(t)[0]},Ri.q2=function(t){return this.quartile(t)[1]},Ri.q3=function(t){return this.quartile(t)[2]},Ri.ci=function(t){return this._get===t&&this._ci||(this._ci=Si(this.values(),1e3,.05,t),this._get=t),this._ci},Ri.ci0=function(t){return this.ci(t)[0]},Ri.ci1=function(t){return this.ci(t)[1]},Ti.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:Qr},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"drop",type:"boolean",default:!0},{name:"cross",type:"boolean",default:!1},{name:"key",type:"field"}]};var Pi=j(Ti,Wr);function Li(t){Wr.call(this,null,t)}Pi.transform=function(t,e){var n,r=this,i=e.fork(e.NO_SOURCE|e.NO_FIELDS);return this.stamp=i.stamp,this.value&&((n=t.modified())||e.modified(this._inputs))?(this._prev=this.value,this.value=n?this.init(t):{},e.visit(e.SOURCE,function(t){r.add(t)})):(this.value=this.value||this.init(t),e.visit(e.REM,function(t){r.rem(t)}),e.visit(e.ADD,function(t){r.add(t)})),i.modifies(this._outputs),r._drop=!1!==t.drop,t.cross&&1<r._dims.length&&(r._drop=!1,this.cross()),r.changes(i)},Pi.cross=function(){var s=this,f=s.value,c=s._dnames,l=c.map(function(){return{}}),h=c.length;function t(t){var e,n,r,i;for(e in t)for(r=t[e].tuple,n=0;n<h;++n)l[n][i=r[c[n]]]=i}t(s._prev),t(f),function t(e,n,r){var i,a,o=c[r],u=l[r++];for(i in u)n[o]=u[i],a=e?e+"|"+i:i,r<h?t(a,n,r):f[a]||s.cell(a,n)}("",{},0)},Pi.init=function(t){var a=this._inputs=[],n=this._outputs=[],o={};function r(t){for(var e,n=Q(x(t)),r=0,i=n.length;r<i;++r)o[e=n[r]]||(o[e]=1,a.push(e))}this._dims=Q(t.groupby),this._dnames=this._dims.map(function(t){var e=M(t);return r(t),n.push(e),e}),this.cellkey=t.key?t.key:Xr(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];var e,i,u,s,f,c,l=t.fields||[null],h=t.ops||["count"],d=t.as||[],p=l.length,v={};for(p!==h.length&&rt("Unmatched number of fields and aggregate ops."),c=0;c<p;++c)e=l[c],i=h[c],null==e&&"count"!==i&&rt("Null aggregate field specified."),f=Jr(i,s=M(e),d[c]),n.push(f),"count"!==i?((u=v[s])||(r(e),(u=v[s]=[]).field=e,this._measures.push(u)),"count"!==i&&(this._countOnly=!1),u.push(Kr(i,f))):this._counts.push(f);return this._measures=this._measures.map(function(t){return ni(t,t.field)}),{}},Pi.cellkey=Xr(),Pi.cell=function(t,e){var n=this.value[t];return n?0===n.num&&this._drop&&n.stamp<this.stamp?(n.stamp=this.stamp,this._adds[this._alen++]=n):n.stamp<this.stamp&&(n.stamp=this.stamp,this._mods[this._mlen++]=n):(n=this.value[t]=this.newcell(t,e),this._adds[this._alen++]=n),n},Pi.newcell=function(t,e){var n={key:t,num:0,agg:null,tuple:this.newtuple(e,this._prev&&this._prev[t]),stamp:this.stamp,store:!1};if(!this._countOnly){var r,i=this._measures,a=i.length;for(n.agg=Array(a),r=0;r<a;++r)n.agg[r]=new i[r](n)}return n.store&&(n.data=new Ni),n},Pi.newtuple=function(t,e){var n,r,i=this._dnames,a=this._dims,o={};for(n=0,r=a.length;n<r;++n)o[i[n]]=a[n](t);return e?vt(e.tuple,o):ht(o)},Pi.add=function(t){var e,n,r,i=this.cellkey(t),a=this.cell(i,t);if(a.num+=1,!this._countOnly)for(a.store&&a.data.add(t),n=0,r=(e=a.agg).length;n<r;++n)e[n].add(e[n].get(t),t)},Pi.rem=function(t){var e,n,r,i=this.cellkey(t),a=this.cell(i,t);if(a.num-=1,!this._countOnly)for(a.store&&a.data.rem(t),n=0,r=(e=a.agg).length;n<r;++n)e[n].rem(e[n].get(t),t)},Pi.celltuple=function(t){var e,n,r,i=t.tuple,a=this._counts;for(t.store&&t.data.values(),n=0,r=a.length;n<r;++n)i[a[n]]=t.num;if(!this._countOnly)for(n=0,r=(e=t.agg).length;n<r;++n)e[n].set(i);return i},Pi.changes=function(t){var e,n,r,i,a=this._adds,o=this._mods,u=this._prev,s=this._drop,f=t.add,c=t.rem,l=t.mod;if(u)for(n in u)e=u[n],s&&!e.num||c.push(e.tuple);for(r=0,i=this._alen;r<i;++r)f.push(this.celltuple(a[r])),a[r]=null;for(r=0,i=this._mlen;r<i;++r)(0===(e=o[r]).num&&s?c:l).push(this.celltuple(e)),o[r]=null;return this._alen=this._mlen=0,this._prev=null,t},Li.Definition={type:"Bin",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"anchor",type:"number"},{name:"maxbins",type:"number",default:20},{name:"base",type:"number",default:10},{name:"divide",type:"number",array:!0,default:[5,2]},{name:"extent",type:"number",array:!0,length:2,required:!0},{name:"step",type:"number"},{name:"steps",type:"number",array:!0},{name:"minstep",type:"number",default:0},{name:"nice",type:"boolean",default:!0},{name:"name",type:"string"},{name:"as",type:"string",array:!0,length:2,default:["bin0","bin1"]}]};var qi=j(Li,Wr);qi.transform=function(t,e){var n,r=this._bins(t),i=r.start,a=r.step,o=t.as||["bin0","bin1"],u=o[0],s=o[1];return n=t.modified()?(e=e.reflow(!0)).SOURCE:e.modified(x(t.field))?e.ADD_MOD:e.ADD,e.visit(n,function(t){var e=r(t);t[u]=e,t[s]=null==e?null:i+a*(1+(e-i)/a)}),e.modifies(o)},qi._bins=function(t){if(this.value&&!t.modified())return this.value;var e,n,r=t.field,i=ri(t),a=i.start,o=i.stop,u=i.step;null!=(e=t.anchor)&&(n=e-(a+u*Math.floor((e-a)/u)),a+=n,o+=n);var s=function(t){var e=r(t);return null==e?null:(e=Math.max(a,Math.min(+e,o-u)),a+u*Math.floor((e-a)/u))};return s.start=a,s.stop=o,s.step=u,this.value=g(s,x(r),t.name||"bin_"+M(r))};var Ui=function(t,e,n){var r=t,i=e||[],a=n||[],o={},u=0;return{add:function(t){a.push(t)},remove:function(t){o[r(t)]=++u},size:function(){return i.length},data:function(t,e){return u&&(i=i.filter(function(t){return!o[r(t)]}),o={},u=0),e&&t&&i.sort(t),a.length&&(i=t?H(t,i,a.sort(t)):i.concat(a),a=[]),i}}};function Fi(t){Wr.call(this,[],t)}function ji(t){Mt.call(this,null,Ii,t)}function Ii(t){return this.value&&!t.modified()?this.value:T(t.fields,t.orders)}function $i(t){Wr.call(this,null,t)}Fi.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},j(Fi,Wr).transform=function(t,e){var n=e.fork(e.ALL),r=Ui(ct,this.value,n.materialize(n.ADD).add),i=t.sort,a=e.changed()||i&&(t.modified("sort")||e.modified(i.fields));return n.visit(n.REM,r.remove),this.modified(a),this.value=n.source=r.data(i,a),e.source&&e.source.root&&(this.value.root=e.source.root),n},j(ji,Mt),$i.Definition={type:"CountPattern",metadata:{generates:!0,changes:!0},params:[{name:"field",type:"field",required:!0},{name:"case",type:"enum",values:["upper","lower","mixed"],default:"mixed"},{name:"pattern",type:"string",default:\'[\\\\w"]+\'},{name:"stopwords",type:"string",default:""},{name:"as",type:"string",array:!0,length:2,default:["text","count"]}]};var Bi=j($i,Wr);function Wi(t){Wr.call(this,null,t)}Bi.transform=function(o,t){function e(a){return function(t){for(var e,n=function(t,e,n){switch(e){case"upper":t=t.toUpperCase();break;case"lower":t=t.toLowerCase()}return t.match(n)}(f(t),o.case,u)||[],r=0,i=n.length;r<i;++r)s.test(e=n[r])||a(e)}}var n=this._parameterCheck(o,t),r=this._counts,u=this._match,s=this._stop,f=o.field,i=o.as||["text","count"],a=e(function(t){r[t]=1+(r[t]||0)}),c=e(function(t){r[t]-=1});return n?t.visit(t.SOURCE,a):(t.visit(t.ADD,a),t.visit(t.REM,c)),this._finish(t,i)},Bi._parameterCheck=function(t,e){var n=!1;return!t.modified("stopwords")&&this._stop||(this._stop=new RegExp("^"+(t.stopwords||"")+"$","i"),n=!0),!t.modified("pattern")&&this._match||(this._match=new RegExp(t.pattern||"[\\\\w\']+","g"),n=!0),(t.modified("field")||e.modified(t.field.fields))&&(n=!0),n&&(this._counts={}),n},Bi._finish=function(t,e){var n,r,i,a=this._counts,o=this._tuples||(this._tuples={}),u=e[0],s=e[1],f=t.fork(t.NO_SOURCE|t.NO_FIELDS);for(n in a)r=o[n],i=a[n]||0,!r&&i?(o[n]=r=ht({}),r[u]=n,r[s]=i,f.add.push(r)):0===i?(r&&f.rem.push(r),a[n]=null,o[n]=null):r[s]!==i&&(r[s]=i,f.mod.push(r));return f.modifies(e)},Wi.Definition={type:"Cross",metadata:{generates:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]},j(Wi,Wr).transform=function(t,e){var n=e.fork(e.NO_SOURCE),r=this.value,i=t.as||["a","b"],a=i[0],o=i[1];return!r||e.changed(e.ADD_REM)||t.modified("as")||t.modified("filter")?(r&&(n.rem=r),r=e.materialize(e.SOURCE).source,n.add=this.value=function(t,e,n,r){for(var i,a,o=[],u={},s=t.length,f=0;f<s;++f)for(u[e]=a=t[f],i=0;i<s;++i)u[n]=t[i],r(u)&&(o.push(ht(u)),(u={})[e]=a);return o}(r,a,o,t.filter||v)):n.mod=r,n.source=this.value,n.modifies(i)};var Yi={kde:zi,mixture:Di,normal:Ci,uniform:Oi},Hi="distributions",Gi="function",Vi="field";function Xi(t){Wr.call(this,null,t)}var Ji=[{key:{function:"normal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"uniform"},params:[{name:"min",type:"number",default:0},{name:"max",type:"number",default:1}]},{key:{function:"kde"},params:[{name:"field",type:"field",required:!0},{name:"from",type:"data"},{name:"bandwidth",type:"number",default:0}]}],Zi={key:{function:"mixture"},params:[{name:"distributions",type:"param",array:!0,params:Ji},{name:"weights",type:"number",array:!0}]};function Qi(t){Wr.call(this,[1/0,-1/0],t)}function Ki(t,e){Mt.call(this,t),this.parent=e}Xi.Definition={type:"Density",metadata:{generates:!0},params:[{name:"extent",type:"number",array:!0,length:2},{name:"steps",type:"number",default:100},{name:"method",type:"string",default:"pdf",values:["pdf","cdf"]},{name:"distribution",type:"param",params:Ji.concat(Zi)},{name:"as",type:"string",array:!0,default:["value","density"]}]},j(Xi,Wr).transform=function(t,e){var n,r=e.fork(e.NO_SOURCE|e.NO_FIELDS);if(!this.value||e.changed()||t.modified()){var i=function e(t,n){var r=t[Gi];Yi.hasOwnProperty(r)||rt("Unknown distribution function: "+r);var i=Yi[r]();for(var a in t)a===Vi?i.data((t.from||n()).map(t[a])):a===Hi?i[a](t[a].map(function(t){return e(t,n)})):typeof i[a]===Gi&&i[a](t[a]);return i}(t.distribution,(n=e,function(){return n.materialize(n.SOURCE).source})),a=t.method||"pdf";"pdf"!==a&&"cdf"!==a&&rt("Invalid density method: "+a),t.extent||i.data||rt("Missing density extent parameter."),a=i[a];var o=t.as||["value","density"],u=t.extent||di(i.data()),s=(u[1]-u[0])/(t.steps||100),f=pi(u[0],u[1]+s/2,s).map(function(t){var e={};return e[o[0]]=t,e[o[1]]=a(t),ht(e)});this.value&&(r.rem=this.value),this.value=r.add=r.source=f}return r},Qi.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},j(Qi,Wr).transform=function(t,e){var n=this.value,r=t.field,i=n[0],a=n[1],o=e.ADD;(e.changed()||e.modified(r.fields)||t.modified("field"))&&(o=e.SOURCE,i=1/0,a=-1/0),e.visit(o,function(t){var e=r(t);null!=e&&((e=+e)<i&&(i=e),a<e&&(a=e))}),this.value=[i,a]};var ta=j(Ki,Mt);function ea(t){Wr.call(this,{},t),this._keys=F();var r=this._targets=[];r.active=0,r.forEach=function(t){for(var e=0,n=r.active;e<n;++e)t(r[e],e,r)}}ta.connect=function(t){return this.targets().add(t),t.source=this},ta.add=function(t){this.value.add.push(t)},ta.rem=function(t){this.value.rem.push(t)},ta.mod=function(t){this.value.mod.push(t)},ta.init=function(t){this.value.init(t,t.NO_SOURCE)},ta.evaluate=function(){return this.value};var na=j(ea,Wr);function ra(t){Mt.call(this,null,ia,t)}function ia(t){return this.value&&!t.modified()?this.value:d(t.name)?Q(t.name).map(function(t){return l(t)}):l(t.name,t.as)}function aa(t){Wr.call(this,F(),t)}function oa(t,n){return t?t.map(function(t,e){return n[e]||M(t)}):null}function ua(t){Wr.call(this,[],t)}function sa(t){Wr.call(this,[],t)}function fa(t){Wr.call(this,null,t)}function ca(t){Wr.call(this,[],t)}na.activate=function(t){this._targets[this._targets.active++]=t},na.subflow=function(t,e,n,r){var i,a,o=this.value,u=o.hasOwnProperty(t)&&o[t];return u?u.value.stamp<n.stamp&&(u.init(n),this.activate(u)):(a=r||(a=this._group[t])&&a.tuple,u=(i=n.dataflow).add(new Ki(n.fork(n.NO_SOURCE),this)).connect(e(i,t,a)),o[t]=u,this.activate(u)),u},na.transform=function(t,e){var n=e.dataflow,r=this,i=t.key,a=t.subflow,o=this._keys,u=t.modified("key");function s(t){return r.subflow(t,a,e)}return this._group=t.group||{},this._targets.active=0,e.visit(e.REM,function(t){var e=ct(t),n=o.get(e);void 0!==n&&(o.delete(e),s(n).rem(t))}),e.visit(e.ADD,function(t){var e=i(t);o.set(ct(t),e),s(e).add(t)}),u||e.modified(i.fields)?e.visit(e.MOD,function(t){var e=ct(t),n=o.get(e),r=i(t);n===r?s(r).mod(t):(o.set(e,r),s(n).rem(t),s(r).add(t))}):e.changed(e.MOD)&&e.visit(e.MOD,function(t){s(o.get(ct(t))).mod(t)}),u&&e.visit(e.REFLOW,function(t){var e=ct(t),n=o.get(e),r=i(t);n!==r&&(o.set(e,r),s(n).rem(t),s(r).add(t))}),o.empty>n.cleanThreshold&&n.runAfter(o.clean),e},j(ra,Mt),aa.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},j(aa,Wr).transform=function(i,t){var e=t.dataflow,a=this.value,n=t.fork(),o=n.add,u=n.rem,s=n.mod,f=i.expr,c=!0;function r(t){var e=ct(t),n=f(t,i),r=a.get(e);n&&r?(a.delete(e),o.push(t)):n||r?c&&n&&!r&&s.push(t):(a.set(e,1),u.push(t))}return t.visit(t.REM,function(t){var e=ct(t);a.has(e)?a.delete(e):u.push(t)}),t.visit(t.ADD,function(t){f(t,i)?o.push(t):a.set(ct(t),1)}),t.visit(t.MOD,r),i.modified()&&(c=!1,t.visit(t.REFLOW,r)),a.empty>e.cleanThreshold&&e.runAfter(a.clean),n},ua.Definition={type:"Flatten",metadata:{generates:!0,source:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0}]},j(ua,Wr).transform=function(t,e){var u=e.fork(e.NO_SOURCE),s=t.fields,f=oa(s,t.as||[]),c=f.length;return u.rem=this.value,e.visit(e.SOURCE,function(e){for(var t,n,r,i=s.map(function(t){return t(e)}),a=i.reduce(function(t,e){return Math.max(t,e.length)},0),o=0;o<a;++o){for(n=dt(e),t=0;t<c;++t)n[f[t]]=null==(r=i[t][o])?null:r;u.add.push(n)}}),this.value=u.source=u.add,u.modifies(f)},sa.Definition={type:"Fold",metadata:{generates:!0,source:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0,length:2,default:["key","value"]}]},j(sa,Wr).transform=function(t,e){var r=e.fork(e.NO_SOURCE),i=t.fields,a=i.map(M),n=t.as||["key","value"],o=n[0],u=n[1],s=i.length;return r.rem=this.value,e.visit(e.SOURCE,function(t){for(var e,n=0;n<s;++n)(e=dt(t))[o]=a[n],e[u]=i[n](t),r.add.push(e)}),this.value=r.source=r.add,r.modifies(n)},fa.Definition={type:"Formula",metadata:{modifies:!0},params:[{name:"expr",type:"expr",required:!0},{name:"as",type:"string",required:!0},{name:"initonly",type:"boolean"}]},j(fa,Wr).transform=function(e,t){var n=e.expr,r=e.as,i=e.modified(),a=e.initonly?t.ADD:i?t.SOURCE:t.modified(n.fields)?t.ADD_MOD:t.ADD;return i&&(t=t.materialize().reflow(!0)),e.initonly||t.modifies(r),t.visit(a,function(t){t[r]=n(t,e)})},j(ca,Wr).transform=function(t,e){var n,r,i,a=this.value,o=e.fork(e.ALL),u=t.size-a.length,s=t.generator;if(0<u){for(n=[];0<=--u;)n.push(i=ht(s(t))),a.push(i);o.add=o.add.length?o.materialize(o.ADD).add.concat(n):n}else r=a.slice(0,-u),o.rem=o.rem.length?o.materialize(o.REM).rem.concat(r):r,a=a.slice(-u);return o.source=this.value=a,o};var la={value:"value",median:function(t,e){var n,r=t.length,i=-1,a=[];if(null==e)for(;++i<r;)isNaN(n=li(t[i]))||a.push(n);else for(;++i<r;)isNaN(n=li(e(t[i],i,t)))||a.push(n);return wi(a.sort(oi),.5)},mean:function(t,e){var n,r=t.length,i=r,a=-1,o=0;if(null==e)for(;++a<r;)isNaN(n=li(t[a]))?--i:o+=n;else for(;++a<r;)isNaN(n=li(e(t[a],a,t)))?--i:o+=n;if(i)return o/i},min:function(t,e){var n,r,i=t.length,a=-1;if(null==e){for(;++a<i;)if(null!=(n=t[a])&&n<=n)for(r=n;++a<i;)null!=(n=t[a])&&n<r&&(r=n)}else for(;++a<i;)if(null!=(n=e(t[a],a,t))&&n<=n)for(r=n;++a<i;)null!=(n=e(t[a],a,t))&&n<r&&(r=n);return r},max:Mi},ha=[];function da(t){Wr.call(this,[],t)}function pa(t){Ti.call(this,t)}da.Definition={type:"Impute",metadata:{generates:!0,changes:!0},params:[{name:"field",type:"field",required:!0},{name:"key",type:"field",required:!0},{name:"keyvals",array:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"enum",default:"value",values:["value","mean","median","max","min"]},{name:"value",default:0}]},j(da,Wr).transform=function(t,e){var n,r,i,a,o,u,s,f,c,l,h,d=e.fork(e.ALL),p=function(t){var e,n=t.method||la.value;if(null!=la[n])return n===la.value?(e=void 0!==t.value?t.value:0,function(){return e}):la[n];rt("Unrecognized imputation method: "+n)}(t),v=(h=t.field,function(t){return t?h(t):NaN}),g=M(t.field),m=M(t.key),y=(t.groupby||[]).map(M),b=function(t,e,n,r){var i,a,o,u,s,f,c,l,h=function(t){return t(l)},d=[],p=r?r.slice():[],v={},g={};for(p.forEach(function(t,e){v[t]=e+1}),u=0,c=t.length;u<c;++u)l=t[u],f=n(l),s=v[f]||(v[f]=p.push(f)),a=(i=e?e.map(h):ha)+"",(o=g[a])||(o=g[a]=[],d.push(o),o.values=i),o[s-1]=l;return d.domain=p,d}(e.source,t.groupby,t.key,t.keyvals),_=[],x=this.value,w=b.domain.length;for(o=0,f=b.length;o<f;++o)for(i=(n=b[o]).values,r=NaN,s=0;s<w;++s)if(null==n[s]){for(a=b.domain[s],l={_impute:!0},u=0,c=i.length;u<c;++u)l[y[u]]=i[u];l[m]=a,l[g]=isNaN(r)?r=p(n,v):r,_.push(ht(l))}return _.length&&(d.add=d.materialize(d.ADD).add.concat(_)),x.length&&(d.rem=d.materialize(d.REM).rem.concat(x)),this.value=_,d},pa.Definition={type:"JoinAggregate",metadata:{modifies:!0},params:[{name:"groupby",type:"field",array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"ops",type:"enum",array:!0,values:Qr},{name:"as",type:"string",null:!0,array:!0},{name:"key",type:"field"}]};var va=j(pa,Ti);function ga(t){Mt.call(this,null,ma,t)}function ma(t){return this.value&&!t.modified()?this.value:Y(t.fields,t.flat)}function ya(t){Wr.call(this,{},t)}function ba(t){Mt.call(this,null,_a,t)}function _a(t){if(this.value&&!t.modified())return this.value;var e,n,r,i=1/0,a=-1/0,o=t.extents;for(e=0,n=o.length;e<n;++e)(r=o[e])[0]<i&&(i=r[0]),r[1]>a&&(a=r[1]);return[i,a]}function xa(t){Mt.call(this,null,wa,t)}function wa(t){return this.value&&!t.modified()?this.value:t.values.reduce(function(t,e){return t.concat(e)},[])}function Ma(t){Wr.call(this,null,t)}function ka(t){Ti.call(this,t)}va.transform=function(t,e){var n,r=this,i=t.modified();return r.value&&(i||e.modified(r._inputs))?(n=r.value=i?r.init(t):{},e.visit(e.SOURCE,function(t){r.add(t)})):(n=r.value=r.value||this.init(t),e.visit(e.REM,function(t){r.rem(t)}),e.visit(e.ADD,function(t){r.add(t)})),r.changes(),e.visit(e.SOURCE,function(t){Wt(t,n[r.cellkey(t)].tuple)}),e.reflow(i).modifies(this._outputs)},va.changes=function(){var t,e,n=this._adds,r=this._mods;for(t=0,e=this._alen;t<e;++t)this.celltuple(n[t]),n[t]=null;for(t=0,e=this._mlen;t<e;++t)this.celltuple(r[t]),r[t]=null;this._alen=this._mlen=0},j(ga,Mt),ya.Definition={type:"Lookup",metadata:{modifies:!0},params:[{name:"index",type:"index",params:[{name:"from",type:"data",required:!0},{name:"key",type:"field",required:!0}]},{name:"values",type:"field",array:!0},{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0},{name:"default",default:null}]},j(ya,Wr).transform=function(t,e){var n,a,r=e,o=t.as,u=t.fields,s=t.index,f=t.values,c=null==t.default?null:t.default,i=t.modified(),l=i?e.SOURCE:e.ADD,h=u.length;return f?(a=f.length,1<h&&!o&&rt(\'Multi-field lookup requires explicit "as" parameter.\'),o&&o.length!==h*a&&rt(\'The "as" parameter has too few output field names.\'),o=o||f.map(M),n=function(t){for(var e,n,r=0,i=0;r<h;++r)if(null==(n=s.get(u[r](t))))for(e=0;e<a;++e,++i)t[o[i]]=c;else for(e=0;e<a;++e,++i)t[o[i]]=f[e](n)}):(o||rt("Missing output field names."),n=function(t){for(var e,n=0;n<h;++n)e=s.get(u[n](t)),t[o[n]]=null==e?c:e}),i?r=e.reflow(!0):l|=u.some(function(t){return e.modified(t.fields)})?e.MOD:0,e.visit(l,n),r.modifies(o)},j(ba,Mt),j(xa,Mt),j(Ma,Wr),Ma.prototype.transform=function(t,e){return this.modified(t.modified()),this.value=t,e.fork(e.NO_SOURCE|e.NO_FIELDS)},ka.Definition={type:"Pivot",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"value",type:"field",required:!0},{name:"op",type:"enum",values:Qr,default:"sum"},{name:"limit",type:"number",default:0},{name:"key",type:"field"}]};var Ea=j(ka,Ti);function Sa(t){ea.call(this,t)}function Aa(t){Wr.call(this,null,t)}function Ca(t){Wr.call(this,null,t)}function za(t){Wr.call(this,null,t)}function Da(t){Wr.call(this,[],t),this.count=0}function Oa(t){Wr.call(this,null,t)}function Na(t){Wr.call(this,null,t),this.modified(!0)}function Ra(t){Wr.call(this,F(),t)}function Ta(t){Wr.call(this,null,t)}Ea._transform=Ea.transform,Ea.transform=function(t,e){return this._transform((r=e,i=(n=t).field,a=n.value,o=("count"===n.op?"__count__":n.op)||"sum",u=x(i).concat(x(a)),f=i,c=n.limit||0,h={},d=[],(l=r).visit(l.SOURCE,function(t){var e=f(t);h[e]||(h[e]=1,d.push(e))}),d.sort(function(t,e){return(t<e||null==t)&&null!=e?-1:(e<t||null==e)&&null!=t?1:(e=e instanceof Date?+e:e,(t=t instanceof Date?+t:t)!==t&&e==e?-1:e!=e&&t==t?1:0)}),s=c?d.slice(0,c):d,{key:n.key,groupby:n.groupby,ops:s.map(function(){return o}),fields:s.map(function(t){return n=i,r=a,g(function(t){return n(t)===e?r(t):NaN},u,(e=t)+"");var e,n,r}),as:s.map(function(t){return t+""}),modified:n.modified.bind(n)}),e);var n,r,i,a,o,u,s,f,c,l,h,d},j(Sa,ea).transform=function(t,n){var r=this,i=t.subflow,a=t.field;return(t.modified("field")||a&&n.modified(x(a)))&&rt("PreFacet does not support field modification."),this._targets.active=0,n.visit(n.MOD,function(t){var e=r.subflow(ct(t),i,n,t);a?a(t).forEach(function(t){e.mod(t)}):e.mod(t)}),n.visit(n.ADD,function(t){var e=r.subflow(ct(t),i,n,t);a?a(t).forEach(function(t){e.add(ht(t))}):e.add(t)}),n.visit(n.REM,function(t){var e=r.subflow(ct(t),i,n,t);a?a(t).forEach(function(t){e.rem(t)}):e.rem(t)}),n},Aa.Definition={type:"Project",metadata:{generates:!0,changes:!0,modifies:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},j(Aa,Wr).transform=function(t,e){var n,r,i=t.fields,a=oa(t.fields,t.as||[]),o=i?function(t,e){return function(t,e,n,r){for(var i=0,a=n.length;i<a;++i)e[r[i]]=n[i](t);return e}(t,e,i,a)}:pt;return this.value?r=this.value:(e=e.addAll(),r=this.value={}),n=e.fork(e.NO_SOURCE),e.visit(e.REM,function(t){var e=ct(t);n.rem.push(r[e]),r[e]=null}),e.visit(e.ADD,function(t){var e=o(t,ht({}));r[ct(t)]=e,n.add.push(e)}),e.visit(e.MOD,function(t){n.mod.push(o(t,r[ct(t)]))}),n},j(Ca,Wr).transform=function(t,e){return this.value=t.value,t.modified("value")?e.fork(e.NO_SOURCE|e.NO_FIELDS):e.StopPropagation},j(za,Wr).transform=function(t,e){var n,r;return this.value?r=this.value:(n=e=e.addAll(),r=this.value={}),t.derive&&(n=e.fork(e.NO_SOURCE),e.visit(e.REM,function(t){var e=ct(t);n.rem.push(r[e]),r[e]=null}),e.visit(e.ADD,function(t){var e=dt(t);r[ct(t)]=e,n.add.push(e)}),e.visit(e.MOD,function(t){n.mod.push(pt(t,r[ct(t)]))})),n},Da.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]},j(Da,Wr).transform=function(t,e){var r=e.fork(e.NO_SOURCE),n=t.modified("size"),i=t.size,a=this.value,o=this.count,u=0,s=a.reduce(function(t,e){return t[ct(e)]=1,t},{});function f(t){var e,n;a.length<i?a.push(t):(n=~~((o+1)*y.random()))<a.length&&u<=n&&(e=a[n],s[ct(e)]&&r.rem.push(e),a[n]=t),++o}if(e.rem.length&&(e.visit(e.REM,function(t){var e=ct(t);s[e]&&(s[e]=-1,r.rem.push(t)),--o}),a=a.filter(function(t){return-1!==s[ct(t)]})),(e.rem.length||n)&&a.length<i&&e.source&&(u=o=a.length,e.visit(e.SOURCE,function(t){s[ct(t)]||f(t)}),u=-1),n&&a.length>i){for(var c=0,l=a.length-i;c<l;++c)s[ct(a[c])]=-1,r.rem.push(a[c]);a=a.slice(l)}return e.mod.length&&e.visit(e.MOD,function(t){s[ct(t)]&&r.mod.push(t)}),e.add.length&&e.visit(e.ADD,f),(e.add.length||u<0)&&(r.add=a.filter(function(t){return!s[ct(t)]})),this.count=o,this.value=r.source=a,r},Oa.Definition={type:"Sequence",metadata:{generates:!0,changes:!0},params:[{name:"start",type:"number",required:!0},{name:"stop",type:"number",required:!0},{name:"step",type:"number",default:1}],output:["value"]},j(Oa,Wr).transform=function(t,e){if(!this.value||t.modified()){var n=e.materialize().fork(e.MOD);return n.rem=this.value?e.rem.concat(this.value):e.rem,this.value=pi(t.start,t.stop,t.step||1).map(ht),n.add=e.add.concat(this.value),n}},j(Na,Wr).transform=function(t,e){return this.value=e.source,e.changed()?e.fork(e.NO_SOURCE|e.NO_FIELDS):e.StopPropagation},j(Ra,Wr).transform=function(t,e){var n=e.dataflow,r=t.field,i=this.value,a=!0;function o(t){i.set(r(t),t)}return t.modified("field")||e.modified(r.fields)?(i.clear(),e.visit(e.SOURCE,o)):e.changed()?(e.visit(e.REM,function(t){i.delete(r(t))}),e.visit(e.ADD,o)):a=!1,this.modified(a),i.empty>n.cleanThreshold&&n.runAfter(i.clean),e.fork()},j(Ta,Wr).transform=function(t,e){(!this.value||t.modified("field")||t.modified("sort")||e.changed()||t.sort&&e.modified(t.sort.fields))&&(this.value=(t.sort?e.source.slice().sort(t.sort):e.source).map(t.field))};var Pa={row_number:function(){return{next:function(t){return t.index+1}}},rank:function(){var r;return{init:function(){r=1},next:function(t){var e=t.index,n=t.data;return e&&t.compare(n[e-1],n[e])?r=e+1:r}}},dense_rank:function(){var r;return{init:function(){r=1},next:function(t){var e=t.index,n=t.data;return e&&t.compare(n[e-1],n[e])?++r:r}}},percent_rank:function(){var t=Pa.rank(),e=t.next;return{init:t.init,next:function(t){return(e(t)-1)/(t.data.length-1)}}},cume_dist:function(){var i;return{init:function(){i=0},next:function(t){var e=t.index,n=t.data,r=t.compare;if(i<e){for(;e+1<n.length&&!r(n[e],n[e+1]);)++e;i=e}return(1+i)/n.length}}},ntile:function(t,e){0<(e=+e)||rt("ntile num must be greater than zero.");var n=Pa.cume_dist(),r=n.next;return{init:n.init,next:function(t){return Math.ceil(e*r(t))}}},lag:function(n,r){return r=+r||1,{next:function(t){var e=t.index-r;return 0<=e?n(t.data[e]):null}}},lead:function(r,i){return i=+i||1,{next:function(t){var e=t.index+i,n=t.data;return e<n.length?r(n[e]):null}}},first_value:function(e){return{next:function(t){return e(t.data[t.i0])}}},last_value:function(e){return{next:function(t){return e(t.data[t.i1-1])}}},nth_value:function(n,r){return 0<(r=+r)||rt("nth_value nth must be greater than zero."),{next:function(t){var e=t.i0+(r-1);return e<t.i1?n(t.data[e]):null}}}},La=Object.keys(Pa);function qa(t){var e=Q(t.ops),l=Q(t.fields),h=Q(t.params),d=Q(t.as),p=this.outputs=[],v=this.windows=[],n={},g={},m=!0,y=[],b=[];function _(t){Q(x(t)).forEach(function(t){n[t]=1})}_(t.sort),e.forEach(function(t,e){var n,r,i,a,o,u=l[e],s=M(u),f=Jr(t,s,d[e]);if(_(u),p.push(f),Pa.hasOwnProperty(t))v.push((n=t,r=l[e],i=h[e],a=f,{init:(o=Pa[n](r,i)).init||w,update:function(t,e){e[a]=o.next(t)}}));else{if(null==u&&"count"!==t&&rt("Null aggregate field specified."),"count"===t)return void y.push(f);m=!1;var c=g[s];c||((c=g[s]=[]).field=u,b.push(c)),c.push(Kr(t,f))}}),(y.length||b.length)&&(this.cell=function(t,r,i){t=t.map(function(t){return ni(t,t.field)});var a={num:0,agg:null,store:!1,count:r};if(!i)for(var n=t.length,o=a.agg=Array(n),e=0;e<n;++e)o[e]=new t[e](a);if(a.store)var u=a.data=new Ni;return a.add=function(t){if(a.num+=1,!i){u&&u.add(t);for(var e=0;e<n;++e)o[e].add(o[e].get(t),t)}},a.rem=function(t){if(a.num-=1,!i){u&&u.rem(t);for(var e=0;e<n;++e)o[e].rem(o[e].get(t),t)}},a.set=function(t){var e,n;for(u&&u.values(),e=0,n=r.length;e<n;++e)t[r[e]]=a.num;if(!i)for(e=0,n=o.length;e<n;++e)o[e].set(t)},a.init=function(){a.num=0,u&&u.reset();for(var t=0;t<n;++t)o[t].init()},a}(b,y,m)),this.inputs=Object.keys(n)}var Ua=qa.prototype;function Fa(t){Wr.call(this,{},t),this._mlen=0,this._mods=[]}Ua.init=function(){this.windows.forEach(function(t){t.init()}),this.cell&&this.cell.init()},Ua.update=function(t,e){var n,r=this.cell,i=this.windows,a=t.data,o=i&&i.length;if(r){for(n=t.p0;n<t.i0;++n)r.rem(a[n]);for(n=t.p1;n<t.i1;++n)r.add(a[n]);r.set(e)}for(n=0;n<o;++n)i[n].update(t,e)},Fa.Definition={type:"Window",metadata:{modifies:!0},params:[{name:"sort",type:"compare"},{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:La.concat(Qr)},{name:"params",type:"number",null:!0,array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"frame",type:"number",null:!0,array:!0,length:2,default:[null,0]},{name:"ignorePeers",type:"boolean",default:!1}]};var ja=j(Fa,Wr);function Ia(t,e,n){var r=n.sort,i=r&&!n.ignorePeers,a=n.frame||[null,0],o=t.data(r),u=o.length,s=0,f=i?ui(r):null,c={i0:0,i1:0,p0:0,p1:0,index:0,data:o,compare:r||P(-1)};for(e.init();s<u;++s)$a(c,a,s,u),i&&Ba(c,f),e.update(c,o[s])}function $a(t,e,n,r){t.p0=t.i0,t.p1=t.i1,t.i0=null==e[0]?0:Math.max(0,n-Math.abs(e[0])),t.i1=null==e[1]?r:Math.min(r,n+Math.abs(e[1])+1),t.index=n}function Ba(t,e){var n=t.i0,r=t.i1-1,i=t.compare,a=t.data,o=a.length-1;0<n&&!i(a[n],a[n-1])&&(t.i0=e.left(a,a[n])),r<o&&!i(a[r],a[r+1])&&(t.i1=e.right(a,a[r]))}ja.transform=function(t,e){var n,r,i=this,a=i.state,o=t.modified();this.stamp=e.stamp,a&&!o||(a=i.state=new qa(t));var u=Xr(t.groupby);function s(t){return i.group(u(t))}for(o||e.modified(a.inputs)?(i.value={},e.visit(e.SOURCE,function(t){s(t).add(t)})):(e.visit(e.REM,function(t){s(t).remove(t)}),e.visit(e.ADD,function(t){s(t).add(t)})),n=0,r=i._mlen;n<r;++n)Ia(i._mods[n],a,t);return i._mlen=0,i._mods=[],e.reflow(o).modifies(a.outputs)},ja.group=function(t){var e=this.value[t];return e||((e=this.value[t]=Ui(ct)).stamp=-1),e.stamp<this.stamp&&(e.stamp=this.stamp,this._mods[this._mlen++]=e),e};var Wa=Object.freeze({aggregate:Ti,bin:Li,collect:Fi,compare:ji,countpattern:$i,cross:Wi,density:Xi,extent:Qi,facet:ea,field:ra,filter:aa,flatten:ua,fold:sa,formula:fa,generate:ca,impute:da,joinaggregate:pa,key:ga,lookup:ya,multiextent:ba,multivalues:xa,params:Ma,pivot:ka,prefacet:Sa,project:Aa,proxy:Ca,relay:za,sample:Da,sequence:Oa,sieve:Na,subflow:Ki,tupleindex:Ra,values:Ta,window:Fa});function Ya(t){this.clear(),t&&this.union(t)}var Ha=Ya.prototype;Ha.clone=function(){return new Ya(this)},Ha.clear=function(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},Ha.empty=function(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},Ha.set=function(t,e,n,r){return n<t?(this.x2=t,this.x1=n):(this.x1=t,this.x2=n),r<e?(this.y2=e,this.y1=r):(this.y1=e,this.y2=r),this},Ha.add=function(t,e){return t<this.x1&&(this.x1=t),e<this.y1&&(this.y1=e),t>this.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this},Ha.expand=function(t){return this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t,this},Ha.round=function(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},Ha.translate=function(t,e){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this},Ha.rotate=function(t,e,n){var r=Math.cos(t),i=Math.sin(t),a=e-e*r+n*i,o=n-e*i-n*r,u=this.x1,s=this.x2,f=this.y1,c=this.y2;return this.clear().add(r*u-i*f+a,i*u+r*f+o).add(r*u-i*c+a,i*u+r*c+o).add(r*s-i*f+a,i*s+r*f+o).add(r*s-i*c+a,i*s+r*c+o)},Ha.union=function(t){return t.x1<this.x1&&(this.x1=t.x1),t.y1<this.y1&&(this.y1=t.y1),t.x2>this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this},Ha.intersect=function(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2<this.x2&&(this.x2=t.x2),t.y2<this.y2&&(this.y2=t.y2),this},Ha.encloses=function(t){return t&&this.x1<=t.x1&&this.x2>=t.x2&&this.y1<=t.y1&&this.y2>=t.y2},Ha.alignsWith=function(t){return t&&(this.x1==t.x1||this.x2==t.x2||this.y1==t.y1||this.y2==t.y2)},Ha.intersects=function(t){return t&&!(this.x2<t.x1||this.x1>t.x2||this.y2<t.y1||this.y1>t.y2)},Ha.contains=function(t,e){return!(t<this.x1||t>this.x2||e<this.y1||e>this.y2)},Ha.width=function(){return this.x2-this.x1},Ha.height=function(){return this.y2-this.y1};var Ga,Va=0,Xa=function(t,e){var n,r=[];return n={id:"gradient_"+Va++,x1:t?t[0]:0,y1:t?t[1]:0,x2:e?e[0]:1,y2:e?e[1]:0,stops:r,stop:function(t,e){return r.push({offset:t,color:e}),n}}};function Ja(t){this.mark=t,this.bounds=this.bounds||new Ya}function Za(t){Ja.call(this,t),this.items=this.items||[]}j(Za,Ja);try{if(!(Ga=require("canvas")))throw 1}catch(t){try{Ga=require("canvas-prebuilt")}catch(t){Ga=null}}function Qa(t,e){return function(t,e){if("undefined"!=typeof document&&document.createElement){var n=document.createElement("canvas");if(n&&n.getContext)return n.width=t,n.height=e,n}return null}(t,e)||function(t,e){if(Ga)try{return new Ga(t,e)}catch(t){}return null}(t,e)||null}function Ka(){return("undefined"!=typeof Image?Image:null)||Ga&&Ga.Image||null||null}function to(t){this._pending=0,this._loader=t||re()}var eo=to.prototype;function no(t){t._pending+=1}function ro(t){t._pending-=1}eo.pending=function(){return this._pending},eo.sanitizeURL=function(t){var e=this;return no(e),e._loader.sanitize(t,{context:"href"}).then(function(t){return ro(e),t}).catch(function(){return ro(e),null})},eo.loadImage=function(t){var r=this,i=Ka();return no(r),r._loader.sanitize(t,{context:"image"}).then(function(t){var e=t.href;if(!e||!i)throw{url:e};var n=new i;return n.onload=function(){ro(r),n.loaded=!0},n.onerror=function(){ro(r),n.loaded=!1},n.src=e,n}).catch(function(t){return ro(r),{loaded:!1,width:0,height:0,src:t&&t.url||""}})},eo.ready=function(){var r=this;return new Promise(function(n){!function t(e){r.pending()?setTimeout(function(){t(!0)},10):n(e)}(!1)})};var io=Math.PI,ao=2*io,oo=1e-6,uo=ao-oo;function so(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function fo(){return new so}so.prototype=fo.prototype={constructor:so,moveTo:function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},quadraticCurveTo:function(t,e,n,r){this._+="Q"+ +t+","+ +e+","+(this._x1=+n)+","+(this._y1=+r)},bezierCurveTo:function(t,e,n,r,i,a){this._+="C"+ +t+","+ +e+","+ +n+","+ +r+","+(this._x1=+i)+","+(this._y1=+a)},arcTo:function(t,e,n,r,i){t=+t,e=+e,n=+n,r=+r,i=+i;var a=this._x1,o=this._y1,u=n-t,s=r-e,f=a-t,c=o-e,l=f*f+c*c;if(i<0)throw new Error("negative radius: "+i);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(oo<l)if(Math.abs(c*u-s*f)>oo&&i){var h=n-a,d=r-o,p=u*u+s*s,v=h*h+d*d,g=Math.sqrt(p),m=Math.sqrt(l),y=i*Math.tan((io-Math.acos((p+l-v)/(2*g*m)))/2),b=y/m,_=y/g;Math.abs(b-1)>oo&&(this._+="L"+(t+b*f)+","+(e+b*c)),this._+="A"+i+","+i+",0,0,"+ +(f*d<c*h)+","+(this._x1=t+_*u)+","+(this._y1=e+_*s)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},arc:function(t,e,n,r,i,a){t=+t,e=+e;var o=(n=+n)*Math.cos(r),u=n*Math.sin(r),s=t+o,f=e+u,c=1^a,l=a?r-i:i-r;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+s+","+f:(Math.abs(this._x1-s)>oo||Math.abs(this._y1-f)>oo)&&(this._+="L"+s+","+f),n&&(l<0&&(l=l%ao+ao),uo<l?this._+="A"+n+","+n+",0,1,"+c+","+(t-o)+","+(e-u)+"A"+n+","+n+",0,1,"+c+","+(this._x1=s)+","+(this._y1=f):oo<l&&(this._+="A"+n+","+n+",0,"+ +(io<=l)+","+c+","+(this._x1=t+n*Math.cos(i))+","+(this._y1=e+n*Math.sin(i))))},rect:function(t,e,n,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +r+"h"+-n+"Z"},toString:function(){return this._}};var co=function(t){return function(){return t}},lo=Math.abs,ho=Math.atan2,po=Math.cos,vo=Math.max,go=Math.min,mo=Math.sin,yo=Math.sqrt,bo=1e-12,_o=Math.PI,xo=_o/2,wo=2*_o;function Mo(t){return 1<=t?xo:t<=-1?-xo:Math.asin(t)}function ko(t){return t.innerRadius}function Eo(t){return t.outerRadius}function So(t){return t.startAngle}function Ao(t){return t.endAngle}function Co(t){return t&&t.padAngle}function zo(t,e,n,r,i,a,o){var u=t-n,s=e-r,f=(o?a:-a)/yo(u*u+s*s),c=f*s,l=-f*u,h=t+c,d=e+l,p=n+c,v=r+l,g=(h+p)/2,m=(d+v)/2,y=p-h,b=v-d,_=y*y+b*b,x=i-a,w=h*v-p*d,M=(b<0?-1:1)*yo(vo(0,x*x*_-w*w)),k=(w*b-y*M)/_,E=(-w*y-b*M)/_,S=(w*b+y*M)/_,A=(-w*y+b*M)/_,C=k-g,z=E-m,D=S-g,O=A-m;return D*D+O*O<C*C+z*z&&(k=S,E=A),{cx:k,cy:E,x01:-c,y01:-l,x11:k*(i/x-1),y11:E*(i/x-1)}}function Do(t){this._context=t}Do.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}};var Oo=function(t){return new Do(t)};function No(t){return t[0]}function Ro(t){return t[1]}var To=function(){var o=No,u=Ro,s=co(!0),f=null,c=Oo,l=null;function e(t){var e,n,r,i=t.length,a=!1;for(null==f&&(l=c(r=fo())),e=0;e<=i;++e)!(e<i&&s(n=t[e],e,t))===a&&((a=!a)?l.lineStart():l.lineEnd()),a&&l.point(+o(n,e,t),+u(n,e,t));if(r)return l=null,r+""||null}return e.x=function(t){return arguments.length?(o="function"==typeof t?t:co(+t),e):o},e.y=function(t){return arguments.length?(u="function"==typeof t?t:co(+t),e):u},e.defined=function(t){return arguments.length?(s="function"==typeof t?t:co(!!t),e):s},e.curve=function(t){return arguments.length?(c=t,null!=f&&(l=c(f)),e):c},e.context=function(t){return arguments.length?(null==t?f=l=null:l=c(f=t),e):f},e},Po=function(){var c=No,l=null,h=co(0),d=Ro,p=co(!0),v=null,g=Oo,m=null;function e(t){var e,n,r,i,a,o=t.length,u=!1,s=new Array(o),f=new Array(o);for(null==v&&(m=g(a=fo())),e=0;e<=o;++e){if(!(e<o&&p(i=t[e],e,t))===u)if(u=!u)n=e,m.areaStart(),m.lineStart();else{for(m.lineEnd(),m.lineStart(),r=e-1;n<=r;--r)m.point(s[r],f[r]);m.lineEnd(),m.areaEnd()}u&&(s[e]=+c(i,e,t),f[e]=+h(i,e,t),m.point(l?+l(i,e,t):s[e],d?+d(i,e,t):f[e]))}if(a)return m=null,a+""||null}function t(){return To().defined(p).curve(g).context(v)}return e.x=function(t){return arguments.length?(c="function"==typeof t?t:co(+t),l=null,e):c},e.x0=function(t){return arguments.length?(c="function"==typeof t?t:co(+t),e):c},e.x1=function(t){return arguments.length?(l=null==t?null:"function"==typeof t?t:co(+t),e):l},e.y=function(t){return arguments.length?(h="function"==typeof t?t:co(+t),d=null,e):h},e.y0=function(t){return arguments.length?(h="function"==typeof t?t:co(+t),e):h},e.y1=function(t){return arguments.length?(d=null==t?null:"function"==typeof t?t:co(+t),e):d},e.lineX0=e.lineY0=function(){return t().x(c).y(h)},e.lineY1=function(){return t().x(c).y(d)},e.lineX1=function(){return t().x(l).y(h)},e.defined=function(t){return arguments.length?(p="function"==typeof t?t:co(!!t),e):p},e.curve=function(t){return arguments.length?(g=t,null!=v&&(m=g(v)),e):g},e.context=function(t){return arguments.length?(null==t?v=m=null:m=g(v=t),e):v},e},Lo={draw:function(t,e){var n=Math.sqrt(e/_o);t.moveTo(n,0),t.arc(0,0,n,0,wo)}},qo=function(){};function Uo(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function Fo(t){this._context=t}Fo.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Uo(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Uo(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function jo(t){this._context=t}jo.prototype={areaStart:qo,areaEnd:qo,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:Uo(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Io(t){this._context=t}Io.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Uo(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function $o(t,e){this._basis=new Fo(t),this._beta=e}$o.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,n=t.length-1;if(0<n)for(var r,i=t[0],a=e[0],o=t[n]-i,u=e[n]-a,s=-1;++s<=n;)r=s/n,this._basis.point(this._beta*t[s]+(1-this._beta)*(i+r*o),this._beta*e[s]+(1-this._beta)*(a+r*u));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};var Bo=function e(n){function t(t){return 1===n?new Fo(t):new $o(t,n)}return t.beta=function(t){return e(+t)},t}(.85);function Wo(t,e,n){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-n),t._x2,t._y2)}function Yo(t,e){this._context=t,this._k=(1-e)/6}Yo.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Wo(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:Wo(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Ho=function e(n){function t(t){return new Yo(t,n)}return t.tension=function(t){return e(+t)},t}(0);function Go(t,e){this._context=t,this._k=(1-e)/6}Go.prototype={areaStart:qo,areaEnd:qo,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:Wo(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Vo=function e(n){function t(t){return new Go(t,n)}return t.tension=function(t){return e(+t)},t}(0);function Xo(t,e){this._context=t,this._k=(1-e)/6}Xo.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Wo(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Jo=function e(n){function t(t){return new Xo(t,n)}return t.tension=function(t){return e(+t)},t}(0);function Zo(t,e,n){var r=t._x1,i=t._y1,a=t._x2,o=t._y2;if(t._l01_a>bo){var u=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,s=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*u-t._x0*t._l12_2a+t._x2*t._l01_2a)/s,i=(i*u-t._y0*t._l12_2a+t._y2*t._l01_2a)/s}if(t._l23_a>bo){var f=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,c=3*t._l23_a*(t._l23_a+t._l12_a);a=(a*f+t._x1*t._l23_2a-e*t._l12_2a)/c,o=(o*f+t._y1*t._l23_2a-n*t._l12_2a)/c}t._context.bezierCurveTo(r,i,a,o,t._x2,t._y2)}function Qo(t,e){this._context=t,this._alpha=e}Qo.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:Zo(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Ko=function e(n){function t(t){return n?new Qo(t,n):new Yo(t,0)}return t.alpha=function(t){return e(+t)},t}(.5);function tu(t,e){this._context=t,this._alpha=e}tu.prototype={areaStart:qo,areaEnd:qo,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:Zo(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var eu=function e(n){function t(t){return n?new tu(t,n):new Go(t,0)}return t.alpha=function(t){return e(+t)},t}(.5);function nu(t,e){this._context=t,this._alpha=e}nu.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Zo(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var ru=function e(n){function t(t){return n?new nu(t,n):new Xo(t,0)}return t.alpha=function(t){return e(+t)},t}(.5);function iu(t){this._context=t}iu.prototype={areaStart:qo,areaEnd:qo,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function au(t){return t<0?-1:1}function ou(t,e,n){var r=t._x1-t._x0,i=e-t._x1,a=(t._y1-t._y0)/(r||i<0&&-0),o=(n-t._y1)/(i||r<0&&-0),u=(a*i+o*r)/(r+i);return(au(a)+au(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(u))||0}function uu(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function su(t,e,n){var r=t._x0,i=t._y0,a=t._x1,o=t._y1,u=(a-r)/3;t._context.bezierCurveTo(r+u,i+u*e,a-u,o-u*n,a,o)}function fu(t){this._context=t}function cu(t){this._context=new lu(t)}function lu(t){this._context=t}function hu(t){this._context=t}function du(t){var e,n,r=t.length-1,i=new Array(r),a=new Array(r),o=new Array(r);for(a[i[0]=0]=2,o[0]=t[0]+2*t[1],e=1;e<r-1;++e)i[e]=1,a[e]=4,o[e]=4*t[e]+2*t[e+1];for(i[r-1]=2,a[r-1]=7,o[r-1]=8*t[r-1]+t[r],e=1;e<r;++e)n=i[e]/a[e-1],a[e]-=n,o[e]-=n*o[e-1];for(i[r-1]=o[r-1]/a[r-1],e=r-2;0<=e;--e)i[e]=(o[e]-i[e+1])/a[e];for(a[r-1]=(t[r]+i[r-1])/2,e=0;e<r-1;++e)a[e]=2*t[e+1]-i[e+1];return[i,a]}fu.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:su(this,this._t0,uu(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(e=+e,(t=+t)!==this._x1||e!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,su(this,uu(this,n=ou(this,t,e)),n);break;default:su(this,this._t0,n=ou(this,t,e))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}},(cu.prototype=Object.create(fu.prototype)).point=function(t,e){fu.prototype.point.call(this,e,t)},lu.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,r,i,a){this._context.bezierCurveTo(e,t,r,n,a,i)}},hu.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),2===n)this._context.lineTo(t[1],e[1]);else for(var r=du(t),i=du(e),a=0,o=1;o<n;++a,++o)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],t[o],e[o]);(this._line||0!==this._line&&1===n)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}};function pu(t,e){this._context=t,this._t=e}pu.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),0<=this._line&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}}this._x=t,this._y=e}};var vu={basis:{curve:function(t){return new Fo(t)}},"basis-closed":{curve:function(t){return new jo(t)}},"basis-open":{curve:function(t){return new Io(t)}},bundle:{curve:Bo,tension:"beta",value:.85},cardinal:{curve:Ho,tension:"tension",value:0},"cardinal-open":{curve:Jo,tension:"tension",value:0},"cardinal-closed":{curve:Vo,tension:"tension",value:0},"catmull-rom":{curve:Ko,tension:"alpha",value:.5},"catmull-rom-closed":{curve:eu,tension:"alpha",value:.5},"catmull-rom-open":{curve:ru,tension:"alpha",value:.5},linear:{curve:Oo},"linear-closed":{curve:function(t){return new iu(t)}},monotone:{horizontal:function(t){return new cu(t)},vertical:function(t){return new fu(t)}},natural:{curve:function(t){return new hu(t)}},step:{curve:function(t){return new pu(t,.5)}},"step-after":{curve:function(t){return new pu(t,1)}},"step-before":{curve:function(t){return new pu(t,0)}}};function gu(t,e,n){var r=vu.hasOwnProperty(t)&&vu[t],i=null;return r&&(i=r.curve||r[e||"vertical"],r.tension&&null!=n&&(i=i[r.tension](n))),i}var mu={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},yu=[/([MLHVCSQTAZmlhvcsqtaz])/g,/###/,/(\\d)([-+])/g,/\\s|,|###/],bu=function(t){var e,n,r,i,a,o,u,s,f,c,l,h=[];for(s=0,c=(e=t.slice().replace(yu[0],"###$1").split(yu[1]).slice(1)).length;s<c;++s){for(r=(n=e[s]).slice(1).trim().replace(yu[2],"$1###$2").split(yu[3]),i=[o=n.charAt(0)],f=0,l=r.length;f<l;++f)(a=+r[f])===a&&i.push(a);if(u=mu[o.toLowerCase()],i.length-1>u)for(f=1,l=i.length;f<l;f+=u)h.push([o].concat(i.slice(f,f+u)));else h.push(i)}return h},_u={},xu={},wu=[].join;function Mu(t){var e=wu.call(t);if(xu[e])return xu[e];var n=t[0],r=t[1],i=t[2],a=t[3],o=t[4],u=t[5],s=t[6],f=t[7],c=f*o,l=-s*u,h=s*o,d=f*u,p=Math.cos(i),v=Math.sin(i),g=Math.cos(a),m=Math.sin(a),y=.5*(a-i),b=Math.sin(.5*y),_=8/3*b*b/Math.sin(y),x=n+p-_*v,w=r+v+_*p,M=n+g,k=r+m,E=M+_*m,S=k-_*g;return xu[e]=[c*x+l*w,h*x+d*w,c*E+l*S,h*E+d*S,c*M+l*k,h*M+d*k]}var ku=["l",0,0,0,0,0,0,0];function Eu(t,e){var n=ku[0]=t[0];if("a"===n||"A"===n)ku[1]=e*t[1],ku[2]=e*t[2],ku[6]=e*t[6],ku[7]=e*t[7];else for(var r=1,i=t.length;r<i;++r)ku[r]=e*t[r];return ku}var Su=function(t,e,n,r,i){var a,o,u,s,f,c=null,l=0,h=0,d=0,p=0;null==n&&(n=0),null==r&&(r=0),null==i&&(i=1),t.beginPath&&t.beginPath();for(var v=0,g=e.length;v<g;++v){switch(a=e[v],1!==i&&(a=Eu(a,i)),a[0]){case"l":l+=a[1],h+=a[2],t.lineTo(l+n,h+r);break;case"L":l=a[1],h=a[2],t.lineTo(l+n,h+r);break;case"h":l+=a[1],t.lineTo(l+n,h+r);break;case"H":l=a[1],t.lineTo(l+n,h+r);break;case"v":h+=a[1],t.lineTo(l+n,h+r);break;case"V":h=a[1],t.lineTo(l+n,h+r);break;case"m":l+=a[1],h+=a[2],t.moveTo(l+n,h+r);break;case"M":l=a[1],h=a[2],t.moveTo(l+n,h+r);break;case"c":o=l+a[5],u=h+a[6],d=l+a[3],p=h+a[4],t.bezierCurveTo(l+a[1]+n,h+a[2]+r,d+n,p+r,o+n,u+r),l=o,h=u;break;case"C":l=a[5],h=a[6],d=a[3],p=a[4],t.bezierCurveTo(a[1]+n,a[2]+r,d+n,p+r,l+n,h+r);break;case"s":o=l+a[3],u=h+a[4],d=2*l-d,p=2*h-p,t.bezierCurveTo(d+n,p+r,l+a[1]+n,h+a[2]+r,o+n,u+r),d=l+a[1],p=h+a[2],l=o,h=u;break;case"S":o=a[3],u=a[4],d=2*l-d,p=2*h-p,t.bezierCurveTo(d+n,p+r,a[1]+n,a[2]+r,o+n,u+r),l=o,h=u,d=a[1],p=a[2];break;case"q":o=l+a[3],u=h+a[4],d=l+a[1],p=h+a[2],t.quadraticCurveTo(d+n,p+r,o+n,u+r),l=o,h=u;break;case"Q":o=a[3],u=a[4],t.quadraticCurveTo(a[1]+n,a[2]+r,o+n,u+r),l=o,h=u,d=a[1],p=a[2];break;case"t":o=l+a[1],u=h+a[2],null===c[0].match(/[QqTt]/)?(d=l,p=h):"t"===c[0]?(d=2*l-s,p=2*h-f):"q"===c[0]&&(d=2*l-d,p=2*h-p),s=d,f=p,t.quadraticCurveTo(d+n,p+r,o+n,u+r),h=u,d=(l=o)+a[1],p=h+a[2];break;case"T":o=a[1],u=a[2],d=2*l-d,p=2*h-p,t.quadraticCurveTo(d+n,p+r,o+n,u+r),l=o,h=u;break;case"a":Au(t,l+n,h+r,[a[1],a[2],a[3],a[4],a[5],a[6]+l+n,a[7]+h+r]),l+=a[6],h+=a[7];break;case"A":Au(t,l+n,h+r,[a[1],a[2],a[3],a[4],a[5],a[6]+n,a[7]+r]),l=a[6],h=a[7];break;case"z":case"Z":t.closePath()}c=a}};function Au(t,e,n,r){for(var i=function(t,e,n,r,i,a,o,u,s){var f=wu.call(arguments);if(_u[f])return _u[f];var c=o*(Math.PI/180),l=Math.sin(c),h=Math.cos(c),d=h*(u-t)*.5+l*(s-e)*.5,p=h*(s-e)*.5-l*(u-t)*.5,v=d*d/((n=Math.abs(n))*n)+p*p/((r=Math.abs(r))*r);1<v&&(n*=v=Math.sqrt(v),r*=v);var g=h/n,m=l/n,y=-l/r,b=h/r,_=g*u+m*s,x=y*u+b*s,w=g*t+m*e,M=y*t+b*e,k=1/((w-_)*(w-_)+(M-x)*(M-x))-.25;k<0&&(k=0);var E=Math.sqrt(k);a==i&&(E=-E);var S=.5*(_+w)-E*(M-x),A=.5*(x+M)+E*(w-_),C=Math.atan2(x-A,_-S),z=Math.atan2(M-A,w-S)-C;z<0&&1===a?z+=2*Math.PI:0<z&&0===a&&(z-=2*Math.PI);for(var D=Math.ceil(Math.abs(z/(.5*Math.PI+.001))),O=[],N=0;N<D;++N){var R=C+N*z/D,T=C+(N+1)*z/D;O[N]=[S,A,R,T,n,r,l,h]}return _u[f]=O}(r[5],r[6],r[0],r[1],r[3],r[4],r[2],e,n),a=0;a<i.length;++a){var o=Mu(i[a]);t.bezierCurveTo(o[0],o[1],o[2],o[3],o[4],o[5])}}var Cu=2*Math.PI,zu=Math.sqrt(3)/2,Du={circle:{draw:function(t,e){var n=Math.sqrt(e)/2;t.moveTo(n,0),t.arc(0,0,n,0,Cu)}},cross:{draw:function(t,e){var n=Math.sqrt(e)/2,r=n/2.5;t.moveTo(-n,-r),t.lineTo(-n,r),t.lineTo(-r,r),t.lineTo(-r,n),t.lineTo(r,n),t.lineTo(r,r),t.lineTo(n,r),t.lineTo(n,-r),t.lineTo(r,-r),t.lineTo(r,-n),t.lineTo(-r,-n),t.lineTo(-r,-r),t.closePath()}},diamond:{draw:function(t,e){var n=Math.sqrt(e)/2;t.moveTo(-n,0),t.lineTo(0,-n),t.lineTo(n,0),t.lineTo(0,n),t.closePath()}},square:{draw:function(t,e){var n=Math.sqrt(e),r=-n/2;t.rect(r,r,n,n)}},"triangle-up":{draw:function(t,e){var n=Math.sqrt(e)/2,r=zu*n;t.moveTo(0,-r),t.lineTo(-n,r),t.lineTo(n,r),t.closePath()}},"triangle-down":{draw:function(t,e){var n=Math.sqrt(e)/2,r=zu*n;t.moveTo(0,r),t.lineTo(-n,-r),t.lineTo(n,-r),t.closePath()}},"triangle-right":{draw:function(t,e){var n=Math.sqrt(e)/2,r=zu*n;t.moveTo(r,0),t.lineTo(-r,-n),t.lineTo(-r,n),t.closePath()}},"triangle-left":{draw:function(t,e){var n=Math.sqrt(e)/2,r=zu*n;t.moveTo(-r,0),t.lineTo(r,-n),t.lineTo(r,n),t.closePath()}}};function Ou(t){return Du.hasOwnProperty(t)?Du[t]:function(t){if(!Nu.hasOwnProperty(t)){var n=bu(t);Nu[t]={draw:function(t,e){Su(t,n,0,0,Math.sqrt(e)/2)}}}return Nu[t]}(t)}var Nu={};function Ru(t){return t.x}function Tu(t){return t.y}function Pu(t){return t.width}function Lu(t){return t.height}function qu(t){return function(){return t}}var Uu=function(){var l=Ru,h=Tu,d=Pu,p=Lu,v=qu(0),g=null;function e(t,e,n){var r,i=null!=e?e:+l.call(this,t),a=null!=n?n:+h.call(this,t),o=+d.call(this,t),u=+p.call(this,t),s=+v.call(this,t);if(g||(g=r=fo()),s<=0)g.rect(i,a,o,u);else{var f=i+o,c=a+u;g.moveTo(i+s,a),g.lineTo(f-s,a),g.quadraticCurveTo(f,a,f,a+s),g.lineTo(f,c-s),g.quadraticCurveTo(f,c,f-s,c),g.lineTo(i+s,c),g.quadraticCurveTo(i,c,i,c-s),g.lineTo(i,a+s),g.quadraticCurveTo(i,a,i+s,a),g.closePath()}if(r)return g=null,r+""||null}return e.x=function(t){return arguments.length?(l="function"==typeof t?t:qu(+t),e):l},e.y=function(t){return arguments.length?(h="function"==typeof t?t:qu(+t),e):h},e.width=function(t){return arguments.length?(d="function"==typeof t?t:qu(+t),e):d},e.height=function(t){return arguments.length?(p="function"==typeof t?t:qu(+t),e):p},e.cornerRadius=function(t){return arguments.length?(v="function"==typeof t?t:qu(+t),e):v},e.context=function(t){return arguments.length?(g=null==t?null:t,e):g},e},Fu=Math.PI,ju=function(){var o,u,s,f,c,l,h,d,p=null;function v(t,e,n){var r=n/2;if(c){var i=h-e,a=t-l;if(i||a){var o=Math.sqrt(i*i+a*a),u=(i/=o)*d,s=(a/=o)*d,f=Math.atan2(a,i);p.moveTo(l-u,h-s),p.lineTo(t-i*r,e-a*r),p.arc(t,e,r,f-Fu,f),p.lineTo(l+u,h+s),p.arc(l,h,d,f,f+Fu)}else p.arc(t,e,r,0,2*Fu);p.closePath()}else c=1;l=t,h=e,d=r}function e(t){var e,n,r,i=t.length,a=!1;for(null==p&&(p=r=fo()),e=0;e<=i;++e)!(e<i&&f(n=t[e],e,t))===a&&(a=!a)&&(c=0),a&&v(+o(n,e,t),+u(n,e,t),+s(n,e,t));if(r)return p=null,r+""||null}return e.x=function(t){return arguments.length?(o=t,e):o},e.y=function(t){return arguments.length?(u=t,e):u},e.size=function(t){return arguments.length?(s=t,e):s},e.defined=function(t){return arguments.length?(f=t,e):f},e.context=function(t){return arguments.length?(p=null==t?null:t,e):p},e};function Iu(t){return t.x||0}function $u(t){return t.y||0}function Bu(t){return t.cornerRadius||0}function Wu(t){return!(!1===t.defined)}var Yu=function(){var V=ko,X=Eo,J=co(0),Z=null,Q=So,K=Ao,tt=Co,et=null;function e(){var t,e,n,r,i,a,o,u,s,f,c,l,h=+V.apply(this,arguments),d=+X.apply(this,arguments),p=Q.apply(this,arguments)-xo,v=K.apply(this,arguments)-xo,g=lo(v-p),m=p<v;if(et||(et=t=fo()),d<h&&(e=d,d=h,h=e),bo<d)if(wo-bo<g)et.moveTo(d*po(p),d*mo(p)),et.arc(0,0,d,p,v,!m),bo<h&&(et.moveTo(h*po(v),h*mo(v)),et.arc(0,0,h,v,p,m));else{var y,b,_=p,x=v,w=p,M=v,k=g,E=g,S=tt.apply(this,arguments)/2,A=bo<S&&(Z?+Z.apply(this,arguments):yo(h*h+d*d)),C=go(lo(d-h)/2,+J.apply(this,arguments)),z=C,D=C;if(bo<A){var O=Mo(A/h*mo(S)),N=Mo(A/d*mo(S));(k-=2*O)>bo?(w+=O*=m?1:-1,M-=O):(k=0,w=M=(p+v)/2),(E-=2*N)>bo?(_+=N*=m?1:-1,x-=N):(E=0,_=x=(p+v)/2)}var R=d*po(_),T=d*mo(_),P=h*po(M),L=h*mo(M);if(bo<C){var q=d*po(x),U=d*mo(x),F=h*po(w),j=h*mo(w);if(g<_o){var I=bo<k?[(r=R)+(l=((f=P-(a=q))*((i=T)-(o=U))-(c=L-o)*(r-a))/(c*(u=F-r)-f*(s=j-i)))*u,i+l*s]:[P,L],$=R-I[0],B=T-I[1],W=q-I[0],Y=U-I[1],H=1/mo((1<(n=($*W+B*Y)/(yo($*$+B*B)*yo(W*W+Y*Y)))?0:n<-1?_o:Math.acos(n))/2),G=yo(I[0]*I[0]+I[1]*I[1]);z=go(C,(h-G)/(H-1)),D=go(C,(d-G)/(H+1))}}bo<E?bo<D?(y=zo(F,j,R,T,d,D,m),b=zo(q,U,P,L,d,D,m),et.moveTo(y.cx+y.x01,y.cy+y.y01),D<C?et.arc(y.cx,y.cy,D,ho(y.y01,y.x01),ho(b.y01,b.x01),!m):(et.arc(y.cx,y.cy,D,ho(y.y01,y.x01),ho(y.y11,y.x11),!m),et.arc(0,0,d,ho(y.cy+y.y11,y.cx+y.x11),ho(b.cy+b.y11,b.cx+b.x11),!m),et.arc(b.cx,b.cy,D,ho(b.y11,b.x11),ho(b.y01,b.x01),!m))):(et.moveTo(R,T),et.arc(0,0,d,_,x,!m)):et.moveTo(R,T),bo<h&&bo<k?bo<z?(y=zo(P,L,q,U,h,-z,m),b=zo(R,T,F,j,h,-z,m),et.lineTo(y.cx+y.x01,y.cy+y.y01),z<C?et.arc(y.cx,y.cy,z,ho(y.y01,y.x01),ho(b.y01,b.x01),!m):(et.arc(y.cx,y.cy,z,ho(y.y01,y.x01),ho(y.y11,y.x11),!m),et.arc(0,0,h,ho(y.cy+y.y11,y.cx+y.x11),ho(b.cy+b.y11,b.cx+b.x11),m),et.arc(b.cx,b.cy,z,ho(b.y11,b.x11),ho(b.y01,b.x01),!m))):et.arc(0,0,h,M,w,m):et.lineTo(P,L)}else et.moveTo(0,0);if(et.closePath(),t)return et=null,t+""||null}return e.centroid=function(){var t=(+V.apply(this,arguments)+ +X.apply(this,arguments))/2,e=(+Q.apply(this,arguments)+ +K.apply(this,arguments))/2-_o/2;return[po(e)*t,mo(e)*t]},e.innerRadius=function(t){return arguments.length?(V="function"==typeof t?t:co(+t),e):V},e.outerRadius=function(t){return arguments.length?(X="function"==typeof t?t:co(+t),e):X},e.cornerRadius=function(t){return arguments.length?(J="function"==typeof t?t:co(+t),e):J},e.padRadius=function(t){return arguments.length?(Z=null==t?null:"function"==typeof t?t:co(+t),e):Z},e.startAngle=function(t){return arguments.length?(Q="function"==typeof t?t:co(+t),e):Q},e.endAngle=function(t){return arguments.length?(K="function"==typeof t?t:co(+t),e):K},e.padAngle=function(t){return arguments.length?(tt="function"==typeof t?t:co(+t),e):tt},e.context=function(t){return arguments.length?(et=null==t?null:t,e):et},e}().startAngle(function(t){return t.startAngle||0}).endAngle(function(t){return t.endAngle||0}).padAngle(function(t){return t.padAngle||0}).innerRadius(function(t){return t.innerRadius||0}).outerRadius(function(t){return t.outerRadius||0}).cornerRadius(Bu),Hu=Po().x(Iu).y1($u).y0(function(t){return(t.y||0)+(t.height||0)}).defined(Wu),Gu=Po().y($u).x1(Iu).x0(function(t){return(t.x||0)+(t.width||0)}).defined(Wu),Vu=To().x(Iu).y($u).defined(Wu),Xu=Uu().x(Iu).y($u).width(function(t){return t.width||0}).height(function(t){return t.height||0}).cornerRadius(Bu),Ju=function(){var e=co(Lo),n=co(64),r=null;function i(){var t;if(r||(r=t=fo()),e.apply(this,arguments).draw(r,+n.apply(this,arguments)),t)return r=null,t+""||null}return i.type=function(t){return arguments.length?(e="function"==typeof t?t:co(t),i):e},i.size=function(t){return arguments.length?(n="function"==typeof t?t:co(+t),i):n},i.context=function(t){return arguments.length?(r=null==t?null:t,i):r},i}().type(function(t){return Ou(t.shape||"circle")}).size(function(t){return null==t.size?64:t.size}),Zu=ju().x(Iu).y($u).defined(Wu).size(function(t){return t.size||1});function Qu(t,e,n,r){return Xu.context(t)(e,n,r)}var Ku,ts=function(t,e){return e.stroke&&0!==e.opacity&&0!==e.strokeOpacity&&t.expand(null!=e.strokeWidth?+e.strokeWidth:1),t},es=2*Math.PI,ns=es/4,rs=es-1e-8;function is(t){return Ku=t,is}function as(){}function os(t,e){Ku.add(t,e)}is.beginPath=as,is.closePath=as,is.moveTo=os,is.lineTo=os,is.rect=function(t,e,n,r){os(t,e),os(t+n,e+r)},is.quadraticCurveTo=function(t,e,n,r){os(t,e),os(n,r)},is.bezierCurveTo=function(t,e,n,r,i,a){os(t,e),os(n,r),os(i,a)},is.arc=function(t,e,n,r,i,a){if(Math.abs(i-r)>rs)return os(t-n,e-n),void os(t+n,e+n);var o,u,s,f,c=1/0,l=-1/0,h=1/0,d=-1/0;function p(t){s=n*Math.cos(t),f=n*Math.sin(t),s<c&&(c=s),l<s&&(l=s),f<h&&(h=f),d<f&&(d=f)}if(p(r),p(i),i!==r)if((r%=es)<0&&(r+=es),(i%=es)<0&&(i+=es),i<r&&(a=!a,o=r,r=i,i=o),a)for(i-=es,o=r-r%ns,u=0;u<4&&i<o;++u,o-=ns)p(o);else for(o=r-r%ns+ns,u=0;u<4&&o<i;++u,o+=ns)p(o);os(t+c,e+h),os(t+l,e+d)};var us=function(t,e,n){return n.id?function(t,e,n){for(var r=n.width(),i=n.height(),a=n.x1+e.x1*r,o=n.y1+e.y1*i,u=n.x1+e.x2*r,s=n.y1+e.y2*i,f=e.stops,c=0,l=f.length,h=t.createLinearGradient(a,o,u,s);c<l;++c)h.addColorStop(f[c].offset,f[c].color);return h}(t,n,e.bounds):n},ss=function(t,e,n){return 0<(n*=null==e.fillOpacity?1:e.fillOpacity)&&(t.globalAlpha=n,t.fillStyle=us(t,e,e.fill),!0)},fs=[],cs=function(t,e,n){var r=null!=(r=e.strokeWidth)?r:1;return!(r<=0)&&(0<(n*=null==e.strokeOpacity?1:e.strokeOpacity)&&(t.globalAlpha=n,t.strokeStyle=us(t,e,e.stroke),t.lineWidth=r,t.lineCap=e.strokeCap||"butt",t.lineJoin=e.strokeJoin||"miter",t.miterLimit=e.strokeMiterLimit||10,t.setLineDash&&(t.setLineDash(e.strokeDash||fs),t.lineDashOffset=e.strokeDashOffset||0),!0))};function ls(t,e){return t.zindex-e.zindex||t.index-e.index}function hs(t){if(!t.zdirty)return t.zitems;var e,n,r,i=t.items,a=[];for(n=0,r=i.length;n<r;++n)(e=i[n]).index=n,e.zindex&&a.push(e);return t.zdirty=!1,t.zitems=a.sort(ls)}function ds(t,e){var n,r,i=t.items;if(i&&i.length){var a=hs(t);if(a&&a.length){for(n=0,r=i.length;n<r;++n)i[n].zindex||e(i[n]);i=a}for(n=0,r=i.length;n<r;++n)e(i[n])}}function ps(t,e){var n,r,i=t.items;if(!i||!i.length)return null;var a=hs(t);for(a&&a.length&&(i=a),r=i.length;0<=--r;)if(n=e(i[r]))return n;if(i===a)for(r=(i=t.items).length;0<=--r;)if(!i[r].zindex&&(n=e(i[r])))return n;return null}function vs(r){return function(e,t,n){ds(t,function(t){n&&!n.intersects(t.bounds)||gs(r,e,t,t)})}}function gs(t,e,n,r){var i=null==n.opacity?1:n.opacity;0!==i&&(t(e,r)||(n.fill&&ss(e,n,i)&&e.fill(),n.stroke&&cs(e,n,i)&&e.stroke()))}var ms=function(){return!0};function ys(u){return u||(u=ms),function(n,t,r,i,a,o){return 1<n.pixelRatio&&(r*=n.pixelRatio,i*=n.pixelRatio),ps(t,function(t){var e=t.bounds;if((!e||e.contains(a,o))&&e)return u(n,t,r,i,a,o)?t:void 0})}}function bs(f,c){return function(t,e,n,r){var i,a,o=Array.isArray(e)?e[0]:e,u=null==c?o.fill:c,s=o.stroke&&t.isPointInStroke;return s&&(i=o.strokeWidth,a=o.strokeCap,t.lineWidth=null!=i?i:1,t.lineCap=null!=a?a:"butt"),!f(t,e)&&(u&&t.isPointInPath(n,r)||s&&t.isPointInStroke(n,r))}}function _s(t){return ys(bs(t))}var xs=function(t,e){return"translate("+t+","+e+")"},ws=function(t){return xs(t.x||0,t.y||0)},Ms=function(t,i){function e(t,e){var n=e.x||0,r=e.y||0;t.translate(n,r),t.beginPath(),i(t,e),t.translate(-n,-r)}return{type:t,tag:"path",nested:!1,attr:function(t,e){t("transform",ws(e)),t("d",i(null,e))},bound:function(t,e){return i(is(t),e),ts(t,e).translate(e.x||0,e.y||0)},draw:vs(e),pick:_s(e)}},ks=Ms("arc",function(t,e){return Yu.context(t)(e)}),Es=function(t,r){function e(t,e){t.beginPath(),r(t,e)}var i,s=bs(e);return{type:t,tag:"path",nested:!0,attr:function(t,e){var n=e.mark.items;n.length&&t("d",r(null,n))},bound:function(t,e){var n=e.items;return 0===n.length?t:(r(is(t),n),ts(t,n[0]))},draw:(i=e,function(t,e,n){!e.items.length||n&&!n.intersects(e.bounds)||gs(i,t,e.items[0],e.items)}),pick:function(t,e,n,r,i,a){var o=e.items,u=e.bounds;return!o||!o.length||u&&!u.contains(i,a)?null:(1<t.pixelRatio&&(n*=t.pixelRatio,r*=t.pixelRatio),s(t,o,n,r)?o[0]:null)}}},Ss=Es("area",function(t,e){var n=e[0],r=n.interpolate||"linear";return("horizontal"===n.orient?Gu:Hu).curve(gu(r,n.orient,n.tension)).context(t)(e)}),As=1;var Cs=function(t,e,n){var r=e.clip,i=t._defs,a=e.clip_id||(e.clip_id="clip"+As++),o=i.clipping[a]||(i.clipping[a]={id:a});return R(r)?o.path=r(null):(o.width=n.width||0,o.height=n.height||0),"url(#"+a+")"},zs=.5;var Ds={type:"group",tag:"g",nested:!1,attr:function(t,e){t("transform",ws(e))},bound:function(t,e){if(!e.clip&&e.items)for(var n=e.items,r=0,i=n.length;r<i;++r)t.union(n[r].bounds);return(e.clip||e.width||e.height)&&ts(t.add(0,0).add(e.width||0,e.height||0),e),t.translate(e.x||0,e.y||0)},draw:function(u,t,s){var f=this;ds(t,function(t){var e,n,r=t.x||0,i=t.y||0,a=t.width||0,o=t.height||0;u.save(),u.translate(r,i),(t.stroke||t.fill)&&0<(n=null==t.opacity?1:t.opacity)&&(u.beginPath(),e=t.stroke?zs:0,Qu(u,t,e,e),t.fill&&ss(u,t,n)&&u.fill(),t.stroke&&cs(u,t,n)&&u.stroke()),t.clip&&(u.beginPath(),u.rect(0,0,a,o),u.clip()),s&&s.translate(-r,-i),ds(t,function(t){f.draw(u,t,s)}),s&&s.translate(r,i),u.restore()})},pick:function(r,o,u,s,f,c){if(o.bounds&&!o.bounds.contains(f,c)||!o.items)return null;var l=this;return ps(o,function(t){var e,i,a,n;if(!(n=t.bounds)||n.contains(f,c))return i=t.x||0,a=t.y||0,r.save(),r.translate(i,a),i=f-i,a=c-a,e=ps(t,function(t){return n=i,r=a,(!1!==(e=t).interactive||"group"===e.marktype)&&e.bounds&&e.bounds.contains(n,r)?l.pick(t,u,s,i,a):null;var e,n,r}),r.restore(),e||((e=!1!==o.interactive&&(t.fill||t.stroke)&&0<=i&&i<=t.width&&0<=a&&a<=t.height)?t:null)})},background:function(t,e){var n=e.stroke?zs:0;t("class","background"),t("d",Qu(null,e,n,n))},foreground:function(t,e,n){t("clip-path",e.clip?Cs(n,e,e):null)}};function Os(e,t){var n=e.image;return n&&n.url===e.url||(n={loaded:!1,width:0,height:0},t.loadImage(e.url).then(function(t){e.image=t,e.image.url=e.url})),n}function Ns(t,e){return"center"===t?e/2:"right"===t?e:0}function Rs(t,e){return"middle"===t?e/2:"bottom"===t?e:0}var Ts={type:"image",tag:"image",nested:!1,attr:function(t,e,n){var r=Os(e,n),i=e.x||0,a=e.y||0,o=(null!=e.width?e.width:r.width)||0,u=(null!=e.height?e.height:r.height)||0,s=!1===e.aspect?"none":"xMidYMid";i-=Ns(e.align,o),a-=Rs(e.baseline,u),t("href",r.src||"","http://www.w3.org/1999/xlink","xlink:href"),t("transform",xs(i,a)),t("width",o),t("height",u),t("preserveAspectRatio",s)},bound:function(t,e){var n=e.image,r=e.x||0,i=e.y||0,a=(null!=e.width?e.width:n&&n.width)||0,o=(null!=e.height?e.height:n&&n.height)||0;return r-=Ns(e.align,a),i-=Rs(e.baseline,o),t.set(r,i,r+a,i+o)},draw:function(c,t,l){var h=this;ds(t,function(t){if(!l||l.intersects(t.bounds)){var e,n,r,i,a=Os(t,h),o=t.x||0,u=t.y||0,s=(null!=t.width?t.width:a.width)||0,f=(null!=t.height?t.height:a.height)||0;o-=Ns(t.align,s),u-=Rs(t.baseline,f),!1!==t.aspect&&(n=a.width/a.height,r=t.width/t.height,n==n&&r==r&&n!==r&&(r<n?(u+=(f-(i=s/n))/2,f=i):(o+=(s-(i=f*n))/2,s=i))),a.loaded&&(c.globalAlpha=null!=(e=t.opacity)?e:1,c.drawImage(a,o,u,s,f))}})},pick:ys(),get:Os,xOffset:Ns,yOffset:Rs},Ps=Es("line",function(t,e){var n=e[0],r=n.interpolate||"linear";return Vu.curve(gu(r,n.orient,n.tension)).context(t)(e)});function Ls(t,e){var n=e.path;if(null==n)return!0;var r=e.pathCache;r&&r.path===n||((e.pathCache=r=bu(n)).path=n),Su(t,r,e.x,e.y)}var qs={type:"path",tag:"path",nested:!1,attr:function(t,e){t("transform",ws(e)),t("d",e.path)},bound:function(t,e){return Ls(is(t),e)?t.set(0,0,0,0):ts(t,e)},draw:vs(Ls),pick:_s(Ls)};function Us(t,e){t.beginPath(),Qu(t,e)}var Fs={type:"rect",tag:"path",nested:!1,attr:function(t,e){t("d",Qu(null,e))},bound:function(t,e){var n,r;return ts(t.set(n=e.x||0,r=e.y||0,n+e.width||0,r+e.height||0),e)},draw:vs(Us),pick:_s(Us)};function js(t,e,n){var r,i,a,o;return!(!e.stroke||!cs(t,e,n))&&(r=e.x||0,i=e.y||0,a=null!=e.x2?e.x2:r,o=null!=e.y2?e.y2:i,t.beginPath(),t.moveTo(r,i),t.lineTo(a,o),!0)}var Is,$s,Bs={type:"rule",tag:"line",nested:!1,attr:function(t,e){t("transform",ws(e)),t("x2",null!=e.x2?e.x2-(e.x||0):0),t("y2",null!=e.y2?e.y2-(e.y||0):0)},bound:function(t,e){var n,r;return ts(t.set(n=e.x||0,r=e.y||0,null!=e.x2?e.x2:n,null!=e.y2?e.y2:r),e)},draw:function(n,t,r){ds(t,function(t){if(!r||r.intersects(t.bounds)){var e=null==t.opacity?1:t.opacity;e&&js(n,t,e)&&n.stroke()}})},pick:ys(function(t,e,n,r){return!!t.isPointInStroke&&js(t,e,1)&&t.isPointInStroke(n,r)})},Ws=Ms("shape",function(t,e){return(e.mark.shape||e.shape).context(t)(e)}),Ys=Ms("symbol",function(t,e){return Ju.context(t)(e)}),Hs={height:Zs,measureWidth:Xs,estimateWidth:Gs,width:Gs,canvas:Qs};function Gs(t){return $s=Zs(t),Vs(Ks(t))}function Vs(t){return~~(.8*t.length*$s)}function Xs(t){return Is.font=tf(t),Js(Ks(t))}function Js(t){return Is.measureText(t).width}function Zs(t){return null!=t.fontSize?t.fontSize:11}function Qs(t){Is=t&&(Is=Qa(1,1))?Is.getContext("2d"):null,Hs.width=Is?Xs:Gs}function Ks(t){var e=t.text;return null==e?"":0<t.limit?function(t){var e,n=+t.limit,r=t.text+"";Is?(Is.font=tf(t),e=Js):($s=Zs(t),e=Vs);if(e(r)<n)return r;var i,a=t.ellipsis||"\xe2\x80\xa6",o="rtl"===t.dir,u=0,s=r.length;{if(n-=e(a),o){for(;u<s;)i=u+s>>>1,e(r.slice(i))>n?u=i+1:s=i;return a+r.slice(u)}for(;u<s;)i=1+(u+s>>>1),e(r.slice(0,i))<n?u=i:s=i-1;return r.slice(0,u)+a}}(t):e+""}function tf(t,e){var n=t.font;return e&&n&&(n=String(n).replace(/"/g,"\'")),(t.fontStyle?t.fontStyle+" ":"")+(t.fontVariant?t.fontVariant+" ":"")+(t.fontWeight?t.fontWeight+" ":"")+Zs(t)+"px "+(n||"sans-serif")}function ef(t){var e=t.baseline,n=Zs(t);return Math.round("top"===e?.79*n:"middle"===e?.3*n:"bottom"===e?-.21*n:0)}Qs(!0);var nf={left:"start",center:"middle",right:"end"},rf=new Ya;function af(t,e,n){var r,i,a=Hs.height(e),o=e.align,u=e.radius||0,s=e.x||0,f=e.y||0,c=e.dx||0,l=(e.dy||0)+ef(e)-Math.round(.8*a);return u&&(i=(e.theta||0)-Math.PI/2,s+=u*Math.cos(i),f+=u*Math.sin(i)),r=Hs.width(e),"center"===o?c-=r/2:"right"===o&&(c-=r),t.set(c+=s,l+=f,c+r,l+a),e.angle&&!n&&t.rotate(e.angle*Math.PI/180,s,f),t.expand(n||!r?0:1)}var of={arc:ks,area:Ss,group:Ds,image:Ts,line:Ps,path:qs,rect:Fs,rule:Bs,shape:Ws,symbol:Ys,text:{type:"text",tag:"text",nested:!1,attr:function(t,e){var n,r=e.dx||0,i=(e.dy||0)+ef(e),a=e.x||0,o=e.y||0,u=e.angle||0,s=e.radius||0;s&&(n=(e.theta||0)-Math.PI/2,a+=s*Math.cos(n),o+=s*Math.sin(n)),t("text-anchor",nf[e.align]||"start"),u?(n=xs(a,o)+" rotate("+u+")",(r||i)&&(n+=" "+xs(r,i))):n=xs(a+r,o+i),t("transform",n)},bound:af,draw:function(u,t,s){ds(t,function(t){var e,n,r,i,a,o;s&&!s.intersects(t.bounds)||(o=Ks(t))&&0!==(e=null==t.opacity?1:t.opacity)&&(u.font=tf(t),u.textAlign=t.align||"left",n=t.x||0,r=t.y||0,(i=t.radius)&&(a=(t.theta||0)-Math.PI/2,n+=i*Math.cos(a),r+=i*Math.sin(a)),t.angle&&(u.save(),u.translate(n,r),u.rotate(t.angle*Math.PI/180),n=r=0),n+=t.dx||0,r+=(t.dy||0)+ef(t),t.fill&&ss(u,t,e)&&u.fillText(o,n,r),t.stroke&&cs(u,t,e)&&u.strokeText(o,n,r),t.angle&&u.restore())})},pick:ys(function(t,e,n,r,i,a){if(e.fontSize<=0)return!1;if(!e.angle)return!0;var o=af(rf,e,!0),u=-e.angle*Math.PI/180,s=Math.cos(u),f=Math.sin(u),c=e.x,l=e.y,h=s*i-f*a+(c-c*s+l*f),d=f*i+s*a+(l-c*f-l*s);return o.contains(h,d)})},trail:Es("trail",function(t,e){return Zu.context(t)(e)})},uf=function(t,e,n){var r=of[t.mark.marktype],i=e||r.bound;return r.nested&&(t=t.mark),i(t.bounds||(t.bounds=new Ya),t,n)},sf={mark:null},ff=function(t,e,n){var r,i,a,o,u=of[t.marktype],s=u.bound,f=t.items,c=f&&f.length;if(u.nested)return c?a=f[0]:(sf.mark=t,a=sf),o=uf(a,s,n),e=e&&e.union(o)||o;if(e=e||t.bounds&&t.bounds.clear()||new Ya,c)for(r=0,i=f.length;r<i;++r)e.union(uf(f[r],s,n));return t.bounds=e},cf=["marktype","name","role","interactive","clip","items","zindex","x","y","width","height","align","baseline","fill","fillOpacity","opacity","stroke","strokeOpacity","strokeWidth","strokeCap","strokeDash","strokeDashOffset","startAngle","endAngle","innerRadius","outerRadius","cornerRadius","padAngle","interpolate","tension","orient","defined","url","path","x2","y2","size","shape","text","angle","theta","radius","dx","dy","font","fontSize","fontWeight","fontStyle","fontVariant"];function lf(t,e){return JSON.stringify(t,cf,e)}function hf(t){return function t(e){var n,r,i,a=e.marktype,o=e.items;if(o)for(r=0,i=o.length;r<i;++r)n=a?"mark":"group",o[r][n]=e,o[r].zindex&&(o[r][n].zdirty=!0),"group"===(a||n)&&t(o[r]);a&&ff(e);return e}("string"==typeof t?JSON.parse(t):t)}function df(t){arguments.length?this.root=hf(t):(this.root=vf({marktype:"group",name:"root",role:"frame"}),this.root.items=[new Za(this.root)])}var pf=df.prototype;function vf(t,e){return{bounds:new Ya,clip:!!t.clip,group:e,interactive:!1!==t.interactive,items:[],marktype:t.marktype,name:t.name||void 0,role:t.role||void 0,zindex:t.zindex||0}}function gf(t,e,n){return!t&&"undefined"!=typeof document&&document.createElement&&(t=document),t?n?t.createElementNS(n,e):t.createElement(e):null}function mf(t,e){e=e.toLowerCase();for(var n=t.childNodes,r=0,i=n.length;r<i;++r)if(n[r].tagName.toLowerCase()===e)return n[r]}function yf(t,e,n,r){var i,a=t.childNodes[e];return a&&a.tagName.toLowerCase()===n.toLowerCase()||(i=a||null,a=gf(t.ownerDocument,n,r),t.insertBefore(a,i)),a}function bf(t,e){for(var n=t.childNodes,r=n.length;e<r;)t.removeChild(n[--r]);return t}function _f(t){return"mark-"+t.marktype+(t.role?" role-"+t.role:"")+(t.name?" "+t.name:"")}function xf(t){this._active=null,this._handlers={},this._loader=t||re()}pf.toJSON=function(t){return lf(this.root,t||0)},pf.mark=function(t,e,n){var r=vf(t,e=e||this.root.items[0]);return(e.items[n]=r).zindex&&(r.group.zdirty=!0),r};var wf=xf.prototype;function Mf(t){this._el=null,this._bgcolor=null,this._loader=new to(t)}wf.initialize=function(t,e,n){return this._el=t,this._obj=n||null,this.origin(e)},wf.element=function(){return this._el},wf.origin=function(t){return this._origin=t||[0,0],this},wf.scene=function(t){return arguments.length?(this._scene=t,this):this._scene},wf.on=function(){},wf.off=function(){},wf._handlerIndex=function(t,e,n){for(var r=t?t.length:0;0<=--r;)if(t[r].type===e&&!n||t[r].handler===n)return r;return-1},wf.handlers=function(){var t,e=this._handlers,n=[];for(t in e)n.push.apply(n,e[t]);return n},wf.eventName=function(t){var e=t.indexOf(".");return e<0?t:t.slice(0,e)},wf.handleHref=function(i,t,e){this._loader.sanitize(e,{context:"href"}).then(function(t){var e=new MouseEvent(i.type,i),n=gf(null,"a");for(var r in t)n.setAttribute(r,t[r]);n.dispatchEvent(e)}).catch(function(){})},wf.handleTooltip=function(t,e,n){this._el.setAttribute("title",n||"")};var kf=Mf.prototype;kf.initialize=function(t,e,n,r,i){return this._el=t,this.resize(e,n,r,i)},kf.element=function(){return this._el},kf.scene=function(){return this._el&&this._el.firstChild},kf.background=function(t){return 0===arguments.length?this._bgcolor:(this._bgcolor=t,this)},kf.resize=function(t,e,n,r){return this._width=t,this._height=e,this._origin=n||[0,0],this._scale=r||1,this},kf.dirty=function(){},kf.render=function(t){var e=this;return e._call=function(){e._render(t)},e._call(),e._call=null,e},kf._render=function(){},kf.renderAsync=function(t){var e=this.render(t);return this._ready?this._ready.then(function(){return e}):Promise.resolve(e)},kf._load=function(t,e){var n=this,r=n._loader[t](e);if(!n._ready){var i=n._call;n._ready=n._loader.ready().then(function(t){t&&i(),n._ready=null})}return r},kf.sanitizeURL=function(t){return this._load("sanitizeURL",t)},kf.loadImage=function(t){return this._load("loadImage",t)};var Ef=function(t,e){var n=e.getBoundingClientRect();return[t.clientX-n.left-(e.clientLeft||0),t.clientY-n.top-(e.clientTop||0)]};function Sf(t){xf.call(this,t),this._down=null,this._touch=null,this._first=!0}var Af=j(Sf,xf);function Cf(r,i,a){return function(t){var e=this._active,n=this.pickEvent(t);n===e||(e&&e.exit||this.fire(a,t),this._active=n,this.fire(i,t)),this.fire(r,t)}}function zf(e){return function(t){this.fire(e,t),this._active=null}}Af.initialize=function(t,e,n){var r=this._canvas=t&&mf(t,"canvas");if(r){var i=this;this.events.forEach(function(e){r.addEventListener(e,function(t){Af[e]?Af[e].call(i,t):i.fire(e,t)})})}return xf.prototype.initialize.call(this,t,e,n)},Af.canvas=function(){return this._canvas},Af.context=function(){return this._canvas.getContext("2d")},Af.events=["keydown","keypress","keyup","dragenter","dragleave","dragover","mousedown","mouseup","mousemove","mouseout","mouseover","click","dblclick","wheel","mousewheel","touchstart","touchmove","touchend"],Af.DOMMouseScroll=function(t){this.fire("mousewheel",t)},Af.mousemove=Cf("mousemove","mouseover","mouseout"),Af.dragover=Cf("dragover","dragenter","dragleave"),Af.mouseout=zf("mouseout"),Af.dragleave=zf("dragleave"),Af.mousedown=function(t){this._down=this._active,this.fire("mousedown",t)},Af.click=function(t){this._down===this._active&&(this.fire("click",t),this._down=null)},Af.touchstart=function(t){this._touch=this.pickEvent(t.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire("touchstart",t,!0)},Af.touchmove=function(t){this.fire("touchmove",t,!0)},Af.touchend=function(t){this.fire("touchend",t,!0),this._touch=null},Af.fire=function(t,e,n){var r,i,a=n?this._touch:this._active,o=this._handlers[t];if("click"===t&&a&&a.href?this.handleHref(e,a,a.href):("mouseover"===t||"mouseout"===t)&&a&&a.tooltip&&this.handleTooltip(e,a,"mouseover"===t?a.tooltip:null),o)for(e.vegaType=t,r=0,i=o.length;r<i;++r)o[r].handler.call(this._obj,e,a)},Af.on=function(t,e){var n=this.eventName(t),r=this._handlers;return this._handlerIndex(r[n],t,e)<0&&(r[n]||(r[n]=[])).push({type:t,handler:e}),this},Af.off=function(t,e){var n=this.eventName(t),r=this._handlers[n],i=this._handlerIndex(r,t,e);return 0<=i&&r.splice(i,1),this},Af.pickEvent=function(t){var e=Ef(t,this._canvas),n=this._origin;return this.pick(this._scene,e[0],e[1],e[0]-n[0],e[1]-n[1])},Af.pick=function(t,e,n,r,i){var a=this.context();return of[t.marktype].pick.call(this,a,t,e,n,r,i)};var Df="undefined"!=typeof window&&window.devicePixelRatio||1;function Of(t){Mf.call(this,t),this._redraw=!1,this._dirty=new Ya}var Nf=j(Of,Mf),Rf=Mf.prototype,Tf=new Ya;function Pf(t){xf.call(this,t);var n=this;n._hrefHandler=qf(n,function(t,e){e&&e.href&&n.handleHref(t,e,e.href)}),n._tooltipHandler=qf(n,function(t,e){e&&e.tooltip&&n.handleTooltip(t,e,"mouseover"===t.type?e.tooltip:null)})}Nf.initialize=function(t,e,n,r,i){return this._canvas=Qa(1,1),t&&(bf(t,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),Rf.initialize.call(this,t,e,n,r,i)},Nf.resize=function(t,e,n,r){var i,a,o,u,s,f,c,l;return Rf.resize.call(this,t,e,n,r),i=this._canvas,a=this._width,o=this._height,u=this._origin,s=this._scale,f="undefined"!=typeof HTMLElement&&i instanceof HTMLElement&&null!=i.parentNode,c=i.getContext("2d"),l=f?Df:s,i.width=a*l,i.height=o*l,f&&1!==l&&(i.style.width=a+"px",i.style.height=o+"px"),c.pixelRatio=l,c.setTransform(l,0,0,l,l*u[0],l*u[1]),this._redraw=!0,this},Nf.canvas=function(){return this._canvas},Nf.context=function(){return this._canvas?this._canvas.getContext("2d"):null},Nf.dirty=function(t){var e=function(t,e){if(null==e)return t;for(var n=Tf.clear().union(t);null!=e;e=e.mark.group)n.translate(e.x||0,e.y||0);return n}(t.bounds,t.mark.group);this._dirty.union(e)},Nf._render=function(t){var e,n,r,i=this.context(),a=this._origin,o=this._width,u=this._height,s=this._dirty;return i.save(),this._redraw||s.empty()?(this._redraw=!1,s=null):(e=i,r=a,(n=s).expand(1).round(),n.translate(-r[0]%1,-r[1]%1),e.beginPath(),e.rect(n.x1,n.y1,n.width(),n.height()),e.clip(),s=n),this.clear(-a[0],-a[1],o,u),this.draw(i,t,s),i.restore(),this._dirty.clear(),this},Nf.draw=function(t,e,n){var r=of[e.marktype];e.clip&&function(t,e){var n=e.clip;if(t.save(),t.beginPath(),R(n))n(t);else{var r=e.group;t.rect(0,0,r.width||0,r.height||0)}t.clip()}(t,e),r.draw.call(this,t,e,n),e.clip&&t.restore()},Nf.clear=function(t,e,n,r){var i=this.context();i.clearRect(t,e,n,r),null!=this._bgcolor&&(i.fillStyle=this._bgcolor,i.fillRect(t,e,n,r))};var Lf=j(Pf,xf);function qf(n,r){return function(t){var e=t.target.__data__;t.vegaType=t.type,e=Array.isArray(e)?e[0]:e,r.call(n._obj,t,e)}}function Uf(t,e,n){var r,i,a="<"+t;if(e)for(r in e)null!=(i=e[r])&&(a+=" "+r+\'="\'+i+\'"\');return n&&(a+=" "+n),a+">"}function Ff(t){return"</"+t+">"}Lf.initialize=function(t,e,n){var r=this._svg;return r&&(r.removeEventListener("click",this._hrefHandler),r.removeEventListener("mouseover",this._tooltipHandler),r.removeEventListener("mouseout",this._tooltipHandler)),this._svg=r=t&&mf(t,"svg"),r&&(r.addEventListener("click",this._hrefHandler),r.addEventListener("mouseover",this._tooltipHandler),r.addEventListener("mouseout",this._tooltipHandler)),xf.prototype.initialize.call(this,t,e,n)},Lf.svg=function(){return this._svg},Lf.on=function(t,e){var n=this.eventName(t),r=this._handlers;if(this._handlerIndex(r[n],t,e)<0){var i={type:t,handler:e,listener:qf(this,e)};(r[n]||(r[n]=[])).push(i),this._svg&&this._svg.addEventListener(n,i.listener)}return this},Lf.off=function(t,e){var n=this.eventName(t),r=this._handlers[n],i=this._handlerIndex(r,t,e);return 0<=i&&(this._svg&&this._svg.removeEventListener(n,r[i].listener),r.splice(i,1)),this};var jf={version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},If={fill:"fill",fillOpacity:"fill-opacity",stroke:"stroke",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",strokeCap:"stroke-linecap",strokeJoin:"stroke-linejoin",strokeDash:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeMiterLimit:"stroke-miterlimit",opacity:"opacity"},$f=Object.keys(If),Bf=jf.xmlns;function Wf(t){Mf.call(this,t),this._dirtyID=1,this._dirty=[],this._svg=null,this._root=null,this._defs=null}var Yf=j(Wf,Mf),Hf=Mf.prototype;function Gf(t,e,n){var r,i,a;for((t=yf(t,n,"linearGradient",Bf)).setAttribute("id",e.id),t.setAttribute("x1",e.x1),t.setAttribute("x2",e.x2),t.setAttribute("y1",e.y1),t.setAttribute("y2",e.y2),r=0,i=e.stops.length;r<i;++r)(a=yf(t,r,"stop",Bf)).setAttribute("offset",e.stops[r].offset),a.setAttribute("stop-color",e.stops[r].color);bf(t,r)}function Vf(t,e,n){var r;(t=yf(t,n,"clipPath",Bf)).setAttribute("id",e.id),e.path?(r=yf(t,0,"path",Bf)).setAttribute("d",e.path):((r=yf(t,0,"rect",Bf)).setAttribute("x",0),r.setAttribute("y",0),r.setAttribute("width",e.width),r.setAttribute("height",e.height))}function Xf(t,e){for(;t&&t.dirty!==e;t=t.mark.group){if(t.dirty=e,!t.mark||t.mark.dirty===e)return;t.mark.dirty=e}}function Jf(t,e,n,r){var i,a=t._svg;if(!a&&(a=gf(i=e.ownerDocument,r,Bf),t._svg=a,t.mark&&(a.__data__=t,a.__values__={fill:"default"},"g"===r))){var o=gf(i,"path",Bf);o.setAttribute("class","background"),a.appendChild(o),o.__data__=t;var u=gf(i,"g",Bf);a.appendChild(u),u.__data__=t}return!i&&a.previousSibling===n&&n||e.insertBefore(a,n?n.nextSibling:e.firstChild),a}Yf.initialize=function(t,e,n,r){return t&&(this._svg=yf(t,0,"svg",Bf),this._svg.setAttribute("class","marks"),bf(t,1),this._root=yf(this._svg,0,"g",Bf),bf(this._svg,1)),this._defs={gradient:{},clipping:{}},this.background(this._bgcolor),Hf.initialize.call(this,t,e,n,r)},Yf.background=function(t){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",t),Hf.background.apply(this,arguments)},Yf.resize=function(t,e,n,r){return Hf.resize.call(this,t,e,n,r),this._svg&&(this._svg.setAttribute("width",this._width*this._scale),this._svg.setAttribute("height",this._height*this._scale),this._svg.setAttribute("viewBox","0 0 "+this._width+" "+this._height),this._root.setAttribute("transform","translate("+this._origin+")")),this._dirty=[],this},Yf.svg=function(){if(!this._svg)return null;var t={class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 "+this._width+" "+this._height};for(var e in jf)t[e]=jf[e];var n=this._bgcolor?Uf("rect",{width:this._width,height:this._height,style:"fill: "+this._bgcolor+";"})+Ff("rect"):"";return Uf("svg",t)+n+this._svg.innerHTML+Ff("svg")},Yf._render=function(t){return this._dirtyCheck()&&(this._dirtyAll&&this._resetDefs(),this.draw(this._root,t),bf(this._root,1)),this.updateDefs(),this._dirty=[],++this._dirtyID,this},Yf.updateDefs=function(){var t,e=this._svg,n=this._defs,r=n.el,i=0;for(t in n.gradient)r||(n.el=r=yf(e,0,"defs",Bf)),Gf(r,n.gradient[t],i++);for(t in n.clipping)r||(n.el=r=yf(e,0,"defs",Bf)),Vf(r,n.clipping[t],i++);r&&(0===i?(e.removeChild(r),n.el=null):bf(r,i))},Yf._resetDefs=function(){var t=this._defs;t.gradient={},t.clipping={}},Yf.dirty=function(t){t.dirty!==this._dirtyID&&(t.dirty=this._dirtyID,this._dirty.push(t))},Yf.isDirty=function(t){return this._dirtyAll||!t._svg||t.dirty===this._dirtyID},Yf._dirtyCheck=function(){this._dirtyAll=!0;var t=this._dirty;if(!t.length)return!0;var e,n,r,i,a,o,u,s=++this._dirtyID;for(a=0,o=t.length;a<o;++a)(n=(e=t[a]).mark).marktype!==r&&(r=n.marktype,i=of[r]),n.zdirty&&n.dirty!==s&&(this._dirtyAll=!1,n.dirty=s,Xf(n.group,s)),e.exit?(i.nested&&n.items.length?(u=n.items[0])._svg&&this._update(i,u._svg,u):e._svg&&(u=e._svg.parentNode)&&u.removeChild(e._svg),e._svg=null):(e=i.nested?n.items[0]:e)._update!==s&&(e._svg&&e._svg.ownerSVGElement?this._update(i,e._svg,e):(this._dirtyAll=!1,Xf(e,s)),e._update=s);return!this._dirtyAll},Yf.draw=function(t,e,n){if(!this.isDirty(e))return e._svg;var r,i=this,a=of[e.marktype],o=!1===e.interactive?"none":null,u="g"===a.tag,s=null,f=0;function c(t){var e=i.isDirty(t),n=Jf(t,r,s,a.tag);e&&(i._update(a,n,t),u&&function(e,n,t){n=n.lastChild;var r,i=0;ds(t,function(t){r=e.draw(n,t,r),++i}),bf(n,1+i)}(i,n,t)),s=n,++f}return(r=Jf(e,t,n,"g")).setAttribute("class",_f(e)),u||r.style.setProperty("pointer-events",o),e.clip?r.setAttribute("clip-path",Cs(i,e,e.group)):r.removeAttribute("clip-path"),a.nested?e.items.length&&c(e.items[0]):ds(e,c),bf(r,f),r};var Zf=null,Qf=null,Kf={group:function(t,e,n){Qf=e.__values__,Zf=e.childNodes[1],t.foreground(tc,n,this),Zf=e.childNodes[0],t.background(tc,n,this);var r=!1===n.mark.interactive?"none":null;r!==Qf.events&&(Zf.style.setProperty("pointer-events",r),Qf.events=r)},text:function(t,e,n){var r=Ks(n);r!==Qf.text&&(e.textContent=r,Qf.text=r),(r=tf(n))!==Qf.font&&(e.style.setProperty("font",r),Qf.font=r)}};function tc(t,e,n){e!==Qf[t]&&(null!=e?n?Zf.setAttributeNS(n,t,e):Zf.setAttribute(t,e):n?Zf.removeAttributeNS(n,t):Zf.removeAttribute(t),Qf[t]=e)}function ec(t){Mf.call(this,t),this._text={head:"",bg:"",root:"",foot:"",defs:"",body:""},this._defs={gradient:{},clipping:{}}}Yf._update=function(t,e,n){Qf=(Zf=e).__values__,t.attr(tc,n,this);var r=Kf[t.type];r&&r.call(this,t,e,n),this.style(Zf,n)},Yf.style=function(t,e){var n,r,i,a,o,u;if(null!=e)for(n=0,r=$f.length;n<r;++n)(o=e[i=$f[n]])!==Qf[i]&&(a=If[i],null==o?"fill"===a?t.style.setProperty(a,"none"):t.style.removeProperty(a):(o.id&&(this._defs.gradient[o.id]=o,o="url("+(u=void 0,"undefined"==typeof window?"":(u=window.location).hash?u.href.slice(0,-u.hash.length):u.href)+"#"+o.id+")"),t.style.setProperty(a,o+"")),Qf[i]=o)};var nc,rc=j(ec,Mf),ic=Mf.prototype;function ac(t,e,n,r){nc[r||t]=e}function oc(t,e,n,r){if(null==t)return"";var i,a,o,u,s,f="";for("bgrect"===n&&!1===e.interactive&&(f+="pointer-events: none; "),"text"===n&&(f+="font: "+tf(t)+"; "),i=0,a=$f.length;i<a;++i)o=$f[i],u=If[o],null==(s=t[o])?"fill"===u&&(f+="fill: none; "):"transparent"!==s||"fill"!==u&&"stroke"!==u?(s.id&&(s="url(#"+(r.gradient[s.id]=s).id+")"),f+=u+": "+s+"; "):f+=u+": none; ";return f?\'style="\'+f.trim()+\'"\':null}rc.resize=function(t,e,n,r){ic.resize.call(this,t,e,n,r);var i=this._origin,a=this._text,o={class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 "+this._width+" "+this._height};for(var u in jf)o[u]=jf[u];a.head=Uf("svg",o);var s=this._bgcolor;return"transparent"!==s&&"none"!==s||(s=null),a.bg=s?Uf("rect",{width:this._width,height:this._height,style:"fill: "+s+";"})+Ff("rect"):"",a.root=Uf("g",{transform:"translate("+i+")"}),a.foot=Ff("g")+Ff("svg"),this},rc.background=function(){var t=ic.background.apply(this,arguments);return arguments.length&&this._text.head&&this.resize(this._width,this._height,this._origin,this._scale),t},rc.svg=function(){var t=this._text;return t.head+t.bg+t.defs+t.root+t.body+t.foot},rc._render=function(t){return this._text.body=this.mark(t),this._text.defs=this.buildDefs(),this},rc.buildDefs=function(){var t,e,n,r,i=this._defs,a="";for(e in i.gradient){for(r=(n=i.gradient[e]).stops,a+=Uf("linearGradient",{id:e,x1:n.x1,x2:n.x2,y1:n.y1,y2:n.y2}),t=0;t<r.length;++t)a+=Uf("stop",{offset:r[t].offset,"stop-color":r[t].color})+Ff("stop");a+=Ff("linearGradient")}for(e in i.clipping)n=i.clipping[e],a+=Uf("clipPath",{id:e}),n.path?a+=Uf("path",{d:n.path})+Ff("path"):a+=Uf("rect",{x:0,y:0,width:n.width,height:n.height})+Ff("rect"),a+=Ff("clipPath");return 0<a.length?Uf("defs")+a+Ff("defs"):""},rc.attributes=function(t,e){return nc={},t(ac,e,this),nc},rc.href=function(t){var e,n=this,r=t.href;if(r){if(e=n._hrefs&&n._hrefs[r])return e;n.sanitizeURL(r).then(function(t){t["xlink:href"]=t.href,t.href=null,(n._hrefs||(n._hrefs={}))[r]=t})}return null},rc.mark=function(n){var r,i=this,a=of[n.marktype],o=a.tag,u=this._defs,s="";function t(t){var e=i.href(t);e&&(s+=Uf("a",e)),r="g"!==o?oc(t,n,o,u):null,s+=Uf(o,i.attributes(a.attr,t),r),"text"===o?s+=Ks(t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"):"g"===o&&(s+=Uf("path",i.attributes(a.background,t),oc(t,n,"bgrect",u))+Ff("path"),s+=Uf("g",i.attributes(a.foreground,t))+i.markGroup(t)+Ff("g")),s+=Ff(o),e&&(s+=Ff("a"))}return"g"!==o&&!1===n.interactive&&(r=\'style="pointer-events: none;"\'),s+=Uf("g",{class:_f(n),"clip-path":n.clip?Cs(i,n,n.group):null},r),a.nested?n.items&&n.items.length&&t(n.items[0]):ds(n,t),s+Ff("g")},rc.markGroup=function(t){var e=this,n="";return ds(t,function(t){n+=e.mark(t)}),n};var uc={Canvas:"canvas",PNG:"png",SVG:"svg",None:"none"},sc={};function fc(t,e){return t=String(t||"").toLowerCase(),1<arguments.length?(sc[t]=e,this):sc[t]}sc.canvas=sc.png={renderer:Of,headless:Of,handler:Sf},sc.svg={renderer:Wf,headless:ec,handler:Pf},sc.none={};var cc=new Ya,lc=function(t){var e=t.clip;if(R(e))e(is(cc.clear()));else{if(!e)return;cc.set(0,0,t.group.width,t.group.height)}t.bounds.intersect(cc)},hc=1e-9;function dc(t,e,n){return t===e||("path"===n?pc(t,e):t instanceof Date&&e instanceof Date?+t==+e:B(t)&&B(e)?Math.abs(t-e)<=hc:t&&e&&(J(t)||J(e))?null!=t&&null!=e&&function(t,e){var n,r,i=Object.keys(t),a=Object.keys(e);if(i.length!==a.length)return!1;for(i.sort(),a.sort(),r=i.length-1;0<=r;r--)if(i[r]!=a[r])return!1;for(r=i.length-1;0<=r;r--)if(n=i[r],!dc(t[n],e[n],n))return!1;return typeof t==typeof e}(t,e):t==e)}function pc(t,e){return dc(bu(t),bu(e))}function vc(t){Wr.call(this,null,t)}function gc(t,e,n){return e(t.bounds.clear(),t,n)}j(vc,Wr).transform=function(t,e){var n,r=e.dataflow,i=t.mark,a=i.marktype,o=of[a],u=o.bound,s=i.bounds;return o.nested?(i.items.length&&r.dirty(i.items[0]),s=gc(i,u),i.items.forEach(function(t){t.bounds.clear().union(s)})):"group"===a||t.modified()?(e.visit(e.MOD,function(t){r.dirty(t)}),s.clear(),i.items.forEach(function(t){s.union(gc(t,u))})):(n=e.changed(e.REM),e.visit(e.ADD,function(t){s.union(gc(t,u))}),e.visit(e.MOD,function(t){n=n||s.alignsWith(t.bounds),r.dirty(t),s.union(gc(t,u))}),n&&(s.clear(),i.items.forEach(function(t){s.union(t.bounds)}))),lc(i),e.modifies("bounds")};var mc=":vega_identifier:";function yc(t){Wr.call(this,0,t)}function bc(t){Wr.call(this,null,t)}yc.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},j(yc,Wr).transform=function(t,e){var n=function(t){var e=t._signals[mc];e||(t._signals[mc]=e=t.add(0));return e}(e.dataflow),r=n.value,i=t.as;return e.visit(e.ADD,function(t){t[i]||(t[i]=++r)}),n.set(this.value=r),e},j(bc,Wr).transform=function(t,e){var n,r,i,a=this.value;a||((a=e.dataflow.scenegraph().mark(t.markdef,(r=(n=t).groups,i=n.parent,r&&1===r.size?r.get(Object.keys(r.object)[0]):r&&i?r.lookup(i):null),t.index)).group.context=t.context,t.context.group||(t.context.group=a.group),a.source=this,a.clip=t.clip,a.interactive=t.interactive,this.value=a);var o="group"===a.marktype?Za:Ja;return e.visit(e.ADD,function(t){o.call(t,a)}),(t.modified("clip")||t.modified("interactive"))&&(a.clip=t.clip,a.interactive=!!t.interactive,a.zdirty=!0,e.reflow()),a.items=e.source,e};var _c="top",xc="left",wc="right",Mc="bottom";function kc(t){Wr.call(this,null,t)}var Ec=j(kc,Wr),Sc={parity:function(t){return t.filter(function(t,e){return e%2?t.opacity=0:1})},greedy:function(t){var n;return t.filter(function(t,e){return e&&Ac(n.bounds,t.bounds)?t.opacity=0:(n=t,1)})}};function Ac(t,e){return!(t.x2-1<e.x1||t.x1+1>e.x2||t.y2-1<e.y1||t.y1+1>e.y2)}function Cc(t){for(var e,n=1,r=t.length,i=t[0].bounds;n<r;i=e,++n)if(Ac(i,e=t[n].bounds))return!0}function zc(t){var e=t.bounds;return 1<e.width()&&1<e.height()}function Dc(t){Wr.call(this,null,t)}Ec.transform=function(t,e){var n=Sc[t.method]||Sc.parity,r=e.materialize(e.SOURCE).source;if(r){t.sort&&(r=r.slice().sort(t.sort)),"greedy"===t.method&&(r=r.filter(zc)),r.forEach(function(t){t.opacity=1});var i,a,o,u,s,f=r;if(3<=f.length&&Cc(f)){for(e=e.reflow(t.modified()).modifies("opacity");3<=(f=n(f)).length&&Cc(f););f.length<3&&!E(r).opacity&&(1<f.length&&(E(f).opacity=0),E(r).opacity=1)}if(t.boundScale){var c=(i=t.boundScale,a=t.boundOrient,o=t.boundTolerance,u=i.range(),s=new Ya,a===_c||a===Mc?s.set(u[0],-1/0,u[1],1/0):s.set(-1/0,u[0],1/0,u[1]),s.expand(o||1),function(t){return s.encloses(t.bounds)});r.forEach(function(t){c(t)||(t.opacity=0)})}return e}},j(Dc,Wr).transform=function(t,e){var n=e.dataflow;if(e.visit(e.ALL,function(t){n.dirty(t)}),e.fields&&e.fields.zindex){var r=e.source&&e.source[0];r&&(r.mark.zdirty=!0)}};var Oc="axis",Nc="legend",Rc="row-header",Tc="row-footer",Pc="row-title",Lc="column-header",qc="column-footer",Uc="column-title";function Fc(t,e){for(var n=0,r=t.length;n<r;++n)e.push(t[n])}function jc(t){return{x1:0,y1:0,x2:t.width||0,y2:t.height||0}}function Ic(t){var e=t.bounds.clone();return e.empty()?e.set(0,0,0,0):e.translate(-(t.x||0),-(t.y||0))}function $c(t,e){return"x1"===e?t.x||0:"y1"===e?t.y||0:"x2"===e?(t.x||0)+(t.width||0):"y2"===e?(t.y||0)+(t.height||0):void 0}function Bc(t,e){return t.bounds[e]}function Wc(t,e,n){var r=J(t)?t[e]:t;return null!=r?r:void 0!==n?n:0}function Yc(t){return t<0?Math.ceil(-t):0}function Hc(t,e,n){var r,i,a,o,u,s,f,c,l,h,d,p,v,g=function(t){for(var e,n,r=t.items,i=r.length,a=0,o={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};a<i;++a)if(n=(e=r[a]).items,"group"===e.marktype)switch(e.role){case Oc:case Nc:break;case Rc:Fc(n,o.rowheaders);break;case Tc:Fc(n,o.rowfooters);break;case Lc:Fc(n,o.colheaders);break;case qc:Fc(n,o.colfooters);break;case Pc:o.rowtitle=n[0];break;case Uc:o.coltitle=n[0];break;default:Fc(n,o.marks)}return o}(e),m=g.marks,y="flush"===n.bounds,b=y?jc:Ic,_=new Ya(0,0,0,0),x=Wc(n.align,"column"),w=Wc(n.align,"row"),M=Wc(n.padding,"column"),k=Wc(n.padding,"row"),E=n.offset,S=e.columns||n.columns||m.length,A=S<0?1:Math.ceil(m.length/S),C=A*S,z=[],D=[],O=[],N=[],R=m.length;for(i=0;i<S;++i)D[i]=0;for(i=0;i<A;++i)N[i]=0;for(i=0;i<R;++i)u=b(m[i]),o=~~(i/S),f=(a=i%S)?Math.ceil(b(m[i-1]).x2):0,c=o?Math.ceil(b(m[i-S]).y2):0,D[a]=Math.max(D[a],f),N[o]=Math.max(N[o],c),z.push(M+Yc(u.x1)),O.push(k+Yc(u.y1)),t.dirty(m[i]);for(i=0;i<R;++i)i%S==0&&(z[i]=0),i<S&&(O[i]=0);if("each"===x)for(a=1;a<S;++a){for(v=0,i=a;i<R;i+=S)v<z[i]&&(v=z[i]);for(i=a;i<R;i+=S)z[i]=v+D[a]}else if("all"===x){for(p=0,a=1;a<S;++a)p<D[a]&&(p=D[a]);for(i=v=0;i<R;++i)i%S&&v<z[i]&&(v=z[i]);for(i=0;i<R;++i)i%S&&(z[i]=v+p)}else for(a=1;a<S;++a)for(i=a;i<R;i+=S)z[i]+=D[a];if("each"===w)for(o=1;o<A;++o){for(v=0,r=(i=o*S)+S;i<r;++i)v<O[i]&&(v=O[i]);for(i=o*S;i<r;++i)O[i]=v+N[o]}else if("all"===w){for(p=0,o=1;o<A;++o)p<N[o]&&(p=N[o]);for(v=0,i=S;i<R;++i)v<O[i]&&(v=O[i]);for(i=S;i<R;++i)O[i]=v+p}else for(o=1;o<A;++o)for(r=(i=o*S)+S;i<r;++i)O[i]+=N[o];for(i=l=0;i<R;++i)f=(s=m[i]).x||0,s.x=l=z[i]+(i%S?l:0),s.bounds.translate(l-f,0);for(a=0;a<S;++a)for(h=0,i=a;i<R;i+=S)c=(s=m[i]).y||0,s.y=h+=O[i],s.bounds.translate(0,h-c);for(i=0;i<R;++i)m[i].mark.bounds.clear();for(i=0;i<R;++i)s=m[i],t.dirty(s),_.union(s.mark.bounds.union(s.bounds));function T(t,e){return Math.floor(Math.min(t,e))}function P(t,e){return Math.ceil(Math.max(t,e))}b=y?$c:Bc,d=Wc(n.headerBand,"row",null),l=Gc(t,g.rowheaders,m,S,A,-Wc(E,"rowHeader"),T,0,b,"x1",0,S,1,d),d=Wc(n.headerBand,"column",null),h=Gc(t,g.colheaders,m,S,S,-Wc(E,"columnHeader"),T,1,b,"y1",0,1,S,d),d=Wc(n.footerBand,"row",null),Gc(t,g.rowfooters,m,S,A,Wc(E,"rowFooter"),P,0,b,"x2",S-1,S,1,d),d=Wc(n.footerBand,"column",null),Gc(t,g.colfooters,m,S,S,Wc(E,"columnFooter"),P,1,b,"y2",C-S,1,S,d),g.rowtitle&&(v=l-Wc(E,"rowTitle"),d=Wc(n.titleBand,"row",.5),Vc(t,g.rowtitle,v,0,_,d)),g.coltitle&&(v=h-Wc(E,"columnTitle"),d=Wc(n.titleBand,"column",.5),Vc(t,g.coltitle,v,1,_,d))}function Gc(t,e,n,r,i,a,o,u,s,f,c,l,h,d){var p,v,g,m,y,b,_,x,w,M=n.length,k=0,E=0;if(!M)return k;for(p=c;p<M;p+=l)n[p]&&(k=o(k,s(n[p],f)));if(!e.length)return k;for(e.length>i&&(t.warn("Grid headers exceed limit: "+i),e=e.slice(0,i)),k+=a,v=0,m=e.length;v<m;++v)t.dirty(e[v]),e[v].mark.bounds.clear();for(p=c,v=0,m=e.length;v<m;++v,p+=l){for(y=(b=e[v]).mark.bounds,g=p;0<=g&&null==(_=n[g]);g-=h);u?(x=null==d?_.x:Math.round(_.bounds.x1+d*_.bounds.width()),w=k):(x=k,w=null==d?_.y:Math.round(_.bounds.y1+d*_.bounds.height())),y.union(b.bounds.translate(x-(b.x||0),w-(b.y||0))),b.x=x,b.y=w,t.dirty(b),E=o(E,y[f])}return E}function Vc(t,e,n,r,i,a){if(e){t.dirty(e);var o=n,u=n;r?o=Math.round(i.x1+a*i.width()):u=Math.round(i.y1+a*i.height()),e.bounds.translate(o-(e.x||0),u-(e.y||0)),e.mark.bounds.clear().union(e.bounds),e.x=o,e.y=u,t.dirty(e)}}var Xc="fit",Jc="fit-x",Zc="fit-y",Qc="pad",Kc="none",tl="padding",el="axis",nl="title",rl="frame",il="legend",al="scope",ol="row-header",ul="row-footer",sl="column-header",fl="column-footer",cl=.5,ll=new Ya;function hl(t){Wr.call(this,null,t)}function dl(t,e,n){return t[e]===n?0:(t[e]=n,1)}function pl(t){var e=t.items[0].datum.orient;return e===xc||e===wc}function vl(t,e,n,r){var i,a,o,u,s=e.items[0],f=s.datum,c=f.orient,l=(u=+(o=f).grid,[o.ticks?u++:-1,o.labels?u++:-1,u+ +o.domain]),h=s.range,d=s.offset,p=s.position,v=s.minExtent,g=s.maxExtent,m=f.title&&s.items[l[2]].items[0],y=s.titlePadding,b=s.bounds,_=0,x=0;switch(ll.clear().union(b),b.clear(),-1<(i=l[0])&&b.union(s.items[i].bounds),-1<(i=l[1])&&b.union(s.items[i].bounds),c){case _c:_=p||0,x=-d,a=Math.max(v,Math.min(g,-b.y1)),m&&(m.auto?(a+=y,m.y=-a,a+=m.bounds.height(),b.add(m.bounds.x1,0).add(m.bounds.x2,0)):b.union(m.bounds)),b.add(0,-a).add(h,0);break;case xc:_=-d,x=p||0,a=Math.max(v,Math.min(g,-b.x1)),m&&(m.auto?(a+=y,m.x=-a,a+=m.bounds.width(),b.add(0,m.bounds.y1).add(0,m.bounds.y2)):b.union(m.bounds)),b.add(-a,0).add(0,h);break;case wc:_=n+d,x=p||0,a=Math.max(v,Math.min(g,b.x2)),m&&(m.auto?(a+=y,m.x=a,a+=m.bounds.width(),b.add(0,m.bounds.y1).add(0,m.bounds.y2)):b.union(m.bounds)),b.add(0,0).add(a,h);break;case Mc:_=p||0,x=r+d,a=Math.max(v,Math.min(g,b.y2)),m&&(m.auto?(a+=y,m.y=a,a+=m.bounds.height(),b.add(m.bounds.x1,0).add(m.bounds.x2,0)):b.union(m.bounds)),b.add(0,0).add(h,a);break;default:_=s.x,x=s.y}return ts(b.translate(_,x),s),dl(s,"x",_+cl)|dl(s,"y",x+cl)&&(s.bounds=ll,t.dirty(s),s.bounds=b,t.dirty(s)),s.mark.bounds.clear().union(b)}function gl(t,e,n,r,i,a,o){var u,s,f,c=e.items[0],l=c.datum.orient,h=c.offset,d=c.bounds,p=0,v=0;switch(l===_c||l===Mc?(f=i,p=n[l]):l!==xc&&l!==wc||(f=r,v=n[l]),ll.clear().union(d),d.clear(),c.items.forEach(function(t){d.union(t.bounds)}),u=Math.round(d.width())+2*c.padding-1,s=Math.round(d.height())+2*c.padding-1,l){case xc:p-=u+h-Math.floor(f.x1),n.left+=s+n.margin;break;case wc:p+=h+Math.ceil(f.x2),n.right+=s+n.margin;break;case _c:v-=s+h-Math.floor(f.y1),n.top+=u+n.margin;break;case Mc:v+=h+Math.ceil(f.y2),n.bottom+=u+n.margin;break;case"top-left":p+=h,v+=h;break;case"top-right":p+=a-u-h,v+=h;break;case"bottom-left":p+=h,v+=o-s-h;break;case"bottom-right":p+=a-u-h,v+=o-s-h;break;default:p=c.x,v=c.y}return ts(d.set(p,v,p+u,v+s),c),dl(c,"x",p)|dl(c,"width",u)|dl(c,"y",v)|dl(c,"height",s)&&(c.bounds=ll,t.dirty(c),c.bounds=d,t.dirty(c)),c.mark.bounds.clear().union(d)}j(hl,Wr).transform=function(e,t){var n=t.dataflow;return e.mark.items.forEach(function(t){e.layout&&Hc(n,t,e.layout),function(t,e,n){var r,i,a,o,u,s,f=e.items,c=Math.max(0,e.width||0),l=Math.max(0,e.height||0),h=(new Ya).set(0,0,c,l),d=h.clone(),p=h.clone(),v=h.clone(),g=[];for(u=0,s=f.length;u<s;++u)switch((i=f[u]).role){case el:d.union(o=vl(t,i,c,l)),(pl(i)?p:v).union(o);break;case nl:r=i;break;case il:g.push(i);break;case rl:case al:case ol:case ul:case sl:case fl:p.union(i.bounds),v.union(i.bounds);break;default:h.union(i.bounds)}r&&(d.union(o=function(t,e,n){var r=e.items[0],i=r.datum.orient,a=r.offset,o=r.bounds,u=0,s=0;switch(ll.clear().union(o),i){case _c:u=r.x,s=n.y1-a;break;case xc:u=n.x1-a,s=r.y;break;case wc:u=n.x2+a,s=r.y;break;case Mc:u=r.x,s=n.y2+a;break;default:u=r.x,s=r.y}o.translate(u-r.x,s-r.y),dl(r,"x",u)|dl(r,"y",s)&&(r.bounds=ll,t.dirty(r),r.bounds=o,t.dirty(r));return e.bounds.clear().union(o)}(t,r,d)),(pl(r)?p:v).union(o));if(g.length)for(a={left:0,right:0,top:0,bottom:0,margin:n.legendMargin||8},u=0,s=g.length;u<s;++u)if(o=gl(t,g[u],a,p,v,c,l),n.autosize&&n.autosize.type===Xc){var m=g[u].items[0].datum.orient;m===xc||m===wc?h.add(o.x1,0).add(o.x2,0):m!==_c&&m!==Mc||h.add(0,o.y1).add(0,o.y2)}else h.union(o);h.union(p).union(v).union(d),function(t,e,n,r){var i=r.autosize||{},a=i.type,o=t._width,u=t._height,s=t.padding();if(t._autosize<1||!a)return;var f=Math.max(0,e.width||0),c=Math.max(0,Math.ceil(-n.x1)),l=Math.max(0,Math.ceil(n.x2-f)),h=Math.max(0,e.height||0),d=Math.max(0,Math.ceil(-n.y1)),p=Math.max(0,Math.ceil(n.y2-h));i.contains===tl&&(o-=s.left+s.right,u-=s.top+s.bottom);a===Kc?(d=c=0,f=o,h=u):a===Xc?(f=Math.max(0,o-c-l),h=Math.max(0,u-d-p)):a===Jc?(f=Math.max(0,o-c-l),u=h+d+p):a===Zc?(o=f+c+l,h=Math.max(0,u-d-p)):a===Qc&&(o=f+c+l,u=h+d+p);t._resizeView(o,u,f,h,[c,d],i.resize)}(t,e,h,n)}(n,t,e)}),t};var ml=Object.freeze({bound:vc,identifier:yc,mark:bc,overlap:kc,render:Dc,viewlayout:hl}),yl="log",bl="pow",_l="sqrt",xl="band",wl="point",Ml="linear",kl="ordinal",El="quantile",Sl="quantize",Al="threshold",Cl="bin-ordinal",zl="sequential",Dl=function(i){return function(t){var e,n=t[0],r=t[1];return r<n&&(e=n,n=r,r=e),[i.invert(n),i.invert(r)]}},Ol=function(f){return function(t){var e,n,r,i,a=f.range(),o=t[0],u=t[1],s=-1;for(u<o&&(n=o,o=u,u=n),r=0,i=a.length;r<i;++r)a[r]>=o&&a[r]<=u&&(s<0&&(s=r),e=r);if(!(s<0))return o=f.invertExtent(a[s]),u=f.invertExtent(a[e]),[void 0===o[0]?o[1]:o[0],void 0===u[1]?u[0]:u[1]]}},Nl=function(t,e,n){var r=t-e+2*n;return t?0<r?r:1:0},Rl=Array.prototype,Tl=Rl.map,Pl=Rl.slice,Ll={name:"implicit"};function ql(r){var a=Nt(),o=[],i=Ll;function u(t){var e=t+"",n=a.get(e);if(!n){if(i!==Ll)return i;a.set(e,n=o.push(t))}return r[(n-1)%r.length]}return r=null==r?[]:Pl.call(r),u.domain=function(t){if(!arguments.length)return o.slice();o=[],a=Nt();for(var e,n,r=-1,i=t.length;++r<i;)a.has(n=(e=t[r])+"")||a.set(n,o.push(e));return u},u.range=function(t){return arguments.length?(r=Pl.call(t),u):r.slice()},u.unknown=function(t){return arguments.length?(i=t,u):i},u.copy=function(){return ql().domain(o).range(r).unknown(i)},u}var Ul=function(t,e,n){t.prototype=e.prototype=n,n.constructor=t};function Fl(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function jl(){}var Il=1/.7,$l="\\\\s*([+-]?\\\\d+)\\\\s*",Bl="\\\\s*([+-]?\\\\d*\\\\.?\\\\d+(?:[eE][+-]?\\\\d+)?)\\\\s*",Wl="\\\\s*([+-]?\\\\d*\\\\.?\\\\d+(?:[eE][+-]?\\\\d+)?)%\\\\s*",Yl=/^#([0-9a-f]{3})$/,Hl=/^#([0-9a-f]{6})$/,Gl=new RegExp("^rgb\\\\("+[$l,$l,$l]+"\\\\)$"),Vl=new RegExp("^rgb\\\\("+[Wl,Wl,Wl]+"\\\\)$"),Xl=new RegExp("^rgba\\\\("+[$l,$l,$l,Bl]+"\\\\)$"),Jl=new RegExp("^rgba\\\\("+[Wl,Wl,Wl,Bl]+"\\\\)$"),Zl=new RegExp("^hsl\\\\("+[Bl,Wl,Wl]+"\\\\)$"),Ql=new RegExp("^hsla\\\\("+[Bl,Wl,Wl,Bl]+"\\\\)$"),Kl={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function th(t){var e;return t=(t+"").trim().toLowerCase(),(e=Yl.exec(t))?new ah((e=parseInt(e[1],16))>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):(e=Hl.exec(t))?eh(parseInt(e[1],16)):(e=Gl.exec(t))?new ah(e[1],e[2],e[3],1):(e=Vl.exec(t))?new ah(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Xl.exec(t))?nh(e[1],e[2],e[3],e[4]):(e=Jl.exec(t))?nh(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Zl.exec(t))?oh(e[1],e[2]/100,e[3]/100,1):(e=Ql.exec(t))?oh(e[1],e[2]/100,e[3]/100,e[4]):Kl.hasOwnProperty(t)?eh(Kl[t]):"transparent"===t?new ah(NaN,NaN,NaN,0):null}function eh(t){return new ah(t>>16&255,t>>8&255,255&t,1)}function nh(t,e,n,r){return r<=0&&(t=e=n=NaN),new ah(t,e,n,r)}function rh(t){return t instanceof jl||(t=th(t)),t?new ah((t=t.rgb()).r,t.g,t.b,t.opacity):new ah}function ih(t,e,n,r){return 1===arguments.length?rh(t):new ah(t,e,n,null==r?1:r)}function ah(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function oh(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||1<=n?t=e=NaN:e<=0&&(t=NaN),new sh(t,e,n,r)}function uh(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof sh)return new sh(t.h,t.s,t.l,t.opacity);if(t instanceof jl||(t=th(t)),!t)return new sh;if(t instanceof sh)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),a=Math.max(e,n,r),o=NaN,u=a-i,s=(a+i)/2;return u?(o=e===a?(n-r)/u+6*(n<r):n===a?(r-e)/u+2:(e-n)/u+4,u/=s<.5?a+i:2-a-i,o*=60):u=0<s&&s<1?0:o,new sh(o,u,s,t.opacity)}(t):new sh(t,e,n,null==r?1:r)}function sh(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function fh(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}Ul(jl,th,{displayable:function(){return this.rgb().displayable()},toString:function(){return this.rgb()+""}}),Ul(ah,ih,Fl(jl,{brighter:function(t){return t=null==t?Il:Math.pow(Il,t),new ah(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new ah(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},toString:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}})),Ul(sh,uh,Fl(jl,{brighter:function(t){return t=null==t?Il:Math.pow(Il,t),new sh(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new sh(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new ah(fh(240<=t?t-240:t+120,i,r),fh(t,i,r),fh(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1}}));var ch=Math.PI/180,lh=180/Math.PI,hh=.95047,dh=1,ph=1.08883,vh=4/29,gh=6/29,mh=3*gh*gh,yh=gh*gh*gh;function bh(t){if(t instanceof xh)return new xh(t.l,t.a,t.b,t.opacity);if(t instanceof Ah){var e=t.h*ch;return new xh(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}t instanceof ah||(t=rh(t));var n=Eh(t.r),r=Eh(t.g),i=Eh(t.b),a=wh((.4124564*n+.3575761*r+.1804375*i)/hh),o=wh((.2126729*n+.7151522*r+.072175*i)/dh);return new xh(116*o-16,500*(a-o),200*(o-wh((.0193339*n+.119192*r+.9503041*i)/ph)),t.opacity)}function _h(t,e,n,r){return 1===arguments.length?bh(t):new xh(t,e,n,null==r?1:r)}function xh(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}function wh(t){return yh<t?Math.pow(t,1/3):t/mh+vh}function Mh(t){return gh<t?t*t*t:mh*(t-vh)}function kh(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Eh(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Sh(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof Ah)return new Ah(t.h,t.c,t.l,t.opacity);t instanceof xh||(t=bh(t));var e=Math.atan2(t.b,t.a)*lh;return new Ah(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}(t):new Ah(t,e,n,null==r?1:r)}function Ah(t,e,n,r){this.h=+t,this.c=+e,this.l=+n,this.opacity=+r}Ul(xh,_h,Fl(jl,{brighter:function(t){return new xh(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new xh(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return t=dh*Mh(t),new ah(kh(3.2404542*(e=hh*Mh(e))-1.5371385*t-.4985314*(n=ph*Mh(n))),kh(-.969266*e+1.8760108*t+.041556*n),kh(.0556434*e-.2040259*t+1.0572252*n),this.opacity)}})),Ul(Ah,Sh,Fl(jl,{brighter:function(t){return new Ah(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new Ah(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return bh(this).rgb()}}));var Ch=1.78277,zh=-.29227,Dh=-.90649,Oh=1.97294,Nh=Oh*Dh,Rh=Oh*Ch,Th=Ch*zh- -.14861*Dh;function Ph(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof Lh)return new Lh(t.h,t.s,t.l,t.opacity);t instanceof ah||(t=rh(t));var e=t.r/255,n=t.g/255,r=t.b/255,i=(Th*r+Nh*e-Rh*n)/(Th+Nh-Rh),a=r-i,o=(Oh*(n-i)-zh*a)/Dh,u=Math.sqrt(o*o+a*a)/(Oh*i*(1-i)),s=u?Math.atan2(o,a)*lh-120:NaN;return new Lh(s<0?s+360:s,u,i,t.opacity)}(t):new Lh(t,e,n,null==r?1:r)}function Lh(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function qh(t,e,n,r,i){var a=t*t,o=a*t;return((1-3*t+3*a-o)*e+(4-6*a+3*o)*n+(1+3*t+3*a-3*o)*r+o*i)/6}Ul(Lh,Ph,Fl(jl,{brighter:function(t){return t=null==t?Il:Math.pow(Il,t),new Lh(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Lh(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*ch,e=+this.l,n=isNaN(this.s)?0:this.s*e*(1-e),r=Math.cos(t),i=Math.sin(t);return new ah(255*(e+n*(-.14861*r+Ch*i)),255*(e+n*(zh*r+Dh*i)),255*(e+n*(Oh*r)),this.opacity)}}));var Uh=function(o){var u=o.length-1;return function(t){var e=t<=0?t=0:1<=t?u-(t=1):Math.floor(t*u),n=o[e],r=o[e+1],i=0<e?o[e-1]:2*n-r,a=e<u-1?o[e+2]:2*r-n;return qh((t-e/u)*u,i,n,r,a)}},Fh=function(o){var u=o.length;return function(t){var e=Math.floor(((t%=1)<0?++t:t)*u),n=o[(e+u-1)%u],r=o[e%u],i=o[(e+1)%u],a=o[(e+2)%u];return qh((t-e/u)*u,n,r,i,a)}},jh=function(t){return function(){return t}};function Ih(e,n){return function(t){return e+t*n}}function $h(t,e){var n=e-t;return n?Ih(t,180<n||n<-180?n-360*Math.round(n/360):n):jh(isNaN(t)?e:t)}function Bh(a){return 1==(a=+a)?Wh:function(t,e){return e-t?(n=t,r=e,i=a,n=Math.pow(n,i),r=Math.pow(r,i)-n,i=1/i,function(t){return Math.pow(n+t*r,i)}):jh(isNaN(t)?e:t);var n,r,i}}function Wh(t,e){var n=e-t;return n?Ih(t,n):jh(isNaN(t)?e:t)}var Yh=function t(e){var o=Bh(e);function n(e,t){var n=o((e=ih(e)).r,(t=ih(t)).r),r=o(e.g,t.g),i=o(e.b,t.b),a=Wh(e.opacity,t.opacity);return function(t){return e.r=n(t),e.g=r(t),e.b=i(t),e.opacity=a(t),e+""}}return n.gamma=t,n}(1);function Hh(u){return function(t){var e,n,r=t.length,i=new Array(r),a=new Array(r),o=new Array(r);for(e=0;e<r;++e)n=ih(t[e]),i[e]=n.r||0,a[e]=n.g||0,o[e]=n.b||0;return i=u(i),a=u(a),o=u(o),n.opacity=1,function(t){return n.r=i(t),n.g=a(t),n.b=o(t),n+""}}}var Gh=Hh(Uh),Vh=Hh(Fh),Xh=function(t,e){var n,r=e?e.length:0,i=t?Math.min(r,t.length):0,a=new Array(i),o=new Array(r);for(n=0;n<i;++n)a[n]=od(t[n],e[n]);for(;n<r;++n)o[n]=e[n];return function(t){for(n=0;n<i;++n)o[n]=a[n](t);return o}},Jh=function(e,n){var r=new Date;return n-=e=+e,function(t){return r.setTime(e+n*t),r}},Zh=function(e,n){return n-=e=+e,function(t){return e+n*t}},Qh=function(t,e){var n,r={},i={};for(n in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)n in t?r[n]=od(t[n],e[n]):i[n]=e[n];return function(t){for(n in r)i[n]=r[n](t);return i}},Kh=/[-+]?(?:\\d+\\.?\\d*|\\.?\\d+)(?:[eE][-+]?\\d+)?/g,td=new RegExp(Kh.source,"g");var ed,nd,rd,id,ad=function(t,r){var e,n,i,a,o,u=Kh.lastIndex=td.lastIndex=0,s=-1,f=[],c=[];for(t+="",r+="";(e=Kh.exec(t))&&(n=td.exec(r));)(i=n.index)>u&&(i=r.slice(u,i),f[s]?f[s]+=i:f[++s]=i),(e=e[0])===(n=n[0])?f[s]?f[s]+=n:f[++s]=n:(f[++s]=null,c.push({i:s,x:Zh(e,n)})),u=td.lastIndex;return u<r.length&&(i=r.slice(u),f[s]?f[s]+=i:f[++s]=i),f.length<2?c[0]?(o=c[0].x,function(t){return o(t)+""}):(a=r,function(){return a}):(r=c.length,function(t){for(var e,n=0;n<r;++n)f[(e=c[n]).i]=e.x(t);return f.join("")})},od=function(t,e){var n,r=typeof e;return null==e||"boolean"===r?jh(e):("number"===r?Zh:"string"===r?(n=th(e))?(e=n,Yh):ad:e instanceof th?Yh:e instanceof Date?Jh:Array.isArray(e)?Xh:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?Qh:Zh)(t,e)},ud=function(e,n){return n-=e=+e,function(t){return Math.round(e+n*t)}},sd=180/Math.PI,fd={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1},cd=function(t,e,n,r,i,a){var o,u,s;return(o=Math.sqrt(t*t+e*e))&&(t/=o,e/=o),(s=t*n+e*r)&&(n-=t*s,r-=e*s),(u=Math.sqrt(n*n+r*r))&&(n/=u,r/=u,s/=u),t*r<e*n&&(t=-t,e=-e,s=-s,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(e,t)*sd,skewX:Math.atan(s)*sd,scaleX:o,scaleY:u}};function ld(h,d,p,v){function g(t){return t.length?t.pop()+" ":""}return function(t,e){var n,r,i,a,o,u,s,f,c=[],l=[];return t=h(t),e=h(e),function(t,e,n,r,i,a){if(t!==n||e!==r){var o=i.push("translate(",null,d,null,p);a.push({i:o-4,x:Zh(t,n)},{i:o-2,x:Zh(e,r)})}else(n||r)&&i.push("translate("+n+d+r+p)}(t.translateX,t.translateY,e.translateX,e.translateY,c,l),n=t.rotate,r=e.rotate,i=c,a=l,n!==r?(180<n-r?r+=360:180<r-n&&(n+=360),a.push({i:i.push(g(i)+"rotate(",null,v)-2,x:Zh(n,r)})):r&&i.push(g(i)+"rotate("+r+v),o=t.skewX,u=e.skewX,s=c,f=l,o!==u?f.push({i:s.push(g(s)+"skewX(",null,v)-2,x:Zh(o,u)}):u&&s.push(g(s)+"skewX("+u+v),function(t,e,n,r,i,a){if(t!==n||e!==r){var o=i.push(g(i)+"scale(",null,",",null,")");a.push({i:o-4,x:Zh(t,n)},{i:o-2,x:Zh(e,r)})}else 1===n&&1===r||i.push(g(i)+"scale("+n+","+r+")")}(t.scaleX,t.scaleY,e.scaleX,e.scaleY,c,l),t=e=null,function(t){for(var e,n=-1,r=l.length;++n<r;)c[(e=l[n]).i]=e.x(t);return c.join("")}}}var hd=ld(function(t){return"none"===t?fd:(ed||(ed=document.createElement("DIV"),nd=document.documentElement,rd=document.defaultView),ed.style.transform=t,t=rd.getComputedStyle(nd.appendChild(ed),null).getPropertyValue("transform"),nd.removeChild(ed),t=t.slice(7,-1).split(","),cd(+t[0],+t[1],+t[2],+t[3],+t[4],+t[5]))},"px, ","px)","deg)"),dd=ld(function(t){return null==t?fd:(id||(id=document.createElementNS("http://www.w3.org/2000/svg","g")),id.setAttribute("transform",t),(t=id.transform.baseVal.consolidate())?(t=t.matrix,cd(t.a,t.b,t.c,t.d,t.e,t.f)):fd)},", ",")",")"),pd=Math.SQRT2;function vd(t){return((t=Math.exp(t))+1/t)/2}function gd(o){return function(e,t){var n=o((e=uh(e)).h,(t=uh(t)).h),r=Wh(e.s,t.s),i=Wh(e.l,t.l),a=Wh(e.opacity,t.opacity);return function(t){return e.h=n(t),e.s=r(t),e.l=i(t),e.opacity=a(t),e+""}}}var md=gd($h),yd=gd(Wh);function bd(o){return function(e,t){var n=o((e=Sh(e)).h,(t=Sh(t)).h),r=Wh(e.c,t.c),i=Wh(e.l,t.l),a=Wh(e.opacity,t.opacity);return function(t){return e.h=n(t),e.c=r(t),e.l=i(t),e.opacity=a(t),e+""}}}var _d=bd($h),xd=bd(Wh);function wd(u){return function t(o){function e(e,t){var n=u((e=Ph(e)).h,(t=Ph(t)).h),r=Wh(e.s,t.s),i=Wh(e.l,t.l),a=Wh(e.opacity,t.opacity);return function(t){return e.h=n(t),e.s=r(t),e.l=i(Math.pow(t,o)),e.opacity=a(t),e+""}}return o=+o,e.gamma=t,e}(1)}var Md=wd($h),kd=wd(Wh),Ed=Object.freeze({interpolate:od,interpolateArray:Xh,interpolateBasis:Uh,interpolateBasisClosed:Fh,interpolateDate:Jh,interpolateNumber:Zh,interpolateObject:Qh,interpolateRound:ud,interpolateString:ad,interpolateTransformCss:hd,interpolateTransformSvg:dd,interpolateZoom:function(t,e){var n,o,u=t[0],s=t[1],f=t[2],r=e[0],i=e[1],a=e[2],c=r-u,l=i-s,h=c*c+l*l;if(h<1e-12)o=Math.log(a/f)/pd,n=function(t){return[u+t*c,s+t*l,f*Math.exp(pd*t*o)]};else{var d=Math.sqrt(h),p=(a*a-f*f+4*h)/(2*f*2*d),v=(a*a-f*f-4*h)/(2*a*2*d),g=Math.log(Math.sqrt(p*p+1)-p),m=Math.log(Math.sqrt(v*v+1)-v);o=(m-g)/pd,n=function(t){var e,n,r=t*o,i=vd(g),a=f/(2*d)*(i*(n=pd*r+g,((n=Math.exp(2*n))-1)/(n+1))-(e=g,((e=Math.exp(e))-1/e)/2));return[u+a*c,s+a*l,f*i/vd(pd*r+g)]}}return n.duration=1e3*o,n},interpolateRgb:Yh,interpolateRgbBasis:Gh,interpolateRgbBasisClosed:Vh,interpolateHsl:md,interpolateHslLong:yd,interpolateLab:function(e,t){var n=Wh((e=_h(e)).l,(t=_h(t)).l),r=Wh(e.a,t.a),i=Wh(e.b,t.b),a=Wh(e.opacity,t.opacity);return function(t){return e.l=n(t),e.a=r(t),e.b=i(t),e.opacity=a(t),e+""}},interpolateHcl:_d,interpolateHclLong:xd,interpolateCubehelix:Md,interpolateCubehelixLong:kd,quantize:function(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t(r/(e-1));return n}}),Sd=function(t){return function(){return t}},Ad=function(t){return+t},Cd=[0,1];function zd(e,n){return(n-=e=+e)?function(t){return(t-e)/n}:Sd(n)}function Dd(t,e,n,r){var i=t[0],a=t[1],o=e[0],u=e[1];return a<i?(i=n(a,i),o=r(u,o)):(i=n(i,a),o=r(o,u)),function(t){return o(i(t))}}function Od(n,t,e,r){var i=Math.min(n.length,t.length)-1,a=new Array(i),o=new Array(i),u=-1;for(n[i]<n[0]&&(n=n.slice().reverse(),t=t.slice().reverse());++u<i;)a[u]=e(n[u],n[u+1]),o[u]=r(t[u],t[u+1]);return function(t){var e=fi(n,t,1,i)-1;return o[e](a[e](t))}}function Nd(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp())}function Rd(e,n){var r,a,o,u=Cd,s=Cd,f=od,c=!1;function i(){return r=2<Math.min(u.length,s.length)?Od:Dd,a=o=null,t}function t(t){return(a||(a=r(u,s,c?(i=e,function(e,n){var r=i(e=+e,n=+n);return function(t){return t<=e?0:n<=t?1:r(t)}}):e,f)))(+t);var i}return t.invert=function(t){return(o||(o=r(s,u,zd,c?(i=n,function(e,n){var r=i(e=+e,n=+n);return function(t){return t<=0?e:1<=t?n:r(t)}}):n)))(+t);var i},t.domain=function(t){return arguments.length?(u=Tl.call(t,Ad),i()):u.slice()},t.range=function(t){return arguments.length?(s=Pl.call(t),i()):s.slice()},t.rangeRound=function(t){return s=Pl.call(t),f=ud,i()},t.clamp=function(t){return arguments.length?(c=!!t,i()):c},t.interpolate=function(t){return arguments.length?(f=t,i()):f},i()}var Td,Pd=function(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[1<r.length?r[0]+r.slice(2):r,+t.slice(n+1)]},Ld=function(t){return(t=Pd(Math.abs(t)))?t[1]:NaN},qd=function(t,e){var n=Pd(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")},Ud={"":function(t,e){t:for(var n,r=(t=t.toPrecision(e)).length,i=1,a=-1;i<r;++i)switch(t[i]){case".":a=n=i;break;case"0":0===a&&(a=i),n=i;break;case"e":break t;default:0<a&&(a=0)}return 0<a?t.slice(0,a)+t.slice(n+1):t},"%":function(t,e){return(100*t).toFixed(e)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.round(t).toString(10)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},g:function(t,e){return t.toPrecision(e)},o:function(t){return Math.round(t).toString(8)},p:function(t,e){return qd(100*t,e)},r:qd,s:function(t,e){var n=Pd(t,e);if(!n)return t+"";var r=n[0],i=n[1],a=i-(Td=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,o=r.length;return a===o?r:o<a?r+new Array(a-o+1).join("0"):0<a?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+Pd(t,Math.max(0,e+a-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}},Fd=/^(?:(.)?([<>=^]))?([+\\-\\( ])?([$#])?(0)?(\\d+)?(,)?(\\.\\d+)?([a-z%])?$/i;function jd(t){return new Id(t)}function Id(t){if(!(e=Fd.exec(t)))throw new Error("invalid format: "+t);var e,n=e[1]||" ",r=e[2]||">",i=e[3]||"-",a=e[4]||"",o=!!e[5],u=e[6]&&+e[6],s=!!e[7],f=e[8]&&+e[8].slice(1),c=e[9]||"";"n"===c?(s=!0,c="g"):Ud[c]||(c=""),(o||"0"===n&&"="===r)&&(o=!0,n="0",r="="),this.fill=n,this.align=r,this.sign=i,this.symbol=a,this.zero=o,this.width=u,this.comma=s,this.precision=f,this.type=c}jd.prototype=Id.prototype,Id.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+this.type};var $d,Bd,Wd,Yd=function(t){return t},Hd=["y","z","a","f","p","n","\xc2\xb5","m","","k","M","G","T","P","E","Z","Y"],Gd=function(t){var e,u,s,x=t.grouping&&t.thousands?(u=t.grouping,s=t.thousands,function(t,e){for(var n=t.length,r=[],i=0,a=u[0],o=0;0<n&&0<a&&(e<o+a+1&&(a=Math.max(1,e-o)),r.push(t.substring(n-=a,n+a)),!((o+=a+1)>e));)a=u[i=(i+1)%u.length];return r.reverse().join(s)}):Yd,r=t.currency,w=t.decimal,M=t.numerals?(e=t.numerals,function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}):Yd,i=t.percent||"%";function o(t){var f=(t=jd(t)).fill,c=t.align,l=t.sign,e=t.symbol,h=t.zero,d=t.width,p=t.comma,v=t.precision,g=t.type,m="$"===e?r[0]:"#"===e&&/[boxX]/.test(g)?"0"+g.toLowerCase():"",y="$"===e?r[1]:/[%p]/.test(g)?i:"",b=Ud[g],_=!g||/[defgprs%]/.test(g);function n(t){var e,n,r,i=m,a=y;if("c"===g)a=b(t)+a,t="";else{var o=(t=+t)<0;if(t=b(Math.abs(t),v),o&&0==+t&&(o=!1),i=(o?"("===l?l:"-":"-"===l||"("===l?"":l)+i,a=("s"===g?Hd[8+Td/3]:"")+a+(o&&"("===l?")":""),_)for(e=-1,n=t.length;++e<n;)if((r=t.charCodeAt(e))<48||57<r){a=(46===r?w+t.slice(e+1):t.slice(e))+a,t=t.slice(0,e);break}}p&&!h&&(t=x(t,1/0));var u=i.length+t.length+a.length,s=u<d?new Array(d-u+1).join(f):"";switch(p&&h&&(t=x(s+t,s.length?d-a.length:1/0),s=""),c){case"<":t=i+t+a+s;break;case"=":t=i+s+t+a;break;case"^":t=s.slice(0,u=s.length>>1)+i+t+a+s.slice(u);break;default:t=s+i+t+a}return M(t)}return v=null==v?g?6:12:/[gprs]/.test(g)?Math.max(1,Math.min(21,v)):Math.max(0,Math.min(20,v)),n.toString=function(){return t+""},n}return{format:o,formatPrefix:function(t,e){var n=o(((t=jd(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(Ld(e)/3))),i=Math.pow(10,-r),a=Hd[8+r/3];return function(t){return n(i*t)+a}}}};function Vd(t){return $d=Gd(t),Bd=$d.format,Wd=$d.formatPrefix,$d}Vd({decimal:".",thousands:",",grouping:[3],currency:["$",""]});var Xd=function(t,e,n){var r,i,a,o,u,s,f=t[0],c=t[t.length-1],l=_i(f,c,null==e?10:e);switch((n=jd(null==n?",f":n)).type){case"s":var h=Math.max(Math.abs(f),Math.abs(c));return null!=n.precision||isNaN((u=l,s=h,r=Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Ld(s)/3)))-Ld(Math.abs(u)))))||(n.precision=r),Wd(n,h);case"":case"e":case"g":case"p":case"r":null!=n.precision||isNaN((a=l,o=Math.max(Math.abs(f),Math.abs(c)),a=Math.abs(a),o=Math.abs(o)-a,r=Math.max(0,Ld(o)-Ld(a))+1))||(n.precision=r-("e"===n.type));break;case"f":case"%":null!=n.precision||isNaN((i=l,r=Math.max(0,-Ld(Math.abs(i)))))||(n.precision=r-2*("%"===n.type))}return Bd(n)};function Jd(u){var s=u.domain;return u.ticks=function(t){var e=s();return yi(e[0],e[e.length-1],null==t?10:t)},u.tickFormat=function(t,e){return Xd(s(),t,e)},u.nice=function(t){null==t&&(t=10);var e,n=s(),r=0,i=n.length-1,a=n[r],o=n[i];return o<a&&(e=a,a=o,o=e,e=r,r=i,i=e),0<(e=bi(a,o,t))?e=bi(a=Math.floor(a/e)*e,o=Math.ceil(o/e)*e,t):e<0&&(e=bi(a=Math.ceil(a*e)/e,o=Math.floor(o*e)/e,t)),0<e?(n[r]=Math.floor(a/e)*e,n[i]=Math.ceil(o/e)*e,s(n)):e<0&&(n[r]=Math.ceil(a*e)/e,n[i]=Math.floor(o*e)/e,s(n)),u},u}function Zd(){var t=Rd(zd,Zh);return t.copy=function(){return Nd(t,Zd())},Jd(t)}var Qd=function(t,e){var n,r=0,i=(t=t.slice()).length-1,a=t[r],o=t[i];return o<a&&(n=r,r=i,i=n,n=a,a=o,o=n),t[r]=e.floor(a),t[i]=e.ceil(o),t};function Kd(e,n){return(n=Math.log(n/e))?function(t){return Math.log(t/e)/n}:Sd(n)}function tp(e,n){return e<0?function(t){return-Math.pow(-n,t)*Math.pow(-e,1-t)}:function(t){return Math.pow(n,t)*Math.pow(e,1-t)}}function ep(t){return isFinite(t)?+("1e"+t):t<0?0:t}function np(e){return 10===e?ep:e===Math.E?Math.exp:function(t){return Math.pow(e,t)}}function rp(e){return e===Math.E?Math.log:10===e&&Math.log10||2===e&&Math.log2||(e=Math.log(e),function(t){return Math.log(t)/e})}function ip(e){return function(t){return-e(-t)}}function ap(t,e){return t<0?-Math.pow(-t,e):Math.pow(t,e)}function op(){var r=1,t=Rd(function(e,n){return(n=ap(n,r)-(e=ap(e,r)))?function(t){return(ap(t,r)-e)/n}:Sd(n)},function(e,n){return n=ap(n,r)-(e=ap(e,r)),function(t){return ap(e+n*t,1/r)}}),e=t.domain;return t.exponent=function(t){return arguments.length?(r=+t,e(e())):r},t.copy=function(){return Nd(t,op().exponent(r))},Jd(t)}var up=1e3,sp=60*up,fp=60*sp,cp=24*fp,lp=7*cp,hp=30*cp,dp=365*cp;function pp(t){return new Date(t)}function vp(t){return t instanceof Date?+t:+new Date(+t)}function gp(o,e,n,r,i,a,u,s,f){var c=Rd(zd,Zh),l=c.invert,h=c.domain,d=f(".%L"),p=f(":%S"),v=f("%I:%M"),g=f("%I %p"),m=f("%a %d"),y=f("%b %d"),b=f("%B"),_=f("%Y"),x=[[u,1,up],[u,5,5*up],[u,15,15*up],[u,30,30*up],[a,1,sp],[a,5,5*sp],[a,15,15*sp],[a,30,30*sp],[i,1,fp],[i,3,3*fp],[i,6,6*fp],[i,12,12*fp],[r,1,cp],[r,2,2*cp],[n,1,lp],[e,1,hp],[e,3,3*hp],[o,1,dp]];function w(t){return(u(t)<t?d:a(t)<t?p:i(t)<t?v:r(t)<t?g:e(t)<t?n(t)<t?m:y:o(t)<t?b:_)(t)}function M(t,e,n,r){if(null==t&&(t=10),"number"==typeof t){var i=Math.abs(n-e)/t,a=ui(function(t){return t[2]}).right(x,i);a===x.length?(r=_i(e/dp,n/dp,t),t=o):a?(r=(a=x[i/x[a-1][2]<x[a][2]/i?a-1:a])[1],t=a[0]):(r=Math.max(_i(e,n,t),1),t=s)}return null==r?t:t.every(r)}return c.invert=function(t){return new Date(l(t))},c.domain=function(t){return arguments.length?h(Tl.call(t,vp)):h().map(pp)},c.ticks=function(t,e){var n,r=h(),i=r[0],a=r[r.length-1],o=a<i;return o&&(n=i,i=a,a=n),n=(n=M(t,i,a,e))?n.range(i,a+1):[],o?n.reverse():n},c.tickFormat=function(t,e){return null==e?w:f(e)},c.nice=function(t,e){var n=h();return(t=M(t,n[0],n[n.length-1],e))?h(Qd(n,t)):c},c.copy=function(){return Nd(c,gp(o,e,n,r,i,a,u,s,f))},c}function mp(){var o,f,n=ql().unknown(void 0),c=n.domain,l=n.range,h=[0,1],u=!1,s=0,d=0,p=.5;function e(){var t=c().length,e=h[1]<h[0],n=h[e-0],r=h[1-e],i=Nl(t,s,d);o=(r-n)/(i||1),u&&(o=Math.floor(o)),n+=(r-n-o*(t-s))*p,f=o*(1-s),u&&(n=Math.round(n),f=Math.round(f));var a=pi(t).map(function(t){return n+o*t});return l(e?a.reverse():a)}return delete n.unknown,n.domain=function(t){return arguments.length?(c(t),e()):c()},n.range=function(t){return arguments.length?(h=[+t[0],+t[1]],e()):h.slice()},n.rangeRound=function(t){return h=[+t[0],+t[1]],u=!0,e()},n.bandwidth=function(){return f},n.step=function(){return o},n.round=function(t){return arguments.length?(u=!!t,e()):u},n.padding=function(t){return arguments.length?(d=Math.max(0,Math.min(1,t)),s=d,e()):s},n.paddingInner=function(t){return arguments.length?(s=Math.max(0,Math.min(1,t)),e()):s},n.paddingOuter=function(t){return arguments.length?(d=Math.max(0,Math.min(1,t)),e()):d},n.align=function(t){return arguments.length?(p=Math.max(0,Math.min(1,t)),e()):p},n.invertRange=function(t){if(null!=t[0]&&null!=t[1]){var e,n,r,i=+t[0],a=+t[1],o=h[1]<h[0],u=o?l().reverse():l(),s=u.length-1;if(i==i&&a==a&&(a<i&&(r=i,i=a,a=r),!(a<u[0]||i>h[1-o])))return e=Math.max(0,fi(u,i)-1),n=i===a?e:fi(u,a)-1,i-u[e]>f+1e-10&&++e,o&&(r=e,e=s-n,n=s-r),n<e?void 0:c().slice(e,n+1)}},n.invert=function(t){var e=n.invertRange([t,t]);return e?e[0]:e},n.copy=function(){return mp().domain(c()).range(h).round(u).paddingInner(s).paddingOuter(d).align(p)},e()}var yp=Array.prototype.map,bp=Array.prototype.slice;function _p(t){return yp.call(t,function(t){return+t})}function xp(t,e){return 1<arguments.length?(wp[t]=(n=t,r=e,function(){var t=r();return t.invertRange||(t.invertRange=t.invert?Dl(t):t.invertExtent?Ol(t):void 0),t.type=n,t}),this):wp.hasOwnProperty(t)?wp[t]:void 0;var n,r}var wp={identity:function t(){var e=[0,1];function n(t){return+t}return(n.invert=n).domain=n.range=function(t){return arguments.length?(e=Tl.call(t,Ad),n):e.slice()},n.copy=function(){return t().domain(e)},Jd(n)},linear:Zd,log:function t(){var e=Rd(Kd,tp).domain([1,10]),h=e.domain,d=10,p=rp(10),v=np(10);function n(){return p=rp(d),v=np(d),h()[0]<0&&(p=ip(p),v=ip(v)),e}return e.base=function(t){return arguments.length?(d=+t,n()):d},e.domain=function(t){return arguments.length?(h(t),n()):h()},e.ticks=function(t){var e,n=h(),r=n[0],i=n[n.length-1];(e=i<r)&&(s=r,r=i,i=s);var a,o,u,s=p(r),f=p(i),c=null==t?10:+t,l=[];if(!(d%1)&&f-s<c){if(s=Math.round(s)-1,f=Math.round(f)+1,0<r){for(;s<f;++s)for(o=1,a=v(s);o<d;++o)if(!((u=a*o)<r)){if(i<u)break;l.push(u)}}else for(;s<f;++s)for(o=d-1,a=v(s);1<=o;--o)if(!((u=a*o)<r)){if(i<u)break;l.push(u)}}else l=yi(s,f,Math.min(f-s,c)).map(v);return e?l.reverse():l},e.tickFormat=function(t,n){if(null==n&&(n=10===d?".0e":","),"function"!=typeof n&&(n=Bd(n)),t===1/0)return n;null==t&&(t=10);var r=Math.max(1,d*t/e.ticks().length);return function(t){var e=t/v(Math.round(p(t)));return e*d<d-.5&&(e*=d),e<=r?n(t):""}},e.nice=function(){return h(Qd(h(),{floor:function(t){return v(Math.floor(p(t)))},ceil:function(t){return v(Math.ceil(p(t)))}}))},e.copy=function(){return Nd(e,t().base(d))},e},ordinal:ql,pow:op,sqrt:function(){return op().exponent(.5)},quantile:function t(){var i=[],n=[],r=[];function a(){var t=0,e=Math.max(1,n.length);for(r=new Array(e-1);++t<e;)r[t-1]=wi(i,t/e);return o}function o(t){if(!isNaN(t=+t))return n[fi(r,t)]}return o.invertExtent=function(t){var e=n.indexOf(t);return e<0?[NaN,NaN]:[0<e?r[e-1]:i[0],e<r.length?r[e]:i[i.length-1]]},o.domain=function(t){if(!arguments.length)return i.slice();i=[];for(var e,n=0,r=t.length;n<r;++n)null==(e=t[n])||isNaN(e=+e)||i.push(e);return i.sort(oi),a()},o.range=function(t){return arguments.length?(n=Pl.call(t),a()):n.slice()},o.quantiles=function(){return r.slice()},o.copy=function(){return t().domain(i).range(n)},o},quantize:function t(){var n=0,r=1,i=1,a=[.5],o=[0,1];function e(t){if(t<=t)return o[fi(a,t,0,i)]}function u(){var t=-1;for(a=new Array(i);++t<i;)a[t]=((t+1)*r-(t-i)*n)/(i+1);return e}return e.domain=function(t){return arguments.length?(n=+t[0],r=+t[1],u()):[n,r]},e.range=function(t){return arguments.length?(i=(o=Pl.call(t)).length-1,u()):o.slice()},e.invertExtent=function(t){var e=o.indexOf(t);return e<0?[NaN,NaN]:e<1?[n,a[0]]:i<=e?[a[i-1],r]:[a[e-1],a[e]]},e.copy=function(){return t().domain([n,r]).range(o)},Jd(e)},threshold:function t(){var n=[.5],r=[0,1],e=1;function i(t){if(t<=t)return r[fi(n,t,0,e)]}return i.domain=function(t){return arguments.length?(n=Pl.call(t),e=Math.min(n.length,r.length-1),i):n.slice()},i.range=function(t){return arguments.length?(r=Pl.call(t),e=Math.min(n.length,r.length-1),i):r.slice()},i.invertExtent=function(t){var e=r.indexOf(t);return[n[e-1],n[e]]},i.copy=function(){return t().domain(n).range(r)},i},time:function(){return gp(He,Ye,$e,je,Fe,Ue,qe,Re,un).domain([new Date(2e3,0,1),new Date(2e3,0,2)])},utc:function(){return gp(en,tn,Ze,Xe,Ve,Ge,qe,Re,fn).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)])},band:mp,point:function(){return function t(e){var n=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,e.copy=function(){return t(n())},e}(mp().paddingInner(1))},sequential:function t(n){var r=Zd(),i=0,a=1,o=!1;function e(){var t=r.domain();i=t[0],a=E(t)-i}function u(t){var e=(t-i)/a;return n(o?Math.max(0,Math.min(1,e)):e)}return u.clamp=function(t){return arguments.length?(o=!!t,u):o},u.domain=function(t){return arguments.length?(r.domain(t),e(),u):r.domain()},u.interpolator=function(t){return arguments.length?(n=t,u):n},u.copy=function(){return t().domain(r.domain()).clamp(o).interpolator(n)},u.ticks=function(t){return r.ticks(t)},u.tickFormat=function(t,e){return r.tickFormat(t,e)},u.nice=function(t){return r.nice(t),e(),u},u},"bin-linear":function t(){var e=Zd(),r=[];function i(t){return e(t)}return i.domain=function(t){return arguments.length?(r=_p(t),e.domain([r[0],E(r)]),i):r.slice()},i.range=function(t){return arguments.length?(e.range(t),i):e.range()},i.rangeRound=function(t){return arguments.length?(e.rangeRound(t),i):e.rangeRound()},i.interpolate=function(t){return arguments.length?(e.interpolate(t),i):e.interpolate()},i.invert=function(t){return e.invert(t)},i.ticks=function(t){var e=r.length,n=~~(e/(t||e));return n<2?i.domain():r.filter(function(t,e){return!(e%n)})},i.tickFormat=function(){return e.tickFormat.apply(e,arguments)},i.copy=function(){return t().domain(i.domain()).range(i.range())},i},"bin-ordinal":function t(){var e=[],n=[];function r(t){return null==t||t!=t?void 0:n[(fi(e,t)-1)%n.length]}return r.domain=function(t){return arguments.length?(e=_p(t),r):e.slice()},r.range=function(t){return arguments.length?(n=bp.call(t),r):n.slice()},r.copy=function(){return t().domain(r.domain()).range(r.range())},r}};for(var Mp in wp)xp(Mp,wp[Mp]);function kp(t){for(var e=t.length/6|0,n=new Array(e),r=0;r<e;)n[r]="#"+t.slice(6*r,6*++r);return n}var Ep=kp("1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5"),Sp=kp("393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6"),Ap=kp("3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9"),Cp=kp("4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac"),zp=kp("4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5"),Dp=new Array(3).concat("67a9cff7f7f7f1a340","0571b092c5defdb863e66101","0571b092c5def7f7f7fdb863e66101","2166ac67a9cfd1e5f0fee0b6f1a340b35806","2166ac67a9cfd1e5f0f7f7f7fee0b6f1a340b35806","2166ac4393c392c5ded1e5f0fee0b6fdb863e08214b35806","2166ac4393c392c5ded1e5f0f7f7f7fee0b6fdb863e08214b35806","0530612166ac4393c392c5ded1e5f0fee0b6fdb863e08214b358067f3b08","0530612166ac4393c392c5ded1e5f0f7f7f7fee0b6fdb863e08214b358067f3b08").map(kp),Op=function(t){for(var e=t.length/6|0,n=new Array(e),r=0;r<e;)n[r]="#"+t.slice(6*r,6*++r);return n},Np=Op("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),Rp=Op("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"),Tp=Op("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"),Pp=Op("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),Lp=Op("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"),qp=Op("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"),Up=Op("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"),Fp=Op("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"),jp=Op("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"),Ip=function(t){return Gh(t[t.length-1])},$p=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(Op),Bp=Ip($p),Wp=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(Op),Yp=Ip(Wp),Hp=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(Op),Gp=Ip(Hp),Vp=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(Op),Xp=Ip(Vp),Jp=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(Op),Zp=Ip(Jp),Qp=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(Op),Kp=Ip(Qp),tv=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(Op),ev=Ip(tv),nv=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(Op),rv=Ip(nv),iv=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(Op),av=Ip(iv),ov=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(Op),uv=Ip(ov),sv=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(Op),fv=Ip(sv),cv=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(Op),lv=Ip(cv),hv=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(Op),dv=Ip(hv),pv=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(Op),vv=Ip(pv),gv=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(Op),mv=Ip(gv),yv=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(Op),bv=Ip(yv),_v=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(Op),xv=Ip(_v),wv=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(Op),Mv=Ip(wv),kv=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(Op),Ev=Ip(kv),Sv=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(Op),Av=Ip(Sv),Cv=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(Op),zv=Ip(Cv),Dv=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(Op),Ov=Ip(Dv),Nv=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(Op),Rv=Ip(Nv),Tv=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(Op),Pv=Ip(Tv),Lv=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(Op),qv=Ip(Lv),Uv=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(Op),Fv=Ip(Uv),jv=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(Op),Iv=Ip(jv),$v=kd(Ph(300,.5,0),Ph(-240,.5,1)),Bv=kd(Ph(-100,.75,.35),Ph(80,1.5,.8)),Wv=kd(Ph(260,.75,.35),Ph(80,1.5,.8)),Yv=Ph();function Hv(e){var n=e.length;return function(t){return e[Math.max(0,Math.min(n-1,Math.floor(t*n)))]}}var Gv=Hv(Op("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),Vv=Hv(Op("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),Xv=Hv(Op("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),Jv=Hv(Op("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921")),Zv=Object.freeze({schemeCategory10:Np,schemeAccent:Rp,schemeDark2:Tp,schemePaired:Pp,schemePastel1:Lp,schemePastel2:qp,schemeSet1:Up,schemeSet2:Fp,schemeSet3:jp,interpolateBrBG:Bp,schemeBrBG:$p,interpolatePRGn:Yp,schemePRGn:Wp,interpolatePiYG:Gp,schemePiYG:Hp,interpolatePuOr:Xp,schemePuOr:Vp,interpolateRdBu:Zp,schemeRdBu:Jp,interpolateRdGy:Kp,schemeRdGy:Qp,interpolateRdYlBu:ev,schemeRdYlBu:tv,interpolateRdYlGn:rv,schemeRdYlGn:nv,interpolateSpectral:av,schemeSpectral:iv,interpolateBuGn:uv,schemeBuGn:ov,interpolateBuPu:fv,schemeBuPu:sv,interpolateGnBu:lv,schemeGnBu:cv,interpolateOrRd:dv,schemeOrRd:hv,interpolatePuBuGn:vv,schemePuBuGn:pv,interpolatePuBu:mv,schemePuBu:gv,interpolatePuRd:bv,schemePuRd:yv,interpolateRdPu:xv,schemeRdPu:_v,interpolateYlGnBu:Mv,schemeYlGnBu:wv,interpolateYlGn:Ev,schemeYlGn:kv,interpolateYlOrBr:Av,schemeYlOrBr:Sv,interpolateYlOrRd:zv,schemeYlOrRd:Cv,interpolateBlues:Ov,schemeBlues:Dv,interpolateGreens:Rv,schemeGreens:Nv,interpolateGreys:Pv,schemeGreys:Tv,interpolatePurples:qv,schemePurples:Lv,interpolateReds:Fv,schemeReds:Uv,interpolateOranges:Iv,schemeOranges:jv,interpolateCubehelixDefault:$v,interpolateRainbow:function(t){(t<0||1<t)&&(t-=Math.floor(t));var e=Math.abs(t-.5);return Yv.h=360*t-100,Yv.s=1.5-1.5*e,Yv.l=.8-.9*e,Yv+""},interpolateWarm:Bv,interpolateCool:Wv,interpolateViridis:Gv,interpolateMagma:Vv,interpolateInferno:Xv,interpolatePlasma:Jv}),Qv={blueorange:Dp},Kv={category10:Np,accent:Rp,dark2:Tp,paired:Pp,pastel1:Lp,pastel2:qp,set1:Up,set2:Fp,set3:jp,category20:Ep,category20b:Sp,category20c:Ap,tableau10:Cp,tableau20:zp,viridis:Gv,magma:Vv,inferno:Xv,plasma:Jv,blueorange:Gh(E(Dp))};function tg(t,e){Kv[t]=Zv["interpolate"+e],Qv[t]=Zv["scheme"+e]}tg("blues","Blues"),tg("greens","Greens"),tg("greys","Greys"),tg("purples","Purples"),tg("reds","Reds"),tg("oranges","Oranges"),tg("brownbluegreen","BrBG"),tg("purplegreen","PRGn"),tg("pinkyellowgreen","PiYG"),tg("purpleorange","PuOr"),tg("redblue","RdBu"),tg("redgrey","RdGy"),tg("redyellowblue","RdYlBu"),tg("redyellowgreen","RdYlGn"),tg("spectral","Spectral"),tg("bluegreen","BuGn"),tg("bluepurple","BuPu"),tg("greenblue","GnBu"),tg("orangered","OrRd"),tg("purplebluegreen","PuBuGn"),tg("purpleblue","PuBu"),tg("purplered","PuRd"),tg("redpurple","RdPu"),tg("yellowgreenblue","YlGnBu"),tg("yellowgreen","YlGn"),tg("yelloworangebrown","YlOrBr"),tg("yelloworangered","YlOrRd");var eg=function(t,e){if(1<arguments.length)return Kv[t]=e,this;var n=t.split("-");return t=n[0],(n=+n[1]+1)&&Qv.hasOwnProperty(t)?Qv[t][n-1]:!n&&Kv.hasOwnProperty(t)?Kv[t]:void 0};function ng(e,t){var n=t[0],r=E(t)-n;return function(t){return e(n+t*r)}}function rg(t,e,n){var r=n-e;return r?"linear"===t.type||"sequential"===t.type?function(t){return(t-e)/r}:t.copy().domain([e,n]).range([0,1]).interpolate(ig):P(0)}function ig(e,t){var n=t-e;return function(t){return e+t*n}}function ag(t,e){var n,r=Ed[(n=t,"interpolate"+n.toLowerCase().split("-").map(function(t){return t[0].toUpperCase()+t.slice(1)}).join(""))];return null!=e&&r&&r.gamma?r.gamma(e):r}var og={millisecond:Re,second:qe,minute:Ue,hour:Fe,day:je,week:$e,month:Ye,year:He},ug={millisecond:Re,second:qe,minute:Ge,hour:Ve,day:Xe,week:Ze,month:tn,year:en};function sg(t){return og.hasOwnProperty(t)&&og[t]}function fg(t){return ug.hasOwnProperty(t)&&ug[t]}function cg(t,e){var n;return J(e)&&(n=e.step,e=e.interval),p(e)&&(e="time"===t.type?sg(e):"utc"===t.type?fg(e):rt("Only time and utc scales accept interval strings."),n&&(e=e.every(n))),e}function lg(e,t,n){var r=e.range(),i=r[0],a=E(r);if(a<i&&(r=a,a=i,i=r),t=t.filter(function(t){return!((t=e(t))<i||a<t)}),0<n&&1<t.length){for(var o=[t[0],E(t)];t.length>n&&3<=t.length;)t=t.filter(function(t,e){return!(e%2)});t.length<3&&(t=o)}return t}function hg(t,e){return t.ticks?t.ticks(e):t.domain()}function dg(t,e,n){var r,i,a=t.tickFormat?t.tickFormat(e,n):String;return t.type===yl?(r=a,i=function(t){var e=jd(t||",");{if(null==e.precision){switch(e.precision=12,e.type){case"%":e.precision-=2;break;case"e":e.precision-=1}return a=Bd(e),o=Bd(".1f")(1)[1],function(t){var e,n,r=a(t),i=r.indexOf(o);if(i<0)return r;for(e=function(t,e){var n,r=t.lastIndexOf("e");if(0<r)return r;for(r=t.length;--r>e;)if(48<=(n=t.charCodeAt(r))&&n<=57)return r+1}(r,i),n=e<r.length?r.slice(e):"";--e>i;)if("0"!==r[e]){++e;break}return r.slice(0,e)+n}}return Bd(e)}var a,o}(n),function(t){return r(t)?i(t):""}):a}function pg(t){Wr.call(this,null,t)}function vg(t){Wr.call(this,null,t)}function gg(){return ht({})}function mg(t){return t.exit}function yg(t){Wr.call(this,null,t)}j(pg,Wr).transform=function(t,e){if(this.value&&!t.modified())return e.StopPropagation;var n=e.fork(e.NO_SOURCE|e.NO_FIELDS),r=this.value,i=t.scale,a=null==t.count?t.values?t.values.length:10:cg(i,t.count),o=t.format||dg(i,a,t.formatSpecifier),u=t.values?lg(i,t.values,a):hg(i,a);return r&&(n.rem=r),r=u.map(function(t,e){return ht({index:e/(u.length-1),value:t,label:o(t)})}),t.extra&&r.push(ht({index:-1,extra:{value:r[0].value},label:""})),n.source=r,n.add=r,this.value=r,n},j(vg,Wr).transform=function(t,e){var n=e.dataflow,r=e.fork(e.NO_SOURCE|e.NO_FIELDS),i=t.item||gg,a=t.key||ct,o=this.value;return d(r.encode)&&(r.encode=null),o&&(t.modified("key")||e.modified(a))&&rt("DataJoin does not support modified key function or fields."),o||(e=e.addAll(),this.value=o=F().test(mg),o.lookup=function(t){return o.get(a(t))}),e.visit(e.ADD,function(t){var e=a(t),n=o.get(e);n?n.exit?(o.empty--,r.add.push(n)):r.mod.push(n):(o.set(e,n=i(t)),r.add.push(n)),n.datum=t,n.exit=!1}),e.visit(e.MOD,function(t){var e=a(t),n=o.get(e);n&&(n.datum=t,r.mod.push(n))}),e.visit(e.REM,function(t){var e=a(t),n=o.get(e);t!==n.datum||n.exit||(r.rem.push(n),n.exit=!0,++o.empty)}),e.changed(e.ADD_MOD)&&r.modifies("datum"),t.clean&&o.empty>n.cleanThreshold&&n.runAfter(o.clean),r},j(yg,Wr).transform=function(n,t){var r=t.fork(t.ADD_REM),e=n.encoders,i=t.encode;if(d(i)){if(!r.changed()&&!i.every(function(t){return e[t]}))return t.StopPropagation;i=i[0]}var a="enter"===i,o=e.update||h,u=e.enter||h,s=e.exit||h,f=(i&&!a?e[i]:o)||h;if(t.changed(t.ADD)&&(t.visit(t.ADD,function(t){u(t,n),o(t,n),f!==h&&f!==o&&f(t,n)}),r.modifies(u.output),r.modifies(o.output),f!==h&&f!==o&&r.modifies(f.output)),t.changed(t.REM)&&s!==h&&(t.visit(t.REM,function(t){s(t,n)}),r.modifies(s.output)),a||f!==h){var c=t.MOD|(n.modified()?t.REFLOW:0);a?(t.visit(c,function(t){var e=u(t,n);(f(t,n)||e)&&r.mod.push(t)}),r.mod.length&&r.modifies(u.output)):t.visit(c,function(t){f(t,n)&&r.mod.push(t)}),r.mod.length&&r.modifies(f.output)}return r.changed()?r:t.StopPropagation};var bg={};function _g(t){var e=t.domain();return e.max=e.pop(),e}function xg(t,e){return bg[t.type]?(o=e,function(t,e,n){var r=n[e+1]||n.max||1/0,i=wg(t,o),a=wg(r,o);return i&&a?i+"\xe2\x80\x93"+a:a?"< "+a:"\xe2\x89\xa5 "+i}):(n=e,function(t){return n(t)});var n,o}function wg(t,e){return isFinite(t)?e(t):null}function Mg(t){Wr.call(this,[],t)}bg[El]=function(t){var e=[-1/0].concat(t.quantiles());return e.max=1/0,e},bg[Sl]=function(t){var e=t.domain(),n=e[0],r=E(e),i=t.range().length,a=new Array(i),o=0;a[0]=-1/0;for(;++o<i;)a[o]=(o*r-(o-i)*n)/i;return a.max=1/0,a},bg[Al]=function(t){var e=[-1/0].concat(t.domain());return e.max=1/0,e},bg["bin-linear"]=_g,bg[Cl]=_g,j(Mg,Wr).transform=function(r,t){if(null!=this.value&&!r.modified())return t.StopPropagation;var e=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=0,n=this.value,a="gradient"===r.type,o=r.scale,u=null==r.count?5:cg(o,r.count),s=r.format||dg(o,u,r.formatSpecifier),f=r.values||function(t,e,n){if(n)return t.domain();var r=bg[t.type];return r?r(t):hg(t,e)}(o,u,a);if(s=xg(o,s),n&&(e.rem=n),a)var c=r.values?o.domain():f,l=rg(o,c[0],E(c));else{var h,d=r.size;R(d)?(r.values||0!==o(f[0])||(f=f.slice(1)),h=f.reduce(function(t,e){return Math.max(t,d(e,r))},0)):d=P(h=d||8)}return n=f.map(function(t,e){var n=ht({index:e,label:s(t,e,f),value:t});return a?n.perc=l(t):(n.offset=h,n.size=d(t,r),n.total=Math.round(i),i+=n.size),n}),e.source=n,e.add=n,this.value=n,e};var kg=F({line:Dg,"line-radial":function(t,e,n,r){return Dg(e*Math.cos(t),e*Math.sin(t),r*Math.cos(n),r*Math.sin(n))},arc:Og,"arc-radial":function(t,e,n,r){return Og(e*Math.cos(t),e*Math.sin(t),r*Math.cos(n),r*Math.sin(n))},curve:Ng,"curve-radial":function(t,e,n,r){return Ng(e*Math.cos(t),e*Math.sin(t),r*Math.cos(n),r*Math.sin(n))},"orthogonal-horizontal":function(t,e,n,r){return"M"+t+","+e+"V"+r+"H"+n},"orthogonal-vertical":function(t,e,n,r){return"M"+t+","+e+"H"+n+"V"+r},"orthogonal-radial":function(t,e,n,r){var i=Math.cos(t),a=Math.sin(t),o=Math.cos(n),u=Math.sin(n),s=Math.abs(n-t)>Math.PI?n<=t:t<n;return"M"+e*i+","+e*a+"A"+e+","+e+" 0 0,"+(s?1:0)+" "+e*o+","+e*u+"L"+r*o+","+r*u},"diagonal-horizontal":function(t,e,n,r){var i=(t+n)/2;return"M"+t+","+e+"C"+i+","+e+" "+i+","+r+" "+n+","+r},"diagonal-vertical":function(t,e,n,r){var i=(e+r)/2;return"M"+t+","+e+"C"+t+","+i+" "+n+","+i+" "+n+","+r},"diagonal-radial":function(t,e,n,r){var i=Math.cos(t),a=Math.sin(t),o=Math.cos(n),u=Math.sin(n),s=(e+r)/2;return"M"+e*i+","+e*a+"C"+s*i+","+s*a+" "+s*o+","+s*u+" "+r*o+","+r*u}});function Eg(t){return t.source.x}function Sg(t){return t.source.y}function Ag(t){return t.target.x}function Cg(t){return t.target.y}function zg(t){Wr.call(this,{},t)}function Dg(t,e,n,r){return"M"+t+","+e+"L"+n+","+r}function Og(t,e,n,r){var i=n-t,a=r-e,o=Math.sqrt(i*i+a*a)/2;return"M"+t+","+e+"A"+o+","+o+" "+180*Math.atan2(a,i)/Math.PI+" 0 1 "+n+","+r}function Ng(t,e,n,r){var i=n-t,a=r-e,o=.2*(i+a),u=.2*(a-i);return"M"+t+","+e+"C"+(t+o)+","+(e+u)+" "+(n+u)+","+(r-o)+" "+n+","+r}function Rg(t){Wr.call(this,null,t)}zg.Definition={type:"LinkPath",metadata:{modifies:!0},params:[{name:"sourceX",type:"field",default:"source.x"},{name:"sourceY",type:"field",default:"source.y"},{name:"targetX",type:"field",default:"target.x"},{name:"targetY",type:"field",default:"target.y"},{name:"orient",type:"enum",default:"vertical",values:["horizontal","vertical","radial"]},{name:"shape",type:"enum",default:"line",values:["line","arc","curve","diagonal","orthogonal"]},{name:"as",type:"string",default:"path"}]},j(zg,Wr).transform=function(t,e){var n=t.sourceX||Eg,r=t.sourceY||Sg,i=t.targetX||Ag,a=t.targetY||Cg,o=t.as||"path",u=t.orient||"vertical",s=t.shape||"line",f=kg.get(s+"-"+u)||kg.get(s);return f||rt("LinkPath unsupported type: "+t.shape+(t.orient?"-"+t.orient:"")),e.visit(e.SOURCE,function(t){t[o]=f(n(t),r(t),i(t),a(t))}),e.reflow(t.modified()).modifies(o)},Rg.Definition={type:"Pie",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"startAngle",type:"number",default:0},{name:"endAngle",type:"number",default:6.283185307179586},{name:"sort",type:"boolean",default:!1},{name:"as",type:"string",array:!0,length:2,default:["startAngle","endAngle"]}]},j(Rg,Wr).transform=function(t,e){var n,r,i,a=t.as||["startAngle","endAngle"],o=a[0],u=a[1],s=t.field||b,f=t.startAngle||0,c=null!=t.endAngle?t.endAngle:2*Math.PI,l=e.source,h=l.map(s),d=h.length,p=f,v=(c-f)/function(t,e){var n,r=t.length,i=-1,a=0;if(null==e)for(;++i<r;)(n=+t[i])&&(a+=n);else for(;++i<r;)(n=+e(t[i],i,t))&&(a+=n);return a}(h),g=pi(d);for(t.sort&&g.sort(function(t,e){return h[t]-h[e]}),n=0;n<d;++n)i=h[g[n]],(r=l[g[n]])[o]=p,r[u]=p+=i*v;return this.value=h,e.reflow(t.modified()).modifies(a)};var Tg=5,Pg=nt([Ml,bl,_l]),Lg=nt([Ml,yl,bl,_l,"time","utc"]),qg=nt(["set","modified","clear","type","scheme","schemeExtent","schemeCount","domain","domainMin","domainMid","domainMax","domainRaw","nice","zero","range","rangeStep","round","reverse","interpolate","interpolateGamma"]);function Ug(t){Wr.call(this,null,t),this.modified(!0)}function Fg(t,e,n){return R(t)&&(e||n)?ng(t,jg(e||[0,1],n)):t}function jg(t,e){return e?t.slice().reverse():t}function Ig(t){Wr.call(this,null,t)}j(Ug,Wr).transform=function(t,e){var n,r=e.dataflow,i=this.value;for(n in i&&!t.modified("type")||(this.value=i=xp((t.type||Ml).toLowerCase())()),t)if(!qg[n]){if("padding"===n&&Lg[i.type])continue;R(i[n])?i[n](t[n]):r.warn("Unsupported scale property: "+n)}return function(t,e,n){var r=e.round||!1,i=e.range;if(null!=e.rangeStep)i=function(t,e,n){t!==xl&&t!==wl&&rt("Only band and point scales support rangeStep.");var r=(null!=e.paddingOuter?e.paddingOuter:e.padding)||0,i=t===wl?1:(null!=e.paddingInner?e.paddingInner:e.padding)||0;return[0,e.rangeStep*Nl(n,i,r)]}(t.type,e,n);else if(e.scheme){if(i=function(t,e,n){var r,i=e.scheme.toLowerCase(),a=eg(i),o=e.schemeExtent;a||rt("Unrecognized scheme name: "+e.scheme);return n=t===Al?n+1:t===Cl?n-1:t===El||t===Sl?+e.schemeCount||Tg:n,t===zl?Fg(a,o,e.reverse):!o&&(r=eg(i+"-"+n))?r:R(a)?function(t,e){for(var n=new Array(e),r=e-1||1,i=0;i<e;++i)n[i]=t(i/r);return n}(Fg(a,o),n):t===kl?a:a.slice(0,n)}(t.type,e,n),R(i))return t.interpolator(i)}else if(i&&t.type===zl)return t.interpolator(Gh(jg(i,e.reverse)));i&&e.interpolate&&t.interpolate?t.interpolate(ag(e.interpolate,e.interpolateGamma)):R(t.round)?t.round(r):R(t.rangeRound)&&t.interpolate(r?ud:od);i&&t.range(jg(i,e.reverse))}(i,t,function(t,e,n){var r=(i=t,a=e.domainRaw,a?(i.domain(a),a.length):-1);var i,a;if(-1<r)return r;var o,u,s=e.domain,f=t.type,c=e.zero||void 0===e.zero&&Pg[f];if(!s)return 0;Lg[f]&&e.padding&&s[0]!==E(s)&&(l=f,h=s,d=e.range,p=e.padding,v=e.exponent,g=Math.abs(E(d)-d[0]),m=g/(g-2*p),y=l===yl?O(h,null,m):l===_l?N(h,null,m,.5):l===bl?N(h,null,m,v):D(h,null,m),(h=h.slice())[0]=y[0],h[h.length-1]=y[1],s=h);var l,h,d,p,v,g,m,y;(c||null!=e.domainMin||null!=e.domainMax||null!=e.domainMid)&&(o=(s=s.slice()).length-1||1,c&&(0<s[0]&&(s[0]=0),s[o]<0&&(s[o]=0)),null!=e.domainMin&&(s[0]=e.domainMin),null!=e.domainMax&&(s[o]=e.domainMax),null!=e.domainMid&&(((u=e.domainMid)<s[0]||u>s[o])&&n.warn("Scale domainMid exceeds domain min or max.",u),s.splice(o,0,u)));t.domain(s),f===kl&&t.unknown(void 0);e.nice&&t.nice&&t.nice(!0!==e.nice&&cg(t,e.nice)||null);return s.length}(i,t,r)),e.fork(e.NO_SOURCE|e.NO_FIELDS)},j(Ig,Wr).transform=function(t,e){var n=t.modified("sort")||e.changed(e.ADD)||e.modified(t.sort.fields)||e.modified("datum");return n&&e.source.sort(t.sort),this.modified(n),e};function $g(t){Wr.call(this,null,t)}function Bg(t,e,n,r,i){for(var a,o=(e-t.sum)/2,u=t.length,s=0;s<u;++s)(a=t[s])[r]=o,a[i]=o+=Math.abs(n(a))}function Wg(t,e,n,r,i){for(var a,o=1/t.sum,u=0,s=t.length,f=0,c=0;f<s;++f)(a=t[f])[r]=u,a[i]=u=o*(c+=Math.abs(n(a)))}function Yg(t,e,n,r,i){for(var a,o,u=0,s=0,f=t.length,c=0;c<f;++c)(a=n(o=t[c]))<0?(o[r]=s,o[i]=s+=a):(o[r]=u,o[i]=u+=a)}$g.Definition={type:"Stack",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"groupby",type:"field",array:!0},{name:"sort",type:"compare"},{name:"offset",type:"enum",default:"zero",values:["zero","center","normalize"]},{name:"as",type:"string",array:!0,length:2,default:["y0","y1"]}]},j($g,Wr).transform=function(t,e){var n,r,i,a,o=t.as||["y0","y1"],u=o[0],s=o[1],f=t.field||b,c="center"===t.offset?Bg:"normalize"===t.offset?Wg:Yg;for(r=0,i=(n=function(t,e,n,r){var i,a,o,u,s,f,c,l,h,d=[],p=function(t){return t(s)};if(null==e)d.push(t.slice());else for(i={},a=0,o=t.length;a<o;++a)s=t[a],f=e.map(p),(c=i[f])||(i[f]=c=[],d.push(c)),c.push(s);for(h=f=0,u=d.length;f<u;++f){for(c=d[f],l=a=0,o=c.length;a<o;++a)l+=Math.abs(r(c[a]));c.sum=l,h<l&&(h=l),n&&c.sort(n)}return d.max=h,d}(e.source,t.groupby,t.sort,f)).length,a=n.max;r<i;++r)c(n[r],a,f,u,s);return e.reflow(t.modified()).modifies(o)};var Hg=Object.freeze({axisticks:pg,datajoin:vg,encode:yg,legendentries:Mg,linkpath:zg,pie:Rg,scale:Ug,sortitems:Ig,stack:$g,validTicks:lg}),Gg=Array.prototype.slice,Vg=function(t,e){return t-e},Xg=function(t){for(var e=0,n=t.length,r=t[n-1][1]*t[0][0]-t[n-1][0]*t[0][1];++e<n;)r+=t[e-1][1]*t[e][0]-t[e-1][0]*t[e][1];return r},Jg=function(t){return function(){return t}},Zg=function(t,e){for(var n,r=-1,i=e.length;++r<i;)if(n=Qg(t,e[r]))return n;return 0};function Qg(t,e){for(var n,r,i,a,o,u,s,f,c,l,h=e[0],d=e[1],p=-1,v=0,g=t.length,m=g-1;v<g;m=v++){var y=t[v],b=y[0],_=y[1],x=t[m],w=x[0],M=x[1];if(l=void 0,a=s=y,u=c=e,((o=f=x)[0]-a[0])*(u[1]-a[1])==(u[0]-a[0])*(o[1]-a[1])&&(n=s[l=+(s[0]===f[0])],r=c[l],i=f[l],n<=r&&r<=i||i<=r&&r<=n))return 0;d<_!=d<M&&h<(w-b)*(d-_)/(M-_)+b&&(p=-p)}return p}var Kg=function(){},tm=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]],em=function(){var h=1,d=1,a=xi,o=e;function r(e){var t=a(e);if(Array.isArray(t))t=t.slice().sort(Vg);else{var n=di(e),r=n[0],i=n[1];t=_i(r,i,t),t=pi(Math.floor(r/t)*t,Math.floor(i/t)*t,t)}return t.map(function(t){return u(e,t)})}function u(e,n){var i=[],r=[];return function(t,e,u){var s,f,n,r,i,a,c=new Array,l=new Array;s=f=-1,r=t[0]>=e,tm[r<<1].forEach(o);for(;++s<h-1;)n=r,r=t[s+1]>=e,tm[n|r<<1].forEach(o);tm[r<<0].forEach(o);for(;++f<d-1;){for(s=-1,r=t[f*h+h]>=e,i=t[f*h]>=e,tm[r<<1|i<<2].forEach(o);++s<h-1;)n=r,r=t[f*h+h+s+1]>=e,a=i,i=t[f*h+s+1]>=e,tm[n|r<<1|i<<2|a<<3].forEach(o);tm[r|i<<3].forEach(o)}s=-1,i=t[f*h]>=e,tm[i<<2].forEach(o);for(;++s<h-1;)a=i,i=t[f*h+s+1]>=e,tm[i<<2|a<<3].forEach(o);function o(t){var e,n,r=[t[0][0]+s,t[0][1]+f],i=[t[1][0]+s,t[1][1]+f],a=p(r),o=p(i);(e=l[a])?(n=c[o])?(delete l[e.end],delete c[n.start],e===n?(e.ring.push(i),u(e.ring)):c[e.start]=l[n.end]={start:e.start,end:n.end,ring:e.ring.concat(n.ring)}):(delete l[e.end],e.ring.push(i),l[e.end=o]=e):(e=c[o])?(n=l[a])?(delete c[e.start],delete l[n.end],e===n?(e.ring.push(i),u(e.ring)):c[n.start]=l[e.end]={start:n.start,end:e.end,ring:n.ring.concat(e.ring)}):(delete c[e.start],e.ring.unshift(r),c[e.start=a]=e):c[a]=l[o]={start:a,end:o,ring:[r,i]}}tm[i<<3].forEach(o)}(e,n,function(t){o(t,e,n),0<Xg(t)?i.push([t]):r.push(t)}),r.forEach(function(t){for(var e,n=0,r=i.length;n<r;++n)if(-1!==Zg((e=i[n])[0],t))return void e.push(t)}),{type:"MultiPolygon",value:n,coordinates:i}}function p(t){return 2*t[0]+t[1]*(h+1)*4}function e(t,u,s){t.forEach(function(t){var e,n=t[0],r=t[1],i=0|n,a=0|r,o=u[a*h+i];0<n&&n<h&&i===n&&(e=u[a*h+i-1],t[0]=n+(s-e)/(o-e)-.5),0<r&&r<d&&a===r&&(e=u[(a-1)*h+i],t[1]=r+(s-e)/(o-e)-.5)})}return r.contour=u,r.size=function(t){if(!arguments.length)return[h,d];var e=Math.ceil(t[0]),n=Math.ceil(t[1]);if(!(0<e&&0<n))throw new Error("invalid size");return h=e,d=n,r},r.thresholds=function(t){return arguments.length?(a="function"==typeof t?t:Array.isArray(t)?Jg(Gg.call(t)):Jg(t),r):a},r.smooth=function(t){return arguments.length?(o=t?e:Kg,r):o===e},r};function nm(t,e,n){for(var r=t.width,i=t.height,a=1+(n<<1),o=0;o<i;++o)for(var u=0,s=0;u<r+n;++u)u<r&&(s+=t.data[u+o*r]),n<=u&&(a<=u&&(s-=t.data[u-a+o*r]),e.data[u-n+o*r]=s/Math.min(u+1,r-1+a-u,a))}function rm(t,e,n){for(var r=t.width,i=t.height,a=1+(n<<1),o=0;o<r;++o)for(var u=0,s=0;u<i+n;++u)u<i&&(s+=t.data[o+u*r]),n<=u&&(a<=u&&(s-=t.data[o+(u-a)*r]),e.data[o+(u-n)*r]=s/Math.min(u+1,i-1+a-u,a))}function im(t){return t[0]}function am(t){return t[1]}var om=["values","size"],um=["x","y","size","cellSize","bandwidth"];function sm(t){Wr.call(this,null,t)}sm.Definition={type:"Contour",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"values",type:"number",array:!0},{name:"x",type:"field"},{name:"y",type:"field"},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number"},{name:"count",type:"number"},{name:"nice",type:"number",default:!1},{name:"thresholds",type:"number",array:!0}]},j(sm,Wr).transform=function(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n,r,i,o,a=t.fork(t.NO_SOURCE|t.NO_FIELDS),u=e.count||10;return e.values?(n=em(),r=om,i=e.values):(n=function(){var o=im,u=am,r=960,i=500,s=20,f=2,c=3*s,l=r+2*c>>f,h=i+2*c>>f,d=Jg(20);function e(t){var a=new Float32Array(l*h),e=new Float32Array(l*h);t.forEach(function(t,e,n){var r=o(t,e,n)+c>>f,i=u(t,e,n)+c>>f;0<=r&&r<l&&0<=i&&i<h&&++a[r+i*l]}),nm({width:l,height:h,data:a},{width:l,height:h,data:e},s>>f),rm({width:l,height:h,data:e},{width:l,height:h,data:a},s>>f),nm({width:l,height:h,data:a},{width:l,height:h,data:e},s>>f),rm({width:l,height:h,data:e},{width:l,height:h,data:a},s>>f),nm({width:l,height:h,data:a},{width:l,height:h,data:e},s>>f),rm({width:l,height:h,data:e},{width:l,height:h,data:a},s>>f);var n=d(a);if(!Array.isArray(n)){var r=Mi(a);n=_i(0,r,n),(n=pi(0,Math.floor(r/n)*n,n)).shift()}return em().thresholds(n).size([l,h])(a).map(p)}function p(t){return t.value*=Math.pow(2,-2*f),t.coordinates.forEach(n),t}function n(t){t.forEach(a)}function a(t){t.forEach(v)}function v(t){t[0]=t[0]*Math.pow(2,f)-c,t[1]=t[1]*Math.pow(2,f)-c}function g(){return l=r+2*(c=3*s)>>f,h=i+2*c>>f,e}return e.x=function(t){return arguments.length?(o="function"==typeof t?t:Jg(+t),e):o},e.y=function(t){return arguments.length?(u="function"==typeof t?t:Jg(+t),e):u},e.size=function(t){if(!arguments.length)return[r,i];var e=Math.ceil(t[0]),n=Math.ceil(t[1]);if(!(0<=e||0<=e))throw new Error("invalid size");return r=e,i=n,g()},e.cellSize=function(t){if(!arguments.length)return 1<<f;if(!(1<=(t=+t)))throw new Error("invalid cell size");return f=Math.floor(Math.log(t)/Math.LN2),g()},e.thresholds=function(t){return arguments.length?(d="function"==typeof t?t:Array.isArray(t)?Jg(Gg.call(t)):Jg(t),e):d},e.bandwidth=function(t){if(!arguments.length)return Math.sqrt(s*(s+1));if(!(0<=(t=+t)))throw new Error("invalid bandwidth");return s=Math.round((Math.sqrt(4*t*t+1)-1)/2),g()},e}(),r=um,i=t.materialize(t.SOURCE).source),n.thresholds(e.thresholds||(e.nice?u:(o=u,function(t){for(var e=di(t),n=e[0],r=e[1]-n,i=[],a=1;a<=o;++a)i.push(n+r*a/(o+1));return i}))),r.forEach(function(t){null!=e[t]&&n[t](e[t])}),this.value&&(a.rem=this.value),i=i&&i.length?n(i).map(ht):[],this.value=a.source=a.add=i,a};var fm="FeatureCollection";function cm(t){Wr.call(this,null,t)}cm.Definition={type:"GeoJSON",metadata:{},params:[{name:"fields",type:"field",array:!0,length:2},{name:"geojson",type:"field"}]},j(cm,Wr).transform=function(t,e){var n,r=this._features,i=this._points,a=t.fields,o=a&&a[0],u=a&&a[1],s=t.geojson,f=e.ADD;n=t.modified()||e.changed(e.REM)||e.modified(x(s))||o&&e.modified(x(o))||u&&e.modified(x(u)),this.value&&!n||(f=e.SOURCE,this._features=r=[],this._points=i=[]),s&&e.visit(f,function(t){r.push(s(t))}),o&&u&&(e.visit(f,function(t){var e=o(t),n=u(t);null!=e&&null!=n&&(e=+e)===e&&(n=+n)===n&&i.push([e,n])}),r=r.concat({type:"Feature",geometry:{type:"MultiPoint",coordinates:i}})),this.value={type:fm,features:r}};var lm=function(){return new hm};function hm(){this.reset()}hm.prototype={constructor:hm,reset:function(){this.s=this.t=0},add:function(t){pm(dm,t,this.t),pm(this,dm.s,this.s),this.s?this.t+=dm.t:this.s=dm.t},valueOf:function(){return this.s}};var dm=new hm;function pm(t,e,n){var r=t.s=e+n,i=r-e,a=r-i;t.t=e-a+(n-i)}var vm=1e-6,gm=Math.PI,mm=gm/2,ym=gm/4,bm=2*gm,_m=180/gm,xm=gm/180,wm=Math.abs,Mm=Math.atan,km=Math.atan2,Em=Math.cos,Sm=Math.ceil,Am=Math.exp,Cm=Math.log,zm=Math.pow,Dm=Math.sin,Om=Math.sign||function(t){return 0<t?1:t<0?-1:0},Nm=Math.sqrt,Rm=Math.tan;function Tm(t){return 1<t?0:t<-1?gm:Math.acos(t)}function Pm(t){return 1<t?mm:t<-1?-mm:Math.asin(t)}function Lm(){}function qm(t,e){t&&Fm.hasOwnProperty(t.type)&&Fm[t.type](t,e)}var Um={Feature:function(t,e){qm(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r<i;)qm(n[r].geometry,e)}},Fm={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)t=n[r],e.point(t[0],t[1],t[2])},LineString:function(t,e){jm(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)jm(n[r],e,0)},Polygon:function(t,e){Im(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)Im(n[r],e)},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,i=n.length;++r<i;)qm(n[r],e)}};function jm(t,e,n){var r,i=-1,a=t.length-n;for(e.lineStart();++i<a;)r=t[i],e.point(r[0],r[1],r[2]);e.lineEnd()}function Im(t,e){var n=-1,r=t.length;for(e.polygonStart();++n<r;)jm(t[n],e,1);e.polygonEnd()}var $m,Bm,Wm,Ym,Hm,Gm=function(t,e){t&&Um.hasOwnProperty(t.type)?Um[t.type](t,e):qm(t,e)},Vm=lm(),Xm=lm(),Jm={point:Lm,lineStart:Lm,lineEnd:Lm,polygonStart:function(){Vm.reset(),Jm.lineStart=Zm,Jm.lineEnd=Qm},polygonEnd:function(){var t=+Vm;Xm.add(t<0?bm+t:t),this.lineStart=this.lineEnd=this.point=Lm},sphere:function(){Xm.add(bm)}};function Zm(){Jm.point=Km}function Qm(){ty($m,Bm)}function Km(t,e){Jm.point=ty,$m=t,Bm=e,Wm=t*=xm,Ym=Em(e=(e*=xm)/2+ym),Hm=Dm(e)}function ty(t,e){var n=(t*=xm)-Wm,r=0<=n?1:-1,i=r*n,a=Em(e=(e*=xm)/2+ym),o=Dm(e),u=Hm*o,s=Ym*a+u*Em(i),f=u*r*Dm(i);Vm.add(km(f,s)),Wm=t,Ym=a,Hm=o}var ey,ny,ry,iy,ay,oy,uy,sy;function fy(t){return[km(t[1],t[0]),Pm(t[2])]}function cy(t){var e=t[0],n=t[1],r=Em(n);return[r*Em(e),r*Dm(e),Dm(n)]}function ly(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function hy(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function dy(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function py(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function vy(t){var e=Nm(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}var gy,my,yy=lm(),by={point:_y,lineStart:wy,lineEnd:My,polygonStart:function(){by.point=ky,by.lineStart=Ey,by.lineEnd=Sy,yy.reset(),Jm.polygonStart()},polygonEnd:function(){Jm.polygonEnd(),by.point=_y,by.lineStart=wy,by.lineEnd=My,Vm<0?(ey=-(ry=180),ny=-(iy=90)):vm<yy?iy=90:yy<-vm&&(ny=-90),my[0]=ey,my[1]=ry}};function _y(t,e){gy.push(my=[ey=t,ry=t]),e<ny&&(ny=e),iy<e&&(iy=e)}function xy(t,e){var n=cy([t*xm,e*xm]);if(sy){var r=hy(sy,n),i=hy([r[1],-r[0],0],r);vy(i),i=fy(i);var a,o=t-ay,u=0<o?1:-1,s=i[0]*_m*u,f=180<wm(o);f^(u*ay<s&&s<u*t)?(a=i[1]*_m,iy<a&&(iy=a)):f^(u*ay<(s=(s+360)%360-180)&&s<u*t)?(a=-i[1]*_m)<ny&&(ny=a):(e<ny&&(ny=e),iy<e&&(iy=e)),f?t<ay?Ay(ey,t)>Ay(ey,ry)&&(ry=t):Ay(t,ry)>Ay(ey,ry)&&(ey=t):ey<=ry?(t<ey&&(ey=t),ry<t&&(ry=t)):ay<t?Ay(ey,t)>Ay(ey,ry)&&(ry=t):Ay(t,ry)>Ay(ey,ry)&&(ey=t)}else gy.push(my=[ey=t,ry=t]);e<ny&&(ny=e),iy<e&&(iy=e),sy=n,ay=t}function wy(){by.point=xy}function My(){my[0]=ey,my[1]=ry,by.point=_y,sy=null}function ky(t,e){if(sy){var n=t-ay;yy.add(180<wm(n)?n+(0<n?360:-360):n)}else oy=t,uy=e;Jm.point(t,e),xy(t,e)}function Ey(){Jm.lineStart()}function Sy(){ky(oy,uy),Jm.lineEnd(),wm(yy)>vm&&(ey=-(ry=180)),my[0]=ey,my[1]=ry,sy=null}function Ay(t,e){return(e-=t)<0?e+360:e}function Cy(t,e){return t[0]-e[0]}function zy(t,e){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:e<t[0]||t[1]<e}var Dy,Oy,Ny,Ry,Ty,Py,Ly,qy,Uy,Fy,jy,Iy,$y,By,Wy,Yy,Hy={sphere:Lm,point:Gy,lineStart:Xy,lineEnd:Qy,polygonStart:function(){Hy.lineStart=Ky,Hy.lineEnd=tb},polygonEnd:function(){Hy.lineStart=Xy,Hy.lineEnd=Qy}};function Gy(t,e){t*=xm;var n=Em(e*=xm);Vy(n*Em(t),n*Dm(t),Dm(e))}function Vy(t,e,n){Ny+=(t-Ny)/++Dy,Ry+=(e-Ry)/Dy,Ty+=(n-Ty)/Dy}function Xy(){Hy.point=Jy}function Jy(t,e){t*=xm;var n=Em(e*=xm);By=n*Em(t),Wy=n*Dm(t),Yy=Dm(e),Hy.point=Zy,Vy(By,Wy,Yy)}function Zy(t,e){t*=xm;var n=Em(e*=xm),r=n*Em(t),i=n*Dm(t),a=Dm(e),o=km(Nm((o=Wy*a-Yy*i)*o+(o=Yy*r-By*a)*o+(o=By*i-Wy*r)*o),By*r+Wy*i+Yy*a);Oy+=o,Py+=o*(By+(By=r)),Ly+=o*(Wy+(Wy=i)),qy+=o*(Yy+(Yy=a)),Vy(By,Wy,Yy)}function Qy(){Hy.point=Gy}function Ky(){Hy.point=eb}function tb(){nb(Iy,$y),Hy.point=Gy}function eb(t,e){Iy=t,$y=e,t*=xm,e*=xm,Hy.point=nb;var n=Em(e);By=n*Em(t),Wy=n*Dm(t),Yy=Dm(e),Vy(By,Wy,Yy)}function nb(t,e){t*=xm;var n=Em(e*=xm),r=n*Em(t),i=n*Dm(t),a=Dm(e),o=Wy*a-Yy*i,u=Yy*r-By*a,s=By*i-Wy*r,f=Nm(o*o+u*u+s*s),c=Pm(f),l=f&&-c/f;Uy+=l*o,Fy+=l*u,jy+=l*s,Oy+=c,Py+=c*(By+(By=r)),Ly+=c*(Wy+(Wy=i)),qy+=c*(Yy+(Yy=a)),Vy(By,Wy,Yy)}var rb=function(n,r){function t(t,e){return t=n(t,e),r(t[0],t[1])}return n.invert&&r.invert&&(t.invert=function(t,e){return(t=r.invert(t,e))&&n.invert(t[0],t[1])}),t};function ib(t,e){return[gm<t?t-bm:t<-gm?t+bm:t,e]}function ab(t,e,n){return(t%=bm)?e||n?rb(ub(t),sb(e,n)):ub(t):e||n?sb(e,n):ib}function ob(n){return function(t,e){return[gm<(t+=n)?t-bm:t<-gm?t+bm:t,e]}}function ub(t){var e=ob(t);return e.invert=ob(-t),e}function sb(t,e){var u=Em(t),s=Dm(t),f=Em(e),c=Dm(e);function n(t,e){var n=Em(e),r=Em(t)*n,i=Dm(t)*n,a=Dm(e),o=a*u+r*s;return[km(i*f-o*c,r*u-a*s),Pm(o*f+i*c)]}return n.invert=function(t,e){var n=Em(e),r=Em(t)*n,i=Dm(t)*n,a=Dm(e),o=a*f-i*c;return[km(i*f+a*c,r*u+o*s),Pm(o*u-r*s)]},n}ib.invert=ib;var fb=function(e){function t(t){return(t=e(t[0]*xm,t[1]*xm))[0]*=_m,t[1]*=_m,t}return e=ab(e[0]*xm,e[1]*xm,2<e.length?e[2]*xm:0),t.invert=function(t){return(t=e.invert(t[0]*xm,t[1]*xm))[0]*=_m,t[1]*=_m,t},t};function cb(t,e){(e=cy(e))[0]-=t,vy(e);var n=Tm(-e[1]);return((-e[2]<0?-n:n)+bm-vm)%bm}var lb=function(){var n,e=[];return{point:function(t,e){n.push([t,e])},lineStart:function(){e.push(n=[])},lineEnd:Lm,rejoin:function(){1<e.length&&e.push(e.pop().concat(e.shift()))},result:function(){var t=e;return e=[],n=null,t}}},hb=function(t,e){return wm(t[0]-e[0])<vm&&wm(t[1]-e[1])<vm};function db(t,e,n,r){this.x=t,this.z=e,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}var pb=function(t,e,n,r,a){var o,i,u=[],s=[];if(t.forEach(function(t){if(!((e=t.length-1)<=0)){var e,n,r=t[0],i=t[e];if(hb(r,i)){for(a.lineStart(),o=0;o<e;++o)a.point((r=t[o])[0],r[1]);a.lineEnd()}else u.push(n=new db(r,t,null,!0)),s.push(n.o=new db(r,null,n,!1)),u.push(n=new db(i,t,null,!1)),s.push(n.o=new db(i,null,n,!0))}}),u.length){for(s.sort(e),vb(u),vb(s),o=0,i=s.length;o<i;++o)s[o].e=n=!n;for(var f,c,l=u[0];;){for(var h=l,d=!0;h.v;)if((h=h.n)===l)return;f=h.z,a.lineStart();do{if(h.v=h.o.v=!0,h.e){if(d)for(o=0,i=f.length;o<i;++o)a.point((c=f[o])[0],c[1]);else r(h.x,h.n.x,1,a);h=h.n}else{if(d)for(f=h.p.z,o=f.length-1;0<=o;--o)a.point((c=f[o])[0],c[1]);else r(h.x,h.p.x,-1,a);h=h.p}f=(h=h.o).z,d=!d}while(!h.v);a.lineEnd()}}};function vb(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r<e;)i.n=n=t[r],n.p=i,i=n;i.n=n=t[0],n.p=i}}var gb=lm(),mb=function(t,e){var n=e[0],r=e[1],i=[Dm(n),-Em(n),0],a=0,o=0;gb.reset();for(var u=0,s=t.length;u<s;++u)if(c=(f=t[u]).length)for(var f,c,l=f[c-1],h=l[0],d=l[1]/2+ym,p=Dm(d),v=Em(d),g=0;g<c;++g,h=y,p=_,v=x,l=m){var m=f[g],y=m[0],b=m[1]/2+ym,_=Dm(b),x=Em(b),w=y-h,M=0<=w?1:-1,k=M*w,E=gm<k,S=p*_;if(gb.add(km(S*M*Dm(k),v*x+S*Em(k))),a+=E?w+M*bm:w,E^n<=h^n<=y){var A=hy(cy(l),cy(m));vy(A);var C=hy(i,A);vy(C);var z=(E^0<=w?-1:1)*Pm(C[2]);(z<r||r===z&&(A[0]||A[1]))&&(o+=E^0<=w?1:-1)}}return(a<-vm||a<vm&&gb<-vm)^1&o},yb=function(g,m,y,b){return function(u){var s,f,c,n=m(u),l=lb(),h=m(l),d=!1,e={point:r,lineStart:i,lineEnd:a,polygonStart:function(){e.point=p,e.lineStart=o,e.lineEnd=v,f=[],s=[]},polygonEnd:function(){e.point=r,e.lineStart=i,e.lineEnd=a,f=ki(f);var t=mb(s,b);f.length?(d||(u.polygonStart(),d=!0),pb(f,_b,t,y,u)):t&&(d||(u.polygonStart(),d=!0),u.lineStart(),y(null,null,1,u),u.lineEnd()),d&&(u.polygonEnd(),d=!1),f=s=null},sphere:function(){u.polygonStart(),u.lineStart(),y(null,null,1,u),u.lineEnd(),u.polygonEnd()}};function r(t,e){g(t,e)&&u.point(t,e)}function t(t,e){n.point(t,e)}function i(){e.point=t,n.lineStart()}function a(){e.point=r,n.lineEnd()}function p(t,e){c.push([t,e]),h.point(t,e)}function o(){h.lineStart(),c=[]}function v(){p(c[0][0],c[0][1]),h.lineEnd();var t,e,n,r,i=h.clean(),a=l.result(),o=a.length;if(c.pop(),s.push(c),c=null,o)if(1&i){if(0<(e=(n=a[0]).length-1)){for(d||(u.polygonStart(),d=!0),u.lineStart(),t=0;t<e;++t)u.point((r=n[t])[0],r[1]);u.lineEnd()}}else 1<o&&2&i&&a.push(a.pop().concat(a.shift())),f.push(a.filter(bb))}return e}};function bb(t){return 1<t.length}function _b(t,e){return((t=t.x)[0]<0?t[1]-mm-vm:mm-t[1])-((e=e.x)[0]<0?e[1]-mm-vm:mm-e[1])}var xb=yb(function(){return!0},function(l){var h,d=NaN,p=NaN,v=NaN;return{lineStart:function(){l.lineStart(),h=1},point:function(t,e){var n,r,i,a,o,u,s,f=0<t?gm:-gm,c=wm(t-d);wm(c-gm)<vm?(l.point(d,p=0<(p+e)/2?mm:-mm),l.point(v,p),l.lineEnd(),l.lineStart(),l.point(f,p),l.point(t,p),h=0):v!==f&&gm<=c&&(wm(d-v)<vm&&(d-=v*vm),wm(t-f)<vm&&(t-=f*vm),r=p,a=e,s=Dm((n=d)-(i=t)),p=wm(s)>vm?Mm((Dm(r)*(u=Em(a))*Dm(i)-Dm(a)*(o=Em(r))*Dm(n))/(o*u*s)):(r+a)/2,l.point(v,p),l.lineEnd(),l.lineStart(),l.point(f,p),h=0),l.point(d=t,p=e),v=f},lineEnd:function(){l.lineEnd(),d=p=NaN},clean:function(){return 2-h}}},function(t,e,n,r){var i;if(null==t)i=n*mm,r.point(-gm,i),r.point(0,i),r.point(gm,i),r.point(gm,0),r.point(gm,-i),r.point(0,-i),r.point(-gm,-i),r.point(-gm,0),r.point(-gm,i);else if(wm(t[0]-e[0])>vm){var a=t[0]<e[0]?gm:-gm;i=n*a/2,r.point(-a,i),r.point(0,i),r.point(a,i)}else r.point(e[0],e[1])},[-gm,-mm]);var wb=function(i){var S=Em(i),a=6*xm,d=0<S,p=wm(S)>vm;function v(t,e){return Em(t)*Em(e)>S}function g(t,e,n){var r=[1,0,0],i=hy(cy(t),cy(e)),a=ly(i,i),o=i[0],u=a-o*o;if(!u)return!n&&t;var s=S*a/u,f=-S*o/u,c=hy(r,i),l=py(r,s);dy(l,py(i,f));var h=c,d=ly(l,h),p=ly(h,h),v=d*d-p*(ly(l,l)-1);if(!(v<0)){var g=Nm(v),m=py(h,(-d-g)/p);if(dy(m,l),m=fy(m),!n)return m;var y,b=t[0],_=e[0],x=t[1],w=e[1];_<b&&(y=b,b=_,_=y);var M=_-b,k=wm(M-gm)<vm;if(!k&&w<x&&(y=x,x=w,w=y),k||M<vm?k?0<x+w^m[1]<(wm(m[0]-b)<vm?x:w):x<=m[1]&&m[1]<=w:gm<M^(b<=m[0]&&m[0]<=_)){var E=py(h,(-d+g)/p);return dy(E,l),[m,fy(E)]}}}function m(t,e){var n=d?i:gm-i,r=0;return t<-n?r|=1:n<t&&(r|=2),e<-n?r|=4:n<e&&(r|=8),r}return yb(v,function(u){var s,f,c,l,h;return{lineStart:function(){l=c=!1,h=1},point:function(t,e){var n,r=[t,e],i=v(t,e),a=d?i?0:m(t,e):i?m(t+(t<0?gm:-gm),e):0;if(!s&&(l=c=i)&&u.lineStart(),i!==c&&(!(n=g(s,r))||hb(s,n)||hb(r,n))&&(r[0]+=vm,r[1]+=vm,i=v(r[0],r[1])),i!==c)h=0,i?(u.lineStart(),n=g(r,s),u.point(n[0],n[1])):(n=g(s,r),u.point(n[0],n[1]),u.lineEnd()),s=n;else if(p&&s&&d^i){var o;a&f||!(o=g(r,s,!0))||(h=0,d?(u.lineStart(),u.point(o[0][0],o[0][1]),u.point(o[1][0],o[1][1]),u.lineEnd()):(u.point(o[1][0],o[1][1]),u.lineEnd(),u.lineStart(),u.point(o[0][0],o[0][1])))}!i||s&&hb(s,r)||u.point(r[0],r[1]),s=r,c=i,f=a},lineEnd:function(){c&&u.lineEnd(),s=null},clean:function(){return h|(l&&c)<<1}}},function(t,e,n,r){!function(t,e,n,r,i,a){if(n){var o=Em(e),u=Dm(e),s=r*n;null==i?(i=e+r*bm,a=e-s/2):(i=cb(o,i),a=cb(o,a),(0<r?i<a:a<i)&&(i+=r*bm));for(var f,c=i;0<r?a<c:c<a;c-=s)f=fy([o,-u*Em(c),-u*Dm(c)]),t.point(f[0],f[1])}}(r,i,a,n,t,e)},d?[0,-i]:[-gm,i-gm])},Mb=function(t,e,n,r,i,a){var o,u=t[0],s=t[1],f=0,c=1,l=e[0]-u,h=e[1]-s;if(o=n-u,l||!(0<o)){if(o/=l,l<0){if(o<f)return;o<c&&(c=o)}else if(0<l){if(c<o)return;f<o&&(f=o)}if(o=i-u,l||!(o<0)){if(o/=l,l<0){if(c<o)return;f<o&&(f=o)}else if(0<l){if(o<f)return;o<c&&(c=o)}if(o=r-s,h||!(0<o)){if(o/=h,h<0){if(o<f)return;o<c&&(c=o)}else if(0<h){if(c<o)return;f<o&&(f=o)}if(o=a-s,h||!(o<0)){if(o/=h,h<0){if(c<o)return;f<o&&(f=o)}else if(0<h){if(o<f)return;o<c&&(c=o)}return 0<f&&(t[0]=u+f*l,t[1]=s+f*h),c<1&&(e[0]=u+c*l,e[1]=s+c*h),!0}}}}},kb=1e9,Eb=-kb;function Sb(m,y,b,_){function x(t,e){return m<=t&&t<=b&&y<=e&&e<=_}function w(t,e,n,r){var i=0,a=0;if(null==t||(i=o(t,n))!==(a=o(e,n))||u(t,e)<0^0<n)for(;r.point(0===i||3===i?m:b,1<i?_:y),(i=(i+n+4)%4)!==a;);else r.point(e[0],e[1])}function o(t,e){return wm(t[0]-m)<vm?0<e?0:3:wm(t[0]-b)<vm?0<e?2:1:wm(t[1]-y)<vm?0<e?1:0:0<e?3:2}function M(t,e){return u(t.x,e.x)}function u(t,e){var n=o(t,1),r=o(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(r){var i,l,a,o,u,s,f,c,h,d,p,v=r,t=lb(),e={point:n,lineStart:function(){e.point=g,l&&l.push(a=[]);d=!0,h=!1,f=c=NaN},lineEnd:function(){i&&(g(o,u),s&&h&&t.rejoin(),i.push(t.result()));e.point=n,h&&v.lineEnd()},polygonStart:function(){v=t,i=[],l=[],p=!0},polygonEnd:function(){var t=function(){for(var t=0,e=0,n=l.length;e<n;++e)for(var r,i,a=l[e],o=1,u=a.length,s=a[0],f=s[0],c=s[1];o<u;++o)r=f,i=c,s=a[o],f=s[0],c=s[1],i<=_?_<c&&(c-i)*(m-r)<(f-r)*(_-i)&&++t:c<=_&&(f-r)*(_-i)<(c-i)*(m-r)&&--t;return t}(),e=p&&t,n=(i=ki(i)).length;(e||n)&&(r.polygonStart(),e&&(r.lineStart(),w(null,null,1,r),r.lineEnd()),n&&pb(i,M,t,w,r),r.polygonEnd());v=r,i=l=a=null}};function n(t,e){x(t,e)&&v.point(t,e)}function g(t,e){var n=x(t,e);if(l&&a.push([t,e]),d)o=t,u=e,d=!1,(s=n)&&(v.lineStart(),v.point(t,e));else if(n&&h)v.point(t,e);else{var r=[f=Math.max(Eb,Math.min(kb,f)),c=Math.max(Eb,Math.min(kb,c))],i=[t=Math.max(Eb,Math.min(kb,t)),e=Math.max(Eb,Math.min(kb,e))];Mb(r,i,m,y,b,_)?(h||(v.lineStart(),v.point(r[0],r[1])),v.point(i[0],i[1]),n||v.lineEnd(),p=!1):n&&(v.lineStart(),v.point(t,e),p=!1)}f=t,c=e,h=n}return e}}lm();function Ab(t,e,n){var r=pi(t,e-vm,n).concat(e);return function(e){return r.map(function(t){return[e,t]})}}function Cb(t,e,n){var r=pi(t,e-vm,n).concat(e);return function(e){return r.map(function(t){return[t,e]})}}var zb,Db,Ob,Nb,Rb=function(t){return t},Tb=lm(),Pb=lm(),Lb={point:Lm,lineStart:Lm,lineEnd:Lm,polygonStart:function(){Lb.lineStart=qb,Lb.lineEnd=jb},polygonEnd:function(){Lb.lineStart=Lb.lineEnd=Lb.point=Lm,Tb.add(wm(Pb)),Pb.reset()},result:function(){var t=Tb/2;return Tb.reset(),t}};function qb(){Lb.point=Ub}function Ub(t,e){Lb.point=Fb,zb=Ob=t,Db=Nb=e}function Fb(t,e){Pb.add(Nb*t-Ob*e),Ob=t,Nb=e}function jb(){Fb(zb,Db)}var Ib=1/0,$b=Ib,Bb=-Ib,Wb=Bb,Yb={point:function(t,e){t<Ib&&(Ib=t);Bb<t&&(Bb=t);e<$b&&($b=e);Wb<e&&(Wb=e)},lineStart:Lm,lineEnd:Lm,polygonStart:Lm,polygonEnd:Lm,result:function(){var t=[[Ib,$b],[Bb,Wb]];return Bb=Wb=-($b=Ib=1/0),t}};var Hb,Gb,Vb,Xb,Jb=0,Zb=0,Qb=0,Kb=0,t_=0,e_=0,n_=0,r_=0,i_=0,a_={point:o_,lineStart:u_,lineEnd:c_,polygonStart:function(){a_.lineStart=l_,a_.lineEnd=h_},polygonEnd:function(){a_.point=o_,a_.lineStart=u_,a_.lineEnd=c_},result:function(){var t=i_?[n_/i_,r_/i_]:e_?[Kb/e_,t_/e_]:Qb?[Jb/Qb,Zb/Qb]:[NaN,NaN];return Jb=Zb=Qb=Kb=t_=e_=n_=r_=i_=0,t}};function o_(t,e){Jb+=t,Zb+=e,++Qb}function u_(){a_.point=s_}function s_(t,e){a_.point=f_,o_(Vb=t,Xb=e)}function f_(t,e){var n=t-Vb,r=e-Xb,i=Nm(n*n+r*r);Kb+=i*(Vb+t)/2,t_+=i*(Xb+e)/2,e_+=i,o_(Vb=t,Xb=e)}function c_(){a_.point=o_}function l_(){a_.point=d_}function h_(){p_(Hb,Gb)}function d_(t,e){a_.point=p_,o_(Hb=Vb=t,Gb=Xb=e)}function p_(t,e){var n=t-Vb,r=e-Xb,i=Nm(n*n+r*r);Kb+=i*(Vb+t)/2,t_+=i*(Xb+e)/2,e_+=i,n_+=(i=Xb*t-Vb*e)*(Vb+t),r_+=i*(Xb+e),i_+=3*i,o_(Vb=t,Xb=e)}function v_(t){this._context=t}v_.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,bm)}},result:Lm};var g_,m_,y_,b_,__,x_=lm(),w_={point:Lm,lineStart:function(){w_.point=M_},lineEnd:function(){g_&&k_(m_,y_),w_.point=Lm},polygonStart:function(){g_=!0},polygonEnd:function(){g_=null},result:function(){var t=+x_;return x_.reset(),t}};function M_(t,e){w_.point=k_,m_=b_=t,y_=__=e}function k_(t,e){b_-=t,__-=e,x_.add(Nm(b_*b_+__*__)),b_=t,__=e}function E_(){this._string=[]}function S_(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}E_.prototype={_radius:4.5,_circle:S_(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=S_(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}};var A_=function(e,n){var r,i,a=4.5;function o(t){return t&&("function"==typeof a&&i.pointRadius(+a.apply(this,arguments)),Gm(t,r(i))),i.result()}return o.area=function(t){return Gm(t,r(Lb)),Lb.result()},o.measure=function(t){return Gm(t,r(w_)),w_.result()},o.bounds=function(t){return Gm(t,r(Yb)),Yb.result()},o.centroid=function(t){return Gm(t,r(a_)),a_.result()},o.projection=function(t){return arguments.length?(r=null==t?(e=null,Rb):(e=t).stream,o):e},o.context=function(t){return arguments.length?(i=null==t?(n=null,new E_):new v_(n=t),"function"!=typeof a&&i.pointRadius(a),o):n},o.pointRadius=function(t){return arguments.length?(a="function"==typeof t?t:(i.pointRadius(+t),+t),o):a},o.projection(e).context(n)};function C_(r){return function(t){var e=new z_;for(var n in r)e[n]=r[n];return e.stream=t,e}}function z_(){}function D_(t,e,n){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=r&&t.clipExtent(null),Gm(n,t.stream(Yb)),e(Yb.result()),null!=r&&t.clipExtent(r),t}function O_(o,u,t){return D_(o,function(t){var e=u[1][0]-u[0][0],n=u[1][1]-u[0][1],r=Math.min(e/(t[1][0]-t[0][0]),n/(t[1][1]-t[0][1])),i=+u[0][0]+(e-r*(t[1][0]+t[0][0]))/2,a=+u[0][1]+(n-r*(t[1][1]+t[0][1]))/2;o.scale(150*r).translate([i,a])},t)}function N_(t,e,n){return O_(t,[[0,0],e],n)}function R_(a,o,t){return D_(a,function(t){var e=+o,n=e/(t[1][0]-t[0][0]),r=(e-n*(t[1][0]+t[0][0]))/2,i=-n*t[0][1];a.scale(150*n).translate([r,i])},t)}function T_(a,o,t){return D_(a,function(t){var e=+o,n=e/(t[1][1]-t[0][1]),r=-n*t[0][0],i=(e-n*(t[1][1]+t[0][1]))/2;a.scale(150*n).translate([r,i])},t)}z_.prototype={constructor:z_,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var P_=16,L_=Em(30*xm),q_=function(t,e){return+e?function(z,D){function O(t,e,n,r,i,a,o,u,s,f,c,l,h,d){var p=o-t,v=u-e,g=p*p+v*v;if(4*D<g&&h--){var m=r+f,y=i+c,b=a+l,_=Nm(m*m+y*y+b*b),x=Pm(b/=_),w=wm(wm(b)-1)<vm||wm(n-s)<vm?(n+s)/2:km(y,m),M=z(w,x),k=M[0],E=M[1],S=k-t,A=E-e,C=v*S-p*A;(D<C*C/g||.3<wm((p*S+v*A)/g-.5)||r*f+i*c+a*l<L_)&&(O(t,e,n,r,i,a,k,E,w,m/=_,y/=_,b,h,d),d.point(k,E),O(k,E,w,m,y,b,o,u,s,f,c,l,h,d))}}return function(i){var n,r,a,o,u,s,f,c,l,h,d,p,v={point:t,lineStart:e,lineEnd:m,polygonStart:function(){i.polygonStart(),v.lineStart=y},polygonEnd:function(){i.polygonEnd(),v.lineStart=e}};function t(t,e){t=z(t,e),i.point(t[0],t[1])}function e(){c=NaN,v.point=g,i.lineStart()}function g(t,e){var n=cy([t,e]),r=z(t,e);O(c,l,f,h,d,p,c=r[0],l=r[1],f=t,h=n[0],d=n[1],p=n[2],P_,i),i.point(c,l)}function m(){v.point=t,i.lineEnd()}function y(){e(),v.point=b,v.lineEnd=_}function b(t,e){g(n=t,e),r=c,a=l,o=h,u=d,s=p,v.point=g}function _(){O(c,l,f,h,d,p,r,a,n,o,u,s,P_,i),(v.lineEnd=m)()}return v}}(t,e):(n=t,C_({point:function(t,e){t=n(t,e),this.stream.point(t[0],t[1])}}));var n};var U_=C_({point:function(t,e){this.stream.point(t*xm,e*xm)}});function F_(t){return j_(function(){return t})()}function j_(t){var n,r,i,e,a,o,u,s,f,c,l=150,h=480,d=250,p=0,v=0,g=0,m=0,y=0,b=null,_=xb,x=null,w=Rb,M=.5,k=q_(A,M);function E(t){return[(t=a(t[0]*xm,t[1]*xm))[0]*l+r,i-t[1]*l]}function S(t){return(t=a.invert((t[0]-r)/l,(i-t[1])/l))&&[t[0]*_m,t[1]*_m]}function A(t,e){return[(t=n(t,e))[0]*l+r,i-t[1]*l]}function C(){a=rb(e=ab(g,m,y),n);var t=n(p,v);return r=h-t[0]*l,i=d+t[1]*l,z()}function z(){return f=c=null,E}return E.stream=function(t){return f&&c===t?f:f=U_((r=e,C_({point:function(t,e){var n=r(t,e);return this.stream.point(n[0],n[1])}}))(_(k(w(c=t)))));var r},E.preclip=function(t){return arguments.length?(_=t,b=void 0,z()):_},E.postclip=function(t){return arguments.length?(w=t,x=o=u=s=null,z()):w},E.clipAngle=function(t){return arguments.length?(_=+t?wb(b=t*xm):(b=null,xb),z()):b*_m},E.clipExtent=function(t){return arguments.length?(w=null==t?(x=o=u=s=null,Rb):Sb(x=+t[0][0],o=+t[0][1],u=+t[1][0],s=+t[1][1]),z()):null==x?null:[[x,o],[u,s]]},E.scale=function(t){return arguments.length?(l=+t,C()):l},E.translate=function(t){return arguments.length?(h=+t[0],d=+t[1],C()):[h,d]},E.center=function(t){return arguments.length?(p=t[0]%360*xm,v=t[1]%360*xm,C()):[p*_m,v*_m]},E.rotate=function(t){return arguments.length?(g=t[0]%360*xm,m=t[1]%360*xm,y=2<t.length?t[2]%360*xm:0,C()):[g*_m,m*_m,y*_m]},E.precision=function(t){return arguments.length?(k=q_(A,M=t*t),z()):Nm(M)},E.fitExtent=function(t,e){return O_(E,t,e)},E.fitSize=function(t,e){return N_(E,t,e)},E.fitWidth=function(t,e){return R_(E,t,e)},E.fitHeight=function(t,e){return T_(E,t,e)},function(){return n=t.apply(this,arguments),E.invert=n.invert&&S,C()}}function I_(t){var e=0,n=gm/3,r=j_(t),i=r(e,n);return i.parallels=function(t){return arguments.length?r(e=t[0]*xm,n=t[1]*xm):[e*_m,n*_m]},i}function $_(t,e){var n=Dm(t),r=(n+Dm(e))/2;if(wm(r)<vm)return function(t){var n=Em(t);function e(t,e){return[t*n,Dm(e)/n]}return e.invert=function(t,e){return[t/n,Pm(e*n)]},e}(t);var i=1+n*(2*r-n),a=Nm(i)/r;function o(t,e){var n=Nm(i-2*r*Dm(e))/r;return[n*Dm(t*=r),a-n*Em(t)]}return o.invert=function(t,e){var n=a-e;return[km(t,wm(n))/r*Om(n),Pm((i-(t*t+n*n)*r*r)/(2*r))]},o}var B_=function(){return I_($_).scale(155.424).center([0,33.6442])},W_=function(){return B_().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])};function Y_(a){return function(t,e){var n=Em(t),r=Em(e),i=a(n*r);return[i*r*Dm(t),i*Dm(e)]}}function H_(o){return function(t,e){var n=Nm(t*t+e*e),r=o(n),i=Dm(r),a=Em(r);return[km(t*i,n*a),Pm(n&&e*i/n)]}}var G_=Y_(function(t){return Nm(2/(1+t))});G_.invert=H_(function(t){return 2*Pm(t/2)});var V_=Y_(function(t){return(t=Tm(t))&&t/Dm(t)});V_.invert=H_(function(t){return t});function X_(t,e){return[t,Cm(Rm((mm+e)/2))]}X_.invert=function(t,e){return[t,2*Mm(Am(e))-mm]};function J_(n){var r,i,a,o=F_(n),e=o.center,u=o.scale,s=o.translate,f=o.clipExtent,c=null;function l(){var t=gm*u(),e=o(fb(o.rotate()).invert([0,0]));return f(null==c?[[e[0]-t,e[1]-t],[e[0]+t,e[1]+t]]:n===X_?[[Math.max(e[0]-t,c),r],[Math.min(e[0]+t,i),a]]:[[c,Math.max(e[1]-t,r)],[i,Math.min(e[1]+t,a)]])}return o.scale=function(t){return arguments.length?(u(t),l()):u()},o.translate=function(t){return arguments.length?(s(t),l()):s()},o.center=function(t){return arguments.length?(e(t),l()):e()},o.clipExtent=function(t){return arguments.length?(null==t?c=r=i=a=null:(c=+t[0][0],r=+t[0][1],i=+t[1][0],a=+t[1][1]),l()):null==c?null:[[c,r],[i,a]]},l()}function Z_(t){return Rm((mm+t)/2)}function Q_(t,e){var n=Em(t),i=t===e?Dm(t):Cm(n/Em(e))/Cm(Z_(e)/Z_(t)),a=n*zm(Z_(t),i)/i;if(!i)return X_;function r(t,e){0<a?e<-mm+vm&&(e=-mm+vm):mm-vm<e&&(e=mm-vm);var n=a/zm(Z_(e),i);return[n*Dm(i*t),a-n*Em(i*t)]}return r.invert=function(t,e){var n=a-e,r=Om(i)*Nm(t*t+n*n);return[km(t,wm(n))/i*Om(n),2*Mm(zm(a/r,1/i))-mm]},r}function K_(t,e){return[t,e]}K_.invert=K_;function tx(t,e){var n=Em(t),i=t===e?Dm(t):(n-Em(e))/(e-t),a=n/i+t;if(wm(i)<vm)return K_;function r(t,e){var n=a-e,r=i*t;return[n*Dm(r),a-n*Em(r)]}return r.invert=function(t,e){var n=a-e;return[km(t,wm(n))/i*Om(n),a-Om(i)*Nm(t*t+n*n)]},r}function ex(t,e){var n=Em(e),r=Em(t)*n;return[n*Dm(t)/r,Dm(e)/r]}ex.invert=H_(Mm);function nx(t,e){return[Em(e)*Dm(t),Dm(e)]}nx.invert=H_(Pm);function rx(t,e){var n=Em(e),r=1+Em(t)*n;return[n*Dm(t)/r,Dm(e)/r]}rx.invert=H_(function(t){return 2*Mm(t)});function ix(t,e){return[Cm(Rm((mm+e)/2)),-t]}ix.invert=function(t,e){return[-e,2*Mm(Am(t))-mm]};var ax=A_(),ox=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function ux(t,e){if(!t||"string"!=typeof t)throw new Error("Projection type must be a name string.");return t=t.toLowerCase(),1<arguments.length?(fx[t]=(r=t,i=e,function t(){var n=i();return n.type=r,n.path=A_().projection(n),n.copy=n.copy||function(){var e=t();return ox.forEach(function(t){n.hasOwnProperty(t)&&e[t](n[t]())}),e.path.pointRadius(n.path.pointRadius()),e},n}),this):fx.hasOwnProperty(t)?fx[t]:null;var r,i}function sx(t){return t&&t.path||ax}var fx={albers:W_,albersusa:function(){var e,n,i,a,o,r,u=W_(),s=B_().rotate([154,0]).center([-2,58.5]).parallels([55,65]),f=B_().rotate([157,0]).center([-3,19.9]).parallels([8,18]),c={point:function(t,e){r=[t,e]}};function l(t){var e=t[0],n=t[1];return r=null,i.point(e,n),r||(a.point(e,n),r)||(o.point(e,n),r)}function h(){return e=n=null,l}return l.invert=function(t){var e=u.scale(),n=u.translate(),r=(t[0]-n[0])/e,i=(t[1]-n[1])/e;return(.12<=i&&i<.234&&-.425<=r&&r<-.214?s:.166<=i&&i<.234&&-.214<=r&&r<-.115?f:u).invert(t)},l.stream=function(t){return e&&n===t?e:(r=[u.stream(n=t),s.stream(t),f.stream(t)],i=r.length,e={point:function(t,e){for(var n=-1;++n<i;)r[n].point(t,e)},sphere:function(){for(var t=-1;++t<i;)r[t].sphere()},lineStart:function(){for(var t=-1;++t<i;)r[t].lineStart()},lineEnd:function(){for(var t=-1;++t<i;)r[t].lineEnd()},polygonStart:function(){for(var t=-1;++t<i;)r[t].polygonStart()},polygonEnd:function(){for(var t=-1;++t<i;)r[t].polygonEnd()}});var r,i},l.precision=function(t){return arguments.length?(u.precision(t),s.precision(t),f.precision(t),h()):u.precision()},l.scale=function(t){return arguments.length?(u.scale(t),s.scale(.35*t),f.scale(t),l.translate(u.translate())):u.scale()},l.translate=function(t){if(!arguments.length)return u.translate();var e=u.scale(),n=+t[0],r=+t[1];return i=u.translate(t).clipExtent([[n-.455*e,r-.238*e],[n+.455*e,r+.238*e]]).stream(c),a=s.translate([n-.307*e,r+.201*e]).clipExtent([[n-.425*e+vm,r+.12*e+vm],[n-.214*e-vm,r+.234*e-vm]]).stream(c),o=f.translate([n-.205*e,r+.212*e]).clipExtent([[n-.214*e+vm,r+.166*e+vm],[n-.115*e-vm,r+.234*e-vm]]).stream(c),h()},l.fitExtent=function(t,e){return O_(l,t,e)},l.fitSize=function(t,e){return N_(l,t,e)},l.fitWidth=function(t,e){return R_(l,t,e)},l.fitHeight=function(t,e){return T_(l,t,e)},l.scale(1070)},azimuthalequalarea:function(){return F_(G_).scale(124.75).clipAngle(179.999)},azimuthalequidistant:function(){return F_(V_).scale(79.4188).clipAngle(179.999)},conicconformal:function(){return I_(Q_).scale(109.5).parallels([30,30])},conicequalarea:B_,conicequidistant:function(){return I_(tx).scale(131.154).center([0,13.9389])},equirectangular:function(){return F_(K_).scale(152.63)},gnomonic:function(){return F_(ex).scale(144.049).clipAngle(60)},mercator:function(){return J_(X_).scale(961/bm)},orthographic:function(){return F_(nx).scale(249.5).clipAngle(90+vm)},stereographic:function(){return F_(rx).scale(250).clipAngle(142)},transversemercator:function(){var t=J_(ix),e=t.center,n=t.rotate;return t.center=function(t){return arguments.length?e([-t[1],t[0]]):[(t=e())[1],-t[0]]},t.rotate=function(t){return arguments.length?n([t[0],t[1],2<t.length?t[2]+90:90]):[(t=n())[0],t[1],t[2]-90]},n([0,0,90]).scale(159.155)}};for(var cx in fx)ux(cx,fx[cx]);function lx(t){Wr.call(this,null,t)}function hx(t){Wr.call(this,null,t)}function dx(t){Wr.call(this,null,t)}function px(t){Wr.call(this,[],t),this.generator=function(){var e,n,r,i,a,o,u,s,f,c,l,h,d=10,p=d,v=90,g=360,m=2.5;function y(){return{type:"MultiLineString",coordinates:t()}}function t(){return pi(Sm(i/v)*v,r,v).map(l).concat(pi(Sm(s/g)*g,u,g).map(h)).concat(pi(Sm(n/d)*d,e,d).filter(function(t){return wm(t%v)>vm}).map(f)).concat(pi(Sm(o/p)*p,a,p).filter(function(t){return wm(t%g)>vm}).map(c))}return y.lines=function(){return t().map(function(t){return{type:"LineString",coordinates:t}})},y.outline=function(){return{type:"Polygon",coordinates:[l(i).concat(h(u).slice(1),l(r).reverse().slice(1),h(s).reverse().slice(1))]}},y.extent=function(t){return arguments.length?y.extentMajor(t).extentMinor(t):y.extentMinor()},y.extentMajor=function(t){return arguments.length?(i=+t[0][0],r=+t[1][0],s=+t[0][1],u=+t[1][1],r<i&&(t=i,i=r,r=t),u<s&&(t=s,s=u,u=t),y.precision(m)):[[i,s],[r,u]]},y.extentMinor=function(t){return arguments.length?(n=+t[0][0],e=+t[1][0],o=+t[0][1],a=+t[1][1],e<n&&(t=n,n=e,e=t),a<o&&(t=o,o=a,a=t),y.precision(m)):[[n,o],[e,a]]},y.step=function(t){return arguments.length?y.stepMajor(t).stepMinor(t):y.stepMinor()},y.stepMajor=function(t){return arguments.length?(v=+t[0],g=+t[1],y):[v,g]},y.stepMinor=function(t){return arguments.length?(d=+t[0],p=+t[1],y):[d,p]},y.precision=function(t){return arguments.length?(m=+t,f=Ab(o,a,90),c=Cb(n,e,m),l=Ab(s,u,90),h=Cb(i,r,m),y):m},y.extentMajor([[-180,-90+vm],[180,90-vm]]).extentMinor([[-180,-80-vm],[180,80+vm]])}()}function vx(t){Wr.call(this,null,t),this.modified(!0)}function gx(t,e,n){R(t[e])&&t[e](n)}lx.Definition={type:"GeoPath",metadata:{modifies:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"path"}]},j(lx,Wr).transform=function(t,e){var n=e.fork(e.ALL),r=this.value,i=t.field||c,a=t.as||"path",o=n.SOURCE;!r||t.modified()?(this.value=r=sx(t.projection),n.materialize().reflow()):o=i===c||e.modified(i.fields)?n.ADD_MOD:n.ADD;var u=function(t,e){var n=t.pointRadius();t.context(null),null!=e&&t.pointRadius(e);return n}(r,t.pointRadius);return n.visit(o,function(t){t[a]=r(i(t))}),r.pointRadius(u),n.modifies(a)},hx.Definition={type:"GeoPoint",metadata:{modifies:!0},params:[{name:"projection",type:"projection",required:!0},{name:"fields",type:"field",array:!0,required:!0,length:2},{name:"as",type:"string",array:!0,length:2,default:["x","y"]}]},j(hx,Wr).transform=function(t,e){var n,r=t.projection,i=t.fields[0],a=t.fields[1],o=t.as||["x","y"],u=o[0],s=o[1];function f(t){var e=r([i(t),a(t)]);e?(t[u]=e[0],t[s]=e[1]):(t[u]=void 0,t[s]=void 0)}return t.modified()?e=e.materialize().reflow(!0).visit(e.SOURCE,f):(n=e.modified(i.fields)||e.modified(a.fields),e.visit(n?e.ADD_MOD:e.ADD,f)),e.modifies(o)},dx.Definition={type:"GeoShape",metadata:{modifies:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field",default:"datum"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"shape"}]},j(dx,Wr).transform=function(t,e){var r,i,a,n,o=e.fork(e.ALL),u=this.value,s=t.field||l("datum"),f=t.as||"shape",c=o.ADD_MOD;return u&&!t.modified()||(this.value=(r=sx(t.projection),i=s,a=t.pointRadius,(n=null==a?function(t){return r(i(t))}:function(t){var e=r.pointRadius(),n=r.pointRadius(a)(i(t));return r.pointRadius(e),n}).context=function(t){return r.context(t),n},u=n),o.materialize().reflow(),c=o.SOURCE),o.visit(c,function(t){t[f]=u}),o.modifies(f)},px.Definition={type:"Graticule",metadata:{source:!0,generates:!0,changes:!0},params:[{name:"extent",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMajor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMinor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"step",type:"number",array:!0,length:2},{name:"stepMajor",type:"number",array:!0,length:2,default:[90,360]},{name:"stepMinor",type:"number",array:!0,length:2,default:[10,10]},{name:"precision",type:"number",default:2.5}]},j(px,Wr).transform=function(t,e){var n,r=e.fork(),i=this.value,a=this.generator;if(!i.length||t.modified())for(var o in t)R(a[o])&&a[o](t[o]);return n=a(),i.length?r.mod.push(vt(i[0],n)):r.add.push(ht(n)),i[0]=n,r.source=i,r},j(vx,Wr).transform=function(e,t){var n,r,i,a,o=this.value;return!o||e.modified("type")?(this.value=o=function(t){var e=ux((t||"mercator").toLowerCase());e||rt("Unrecognized projection type: "+t);return e()}(e.type),ox.forEach(function(t){null!=e[t]&&gx(o,t,e[t])})):ox.forEach(function(t){e.modified(t)&&gx(o,t,e[t])}),null!=e.pointRadius&&o.path.pointRadius(e.pointRadius),e.fit&&(n=o,a=(r=e).fit,i=1===(a=Q(a)).length?a[0]:{type:fm,features:a.reduce(function(t,e){return e&&e.type===fm?t.push.apply(t,e.features):d(e)?t.push.apply(t,e):t.push(e),t},[])},r.extent?n.fitExtent(r.extent,i):r.size&&n.fitSize(r.size,i)),t.fork(t.NO_SOURCE|t.NO_FIELDS)};var mx=Object.freeze({contour:sm,geojson:cm,geopath:lx,geopoint:hx,geoshape:dx,graticule:px,projection:vx}),yx=function(t){return function(){return t}},bx=function(){return 1e-6*(Math.random()-.5)};function _x(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var i,a,o,u,s,f,c,l,h,d=t._root,p={data:r},v=t._x0,g=t._y0,m=t._x1,y=t._y1;if(!d)return t._root=p,t;for(;d.length;)if((f=e>=(a=(v+m)/2))?v=a:m=a,(c=n>=(o=(g+y)/2))?g=o:y=o,!(d=(i=d)[l=c<<1|f]))return i[l]=p,t;if(u=+t._x.call(null,d.data),s=+t._y.call(null,d.data),e===u&&n===s)return p.next=d,i?i[l]=p:t._root=p,t;for(;i=i?i[l]=new Array(4):t._root=new Array(4),(f=e>=(a=(v+m)/2))?v=a:m=a,(c=n>=(o=(g+y)/2))?g=o:y=o,(l=c<<1|f)==(h=(o<=s)<<1|a<=u););return i[h]=d,i[l]=p,t}var xx=function(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i};function wx(t){return t[0]}function Mx(t){return t[1]}function kx(t,e,n){var r=new Ex(null==e?wx:e,null==n?Mx:n,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function Ex(t,e,n,r,i,a){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=i,this._y1=a,this._root=void 0}function Sx(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var Ax=kx.prototype=Ex.prototype;function Cx(t){return t.x+t.vx}function zx(t){return t.y+t.vy}Ax.copy=function(){var t,e,n=new Ex(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return n;if(!r.length)return n._root=Sx(r),n;for(t=[{source:r,target:n._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(e=r.source[i])&&(e.length?t.push({source:e,target:r.target[i]=new Array(4)}):r.target[i]=Sx(e));return n},Ax.add=function(t){var e=+this._x.call(null,t),n=+this._y.call(null,t);return _x(this.cover(e,n),e,n,t)},Ax.addAll=function(t){var e,n,r,i,a=t.length,o=new Array(a),u=new Array(a),s=1/0,f=1/0,c=-1/0,l=-1/0;for(n=0;n<a;++n)isNaN(r=+this._x.call(null,e=t[n]))||isNaN(i=+this._y.call(null,e))||((o[n]=r)<s&&(s=r),c<r&&(c=r),(u[n]=i)<f&&(f=i),l<i&&(l=i));for(c<s&&(s=this._x0,c=this._x1),l<f&&(f=this._y0,l=this._y1),this.cover(s,f).cover(c,l),n=0;n<a;++n)_x(this,o[n],u[n],t[n]);return this},Ax.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,r=this._y0,i=this._x1,a=this._y1;if(isNaN(n))i=(n=Math.floor(t))+1,a=(r=Math.floor(e))+1;else{if(!(t<n||i<t||e<r||a<e))return this;var o,u,s=i-n,f=this._root;switch(u=(e<(r+a)/2)<<1|t<(n+i)/2){case 0:for(;(o=new Array(4))[u]=f,f=o,a=r+(s*=2),(i=n+s)<t||a<e;);break;case 1:for(;(o=new Array(4))[u]=f,f=o,a=r+(s*=2),t<(n=i-s)||a<e;);break;case 2:for(;(o=new Array(4))[u]=f,f=o,r=a-(s*=2),(i=n+s)<t||e<r;);break;case 3:for(;(o=new Array(4))[u]=f,f=o,r=a-(s*=2),t<(n=i-s)||e<r;);}this._root&&this._root.length&&(this._root=f)}return this._x0=n,this._y0=r,this._x1=i,this._y1=a,this},Ax.data=function(){var e=[];return this.visit(function(t){if(!t.length)for(;e.push(t.data),t=t.next;);}),e},Ax.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},Ax.find=function(t,e,n){var r,i,a,o,u,s,f,c=this._x0,l=this._y0,h=this._x1,d=this._y1,p=[],v=this._root;for(v&&p.push(new xx(v,c,l,h,d)),null==n?n=1/0:(c=t-n,l=e-n,h=t+n,d=e+n,n*=n);s=p.pop();)if(!(!(v=s.node)||(i=s.x0)>h||(a=s.y0)>d||(o=s.x1)<c||(u=s.y1)<l))if(v.length){var g=(i+o)/2,m=(a+u)/2;p.push(new xx(v[3],g,m,o,u),new xx(v[2],i,m,g,u),new xx(v[1],g,a,o,m),new xx(v[0],i,a,g,m)),(f=(m<=e)<<1|g<=t)&&(s=p[p.length-1],p[p.length-1]=p[p.length-1-f],p[p.length-1-f]=s)}else{var y=t-+this._x.call(null,v.data),b=e-+this._y.call(null,v.data),_=y*y+b*b;if(_<n){var x=Math.sqrt(n=_);c=t-x,l=e-x,h=t+x,d=e+x,r=v.data}}return r},Ax.remove=function(t){if(isNaN(a=+this._x.call(null,t))||isNaN(o=+this._y.call(null,t)))return this;var e,n,r,i,a,o,u,s,f,c,l,h,d=this._root,p=this._x0,v=this._y0,g=this._x1,m=this._y1;if(!d)return this;if(d.length)for(;;){if((f=a>=(u=(p+g)/2))?p=u:g=u,(c=o>=(s=(v+m)/2))?v=s:m=s,!(d=(e=d)[l=c<<1|f]))return this;if(!d.length)break;(e[l+1&3]||e[l+2&3]||e[l+3&3])&&(n=e,h=l)}for(;d.data!==t;)if(!(d=(r=d).next))return this;return(i=d.next)&&delete d.next,r?i?r.next=i:delete r.next:e?(i?e[l]=i:delete e[l],(d=e[0]||e[1]||e[2]||e[3])&&d===(e[3]||e[2]||e[1]||e[0])&&!d.length&&(n?n[h]=d:this._root=d)):this._root=i,this},Ax.removeAll=function(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this},Ax.root=function(){return this._root},Ax.size=function(){var e=0;return this.visit(function(t){if(!t.length)for(;++e,t=t.next;);}),e},Ax.visit=function(t){var e,n,r,i,a,o,u=[],s=this._root;for(s&&u.push(new xx(s,this._x0,this._y0,this._x1,this._y1));e=u.pop();)if(!t(s=e.node,r=e.x0,i=e.y0,a=e.x1,o=e.y1)&&s.length){var f=(r+a)/2,c=(i+o)/2;(n=s[3])&&u.push(new xx(n,f,c,a,o)),(n=s[2])&&u.push(new xx(n,r,c,f,o)),(n=s[1])&&u.push(new xx(n,f,i,a,c)),(n=s[0])&&u.push(new xx(n,r,i,f,c))}return this},Ax.visitAfter=function(t){var e,n=[],r=[];for(this._root&&n.push(new xx(this._root,this._x0,this._y0,this._x1,this._y1));e=n.pop();){var i=e.node;if(i.length){var a,o=e.x0,u=e.y0,s=e.x1,f=e.y1,c=(o+s)/2,l=(u+f)/2;(a=i[0])&&n.push(new xx(a,o,u,c,l)),(a=i[1])&&n.push(new xx(a,c,u,s,l)),(a=i[2])&&n.push(new xx(a,o,l,c,f)),(a=i[3])&&n.push(new xx(a,c,l,s,f))}r.push(e)}for(;e=r.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},Ax.x=function(t){return arguments.length?(this._x=t,this):this._x},Ax.y=function(t){return arguments.length?(this._y=t,this):this._y};function Dx(t){return t.index}function Ox(t,e){var n=t.get(e);if(!n)throw new Error("missing: "+e);return n}var Nx,Rx,Tx=0,Px=0,Lx=0,qx=1e3,Ux=0,Fx=0,jx=0,Ix="object"==typeof performance&&performance.now?performance:Date,$x="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Bx(){return Fx||($x(Wx),Fx=Ix.now()+jx)}function Wx(){Fx=0}function Yx(){this._call=this._time=this._next=null}function Hx(t,e,n){var r=new Yx;return r.restart(t,e,n),r}function Gx(){Fx=(Ux=Ix.now())+jx,Tx=Px=0;try{!function(){Bx(),++Tx;for(var t,e=Nx;e;)0<=(t=Fx-e._time)&&e._call.call(null,t),e=e._next;--Tx}()}finally{Tx=0,function(){var t,e,n=Nx,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),n=(t=n)._next):(e=n._next,n._next=null,n=t?t._next=e:Nx=e);Rx=t,Xx(r)}(),Fx=0}}function Vx(){var t=Ix.now(),e=t-Ux;qx<e&&(jx-=e,Ux=t)}function Xx(t){Tx||(Px&&(Px=clearTimeout(Px)),24<t-Fx?(t<1/0&&(Px=setTimeout(Gx,t-Ix.now()-jx)),Lx&&(Lx=clearInterval(Lx))):(Lx||(Ux=Ix.now(),Lx=setInterval(Vx,qx)),Tx=1,$x(Gx)))}function Jx(t){return t.x}function Zx(t){return t.y}Yx.prototype=Hx.prototype={constructor:Yx,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?Bx():+n)+(null==e?0:+e),this._next||Rx===this||(Rx?Rx._next=this:Nx=this,Rx=this),this._call=t,this._time=n,Xx()},stop:function(){this._call&&(this._call=null,this._time=1/0,Xx())}};var Qx=10,Kx=Math.PI*(3-Math.sqrt(5)),tw=function(c){var n,r=1,e=.001,i=1-Math.pow(e,1/300),a=0,o=.6,u=Nt(),t=Hx(f),s=It("tick","end");function f(){l(),s.call("tick",n),r<e&&(t.stop(),s.call("end",n))}function l(){var t,e,n=c.length;for(r+=(a-r)*i,u.each(function(t){t(r)}),t=0;t<n;++t)null==(e=c[t]).fx?e.x+=e.vx*=o:(e.x=e.fx,e.vx=0),null==e.fy?e.y+=e.vy*=o:(e.y=e.fy,e.vy=0)}function h(){for(var t,e=0,n=c.length;e<n;++e){if((t=c[e]).index=e,isNaN(t.x)||isNaN(t.y)){var r=Qx*Math.sqrt(e),i=e*Kx;t.x=r*Math.cos(i),t.y=r*Math.sin(i)}(isNaN(t.vx)||isNaN(t.vy))&&(t.vx=t.vy=0)}}function d(t){return t.initialize&&t.initialize(c),t}return null==c&&(c=[]),h(),n={tick:l,restart:function(){return t.restart(f),n},stop:function(){return t.stop(),n},nodes:function(t){return arguments.length?(c=t,h(),u.each(d),n):c},alpha:function(t){return arguments.length?(r=+t,n):r},alphaMin:function(t){return arguments.length?(e=+t,n):e},alphaDecay:function(t){return arguments.length?(i=+t,n):+i},alphaTarget:function(t){return arguments.length?(a=+t,n):a},velocityDecay:function(t){return arguments.length?(o=1-t,n):1-o},force:function(t,e){return 1<arguments.length?(null==e?u.remove(t):u.set(t,d(e)),n):u.get(t)},find:function(t,e,n){var r,i,a,o,u,s=0,f=c.length;for(null==n?n=1/0:n*=n,s=0;s<f;++s)(a=(r=t-(o=c[s]).x)*r+(i=e-o.y)*i)<n&&(u=o,n=a);return u},on:function(t,e){return 1<arguments.length?(s.on(t,e),n):s.on(t)}}},ew={center:function(a,o){var u;function e(){var t,e,n=u.length,r=0,i=0;for(t=0;t<n;++t)r+=(e=u[t]).x,i+=e.y;for(r=r/n-a,i=i/n-o,t=0;t<n;++t)(e=u[t]).x-=r,e.y-=i}return null==a&&(a=0),null==o&&(o=0),e.initialize=function(t){u=t},e.x=function(t){return arguments.length?(a=+t,e):a},e.y=function(t){return arguments.length?(o=+t,e):o},e},collide:function(r){var a,o,g=1,u=1;function e(){for(var t,e,l,h,d,p,v,n=a.length,r=0;r<u;++r)for(e=kx(a,Cx,zx).visitAfter(s),t=0;t<n;++t)l=a[t],p=o[l.index],v=p*p,h=l.x+l.vx,d=l.y+l.vy,e.visit(i);function i(t,e,n,r,i){var a=t.data,o=t.r,u=p+o;if(!a)return h+u<e||r<h-u||d+u<n||i<d-u;if(a.index>l.index){var s=h-a.x-a.vx,f=d-a.y-a.vy,c=s*s+f*f;c<u*u&&(0===s&&(c+=(s=bx())*s),0===f&&(c+=(f=bx())*f),c=(u-(c=Math.sqrt(c)))/c*g,l.vx+=(s*=c)*(u=(o*=o)/(v+o)),l.vy+=(f*=c)*u,a.vx-=s*(u=1-u),a.vy-=f*u)}}}function s(t){if(t.data)return t.r=o[t.data.index];for(var e=t.r=0;e<4;++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function n(){if(a){var t,e,n=a.length;for(o=new Array(n),t=0;t<n;++t)e=a[t],o[e.index]=+r(e,t,a)}}return"function"!=typeof r&&(r=yx(null==r?1:+r)),e.initialize=function(t){a=t,n()},e.iterations=function(t){return arguments.length?(u=+t,e):u},e.strength=function(t){return arguments.length?(g=+t,e):g},e.radius=function(t){return arguments.length?(r="function"==typeof t?t:yx(+t),n(),e):r},e},nbody:function(){var i,s,f,c,r=yx(-30),l=1,h=1/0,d=.81;function e(t){var e,n=i.length,r=kx(i,Jx,Zx).visitAfter(a);for(f=t,e=0;e<n;++e)s=i[e],r.visit(o)}function n(){if(i){var t,e,n=i.length;for(c=new Array(n),t=0;t<n;++t)e=i[t],c[e.index]=+r(e,t,i)}}function a(t){var e,n,r,i,a,o=0,u=0;if(t.length){for(r=i=a=0;a<4;++a)(e=t[a])&&(n=Math.abs(e.value))&&(o+=e.value,u+=n,r+=n*e.x,i+=n*e.y);t.x=r/u,t.y=i/u}else for((e=t).x=e.data.x,e.y=e.data.y;o+=c[e.data.index],e=e.next;);t.value=o}function o(t,e,n,r){if(!t.value)return!0;var i=t.x-s.x,a=t.y-s.y,o=r-e,u=i*i+a*a;if(o*o/d<u)return u<h&&(0===i&&(u+=(i=bx())*i),0===a&&(u+=(a=bx())*a),u<l&&(u=Math.sqrt(l*u)),s.vx+=i*t.value*f/u,s.vy+=a*t.value*f/u),!0;if(!(t.length||h<=u))for((t.data!==s||t.next)&&(0===i&&(u+=(i=bx())*i),0===a&&(u+=(a=bx())*a),u<l&&(u=Math.sqrt(l*u)));t.data!==s&&(o=c[t.data.index]*f/u,s.vx+=i*o,s.vy+=a*o),t=t.next;);}return e.initialize=function(t){i=t,n()},e.strength=function(t){return arguments.length?(r="function"==typeof t?t:yx(+t),n(),e):r},e.distanceMin=function(t){return arguments.length?(l=t*t,e):Math.sqrt(l)},e.distanceMax=function(t){return arguments.length?(h=t*t,e):Math.sqrt(h)},e.theta=function(t){return arguments.length?(d=t*t,e):Math.sqrt(d)},e},link:function(l){var h,d,a,o,p,u=Dx,n=function(t){return 1/Math.min(o[t.source.index],o[t.target.index])},r=yx(30),v=1;function e(t){for(var e=0,n=l.length;e<v;++e)for(var r,i,a,o,u,s,f,c=0;c<n;++c)i=(r=l[c]).source,o=(a=r.target).x+a.vx-i.x-i.vx||bx(),u=a.y+a.vy-i.y-i.vy||bx(),o*=s=((s=Math.sqrt(o*o+u*u))-d[c])/s*t*h[c],u*=s,a.vx-=o*(f=p[c]),a.vy-=u*f,i.vx+=o*(f=1-f),i.vy+=u*f}function i(){if(a){var t,e,n=a.length,r=l.length,i=Nt(a,u);for(t=0,o=new Array(n);t<r;++t)(e=l[t]).index=t,"object"!=typeof e.source&&(e.source=Ox(i,e.source)),"object"!=typeof e.target&&(e.target=Ox(i,e.target)),o[e.source.index]=(o[e.source.index]||0)+1,o[e.target.index]=(o[e.target.index]||0)+1;for(t=0,p=new Array(r);t<r;++t)e=l[t],p[t]=o[e.source.index]/(o[e.source.index]+o[e.target.index]);h=new Array(r),s(),d=new Array(r),f()}}function s(){if(a)for(var t=0,e=l.length;t<e;++t)h[t]=+n(l[t],t,l)}function f(){if(a)for(var t=0,e=l.length;t<e;++t)d[t]=+r(l[t],t,l)}return null==l&&(l=[]),e.initialize=function(t){a=t,i()},e.links=function(t){return arguments.length?(l=t,i(),e):l},e.id=function(t){return arguments.length?(u=t,e):u},e.iterations=function(t){return arguments.length?(v=+t,e):v},e.strength=function(t){return arguments.length?(n="function"==typeof t?t:yx(+t),s(),e):n},e.distance=function(t){return arguments.length?(r="function"==typeof t?t:yx(+t),f(),e):r},e},x:function(n){var i,a,o,r=yx(.1);function e(t){for(var e,n=0,r=i.length;n<r;++n)(e=i[n]).vx+=(o[n]-e.x)*a[n]*t}function u(){if(i){var t,e=i.length;for(a=new Array(e),o=new Array(e),t=0;t<e;++t)a[t]=isNaN(o[t]=+n(i[t],t,i))?0:+r(i[t],t,i)}}return"function"!=typeof n&&(n=yx(null==n?0:+n)),e.initialize=function(t){i=t,u()},e.strength=function(t){return arguments.length?(r="function"==typeof t?t:yx(+t),u(),e):r},e.x=function(t){return arguments.length?(n="function"==typeof t?t:yx(+t),u(),e):n},e},y:function(n){var i,a,o,r=yx(.1);function e(t){for(var e,n=0,r=i.length;n<r;++n)(e=i[n]).vy+=(o[n]-e.y)*a[n]*t}function u(){if(i){var t,e=i.length;for(a=new Array(e),o=new Array(e),t=0;t<e;++t)a[t]=isNaN(o[t]=+n(i[t],t,i))?0:+r(i[t],t,i)}}return"function"!=typeof n&&(n=yx(null==n?0:+n)),e.initialize=function(t){i=t,u()},e.strength=function(t){return arguments.length?(r="function"==typeof t?t:yx(+t),u(),e):r},e.y=function(t){return arguments.length?(n="function"==typeof t?t:yx(+t),u(),e):n},e}},nw="forces",rw=["alpha","alphaMin","alphaTarget","velocityDecay","forces"],iw=["static","iterations"],aw=["x","y","vx","vy"];function ow(t){Wr.call(this,null,t)}ow.Definition={type:"Force",metadata:{modifies:!0},params:[{name:"static",type:"boolean",default:!1},{name:"restart",type:"boolean",default:!1},{name:"iterations",type:"number",default:300},{name:"alpha",type:"number",default:1},{name:"alphaMin",type:"number",default:.001},{name:"alphaTarget",type:"number",default:0},{name:"velocityDecay",type:"number",default:.4},{name:"forces",type:"param",array:!0,params:[{key:{force:"center"},params:[{name:"x",type:"number",default:0},{name:"y",type:"number",default:0}]},{key:{force:"collide"},params:[{name:"radius",type:"number",expr:!0},{name:"strength",type:"number",default:.7},{name:"iterations",type:"number",default:1}]},{key:{force:"nbody"},params:[{name:"strength",type:"number",default:-30},{name:"theta",type:"number",default:.9},{name:"distanceMin",type:"number",default:1},{name:"distanceMax",type:"number"}]},{key:{force:"link"},params:[{name:"links",type:"data"},{name:"id",type:"field"},{name:"distance",type:"number",default:30,expr:!0},{name:"strength",type:"number",expr:!0},{name:"iterations",type:"number",default:1}]},{key:{force:"x"},params:[{name:"strength",type:"number",default:.1},{name:"x",type:"field"}]},{key:{force:"y"},params:[{name:"strength",type:"number",default:.1},{name:"y",type:"field"}]}]},{name:"as",type:"string",array:!0,modify:!1,default:aw}]};var uw=j(ow,Wr);function sw(t,e,n,r){var i,a,o,u,s=Q(e.forces);for(i=0,a=rw.length;i<a;++i)(o=rw[i])!==nw&&e.modified(o)&&t[o](e[o]);for(i=0,a=s.length;i<a;++i)u=nw+i,(o=n||e.modified(nw,i)?cw(s[i]):r&&fw(s[i],r)?t.force(u):null)&&t.force(u,o);for(a=t.numForces||0;i<a;++i)t.force(nw+i,null);return t.numForces=s.length,t}function fw(t,e){var n,r;for(n in t)if(R(r=t[n])&&e.modified(x(r)))return 1;return 0}function cw(t){var e,n;for(n in ew.hasOwnProperty(t.force)||rt("Unrecognized force: "+t.force),e=ew[t.force](),t)R(e[n])&&lw(e[n],t[n],t);return e}function lw(t,e,n){t(R(e)?function(t){return e(t,n)}:e)}uw.transform=function(t,e){var n,r,i,a,o,u,s,f,c=this.value,l=e.changed(e.ADD_REM),h=t.modified(rw),d=t.iterations||300;if(c?(l&&(e.modifies("index"),c.nodes(e.source)),(h||e.changed(e.MOD))&&sw(c,t,0,e)):(this.value=(i=e.source,a=t,o=tw(i),u=!1,s=o.stop,f=o.restart,o.stopped=function(){return u},o.restart=function(){return u=!1,f()},o.stop=function(){return u=!0,s()},c=sw(o,a,!0).on("end",function(){u=!0})),c.on("tick",(n=e.dataflow,r=this,function(){n.touch(r).run()})),t.static||(l=!0,c.tick()),e.modifies("index")),h||l||t.modified(iw)||e.changed()&&t.restart)if(c.alpha(Math.max(c.alpha(),t.alpha||1)).alphaDecay(1-Math.pow(c.alphaMin(),1/d)),t.static)for(c.stop();0<=--d;)c.tick();else if(c.stopped()&&c.restart(),!l)return e.StopPropagation;return this.finish(t,e)},uw.finish=function(t,e){for(var n,r=e.dataflow,i=this._argops,a=0,o=i.length;a<o;++a)if((n=i[a]).name===nw&&"link"===n.op._argval.force)for(var u,s=n.op._argops,f=0,c=s.length;f<c;++f)if("links"===s[f].name&&(u=s[f].op.source)){r.pulse(u,r.changeset().reflow());break}return e.reflow(t.modified()).modifies(aw)};var hw=Object.freeze({force:ow});function dw(t,e){return t.parent===e.parent?1:2}function pw(t,e){return t+e.x}function vw(t,e){return Math.max(t,e.y)}function gw(t){var e=0,n=t.children,r=n&&n.length;if(r)for(;0<=--r;)e+=n[r].value;else e=1;t.value=e}function mw(t,e){var n,r,i,a,o,u=new xw(t),s=+t.value&&(u.value=t.value),f=[u];for(null==e&&(e=yw);n=f.pop();)if(s&&(n.value=+n.data.value),(i=e(n.data))&&(o=i.length))for(n.children=new Array(o),a=o-1;0<=a;--a)f.push(r=n.children[a]=new xw(i[a])),r.parent=n,r.depth=n.depth+1;return u.eachBefore(_w)}function yw(t){return t.children}function bw(t){t.data=t.data.data}function _w(t){for(var e=0;t.height=e,(t=t.parent)&&t.height<++e;);}function xw(t){this.data=t,this.depth=this.height=0,this.parent=null}xw.prototype=mw.prototype={constructor:xw,count:function(){return this.eachAfter(gw)},each:function(t){var e,n,r,i,a=this,o=[a];do{for(e=o.reverse(),o=[];a=e.pop();)if(t(a),n=a.children)for(r=0,i=n.length;r<i;++r)o.push(n[r])}while(o.length);return this},eachAfter:function(t){for(var e,n,r,i=this,a=[i],o=[];i=a.pop();)if(o.push(i),e=i.children)for(n=0,r=e.length;n<r;++n)a.push(e[n]);for(;i=o.pop();)t(i);return this},eachBefore:function(t){for(var e,n,r=this,i=[r];r=i.pop();)if(t(r),e=r.children)for(n=e.length-1;0<=n;--n)i.push(e[n]);return this},sum:function(i){return this.eachAfter(function(t){for(var e=+i(t.data)||0,n=t.children,r=n&&n.length;0<=--r;)e+=n[r].value;t.value=e})},sort:function(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})},path:function(t){for(var e=this,n=function(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),i=null;for(t=n.pop(),e=r.pop();t===e;)i=t,t=n.pop(),e=r.pop();return i}(e,t),r=[e];e!==n;)e=e.parent,r.push(e);for(var i=r.length;t!==n;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){var e=[];return this.each(function(t){e.push(t)}),e},leaves:function(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e},links:function(){var e=this,n=[];return e.each(function(t){t!==e&&n.push({source:t.parent,target:t})}),n},copy:function(){return mw(this).eachBefore(bw)}};var ww=Array.prototype.slice;var Mw=function(t){for(var e,n,r=0,i=(t=function(t){for(var e,n,r=t.length;r;)n=Math.random()*r--|0,e=t[r],t[r]=t[n],t[n]=e;return t}(ww.call(t))).length,a=[];r<i;)e=t[r],n&&Sw(n,e)?++r:(n=Cw(a=kw(a,e)),r=0);return n};function kw(t,e){var n,r;if(Aw(e,t))return[e];for(n=0;n<t.length;++n)if(Ew(e,t[n])&&Aw(zw(t[n],e),t))return[t[n],e];for(n=0;n<t.length-1;++n)for(r=n+1;r<t.length;++r)if(Ew(zw(t[n],t[r]),e)&&Ew(zw(t[n],e),t[r])&&Ew(zw(t[r],e),t[n])&&Aw(Dw(t[n],t[r],e),t))return[t[n],t[r],e];throw new Error}function Ew(t,e){var n=t.r-e.r,r=e.x-t.x,i=e.y-t.y;return n<0||n*n<r*r+i*i}function Sw(t,e){var n=t.r-e.r+1e-6,r=e.x-t.x,i=e.y-t.y;return 0<n&&r*r+i*i<n*n}function Aw(t,e){for(var n=0;n<e.length;++n)if(!Sw(t,e[n]))return!1;return!0}function Cw(t){switch(t.length){case 1:return{x:(e=t[0]).x,y:e.y,r:e.r};case 2:return zw(t[0],t[1]);case 3:return Dw(t[0],t[1],t[2])}var e}function zw(t,e){var n=t.x,r=t.y,i=t.r,a=e.x,o=e.y,u=e.r,s=a-n,f=o-r,c=u-i,l=Math.sqrt(s*s+f*f);return{x:(n+a+s/l*c)/2,y:(r+o+f/l*c)/2,r:(l+i+u)/2}}function Dw(t,e,n){var r=t.x,i=t.y,a=t.r,o=e.x,u=e.y,s=e.r,f=n.x,c=n.y,l=n.r,h=r-o,d=r-f,p=i-u,v=i-c,g=s-a,m=l-a,y=r*r+i*i-a*a,b=y-o*o-u*u+s*s,_=y-f*f-c*c+l*l,x=d*p-h*v,w=(p*_-v*b)/(2*x)-r,M=(v*g-p*m)/x,k=(d*b-h*_)/(2*x)-i,E=(h*m-d*g)/x,S=M*M+E*E-1,A=2*(a+w*M+k*E),C=w*w+k*k-a*a,z=-(S?(A+Math.sqrt(A*A-4*S*C))/(2*S):C/A);return{x:r+w+M*z,y:i+k+E*z,r:z}}function Ow(t,e,n){var r=t.x,i=t.y,a=e.r+n.r,o=t.r+n.r,u=e.x-r,s=e.y-i,f=u*u+s*s;if(f){var c=.5+((o*=o)-(a*=a))/(2*f),l=Math.sqrt(Math.max(0,2*a*(o+f)-(o-=f)*o-a*a))/(2*f);n.x=r+c*u+l*s,n.y=i+c*s-l*u}else n.x=r+o,n.y=i}function Nw(t,e){var n=e.x-t.x,r=e.y-t.y,i=t.r+e.r;return n*n+r*r<i*i-1e-6}function Rw(t){var e=t._,n=t.next._,r=e.r+n.r,i=(e.x*n.r+n.x*e.r)/r,a=(e.y*n.r+n.y*e.r)/r;return i*i+a*a}function Tw(t){this._=t,this.next=null,this.previous=null}function Pw(t){if("function"!=typeof t)throw new Error;return t}function Lw(){return 0}var qw=function(t){return function(){return t}};function Uw(t){return Math.sqrt(t.value)}function Fw(e){return function(t){t.children||(t.r=Math.max(0,+e(t)||0))}}function jw(o,u){return function(t){if(e=t.children){var e,n,r,i=e.length,a=o(t)*u||0;if(a)for(n=0;n<i;++n)e[n].r+=a;if(r=function(t){if(!(i=t.length))return 0;var e,n,r,i,a,o,u,s,f,c,l;if((e=t[0]).x=0,e.y=0,!(1<i))return e.r;if(n=t[1],e.x=-n.r,n.x=e.r,n.y=0,!(2<i))return e.r+n.r;Ow(n,e,r=t[2]),e=new Tw(e),n=new Tw(n),r=new Tw(r),e.next=r.previous=n,n.next=e.previous=r,r.next=n.previous=e;t:for(u=3;u<i;++u){Ow(e._,n._,r=t[u]),r=new Tw(r),s=n.next,f=e.previous,c=n._.r,l=e._.r;do{if(c<=l){if(Nw(s._,r._)){n=s,(e.next=n).previous=e,--u;continue t}c+=s._.r,s=s.next}else{if(Nw(f._,r._)){((e=f).next=n).previous=e,--u;continue t}l+=f._.r,f=f.previous}}while(s!==f.next);for(r.previous=e,r.next=n,e.next=n.previous=n=r,a=Rw(e);(r=r.next)!==n;)(o=Rw(r))<a&&(e=r,a=o);n=e.next}for(e=[n._],r=n;(r=r.next)!==n;)e.push(r._);for(r=Mw(e),u=0;u<i;++u)(e=t[u]).x-=r.x,e.y-=r.y;return r.r}(e),a)for(n=0;n<i;++n)e[n].r-=a;t.r=r+a}}}function Iw(n){return function(t){var e=t.parent;t.r*=n,e&&(t.x=e.x+n*t.x,t.y=e.y+n*t.y)}}var $w=function(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)},Bw=function(t,e,n,r,i){for(var a,o=t.children,u=-1,s=o.length,f=t.value&&(r-e)/t.value;++u<s;)(a=o[u]).y0=n,a.y1=i,a.x0=e,a.x1=e+=a.value*f},Ww="$",Yw={depth:-1},Hw={};function Gw(t){return t.id}function Vw(t){return t.parentId}function Xw(t,e){return t.parent===e.parent?1:2}function Jw(t){var e=t.children;return e?e[0]:t.t}function Zw(t){var e=t.children;return e?e[e.length-1]:t.t}function Qw(t,e){this._=t,this.parent=null,this.children=null,this.A=null,(this.a=this).z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=e}Qw.prototype=Object.create(xw.prototype);var Kw=function(t,e,n,r,i){for(var a,o=t.children,u=-1,s=o.length,f=t.value&&(i-n)/t.value;++u<s;)(a=o[u]).x0=e,a.x1=r,a.y0=n,a.y1=n+=a.value*f},tM=(1+Math.sqrt(5))/2;function eM(t,e,n,r,i,a){for(var o,u,s,f,c,l,h,d,p,v,g,m=[],y=e.children,b=0,_=0,x=y.length,w=e.value;b<x;){for(s=i-n,f=a-r;!(c=y[_++].value)&&_<x;);for(l=h=c,g=c*c*(v=Math.max(f/s,s/f)/(w*t)),p=Math.max(h/g,g/l);_<x;++_){if(c+=u=y[_].value,u<l&&(l=u),h<u&&(h=u),g=c*c*v,p<(d=Math.max(h/g,g/l))){c-=u;break}p=d}m.push(o={value:c,dice:s<f,children:y.slice(b,_)}),o.dice?Bw(o,n,r,i,w?r+=f*c/w:a):Kw(o,n,r,w?n+=s*c/w:i,a),w-=c,b=_}return m}var nM=function e(a){function t(t,e,n,r,i){eM(a,t,e,n,r,i)}return t.ratio=function(t){return e(1<(t=+t)?t:1)},t}(tM),rM=function e(d){function t(t,e,n,r,i){if((a=t._squarify)&&a.ratio===d)for(var a,o,u,s,f,c=-1,l=a.length,h=t.value;++c<l;){for(u=(o=a[c]).children,s=o.value=0,f=u.length;s<f;++s)o.value+=u[s].value;o.dice?Bw(o,e,n,r,n+=(i-n)*o.value/h):Kw(o,e,n,e+=(r-e)*o.value/h,i),h-=o.value}else t._squarify=a=eM(d,t,e,n,r,i),a.ratio=d}return t.ratio=function(t){return e(1<(t=+t)?t:1)},t}(tM);function iM(t){Wr.call(this,null,t)}function aM(t){return t.values}function oM(t){Wr.call(this,null,t)}iM.Definition={type:"Nest",metadata:{treesource:!0,generates:!0},params:[{name:"keys",type:"field",array:!0},{name:"key",type:"field"},{name:"generate",type:"boolean"}]},j(iM,Wr).transform=function(t,e){e.source||rt("Nest transform requires an upstream data source.");var n,r,i,a=t.key||ct,o=t.generate,u=t.modified(),s=o||u?e.fork(e.ALL):e;return(!this.value||u||e.changed())&&(o&&this.value&&(s.materialize(s.REM),this.value.each(function(t){t.children&&s.rem.push(t)})),n=Q(t.keys).reduce(function(t,e){return t.key(e),t},Rt()).entries(s.materialize(s.SOURCE).source),this.value=r=mw({values:n},aM),o&&(s.materialize(s.ADD),s.source=s.source.slice(),r.each(function(t){t.children&&(t=ht(t.data),s.add.push(t),s.source.push(t))})),i=r.lookup={},r.each(function(t){null!=ct(t.data)&&(i[a(t.data)]=t)})),s.source.root=this.value,s},j(oM,Wr).transform=function(t,e){e.source&&e.source.root||rt(this.constructor.name+" transform requires a backing tree data source.");var n=this.layout(t.method),r=this.fields,i=e.source.root,a=t.as||r;t.field&&i.sum(t.field),t.sort&&i.sort(t.sort),function(t,e,n){for(var r,i=0,a=e.length;i<a;++i)(r=e[i])in n&&t[r](n[r])}(n,this.params,t);try{this.value=n(i)}catch(t){rt(t)}return i.each(function(t){!function(t,e,n){for(var r=t.data,i=0,a=e.length-1;i<a;++i)r[n[i]]=t[e[i]];r[n[a]]=t.children?t.children.length:0}(t,r,a)}),e.reflow(t.modified()).modifies(a).modifies("leaf")};var uM=["x","y","r","depth","children"];function sM(t){oM.call(this,t)}sM.Definition={type:"Pack",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"padding",type:"number",default:0},{name:"radius",type:"field",default:null},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:3,default:uM}]};var fM=j(sM,oM);fM.layout=function(){var n=null,e=1,r=1,i=Lw;function a(t){return t.x=e/2,t.y=r/2,n?t.eachBefore(Fw(n)).eachAfter(jw(i,.5)).eachBefore(Iw(1)):t.eachBefore(Fw(Uw)).eachAfter(jw(Lw,1)).eachAfter(jw(i,t.r/Math.min(e,r))).eachBefore(Iw(Math.min(e,r)/(2*t.r))),t}return a.radius=function(t){return arguments.length?(n=null==(e=t)?null:Pw(e),a):n;var e},a.size=function(t){return arguments.length?(e=+t[0],r=+t[1],a):[e,r]},a.padding=function(t){return arguments.length?(i="function"==typeof t?t:qw(+t),a):i},a},fM.params=["size","padding"],fM.fields=uM;var cM=["x0","y0","x1","y1","depth","children"];function lM(t){oM.call(this,t)}lM.Definition={type:"Partition",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"padding",type:"number",default:0},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:4,default:cM}]};var hM=j(lM,oM);function dM(t){Wr.call(this,null,t)}hM.layout=function(){var n=1,r=1,u=0,i=!1;function e(t){var a,o,e=t.height+1;return t.x0=t.y0=u,t.x1=n,t.y1=r/e,t.eachBefore((a=r,o=e,function(t){t.children&&Bw(t,t.x0,a*(t.depth+1)/o,t.x1,a*(t.depth+2)/o);var e=t.x0,n=t.y0,r=t.x1-u,i=t.y1-u;r<e&&(e=r=(e+r)/2),i<n&&(n=i=(n+i)/2),t.x0=e,t.y0=n,t.x1=r,t.y1=i})),i&&t.eachBefore($w),t}return e.round=function(t){return arguments.length?(i=!!t,e):i},e.size=function(t){return arguments.length?(n=+t[0],r=+t[1],e):[n,r]},e.padding=function(t){return arguments.length?(u=+t,e):u},e},hM.params=["size","round","padding"],hM.fields=cM,dM.Definition={type:"Stratify",metadata:{treesource:!0},params:[{name:"key",type:"field",required:!0},{name:"parentKey",type:"field",required:!0}]},j(dM,Wr).transform=function(e,t){t.source||rt("Stratify transform requires an upstream data source.");var n,r,i=e.modified();return(!this.value||i||t.changed(t.ADD_REM)||t.modified(e.key.fields)||t.modified(e.parentKey.fields))&&(n=function(){var l=Gw,h=Vw;function e(t){var e,n,r,i,a,o,u,s=t.length,f=new Array(s),c={};for(n=0;n<s;++n)e=t[n],a=f[n]=new xw(e),null!=(o=l(e,n,t))&&(o+="")&&(c[u=Ww+(a.id=o)]=u in c?Hw:a);for(n=0;n<s;++n)if(a=f[n],null!=(o=h(t[n],n,t))&&(o+="")){if(!(i=c[Ww+o]))throw new Error("missing: "+o);if(i===Hw)throw new Error("ambiguous: "+o);i.children?i.children.push(a):i.children=[a],a.parent=i}else{if(r)throw new Error("multiple roots");r=a}if(!r)throw new Error("no root");if(r.parent=Yw,r.eachBefore(function(t){t.depth=t.parent.depth+1,--s}).eachBefore(_w),r.parent=null,0<s)throw new Error("cycle");return r}return e.id=function(t){return arguments.length?(l=Pw(t),e):l},e.parentId=function(t){return arguments.length?(h=Pw(t),e):h},e}().id(e.key).parentId(e.parentKey)(t.source),r=n.lookup={},n.each(function(t){r[e.key(t.data)]=t}),this.value=n),t.source.root=this.value,i?t.fork(t.ALL):t};var pM={tidy:function(){var b=Xw,f=1,c=1,l=null;function e(t){var e=function(t){for(var e,n,r,i,a,o=new Qw(t,0),u=[o];e=u.pop();)if(r=e._.children)for(e.children=new Array(a=r.length),i=a-1;0<=i;--i)u.push(n=e.children[i]=new Qw(r[i],i)),n.parent=e;return(o.parent=new Qw(null,0)).children=[o],o}(t);if(e.eachAfter(h),e.parent.m=-e.z,e.eachBefore(d),l)t.eachBefore(p);else{var n=t,r=t,i=t;t.eachBefore(function(t){t.x<n.x&&(n=t),t.x>r.x&&(r=t),t.depth>i.depth&&(i=t)});var a=n===r?1:b(n,r)/2,o=a-n.x,u=f/(r.x+a+o),s=c/(i.depth||1);t.eachBefore(function(t){t.x=(t.x+o)*u,t.y=t.depth*s})}return t}function h(t){var e=t.children,n=t.parent.children,r=t.i?n[t.i-1]:null;if(e){!function(t){for(var e,n=0,r=0,i=t.children,a=i.length;0<=--a;)(e=i[a]).z+=n,e.m+=n,n+=e.s+(r+=e.c)}(t);var i=(e[0].z+e[e.length-1].z)/2;r?(t.z=r.z+b(t._,r._),t.m=t.z-i):t.z=i}else r&&(t.z=r.z+b(t._,r._));t.parent.A=function(t,e,n){if(e){for(var r,i=t,a=t,o=e,u=i.parent.children[0],s=i.m,f=a.m,c=o.m,l=u.m;o=Zw(o),i=Jw(i),o&&i;)u=Jw(u),(a=Zw(a)).a=t,0<(r=o.z+c-i.z-s+b(o._,i._))&&(m=t,y=n,h=(g=o).a.parent===m.parent?g.a:y,v=(p=r)/((d=t).i-h.i),d.c-=v,d.s+=p,h.c+=v,d.z+=p,d.m+=p,s+=r,f+=r),c+=o.m,s+=i.m,l+=u.m,f+=a.m;o&&!Zw(a)&&(a.t=o,a.m+=c-f),i&&!Jw(u)&&(u.t=i,u.m+=s-l,n=t)}var h,d,p,v,g,m,y;return n}(t,r,t.parent.A||n[0])}function d(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function p(t){t.x*=f,t.y=t.depth*c}return e.separation=function(t){return arguments.length?(b=t,e):b},e.size=function(t){return arguments.length?(l=!1,f=+t[0],c=+t[1],e):l?null:[f,c]},e.nodeSize=function(t){return arguments.length?(l=!0,f=+t[0],c=+t[1],e):l?[f,c]:null},e},cluster:function(){var u=dw,s=1,f=1,c=!1;function e(e){var r,i=0;e.eachAfter(function(t){var e,n=t.children;n?(t.x=(e=n).reduce(pw,0)/e.length,t.y=1+n.reduce(vw,0)):(t.x=r?i+=u(t,r):0,t.y=0,r=t)});var t=function(t){for(var e;e=t.children;)t=e[0];return t}(e),n=function(t){for(var e;e=t.children;)t=e[e.length-1];return t}(e),a=t.x-u(t,n)/2,o=n.x+u(n,t)/2;return e.eachAfter(c?function(t){t.x=(t.x-e.x)*s,t.y=(e.y-t.y)*f}:function(t){t.x=(t.x-a)/(o-a)*s,t.y=(1-(e.y?t.y/e.y:1))*f})}return e.separation=function(t){return arguments.length?(u=t,e):u},e.size=function(t){return arguments.length?(c=!1,s=+t[0],f=+t[1],e):c?null:[s,f]},e.nodeSize=function(t){return arguments.length?(c=!0,s=+t[0],f=+t[1],e):c?[s,f]:null},e}},vM=["x","y","depth","children"];function gM(t){oM.call(this,t)}gM.Definition={type:"Tree",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"tidy",values:["tidy","cluster"]},{name:"size",type:"number",array:!0,length:2},{name:"nodeSize",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:4,default:vM}]};var mM=j(gM,oM);function yM(t){Wr.call(this,{},t)}mM.layout=function(t){var e=t||"tidy";if(pM.hasOwnProperty(e))return pM[e]();rt("Unrecognized Tree layout method: "+e)},mM.params=["size","nodeSize","separation"],mM.fields=vM,yM.Definition={type:"TreeLinks",metadata:{tree:!0,generates:!0,changes:!0},params:[{name:"key",type:"field"}]},j(yM,Wr).transform=function(t,e){e.source&&e.source.root||rt("TreeLinks transform requires a backing tree data source.");var a=e.source.root.lookup,o=this.value,u=t.key||ct,s={},f=e.fork();function c(t){var e=o[t];e&&(s[t]=1,f.mod.push(e))}return e.visit(e.REM,function(t){var e=u(t),n=o[e];n&&(delete o[e],f.rem.push(n))}),e.visit(e.ADD,function(t){var e,n,r,i=u(t);(e=(n=a[i]).parent&&(r=n.parent.data)&&null!=ct(r)&&r)&&(f.add.push(o[i]=ht({source:e,target:t})),s[i]=1)}),e.visit(e.MOD,function(t){var e=u(t),n=a[e].children;if(c(e),n)for(var r=0,i=n.length;r<i;++r)s[e=u(n[r].data)]||c(e)}),f};var bM={binary:function(t,e,n,r,i){var a,o,y=t.children,u=y.length,b=new Array(u+1);for(b[0]=o=a=0;a<u;++a)b[a+1]=o+=y[a].value;!function t(e,n,r,i,a,o,u){if(n-1<=e){var s=y[e];return s.x0=i,s.y0=a,s.x1=o,void(s.y1=u)}for(var f=b[e],c=r/2+f,l=e+1,h=n-1;l<h;){var d=l+h>>>1;b[d]<c?l=d+1:h=d}c-b[l-1]<b[l]-c&&e+1<l&&--l;var p=b[l]-f,v=r-p;if(u-a<o-i){var g=(i*v+o*p)/r;t(e,l,p,i,a,g,u),t(l,n,v,g,a,o,u)}else{var m=(a*v+u*p)/r;t(e,l,p,i,a,o,m),t(l,n,v,i,m,o,u)}}(0,u,t.value,e,n,r,i)},dice:Bw,slice:Kw,slicedice:function(t,e,n,r,i){(1&t.depth?Kw:Bw)(t,e,n,r,i)},squarify:nM,resquarify:rM},_M=["x0","y0","x1","y1","depth","children"];function xM(t){oM.call(this,t)}xM.Definition={type:"Treemap",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"squarify",values:["squarify","resquarify","binary","dice","slice","slicedice"]},{name:"padding",type:"number",default:0},{name:"paddingInner",type:"number",default:0},{name:"paddingOuter",type:"number",default:0},{name:"paddingTop",type:"number",default:0},{name:"paddingRight",type:"number",default:0},{name:"paddingBottom",type:"number",default:0},{name:"paddingLeft",type:"number",default:0},{name:"ratio",type:"number",default:1.618033988749895},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:4,default:_M}]};var wM=j(xM,oM);wM.layout=function(){var n=function(){var o=nM,e=!1,n=1,r=1,u=[0],s=Lw,f=Lw,c=Lw,l=Lw,h=Lw;function i(t){return t.x0=t.y0=0,t.x1=n,t.y1=r,t.eachBefore(a),u=[0],e&&t.eachBefore($w),t}function a(t){var e=u[t.depth],n=t.x0+e,r=t.y0+e,i=t.x1-e,a=t.y1-e;i<n&&(n=i=(n+i)/2),a<r&&(r=a=(r+a)/2),t.x0=n,t.y0=r,t.x1=i,t.y1=a,t.children&&(e=u[t.depth+1]=s(t)/2,n+=h(t)-e,r+=f(t)-e,(i-=c(t)-e)<n&&(n=i=(n+i)/2),(a-=l(t)-e)<r&&(r=a=(r+a)/2),o(t,n,r,i,a))}return i.round=function(t){return arguments.length?(e=!!t,i):e},i.size=function(t){return arguments.length?(n=+t[0],r=+t[1],i):[n,r]},i.tile=function(t){return arguments.length?(o=Pw(t),i):o},i.padding=function(t){return arguments.length?i.paddingInner(t).paddingOuter(t):i.paddingInner()},i.paddingInner=function(t){return arguments.length?(s="function"==typeof t?t:qw(+t),i):s},i.paddingOuter=function(t){return arguments.length?i.paddingTop(t).paddingRight(t).paddingBottom(t).paddingLeft(t):i.paddingTop()},i.paddingTop=function(t){return arguments.length?(f="function"==typeof t?t:qw(+t),i):f},i.paddingRight=function(t){return arguments.length?(c="function"==typeof t?t:qw(+t),i):c},i.paddingBottom=function(t){return arguments.length?(l="function"==typeof t?t:qw(+t),i):l},i.paddingLeft=function(t){return arguments.length?(h="function"==typeof t?t:qw(+t),i):h},i}();return n.ratio=function(t){var e=n.tile();e.ratio&&n.tile(e.ratio(t))},n.method=function(t){bM.hasOwnProperty(t)?n.tile(bM[t]):rt("Unrecognized Treemap layout method: "+t)},n},wM.params=["method","ratio","size","round","padding","paddingInner","paddingOuter","paddingTop","paddingRight","paddingBottom","paddingLeft"],wM.fields=_M;var MM=Object.freeze({nest:iM,pack:sM,partition:lM,stratify:dM,tree:gM,treelinks:yM,treemap:xM}),kM=function(t){return function(){return t}};function EM(t){return t[0]}function SM(t){return t[1]}function AM(){this._=null}function CM(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function zM(t,e){var n=e,r=e.R,i=n.U;i?i.L===n?i.L=r:i.R=r:t._=r,r.U=i,n.U=r,n.R=r.L,n.R&&(n.R.U=n),r.L=n}function DM(t,e){var n=e,r=e.L,i=n.U;i?i.L===n?i.L=r:i.R=r:t._=r,r.U=i,n.U=r,n.L=r.R,n.L&&(n.L.U=n),r.R=n}function OM(t){for(;t.L;)t=t.L;return t}function NM(t,e,n,r){var i=[null,null],a=QM.push(i)-1;return i.left=t,i.right=e,n&&TM(i,t,e,n),r&&TM(i,e,t,r),JM[t.index].halfedges.push(a),JM[e.index].halfedges.push(a),i}function RM(t,e,n){var r=[e,n];return r.left=t,r}function TM(t,e,n,r){t[0]||t[1]?t.left===n?t[1]=r:t[0]=r:(t[0]=r,t.left=e,t.right=n)}function PM(t,e,n,r,i){var a,o=t[0],u=t[1],s=o[0],f=o[1],c=0,l=1,h=u[0]-s,d=u[1]-f;if(a=e-s,h||!(0<a)){if(a/=h,h<0){if(a<c)return;a<l&&(l=a)}else if(0<h){if(l<a)return;c<a&&(c=a)}if(a=r-s,h||!(a<0)){if(a/=h,h<0){if(l<a)return;c<a&&(c=a)}else if(0<h){if(a<c)return;a<l&&(l=a)}if(a=n-f,d||!(0<a)){if(a/=d,d<0){if(a<c)return;a<l&&(l=a)}else if(0<d){if(l<a)return;c<a&&(c=a)}if(a=i-f,d||!(a<0)){if(a/=d,d<0){if(l<a)return;c<a&&(c=a)}else if(0<d){if(a<c)return;a<l&&(l=a)}return(0<c||l<1)&&(0<c&&(t[0]=[s+c*h,f+c*d]),l<1&&(t[1]=[s+l*h,f+l*d])),!0}}}}}function LM(t,e,n,r,i){var a=t[1];if(a)return!0;var o,u,s=t[0],f=t.left,c=t.right,l=f[0],h=f[1],d=c[0],p=c[1],v=(l+d)/2,g=(h+p)/2;if(p===h){if(v<e||r<=v)return;if(d<l){if(s){if(s[1]>=i)return}else s=[v,n];a=[v,i]}else{if(s){if(s[1]<n)return}else s=[v,i];a=[v,n]}}else if(u=g-(o=(l-d)/(p-h))*v,o<-1||1<o)if(d<l){if(s){if(s[1]>=i)return}else s=[(n-u)/o,n];a=[(i-u)/o,i]}else{if(s){if(s[1]<n)return}else s=[(i-u)/o,i];a=[(n-u)/o,n]}else if(h<p){if(s){if(s[0]>=r)return}else s=[e,o*e+u];a=[r,o*r+u]}else{if(s){if(s[0]<e)return}else s=[r,o*r+u];a=[e,o*e+u]}return t[0]=s,t[1]=a,!0}function qM(t,e){return e[+(e.left!==t.site)]}AM.prototype={constructor:AM,insert:function(t,e){var n,r,i;if(t){if(e.P=t,e.N=t.N,t.N&&(t.N.P=e),t.N=e,t.R){for(t=t.R;t.L;)t=t.L;t.L=e}else t.R=e;n=t}else this._?(t=OM(this._),e.P=null,(e.N=t).P=t.L=e,n=t):(e.P=e.N=null,this._=e,n=null);for(e.L=e.R=null,e.U=n,e.C=!0,t=e;n&&n.C;)n===(r=n.U).L?(i=r.R)&&i.C?(n.C=i.C=!1,r.C=!0,t=r):(t===n.R&&(zM(this,n),n=(t=n).U),n.C=!1,r.C=!0,DM(this,r)):(i=r.L)&&i.C?(n.C=i.C=!1,r.C=!0,t=r):(t===n.L&&(DM(this,n),n=(t=n).U),n.C=!1,r.C=!0,zM(this,r)),n=t.U;this._.C=!1},remove:function(t){t.N&&(t.N.P=t.P),t.P&&(t.P.N=t.N),t.N=t.P=null;var e,n,r,i=t.U,a=t.L,o=t.R;if(n=a?o?OM(o):a:o,i?i.L===t?i.L=n:i.R=n:this._=n,a&&o?(r=n.C,n.C=t.C,((n.L=a).U=n)!==o?(i=n.U,n.U=t.U,t=n.R,i.L=t,(n.R=o).U=n):(n.U=i,t=(i=n).R)):(r=t.C,t=n),t&&(t.U=i),!r)if(t&&t.C)t.C=!1;else{do{if(t===this._)break;if(t===i.L){if((e=i.R).C&&(e.C=!1,i.C=!0,zM(this,i),e=i.R),e.L&&e.L.C||e.R&&e.R.C){e.R&&e.R.C||(e.L.C=!1,e.C=!0,DM(this,e),e=i.R),e.C=i.C,i.C=e.R.C=!1,zM(this,i),t=this._;break}}else if((e=i.L).C&&(e.C=!1,i.C=!0,DM(this,i),e=i.L),e.L&&e.L.C||e.R&&e.R.C){e.L&&e.L.C||(e.R.C=!1,e.C=!0,zM(this,e),e=i.L),e.C=i.C,i.C=e.L.C=!1,DM(this,i),t=this._;break}e.C=!0,i=(t=i).U}while(!t.C);t&&(t.C=!1)}}};var UM,FM=[];function jM(t){var e=t.P,n=t.N;if(e&&n){var r=e.site,i=t.site,a=n.site;if(r!==a){var o=i[0],u=i[1],s=r[0]-o,f=r[1]-u,c=a[0]-o,l=a[1]-u,h=2*(s*l-f*c);if(!(-tk<=h)){var d=s*s+f*f,p=c*c+l*l,v=(l*d-f*p)/h,g=(s*p-c*d)/h,m=FM.pop()||new function(){CM(this),this.x=this.y=this.arc=this.site=this.cy=null};m.arc=t,m.site=i,m.x=v+o,m.y=(m.cy=g+u)+Math.sqrt(v*v+g*g),t.circle=m;for(var y=null,b=ZM._;b;)if(m.y<b.y||m.y===b.y&&m.x<=b.x){if(!b.L){y=b.P;break}b=b.L}else{if(!b.R){y=b;break}b=b.R}ZM.insert(y,m),y||(UM=m)}}}}function IM(t){var e=t.circle;e&&(e.P||(UM=e.N),ZM.remove(e),FM.push(e),CM(e),t.circle=null)}var $M=[];function BM(t){var e=$M.pop()||new function(){CM(this),this.edge=this.site=this.circle=null};return e.site=t,e}function WM(t){IM(t),XM.remove(t),$M.push(t),CM(t)}function YM(t){var e=t.circle,n=e.x,r=e.cy,i=[n,r],a=t.P,o=t.N,u=[t];WM(t);for(var s=a;s.circle&&Math.abs(n-s.circle.x)<KM&&Math.abs(r-s.circle.cy)<KM;)a=s.P,u.unshift(s),WM(s),s=a;u.unshift(s),IM(s);for(var f=o;f.circle&&Math.abs(n-f.circle.x)<KM&&Math.abs(r-f.circle.cy)<KM;)o=f.N,u.push(f),WM(f),f=o;u.push(f),IM(f);var c,l=u.length;for(c=1;c<l;++c)f=u[c],s=u[c-1],TM(f.edge,s.site,f.site,i);s=u[0],(f=u[l-1]).edge=NM(s.site,f.site,null,i),jM(s),jM(f)}function HM(t){for(var e,n,r,i,a,o=t[0],u=t[1],s=XM._;s;)if(r=GM(s,u)-o,KM<r)s=s.L;else{if(i=o-VM(s,u),!(KM<i)){-KM<r?(e=s.P,n=s):-KM<i?n=(e=s).N:e=n=s;break}if(!s.R){e=s;break}s=s.R}JM[(a=t).index]={site:a,halfedges:[]};var f=BM(t);if(XM.insert(e,f),e||n){if(e===n)return IM(e),n=BM(e.site),XM.insert(f,n),f.edge=n.edge=NM(e.site,f.site),jM(e),void jM(n);if(n){IM(e),IM(n);var c=e.site,l=c[0],h=c[1],d=t[0]-l,p=t[1]-h,v=n.site,g=v[0]-l,m=v[1]-h,y=2*(d*m-p*g),b=d*d+p*p,_=g*g+m*m,x=[(m*b-p*_)/y+l,(d*_-g*b)/y+h];TM(n.edge,c,v,x),f.edge=NM(c,t,null,x),n.edge=NM(t,v,null,x),jM(e),jM(n)}else f.edge=NM(e.site,f.site)}}function GM(t,e){var n=t.site,r=n[0],i=n[1],a=i-e;if(!a)return r;var o=t.P;if(!o)return-1/0;var u=(n=o.site)[0],s=n[1],f=s-e;if(!f)return u;var c=u-r,l=1/a-1/f,h=c/f;return l?(-h+Math.sqrt(h*h-2*l*(c*c/(-2*f)-s+f/2+i-a/2)))/l+r:(r+u)/2}function VM(t,e){var n=t.N;if(n)return GM(n,e);var r=t.site;return r[1]===e?r[0]:1/0}var XM,JM,ZM,QM,KM=1e-6,tk=1e-12;function ek(t,e){return e[1]-t[1]||e[0]-t[0]}function nk(t,e){var n,r,i,a=t.sort(ek).pop();for(QM=[],JM=new Array(t.length),XM=new AM,ZM=new AM;;)if(i=UM,a&&(!i||a[1]<i.y||a[1]===i.y&&a[0]<i.x))a[0]===n&&a[1]===r||(HM(a),n=a[0],r=a[1]),a=t.pop();else{if(!i)break;YM(i.arc)}if(function(){for(var t,e,n,r,i=0,a=JM.length;i<a;++i)if((t=JM[i])&&(r=(e=t.halfedges).length)){var o=new Array(r),u=new Array(r);for(n=0;n<r;++n)o[n]=n,u[n]=(s=t,f=QM[e[n]],h=l=void 0,c=s.site,l=f.left,h=f.right,c===h&&(h=l,l=c),h?Math.atan2(h[1]-l[1],h[0]-l[0]):(c===l?(l=f[1],h=f[0]):(l=f[0],h=f[1]),Math.atan2(l[0]-h[0],h[1]-l[1])));for(o.sort(function(t,e){return u[e]-u[t]}),n=0;n<r;++n)u[n]=e[o[n]];for(n=0;n<r;++n)e[n]=u[n]}var s,f,c,l,h}(),e){var o=+e[0][0],u=+e[0][1],s=+e[1][0],f=+e[1][1];!function(t,e,n,r){for(var i,a=QM.length;a--;)LM(i=QM[a],t,e,n,r)&&PM(i,t,e,n,r)&&(Math.abs(i[0][0]-i[1][0])>KM||Math.abs(i[0][1]-i[1][1])>KM)||delete QM[a]}(o,u,s,f),function(t,e,n,r){var i,a,o,u,s,f,c,l,h,d,p,v,g,m,y=JM.length,b=!0;for(i=0;i<y;++i)if(a=JM[i]){for(o=a.site,u=(s=a.halfedges).length;u--;)QM[s[u]]||s.splice(u,1);for(u=0,f=s.length;u<f;)g=a,p=(d=(m=QM[s[u]])[+(m.left===g.site)])[0],v=d[1],l=(c=qM(a,QM[s[++u%f]]))[0],h=c[1],(Math.abs(p-l)>KM||Math.abs(v-h)>KM)&&(s.splice(u,0,QM.push(RM(o,d,Math.abs(p-t)<KM&&KM<r-v?[t,Math.abs(l-t)<KM?h:r]:Math.abs(v-r)<KM&&KM<n-p?[Math.abs(h-r)<KM?l:n,r]:Math.abs(p-n)<KM&&KM<v-e?[n,Math.abs(l-n)<KM?h:e]:Math.abs(v-e)<KM&&KM<p-t?[Math.abs(h-e)<KM?l:t,e]:null))-1),++f);f&&(b=!1)}if(b){var _,x,w,M=1/0;for(i=0,b=null;i<y;++i)(a=JM[i])&&(w=(_=(o=a.site)[0]-t)*_+(x=o[1]-e)*x)<M&&(M=w,b=a);if(b){var k=[t,e],E=[t,r],S=[n,r],A=[n,e];b.halfedges.push(QM.push(RM(o=b.site,k,E))-1,QM.push(RM(o,E,S))-1,QM.push(RM(o,S,A))-1,QM.push(RM(o,A,k))-1)}}for(i=0;i<y;++i)(a=JM[i])&&(a.halfedges.length||delete JM[i])}(o,u,s,f)}this.edges=QM,this.cells=JM,XM=ZM=QM=JM=null}nk.prototype={constructor:nk,polygons:function(){var n=this.edges;return this.cells.map(function(e){var t=e.halfedges.map(function(t){return qM(e,n[t])});return t.data=e.site.data,t})},triangles:function(){var h=[],d=this.edges;return this.cells.forEach(function(t,e){if(r=(n=t.halfedges).length)for(var n,r,i,a,o,u,s=t.site,f=-1,c=d[n[r-1]],l=c.left===s?c.right:c.left;++f<r;)i=l,l=(c=d[n[f]]).left===s?c.right:c.left,i&&l&&e<i.index&&e<l.index&&(o=i,u=l,((a=s)[0]-u[0])*(o[1]-a[1])-(a[0]-o[0])*(u[1]-a[1])<0)&&h.push([s.data,i.data,l.data])}),h},links:function(){return this.edges.filter(function(t){return t.right}).map(function(t){return{source:t.left.data,target:t.right.data}})},find:function(o,u,t){for(var e,s,f=this,c=f._found||0,n=f.cells.length;!(s=f.cells[c]);)if(++c>=n)return null;for(var r=o-s.site[0],i=u-s.site[1],l=r*r+i*i;s=f.cells[e=c],c=null,s.halfedges.forEach(function(t){var e=f.edges[t],n=e.left;if(n!==s.site&&n||(n=e.right)){var r=o-n[0],i=u-n[1],a=r*r+i*i;a<l&&(l=a,c=n.index)}}),null!==c;);return f._found=e,null==t||l<=t*t?s.site:null}};function rk(t){Wr.call(this,null,t)}rk.Definition={type:"Voronoi",metadata:{modifies:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"size",type:"number",array:!0,length:2},{name:"extent",type:"array",array:!0,length:2,default:[[-1e5,-1e5],[1e5,1e5]],content:{type:"number",array:!0,length:2}},{name:"as",type:"string",default:"path"}]};var ik=j(rk,Wr),ak=[[-1e5,-1e5],[1e5,1e5]];ik.transform=function(t,e){var n,r,i,a,o=t.as||"path",u=e.source;for(n=function(){var i=EM,a=SM,e=null;function n(r){return new nk(r.map(function(t,e){var n=[Math.round(i(t,e,r)/KM)*KM,Math.round(a(t,e,r)/KM)*KM];return n.index=e,n.data=t,n}),e)}return n.polygons=function(t){return n(t).polygons()},n.links=function(t){return n(t).links()},n.triangles=function(t){return n(t).triangles()},n.x=function(t){return arguments.length?(i="function"==typeof t?t:kM(+t),n):i},n.y=function(t){return arguments.length?(a="function"==typeof t?t:kM(+t),n):a},n.extent=function(t){return arguments.length?(e=null==t?null:[[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]],n):e&&[[e[0][0],e[0][1]],[e[1][0],e[1][1]]]},n.size=function(t){return arguments.length?(e=null==t?null:[[0,0],[+t[0],+t[1]]],n):e&&[e[1][0]-e[0][0],e[1][1]-e[0][1]]},n}().x(t.x).y(t.y),t.size?n.size(t.size):n.extent(t.extent||ak),this.value=n=n(u),r=n.polygons(),i=0,a=u.length;i<a;++i)u[i][o]=r[i]?"M"+r[i].join("L")+"Z":null;return e.reflow(t.modified()).modifies(o)};var ok=Object.freeze({voronoi:rk}),uk=Math.PI/180,sk=64,fk=2048,ck=function(){var s,f,c,l,h,d,p,E=[256,256],S=pk,v=[],A=Math.random,e={};function g(t,e,n){for(var r,i,a,o,u,s=e.x,f=e.y,c=Math.sqrt(E[0]*E[0]+E[1]*E[1]),l=S(E),h=A()<.5?1:-1,d=-h;(r=l(d+=h))&&(i=~~r[0],a=~~r[1],!(Math.min(Math.abs(i),Math.abs(a))>=c));)if(e.x=s+i,e.y=f+a,!(e.x+e.x0<0||e.y+e.y0<0||e.x+e.x1>E[0]||e.y+e.y1>E[1]||n&&hk(e,t,E[0])||n&&(u=n,!((o=e).x+o.x1>u[0].x&&o.x+o.x0<u[1].x&&o.y+o.y1>u[0].y&&o.y+o.y0<u[1].y)))){for(var p,v=e.sprite,g=e.width>>5,m=E[0]>>5,y=e.x-(g<<4),b=127&y,_=32-b,x=e.y1-e.y0,w=(e.y+e.y0)*m+(y>>5),M=0;M<x;M++){for(var k=p=0;k<=g;k++)t[w+k]|=p<<_|(k<g?(p=v[M*g+k])>>>b:0);w+=m}return e.sprite=null,!0}return!1}return e.layout=function(){for(var t=function(t){t.width=t.height=1;var e=Math.sqrt(t.getContext("2d").getImageData(0,0,1,1).data.length>>2);t.width=(sk<<5)/e,t.height=fk/e;var n=t.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:e}}(Qa()),e=function(t){var e=[],n=-1;for(;++n<t;)e[n]=0;return e}((E[0]>>5)*E[1]),n=null,r=v.length,i=-1,a=[],o=v.map(function(t){return{text:s(t),font:f(t),style:l(t),weight:h(t),rotate:d(t),size:~~c(t),padding:p(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t}}).sort(function(t,e){return e.size-t.size});++i<r;){var u=o[i];u.x=E[0]*(A()+.5)>>1,u.y=E[1]*(A()+.5)>>1,lk(t,u,o,i),u.hasText&&g(e,u,n)&&(a.push(u),n?dk(n,u):n=[{x:u.x+u.x0,y:u.y+u.y0},{x:u.x+u.x1,y:u.y+u.y1}],u.x-=E[0]>>1,u.y-=E[1]>>1)}return a},e.words=function(t){return arguments.length?(v=t,e):v},e.size=function(t){return arguments.length?(E=[+t[0],+t[1]],e):E},e.font=function(t){return arguments.length?(f=vk(t),e):f},e.fontStyle=function(t){return arguments.length?(l=vk(t),e):l},e.fontWeight=function(t){return arguments.length?(h=vk(t),e):h},e.rotate=function(t){return arguments.length?(d=vk(t),e):d},e.text=function(t){return arguments.length?(s=vk(t),e):s},e.spiral=function(t){return arguments.length?(S=gk[t]||t,e):S},e.fontSize=function(t){return arguments.length?(c=vk(t),e):c},e.padding=function(t){return arguments.length?(p=vk(t),e):p},e.random=function(t){return arguments.length?(A=t,e):A},e};function lk(t,e,n,r){if(!e.sprite){var i=t.context,a=t.ratio;i.clearRect(0,0,(sk<<5)/a,fk/a);var o,u,s,f,c,l=0,h=0,d=0,p=n.length;for(--r;++r<p;){if(e=n[r],i.save(),i.font=e.style+" "+e.weight+" "+~~((e.size+1)/a)+"px "+e.font,o=i.measureText(e.text+"m").width*a,s=e.size<<1,e.rotate){var v=Math.sin(e.rotate*uk),g=Math.cos(e.rotate*uk),m=o*g,y=o*v,b=s*g,_=s*v;o=Math.max(Math.abs(m+_),Math.abs(m-_))+31>>5<<5,s=~~Math.max(Math.abs(y+b),Math.abs(y-b))}else o=o+31>>5<<5;if(d<s&&(d=s),sk<<5<=l+o&&(h+=d,d=l=0),fk<=h+s)break;i.translate((l+(o>>1))/a,(h+(s>>1))/a),e.rotate&&i.rotate(e.rotate*uk),i.fillText(e.text,0,0),e.padding&&(i.lineWidth=2*e.padding,i.strokeText(e.text,0,0)),i.restore(),e.width=o,e.height=s,e.xoff=l,e.yoff=h,e.x1=o>>1,e.y1=s>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,l+=o}for(var x=i.getImageData(0,0,(sk<<5)/a,fk/a).data,w=[];0<=--r;)if((e=n[r]).hasText){for(u=(o=e.width)>>5,s=e.y1-e.y0,f=0;f<s*u;f++)w[f]=0;if(null==(l=e.xoff))return;h=e.yoff;var M=0,k=-1;for(c=0;c<s;c++){for(f=0;f<o;f++){var E=u*c+(f>>5),S=x[(h+c)*(sk<<5)+(l+f)<<2]?1<<31-f%32:0;w[E]|=S,M|=S}M?k=c:(e.y0++,s--,c--,h++)}e.y1=e.y0+k,e.sprite=w.slice(0,(e.y1-e.y0)*u)}}}function hk(t,e,n){n>>=5;for(var r,i=t.sprite,a=t.width>>5,o=t.x-(a<<4),u=127&o,s=32-u,f=t.y1-t.y0,c=(t.y+t.y0)*n+(o>>5),l=0;l<f;l++){for(var h=r=0;h<=a;h++)if((r<<s|(h<a?(r=i[l*a+h])>>>u:0))&e[c+h])return!0;c+=n}return!1}function dk(t,e){var n=t[0],r=t[1];e.x+e.x0<n.x&&(n.x=e.x+e.x0),e.y+e.y0<n.y&&(n.y=e.y+e.y0),e.x+e.x1>r.x&&(r.x=e.x+e.x1),e.y+e.y1>r.y&&(r.y=e.y+e.y1)}function pk(t){var e=t[0]/t[1];return function(t){return[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]}}function vk(t){return"function"==typeof t?t:function(){return t}}var gk={archimedean:pk,rectangular:function(t){var n=4*t[0]/t[1],r=0,i=0;return function(t){var e=t<0?-1:1;switch(Math.sqrt(1+4*e*t)-e&3){case 0:r+=n;break;case 1:i+=4;break;case 2:r-=n;break;default:i-=4}return[r,i]}}},mk=["x","y","font","fontSize","fontStyle","fontWeight","angle"],yk=["text","font","rotate","fontSize","fontStyle","fontWeight"];function bk(t){Wr.call(this,ck(),t)}bk.Definition={type:"Wordcloud",metadata:{modifies:!0},params:[{name:"size",type:"number",array:!0,length:2},{name:"font",type:"string",expr:!0,default:"sans-serif"},{name:"fontStyle",type:"string",expr:!0,default:"normal"},{name:"fontWeight",type:"string",expr:!0,default:"normal"},{name:"fontSize",type:"number",expr:!0,default:14},{name:"fontSizeRange",type:"number",array:"nullable",default:[10,50]},{name:"rotate",type:"number",expr:!0,default:0},{name:"text",type:"field"},{name:"spiral",type:"string",values:["archimedean","rectangular"]},{name:"padding",type:"number",expr:!0},{name:"as",type:"string",array:!0,length:7,default:mk}]},j(bk,Wr).transform=function(n,r){var t=n.modified();if(t||r.changed(r.ADD_REM)||yk.some(function(t){var e=n[t];return R(e)&&r.modified(e.fields)})){var e,i=r.materialize(r.SOURCE).source,a=this.value,o=n.as||mk,u=n.fontSize||14;if(R(u)?e=n.fontSizeRange:u=P(u),e){var s=u,f=xp("sqrt")().domain(function(t,e){for(var n,r=1/0,i=-1/0,a=0,o=e.length;a<o;++a)(n=t(e[a]))<r&&(r=n),i<n&&(i=n);return[r,i]}(s,i)).range(e);u=function(t){return f(s(t))}}i.forEach(function(t){t[o[0]]=NaN,t[o[1]]=NaN,t[o[3]]=0});for(var c,l,h=a.words(i).text(n.text).size(n.size||[500,500]).padding(n.padding||1).spiral(n.spiral||"archimedean").rotate(n.rotate||0).font(n.font||"sans-serif").fontStyle(n.fontStyle||"normal").fontWeight(n.fontWeight||"normal").fontSize(u).random(y.random).layout(),d=a.size(),p=d[0]>>1,v=d[1]>>1,g=0,m=h.length;g<m;++g)(l=(c=h[g]).datum)[o[0]]=c.x+p,l[o[1]]=c.y+v,l[o[2]]=c.font,l[o[3]]=c.size,l[o[4]]=c.style,l[o[5]]=c.weight,l[o[6]]=c.rotate;return r.reflow(t).modifies(o)}};var _k=Object.freeze({wordcloud:bk});function xk(t){return new Uint32Array(t)}function wk(t,e,n){var r=(e<257?function(t){return new Uint8Array(t)}:e<65537?function(t){return new Uint16Array(t)}:xk)(t);return n&&r.set(n),r}var Mk=function(t,e,n){var s=1<<e;return{one:s,zero:~s,range:n.slice(),bisect:t.bisect,index:t.index,size:t.size,onAdd:function(t,e){var n,r=this.bisect(this.range,t.value),i=t.index,a=r[0],o=r[1],u=i.length;for(n=0;n<a;++n)e[i[n]]|=s;for(n=o;n<u;++n)e[i[n]]|=s;return this}}};function kk(){var h=xk(0),d=[],p=0;return{insert:function(t,e,n){if(!e.length)return[];var r,i,a,o,u,s=p,f=e.length,c=Array(f),l=xk(f);for(a=0;a<f;++a)c[a]=t(e[a]),l[a]=a;if(u=l,(o=c).sort.call(u,function(t,e){var n=o[t],r=o[e];return n<r?-1:r<n?1:0}),c=Ei(o,u),s)r=d,i=h,d=Array(s+f),h=xk(s+f),function(t,e,n,r,i,a,o,u,s){var f,c=0,l=0;for(f=0;c<r&&l<o;++f)e[c]<i[l]?(u[f]=e[c],s[f]=n[c++]):(u[f]=i[l],s[f]=a[l++]+t);for(;c<r;++c,++f)u[f]=e[c],s[f]=n[c];for(;l<o;++l,++f)u[f]=i[l],s[f]=a[l]+t}(n,r,i,s,c,l,f,d,h);else{if(0<n)for(a=0;a<f;++a)l[a]+=n;d=c,h=l}return p=s+f,{index:l,value:c}},remove:function(t,e){var n,r,i,a=p;for(r=0;!e[h[r]]&&r<a;++r);for(i=r;r<a;++r)e[n=h[r]]||(h[i]=n,d[i]=d[r],++i);p=a-t},bisect:function(t,e){var n;return e?n=e.length:(e=d,n=p),[ci(e,t[0],0,n),fi(e,t[1],0,n)]},reindex:function(t){for(var e=0,n=p;e<n;++e)h[e]=t[h[e]]},index:function(){return h},size:function(){return p}}}function Ek(t){var n,s,r,f,c;Wr.call(this,(n=8,s=[],r=xk(0),f=wk(0,n),c=wk(0,n),{data:function(){return s},seen:function(){return t=r,e=s.length,r=t.length>=e?t:((n=n||new t.constructor(e)).set(t),n);var t,e,n},add:function(t){for(var e,n=0,r=s.length,i=t.length;n<i;++n)(e=t[n])._index=r++,s.push(e)},remove:function(t,e){var n,r,i,a=s.length,o=Array(a-t),u=s;for(r=0;!e[r]&&r<a;++r)o[r]=s[r],u[r]=r;for(i=r;r<a;++r)n=s[r],e[r]?u[r]=-1:(u[r]=i,f[i]=f[r],c[i]=c[r],(o[i]=n)._index=i++),f[r]=0;return s=o,u},size:function(){return s.length},curr:function(){return f},prev:function(){return c},reset:function(t){c[t]=f[t]},all:function(){return n<257?255:n<65537?65535:4294967295},set:function(t,e){f[t]|=e},clear:function(t,e){f[t]&=~e},resize:function(t,e){(f.length<t||n<e)&&(n=Math.max(e,n),f=wk(t,n,f),c=wk(t,n))}}),t),this._indices=null,this._dims=null}Ek.Definition={type:"CrossFilter",metadata:{},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"query",type:"array",array:!0,required:!0,content:{type:"number",array:!0,length:2}}]};var Sk=j(Ek,Wr);function Ak(t){Wr.call(this,null,t)}Sk.transform=function(t,e){return this._dims?t.modified("fields")||t.fields.some(function(t){return e.modified(t.fields)})?this.reinit(t,e):this.eval(t,e):this.init(t,e)},Sk.init=function(t,e){for(var n,r,i=t.fields,a=t.query,o=this._indices={},u=this._dims=[],s=a.length,f=0;f<s;++f)r=o[n=i[f].fname]||(o[n]=kk()),u.push(Mk(r,f,a[f]));return this.eval(t,e)},Sk.reinit=function(t,e){var n,r,i,a,o,u,s,f,c,l=e.materialize().fork(),h=t.fields,d=t.query,p=this._indices,v=this._dims,g=this.value,m=g.curr(),y=g.prev(),b=g.all(),_=l.rem=l.add,x=l.mod,w=d.length,M={};if(y.set(m),e.rem.length&&(o=this.remove(t,e,l)),e.add.length&&g.add(e.add),e.mod.length)for(u={},s=0,f=(a=e.mod).length;s<f;++s)u[a[s]._index]=1;for(s=0;s<w;++s)c=h[s],(!v[s]||t.modified("fields",s)||e.modified(c.fields))&&((n=M[i=c.fname])||(p[i]=r=kk(),M[i]=n=r.insert(c,e.source,0)),v[s]=Mk(r,s,d[s]).onAdd(n,m));for(s=0,f=g.data().length;s<f;++s)o[s]||(y[s]!==m[s]?_.push(s):u[s]&&m[s]!==b&&x.push(s));return g.mask=(1<<w)-1,l},Sk.eval=function(t,e){var n=e.materialize().fork(),r=this._dims.length,i=0;return e.rem.length&&(this.remove(t,e,n),i|=(1<<r)-1),t.modified("query")&&!t.modified("fields")&&(i|=this.update(t,e,n)),e.add.length&&(this.insert(t,e,n),i|=(1<<r)-1),e.mod.length&&(this.modify(e,n),i|=(1<<r)-1),this.value.mask=i,n},Sk.insert=function(t,e,n){var r,i,a,o=e.add,u=this.value,s=this._dims,f=this._indices,c=t.fields,l={},h=n.add,d=u.size(),p=d+o.length,v=s.length;u.resize(p,v),u.add(o);var g=u.curr(),m=u.prev(),y=u.all();for(r=0;r<v;++r)a=l[i=c[r].fname]||(l[i]=f[i].insert(c[r],o,d)),s[r].onAdd(a,g);for(;d<p;++d)m[d]=y,g[d]!==y&&h.push(d)},Sk.modify=function(t,e){var n,r,i,a=e.mod,o=this.value,u=o.curr(),s=o.all(),f=t.mod;for(n=0,r=f.length;n<r;++n)u[i=f[n]._index]!==s&&a.push(i)},Sk.remove=function(t,e,n){var r,i,a,o,u=this._indices,s=this.value,f=s.curr(),c=s.prev(),l=s.all(),h={},d=n.rem,p=e.rem;for(r=0,i=p.length;r<i;++r)h[a=p[r]._index]=1,c[a]=o=f[a],o!==(f[a]=l)&&d.push(a);for(a in u)u[a].remove(i,h);return this.reindex(e,i,h),h},Sk.reindex=function(t,n,r){var i=this._indices,a=this.value;t.runAfter(function(){var t=a.remove(n,r);for(var e in i)i[e].reindex(t)})},Sk.update=function(t,e,n){var r,i,a=this._dims,o=t.query,u=e.stamp,s=a.length,f=0;for(i=n.filters=0;i<s;++i)t.modified("query",i)&&(r=i,++f);if(1===f)f=a[r].one,this.incrementOne(a[r],o[r],n.add,n.rem);else for(f=i=0;i<s;++i)t.modified("query",i)&&(f|=a[i].one,this.incrementAll(a[i],o[i],u,n.add),n.rem=n.add);return f},Sk.incrementAll=function(t,e,n,r){var i,a,o,u=this.value,s=u.seen(),f=u.curr(),c=u.prev(),l=t.index(),h=t.bisect(t.range),d=t.bisect(e),p=d[0],v=d[1],g=h[0],m=h[1],y=t.one;if(p<g)for(i=p,a=Math.min(g,v);i<a;++i)s[o=l[i]]!==n&&(c[o]=f[o],s[o]=n,r.push(o)),f[o]^=y;else if(g<p)for(i=g,a=Math.min(p,m);i<a;++i)s[o=l[i]]!==n&&(c[o]=f[o],s[o]=n,r.push(o)),f[o]^=y;if(m<v)for(i=Math.max(p,m),a=v;i<a;++i)s[o=l[i]]!==n&&(c[o]=f[o],s[o]=n,r.push(o)),f[o]^=y;else if(v<m)for(i=Math.max(g,v),a=m;i<a;++i)s[o=l[i]]!==n&&(c[o]=f[o],s[o]=n,r.push(o)),f[o]^=y;t.range=e.slice()},Sk.incrementOne=function(t,e,n,r){var i,a,o,u=this.value.curr(),s=t.index(),f=t.bisect(t.range),c=t.bisect(e),l=c[0],h=c[1],d=f[0],p=f[1],v=t.one;if(l<d)for(i=l,a=Math.min(d,h);i<a;++i)u[o=s[i]]^=v,n.push(o);else if(d<l)for(i=d,a=Math.min(l,p);i<a;++i)u[o=s[i]]^=v,r.push(o);if(p<h)for(i=Math.max(l,p),a=h;i<a;++i)u[o=s[i]]^=v,n.push(o);else if(h<p)for(i=Math.max(d,h),a=p;i<a;++i)u[o=s[i]]^=v,r.push(o);t.range=e.slice()},Ak.Definition={type:"ResolveFilter",metadata:{},params:[{name:"ignore",type:"number",required:!0,description:"A bit mask indicating which filters to ignore."},{name:"filter",type:"object",required:!0,description:"Per-tuple filter bitmaps from a CrossFilter transform."}]},j(Ak,Wr).transform=function(t,e){var n=~(t.ignore||0),r=t.filter,i=r.mask;if(0==(i&n))return e.StopPropagation;var a=e.fork(e.ALL),o=r.data(),u=r.curr(),s=r.prev(),f=function(t){return u[t]&n?null:o[t]};return a.filter(a.MOD,f),i&i-1?(a.filter(a.ADD,function(t){var e=u[t]&n;return!e&&e^s[t]&n?o[t]:null}),a.filter(a.REM,function(t){var e=u[t]&n;return e&&!(e^e^s[t]&n)?o[t]:null})):(a.filter(a.ADD,f),a.filter(a.REM,function(t){return(u[t]&n)===i?o[t]:null})),a.filter(a.SOURCE,function(t){return f(t._index)})};var Ck=Object.freeze({crossfilter:Ek,resolvefilter:Ak}),zk="default",Dk=function(t){var a=t._signals.cursor;a||(t._signals.cursor=a=t.add({user:zk,item:null})),t.on(t.events("view","mousemove"),a,function(t,e){var n=a.value,r=n?p(n)?n:n.user:zk,i=e.item&&e.item.cursor||null;return n&&r===n.user&&i==n.item?n:{user:r,item:i}}),t.add(null,function(t){var e,n=t.cursor,r=this.value;return p(n)||(r=n.item,n=n.user),e=n&&n!==zk?n:r||n,"undefined"!=typeof document&&document.body&&(document.body.style.cursor=e),r},{cursor:a})};function Ok(t,e){var n=t._runtime.data;return n.hasOwnProperty(e)||rt("Unrecognized data set: "+e),n[e]}function Nk(t,e){gt(e)||rt("Second argument to changes must be a changeset.");var n=Ok(this,t);return n.modified=!0,this.pulse(n.input,e)}function Rk(t){var e=t.padding();return Math.max(0,t._viewWidth+e.left+e.right)}function Tk(t){var e=t.padding();return Math.max(0,t._viewHeight+e.top+e.bottom)}function Pk(t){var e=t.padding(),n=t._origin;return[e.left+n[0],e.top+n[1]]}var Lk=function(t,e,n){var r,i,a,o=t._renderer.scene();return o&&(a=Pk(t),i=e.changedTouches?e.changedTouches[0]:e,(r=Ef(i,o))[0]-=a[0],r[1]-=a[1]),e.dataflow=t,e.vega=function(t,r,n){var i=r?"group"===r.mark.marktype?r:r.mark.group:null;function a(t){var e,n=i;if(t)for(e=r;e;e=e.mark.group)if(e.mark.name===t){n=e;break}return n&&n.mark&&n.mark.interactive?n:{}}function e(t){if(!t)return n;p(t)&&(t=a(t));for(var e=n.slice();t;)e[0]-=t.x||0,e[1]-=t.y||0,t=t.mark&&t.mark.group;return e}return{view:P(t),item:P(r||{}),group:a,xy:e,x:function(t){return e(t)[0]},y:function(t){return e(t)[1]}}}(t,n,r),e.item=n,e};var qk="view",Uk="window";function Fk(t){return t.item}function jk(t){var e=t.item.mark.source;return e.source||e}function Ik(n){return function(t,e){return e.vega.view().changeset().encode(e.item,n)}}var $k=function(t,e,n){var r=document.createElement(t);for(var i in e)r.setAttribute(i,e[i]);return null!=n&&(r.textContent=n),r},Bk="vega-bind",Wk="vega-bind-name",Yk="vega-bind-radio",Hk="vega-option-",Gk=function(e,t,n){if(t){var r=n.param,i=n.state;return i||(i=n.state={elements:null,active:!1,set:null,update:function(t){i.source=!0,e.signal(r.signal,t).run()}},r.debounce&&(i.update=L(r.debounce,i.update))),function(t,e,n,r){var i=$k("div",{class:Bk});i.appendChild($k("span",{class:Wk},n.name||n.signal)),e.appendChild(i);var a=Vk;switch(n.input){case"checkbox":a=Xk;break;case"select":a=Jk;break;case"radio":a=Zk;break;case"range":a=Qk}a(t,i,n,r)}(i,t,r,e.signal(r.signal)),i.active||(e.on(e._signals[r.signal],null,function(){i.source?i.source=!1:i.set(e.signal(r.signal))}),i.active=!0),i}};function Vk(t,e,n,r){var i=$k("input");for(var a in n)"signal"!==a&&"element"!==a&&i.setAttribute("input"===a?"type":a,n[a]);i.setAttribute("name",n.signal),i.value=r,e.appendChild(i),i.addEventListener("input",function(){t.update(i.value)}),t.elements=[i],t.set=function(t){i.value=t}}function Xk(t,e,n,r){var i={type:"checkbox",name:n.signal};r&&(i.checked=!0);var a=$k("input",i);e.appendChild(a),a.addEventListener("change",function(){t.update(a.checked)}),t.elements=[a],t.set=function(t){a.checked=!!t||null}}function Jk(t,e,r,n){var i=$k("select",{name:r.signal});r.options.forEach(function(t){var e={value:t};Kk(t,n)&&(e.selected=!0),i.appendChild($k("option",e,t+""))}),e.appendChild(i),i.addEventListener("change",function(){t.update(r.options[i.selectedIndex])}),t.elements=[i],t.set=function(t){for(var e=0,n=r.options.length;e<n;++e)if(Kk(r.options[e],t))return void(i.selectedIndex=e)}}function Zk(i,t,a,o){var u=$k("span",{class:Yk});t.appendChild(u),i.elements=a.options.map(function(t){var e=Hk+a.signal+"-"+t,n={id:e,type:"radio",name:a.signal,value:t};Kk(t,o)&&(n.checked=!0);var r=$k("input",n);return r.addEventListener("change",function(){i.update(t)}),u.appendChild(r),u.appendChild($k("label",{for:e},t+"")),r}),i.set=function(t){for(var e=i.elements,n=0,r=e.length;n<r;++n)Kk(e[n].value,t)&&(e[n].checked=!0)}}function Qk(t,e,n,r){r=void 0!==r?r:(+n.max+ +n.min)/2;var i=n.min||Math.min(0,+r)||0,a=n.max||Math.max(100,+r)||100,o=n.step||_i(i,a,100),u=$k("input",{type:"range",name:n.signal,min:i,max:a,step:o});u.value=r;var s=$k("label",{},+r);function f(){s.textContent=u.value,t.update(+u.value)}e.appendChild(u),e.appendChild(s),u.addEventListener("input",f),u.addEventListener("change",f),t.elements=[u],t.set=function(t){u.value=t,s.textContent=t}}function Kk(t,e){return t===e||t+""==e+""}var tE=function(t,e,n,r,i){return(e=e||new r(t.loader())).initialize(n,Rk(t),Tk(t),Pk(t),i).background(t._background)};function eE(e,n){if("string"==typeof n){if("undefined"==typeof document)return e.error("DOM document instance not found."),null;if(!(n=document.querySelector(n)))return e.error("Signal bind element not found: "+n),null}if(n)try{n.innerHTML=""}catch(t){n=null,e.error(t)}return n}var nE=function(t,e,n){var r=fc(e),i=r&&r.headless;return i?t.runAsync().then(function(){return tE(t,null,null,i,n).renderAsync(t._scenegraph.root)}):Promise.reject("Unrecognized renderer type: "+e)};var rE=function(t,e){return t=t||e.autosize,J(t)?t:{type:t=t||"pad"}},iE=function(t,e){return t=t||e.padding,J(t)?{top:aE(t.top),bottom:aE(t.bottom),left:aE(t.left),right:aE(t.right)}:{top:n=aE(t),bottom:n,left:n,right:n};var n};function aE(t){return+t||0}var oE=["value","update","react","bind"];function uE(t,e){rt(t+\' for "outer" push: \'+Z(e))}var sE,fE,cE,lE,hE=function(e,t){var n=e.name;if("outer"===e.push)t.signals[n]||uE("No prior signal definition",n),oE.forEach(function(t){void 0!==e[t]&&uE("Invalid property ",t)});else{var r=t.addSignal(n,e.value);!1===e.react&&(r.react=!1),e.bind&&t.addBinding(n,e.bind)}};function dE(t){this.type=t}dE.prototype.visit=function(t){var e,n,r;if(t(this))return 1;for(n=0,r=(e=function(t){switch(t.type){case"ArrayExpression":return t.elements;case"BinaryExpression":case"LogicalExpression":return[t.left,t.right];case"CallExpression":var e=t.arguments.slice();return e.unshift(t.callee),e;case"ConditionalExpression":return[t.test,t.consequent,t.alternate];case"MemberExpression":return[t.object,t.property];case"ObjectExpression":return t.properties;case"Property":return[t.key,t.value];case"UnaryExpression":return[t.argument];case"Identifier":case"Literal":case"RawCode":default:return[]}}(this)).length;n<r;++n)if(e[n].visit(t))return 1};var pE=1,vE=2,gE=3,mE=4,yE=5,bE=6,_E=7,xE=8,wE="ArrayExpression",ME="BinaryExpression",kE="CallExpression",EE="ConditionalExpression",SE="Identifier",AE="Literal",CE="LogicalExpression",zE="MemberExpression",DE="ObjectExpression",OE="Property",NE="UnaryExpression",RE="Unexpected token %0",TE="Unexpected number",PE="Unexpected string",LE="Unexpected identifier",qE="Unexpected reserved word",UE="Unexpected end of input",FE="Invalid regular expression",jE="Invalid regular expression: missing /",IE="Octal literals are not allowed in strict mode.",$E="Duplicate data property in object literal not allowed in strict mode",BE="ILLEGAL",WE="Disabled.",YE=new RegExp("[\xc2\xaa\xc2\xb5\xc2\xba\xc3\x80-\xc3\x96\xc3\x98-\xc3\xb6\xc3\xb8-\xcb\x81\xcb\x86-\xcb\x91\xcb\xa0-\xcb\xa4\xcb\xac\xcb\xae\xcd\xb0-\xcd\xb4\xcd\xb6\xcd\xb7\xcd\xba-\xcd\xbd\xcd\xbf\xce\x86\xce\x88-\xce\x8a\xce\x8c\xce\x8e-\xce\xa1\xce\xa3-\xcf\xb5\xcf\xb7-\xd2\x81\xd2\x8a-\xd4\xaf\xd4\xb1-\xd5\x96\xd5\x99\xd5\xa1-\xd6\x87\xd7\x90-\xd7\xaa\xd7\xb0-\xd7\xb2\xd8\xa0-\xd9\x8a\xd9\xae\xd9\xaf\xd9\xb1-\xdb\x93\xdb\x95\xdb\xa5\xdb\xa6\xdb\xae\xdb\xaf\xdb\xba-\xdb\xbc\xdb\xbf\xdc\x90\xdc\x92-\xdc\xaf\xdd\x8d-\xde\xa5\xde\xb1\xdf\x8a-\xdf\xaa\xdf\xb4\xdf\xb5\xdf\xba\xe0\xa0\x80-\xe0\xa0\x95\xe0\xa0\x9a\xe0\xa0\xa4\xe0\xa0\xa8\xe0\xa1\x80-\xe0\xa1\x98\xe0\xa2\xa0-\xe0\xa2\xb2\xe0\xa4\x84-\xe0\xa4\xb9\xe0\xa4\xbd\xe0\xa5\x90\xe0\xa5\x98-\xe0\xa5\xa1\xe0\xa5\xb1-\xe0\xa6\x80\xe0\xa6\x85-\xe0\xa6\x8c\xe0\xa6\x8f\xe0\xa6\x90\xe0\xa6\x93-\xe0\xa6\xa8\xe0\xa6\xaa-\xe0\xa6\xb0\xe0\xa6\xb2\xe0\xa6\xb6-\xe0\xa6\xb9\xe0\xa6\xbd\xe0\xa7\x8e\xe0\xa7\x9c\xe0\xa7\x9d\xe0\xa7\x9f-\xe0\xa7\xa1\xe0\xa7\xb0\xe0\xa7\xb1\xe0\xa8\x85-\xe0\xa8\x8a\xe0\xa8\x8f\xe0\xa8\x90\xe0\xa8\x93-\xe0\xa8\xa8\xe0\xa8\xaa-\xe0\xa8\xb0\xe0\xa8\xb2\xe0\xa8\xb3\xe0\xa8\xb5\xe0\xa8\xb6\xe0\xa8\xb8\xe0\xa8\xb9\xe0\xa9\x99-\xe0\xa9\x9c\xe0\xa9\x9e\xe0\xa9\xb2-\xe0\xa9\xb4\xe0\xaa\x85-\xe0\xaa\x8d\xe0\xaa\x8f-\xe0\xaa\x91\xe0\xaa\x93-\xe0\xaa\xa8\xe0\xaa\xaa-\xe0\xaa\xb0\xe0\xaa\xb2\xe0\xaa\xb3\xe0\xaa\xb5-\xe0\xaa\xb9\xe0\xaa\xbd\xe0\xab\x90\xe0\xab\xa0\xe0\xab\xa1\xe0\xac\x85-\xe0\xac\x8c\xe0\xac\x8f\xe0\xac\x90\xe0\xac\x93-\xe0\xac\xa8\xe0\xac\xaa-\xe0\xac\xb0\xe0\xac\xb2\xe0\xac\xb3\xe0\xac\xb5-\xe0\xac\xb9\xe0\xac\xbd\xe0\xad\x9c\xe0\xad\x9d\xe0\xad\x9f-\xe0\xad\xa1\xe0\xad\xb1\xe0\xae\x83\xe0\xae\x85-\xe0\xae\x8a\xe0\xae\x8e-\xe0\xae\x90\xe0\xae\x92-\xe0\xae\x95\xe0\xae\x99\xe0\xae\x9a\xe0\xae\x9c\xe0\xae\x9e\xe0\xae\x9f\xe0\xae\xa3\xe0\xae\xa4\xe0\xae\xa8-\xe0\xae\xaa\xe0\xae\xae-\xe0\xae\xb9\xe0\xaf\x90\xe0\xb0\x85-\xe0\xb0\x8c\xe0\xb0\x8e-\xe0\xb0\x90\xe0\xb0\x92-\xe0\xb0\xa8\xe0\xb0\xaa-\xe0\xb0\xb9\xe0\xb0\xbd\xe0\xb1\x98\xe0\xb1\x99\xe0\xb1\xa0\xe0\xb1\xa1\xe0\xb2\x85-\xe0\xb2\x8c\xe0\xb2\x8e-\xe0\xb2\x90\xe0\xb2\x92-\xe0\xb2\xa8\xe0\xb2\xaa-\xe0\xb2\xb3\xe0\xb2\xb5-\xe0\xb2\xb9\xe0\xb2\xbd\xe0\xb3\x9e\xe0\xb3\xa0\xe0\xb3\xa1\xe0\xb3\xb1\xe0\xb3\xb2\xe0\xb4\x85-\xe0\xb4\x8c\xe0\xb4\x8e-\xe0\xb4\x90\xe0\xb4\x92-\xe0\xb4\xba\xe0\xb4\xbd\xe0\xb5\x8e\xe0\xb5\xa0\xe0\xb5\xa1\xe0\xb5\xba-\xe0\xb5\xbf\xe0\xb6\x85-\xe0\xb6\x96\xe0\xb6\x9a-\xe0\xb6\xb1\xe0\xb6\xb3-\xe0\xb6\xbb\xe0\xb6\xbd\xe0\xb7\x80-\xe0\xb7\x86\xe0\xb8\x81-\xe0\xb8\xb0\xe0\xb8\xb2\xe0\xb8\xb3\xe0\xb9\x80-\xe0\xb9\x86\xe0\xba\x81\xe0\xba\x82\xe0\xba\x84\xe0\xba\x87\xe0\xba\x88\xe0\xba\x8a\xe0\xba\x8d\xe0\xba\x94-\xe0\xba\x97\xe0\xba\x99-\xe0\xba\x9f\xe0\xba\xa1-\xe0\xba\xa3\xe0\xba\xa5\xe0\xba\xa7\xe0\xba\xaa\xe0\xba\xab\xe0\xba\xad-\xe0\xba\xb0\xe0\xba\xb2\xe0\xba\xb3\xe0\xba\xbd\xe0\xbb\x80-\xe0\xbb\x84\xe0\xbb\x86\xe0\xbb\x9c-\xe0\xbb\x9f\xe0\xbc\x80\xe0\xbd\x80-\xe0\xbd\x87\xe0\xbd\x89-\xe0\xbd\xac\xe0\xbe\x88-\xe0\xbe\x8c\xe1\x80\x80-\xe1\x80\xaa\xe1\x80\xbf\xe1\x81\x90-\xe1\x81\x95\xe1\x81\x9a-\xe1\x81\x9d\xe1\x81\xa1\xe1\x81\xa5\xe1\x81\xa6\xe1\x81\xae-\xe1\x81\xb0\xe1\x81\xb5-\xe1\x82\x81\xe1\x82\x8e\xe1\x82\xa0-\xe1\x83\x85\xe1\x83\x87\xe1\x83\x8d\xe1\x83\x90-\xe1\x83\xba\xe1\x83\xbc-\xe1\x89\x88\xe1\x89\x8a-\xe1\x89\x8d\xe1\x89\x90-\xe1\x89\x96\xe1\x89\x98\xe1\x89\x9a-\xe1\x89\x9d\xe1\x89\xa0-\xe1\x8a\x88\xe1\x8a\x8a-\xe1\x8a\x8d\xe1\x8a\x90-\xe1\x8a\xb0\xe1\x8a\xb2-\xe1\x8a\xb5\xe1\x8a\xb8-\xe1\x8a\xbe\xe1\x8b\x80\xe1\x8b\x82-\xe1\x8b\x85\xe1\x8b\x88-\xe1\x8b\x96\xe1\x8b\x98-\xe1\x8c\x90\xe1\x8c\x92-\xe1\x8c\x95\xe1\x8c\x98-\xe1\x8d\x9a\xe1\x8e\x80-\xe1\x8e\x8f\xe1\x8e\xa0-\xe1\x8f\xb4\xe1\x90\x81-\xe1\x99\xac\xe1\x99\xaf-\xe1\x99\xbf\xe1\x9a\x81-\xe1\x9a\x9a\xe1\x9a\xa0-\xe1\x9b\xaa\xe1\x9b\xae-\xe1\x9b\xb8\xe1\x9c\x80-\xe1\x9c\x8c\xe1\x9c\x8e-\xe1\x9c\x91\xe1\x9c\xa0-\xe1\x9c\xb1\xe1\x9d\x80-\xe1\x9d\x91\xe1\x9d\xa0-\xe1\x9d\xac\xe1\x9d\xae-\xe1\x9d\xb0\xe1\x9e\x80-\xe1\x9e\xb3\xe1\x9f\x97\xe1\x9f\x9c\xe1\xa0\xa0-\xe1\xa1\xb7\xe1\xa2\x80-\xe1\xa2\xa8\xe1\xa2\xaa\xe1\xa2\xb0-\xe1\xa3\xb5\xe1\xa4\x80-\xe1\xa4\x9e\xe1\xa5\x90-\xe1\xa5\xad\xe1\xa5\xb0-\xe1\xa5\xb4\xe1\xa6\x80-\xe1\xa6\xab\xe1\xa7\x81-\xe1\xa7\x87\xe1\xa8\x80-\xe1\xa8\x96\xe1\xa8\xa0-\xe1\xa9\x94\xe1\xaa\xa7\xe1\xac\x85-\xe1\xac\xb3\xe1\xad\x85-\xe1\xad\x8b\xe1\xae\x83-\xe1\xae\xa0\xe1\xae\xae\xe1\xae\xaf\xe1\xae\xba-\xe1\xaf\xa5\xe1\xb0\x80-\xe1\xb0\xa3\xe1\xb1\x8d-\xe1\xb1\x8f\xe1\xb1\x9a-\xe1\xb1\xbd\xe1\xb3\xa9-\xe1\xb3\xac\xe1\xb3\xae-\xe1\xb3\xb1\xe1\xb3\xb5\xe1\xb3\xb6\xe1\xb4\x80-\xe1\xb6\xbf\xe1\xb8\x80-\xe1\xbc\x95\xe1\xbc\x98-\xe1\xbc\x9d\xe1\xbc\xa0-\xe1\xbd\x85\xe1\xbd\x88-\xe1\xbd\x8d\xe1\xbd\x90-\xe1\xbd\x97\xe1\xbd\x99\xe1\xbd\x9b\xe1\xbd\x9d\xe1\xbd\x9f-\xe1\xbd\xbd\xe1\xbe\x80-\xe1\xbe\xb4\xe1\xbe\xb6-\xe1\xbe\xbc\xe1\xbe\xbe\xe1\xbf\x82-\xe1\xbf\x84\xe1\xbf\x86-\xe1\xbf\x8c\xe1\xbf\x90-\xe1\xbf\x93\xe1\xbf\x96-\xe1\xbf\x9b\xe1\xbf\xa0-\xe1\xbf\xac\xe1\xbf\xb2-\xe1\xbf\xb4\xe1\xbf\xb6-\xe1\xbf\xbc\xe2\x81\xb1\xe2\x81\xbf\xe2\x82\x90-\xe2\x82\x9c\xe2\x84\x82\xe2\x84\x87\xe2\x84\x8a-\xe2\x84\x93\xe2\x84\x95\xe2\x84\x99-\xe2\x84\x9d\xe2\x84\xa4\xe2\x84\xa6\xe2\x84\xa8\xe2\x84\xaa-\xe2\x84\xad\xe2\x84\xaf-\xe2\x84\xb9\xe2\x84\xbc-\xe2\x84\xbf\xe2\x85\x85-\xe2\x85\x89\xe2\x85\x8e\xe2\x85\xa0-\xe2\x86\x88\xe2\xb0\x80-\xe2\xb0\xae\xe2\xb0\xb0-\xe2\xb1\x9e\xe2\xb1\xa0-\xe2\xb3\xa4\xe2\xb3\xab-\xe2\xb3\xae\xe2\xb3\xb2\xe2\xb3\xb3\xe2\xb4\x80-\xe2\xb4\xa5\xe2\xb4\xa7\xe2\xb4\xad\xe2\xb4\xb0-\xe2\xb5\xa7\xe2\xb5\xaf\xe2\xb6\x80-\xe2\xb6\x96\xe2\xb6\xa0-\xe2\xb6\xa6\xe2\xb6\xa8-\xe2\xb6\xae\xe2\xb6\xb0-\xe2\xb6\xb6\xe2\xb6\xb8-\xe2\xb6\xbe\xe2\xb7\x80-\xe2\xb7\x86\xe2\xb7\x88-\xe2\xb7\x8e\xe2\xb7\x90-\xe2\xb7\x96\xe2\xb7\x98-\xe2\xb7\x9e\xe2\xb8\xaf\xe3\x80\x85-\xe3\x80\x87\xe3\x80\xa1-\xe3\x80\xa9\xe3\x80\xb1-\xe3\x80\xb5\xe3\x80\xb8-\xe3\x80\xbc\xe3\x81\x81-\xe3\x82\x96\xe3\x82\x9d-\xe3\x82\x9f\xe3\x82\xa1-\xe3\x83\xba\xe3\x83\xbc-\xe3\x83\xbf\xe3\x84\x85-\xe3\x84\xad\xe3\x84\xb1-\xe3\x86\x8e\xe3\x86\xa0-\xe3\x86\xba\xe3\x87\xb0-\xe3\x87\xbf\xe3\x90\x80-\xe4\xb6\xb5\xe4\xb8\x80-\xe9\xbf\x8c\xea\x80\x80-\xea\x92\x8c\xea\x93\x90-\xea\x93\xbd\xea\x94\x80-\xea\x98\x8c\xea\x98\x90-\xea\x98\x9f\xea\x98\xaa\xea\x98\xab\xea\x99\x80-\xea\x99\xae\xea\x99\xbf-\xea\x9a\x9d\xea\x9a\xa0-\xea\x9b\xaf\xea\x9c\x97-\xea\x9c\x9f\xea\x9c\xa2-\xea\x9e\x88\xea\x9e\x8b-\xea\x9e\x8e\xea\x9e\x90-\xea\x9e\xad\xea\x9e\xb0\xea\x9e\xb1\xea\x9f\xb7-\xea\xa0\x81\xea\xa0\x83-\xea\xa0\x85\xea\xa0\x87-\xea\xa0\x8a\xea\xa0\x8c-\xea\xa0\xa2\xea\xa1\x80-\xea\xa1\xb3\xea\xa2\x82-\xea\xa2\xb3\xea\xa3\xb2-\xea\xa3\xb7\xea\xa3\xbb\xea\xa4\x8a-\xea\xa4\xa5\xea\xa4\xb0-\xea\xa5\x86\xea\xa5\xa0-\xea\xa5\xbc\xea\xa6\x84-\xea\xa6\xb2\xea\xa7\x8f\xea\xa7\xa0-\xea\xa7\xa4\xea\xa7\xa6-\xea\xa7\xaf\xea\xa7\xba-\xea\xa7\xbe\xea\xa8\x80-\xea\xa8\xa8\xea\xa9\x80-\xea\xa9\x82\xea\xa9\x84-\xea\xa9\x8b\xea\xa9\xa0-\xea\xa9\xb6\xea\xa9\xba\xea\xa9\xbe-\xea\xaa\xaf\xea\xaa\xb1\xea\xaa\xb5\xea\xaa\xb6\xea\xaa\xb9-\xea\xaa\xbd\xea\xab\x80\xea\xab\x82\xea\xab\x9b-\xea\xab\x9d\xea\xab\xa0-\xea\xab\xaa\xea\xab\xb2-\xea\xab\xb4\xea\xac\x81-\xea\xac\x86\xea\xac\x89-\xea\xac\x8e\xea\xac\x91-\xea\xac\x96\xea\xac\xa0-\xea\xac\xa6\xea\xac\xa8-\xea\xac\xae\xea\xac\xb0-\xea\xad\x9a\xea\xad\x9c-\xea\xad\x9f\xea\xad\xa4\xea\xad\xa5\xea\xaf\x80-\xea\xaf\xa2\xea\xb0\x80-\xed\x9e\xa3\xed\x9e\xb0-\xed\x9f\x86\xed\x9f\x8b-\xed\x9f\xbb\xef\xa4\x80-\xef\xa9\xad\xef\xa9\xb0-\xef\xab\x99\xef\xac\x80-\xef\xac\x86\xef\xac\x93-\xef\xac\x97\xef\xac\x9d\xef\xac\x9f-\xef\xac\xa8\xef\xac\xaa-\xef\xac\xb6\xef\xac\xb8-\xef\xac\xbc\xef\xac\xbe\xef\xad\x80\xef\xad\x81\xef\xad\x83\xef\xad\x84\xef\xad\x86-\xef\xae\xb1\xef\xaf\x93-\xef\xb4\xbd\xef\xb5\x90-\xef\xb6\x8f\xef\xb6\x92-\xef\xb7\x87\xef\xb7\xb0-\xef\xb7\xbb\xef\xb9\xb0-\xef\xb9\xb4\xef\xb9\xb6-\xef\xbb\xbc\xef\xbc\xa1-\xef\xbc\xba\xef\xbd\x81-\xef\xbd\x9a\xef\xbd\xa6-\xef\xbe\xbe\xef\xbf\x82-\xef\xbf\x87\xef\xbf\x8a-\xef\xbf\x8f\xef\xbf\x92-\xef\xbf\x97\xef\xbf\x9a-\xef\xbf\x9c]"),HE=new RegExp("[\xc2\xaa\xc2\xb5\xc2\xba\xc3\x80-\xc3\x96\xc3\x98-\xc3\xb6\xc3\xb8-\xcb\x81\xcb\x86-\xcb\x91\xcb\xa0-\xcb\xa4\xcb\xac\xcb\xae\xcc\x80-\xcd\xb4\xcd\xb6\xcd\xb7\xcd\xba-\xcd\xbd\xcd\xbf\xce\x86\xce\x88-\xce\x8a\xce\x8c\xce\x8e-\xce\xa1\xce\xa3-\xcf\xb5\xcf\xb7-\xd2\x81\xd2\x83-\xd2\x87\xd2\x8a-\xd4\xaf\xd4\xb1-\xd5\x96\xd5\x99\xd5\xa1-\xd6\x87\xd6\x91-\xd6\xbd\xd6\xbf\xd7\x81\xd7\x82\xd7\x84\xd7\x85\xd7\x87\xd7\x90-\xd7\xaa\xd7\xb0-\xd7\xb2\xd8\x90-\xd8\x9a\xd8\xa0-\xd9\xa9\xd9\xae-\xdb\x93\xdb\x95-\xdb\x9c\xdb\x9f-\xdb\xa8\xdb\xaa-\xdb\xbc\xdb\xbf\xdc\x90-\xdd\x8a\xdd\x8d-\xde\xb1\xdf\x80-\xdf\xb5\xdf\xba\xe0\xa0\x80-\xe0\xa0\xad\xe0\xa1\x80-\xe0\xa1\x9b\xe0\xa2\xa0-\xe0\xa2\xb2\xe0\xa3\xa4-\xe0\xa5\xa3\xe0\xa5\xa6-\xe0\xa5\xaf\xe0\xa5\xb1-\xe0\xa6\x83\xe0\xa6\x85-\xe0\xa6\x8c\xe0\xa6\x8f\xe0\xa6\x90\xe0\xa6\x93-\xe0\xa6\xa8\xe0\xa6\xaa-\xe0\xa6\xb0\xe0\xa6\xb2\xe0\xa6\xb6-\xe0\xa6\xb9\xe0\xa6\xbc-\xe0\xa7\x84\xe0\xa7\x87\xe0\xa7\x88\xe0\xa7\x8b-\xe0\xa7\x8e\xe0\xa7\x97\xe0\xa7\x9c\xe0\xa7\x9d\xe0\xa7\x9f-\xe0\xa7\xa3\xe0\xa7\xa6-\xe0\xa7\xb1\xe0\xa8\x81-\xe0\xa8\x83\xe0\xa8\x85-\xe0\xa8\x8a\xe0\xa8\x8f\xe0\xa8\x90\xe0\xa8\x93-\xe0\xa8\xa8\xe0\xa8\xaa-\xe0\xa8\xb0\xe0\xa8\xb2\xe0\xa8\xb3\xe0\xa8\xb5\xe0\xa8\xb6\xe0\xa8\xb8\xe0\xa8\xb9\xe0\xa8\xbc\xe0\xa8\xbe-\xe0\xa9\x82\xe0\xa9\x87\xe0\xa9\x88\xe0\xa9\x8b-\xe0\xa9\x8d\xe0\xa9\x91\xe0\xa9\x99-\xe0\xa9\x9c\xe0\xa9\x9e\xe0\xa9\xa6-\xe0\xa9\xb5\xe0\xaa\x81-\xe0\xaa\x83\xe0\xaa\x85-\xe0\xaa\x8d\xe0\xaa\x8f-\xe0\xaa\x91\xe0\xaa\x93-\xe0\xaa\xa8\xe0\xaa\xaa-\xe0\xaa\xb0\xe0\xaa\xb2\xe0\xaa\xb3\xe0\xaa\xb5-\xe0\xaa\xb9\xe0\xaa\xbc-\xe0\xab\x85\xe0\xab\x87-\xe0\xab\x89\xe0\xab\x8b-\xe0\xab\x8d\xe0\xab\x90\xe0\xab\xa0-\xe0\xab\xa3\xe0\xab\xa6-\xe0\xab\xaf\xe0\xac\x81-\xe0\xac\x83\xe0\xac\x85-\xe0\xac\x8c\xe0\xac\x8f\xe0\xac\x90\xe0\xac\x93-\xe0\xac\xa8\xe0\xac\xaa-\xe0\xac\xb0\xe0\xac\xb2\xe0\xac\xb3\xe0\xac\xb5-\xe0\xac\xb9\xe0\xac\xbc-\xe0\xad\x84\xe0\xad\x87\xe0\xad\x88\xe0\xad\x8b-\xe0\xad\x8d\xe0\xad\x96\xe0\xad\x97\xe0\xad\x9c\xe0\xad\x9d\xe0\xad\x9f-\xe0\xad\xa3\xe0\xad\xa6-\xe0\xad\xaf\xe0\xad\xb1\xe0\xae\x82\xe0\xae\x83\xe0\xae\x85-\xe0\xae\x8a\xe0\xae\x8e-\xe0\xae\x90\xe0\xae\x92-\xe0\xae\x95\xe0\xae\x99\xe0\xae\x9a\xe0\xae\x9c\xe0\xae\x9e\xe0\xae\x9f\xe0\xae\xa3\xe0\xae\xa4\xe0\xae\xa8-\xe0\xae\xaa\xe0\xae\xae-\xe0\xae\xb9\xe0\xae\xbe-\xe0\xaf\x82\xe0\xaf\x86-\xe0\xaf\x88\xe0\xaf\x8a-\xe0\xaf\x8d\xe0\xaf\x90\xe0\xaf\x97\xe0\xaf\xa6-\xe0\xaf\xaf\xe0\xb0\x80-\xe0\xb0\x83\xe0\xb0\x85-\xe0\xb0\x8c\xe0\xb0\x8e-\xe0\xb0\x90\xe0\xb0\x92-\xe0\xb0\xa8\xe0\xb0\xaa-\xe0\xb0\xb9\xe0\xb0\xbd-\xe0\xb1\x84\xe0\xb1\x86-\xe0\xb1\x88\xe0\xb1\x8a-\xe0\xb1\x8d\xe0\xb1\x95\xe0\xb1\x96\xe0\xb1\x98\xe0\xb1\x99\xe0\xb1\xa0-\xe0\xb1\xa3\xe0\xb1\xa6-\xe0\xb1\xaf\xe0\xb2\x81-\xe0\xb2\x83\xe0\xb2\x85-\xe0\xb2\x8c\xe0\xb2\x8e-\xe0\xb2\x90\xe0\xb2\x92-\xe0\xb2\xa8\xe0\xb2\xaa-\xe0\xb2\xb3\xe0\xb2\xb5-\xe0\xb2\xb9\xe0\xb2\xbc-\xe0\xb3\x84\xe0\xb3\x86-\xe0\xb3\x88\xe0\xb3\x8a-\xe0\xb3\x8d\xe0\xb3\x95\xe0\xb3\x96\xe0\xb3\x9e\xe0\xb3\xa0-\xe0\xb3\xa3\xe0\xb3\xa6-\xe0\xb3\xaf\xe0\xb3\xb1\xe0\xb3\xb2\xe0\xb4\x81-\xe0\xb4\x83\xe0\xb4\x85-\xe0\xb4\x8c\xe0\xb4\x8e-\xe0\xb4\x90\xe0\xb4\x92-\xe0\xb4\xba\xe0\xb4\xbd-\xe0\xb5\x84\xe0\xb5\x86-\xe0\xb5\x88\xe0\xb5\x8a-\xe0\xb5\x8e\xe0\xb5\x97\xe0\xb5\xa0-\xe0\xb5\xa3\xe0\xb5\xa6-\xe0\xb5\xaf\xe0\xb5\xba-\xe0\xb5\xbf\xe0\xb6\x82\xe0\xb6\x83\xe0\xb6\x85-\xe0\xb6\x96\xe0\xb6\x9a-\xe0\xb6\xb1\xe0\xb6\xb3-\xe0\xb6\xbb\xe0\xb6\xbd\xe0\xb7\x80-\xe0\xb7\x86\xe0\xb7\x8a\xe0\xb7\x8f-\xe0\xb7\x94\xe0\xb7\x96\xe0\xb7\x98-\xe0\xb7\x9f\xe0\xb7\xa6-\xe0\xb7\xaf\xe0\xb7\xb2\xe0\xb7\xb3\xe0\xb8\x81-\xe0\xb8\xba\xe0\xb9\x80-\xe0\xb9\x8e\xe0\xb9\x90-\xe0\xb9\x99\xe0\xba\x81\xe0\xba\x82\xe0\xba\x84\xe0\xba\x87\xe0\xba\x88\xe0\xba\x8a\xe0\xba\x8d\xe0\xba\x94-\xe0\xba\x97\xe0\xba\x99-\xe0\xba\x9f\xe0\xba\xa1-\xe0\xba\xa3\xe0\xba\xa5\xe0\xba\xa7\xe0\xba\xaa\xe0\xba\xab\xe0\xba\xad-\xe0\xba\xb9\xe0\xba\xbb-\xe0\xba\xbd\xe0\xbb\x80-\xe0\xbb\x84\xe0\xbb\x86\xe0\xbb\x88-\xe0\xbb\x8d\xe0\xbb\x90-\xe0\xbb\x99\xe0\xbb\x9c-\xe0\xbb\x9f\xe0\xbc\x80\xe0\xbc\x98\xe0\xbc\x99\xe0\xbc\xa0-\xe0\xbc\xa9\xe0\xbc\xb5\xe0\xbc\xb7\xe0\xbc\xb9\xe0\xbc\xbe-\xe0\xbd\x87\xe0\xbd\x89-\xe0\xbd\xac\xe0\xbd\xb1-\xe0\xbe\x84\xe0\xbe\x86-\xe0\xbe\x97\xe0\xbe\x99-\xe0\xbe\xbc\xe0\xbf\x86\xe1\x80\x80-\xe1\x81\x89\xe1\x81\x90-\xe1\x82\x9d\xe1\x82\xa0-\xe1\x83\x85\xe1\x83\x87\xe1\x83\x8d\xe1\x83\x90-\xe1\x83\xba\xe1\x83\xbc-\xe1\x89\x88\xe1\x89\x8a-\xe1\x89\x8d\xe1\x89\x90-\xe1\x89\x96\xe1\x89\x98\xe1\x89\x9a-\xe1\x89\x9d\xe1\x89\xa0-\xe1\x8a\x88\xe1\x8a\x8a-\xe1\x8a\x8d\xe1\x8a\x90-\xe1\x8a\xb0\xe1\x8a\xb2-\xe1\x8a\xb5\xe1\x8a\xb8-\xe1\x8a\xbe\xe1\x8b\x80\xe1\x8b\x82-\xe1\x8b\x85\xe1\x8b\x88-\xe1\x8b\x96\xe1\x8b\x98-\xe1\x8c\x90\xe1\x8c\x92-\xe1\x8c\x95\xe1\x8c\x98-\xe1\x8d\x9a\xe1\x8d\x9d-\xe1\x8d\x9f\xe1\x8e\x80-\xe1\x8e\x8f\xe1\x8e\xa0-\xe1\x8f\xb4\xe1\x90\x81-\xe1\x99\xac\xe1\x99\xaf-\xe1\x99\xbf\xe1\x9a\x81-\xe1\x9a\x9a\xe1\x9a\xa0-\xe1\x9b\xaa\xe1\x9b\xae-\xe1\x9b\xb8\xe1\x9c\x80-\xe1\x9c\x8c\xe1\x9c\x8e-\xe1\x9c\x94\xe1\x9c\xa0-\xe1\x9c\xb4\xe1\x9d\x80-\xe1\x9d\x93\xe1\x9d\xa0-\xe1\x9d\xac\xe1\x9d\xae-\xe1\x9d\xb0\xe1\x9d\xb2\xe1\x9d\xb3\xe1\x9e\x80-\xe1\x9f\x93\xe1\x9f\x97\xe1\x9f\x9c\xe1\x9f\x9d\xe1\x9f\xa0-\xe1\x9f\xa9\xe1\xa0\x8b-\xe1\xa0\x8d\xe1\xa0\x90-\xe1\xa0\x99\xe1\xa0\xa0-\xe1\xa1\xb7\xe1\xa2\x80-\xe1\xa2\xaa\xe1\xa2\xb0-\xe1\xa3\xb5\xe1\xa4\x80-\xe1\xa4\x9e\xe1\xa4\xa0-\xe1\xa4\xab\xe1\xa4\xb0-\xe1\xa4\xbb\xe1\xa5\x86-\xe1\xa5\xad\xe1\xa5\xb0-\xe1\xa5\xb4\xe1\xa6\x80-\xe1\xa6\xab\xe1\xa6\xb0-\xe1\xa7\x89\xe1\xa7\x90-\xe1\xa7\x99\xe1\xa8\x80-\xe1\xa8\x9b\xe1\xa8\xa0-\xe1\xa9\x9e\xe1\xa9\xa0-\xe1\xa9\xbc\xe1\xa9\xbf-\xe1\xaa\x89\xe1\xaa\x90-\xe1\xaa\x99\xe1\xaa\xa7\xe1\xaa\xb0-\xe1\xaa\xbd\xe1\xac\x80-\xe1\xad\x8b\xe1\xad\x90-\xe1\xad\x99\xe1\xad\xab-\xe1\xad\xb3\xe1\xae\x80-\xe1\xaf\xb3\xe1\xb0\x80-\xe1\xb0\xb7\xe1\xb1\x80-\xe1\xb1\x89\xe1\xb1\x8d-\xe1\xb1\xbd\xe1\xb3\x90-\xe1\xb3\x92\xe1\xb3\x94-\xe1\xb3\xb6\xe1\xb3\xb8\xe1\xb3\xb9\xe1\xb4\x80-\xe1\xb7\xb5\xe1\xb7\xbc-\xe1\xbc\x95\xe1\xbc\x98-\xe1\xbc\x9d\xe1\xbc\xa0-\xe1\xbd\x85\xe1\xbd\x88-\xe1\xbd\x8d\xe1\xbd\x90-\xe1\xbd\x97\xe1\xbd\x99\xe1\xbd\x9b\xe1\xbd\x9d\xe1\xbd\x9f-\xe1\xbd\xbd\xe1\xbe\x80-\xe1\xbe\xb4\xe1\xbe\xb6-\xe1\xbe\xbc\xe1\xbe\xbe\xe1\xbf\x82-\xe1\xbf\x84\xe1\xbf\x86-\xe1\xbf\x8c\xe1\xbf\x90-\xe1\xbf\x93\xe1\xbf\x96-\xe1\xbf\x9b\xe1\xbf\xa0-\xe1\xbf\xac\xe1\xbf\xb2-\xe1\xbf\xb4\xe1\xbf\xb6-\xe1\xbf\xbc\xe2\x80\x8c\xe2\x80\x8d\xe2\x80\xbf\xe2\x81\x80\xe2\x81\x94\xe2\x81\xb1\xe2\x81\xbf\xe2\x82\x90-\xe2\x82\x9c\xe2\x83\x90-\xe2\x83\x9c\xe2\x83\xa1\xe2\x83\xa5-\xe2\x83\xb0\xe2\x84\x82\xe2\x84\x87\xe2\x84\x8a-\xe2\x84\x93\xe2\x84\x95\xe2\x84\x99-\xe2\x84\x9d\xe2\x84\xa4\xe2\x84\xa6\xe2\x84\xa8\xe2\x84\xaa-\xe2\x84\xad\xe2\x84\xaf-\xe2\x84\xb9\xe2\x84\xbc-\xe2\x84\xbf\xe2\x85\x85-\xe2\x85\x89\xe2\x85\x8e\xe2\x85\xa0-\xe2\x86\x88\xe2\xb0\x80-\xe2\xb0\xae\xe2\xb0\xb0-\xe2\xb1\x9e\xe2\xb1\xa0-\xe2\xb3\xa4\xe2\xb3\xab-\xe2\xb3\xb3\xe2\xb4\x80-\xe2\xb4\xa5\xe2\xb4\xa7\xe2\xb4\xad\xe2\xb4\xb0-\xe2\xb5\xa7\xe2\xb5\xaf\xe2\xb5\xbf-\xe2\xb6\x96\xe2\xb6\xa0-\xe2\xb6\xa6\xe2\xb6\xa8-\xe2\xb6\xae\xe2\xb6\xb0-\xe2\xb6\xb6\xe2\xb6\xb8-\xe2\xb6\xbe\xe2\xb7\x80-\xe2\xb7\x86\xe2\xb7\x88-\xe2\xb7\x8e\xe2\xb7\x90-\xe2\xb7\x96\xe2\xb7\x98-\xe2\xb7\x9e\xe2\xb7\xa0-\xe2\xb7\xbf\xe2\xb8\xaf\xe3\x80\x85-\xe3\x80\x87\xe3\x80\xa1-\xe3\x80\xaf\xe3\x80\xb1-\xe3\x80\xb5\xe3\x80\xb8-\xe3\x80\xbc\xe3\x81\x81-\xe3\x82\x96\xe3\x82\x99\xe3\x82\x9a\xe3\x82\x9d-\xe3\x82\x9f\xe3\x82\xa1-\xe3\x83\xba\xe3\x83\xbc-\xe3\x83\xbf\xe3\x84\x85-\xe3\x84\xad\xe3\x84\xb1-\xe3\x86\x8e\xe3\x86\xa0-\xe3\x86\xba\xe3\x87\xb0-\xe3\x87\xbf\xe3\x90\x80-\xe4\xb6\xb5\xe4\xb8\x80-\xe9\xbf\x8c\xea\x80\x80-\xea\x92\x8c\xea\x93\x90-\xea\x93\xbd\xea\x94\x80-\xea\x98\x8c\xea\x98\x90-\xea\x98\xab\xea\x99\x80-\xea\x99\xaf\xea\x99\xb4-\xea\x99\xbd\xea\x99\xbf-\xea\x9a\x9d\xea\x9a\x9f-\xea\x9b\xb1\xea\x9c\x97-\xea\x9c\x9f\xea\x9c\xa2-\xea\x9e\x88\xea\x9e\x8b-\xea\x9e\x8e\xea\x9e\x90-\xea\x9e\xad\xea\x9e\xb0\xea\x9e\xb1\xea\x9f\xb7-\xea\xa0\xa7\xea\xa1\x80-\xea\xa1\xb3\xea\xa2\x80-\xea\xa3\x84\xea\xa3\x90-\xea\xa3\x99\xea\xa3\xa0-\xea\xa3\xb7\xea\xa3\xbb\xea\xa4\x80-\xea\xa4\xad\xea\xa4\xb0-\xea\xa5\x93\xea\xa5\xa0-\xea\xa5\xbc\xea\xa6\x80-\xea\xa7\x80\xea\xa7\x8f-\xea\xa7\x99\xea\xa7\xa0-\xea\xa7\xbe\xea\xa8\x80-\xea\xa8\xb6\xea\xa9\x80-\xea\xa9\x8d\xea\xa9\x90-\xea\xa9\x99\xea\xa9\xa0-\xea\xa9\xb6\xea\xa9\xba-\xea\xab\x82\xea\xab\x9b-\xea\xab\x9d\xea\xab\xa0-\xea\xab\xaf\xea\xab\xb2-\xea\xab\xb6\xea\xac\x81-\xea\xac\x86\xea\xac\x89-\xea\xac\x8e\xea\xac\x91-\xea\xac\x96\xea\xac\xa0-\xea\xac\xa6\xea\xac\xa8-\xea\xac\xae\xea\xac\xb0-\xea\xad\x9a\xea\xad\x9c-\xea\xad\x9f\xea\xad\xa4\xea\xad\xa5\xea\xaf\x80-\xea\xaf\xaa\xea\xaf\xac\xea\xaf\xad\xea\xaf\xb0-\xea\xaf\xb9\xea\xb0\x80-\xed\x9e\xa3\xed\x9e\xb0-\xed\x9f\x86\xed\x9f\x8b-\xed\x9f\xbb\xef\xa4\x80-\xef\xa9\xad\xef\xa9\xb0-\xef\xab\x99\xef\xac\x80-\xef\xac\x86\xef\xac\x93-\xef\xac\x97\xef\xac\x9d-\xef\xac\xa8\xef\xac\xaa-\xef\xac\xb6\xef\xac\xb8-\xef\xac\xbc\xef\xac\xbe\xef\xad\x80\xef\xad\x81\xef\xad\x83\xef\xad\x84\xef\xad\x86-\xef\xae\xb1\xef\xaf\x93-\xef\xb4\xbd\xef\xb5\x90-\xef\xb6\x8f\xef\xb6\x92-\xef\xb7\x87\xef\xb7\xb0-\xef\xb7\xbb\xef\xb8\x80-\xef\xb8\x8f\xef\xb8\xa0-\xef\xb8\xad\xef\xb8\xb3\xef\xb8\xb4\xef\xb9\x8d-\xef\xb9\x8f\xef\xb9\xb0-\xef\xb9\xb4\xef\xb9\xb6-\xef\xbb\xbc\xef\xbc\x90-\xef\xbc\x99\xef\xbc\xa1-\xef\xbc\xba\xef\xbc\xbf\xef\xbd\x81-\xef\xbd\x9a\xef\xbd\xa6-\xef\xbe\xbe\xef\xbf\x82-\xef\xbf\x87\xef\xbf\x8a-\xef\xbf\x8f\xef\xbf\x92-\xef\xbf\x97\xef\xbf\x9a-\xef\xbf\x9c]");function GE(t,e){if(!t)throw new Error("ASSERT: "+e)}function VE(t){return 48<=t&&t<=57}function XE(t){return 0<="0123456789abcdefABCDEF".indexOf(t)}function JE(t){return 0<="01234567".indexOf(t)}function ZE(t){return 10===t||13===t||8232===t||8233===t}function QE(t){return 36===t||95===t||65<=t&&t<=90||97<=t&&t<=122||92===t||128<=t&&YE.test(String.fromCharCode(t))}function KE(t){return 36===t||95===t||65<=t&&t<=90||97<=t&&t<=122||48<=t&&t<=57||92===t||128<=t&&HE.test(String.fromCharCode(t))}var tS={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1};function eS(){for(var t,e;fE<cE&&(t=sE.charCodeAt(fE),32===(e=t)||9===e||11===e||12===e||160===e||5760<=e&&0<=[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)||ZE(t));)++fE}function nS(t){var e,n,r,i=0;for(n="u"===t?4:2,e=0;e<n;++e)fE<cE&&XE(sE[fE])?(r=sE[fE++],i=16*i+"0123456789abcdef".indexOf(r.toLowerCase())):mS({},RE,BE);return String.fromCharCode(i)}function rS(){var t,e,n,r;for(e=0,"}"===(t=sE[fE])&&mS({},RE,BE);fE<cE&&XE(t=sE[fE++]);)e=16*e+"0123456789abcdef".indexOf(t.toLowerCase());return(1114111<e||"}"!==t)&&mS({},RE,BE),e<=65535?String.fromCharCode(e):(n=55296+(e-65536>>10),r=56320+(e-65536&1023),String.fromCharCode(n,r))}function iS(){var t,e;for(t=sE.charCodeAt(fE++),e=String.fromCharCode(t),92===t&&(117!==sE.charCodeAt(fE)&&mS({},RE,BE),++fE,(t=nS("u"))&&"\\\\"!==t&&QE(t.charCodeAt(0))||mS({},RE,BE),e=t);fE<cE&&KE(t=sE.charCodeAt(fE));)++fE,e+=String.fromCharCode(t),92===t&&(e=e.substr(0,e.length-1),117!==sE.charCodeAt(fE)&&mS({},RE,BE),++fE,(t=nS("u"))&&"\\\\"!==t&&KE(t.charCodeAt(0))||mS({},RE,BE),e+=t);return e}function aS(){var t,e;return t=fE,{type:1===(e=92===sE.charCodeAt(fE)?iS():function(){var t,e;for(t=fE++;fE<cE;){if(92===(e=sE.charCodeAt(fE)))return fE=t,iS();if(!KE(e))break;++fE}return sE.slice(t,fE)}()).length?gE:tS.hasOwnProperty(e)?mE:"null"===e?yE:"true"===e||"false"===e?pE:gE,value:e,start:t,end:fE}}function oS(){var t,e,n,r,i=fE,a=sE.charCodeAt(fE),o=sE[fE];switch(a){case 46:case 40:case 41:case 59:case 44:case 123:case 125:case 91:case 93:case 58:case 63:case 126:return++fE,{type:_E,value:String.fromCharCode(a),start:i,end:fE};default:if(61===(t=sE.charCodeAt(fE+1)))switch(a){case 43:case 45:case 47:case 60:case 62:case 94:case 124:case 37:case 38:case 42:return fE+=2,{type:_E,value:String.fromCharCode(a)+String.fromCharCode(t),start:i,end:fE};case 33:case 61:return fE+=2,61===sE.charCodeAt(fE)&&++fE,{type:_E,value:sE.slice(i,fE),start:i,end:fE}}}return">>>="===(r=sE.substr(fE,4))?{type:_E,value:r,start:i,end:fE+=4}:">>>"===(n=r.substr(0,3))||"<<="===n||">>="===n?{type:_E,value:n,start:i,end:fE+=3}:o===(e=n.substr(0,2))[1]&&0<="+-<>&|".indexOf(o)||"=>"===e?{type:_E,value:e,start:i,end:fE+=2}:0<="<>=!+-*%&|^/".indexOf(o)?{type:_E,value:o,start:i,end:++fE}:void mS({},RE,BE)}function uS(){var t,e,n;if(GE(VE((n=sE[fE]).charCodeAt(0))||"."===n,"Numeric literal must start with a decimal digit or a decimal point"),e=fE,t="","."!==n){if(t=sE[fE++],n=sE[fE],"0"===t){if("x"===n||"X"===n)return++fE,function(t){for(var e="";fE<cE&&XE(sE[fE]);)e+=sE[fE++];return 0===e.length&&mS({},RE,BE),QE(sE.charCodeAt(fE))&&mS({},RE,BE),{type:bE,value:parseInt("0x"+e,16),start:t,end:fE}}(e);if(JE(n))return function(t){for(var e="0"+sE[fE++];fE<cE&&JE(sE[fE]);)e+=sE[fE++];return(QE(sE.charCodeAt(fE))||VE(sE.charCodeAt(fE)))&&mS({},RE,BE),{type:bE,value:parseInt(e,8),octal:!0,start:t,end:fE}}(e);n&&VE(n.charCodeAt(0))&&mS({},RE,BE)}for(;VE(sE.charCodeAt(fE));)t+=sE[fE++];n=sE[fE]}if("."===n){for(t+=sE[fE++];VE(sE.charCodeAt(fE));)t+=sE[fE++];n=sE[fE]}if("e"===n||"E"===n)if(t+=sE[fE++],"+"!==(n=sE[fE])&&"-"!==n||(t+=sE[fE++]),VE(sE.charCodeAt(fE)))for(;VE(sE.charCodeAt(fE));)t+=sE[fE++];else mS({},RE,BE);return QE(sE.charCodeAt(fE))&&mS({},RE,BE),{type:bE,value:parseFloat(t),start:e,end:fE}}function sS(){var t,e,n,r;return lE=null,eS(),t=fE,e=function(){var t,e,n,r;for(GE("/"===(t=sE[fE]),"Regular expression literal must start with a slash"),e=sE[fE++],r=n=!1;fE<cE;)if(e+=t=sE[fE++],"\\\\"===t)ZE((t=sE[fE++]).charCodeAt(0))&&mS({},jE),e+=t;else if(ZE(t.charCodeAt(0)))mS({},jE);else if(n)"]"===t&&(n=!1);else{if("/"===t){r=!0;break}"["===t&&(n=!0)}return r||mS({},jE),{value:e.substr(1,e.length-2),literal:e}}(),n=function(){var t,e,n;for(n=e="";fE<cE&&KE((t=sE[fE]).charCodeAt(0));)++fE,"\\\\"===t&&fE<cE?mS({},RE,BE):(n+=t,e+=t);return 0<=n.search(/[^gimuy]/g)&&mS({},FE,n),{value:n,literal:e}}(),r=function(t,e){var n=t;0<=e.indexOf("u")&&(n=n.replace(/\\\\u\\{([0-9a-fA-F]+)\\}/g,function(t,e){if(parseInt(e,16)<=1114111)return"x";mS({},FE)}).replace(/[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g,"x"));try{new RegExp(n)}catch(t){mS({},FE)}try{return new RegExp(t,e)}catch(t){return null}}(e.value,n.value),{literal:e.literal+n.literal,value:r,regex:{pattern:e.value,flags:n.value},start:t,end:fE}}function fS(){var t;return eS(),cE<=fE?{type:vE,start:fE,end:fE}:QE(t=sE.charCodeAt(fE))?aS():40===t||41===t||59===t?oS():39===t||34===t?function(){var t,e,n,r,i="",a=!1;for(GE("\'"===(t=sE[fE])||\'"\'===t,"String literal must starts with a quote"),e=fE,++fE;fE<cE;){if((n=sE[fE++])===t){t="";break}if("\\\\"===n)if((n=sE[fE++])&&ZE(n.charCodeAt(0)))"\\r"===n&&"\\n"===sE[fE]&&++fE;else switch(n){case"u":case"x":"{"===sE[fE]?(++fE,i+=rS()):i+=nS(n);break;case"n":i+="\\n";break;case"r":i+="\\r";break;case"t":i+="\\t";break;case"b":i+="\\b";break;case"f":i+="\\f";break;case"v":i+="\\v";break;default:JE(n)?(0!==(r="01234567".indexOf(n))&&(a=!0),fE<cE&&JE(sE[fE])&&(a=!0,r=8*r+"01234567".indexOf(sE[fE++]),0<="0123".indexOf(n)&&fE<cE&&JE(sE[fE])&&(r=8*r+"01234567".indexOf(sE[fE++]))),i+=String.fromCharCode(r)):i+=n}else{if(ZE(n.charCodeAt(0)))break;i+=n}}return""!==t&&mS({},RE,BE),{type:xE,value:i,octal:a,start:e,end:fE}}():46===t?VE(sE.charCodeAt(fE+1))?uS():oS():VE(t)?uS():oS()}function cS(){var t;return fE=(t=lE).end,lE=fS(),fE=t.end,t}function lS(){var t;t=fE,lE=fS(),fE=t}function hS(t,e,n){var r=new dE("||"===t||"&&"===t?CE:ME);return r.operator=t,r.left=e,r.right=n,r}function dS(t){var e=new dE(SE);return e.name=t,e}function pS(t){var e=new dE(AE);return e.value=t.value,e.raw=sE.slice(t.start,t.end),t.regex&&("//"===e.raw&&(e.raw="/(?:)/"),e.regex=t.regex),e}function vS(t,e,n){var r=new dE(zE);return r.computed="["===t,r.object=e,r.property=n,r.computed||(n.member=!0),r}function gS(t,e,n){var r=new dE(OE);return r.key=e,r.value=n,r.kind=t,r}function mS(t,e){var n,r=Array.prototype.slice.call(arguments,2),i=e.replace(/%(\\d)/g,function(t,e){return GE(e<r.length,"Message reference must be in range"),r[e]});throw(n=new Error(i)).index=fE,n.description=i,n}function yS(t){t.type===vE&&mS(t,UE),t.type===bE&&mS(t,TE),t.type===xE&&mS(t,PE),t.type===gE&&mS(t,LE),t.type===mE&&mS(t,qE),mS(t,RE,t.value)}function bS(t){var e=cS();e.type===_E&&e.value===t||yS(e)}function _S(t){return lE.type===_E&&lE.value===t}function xS(t){return lE.type===mE&&lE.value===t}function wS(){var t,e,n=[];for(fE=lE.start,bS("[");!_S("]");)_S(",")?(cS(),n.push(null)):(n.push(NS()),_S("]")||bS(","));return cS(),t=n,(e=new dE(wE)).elements=t,e}function MS(){var t;return fE=lE.start,(t=cS()).type===xE||t.type===bE?(t.octal&&mS(t,IE),pS(t)):dS(t.value)}function kS(){var t,e,n,r,i,a,o,u=[],s={},f=String;for(fE=lE.start,bS("{");!_S("}");)i=r=n=void 0,fE=lE.start,e="$"+((t=(n=lE).type===gE?(i=MS(),bS(":"),gS("init",i,NS())):n.type!==vE&&n.type!==_E?(r=MS(),bS(":"),gS("init",r,NS())):void yS(n)).key.type===SE?t.key.name:f(t.key.value)),Object.prototype.hasOwnProperty.call(s,e)?mS({},$E):s[e]=!0,u.push(t),_S("}")||bS(",");return bS("}"),a=u,(o=new dE(DE)).properties=a,o}var ES={if:1,this:1};function SS(){var t,e,n,r;if(_S("("))return bS("("),r=RS(),bS(")"),r;if(_S("["))return wS();if(_S("{"))return kS();if(t=lE.type,fE=lE.start,t===gE||ES[lE.value])n=dS(cS().value);else if(t===xE||t===bE)lE.octal&&mS(lE,IE),n=pS(cS());else{if(t===mE)throw new Error(WE);t===pE?((e=cS()).value="true"===e.value,n=pS(e)):t===yE?((e=cS()).value=null,n=pS(e)):_S("/")||_S("/=")?(n=pS(sS()),lS()):yS(cS())}return n}function AS(){var t=[];if(bS("("),!_S(")"))for(;fE<cE&&(t.push(NS()),!_S(")"));)bS(",");return bS(")"),t}function CS(){var t,e;return fE=lE.start,t=cS(),(e=t).type!==gE&&e.type!==mE&&e.type!==pE&&e.type!==yE&&yS(t),dS(t.value)}function zS(){var t=function(){var t,e,n,r,i,a;for(t=SS();;)if(_S("."))bS("."),t=vS(".",t,CS());else if(_S("("))e=AS(),r=t,i=e,a=void 0,(a=new dE(kE)).callee=r,a.arguments=i,t=a;else{if(!_S("["))break;n=void 0,bS("["),n=RS(),bS("]"),t=vS("[",t,n)}return t}();if(lE.type===_E&&(_S("++")||_S("--")))throw new Error(WE);return t}function DS(){var t,e,n,r,i;if(lE.type!==_E&&lE.type!==mE)e=zS();else{if(_S("++")||_S("--"))throw new Error(WE);if(_S("+")||_S("-")||_S("~")||_S("!"))t=cS(),e=DS(),n=t.value,r=e,(i=new dE(NE)).operator=n,i.argument=r,i.prefix=!0,e=i;else{if(xS("delete")||xS("void")||xS("typeof"))throw new Error(WE);e=zS()}}return e}function OS(t){var e=0;if(t.type!==_E&&t.type!==mE)return 0;switch(t.value){case"||":e=1;break;case"&&":e=2;break;case"|":e=3;break;case"^":e=4;break;case"&":e=5;break;case"==":case"!=":case"===":case"!==":e=6;break;case"<":case">":case"<=":case">=":case"instanceof":case"in":e=7;break;case"<<":case">>":case">>>":e=8;break;case"+":case"-":e=9;break;case"*":case"/":case"%":e=11}return e}function NS(){var t,e,n,r,i,a,o;return t=function(){var t,e,n,r,i,a,o,u,s,f;if(t=lE,s=DS(),0===(i=OS(r=lE)))return s;for(r.prec=i,cS(),e=[t,lE],a=[s,r,o=DS()];0<(i=OS(lE));){for(;2<a.length&&i<=a[a.length-2].prec;)o=a.pop(),u=a.pop().value,s=a.pop(),e.pop(),n=hS(u,s,o),a.push(n);(r=cS()).prec=i,a.push(r),e.push(lE),n=DS(),a.push(n)}for(n=a[f=a.length-1],e.pop();1<f;)e.pop(),n=hS(a[f-1].value,a[f-2],n),f-=2;return n}(),_S("?")&&(cS(),e=NS(),bS(":"),n=NS(),r=t,i=e,a=n,(o=new dE(EE)).test=r,o.consequent=i,o.alternate=a,t=o),t}function RS(){var t=NS();if(_S(","))throw new Error(WE);return t}var TS={NaN:"NaN",E:"Math.E",LN2:"Math.LN2",LN10:"Math.LN10",LOG2E:"Math.LOG2E",LOG10E:"Math.LOG10E",PI:"Math.PI",SQRT1_2:"Math.SQRT1_2",SQRT2:"Math.SQRT2",MIN_VALUE:"Number.MIN_VALUE",MAX_VALUE:"Number.MAX_VALUE"},PS=function(f){function t(o,u,s){return function(t){return e=o,r=u,i=s,a=f((n=t)[0]),r&&(a=r+"("+a+")",0===r.lastIndexOf("new ",0)&&(a="("+a+")")),a+"."+e+(i<0?"":0===i?"()":"("+n.slice(1).map(f).join(",")+")");var e,n,r,i,a}}var e="new Date",n="String";return{isNaN:"isNaN",isFinite:"isFinite",abs:"Math.abs",acos:"Math.acos",asin:"Math.asin",atan:"Math.atan",atan2:"Math.atan2",ceil:"Math.ceil",cos:"Math.cos",exp:"Math.exp",floor:"Math.floor",log:"Math.log",max:"Math.max",min:"Math.min",pow:"Math.pow",random:"Math.random",round:"Math.round",sin:"Math.sin",sqrt:"Math.sqrt",tan:"Math.tan",clamp:function(t){t.length<3&&rt("Missing arguments to clamp function."),3<t.length&&rt("Too many arguments to clamp function.");var e=t.map(f);return"Math.max("+e[1]+", Math.min("+e[2]+","+e[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:e,date:t("getDate",e,0),day:t("getDay",e,0),year:t("getFullYear",e,0),month:t("getMonth",e,0),hours:t("getHours",e,0),minutes:t("getMinutes",e,0),seconds:t("getSeconds",e,0),milliseconds:t("getMilliseconds",e,0),time:t("getTime",e,0),timezoneoffset:t("getTimezoneOffset",e,0),utcdate:t("getUTCDate",e,0),utcday:t("getUTCDay",e,0),utcyear:t("getUTCFullYear",e,0),utcmonth:t("getUTCMonth",e,0),utchours:t("getUTCHours",e,0),utcminutes:t("getUTCMinutes",e,0),utcseconds:t("getUTCSeconds",e,0),utcmilliseconds:t("getUTCMilliseconds",e,0),length:t("length",null,-1),indexof:t("indexOf",null),lastindexof:t("lastIndexOf",null),slice:t("slice",null),parseFloat:"parseFloat",parseInt:"parseInt",upper:t("toUpperCase",n,0),lower:t("toLowerCase",n,0),substring:t("substring",n),replace:t("replace",n),regexp:"RegExp",test:t("test","RegExp"),if:function(t){t.length<3&&rt("Missing arguments to if function."),3<t.length&&rt("Too many arguments to if function.");var e=t.map(f);return"("+e[0]+"?"+e[1]+":"+e[2]+")"}}},LS={};function qS(t,e,n){var r=t+":"+n,i=LS[r];return i&&i[0]===e||(LS[r]=i=[e,e(n)]),i[1]}function US(t,e){return qS("timeFormat",un,e)(t)}var FS=new Date(2e3,0,1);function jS(t,e,n){return FS.setMonth(t),FS.setDate(e),US(FS,n)}function IS(e,t,n){try{e[t].apply(e,["EXPRESSION"].concat([].slice.call(n)))}catch(t){e.warn(t)}return n[n.length-1]}var $S="undefined"!=typeof window&&window||null;var BS="Literal",WS="Identifier",YS="@",HS="%",GS=":";function VS(t,e){var n;return R(t)?t:p(t)?(n=e.scales[t])&&n.value:void 0}function XS(t,e,n){var r=HS+n;if(!e.hasOwnProperty(r))try{e[r]=t.scaleRef(n)}catch(t){}}function JS(t,e,n,r){if(e[0].type===BS)XS(n,r,e[0].value);else if(e[0].type===WS)for(t in n.scales)XS(n,r,t)}function ZS(i,a){return function(t,e,n){if(t){var r=VS(t,(n||this).context);return r&&r.path[i](e)}return a(e)}}var QS=ZS("area",function(t){return Xm.reset(),Gm(t,Jm),2*Xm}),KS=ZS("bounds",function(t){var e,n,r,i,a,o,u;if(iy=ry=-(ey=ny=1/0),gy=[],Gm(t,by),n=gy.length){for(gy.sort(Cy),e=1,a=[r=gy[0]];e<n;++e)zy(r,(i=gy[e])[0])||zy(r,i[1])?(Ay(r[0],i[1])>Ay(r[0],r[1])&&(r[1]=i[1]),Ay(i[0],r[1])>Ay(r[0],r[1])&&(r[0]=i[0])):a.push(r=i);for(o=-1/0,e=0,r=a[n=a.length-1];e<=n;r=i,++e)i=a[e],(u=Ay(r[1],i[0]))>o&&(o=u,ey=i[0],ry=r[1])}return gy=my=null,ey===1/0||ny===1/0?[[NaN,NaN],[NaN,NaN]]:[[ey,ny],[ry,iy]]}),tA=ZS("centroid",function(t){Dy=Oy=Ny=Ry=Ty=Py=Ly=qy=Uy=Fy=jy=0,Gm(t,Hy);var e=Uy,n=Fy,r=jy,i=e*e+n*n+r*r;return i<1e-12&&(e=Py,n=Ly,r=qy,Oy<vm&&(e=Ny,n=Ry,r=Ty),(i=e*e+n*n+r*r)<1e-12)?[NaN,NaN]:[km(n,e)*_m,Pm(r/Nm(i))*_m]});function eA(t){var e=this.context.data[t];return e?e.values.value:[]}function nA(t,e,n,r){e[0].type!==BS&&rt("First argument to data functions must be a string literal.");var i=e[0].value,a=GS+i;r.hasOwnProperty(a)||(r[a]=n.getData(i).tuplesRef())}var rA={};function iA(t){return t.data}function aA(t,e){var n=eA.call(e,t);return n.root&&n.root.lookup||rA}var oA=function(t,e,n,r){var i,a=e[0],o=e[e.length-1];return o<a&&(i=a,a=o,o=i),r=void 0===r||r,((n=void 0===n||n)?a<=t:a<t)&&(r?t<=o:t<o)};function uA(t,e){return t===e||t!=t&&e!=e||!(!d(t)||!d(e)||t.length!==e.length)&&function(t,e){for(var n=0,r=t.length;n<r;++n)if(!uA(t[n],e[n]))return!1;return!0}(t,e)}function sA(n){return function(t){for(var e in n)if(!uA(t[e],n[e]))return!1;return!0}}var fA="bin_",cA="intersect",lA="union",hA="index:unit";function dA(t,e){for(var n,r=e.fields,i=e.values,a=e.getter||(e.getter=[]),o=r.length,u=0;u<o;++u)if(a[u]=a[u]||l(r[u]),n=a[u](t),$(n)&&(n=S(n)),$(i[u])&&(i[u]=S(i[u])),e[fA+r[u]]){if($(i[u][0])&&(i[u]=i[u].map(S)),!oA(n,i[u],!0,!1))return!1}else if(n!==i[u])return!1;return!0}function pA(t,e){for(var n,r,i=e.intervals,a=i.length,o=0;o<a;++o){if(n=i[o].extent,r=(i[o].getter||(i[o].getter=l(i[o].field)))(t),!n||n[0]===n[1])return!1;if($(r)&&(r=S(r)),$(n[0])&&(n=i[o].extent=n.map(S)),B(n[0])&&!oA(r,n))return!1;if(p(n[0])&&n.indexOf(r)<0)return!1}return!0}function vA(t,e,n,r){for(var i,a,o,u,s,f=this.context.data[t],c=f?f.values.value:[],l=f?f[hA]&&f[hA].value:void 0,h=n===cA,d=c.length,p=0;p<d;++p)if(i=c[p],l&&h){if(-1===(o=(a=a||{})[u=i.unit]||0))continue;if(s=r(e,i),a[u]=s?-1:++o,s&&1===l.size)return!0;if(!s&&o===l.get(u).count)return!1}else if(h^(s=r(e,i)))return s;return d&&h}function gA(t,e,n){return vA.call(this,t,e,n,dA)}function mA(t,e,n,r){e[0].type!==BS&&rt("First argument to indata must be a string literal.");var i=e[0].value,a=2<=e.length&&e[e.length-1].value,o=YS+"unit";a!==cA||r.hasOwnProperty(o)||(r[o]=n.getData(i).indataRef(n,"unit")),nA(0,e,n,r)}function yA(t,e,n,r){var i,a,o,u,s,f=this.context.data[t],c=f?f.values.value:[],l=f?f[hA]&&f[hA].value:void 0,h=c[0],d=0;if(h){for(i=e?h.encodings.length:h.fields.length;d<i;++d)if(e&&h.encodings[d]===e||n&&h.fields[d]===n){a=d,u=h[fA+h.fields[d]];break}return l&&1===l.size&&(r=lA),l&&r===cA?(s=c.reduce(function(t,e){return(t[e.unit]||(t[e.unit]=[])).push({unit:e.unit,value:e.values[a]}),t},{}),o=Object.keys(s).map(function(t){return{unit:t,value:u?_A(s[t],lA):bA(s[t],lA)}})):o=c.map(function(t){return{unit:t.unit,value:t.values[a]}}),u?_A(o,r):bA(o,r)}}function bA(t,e){for(var n,r,i,a,o={},u=0,s={},f=[],c=0,l=t.length;c<l;++c)r=(n=t[c]).unit,a=n.value,o[r]||(o[r]=++u),(i=s[a])||(s[a]=i={value:a,units:{},count:0}),i.units[r]||(i.units[r]=++i.count);for(a in s)i=s[a],e===cA&&i.count!==u||f.push(i.value);return f.length?f:void 0}function _A(t,e){for(var n,r,i,a,o=e===cA?wA:xA,u=0,s=t.length;u<s;++u)n=t[u].value,$(n[0])&&(n=n.map(S)),i=n[0],(a=n[1])<i&&(a=n[0],i=n[1]),r=r?o(r,i,a):[i,a];return r&&r.length&&+r[0]!=+r[1]?r:void 0}function xA(t,e,n){return t[0]>e&&(t[0]=e),t[1]<n&&(t[1]=n),t}function wA(t,e,n){return n<t[0]||t[1]<e?[]:(t[0]<e&&(t[0]=e),t[1]>n&&(t[1]=n),t)}var MA={random:function(){return y.random()},isArray:d,isBoolean:I,isDate:$,isNumber:B,isObject:J,isRegExp:W,isString:p,isTuple:ft,toBoolean:X,toDate:tt,toNumber:S,toString:et,pad:V,peek:E,truncate:it,rgb:ih,lab:_h,hcl:Sh,hsl:uh,sequence:pi,format:function(t,e){return qS("format",Bd,e)(t)},utcFormat:function(t,e){return qS("utcFormat",fn,e)(t)},utcParse:function(t,e){return qS("utcParse",cn,e)(t)},timeFormat:US,timeParse:function(t,e){return qS("timeParse",sn,e)(t)},monthFormat:function(t){return jS(t,1,"%B")},monthAbbrevFormat:function(t){return jS(t,1,"%b")},dayFormat:function(t){return jS(0,2+t,"%A")},dayAbbrevFormat:function(t){return jS(0,2+t,"%a")},quarter:function(t){return 1+~~(new Date(t).getMonth()/3)},utcquarter:function(t){return 1+~~(new Date(t).getUTCMonth()/3)},warn:function(){return IS(this.context.dataflow,"warn",arguments)},info:function(){return IS(this.context.dataflow,"info",arguments)},debug:function(){return IS(this.context.dataflow,"debug",arguments)},inScope:function(t){var e=this.context.group,n=!1;if(e)for(;t;){if(t===e){n=!0;break}t=t.mark.group}return n},clampRange:function(t,e,n){var r,i=t[0],a=t[1];return a<i&&(r=a,a=i,i=r),n-e<=(r=a-i)?[e,n]:[Math.min(Math.max(i,e),n-r),Math.min(Math.max(a,r),n)]},pinchDistance:function(t){var e=t.touches,n=e[0].clientX-e[1].clientX,r=e[0].clientY-e[1].clientY;return Math.sqrt(n*n+r*r)},pinchAngle:function(t){var e=t.touches;return Math.atan2(e[0].clientY-e[1].clientY,e[0].clientX-e[1].clientX)},screen:function(){return $S?$S.screen:{}},containerSize:function(){var t=this.context.dataflow,e=t.container&&t.container();return e?[e.clientWidth,e.clientHeight]:[void 0,void 0]},windowSize:function(){return $S?[$S.innerWidth,$S.innerHeight]:[void 0,void 0]},span:function(t){return t[t.length-1]-t[0]||0},flush:function(t,e,n,r,i,a){var o=Math.abs(e-t[0]),u=Math.abs(E(t)-e);return o<u&&o<=n?r:u<=n?i:a},bandspace:function(t,e,n){return Nl(t||0,e||0,n||0)},inrange:oA,setdata:function(t,e){var n=this.context.dataflow,r=this.context.data[t].input;return n.pulse(r,n.changeset().remove(v).insert(e)),1},pathShape:function(e){var n=null;return function(t){return t?Su(t,n=n||bu(e)):e}},panLinear:s,panLog:A,panPow:C,zoomLinear:D,zoomLog:O,zoomPow:N,encode:function(t,e,n){if(t){var r=this.context.dataflow,i=t.mark.source;r.pulse(i,r.changeset().encode(t,e))}return void 0!==n?n:t},modify:function(t,e,n,r,i,a){var o,u,s=this.context.dataflow,f=this.context.data[t],c=f.input,l=f.changes,h=s.stamp();if(!1===s._trigger||!(c.value.length||e||r))return 0;if((!l||l.stamp<h)&&(f.changes=l=s.changeset(),l.stamp=h,s.runAfter(function(){f.modified=!0,s.pulse(c,l).run()},!0,1)),n&&(o=!0===n?v:d(n)||ft(n)?n:sA(n),l.remove(o)),e&&l.insert(e),r&&(o=sA(r),c.value.some(o)?l.remove(o):l.insert(r)),i)for(u in a)l.modify(i,u,a[u]);return 1}},kA=["view","item","group","xy","x","y"],EA="event.vega.",SA="this.",AA={};function CA(t,e,n){return 1===arguments.length?MA[t]:(MA[t]=e,n&&(AA[t]=n),DA&&(DA.functions[t]=SA+t),this)}CA("bandwidth",function(t,e){var n=VS(t,(e||this).context);return n&&n.bandwidth?n.bandwidth():0},JS),CA("copy",function(t,e){var n=VS(t,(e||this).context);return n?n.copy():void 0},JS),CA("domain",function(t,e){var n=VS(t,(e||this).context);return n?n.domain():[]},JS),CA("range",function(t,e){var n=VS(t,(e||this).context);return n&&n.range?n.range():[]},JS),CA("invert",function(t,e,n){var r=VS(t,(n||this).context);return r?d(e)?(r.invertRange||r.invert)(e):(r.invert||r.invertExtent)(e):void 0},JS),CA("scale",function(t,e,n){var r=VS(t,(n||this).context);return r?r(e):void 0},JS),CA("gradient",function(t,e,n,r,i){t=VS(t,(i||this).context);var a=Xa(e,n),o=t.domain(),u=o[0],s=o[o.length-1],f=rg(t,u,s);t.ticks&&(u!==(o=t.ticks(+r||15))[0]&&o.unshift(u),s!==o[o.length-1]&&o.push(s));for(var c=0,l=o.length;c<l;++c)a.stop(f(o[c]),t(o[c]));return a},JS),CA("geoArea",QS,JS),CA("geoBounds",KS,JS),CA("geoCentroid",tA,JS),CA("geoShape",function(t,e,n){var r=VS(t,(n||this).context);return function(t){return r?r.path.context(t)(e):""}},JS),CA("indata",function(t,e,n){var r=this.context.data[t]["index:"+e],i=r?r.value.get(n):void 0;return i?i.count:i},function(t,e,n,r){e[0].type!==BS&&rt("First argument to indata must be a string literal."),e[1].type!==BS&&rt("Second argument to indata must be a string literal.");var i=e[0].value,a=e[1].value,o=YS+a;r.hasOwnProperty(o)||(r[o]=n.getData(i).indataRef(n,a))}),CA("data",eA,nA),CA("vlSingle",gA,nA),CA("vlSingleDomain",yA,nA),CA("vlMulti",gA,mA),CA("vlMultiDomain",yA,mA),CA("vlInterval",function(t,e,n){return vA.call(this,t,e,n,pA)},nA),CA("vlIntervalDomain",function(t,e,n,r){var i,a,o,u,s,f=this.context.data[t],c=f?f.values.value:[],l=c[0],h=0;if(l){for(i=l.intervals.length;h<i;++h)if(a=l.intervals[h],e&&a.encoding===e||n&&a.field===n){if(!a.extent)return;o=h,s=2<a.extent.length;break}return u=c.reduce(function(t,e){var n=e.intervals[o].extent,r=s?n.map(function(t){return{unit:e.unit,value:t}}):{unit:e.unit,value:n};return s?t.push.apply(t,r):t.push(r),t},[]),s?bA(u,r):_A(u,r)}},nA),CA("treePath",function(t,e,n){var r=aA(t,this),i=r[e],a=r[n];return i&&a?i.path(a).map(iA):void 0},nA),CA("treeAncestors",function(t,e){var n=aA(t,this)[e];return n?n.ancestors().map(iA):void 0},nA);var zA={blacklist:["_"],whitelist:["datum","event","item"],fieldvar:"datum",globalvar:function(t){return"_["+Z("$"+t)+"]"},functions:function(t){var e=PS(t);for(var n in kA.forEach(function(t){e[t]=EA+t}),MA)e[n]=SA+n;return e},constants:TS,visitors:AA},DA=function(t){var n=(t=t||{}).whitelist?nt(t.whitelist):{},r=t.blacklist?nt(t.blacklist):{},i=t.constants||TS,a=(t.functions||PS)(l),e=t.globalvar,o=t.fieldvar,u={},s={},f=0,c=R(e)?e:function(t){return e+\'["\'+t+\'"]\'};function l(t){if(p(t))return t;var e=h[t.type];return null==e&&rt("Unsupported type: "+t.type),e(t)}var h={Literal:function(t){return t.raw},Identifier:function(t){var e=t.name;return 0<f?e:r.hasOwnProperty(e)?rt("Illegal identifier: "+e):i.hasOwnProperty(e)?i[e]:n.hasOwnProperty(e)?e:(u[e]=1,c(e))},MemberExpression:function(t){var e=!t.computed,n=l(t.object);e&&(f+=1);var r=l(t.property);return n===o&&(s[r]=1),e&&(f-=1),n+(e?"."+r:"["+r+"]")},CallExpression:function(t){"Identifier"!==t.callee.type&&rt("Illegal callee type: "+t.callee.type);var e=t.callee.name,n=t.arguments,r=a.hasOwnProperty(e)&&a[e];return r||rt("Unrecognized function: "+e),R(r)?r(n):r+"("+n.map(l).join(",")+")"},ArrayExpression:function(t){return"["+t.elements.map(l).join(",")+"]"},BinaryExpression:function(t){return"("+l(t.left)+t.operator+l(t.right)+")"},UnaryExpression:function(t){return"("+t.operator+l(t.argument)+")"},ConditionalExpression:function(t){return"("+l(t.test)+"?"+l(t.consequent)+":"+l(t.alternate)+")"},LogicalExpression:function(t){return"("+l(t.left)+t.operator+l(t.right)+")"},ObjectExpression:function(t){return"{"+t.properties.map(l).join(",")+"}"},Property:function(t){f+=1;var e=l(t.key);return f-=1,e+":"+l(t.value)}};function d(t){var e={code:l(t),globals:Object.keys(u),fields:Object.keys(s)};return u={},s={},e}return d.functions=a,d.constants=i,d}(zA),OA=function(e,r,t){var n,i,a={};try{n=function(t){fE=0,cE=(sE=t).length,lE=null,lS();var e=RS();if(lE.type!==vE)throw new Error("Unexpect token after expression.");return e}(e)}catch(t){rt("Expression parse error: "+Z(e))}return n.visit(function(t){if("CallExpression"===t.type){var e=t.callee.name,n=zA.visitors[e];n&&n(e,t.arguments,r,a)}}),(i=DA(n)).globals.forEach(function(t){var e="$"+t;!a.hasOwnProperty(e)&&r.getSignal(t)&&(a[e]=r.signalRef(t))}),{$expr:t?t+"return("+i.code+");":i.code,$fields:i.fields,$params:a}},NA="view",RA="scope";function TA(t,e){return(t.merge?PA:t.stream?LA:t.type?qA:rt("Invalid stream specification: "+Z(t)))(t,e)}function PA(t,e){var n=UA({merge:t.merge.map(function(t){return TA(t,e)})},t,e);return e.addStream(n).id}function LA(t,e){var n=UA({stream:TA(t.stream,e)},t,e);return e.addStream(n).id}function qA(t,e){var n,r=e.event((n=t.source)===RA?NA:n||NA,t.type),i=UA({stream:r},t,e);return 1===Object.keys(i).length?r:e.addStream(i).id}function UA(t,e,n){var r,i,a,o,u=e.between;return u&&(2!==u.length&&rt(\'Stream "between" parameter must have 2 entries: \'+Z(e)),t.between=[TA(u[0],n),TA(u[1],n)]),u=e.filter?Q(e.filter):[],(e.marktype||e.markname||e.markrole)&&u.push((r=e.marktype,i=e.markname,a=e.markrole,(o="event.item")+(r&&"*"!==r?"&&"+o+".mark.marktype===\'"+r+"\'":"")+(a?"&&"+o+".mark.role===\'"+a+"\'":"")+(i?"&&"+o+".mark.name===\'"+i+"\'":""))),e.source===RA&&u.push("inScope(event.item)"),u.length&&(t.filter=OA("("+u.join(")&&(")+")").$expr),null!=(u=e.throttle)&&(t.throttle=+u),null!=(u=e.debounce)&&(t.debounce=+u),e.consume&&(t.consume=!0),t}var FA,jA,IA="view",$A="[",BA="]",WA="{",YA="}",HA=":",GA=",",VA="@",XA=">",JA=/[[\\]{}]/,ZA={"*":1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1};function QA(t,e,n,r,i){for(var a,o=0,u=t.length;e<u;++e){if(a=t[e],!o&&a===n)return e;i&&0<=i.indexOf(a)?--o:r&&0<=r.indexOf(a)&&++o}return e}function KA(t){for(var e=[],n=0,r=t.length,i=0;i<r;)i=QA(t,i,GA,$A+WA,BA+YA),e.push(t.substring(n,i).trim()),n=++i;if(0===e.length)throw"Empty event selector: "+t;return e}function tC(t){return"["===t[0]?function(t){var e,n,r=t.length,i=1;if((i=QA(t,i,BA,$A,BA))===r)throw"Empty between selector: "+t;if(2!==(e=KA(t.substring(1,i))).length)throw"Between selector must have two elements: "+t;if((t=t.slice(i+1).trim())[0]!==XA)throw"Expected \'>\' after between selector: "+t;{if(e=e.map(tC),(n=tC(t.slice(1).trim())).between)return{between:e,stream:n};n.between=e}return n}(t):function(e){var t,n,r={source:FA},i=[],a=[0,0],o=0,u=0,s=e.length,f=0;if(e[s-1]===YA){if(!(0<=(f=e.lastIndexOf(WA))))throw"Unmatched right brace: "+e;try{a=function(n){var t=n.split(GA);if(!n.length||2<t.length)throw n;return t.map(function(t){var e=+t;if(e!=e)throw n;return e})}(e.substring(f+1,s-1))}catch(t){throw"Invalid throttle specification: "+e}e=e.slice(0,f).trim(),s=e.length,f=0}if(!s)throw e;e[0]===VA&&(o=++f);(t=QA(e,f,HA))<s&&(i.push(e.substring(u,t).trim()),u=f=++t);if((f=QA(e,f,$A))===s)i.push(e.substring(u,s).trim());else if(i.push(e.substring(u,f).trim()),n=[],(u=++f)===s)throw"Unmatched left bracket: "+e;for(;f<s;){if((f=QA(e,f,BA))===s)throw"Unmatched left bracket: "+e;if(n.push(e.substring(u,f).trim()),f<s-1&&e[++f]!==$A)throw"Expected left bracket: "+e;u=++f}if(!(s=i.length)||JA.test(i[s-1]))throw"Invalid event selector: "+e;1<s?(r.type=i[1],o?r.markname=i[0].slice(1):(c=i[0],jA.hasOwnProperty(c)?r.marktype=i[0]:r.source=i[0])):r.type=i[0];var c;"!"===r.type.slice(-1)&&(r.consume=!0,r.type=r.type.slice(0,-1));null!=n&&(r.filter=n);a[0]&&(r.throttle=a[0]);a[1]&&(r.debounce=a[1]);return r}(t)}var eC="var datum=event.item&&event.item.datum;",nC=function(t,r,e){var n,i,a,o,u=t.events,s=t.update,f=t.encode,c=[];u||rt("Signal update missing events specification."),p(u)&&(FA=a||IA,jA=o||ZA,u=KA(u.trim()).map(tC)),(u=Q(u).filter(function(t){return t.signal||t.scale?(c.push(t),0):1})).length&&c.push(1<u.length?{merge:u}:u[0]),null!=f&&(s&&rt("Signal encode and update are mutually exclusive."),s="encode(item(),"+Z(f)+")"),n=p(s)?OA(s,r,eC):null!=s.expr?OA(s.expr,r,eC):null!=s.value?s.value:null!=s.signal?{$expr:"_.value",$params:{value:r.signalRef(s.signal)}}:rt("Invalid signal update specification."),i={target:e,update:n},t.force&&(i.options={force:!0}),c.forEach(function(t){var e,n;t={source:(e=t,n=r,e.signal?n.getSignal(e.signal).id:e.scale?n.getScale(e.scale).id:TA(e,n))},r.addUpdate(Wt(t,i))})};function rC(t,e,n,r){this.id=-1,this.type=t,this.value=e,this.params=n,r&&(this.parent=r)}function iC(t,e,n,r){return new rC(t,e,n,r)}function aC(t,e){return iC("operator",t,e)}function oC(t){var e={$ref:t.id};return t.id<0&&(t.refs=t.refs||[]).push(e),e}var uC={$tupleid:1,toString:function(){return":_tupleid_:"}};function sC(t,e){return e?{$field:t,$name:e}:{$field:t}}var fC=sC("key");function cC(t,e){return{$compare:t,$order:e}}var lC="descending";function hC(t,e){return(t&&t.signal?"$"+t.signal:t||"")+(t&&e?"_":"")+(e&&e.signal?"$"+e.signal:e||"")}function dC(t){return t&&t.signal}function pC(t,e){return null!=t?t:e}function vC(r){return function(t,e,n){return iC(r,e,t||void 0,n)}}var gC=vC("aggregate"),mC=vC("axisticks"),yC=vC("bound"),bC=vC("collect"),_C=vC("compare"),xC=vC("datajoin"),wC=vC("encode"),MC=vC("facet"),kC=vC("field"),EC=vC("key"),SC=vC("legendentries"),AC=vC("mark"),CC=vC("multiextent"),zC=vC("multivalues"),DC=vC("overlap"),OC=vC("params"),NC=vC("prefacet"),RC=vC("projection"),TC=vC("proxy"),PC=vC("relay"),LC=vC("render"),qC=vC("scale"),UC=vC("sieve"),FC=vC("sortitems"),jC=vC("viewlayout"),IC=vC("values"),$C=0,BC=["identity","ordinal","band","point","bin-linear","bin-ordinal","linear","pow","sqrt","log","sequential","time","utc","quantize","quantile","threshold"],WC=nt(BC),YC=nt(BC.slice(1,6));function HC(t){return YC.hasOwnProperty(t)}function GC(t){return"quantile"===t}function VC(t,e){var n,r,i,a,o=e.getScale(t.name).params;for(n in o.domain=ZC(t.domain,t,e),null!=t.range&&(o.range=function t(e,n,r){var i=e.range,a=n.config.range;{if(i.signal)return n.signalRef(i.signal);if(p(i)){if(a&&a.hasOwnProperty(i))return e=Wt({},e,{range:a[i]}),t(e,n,r);"width"===i?i=[0,{signal:"width"}]:"height"===i?i=HC(e.type)?[0,{signal:"height"}]:[{signal:"height"},0]:rt("Unrecognized scale range value: "+Z(i))}else{if(i.scheme)return r.scheme=XC(i.scheme,n),i.extent&&(r.schemeExtent=(o=i.extent,u=n,o.signal?u.signalRef(o.signal):o.map(function(t){return XC(t,u)}))),void(i.count&&(r.schemeCount=XC(i.count,n)));if(i.step)return void(r.rangeStep=XC(i.step,n));if(HC(e.type)&&!d(i))return ZC(i,e,n);d(i)||rt("Unsupported range type: "+Z(i))}}var o,u;return i.map(function(t){return XC(t,n)})}(t,e,o)),null!=t.interpolate&&(r=t.interpolate,(i=o).interpolate=XC(r.type||r),null!=r.gamma&&(i.interpolateGamma=XC(r.gamma))),null!=t.nice&&(a=t.nice,o.nice=J(a)?{interval:XC(a.interval),step:XC(a.step)}:XC(a)),t)o.hasOwnProperty(n)||"name"===n||(o[n]=XC(t[n],e))}function XC(t,e){return J(t)?t.signal?e.signalRef(t.signal):rt("Unsupported object: "+Z(t)):t}function JC(t){rt("Can not find data set: "+Z(t))}function ZC(t,e,n){if(t)return t.signal?n.signalRef(t.signal):(d(t)?function(t,e,n){return t.map(function(t){return XC(t,n)})}:t.fields?function(t,e,n){var r=t.data,i=t.fields.reduce(function(t,e){return e=p(e)?{data:r,field:e}:d(e)||e.signal?function(t,e){var n="_:vega:_"+$C++,r=bC({});if(d(t))r.value={$ingest:t};else if(t.signal){var i="setdata("+Z(n)+","+t.signal+")";r.params.input=e.signalRef(i)}return e.addDataPipeline(n,[r,UC({})]),{data:n,field:"data"}}(e,n):e,t.push(e),t},[]);return(HC(e.type)?function(t,n,e){var r,i,a;return r=e.map(function(t){var e=n.getData(t.data);return e||JC(t.data),e.countsRef(n,t.field)}),i=n.add(gC({groupby:fC,ops:["sum"],fields:[n.fieldRef("count")],as:["count"],pulse:r})),a=n.add(bC({pulse:oC(i)})),oC(n.add(IC({field:fC,sort:n.sortRef(QC(t.sort,!0)),pulse:oC(a)})))}:GC(e.type)?function(t,n,e){var r=e.map(function(t){var e=n.getData(t.data);return e||JC(t.data),e.domainRef(n,t.field)});return oC(n.add(zC({values:r})))}:function(t,n,e){var r=e.map(function(t){var e=n.getData(t.data);return e||JC(t.data),e.extentRef(n,t.field)});return oC(n.add(CC({extents:r})))})(t,n,i)}:function(t,e,n){var r=n.getData(t.data);r||JC(t.data);return HC(e.type)?r.valuesRef(n,t.field,QC(t.sort,!1)):GC(e.type)?r.domainRef(n,t.field):r.extentRef(n,t.field)})(t,e,n);null==e.domainMin&&null==e.domainMax||rt("No scale domain defined for domainMin/domainMax to override.")}function QC(t,e){return t&&(t.field||t.op?t.field||"count"===t.op?e&&t.field?rt("Multiple domain scales can not sort by field."):e&&t.op&&"count"!==t.op&&rt("Multiple domain scales support op count only."):rt("No field provided for sort aggregate op: "+t.op):J(t)?t.field="key":t={field:"key"}),t}function KC(t,e,n){return d(t)?t.map(function(t){return KC(t,e,n)}):J(t)?t.signal?n.signalRef(t.signal):"fit"===e?t:rt("Unsupported parameter object: "+Z(t)):t}var tz="top",ez="left",nz="bottom",rz="label",iz="perc",az="value",oz="guide-label",uz="guide-title",sz="group-title",fz=["shape","size","fill","stroke","strokeDash","opacity"],cz={name:1,interactive:1},lz=nt(["rule"]),hz=nt(["group","image","rect"]),dz=function(t,e){var n="";return lz[e]||(t.x2&&(t.x?(hz[e]&&(n+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),n+="o.width=o.x2-o.x;"):n+="o.x=o.x2-(o.width||0);"),t.xc&&(n+="o.x=o.xc-(o.width||0)/2;"),t.y2&&(t.y?(hz[e]&&(n+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),n+="o.height=o.y2-o.y;"):n+="o.y=o.y2-(o.height||0);"),t.yc&&(n+="o.y=o.yc-(o.height||0)/2;")),n},pz=function(t,e,n,r){var i=OA(t,e);return i.$fields.forEach(function(t){r[t]=1}),Wt(n,i.$params),i.$expr},vz=function(t,e,n,r){return function t(e,n,r,i){var a,o,u;if(e.signal)a="datum",u=pz(e.signal,n,r,i);else if(e.group||e.parent){for(o=Math.max(1,e.level||1),a="item";0<o--;)a+=".mark.group";e.parent?(u=e.parent,a+=".datum"):u=e.group}else e.datum?(a="datum",u=e.datum):rt("Invalid field reference: "+Z(e));e.signal||(p(u)?(i[u]=1,u=m(u).map(Z).join("][")):u=t(u,n,r,i));return a+"["+u+"]"}(J(t)?t:{datum:t},e,n,r)};var gz=function(t,e,n,r,i){var a,o,u,s=mz(t.scale,n,r,i);return null!=t.range?(o=s+".range()",e=0===(a=+t.range)?o+"[0]":"($="+o+","+(1===a?"$[$.length-1]":"$[0]+"+a+"*($[$.length-1]-$[0])")+")"):(void 0!==e&&(e=s+"("+e+")"),t.band&&(u=function(t,e){if(!p(t))return-1;var n=e.scaleType(t);return"band"===n||"point"===n?1:0}(t.scale,n))&&(a=(o=s+".bandwidth")+"()"+(1===(a=+t.band)?"":"*"+a),u<0&&(a="("+o+"?"+a+":0)"),e=(e?e+"+":"")+a,t.extra&&(e="(datum.extra?"+s+"(datum.extra.value):"+e+")")),null==e&&(e="0")),e};function mz(t,e,n,r){var i;if(p(t))i=HS+t,n.hasOwnProperty(i)||(n[i]=e.scaleRef(t)),i=Z(i);else{for(i in e.scales)n[HS+i]=e.scaleRef(i);i=Z(HS)+"+"+(t.signal?"("+pz(t.signal,e,n,r)+")":vz(t,e,n,r))}return"_["+i+"]"}var yz=function(t,e,n,r){return J(t)?"("+bz(null,t,e,n,r)+")":t},bz=function(t,e,n,r,i){if(null!=e.gradient)return o=n,u=r,s=i,"this.gradient("+mz((a=e).gradient,o,u,s)+","+Z(a.start)+","+Z(a.stop)+","+Z(a.count)+")";var a,o,u,s,f=e.signal?pz(e.signal,n,r,i):e.color?function(t,i,a,o){function e(t,e,n,r){return"this."+t+"("+[bz(null,e,i,a,o),bz(null,n,i,a,o),bz(null,r,i,a,o)].join(",")+").toString()"}return t.c?e("hcl",t.h,t.c,t.l):t.h||t.s?e("hsl",t.h,t.s,t.l):t.l||t.a?e("lab",t.l,t.a,t.b):t.r||t.g||t.b?e("rgb",t.r,t.g,t.b):null}(e.color,n,r,i):null!=e.field?vz(e.field,n,r,i):void 0!==e.value?Z(e.value):void 0;return null!=e.scale&&(f=gz(e,f,n,r,i)),void 0===f&&(f=null),null!=e.exponent&&(f="Math.pow("+f+","+yz(e.exponent,n,r,i)+")"),null!=e.mult&&(f+="*"+yz(e.mult,n,r,i)),null!=e.offset&&(f+="+"+yz(e.offset,n,r,i)),e.round&&(f="Math.round("+f+")"),f},_z=function(t,e,n){return t+"["+Z(e)+"]="+n+";"},xz=function(n,t,r,i,a){var o="";return t.forEach(function(t){var e=bz(n,t,r,i,a);o+=t.test?pz(t.test,r,i,a)+"?"+e+":":e}),_z("o",n,o)};function wz(t,e,n,r){var i,a,o,u={},s="var o=item,datum=o.datum,$;";for(i in t)a=t[i],d(a)?s+=xz(i,a,r,n,u):(o=bz(i,a,r,n,u),s+=_z("o",i,o));return s+=dz(t,e),{$expr:s+="return 1;",$fields:Object.keys(u),$output:Object.keys(t)}}var Mz="mark",kz="frame",Ez="legend-label",Sz="title";function Az(t){return J(t)?t:{value:t}}function Cz(t,e,n){return null!=n?(t[e]=J(n)&&!d(n)?n:{value:n},1):0}function zz(t,e,n){for(var r in e)n&&n.hasOwnProperty(r)||(t[r]=Wt(t[r]||{},e[r]));return t}function Dz(t,e,n,r,i,a){var o,u;for(u in(a=a||{}).encoders={$encode:o={}},t=function(r,t,e,n,i){var a,o,u={};"legend"!=e&&0!==String(e).indexOf("axis")||(e=null);for(a in o=e===kz?i.group:e===Mz?Wt({},i.mark,i[t]):null)Oz(a,r)||("fill"===a||"stroke"===a)&&(Oz("fill",r)||Oz("stroke",r))||(u[a]={value:o[a]});return Q(n).forEach(function(t){var e=i.style&&i.style[t];for(var n in e)Oz(n,r)||(u[n]={value:e[n]})}),(r=Wt({},r)).enter=Wt(u,r.enter),r}(t,e,n,r,i.config))o[u]=wz(t[u],e,a,i);return a}function Oz(t,e){return e&&(e.enter&&e.enter[t]||e.update&&e.update[t])}var Nz=function(t,e,n,r,i,a,o){return{type:t,name:o?o.name:void 0,role:e,style:o&&o.style||n,key:r,from:i,interactive:!(!o||!o.interactive),encode:zz(a,o,cz)}},Rz="group",Tz="rule",Pz="text",Lz=function(t,e,n,r,i,a,o){return{type:Rz,name:n,role:t,style:e,from:r,interactive:i||!1,encode:a,marks:o}};function qz(t){return J(t)&&t.signal?t.signal:Z(t)}var Uz=function(t){var e=t.role||"";return e.indexOf("axis")&&e.indexOf("legend")?t.type===Rz?"scope":e||Mz:e},Fz=function(t,e){var n=Gr(t.type);n||rt("Unrecognized transform type: "+Z(t.type));var r=iC(n.type.toLowerCase(),null,jz(n,t,e));return t.signal&&e.addSignal(t.signal,e.proxy(r)),r.metadata=n.metadata||{},r};function jz(t,e,n){var r,i,a,o={};for(i=0,a=t.params.length;i<a;++i)o[(r=t.params[i]).name]=Iz(r,e,n);return o}function Iz(e,t,n){var r,i,a,o=e.type,u=t[e.name];if("index"===o)return function(t,e,n){p(e.from)||rt(\'Lookup "from" parameter must be a string literal.\');return n.getData(e.from).lookupRef(n,e.key)}(0,t,n);{if(void 0!==u)return"param"===o?(i=n,a=t[(r=e).name],r.array?(d(a)||rt("Expected an array of sub-parameters. Instead: "+Z(a)),a.map(function(t){return Bz(r,t,i)})):Bz(r,a,i)):"projection"===o?n.projectionRef(t[e.name]):e.array&&!dC(u)?u.map(function(t){return $z(e,t,n)}):$z(e,u,n);e.required&&rt("Missing required "+Z(t.type)+" parameter: "+Z(e.name))}}function $z(t,e,n){var r=t.type;if(dC(e))return Wz(r)?rt("Expression references can not be signals."):Yz(r)?n.fieldRef(e):Hz(r)?n.compareRef(e):n.signalRef(e.signal);var i,a,o=t.expr||Yz(r);return o&&((a=e)&&a.expr)?OA(e.expr,n):o&&((i=e)&&i.field)?sC(e.field):Wz(r)?OA(e,n):"data"===r?oC(n.getData(e).values):Yz(r)?sC(e):Hz(r)?n.compareRef(e):e}function Bz(t,e,n){var r,i,a,o,u;for(o=0,u=t.params.length;o<u;++o){for(a in(i=t.params[o]).key)if(i.key[a]!==e[a]){i=null;break}if(i)break}return i||rt("Unsupported parameter: "+Z(e)),r=Wt(jz(i,e,n),i.key),oC(n.add(OC(r)))}function Wz(t){return"expr"===t}function Yz(t){return"field"===t}function Hz(t){return"compare"===t}function Gz(t,e,n,r,i){this.scope=t,this.input=e,this.output=n,this.values=r,this.aggregate=i,this.index={}}Gz.fromEntries=function(t,e){var n=e.length,r=1,i=e[0],a=e[n-1],o=e[n-2],u=null;for(t.add(e[0]);r<n;++r)e[r].params.pulse=oC(e[r-1]),t.add(e[r]),"aggregate"===e[r].type&&(u=e[r]);return new Gz(t,i,o,a,u)};var Vz=Gz.prototype;function Xz(t){return p(t)?t:null}function Jz(t,e,n){var r,i=hC(n.op,n.field);if(e.ops){for(var a=0,o=e.as.length;a<o;++a)if(e.as[a]===i)return}else e.ops=["count"],e.fields=[null],e.as=["count"];n.op&&(e.ops.push((r=n.op.signal)?t.signalRef(r):n.op),e.fields.push(t.fieldRef(n.field)),e.as.push(i))}function Zz(t,e,n,r,i,a,o){var u,s,f,c=e[n]||(e[n]={}),l=J(f=a)?(f.order===lC?"-":"+")+hC(f.op,f.field):"",h=Xz(i);if(null!=h&&(t=e.scope,u=c[h+=l?"|"+l:""]),!u){var d=a?{field:fC,pulse:e.countsRef(t,i,a)}:{field:t.fieldRef(i),pulse:oC(e.output)};l&&(d.sort=t.sortRef(a)),s=t.add(iC(r,void 0,d)),o&&(e.index[i]=s),u=oC(s),null!=h&&(c[h]=u)}return u}Vz.countsRef=function(t,e,n){var r,i,a,o=this.counts||(this.counts={}),u=Xz(e);return null!=u&&(t=this.scope,r=o[u]),r?n&&n.field&&Jz(t,r.agg.params,n):(a={groupby:t.fieldRef(e,"key"),pulse:oC(this.output)},n&&n.field&&Jz(t,a,n),r={agg:i=t.add(gC(a)),ref:oC(r=t.add(bC({pulse:oC(i)})))},null!=u&&(o[u]=r)),r.ref},Vz.tuplesRef=function(){return oC(this.values)},Vz.extentRef=function(t,e){return Zz(t,this,"extent","extent",e,!1)},Vz.domainRef=function(t,e){return Zz(t,this,"domain","values",e,!1)},Vz.valuesRef=function(t,e,n){return Zz(t,this,"vals","values",e,n||!0)},Vz.lookupRef=function(t,e){return Zz(t,this,"lookup","tupleindex",e,!1)},Vz.indataRef=function(t,e){return Zz(t,this,"indata","tupleindex",e,!0,!0)};var Qz=function(t,e,n){var r,i,a=t.remove,o=t.insert,u=t.toggle,s=t.modify,f=t.values,c=e.add(aC());r="if("+t.trigger+\',modify("\'+n+\'",\'+[o,a,u,s,f].map(function(t){return null==t?"null":t}).join(",")+"),0)",i=OA(r,e),c.update=i.$expr,c.params=i.$params},Kz=function(t,n){var e,r,i,a,o,u,s,f,c,l,h,d,p,v,g,m,y,b,_,x,w,M,k,E,S,A,C,z,D,O,N,R,T,P,L,q,U,F,j,I,$,B,W=Uz(t),Y=t.type===Rz,H=t.from&&t.from.facet,G=t.layout||"scope"===W||W===kz,V=W===Mz||G||H,X=t.overlap;v=t.from,g=Y,m=n,v?(y=v.facet)&&(g||rt("Only group marks can be faceted."),null!=y.field?x=w=oC(m.getData(y.data).output):(v.data?w=oC(m.getData(v.data).aggregate):((_=Fz(Wt({type:"aggregate",groupby:Q(y.groupby)},y.aggregate),m)).params.key=m.keyRef(y.groupby),_.params.pulse=oC(m.getData(y.data).output),x=w=oC(m.add(_))),b=m.keyRef(y.groupby,!0))):x=oC(m.add(bC(null,[{}]))),x||(x=v.$ref?v:oC(m.getData(v.data).output)),i={key:b,pulse:x,parent:w},c=oC(r=n.add(xC({key:i.key||(t.key?sC(t.key):void 0),pulse:i.pulse,clean:!Y}))),r=a=n.add(bC({pulse:c})),l=oC(r=n.add(AC({markdef:(C=t,{marktype:C.type,name:C.name||void 0,role:C.role||Uz(C),zindex:+C.zindex||void 0}),interactive:(S=t.interactive,A=n,S&&S.signal?A.signalRef(S.signal):!1!==S),clip:(M=t.clip,k=n,J(M)&&(M.signal?E=M.signal:M.path?E="pathShape("+qz(M.path)+")":M.sphere&&(E="geoShape("+qz(M.sphere)+\', {type: "Sphere"})\')),E?k.signalRef(E):!!M),context:{$context:!0},groups:n.lookup(),parent:n.signals.parent?n.signalRef("parent"):null,index:n.markpath(),pulse:oC(r)}))),(r=n.add(wC(Dz(t.encode,t.type,W,t.style,n,{pulse:l})))).params.parent=n.encode(),t.transform&&t.transform.forEach(function(t){var e=Fz(t,n);(e.metadata.generates||e.metadata.changes)&&rt("Mark transforms should not generate new data."),e.params.pulse=oC(r),n.add(r=e)}),t.sort&&(r=n.add(FC({sort:n.compareRef(t.sort,!0),pulse:oC(r)}))),h=oC(r),(H||G)&&(d=oC(G=n.add(jC({layout:n.objectProperty(t.layout),legendMargin:n.config.legendMargin,mark:l,pulse:h})))),p=oC(o=n.add(yC({mark:l,pulse:d||h}))),Y&&(V&&((e=n.operators).pop(),G&&e.pop()),n.pushState(h,d||p,c),H?(P=n,L=i,I=(T=t).from.facet,$=I.name,B=oC(P.getData(I.data).output),I.name||rt("Facet must have a name: "+Z(I)),I.data||rt("Facet must reference a data set: "+Z(I)),I.field?j=P.add(NC({field:P.fieldRef(I.field),pulse:B})):I.groupby?j=P.add(MC({key:P.keyRef(I.groupby),group:oC(P.proxy(L.parent)),pulse:B})):rt("Facet must specify groupby or field: "+Z(I)),U=(q=P.fork()).add(bC()),F=q.add(UC({pulse:oC(U)})),q.addData($,new Gz(q,U,U,F)),q.addSignal("parent",null),j.params.subflow={$subflow:sD(T,q).toRuntime()}):V?(z=t,O=i,N=(D=n).add(NC({pulse:O.pulse})),(R=D.fork()).add(UC()),R.addSignal("parent",null),N.params.subflow={$subflow:sD(z,R).toRuntime()}):sD(t,n),n.popState(),V&&(G&&e.push(G),e.push(o))),X&&(r={method:!0===X.method?"parity":X.method,pulse:p},X.order&&(r.sort=n.compareRef({field:X.order})),X.bound&&(r.boundScale=n.scaleRef(X.bound.scale),r.boundOrient=X.bound.orient,r.boundTolerance=X.bound.tolerance),p=oC(n.add(DC(r)))),u=n.add(LC({pulse:p})),s=n.add(UC({pulse:oC(u)},void 0,n.parent())),null!=t.name&&(f=t.name,n.addData(f,new Gz(n,a,u,s)),t.on&&t.on.forEach(function(t){(t.insert||t.remove||t.toggle)&&rt("Marks only support modify triggers."),Qz(t,n,f)}))},tD=function(t,e){var n,r,i,a,o,u,s,f,c,l,h,d,p,v,g,m,y,b,_,x,w,M,k,E,S,A,C,z,D,O,N,R,T,P,L,q,U,F,j,I,$,B,W,Y,H,G,V,X=t.type||"symbol",J=e.config.legend,Z=t.encode||{},Q=Z.legend||{},K=Q.name||void 0,tt=Q.interactive,et=Q.style,nt=t.size||t.shape||t.fill||t.stroke||t.strokeDash||t.opacity;return nt||rt("Missing valid scale for legend."),n={orient:pC(t.orient,J.orient),title:null!=t.title},r=oC(e.add(bC(null,[n]))),Q=zz({enter:(c=J,l={},Cz(l,"fill",c.fillColor)+Cz(l,"stroke",c.strokeColor)+Cz(l,"strokeWidth",c.strokeWidth)+Cz(l,"strokeDash",c.strokeDash)+Cz(l,"cornerRadius",c.cornerRadius)?l:void 0),update:{offset:Az(pC(t.offset,J.offset)),padding:Az(pC(t.padding,J.padding)),titlePadding:Az(pC(t.titlePadding,J.titlePadding))}},Q,cz),u={update:{x:{field:{group:"padding"}},y:{field:{group:"padding"}},entryPadding:Az(pC(t.entryPadding,J.entryPadding))}},"gradient"===X?(i=oC(e.add(SC({type:"gradient",scale:e.scaleRef(nt),count:e.objectProperty(t.tickCount),values:e.objectProperty(t.values),formatSpecifier:e.property(t.format)}))),f=[(T=nt,P=J,L=Z.gradient,F={value:0},j={},j.enter=q={opacity:F,x:F,y:F},Cz(q,"width",P.gradientWidth),Cz(q,"height",P.gradientHeight),Cz(q,"stroke",P.gradientStrokeColor),Cz(q,"strokeWidth",P.gradientStrokeWidth),j.exit={opacity:F},j.update=U={x:F,y:F,fill:{gradient:T},opacity:{value:1}},Cz(U,"width",P.gradientWidth),Cz(U,"height",P.gradientHeight),Nz("rect","legend-gradient",null,void 0,void 0,j,L)),(A=J,C=Z.labels,z=i,N={value:0},R={},R.enter=D={opacity:N},Cz(D,"fill",A.labelColor),Cz(D,"font",A.labelFont),Cz(D,"fontSize",A.labelFontSize),Cz(D,"fontWeight",A.labelFontWeight),Cz(D,"baseline",A.gradientLabelBaseline),Cz(D,"limit",A.gradientLabelLimit),R.exit={opacity:N},R.update=O={opacity:{value:1},text:{field:rz}},D.x=O.x={field:iz,mult:A.gradientWidth},D.y=O.y={value:A.gradientHeight,offset:A.gradientLabelOffset},D.align=O.align={signal:\'datum.perc<=0?"left":datum.perc>=1?"right":"center"\'},Nz(Pz,Ez,oz,iz,z,R,C))]):(i=oC(e.add(SC(s={scale:e.scaleRef(nt),count:e.objectProperty(t.tickCount),values:e.objectProperty(t.values),formatSpecifier:e.property(t.format)}))),f=[(b=t,_=J,x=Z.symbols,w=i,E={value:0},S={},S.enter=M={opacity:E},Cz(M,"shape",_.symbolType),Cz(M,"size",_.symbolSize),Cz(M,"strokeWidth",_.symbolStrokeWidth),b.fill||(Cz(M,"fill",_.symbolFillColor),Cz(M,"stroke",_.symbolStrokeColor)),S.exit={opacity:E},S.update=k={opacity:{value:1}},M.x=k.x={field:"offset",mult:.5},M.y=k.y={field:"size",mult:.5,offset:{field:"total",offset:{field:{group:"entryPadding"},mult:{field:"index"}}}},fz.forEach(function(t){b[t]&&(k[t]=M[t]={scale:b[t],field:az})}),Nz("symbol","legend-symbol",null,az,w,S,x)),(h=J,d=Z.labels,p=i,m={value:0},y={},y.enter=v={opacity:m},Cz(v,"align",h.labelAlign),Cz(v,"baseline",h.labelBaseline),Cz(v,"fill",h.labelColor),Cz(v,"font",h.labelFont),Cz(v,"fontSize",h.labelFontSize),Cz(v,"fontWeight",h.labelFontWeight),Cz(v,"limit",h.labelLimit),y.exit={opacity:m},y.update=g={opacity:{value:1},text:{field:rz}},v.x=g.x={field:"offset",offset:h.labelOffset},v.y=g.y={field:"size",mult:.5,offset:{field:"total",offset:{field:{group:"entryPadding"},mult:{field:"index"}}}},Nz(Pz,Ez,oz,az,p,y,d))],s.size=function(t,e,n){var r=eD(e,n[1].encode,"fontSize",oz);{if(t.size)return{$expr:"Math.max(Math.ceil(Math.sqrt(_.scale(datum))),"+r+")"};var i=eD(e,n[0].encode,"size");return Math.max(Math.ceil(Math.sqrt(i)),r)}}(t,e,f)),f=[Lz("legend-entry",null,null,r,tt,u,f)],n.title&&(I=t,$=J,B=Z.title,W=r,H={value:0},G=I.title,(V={}).enter=Y={x:{field:{group:"padding"}},y:{field:{group:"padding"}},opacity:H},Cz(Y,"align",$.titleAlign),Cz(Y,"baseline",$.titleBaseline),Cz(Y,"fill",$.titleColor),Cz(Y,"font",$.titleFont),Cz(Y,"fontSize",$.titleFontSize),Cz(Y,"fontWeight",$.titleFontWeight),Cz(Y,"limit",$.titleLimit),V.exit={opacity:H},V.update={opacity:{value:1},text:G&&G.signal?{signal:G.signal}:{value:G+""}},o=Nz(Pz,"legend-title",uz,null,W,V,B),u.update.y.offset={field:{group:"titlePadding"},offset:eD(e,o.encode,"fontSize",uz)},f.push(o)),a=Lz("legend",et,K,r,tt,Q,f),t.zindex&&(a.zindex=t.zindex),Kz(a,e)};function eD(t,e,n,r){var i=e&&(e.update&&e.update[n]||e.enter&&e.enter[n]);return+(i?i.value:r&&(i=t.config.style[r])&&i[n])}var nD=function(t,e){t=p(t)?{text:t}:t;var n,r,i,a=e.config.title,o=Wt({},t.encode);return n={orient:null!=t.orient?t.orient:a.orient},r=oC(e.add(bC(null,[n]))),o.name=t.name,o.interactive=t.interactive,i=function(t,e,n,r){var i,a,o,u,s,f,c=t.text,l=t.orient||e.orient,h=t.anchor||e.anchor,d=l===ez||l===tz?-1:1,p=l===tz||l===nz,v={group:p?"width":"height"},g={};g.enter=i={opacity:{value:0}},Cz(i,"fill",e.color),Cz(i,"font",e.font),Cz(i,"fontSize",e.fontSize),Cz(i,"fontWeight",e.fontWeight),g.exit={opacity:{value:0}},g.update=a={opacity:{value:1},text:J(c)?c:{value:c+""},offset:Az((null!=t.offset?t.offset:e.offset)||0)},"start"===h?(s=0,f="left"):"end"===h?(s=1,f="right"):(s=.5,f="center");o={field:v,mult:s},u=d<0?{value:0}:p?{field:{group:"height"}}:{field:{group:"width"}},p?(a.x=o,a.y=u,a.angle={value:0},a.baseline={value:l===tz?"bottom":"top"}):(a.x=u,a.y=o,a.angle={value:90*d},a.baseline={value:"bottom"});return a.align={value:f},a.limit={field:v},Cz(a,"angle",e.angle),Cz(a,"baseline",e.baseline),Cz(a,"limit",e.limit),Nz(Pz,Sz,t.style||sz,null,r,g,n)}(t,a,o,r),t.zindex&&(i.zindex=t.zindex),Kz(i,e)};function rD(e,n){var r=[];e.transform&&e.transform.forEach(function(t){r.push(Fz(t,n))}),e.on&&e.on.forEach(function(t){Qz(t,n,e.name)}),n.addDataPipeline(e.name,function(t,e,n){var r,i,a,o,u,s=[],f=null,c=!1,l=!1;t.values?s.push(f=iD({$ingest:t.values,$format:t.format})):t.url?s.push(f=iD({$request:t.url,$format:t.format})):t.source&&(f=r=Q(t.source).map(function(t){return oC(e.getData(t).output)}),s.push(null));for(i=0,a=n.length;i<a;++i)o=n[i],u=o.metadata,f||u.source||s.push(f=iD()),s.push(o),u.generates&&(l=!0),u.modifies&&!l&&(c=!0),u.source?f=o:u.changes&&(f=null);r&&(a=r.length-1,s[0]=PC({derive:c,pulse:a?r:r[0]}),(c||a)&&s.splice(1,0,iD()));f||s.push(iD());return s.push(UC({})),s}(e,n,r))}function iD(t){var e=bC({},t);return e.metadata={source:!0},e}function aD(t,e){return{scale:t.scale,range:e}}function oD(t,e,n,r,i){return{signal:\'flush(range("\'+t+\'"), scale("\'+t+\'", datum.value), \'+e+","+n+","+r+","+i+")"}}var uD=function(t,e){var n,r,i,a,o,u,s,f,c,l,h,d,p,v,g,m,y,b,_,x,w,M,k,E,S,A,C,z,D,O,N,R,T,P,L,q,U,F,j,I,$,B,W,Y,H,G,V,X,J,Z,Q,K,tt,et,nt,rt,it,at,ot,ut,st,ft,ct,lt,ht,dt,pt,vt,gt,mt,yt,bt,_t,xt,wt,Mt,kt,Et,St,At,Ct,zt,Dt,Ot,Nt,Rt,Tt,Pt,Lt,qt,Ut=(s=t,c=(f=e).config,l=s.orient,h=l===tz||l===nz?c.axisX:c.axisY,d=c["axis"+l[0].toUpperCase()+l.slice(1)],p="band"===f.scaleType(s.scale)&&c.axisBand,h||d||p?Wt({},c.axis,h,d,p):c.axis),Ft=t.encode||{},jt=Ft.axis||{},It=jt.name||void 0,$t=jt.interactive,Bt=jt.style;return n={orient:t.orient,ticks:!!pC(t.ticks,Ut.ticks),labels:!!pC(t.labels,Ut.labels),grid:!!pC(t.grid,Ut.grid),domain:!!pC(t.domain,Ut.domain),title:!!pC(t.title,!1)},r=oC(e.add(bC({},[n]))),jt=zz({update:{range:{signal:\'abs(span(range("\'+t.scale+\'")))\'},offset:Az(pC(t.offset,0)),position:Az(pC(t.position,0)),titlePadding:Az(pC(t.titlePadding,Ut.titlePadding)),minExtent:Az(pC(t.minExtent,Ut.minExtent)),maxExtent:Az(pC(t.maxExtent,Ut.maxExtent))}},Ft.axis,cz),i=oC(e.add(mC({scale:e.scaleRef(t.scale),extra:Ut.tickExtra,count:e.objectProperty(t.tickCount),values:e.objectProperty(t.values),formatSpecifier:e.property(t.format)}))),u=[],n.grid&&u.push((v=t,g=Ut,m=Ft.grid,y=i,A=v.orient,C=v.gridScale,D=(z=A===ez||A===tz?1:-1)*v.offset||0,(N={}).enter=b={opacity:O={value:0}},Cz(b,"stroke",g.gridColor),Cz(b,"strokeWidth",g.gridWidth),Cz(b,"strokeDash",g.gridDash),N.exit=_={opacity:O},N.update=x={},Cz(x,"opacity",g.gridOpacity),w={scale:v.scale,field:az,band:g.bandPosition,round:g.tickRound,extra:g.tickExtra,offset:g.tickOffset},A===tz||A===nz?(M="x",k="y",S="height"):(M="y",k="x",S="width"),E=k+"2",x[M]=b[M]=_[M]=w,C?(b[k]={scale:C,range:0,mult:z,offset:D},x[E]=b[E]={scale:C,range:1,mult:z,offset:D}):(b[k]={value:D},x[E]=b[E]={signal:S,mult:z,offset:D}),Nz(Tz,"axis-grid",null,az,y,N,m))),n.ticks&&(a=pC(t.tickSize,Ut.tickSize),u.push((R=t,T=Ut,P=Ft.ticks,L=i,q=a,B=R.orient,W=B===ez||B===tz?-1:1,(H={}).enter=U={opacity:Y={value:0}},Cz(U,"stroke",T.tickColor),Cz(U,"strokeWidth",T.tickWidth),H.exit=F={opacity:Y},H.update=j={opacity:{value:1}},(I=Az(q)).mult=W,$={scale:R.scale,field:az,band:T.bandPosition,round:T.tickRound,extra:T.tickExtra,offset:T.tickOffset},B===tz||B===nz?(j.y=U.y=Y,j.y2=U.y2=I,j.x=U.x=F.x=$):(j.x=U.x=Y,j.x2=U.x2=I,j.y=U.y=F.y=$),Nz(Tz,"axis-tick",null,az,L,H,P)))),n.labels&&(a=n.ticks?a:0,u.push((G=t,V=Ut,X=Ft.labels,J=i,Z=a,rt=G.orient,it=rt===ez||rt===tz?-1:1,at=G.scale,ot=pC(G.labelPadding,V.labelPadding),ut=pC(G.labelBound,V.labelBound),st=pC(G.labelFlush,V.labelFlush),ft=null!=st&&!1!==st&&(st=+st)===st,ct=+pC(G.labelFlushOffset,V.labelFlushOffset),lt=pC(G.labelOverlap,V.labelOverlap),(dt={}).enter=Q={opacity:ht={value:0}},Cz(Q,"angle",V.labelAngle),Cz(Q,"fill",V.labelColor),Cz(Q,"font",V.labelFont),Cz(Q,"fontSize",V.labelFontSize),Cz(Q,"fontWeight",V.labelFontWeight),Cz(Q,"limit",V.labelLimit),dt.exit=K={opacity:ht},dt.update=tt={opacity:{value:1},text:{field:rz}},(et=Az(Z)).mult=it,et.offset=Az(ot),et.offset.mult=it,nt={scale:at,field:az,band:.5,offset:V.tickOffset},rt===tz||rt===nz?(tt.y=Q.y=et,tt.x=Q.x=K.x=nt,Cz(tt,"align",ft?oD(at,st,\'"left"\',\'"right"\',\'"center"\'):"center"),ft&&ct&&Cz(tt,"dx",oD(at,st,-ct,ct,0)),Cz(tt,"baseline",rt===tz?"bottom":"top")):(tt.x=Q.x=et,tt.y=Q.y=K.y=nt,Cz(tt,"align","right"===rt?"left":"right"),Cz(tt,"baseline",ft?oD(at,st,\'"bottom"\',\'"top"\',\'"middle"\'):"middle"),ft&&ct&&Cz(tt,"dy",oD(at,st,ct,-ct,0))),G=Nz(Pz,"axis-label",oz,az,J,dt,X),(lt||ut)&&(G.overlap={method:lt,order:"datum.index",bound:ut?{scale:at,orient:rt,tolerance:+ut}:null}),G))),n.domain&&u.push((pt=t,vt=Ut,gt=Ft.domain,mt=r,Mt=pt.orient,(Et={}).enter=yt={opacity:kt={value:0}},Cz(yt,"stroke",vt.domainColor),Cz(yt,"strokeWidth",vt.domainWidth),Et.exit={opacity:kt},Et.update=bt={opacity:{value:1}},Mt===tz||Mt===nz?(_t="x",wt="y"):(_t="y",wt="x"),xt=_t+"2",yt[wt]=kt,bt[_t]=yt[_t]=aD(pt,0),bt[xt]=yt[xt]=aD(pt,1),Nz(Tz,"axis-domain",null,null,mt,Et,gt))),n.title&&u.push((St=t,At=Ut,Ct=Ft.title,zt=r,Rt=St.orient,Tt=St.title,Pt=Rt===ez||Rt===tz?-1:1,Lt=Rt===tz||Rt===nz,(qt={}).enter=Dt={opacity:{value:0}},Cz(Dt,"align",At.titleAlign),Cz(Dt,"fill",At.titleColor),Cz(Dt,"font",At.titleFont),Cz(Dt,"fontSize",At.titleFontSize),Cz(Dt,"fontWeight",At.titleFontWeight),Cz(Dt,"limit",At.titleLimit),qt.exit={opacity:{value:0}},qt.update=Ot={opacity:{value:1},text:Tt&&Tt.signal?{signal:Tt.signal}:{value:Tt+""}},Nt={scale:St.scale,range:.5},Lt?(Ot.x=Nt,Ot.angle={value:0},Ot.baseline={value:Rt===tz?"bottom":"top"}):(Ot.y=Nt,Ot.angle={value:90*Pt},Ot.baseline={value:"bottom"}),Cz(Ot,"angle",At.titleAngle),Cz(Ot,"baseline",At.titleBaseline),!Cz(Ot,"x",At.titleX)&&Lt&&!Oz("x",Ct)&&(qt.enter.auto={value:!0}),!Cz(Ot,"y",At.titleY)&&!Lt&&!Oz("y",Ct)&&(qt.enter.auto={value:!0}),Nz(Pz,"axis-title",uz,null,zt,qt,Ct))),o=Lz("axis",Bt,It,r,$t,jt,u),t.zindex&&(o.zindex=t.zindex),Kz(o,e)},sD=function(t,i,e){var n=Q(t.signals),r=Q(t.scales);return e||n.forEach(function(t){hE(t,i)}),Q(t.projections).forEach(function(t){!function(t,e){var n={};for(var r in t)"name"!==r&&(n[r]=KC(t[r],r,e));e.addProjection(t.name,n)}(t,i)}),r.forEach(function(t){var e,n,r;n=i,r=(e=t).type||"linear",WC.hasOwnProperty(r)||rt("Unrecognized scale type: "+Z(r)),n.addScale(e.name,{type:r,domain:void 0})}),Q(t.data).forEach(function(t){rD(t,i)}),r.forEach(function(t){VC(t,i)}),n.forEach(function(t){!function(t,e){var n=e.getSignal(t.name);if(t.update){var r=OA(t.update,e);n.update=r.$expr,n.params=r.$params}t.on&&t.on.forEach(function(t){nC(t,e,n.id)})}(t,i)}),Q(t.axes).forEach(function(t){uD(t,i)}),Q(t.marks).forEach(function(t){Kz(t,i)}),Q(t.legends).forEach(function(t){tD(t,i)}),t.title&&nD(t.title,i),i.parseLambdas(),i},fD=nt(["width","height","padding","autosize"]);function cD(t){this.config=t,this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.background=null,this.eventConfig=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function lD(t){this.config=t.config,this.field=Object.create(t.field),this.signals=Object.create(t.signals),this.lambdas=Object.create(t.lambdas),this.scales=Object.create(t.scales),this.events=Object.create(t.events),this.data=Object.create(t.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++t._nextsub[0],this._nextsub=t._nextsub,this._parent=t._parent.slice(),this._encode=t._encode.slice(),this._lookup=t._lookup.slice(),this._markpath=t._markpath}var hD=cD.prototype=lD.prototype;function dD(t){return(d(t)?function(t){for(var e,n="[",r=0,i=t.length;r<i;++r)e=t[r],n+=(0<r?",":"")+(J(e)?e.signal||dD(e):Z(e));return n+"]"}:function(t){var e,n,r="{",i=0;for(e in t)n=t[e],r+=(1<++i?",":"")+Z(e)+":"+(J(n)?n.signal||dD(n):Z(n));return r+"}"})(t)}hD.fork=function(){return new lD(this)},hD.toRuntime=function(){return this.finish(),{background:this.background,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig}},hD.id=function(){return(this._subid?this._subid+":":0)+this._id++},hD.add=function(e){return this.operators.push(e),e.id=this.id(),e.refs&&(e.refs.forEach(function(t){t.$ref=e.id}),e.refs=null),e},hD.proxy=function(t){var e=t instanceof rC?oC(t):t;return this.add(TC({value:e}))},hD.addStream=function(t){return this.streams.push(t),t.id=this.id(),t},hD.addUpdate=function(t){return this.updates.push(t),t},hD.finish=function(){var t,e;for(t in this.root&&(this.root.root=!0),this.signals)this.signals[t].signal=t;for(t in this.scales)this.scales[t].scale=t;function n(t,e,n){var r;t&&((r=t.data||(t.data={}))[e]||(r[e]=[])).push(n)}for(t in this.data)for(var r in n((e=this.data[t]).input,t,"input"),n(e.output,t,"output"),n(e.values,t,"values"),e.index)n(e.index[r],t,"index:"+r);return this},hD.pushState=function(t,e,n){this._encode.push(oC(this.add(UC({pulse:t})))),this._parent.push(e),this._lookup.push(n?oC(this.proxy(n)):null),this._markpath.push(-1)},hD.popState=function(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},hD.parent=function(){return E(this._parent)},hD.encode=function(){return E(this._encode)},hD.lookup=function(){return E(this._lookup)},hD.markpath=function(){var t=this._markpath;return++t[t.length-1]},hD.fieldRef=function(t,e){if(p(t))return sC(t,e);t.signal||rt("Unsupported field reference: "+Z(t));var n,r=t.signal,i=this.field[r];return i||(n={name:this.signalRef(r)},e&&(n.as=e),this.field[r]=i=oC(this.add(kC(n)))),i},hD.compareRef=function(t,e){function n(t){return dC(t)?(i=!0,oC(r[t.signal])):t}var r=this.signals,i=!1,a=Q(t.field).map(n),o=Q(t.order).map(n);return e&&a.push(uC),i?oC(this.add(_C({fields:a,orders:o}))):cC(a,o)},hD.keyRef=function(t,e){var n,r=this.signals,i=!1;return t=Q(t).map(function(t){return dC(t)?(i=!0,oC(r[t.signal])):t}),i?oC(this.add(EC({fields:t,flat:e}))):(n={$key:t},e&&(n.$flat=!0),n)},hD.sortRef=function(t){if(!t)return t;var e=[hC(t.op,t.field),uC],n=t.order||"ascending";return n.signal?oC(this.add(_C({fields:e,orders:[n=this.signalRef(n.signal),n]}))):cC(e,[n,n])},hD.event=function(t,e){var n=t+":"+e;if(!this.events[n]){var r=this.id();this.streams.push({id:r,source:t,type:e}),this.events[n]=r}return this.events[n]},hD.addSignal=function(t,e){this.signals.hasOwnProperty(t)&&rt("Duplicate signal name: "+Z(t));var n=e instanceof rC?e:this.add(aC(e));return this.signals[t]=n},hD.getSignal=function(t){return this.signals[t]||rt("Unrecognized signal name: "+Z(t)),this.signals[t]},hD.signalRef=function(t){return this.signals[t]?oC(this.signals[t]):(this.lambdas.hasOwnProperty(t)||(this.lambdas[t]=this.add(aC(null))),oC(this.lambdas[t]))},hD.parseLambdas=function(){for(var t=Object.keys(this.lambdas),e=0,n=t.length;e<n;++e){var r=t[e],i=OA(r,this),a=this.lambdas[r];a.params=i.$params,a.update=i.$expr}},hD.property=function(t){return t&&t.signal?this.signalRef(t.signal):t},hD.objectProperty=function(t){return t&&J(t)?this.signalRef(t.signal||dD(t)):t},hD.addBinding=function(t,e){this.bindings||rt("Nested signals do not support binding: "+Z(t)),this.bindings.push(Wt({signal:t},e))},hD.addScaleProj=function(t,e){this.scales.hasOwnProperty(t)&&rt("Duplicate scale or projection name: "+Z(t)),this.scales[t]=this.add(e)},hD.addScale=function(t,e){this.addScaleProj(t,qC(e))},hD.addProjection=function(t,e){this.addScaleProj(t,RC(e))},hD.getScale=function(t){return this.scales[t]||rt("Unrecognized scale name: "+Z(t)),this.scales[t]},hD.projectionRef=hD.scaleRef=function(t){return oC(this.getScale(t))},hD.projectionType=hD.scaleType=function(t){return this.getScale(t).params.type},hD.addData=function(t,e){return this.data.hasOwnProperty(t)&&rt("Duplicate data set name: "+Z(t)),this.data[t]=e},hD.getData=function(t){return this.data[t]||rt("Undefined data set name: "+Z(t)),this.data[t]},hD.addDataPipeline=function(t,e){return this.data.hasOwnProperty(t)&&rt("Duplicate data set name: "+Z(t)),this.addData(t,Gz.fromEntries(this,e))};var pD=function(t){var i={padding:0,autosize:"pad",background:null,events:{defaults:{allow:["wheel"]}},group:null,mark:null,arc:{fill:yD},area:{fill:yD},image:null,line:{stroke:yD,strokeWidth:mD},path:{stroke:yD},rect:{fill:yD},rule:{stroke:bD},shape:{stroke:yD},symbol:{fill:yD,size:64},text:{fill:bD,font:vD,fontSize:11},style:{"guide-label":{fill:bD,font:vD,fontSize:10},"guide-title":{fill:bD,font:vD,fontSize:11,fontWeight:"bold"},"group-title":{fill:bD,font:vD,fontSize:13,fontWeight:"bold"},point:{size:gD,strokeWidth:mD,shape:"circle"},circle:{size:gD,strokeWidth:mD},square:{size:gD,strokeWidth:mD,shape:"square"},cell:{fill:"transparent",stroke:xD}},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:_D,grid:!1,gridWidth:1,gridColor:xD,gridOpacity:1,labels:!0,labelAngle:0,labelLimit:180,labelPadding:2,ticks:!0,tickColor:_D,tickOffset:0,tickRound:!0,tickSize:5,tickWidth:1,titleAlign:"center",titlePadding:4},axisBand:{tickOffset:-1},legend:{orient:"right",offset:18,padding:0,entryPadding:5,titlePadding:5,gradientWidth:100,gradientHeight:20,gradientStrokeColor:xD,gradientStrokeWidth:0,gradientLabelBaseline:"top",gradientLabelOffset:2,labelAlign:"left",labelBaseline:"middle",labelOffset:8,labelLimit:160,symbolType:"circle",symbolSize:100,symbolFillColor:"transparent",symbolStrokeColor:_D,symbolStrokeWidth:1.5,titleAlign:"left",titleBaseline:"top",titleLimit:180},title:{orient:"top",anchor:"middle",offset:4},range:{category:{scheme:"tableau10"},ordinal:{scheme:"blues",extent:[.2,1]},heatmap:{scheme:"viridis"},ramp:{scheme:"blues",extent:[.2,1]},diverging:{scheme:"blueorange"},symbol:["circle","square","triangle-up","cross","diamond","triangle-right","triangle-down","triangle-left"]}};return(t||[]).forEach(function(t){var e,n,r;if(t)for(e in t)if("style"===e)for(e in r=i.style||(i.style={}),t.style)r[e]=Wt(r[e]||{},t.style[e]);else n=t[e],i[e]=J(n)&&!d(n)?Wt(J(i[e])?i[e]:{},n):n}),i},vD="sans-serif",gD=30,mD=2,yD="#4c78a8",bD="#000",_D="#888",xD="#ddd";function wD(t,e,n){";"!==e[e.length-1]&&(e="return("+e+");");var r=Function.apply(null,t.concat(e));return n&&n.functions?r.bind(n.functions):r}function MD(t,e){return wD(["event"],t,e)}function kD(t,e,n){var r,i;for(r in n=n||{},t)(i=t[r])&&i.$expr&&i.$params&&kD(i.$params,e,n),n[r]=d(i)?i.map(function(t){return ED(t,e)}):ED(i,e);return n}function ED(t,e){if(!t||!J(t))return t;for(var n,r=0,i=SD.length;r<i;++r)if(n=SD[r],t.hasOwnProperty(n.key))return n.parse(t,e);return t}var SD=[{key:"$ref",parse:function(t,e){return e.get(t.$ref)||rt("Operator not defined: "+t.$ref)}},{key:"$key",parse:function(t,e){var n="k:"+t.$key+"_"+!!t.$flat;return e.fn[n]||(e.fn[n]=Y(t.$key,t.$flat))}},{key:"$expr",parse:function(t,e){var n="e:"+t.$expr;return e.fn[n]||(e.fn[n]=g((r=t.$expr,i=e,wD(["datum","_"],r,i)),t.$fields,t.$name));var r,i}},{key:"$field",parse:function(t,e){if(!t.$field)return null;var n="f:"+t.$field+"_"+t.$name;return e.fn[n]||(e.fn[n]=l(t.$field,t.$name))}},{key:"$encode",parse:function(t,e){var n,r,i=t.$encode,a={};for(n in i)r=i[n],a[n]=g(wD(["item","_"],r.$expr,e),r.$fields),a[n].output=r.$output;return a}},{key:"$compare",parse:function(t,e){var n="c:"+t.$compare+"_"+t.$order,r=Q(t.$compare).map(function(t){return t&&t.$tupleid?ct:t});return e.fn[n]||(e.fn[n]=T(r,t.$order))}},{key:"$context",parse:function(t,e){return e}},{key:"$subflow",parse:function(t,o){var u=t.$subflow;return function(t,e,n){var r=DD(u,o.fork()),i=r.get(u.operators[0].id),a=r.signals.parent;return a&&a.set(n),i}}},{key:"$tupleid",parse:function(){return ct}}];function AD(t){return(t+"").toLowerCase()}var CD=function(t,e){"operator"!==AD(t.type)&&t.type?e.transform(t,t.type):e.operator(t,t.update?wD(["_"],t.update,e):null)};var zD=function(t,e){var n=e.get(t.source),r=null,i=t.update,a=void 0;n||rt("Source not defined: "+t.source),r=t.target&&t.target.$expr?MD(t.target.$expr,e):e.get(t.target),i&&i.$expr&&(i.$params&&(a=kD(i.$params,e)),i=wD(["_","event"],i.$expr,e)),e.update(t,n,r,i,a)},DD=function(t,o){var e=t.operators||[];return t.background&&(o.background=t.background),t.eventConfig&&(o.eventConfig=t.eventConfig),e.forEach(function(t){CD(t,o)}),e.forEach(function(t){var e,n,r,i;n=o,(e=t).params&&((r=n.get(e.id))||rt("Invalid operator id: "+e.id),i=kD(e.params,n),n.dataflow.connect(r,r.parameters(i)))}),(t.streams||[]).forEach(function(t){var e,n,r,i,a;n=o,i=null!=(e=t).filter?MD(e.filter,n):void 0,a=null!=e.stream?n.get(e.stream):void 0,e.source?a=n.events(e.source,e.type,i):e.merge&&(a=(r=e.merge.map(n.get.bind(n)))[0].merge.apply(r[0],r.slice(1))),e.between&&(r=e.between.map(n.get.bind(n)),a=a.between(r[0],r[1])),e.filter&&(a=a.filter(i)),null!=e.throttle&&(a=a.throttle(+e.throttle)),null!=e.debounce&&(a=a.debounce(+e.debounce)),null==a&&rt("Invalid stream definition: "+JSON.stringify(e)),e.consume&&a.consume(!0),n.stream(e,a)}),(t.updates||[]).forEach(function(t){zD(t,o)}),o.resolve()},OD={skip:!0};var ND=function(t,e,n){return new RD(t,e,n)};function RD(t,e,n){this.dataflow=t,this.transforms=e,this.events=t.events.bind(t),this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},n&&(this.functions=Object.create(n),this.functions.context=this)}function TD(t){this.dataflow=t.dataflow,this.transforms=t.transforms,this.functions=t.functions,this.events=t.events,this.signals=Object.create(t.signals),this.scales=Object.create(t.scales),this.nodes=Object.create(t.nodes),this.data=Object.create(t.data),this.fn=Object.create(t.fn),t.functions&&(this.functions=Object.create(t.functions),this.functions.context=this)}RD.prototype=TD.prototype={fork:function(){var t=new TD(this);return(this.subcontext||(this.subcontext=[])).push(t),t},get:function(t){return this.nodes[t]},set:function(t,e){return this.nodes[t]=e},add:function(t,e){var n,r=this,i=r.dataflow;if(r.set(t.id,e),"collect"===AD(t.type)&&(n=t.value)&&(n.$ingest?i.ingest(e,n.$ingest,n.$format):n.$request?i.request(e,n.$request,n.$format):i.pulse(e,i.changeset().insert(n))),t.root&&(r.root=e),t.parent){var a=r.get(t.parent.$ref);a?(i.connect(a,[e]),e.targets().add(a)):(r.unresolved=r.unresolved||[]).push(function(){a=r.get(t.parent.$ref),i.connect(a,[e]),e.targets().add(a)})}if(t.signal&&(r.signals[t.signal]=e),t.scale&&(r.scales[t.scale]=e),t.data)for(var o in t.data)n=r.data[o]||(r.data[o]={}),t.data[o].forEach(function(t){n[t]=e})},resolve:function(){return(this.unresolved||[]).forEach(function(t){t()}),delete this.unresolved,this},operator:function(t,e,n){this.add(t,this.dataflow.add(t.value,e,n,t.react))},transform:function(t,e,n){this.add(t,this.dataflow.add(this.transforms[AD(e)],n))},stream:function(t,e){this.set(t.id,e)},update:function(t,e,n,r,i){this.dataflow.on(e,n,r,i,t.options)},getState:function(n){var r=this,t={};if(n.signals){var i=t.signals={};Object.keys(r.signals).forEach(function(t){var e=r.signals[t];n.signals(t,e)&&(i[t]=e.value)})}if(n.data){var a=t.data={};Object.keys(r.data).forEach(function(t){var e=r.data[t];n.data(t,e)&&(a[t]=e.input.value)})}return r.subcontext&&!1!==n.recurse&&(t.subcontext=r.subcontext.map(function(t){return t.getState(n)})),t},setState:function(t){var r=this,e=r.dataflow,n=t.data,i=t.signals;Object.keys(i||{}).forEach(function(t){e.update(r.signals[t],i[t],OD)}),Object.keys(n||{}).forEach(function(t){e.pulse(r.data[t].input,e.changeset().remove(v).insert(n[t]))}),(t.subcontext||[]).forEach(function(t,e){var n=r.subcontext[e];n&&n.setState(t)})}};var PD=function(t,e,n){return DD(e,ND(t,Hr,n||MA))},LD="padding";function qD(t,e){var n=t.autosize(),r=t.padding();return e-(n&&n.contains===LD?r.left+r.right:0)}function UD(t,e){var n=t.autosize(),r=t.padding();return e-(n&&n.contains===LD?r.top+r.bottom:0)}function FD(t,e){return e.modified&&d(e.input.value)&&t.indexOf("_:vega:_")}function jD(t,e){return!("parent"===t||e instanceof Hr.proxy)}function ID(t,e){var n=this;e=e||{},Ir.call(n),n.loader(e.loader||n._loader),n.logLevel(e.logLevel||0),n._el=null,n._renderType=e.renderer||uc.Canvas,n._scenegraph=new df;var r=n._scenegraph.root;n._renderer=null,n._redraw=!0,n._handler=(new Sf).scene(r),n._preventDefault=!1,n._eventListeners=[],n._resizeListeners=[];var i,a,o=PD(n,t,e.functions);n._runtime=o,n._signals=o.signals,n._bind=(t.bindings||[]).map(function(t){return{state:null,param:Wt({},t)}}),o.root&&o.root.set(r),r.source=o.data.root.input,n.pulse(o.data.root.input,n.changeset().insert(r.items)),n._background=o.background||null,n._eventConfig=(i=o.eventConfig,(a=(i=Wt({},i)).defaults)&&(d(a.prevent)&&(a.prevent=nt(a.prevent)),d(a.allow)&&(a.allow=nt(a.allow))),i),n._width=n.width(),n._height=n.height(),n._viewWidth=qD(n,n._width),n._viewHeight=UD(n,n._height),n._origin=[0,0],n._resize=0,n._autosize=1,function(e){var t=e._signals,n=t.width,r=t.height,i=t.padding;function a(){e._autosize=e._resize=1}e._resizeWidth=e.add(null,function(t){e._width=t.size,e._viewWidth=qD(e,t.size),a()},{size:n}),e._resizeHeight=e.add(null,function(t){e._height=t.size,e._viewHeight=UD(e,t.size),a()},{size:r});var o=e.add(null,a,{pad:i});e._resizeWidth.rank=n.rank+1,e._resizeHeight.rank=r.rank+1,o.rank=i.rank+1}(n),Dk(n)}var $D=j(ID,Ir);function BD(t,e){return t._signals.hasOwnProperty(e)?t._signals[e]:rt("Unrecognized signal name: "+Z(e))}function WD(t,n){var e=(t._targets||[]).filter(function(t){var e=t._update;return e&&e.handler===n});return e.length?e[0]:null}$D.run=function(t){if(Ir.prototype.run.call(this,t),this._redraw||this._resize)try{this.render()}catch(t){this.error(t)}return this},$D.render=function(){var t,e,n,r;return this._renderer&&(this._resize&&(this._resize=0,e=Pk(t=this),n=Rk(t),r=Tk(t),t._renderer.background(t._background),t._renderer.resize(n,r,e),t._handler.origin(e),t._resizeListeners.forEach(function(t){t(n,r)})),this._renderer.render(this._scenegraph.root)),this._redraw=!1,this},$D.dirty=function(t){this._redraw=!0,this._renderer&&this._renderer.dirty(t)},$D.container=function(){return this._el},$D.scenegraph=function(){return this._scenegraph},$D.signal=function(t,e,n){var r=BD(this,t);return 1===arguments.length?r.value:this.update(r,e,n)},$D.background=function(t){return arguments.length?(this._background=t,this._resize=1,this):this._background},$D.width=function(t){return arguments.length?this.signal("width",t):this.signal("width")},$D.height=function(t){return arguments.length?this.signal("height",t):this.signal("height")},$D.padding=function(t){return arguments.length?this.signal("padding",t):this.signal("padding")},$D.autosize=function(t){return arguments.length?this.signal("autosize",t):this.signal("autosize")},$D.renderer=function(t){return arguments.length?(fc(t)||rt("Unrecognized renderer type: "+t),t!==this._renderType&&(this._renderType=t,this._renderer&&(this._renderer=null,this.initialize(this._el))),this):this._renderType},$D.loader=function(t){return arguments.length?(t!==this._loader&&(Ir.prototype.loader.call(this,t),this._renderer&&(this._renderer=null,this.initialize(this._el))),this):this._loader},$D.resize=function(){return this._autosize=1,this},$D._resizeView=function(n,r,i,a,o,u){this.runAfter(function(t){var e=0;t._autosize=0,t.width()!==i&&(e=1,t.width(i),t._resizeWidth.skip(!0)),t.height()!==a&&(e=1,t.height(a),t._resizeHeight.skip(!0)),t._viewWidth!==n&&(t._resize=1,t._viewWidth=n),t._viewHeight!==r&&(t._resize=1,t._viewHeight=r),t._origin[0]===o[0]&&t._origin[1]===o[1]||(t._resize=1,t._origin=o),e&&t.run("enter"),u&&t.runAfter(function(){t.resize()})},!1,1)},$D.addEventListener=function(t,e){return this._handler.on(t,e),this},$D.removeEventListener=function(t,e){return this._handler.off(t,e),this},$D.addResizeListener=function(t){var e=this._resizeListeners;return e.indexOf(t)<0&&e.push(t),this},$D.removeResizeListener=function(t){var e=this._resizeListeners,n=e.indexOf(t);return 0<=n&&e.splice(n,1),this},$D.addSignalListener=function(t,e){var n=BD(this,t),r=WD(n,e);return r||((r=function(){e(t,n.value)}).handler=e,this.on(n,null,r)),this},$D.removeSignalListener=function(t,e){var n=BD(this,t),r=WD(n,e);return r&&n._targets.remove(r),this},$D.preventDefault=function(t){return arguments.length?(this._preventDefault=t,this):this._preventDefault},$D.tooltipHandler=function(t){var e=this._handler;return arguments.length?(e.handleTooltip=t||xf.prototype.handleTooltip,this):e.handleTooltip},$D.events=function(u,s,t){var e,f=this,c=new At(t),n=function(t,e){var n,r,i,a,o;u!==qk||(r=s,i=(n=f)._eventConfig.defaults,a=i&&i.prevent,o=i&&i.allow,!1===a||!0===o||!0!==a&&!1!==o&&(a?!a[r]:o?o[r]:!n.preventDefault()))||t.preventDefault();try{c.receive(Lk(f,t,e))}catch(t){f.error(t)}finally{f.run()}};if(u===qk)return f.addEventListener(s,n),c;if(u===Uk?"undefined"!=typeof window&&(e=[window]):"undefined"!=typeof document&&(e=document.querySelectorAll(u)),!e)return f.warn("Can not resolve event source: "+u),c;for(var r=0,i=e.length;r<i;++r)e[r].addEventListener(s,n);return f._eventListeners.push({type:s,sources:e,handler:n}),c},$D.finalize=function(){for(var t,e,n=this._eventListeners,r=n.length;0<=--r;)for(t=(e=n[r]).sources.length;0<=--t;)e.sources[t].removeEventListener(e.type,e.handler)},$D.hover=function(t,e){return e=[e||"update",t=[t||"hover"]],this.on(this.events("view","mouseover",Fk),jk,Ik(t)),this.on(this.events("view","mouseout",Fk),jk,Ik(e)),this},$D.data=function(t){return Ok(this,t).values.value},$D.change=Nk,$D.insert=function(t,e){return Nk.call(this,t,mt().insert(e))},$D.remove=function(t,e){return Nk.call(this,t,mt().remove(e))},$D.initialize=function(t,e){var n,r,i,a,o,u,s=this,f=s._renderType,c=fc(f);return t=s._el=t?eE(s,t):null,c||s.error("Unrecognized renderer type: "+f),n=c.handler||Sf,r=t?c.renderer:c.headless,s._renderer=r?tE(s,s._renderer,t,r):null,s._handler=(a=(i=s)._handler,o=t,u=new n(i.loader()).scene(i.scenegraph().root).initialize(o,Pk(i),i),a&&(u.handleTooltip=a.handleTooltip,a.handlers().forEach(function(t){u.on(t.type,t.handler)})),u),s._redraw=!0,t&&(e=e?eE(s,e):t.appendChild($k("div",{class:"vega-bindings"})),s._bind.forEach(function(t){t.param.element&&(t.element=eE(s,t.param.element))}),s._bind.forEach(function(t){Gk(s,t.element||e,t)})),s},$D.toImageURL=function(r,t){return r!==uc.Canvas&&r!==uc.SVG&&r!==uc.PNG?Promise.reject("Unrecognized image type: "+r):nE(this,r,t).then(function(t){return r===uc.SVG?(e=t.svg(),n=new Blob([e],{type:"image/svg+xml"}),window.URL.createObjectURL(n)):t.canvas().toDataURL("image/png");var e,n})},$D.toCanvas=function(t){return nE(this,uc.Canvas,t).then(function(t){return t.canvas()})},$D.toSVG=function(t){return nE(this,uc.SVG,t).then(function(t){return t.svg()})},$D.getState=function(t){return this._runtime.getState(t||{data:FD,signals:jD,recurse:!0})},$D.setState=function(t){var e=this;return e.runAfter(function(){e._trigger=!1,e._runtime.setState(t),e.run().runAfter(function(){e._trigger=!0})}),this},Wt(Hr,Wa,ml,Hg,mx,hw,MM,ok,_k,Ck),y.version="3.2.1",y.Dataflow=Ir,y.EventStream=At,y.Parameters=bt,y.Pulse=Cr,y.MultiPulse=Rr,y.Operator=Mt,y.Transform=Wr,y.changeset=mt,y.ingest=ht,y.isTuple=ft,y.definition=Gr,y.transform=Vr,y.transforms=Hr,y.tupleid=ct,y.scale=xp,y.scheme=eg,y.interpolate=ag,y.interpolateRange=ng,y.timeInterval=sg,y.utcInterval=fg,y.projection=ux,y.View=ID,y.parse=function(t,e){return J(t)||rt("Input Vega specification must be an object."),(n=t,r=new cD(pD([e,t.config])),f=r.config,r.background=n.background||f.background,r.eventConfig=f.events,s=oC(r.root=r.add(aC())),r.addSignal("width",n.width||0),r.addSignal("height",n.height||0),r.addSignal("padding",iE(n.padding,f)),r.addSignal("autosize",rE(n.autosize,f)),Q(n.signals).forEach(function(t){fD[t.name]||hE(t,r)}),a=r.add(bC()),o=zz({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},n.encode),o=r.add(wC(Dz(o,Rz,kz,n.style,r,{pulse:oC(a)}))),u=r.add(jC({layout:r.objectProperty(n.layout),legendMargin:f.legendMargin,autosize:r.signalRef("autosize"),mark:s,pulse:oC(o)})),r.operators.pop(),r.pushState(oC(o),oC(u),null),sD(n,r,!0),r.operators.push(u),i=r.add(yC({mark:s,pulse:oC(u)})),i=r.add(LC({pulse:oC(i)})),i=r.add(UC({pulse:oC(i)})),r.addData("root",new Gz(r,a,a,i)),r).toRuntime();var n,r,i,a,o,u,s,f},y.expressionFunction=CA,y.formatLocale=Vd,y.timeFormatLocale=xr,y.runtime=DD,y.runtimeContext=ND,y.bin=ri,y.bootstrapCI=Si,y.quartiles=Ai,y.setRandom=function(t){y.random=t},y.randomInteger=function(t,e){null==e&&(e=t,t=0);var n,r,i,a={};return a.min=function(t){return arguments.length?(i=r-(n=t||0),a):n},a.max=function(t){return arguments.length?(i=(r=t||0)-n,a):r},a.sample=function(){return n+Math.floor(i*y.random())},a.pdf=function(t){return t===Math.floor(t)&&n<=t&&t<r?1/i:0},a.cdf=function(t){var e=Math.floor(t);return e<n?0:r<=e?1:(e-n+1)/i},a.icdf=function(t){return 0<=t&&t<=1?n-1+Math.floor(t*i):NaN},a.min(t).max(e)},y.randomKDE=zi,y.randomMixture=Di,y.randomNormal=Ci,y.randomUniform=Oi,y.accessor=g,y.accessorName=M,y.accessorFields=x,y.id=f,y.identity=c,y.zero=w,y.one=b,y.truthy=v,y.falsy=h,y.logger=e,y.None=0,y.Error=r,y.Warn=2,y.Info=_,y.Debug=k,y.panLinear=s,y.panLog=A,y.panPow=C,y.zoomLinear=D,y.zoomLog=O,y.zoomPow=N,y.array=Q,y.compare=T,y.constant=P,y.debounce=L,y.error=rt,y.extend=Wt,y.extentIndex=q,y.fastmap=F,y.field=l,y.inherits=j,y.isArray=d,y.isBoolean=I,y.isDate=$,y.isFunction=R,y.isNumber=B,y.isObject=J,y.isRegExp=W,y.isString=p,y.key=Y,y.merge=H,y.pad=V,y.peek=E,y.repeat=G,y.splitAccessPath=m,y.stringValue=Z,y.toBoolean=X,y.toDate=tt,y.toNumber=S,y.toString=et,y.toSet=nt,y.truncate=it,y.visitArray=at,y.loader=re,y.read=Mr,y.inferType=pe,y.inferTypes=ve,y.typeParsers=le,y.formats=ze,y.Bounds=Ya,y.Gradient=Xa,y.GroupItem=Za,y.ResourceLoader=to,y.Item=Ja,y.Scenegraph=df,y.Handler=xf,y.Renderer=Mf,y.CanvasHandler=Sf,y.CanvasRenderer=Of,y.SVGHandler=Pf,y.SVGRenderer=Wf,y.SVGStringRenderer=ec,y.RenderType=uc,y.renderModule=fc,y.Marks=of,y.boundClip=lc,y.boundContext=is,y.boundStroke=ts,y.boundItem=uf,y.boundMark=ff,y.pathCurves=gu,y.pathSymbols=Ou,y.pathRectangle=Uu,y.pathTrail=ju,y.pathParse=bu,y.pathRender=Su,y.point=Ef,y.domCreate=gf,y.domFind=mf,y.domChild=yf,y.domClear=bf,y.openTag=Uf,y.closeTag=Ff,y.font=tf,y.textMetrics=Hs,y.resetSVGClipId=function(){As=1},y.sceneEqual=dc,y.pathEqual=pc,y.sceneToJSON=lf,y.sceneFromJSON=hf,y.sceneZOrder=hs,y.sceneVisit=ds,y.scenePickVisit=ps,Object.defineProperty(y,"__esModule",{value:!0})});'

# vega-lite-2.3.1.min.js
Canvas._vegalite = b'!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).vl=e()}}(function(){return function o(a,s,l){function c(n,e){if(!s[n]){if(!a[n]){var t="function"==typeof require&&require;if(!e&&t)return t(n,!0);if(u)return u(n,!0);var i=new Error("Cannot find module \'"+n+"\'");throw i.code="MODULE_NOT_FOUND",i}var r=s[n]={exports:{}};a[n][0].call(r.exports,function(e){var t=a[n][1][e];return c(t||e)},r,r.exports,o,a,s,l)}return s[n].exports}for(var u="function"==typeof require&&require,e=0;e<l.length;e++)c(l[e]);return c}({1:[function(e,t,n){var y="undefined"!=typeof JSON?JSON:e("jsonify");t.exports=function(e,t){t||(t={}),"function"==typeof t&&(t={cmp:t});var p=t.space||"";"number"==typeof p&&(p=Array(p+1).join(" "));var o,g="boolean"==typeof t.cycles&&t.cycles,m=t.replacer||function(e,t){return t},h=t.cmp&&(o=t.cmp,function(r){return function(e,t){var n={key:e,value:r[e]},i={key:t,value:r[t]};return o(n,i)}}),v=[];return function e(t,n,i,r){var o=p?"\\n"+new Array(r+1).join(p):"",a=p?": ":":";if(i&&i.toJSON&&"function"==typeof i.toJSON&&(i=i.toJSON()),void 0!==(i=m.call(t,n,i))){if("object"!=typeof i||null===i)return y.stringify(i);if(b(i)){for(var s=[],l=0;l<i.length;l++){var c=e(i,l,i[l],r+1)||y.stringify(null);s.push(o+p+c)}return"["+s.join(",")+o+"]"}if(-1!==v.indexOf(i)){if(g)return y.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}v.push(i);var u=O(i).sort(h&&h(i));for(s=[],l=0;l<u.length;l++){var f=e(i,n=u[l],i[n],r+1);if(f){var d=y.stringify(n)+a+f;s.push(o+p+d)}}return v.splice(v.indexOf(i),1),"{"+s.join(",")+o+"}"}}({"":e},"",e,0)};var b=Array.isArray||function(e){return"[object Array]"==={}.toString.call(e)},O=Object.keys||function(e){var t=Object.prototype.hasOwnProperty||function(){return!0},n=[];for(var i in e)t.call(e,i)&&n.push(i);return n}},{jsonify:2}],2:[function(e,t,n){n.parse=e("./lib/parse"),n.stringify=e("./lib/stringify")},{"./lib/parse":3,"./lib/stringify":4}],3:[function(e,t,n){var i,r,o,s,a={\'"\':\'"\',"\\\\":"\\\\","/":"/",b:"\\b",f:"\\f",n:"\\n",r:"\\r",t:"\\t"},l=function(e){throw{name:"SyntaxError",message:e,at:i,text:o}},c=function(e){return e&&e!==r&&l("Expected \'"+e+"\' instead of \'"+r+"\'"),r=o.charAt(i),i+=1,r},u=function(){var e,t="";for("-"===r&&c(t="-");"0"<=r&&r<="9";)t+=r,c();if("."===r)for(t+=".";c()&&"0"<=r&&r<="9";)t+=r;if("e"===r||"E"===r)for(t+=r,c(),"-"!==r&&"+"!==r||(t+=r,c());"0"<=r&&r<="9";)t+=r,c();if(e=+t,isFinite(e))return e;l("Bad number")},f=function(){var e,t,n,i="";if(\'"\'===r)for(;c();){if(\'"\'===r)return c(),i;if("\\\\"===r)if(c(),"u"===r){for(t=n=0;t<4&&(e=parseInt(c(),16),isFinite(e));t+=1)n=16*n+e;i+=String.fromCharCode(n)}else{if("string"!=typeof a[r])break;i+=a[r]}else i+=r}l("Bad string")},d=function(){for(;r&&r<=" ";)c()};s=function(){switch(d(),r){case"{":return function(){var e,t={};if("{"===r){if(c("{"),d(),"}"===r)return c("}"),t;for(;r;){if(e=f(),d(),c(":"),Object.hasOwnProperty.call(t,e)&&l(\'Duplicate key "\'+e+\'"\'),t[e]=s(),d(),"}"===r)return c("}"),t;c(","),d()}}l("Bad object")}();case"[":return function(){var e=[];if("["===r){if(c("["),d(),"]"===r)return c("]"),e;for(;r;){if(e.push(s()),d(),"]"===r)return c("]"),e;c(","),d()}}l("Bad array")}();case\'"\':return f();case"-":return u();default:return"0"<=r&&r<="9"?u():function(){switch(r){case"t":return c("t"),c("r"),c("u"),c("e"),!0;case"f":return c("f"),c("a"),c("l"),c("s"),c("e"),!1;case"n":return c("n"),c("u"),c("l"),c("l"),null}l("Unexpected \'"+r+"\'")}()}},t.exports=function(e,a){var t;return o=e,i=0,r=" ",t=s(),d(),r&&l("Syntax error"),"function"==typeof a?function e(t,n){var i,r,o=t[n];if(o&&"object"==typeof o)for(i in o)Object.prototype.hasOwnProperty.call(o,i)&&(void 0!==(r=e(o,i))?o[i]=r:delete o[i]);return a.call(t,n,o)}({"":t},""):t}},{}],4:[function(e,t,n){var u,f,d,i=/[\\\\\\"\\x00-\\x1f\\x7f-\\x9f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]/g,r={"\\b":"\\\\b","\\t":"\\\\t","\\n":"\\\\n","\\f":"\\\\f","\\r":"\\\\r",\'"\':\'\\\\"\',"\\\\":"\\\\\\\\"};function p(e){return i.lastIndex=0,i.test(e)?\'"\'+e.replace(i,function(e){var t=r[e];return"string"==typeof t?t:"\\\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+\'"\':\'"\'+e+\'"\'}t.exports=function(e,t,n){var i;if(f=u="","number"==typeof n)for(i=0;i<n;i+=1)f+=" ";else"string"==typeof n&&(f=n);if((d=t)&&"function"!=typeof t&&("object"!=typeof t||"number"!=typeof t.length))throw new Error("JSON.stringify");return function e(t,n){var i,r,o,a,s,l=u,c=n[t];switch(c&&"object"==typeof c&&"function"==typeof c.toJSON&&(c=c.toJSON(t)),"function"==typeof d&&(c=d.call(n,t,c)),typeof c){case"string":return p(c);case"number":return isFinite(c)?String(c):"null";case"boolean":case"null":return String(c);case"object":if(!c)return"null";if(u+=f,s=[],"[object Array]"===Object.prototype.toString.apply(c)){for(a=c.length,i=0;i<a;i+=1)s[i]=e(i,c)||"null";return o=0===s.length?"[]":u?"[\\n"+u+s.join(",\\n"+u)+"\\n"+l+"]":"["+s.join(",")+"]",u=l,o}if(d&&"object"==typeof d)for(a=d.length,i=0;i<a;i+=1)"string"==typeof(r=d[i])&&(o=e(r,c))&&s.push(p(r)+(u?": ":":")+o);else for(r in c)Object.prototype.hasOwnProperty.call(c,r)&&(o=e(r,c))&&s.push(p(r)+(u?": ":":")+o);return o=0===s.length?"{}":u?"{\\n"+u+s.join(",\\n"+u)+"\\n"+l+"}":"{"+s.join(",")+"}",u=l,o}}("",{"":e})}},{}],5:[function(e,t,n){var i,r,o=t.exports={};function a(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function l(t){if(i===setTimeout)return setTimeout(t,0);if((i===a||!i)&&setTimeout)return i=setTimeout,setTimeout(t,0);try{return i(t,0)}catch(e){try{return i.call(null,t,0)}catch(e){return i.call(this,t,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:a}catch(e){i=a}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var c,u=[],f=!1,d=-1;function p(){f&&c&&(f=!1,c.length?u=c.concat(u):d=-1,u.length&&g())}function g(){if(!f){var e=l(p);f=!0;for(var t=u.length;t;){for(c=u,u=[];++d<t;)c&&c[d].run();d=-1,t=u.length}c=null,f=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(e)}}function m(e,t){this.fun=e,this.array=t}function h(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];u.push(new m(e,t)),1!==u.length||f||l(g)},m.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=h,o.addListener=h,o.once=h,o.off=h,o.removeListener=h,o.removeAllListeners=h,o.emit=h,o.prependListener=h,o.prependOnceListener=h,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},{}],6:[function(e,t,n){"function"==typeof Object.create?t.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},{}],7:[function(e,t,n){t.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},{}],8:[function(d,e,T){(function(i,r){var s=/%[sdj%]/g;T.format=function(e){if(!O(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(l(arguments[n]));return t.join(" ")}n=1;for(var i=arguments,r=i.length,o=String(e).replace(s,function(e){if("%%"===e)return"%";if(r<=n)return e;switch(e){case"%s":return String(i[n++]);case"%d":return Number(i[n++]);case"%j":try{return JSON.stringify(i[n++])}catch(e){return"[Circular]"}default:return e}}),a=i[n];n<r;a=i[++n])y(a)||!u(a)?o+=" "+a:o+=" "+l(a);return o},T.deprecate=function(e,t){if(_(r.process))return function(){return T.deprecate(e,t).apply(this,arguments)};if(!0===i.noDeprecation)return e;var n=!1;return function(){if(!n){if(i.throwDeprecation)throw new Error(t);i.traceDeprecation?console.trace(t):console.error(t),n=!0}return e.apply(this,arguments)}};var e,o={};function l(e,t){var n={seen:[],stylize:c};return 3<=arguments.length&&(n.depth=arguments[2]),4<=arguments.length&&(n.colors=arguments[3]),v(t)?n.showHidden=t:t&&T._extend(n,t),_(n.showHidden)&&(n.showHidden=!1),_(n.depth)&&(n.depth=2),_(n.colors)&&(n.colors=!1),_(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=a),p(n,e,n.depth)}function a(e,t){var n=l.styles[t];return n?"\x1b["+l.colors[n][0]+"m"+e+"\x1b["+l.colors[n][1]+"m":e}function c(e,t){return e}function p(t,n,i){if(t.customInspect&&n&&w(n.inspect)&&n.inspect!==T.inspect&&(!n.constructor||n.constructor.prototype!==n)){var e=n.inspect(i,t);return O(e)||(e=p(t,e,i)),e}var r=function(e,t){if(_(t))return e.stylize("undefined","undefined");if(O(t)){var n="\'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/\'/g,"\\\\\'").replace(/\\\\"/g,\'"\')+"\'";return e.stylize(n,"string")}if(b(t))return e.stylize(""+t,"number");if(v(t))return e.stylize(""+t,"boolean");if(y(t))return e.stylize("null","null")}(t,n);if(r)return r;var o,a=Object.keys(n),s=(o={},a.forEach(function(e,t){o[e]=!0}),o);if(t.showHidden&&(a=Object.getOwnPropertyNames(n)),x(n)&&(0<=a.indexOf("message")||0<=a.indexOf("description")))return g(n);if(0===a.length){if(w(n)){var l=n.name?": "+n.name:"";return t.stylize("[Function"+l+"]","special")}if(S(n))return t.stylize(RegExp.prototype.toString.call(n),"regexp");if(E(n))return t.stylize(Date.prototype.toString.call(n),"date");if(x(n))return g(n)}var c,u="",f=!1,d=["{","}"];(h(n)&&(f=!0,d=["[","]"]),w(n))&&(u=" [Function"+(n.name?": "+n.name:"")+"]");return S(n)&&(u=" "+RegExp.prototype.toString.call(n)),E(n)&&(u=" "+Date.prototype.toUTCString.call(n)),x(n)&&(u=" "+g(n)),0!==a.length||f&&0!=n.length?i<0?S(n)?t.stylize(RegExp.prototype.toString.call(n),"regexp"):t.stylize("[Object]","special"):(t.seen.push(n),c=f?function(t,n,i,r,e){for(var o=[],a=0,s=n.length;a<s;++a)N(n,String(a))?o.push(m(t,n,i,r,String(a),!0)):o.push("");return e.forEach(function(e){e.match(/^\\d+$/)||o.push(m(t,n,i,r,e,!0))}),o}(t,n,i,s,a):a.map(function(e){return m(t,n,i,s,e,f)}),t.seen.pop(),function(e,t,n){if(60<e.reduce(function(e,t){return 0,0<=t.indexOf("\\n")&&0,e+t.replace(/\\u001b\\[\\d\\d?m/g,"").length+1},0))return n[0]+(""===t?"":t+"\\n ")+" "+e.join(",\\n  ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(c,u,d)):d[0]+u+d[1]}function g(e){return"["+Error.prototype.toString.call(e)+"]"}function m(e,t,n,i,r,o){var a,s,l;if((l=Object.getOwnPropertyDescriptor(t,r)||{value:t[r]}).get?s=l.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):l.set&&(s=e.stylize("[Setter]","special")),N(i,r)||(a="["+r+"]"),s||(e.seen.indexOf(l.value)<0?-1<(s=y(n)?p(e,l.value,null):p(e,l.value,n-1)).indexOf("\\n")&&(s=o?s.split("\\n").map(function(e){return"  "+e}).join("\\n").substr(2):"\\n"+s.split("\\n").map(function(e){return"   "+e}).join("\\n")):s=e.stylize("[Circular]","special")),_(a)){if(o&&r.match(/^\\d+$/))return s;(a=JSON.stringify(""+r)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/\'/g,"\\\\\'").replace(/\\\\"/g,\'"\').replace(/(^"|"$)/g,"\'"),a=e.stylize(a,"string"))}return a+": "+s}function h(e){return Array.isArray(e)}function v(e){return"boolean"==typeof e}function y(e){return null===e}function b(e){return"number"==typeof e}function O(e){return"string"==typeof e}function _(e){return void 0===e}function S(e){return u(e)&&"[object RegExp]"===t(e)}function u(e){return"object"==typeof e&&null!==e}function E(e){return u(e)&&"[object Date]"===t(e)}function x(e){return u(e)&&("[object Error]"===t(e)||e instanceof Error)}function w(e){return"function"==typeof e}function t(e){return Object.prototype.toString.call(e)}function n(e){return e<10?"0"+e.toString(10):e.toString(10)}T.debuglog=function(t){if(_(e)&&(e=i.env.NODE_DEBUG||""),t=t.toUpperCase(),!o[t])if(new RegExp("\\\\b"+t+"\\\\b","i").test(e)){var n=i.pid;o[t]=function(){var e=T.format.apply(T,arguments);console.error("%s %d: %s",t,n,e)}}else o[t]=function(){};return o[t]},(T.inspect=l).colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},l.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},T.isArray=h,T.isBoolean=v,T.isNull=y,T.isNullOrUndefined=function(e){return null==e},T.isNumber=b,T.isString=O,T.isSymbol=function(e){return"symbol"==typeof e},T.isUndefined=_,T.isRegExp=S,T.isObject=u,T.isDate=E,T.isError=x,T.isFunction=w,T.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},T.isBuffer=d("./support/isBuffer");var f=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function N(e,t){return Object.prototype.hasOwnProperty.call(e,t)}T.log=function(){var e,t;console.log("%s - %s",(e=new Date,t=[n(e.getHours()),n(e.getMinutes()),n(e.getSeconds())].join(":"),[e.getDate(),f[e.getMonth()],t].join(" ")),T.format.apply(T,arguments))},T.inherits=d("inherits"),T._extend=function(e,t){if(!t||!u(t))return e;for(var n=Object.keys(t),i=n.length;i--;)e[n[i]]=t[n[i]];return e}}).call(this,d("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":7,_process:5,inherits:6}],9:[function(e,t,n){var i;i=this,function(e){"use strict";var f,d,i="view",p="[",g="]",m="{",h="}",v=":",y=",",b="@",o=">",O=/[[\\]{}]/,r={"*":1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1};function _(e,t,n,i,r){for(var o,a=0,s=e.length;t<s;++t){if(o=e[t],!a&&o===n)return t;r&&0<=r.indexOf(o)?--a:i&&0<=i.indexOf(o)&&++a}return t}function a(e){for(var t=[],n=0,i=e.length,r=0;r<i;)r=_(e,r,y,p+m,g+h),t.push(e.substring(n,r).trim()),n=++r;if(0===t.length)throw"Empty event selector: "+e;return t}function s(e){return"["===e[0]?function(e){var t,n,i=e.length,r=1;if((r=_(e,r,g,p,g))===i)throw"Empty between selector: "+e;if(2!==(t=a(e.substring(1,r))).length)throw"Between selector must have two elements: "+e;if((e=e.slice(r+1).trim())[0]!==o)throw"Expected \'>\' after between selector: "+e;{if(t=t.map(s),(n=s(e.slice(1).trim())).between)return{between:t,stream:n};n.between=t}return n}(e):function(t){var e,n,i={source:f},r=[],o=[0,0],a=0,s=0,l=t.length,c=0;if(t[l-1]===h){if(!(0<=(c=t.lastIndexOf(m))))throw"Unmatched right brace: "+t;try{o=function(n){var e=n.split(y);if(!n.length||2<e.length)throw n;return e.map(function(e){var t=+e;if(t!=t)throw n;return t})}(t.substring(c+1,l-1))}catch(e){throw"Invalid throttle specification: "+t}t=t.slice(0,c).trim(),l=t.length,c=0}if(!l)throw t;t[0]===b&&(a=++c);(e=_(t,c,v))<l&&(r.push(t.substring(s,e).trim()),s=c=++e);if((c=_(t,c,p))===l)r.push(t.substring(s,l).trim());else if(r.push(t.substring(s,c).trim()),n=[],(s=++c)===l)throw"Unmatched left bracket: "+t;for(;c<l;){if((c=_(t,c,g))===l)throw"Unmatched left bracket: "+t;if(n.push(t.substring(s,c).trim()),c<l-1&&t[++c]!==p)throw"Expected left bracket: "+t;s=++c}if(!(l=r.length)||O.test(r[l-1]))throw"Invalid event selector: "+t;1<l?(i.type=r[1],a?i.markname=r[0].slice(1):(u=r[0],d.hasOwnProperty(u)?i.marktype=r[0]:i.source=r[0])):i.type=r[0];var u;"!"===i.type.slice(-1)&&(i.consume=!0,i.type=i.type.slice(0,-1));null!=n&&(i.filter=n);o[0]&&(i.throttle=o[0]);o[1]&&(i.debounce=o[1]);return i}(e)}e.selector=function(e,t,n){return f=t||i,d=n||r,a(e.trim()).map(s)},Object.defineProperty(e,"__esModule",{value:!0})}("object"==typeof n&&void 0!==t?n:i.vega=i.vega||{})},{}],10:[function(e,t,n){var i;i=this,function(e){"use strict";var h=function(e,t,n){return e.fields=t||[],e.fname=n,e};function v(e){return null==e?null:e.fields}var u=function(e){throw Error(e)},y=function(e){var t,n,i,r=[],o=null,a=0,s=e.length,l="";function c(){r.push(l+e.substring(t,n)),l="",t=n+1}for(e+="",t=n=0;n<s;++n)if("\\\\"===(i=e[n]))l+=e.substring(t,n),t=++n;else if(i===o)c(),o=null,a=-1;else{if(o)continue;t===a&&\'"\'===i?(t=n+1,o=i):t===a&&"\'"===i?(t=n+1,o=i):"."!==i||a?"["===i?(t<n&&c(),a=t=n+1):"]"===i&&(a||u("Access path missing open bracket: "+e),0<a&&c(),a=0,t=n+1):t<n?c():t=n+1}return a&&u("Access path missing closing bracket: "+e),o&&u("Access path missing closing quote: "+e),t<n&&(n++,c()),r},t=Array.isArray,n=function(e){return e===Object(e)},i=function(e){return"string"==typeof e};function b(e){return t(e)?"["+e.map(b)+"]":n(e)||i(e)?JSON.stringify(e).replace("\\u2028","\\\\u2028").replace("\\u2029","\\\\u2029"):e}var r=function(e,t){var n=y(e),i="return _["+n.map(b).join("][")+"];";return h(Function("_",i),[e=1===n.length?n[0]:e],t||e)},o=[],a=r("id"),s=h(function(e){return e},o,"identity"),l=h(function(){return 0},o,"zero"),c=h(function(){return 1},o,"one"),f=h(function(){return!0},o,"true"),d=h(function(){return!1},o,"false");function p(e,t,n){var i=[t].concat([].slice.call(n));console[e].apply(console,i)}var g=function(e){return e[e.length-1]},m=function(e){return null==e||""===e?null:+e};function O(t){return function(e){return t*Math.exp(e)}}function _(t){return function(e){return Math.log(t*e)}}function S(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function E(e,t,n,i){var r=n(e[0]),o=n(g(e)),a=(o-r)*t;return[i(r-a),i(o-a)]}function x(e,t,n,i,r){var o=i(e[0]),a=i(g(e)),s=null!=t?i(t):(o+a)/2;return[r(s+(o-s)*n),r(s+(a-s)*n)]}var w=function(e){return null!=e?t(e)?e:[e]:[]},N=function(e){return"function"==typeof e},T={},P=function(e){return"[object Date]"===Object.prototype.toString.call(e)},D=function(e){return"number"==typeof e},k=function(e,t){for(var n="";0<=--t;)n+=e;return n};function j(e){return D(e)?e:P(e)?e:Date.parse(e)}e.accessor=h,e.accessorName=function(e){return null==e?null:e.fname},e.accessorFields=v,e.id=a,e.identity=s,e.zero=l,e.one=c,e.truthy=f,e.falsy=d,e.logger=function(e){var t=e||0;return{level:function(e){return arguments.length?(t=+e,this):t},error:function(){return 1<=t&&p("error","ERROR",arguments),this},warn:function(){return 2<=t&&p("warn","WARN",arguments),this},info:function(){return 3<=t&&p("log","INFO",arguments),this},debug:function(){return 4<=t&&p("log","DEBUG",arguments),this}}},e.None=0,e.Error=1,e.Warn=2,e.Info=3,e.Debug=4,e.panLinear=function(e,t){return E(e,t,m,s)},e.panLog=function(e,t){var n=Math.sign(e[0]);return E(e,t,_(n),O(n))},e.panPow=function(e,t,n){return E(e,t,S(n),S(1/n))},e.zoomLinear=function(e,t,n){return x(e,t,n,m,s)},e.zoomLog=function(e,t,n){var i=Math.sign(e[0]);return x(e,t,n,_(i),O(i))},e.zoomPow=function(e,t,n,i){return x(e,t,n,S(i),S(1/i))},e.array=w,e.compare=function(e,t){var n,i,r,o,a,s,l,c,u,f=[],d=(e=w(e)).map(function(e,t){return null==e?null:(f.push(t),N(e)?e:y(e).map(b).join("]["))}),p=f.length-1,g=w(t),m="var u,v;return ";if(p<0)return null;for(i=0;i<=p;++i)r=d[n=f[i]],N(r)?(o="(u=this."+(s="f"+n)+"(a))",a="(v=this."+s+"(b))",(l=l||{})[s]=r):(o="(u=a["+r+"])",a="(v=b["+r+"])"),s="((v=v instanceof Date?+v:v),(u=u instanceof Date?+u:u))","descending"!==g[n]?c=-(u=1):(u=-1,c=1),m+="("+o+"<"+a+"||u==null)&&v!=null?"+c+":(u>v||v==null)&&u!=null?"+u+":"+s+"!==u&&v===v?"+c+":v!==v&&u===u?"+u+(n<p?":":":0");return r=Function("a","b",m+";"),l&&(r=r.bind(l)),e=e.reduce(function(t,e){return N(e)?(v(e)||[]).forEach(function(e){t[e]=1}):null!=e&&(t[e+""]=1),t},{}),h(r,Object.keys(e))},e.constant=function(e){return N(e)?e:function(){return e}},e.debounce=function(t,e){var n,i;function r(){e(i),n=i=null}return function(e){i=e,n&&clearTimeout(n),n=setTimeout(r,t)}},e.error=u,e.extend=function(e){for(var t,n,i=1,r=arguments.length;i<r;++i)for(n in t=arguments[i])e[n]=t[n];return e},e.extentIndex=function(e,t){var n,i,r,o,a,s=-1,l=e.length;if(null==t){for(;++s<l;)if(null!=(i=e[s])&&i<=i){n=r=i;break}for(o=a=s;++s<l;)null!=(i=e[s])&&(i<n&&(n=i,o=s),r<i&&(r=i,a=s))}else{for(;++s<l;)if(null!=(i=t(e[s],s,e))&&i<=i){n=r=i;break}for(o=a=s;++s<l;)null!=(i=t(e[s],s,e))&&(i<n&&(n=i,o=s),r<i&&(r=i,a=s))}return[o,a]},e.fastmap=function(t){var r,o,a={};function n(e){return a.hasOwnProperty(e)&&a[e]!==T}return r={size:0,empty:0,object:a,has:n,get:function(e){return n(e)?a[e]:void 0},set:function(e,t){return n(e)||(++r.size,a[e]===T&&--r.empty),a[e]=t,this},delete:function(e){return n(e)&&(--r.size,++r.empty,a[e]=T),this},clear:function(){r.size=r.empty=0,r.object=a={}},test:function(e){return arguments.length?(o=e,r):o},clean:function(){var e,t,n={},i=0;for(e in a)(t=a[e])===T||o&&o(t)||(n[e]=t,++i);r.size=i,r.empty=0,r.object=a=n}},t&&Object.keys(t).forEach(function(e){r.set(e,t[e])}),r},e.field=r,e.inherits=function(e,t){var n=e.prototype=Object.create(t.prototype);return n.constructor=e,n},e.isArray=t,e.isBoolean=function(e){return"boolean"==typeof e},e.isDate=P,e.isFunction=N,e.isNumber=D,e.isObject=n,e.isRegExp=function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},e.isString=i,e.key=function(e,t){e&&(e=t?w(e).map(function(e){return e.replace(/\\\\(.)/g,"$1")}):w(e));var n=e&&e.length?Function("_","return \'\'+"+e.map(function(e){return"_["+(t?b(e):y(e).map(b).join("]["))+"]"}).join("+\'|\'+")+";"):function(){return""};return h(n,e,"key")},e.merge=function(e,t,n,i){var r=t.length,o=n.length;if(!o)return t;if(!r)return n;for(var a=i||new t.constructor(r+o),s=0,l=0,c=0;s<r&&l<o;++c)a[c]=0<e(t[s],n[l])?n[l++]:t[s++];for(;s<r;++s,++c)a[c]=t[s];for(;l<o;++l,++c)a[c]=n[l];return a},e.pad=function(e,t,n,i){var r=n||" ",o=e+"",a=t-o.length;return a<=0?o:"left"===i?k(r,a)+o:"center"===i?k(r,~~(a/2))+o+k(r,Math.ceil(a/2)):o+k(r,a)},e.peek=g,e.repeat=k,e.splitAccessPath=y,e.stringValue=b,e.toBoolean=function(e){return null==e||""===e?null:!(!e||"false"===e||"0"===e||!e)},e.toDate=function(e,t){return t=t||j,null==e||""===e?null:t(e)},e.toNumber=m,e.toString=function(e){return null==e||""===e?null:e+""},e.toSet=function(e){for(var t={},n=0,i=e.length;n<i;++n)t[e[n]]=!0;return t},e.truncate=function(e,t,n,i){var r=null!=i?i:"\xe2\x80\xa6",o=e+"",a=o.length,s=Math.max(0,t-r.length);return a<=t?o:"left"===n?r+o.slice(a-s):"center"===n?o.slice(0,Math.ceil(s/2))+r+o.slice(a-~~(s/2)):o.slice(0,s)+r},e.visitArray=function(e,t,n){if(e){var i,r=0,o=e.length;if(t)for(;r<o;++r)(i=t(e[r]))&&n(i,r,e);else e.forEach(n)}},Object.defineProperty(e,"__esModule",{value:!0})}("object"==typeof n&&void 0!==t?n:i.vega=i.vega||{})},{}],11:[function(e,t,n){t.exports={name:"vega-lite",author:\'Jeffrey Heer, Dominik Moritz, Kanit "Ham" Wongsuphasawat\',version:"2.3.1",collaborators:["Kanit Wongsuphasawat <kanitw@gmail.com> (http://kanitw.yellowpigz.com)","Dominik Moritz <domoritz@cs.washington.edu> (https://www.domoritz.de)","Jeffrey Heer <jheer@uw.edu> (http://jheer.org)"],homepage:"https://vega.github.io/vega-lite/",description:"Vega-Lite is a concise high-level language for interactive visualization.",main:"build/src/index.js",unpkg:"build/vega-lite.min.js",jsdelivr:"build/vega-lite.min.js",types:"typings/vega-lite.d.ts",bin:{vl2png:"./bin/vl2png",vl2svg:"./bin/vl2svg",vl2vg:"./bin/vl2vg"},directories:{test:"test"},scripts:{pretsc:"mkdir -p build && rm -rf build/*/** && cp package.json build/",prebuild:"mkdir -p build/site build/test-gallery",build:"npm run build:only","build:only":"tsc && cp package.json build && browserify src/index.ts -p tsify -d -s vl | exorcist build/vega-lite.js.map > build/vega-lite.js",postbuild:"node node_modules/uglify-js/bin/uglifyjs build/vega-lite.js -cm --source-map content=build/vega-lite.js.map,filename=build/vega-lite.min.js.map -o build/vega-lite.min.js && npm run schema","build:examples":"npm run data && npm run build:only && npm run build:examples-only","build:examples-only":"npm run build:example && npm run build:examples-normalized","build:examples-normalized":"rm -f examples/specs/normalized/*.vl.json && scripts/build-normalized-examples","build:example":"TZ=America/Los_Angeles scripts/build-examples.sh","build:toc":"bundle exec jekyll build -q && scripts/generate-toc","build:site":"browserify site/static/main.ts -p [tsify -p site] -d | exorcist build/site/main.js.map > build/site/main.js","build:versions":"scripts/update-version.sh","build:test-gallery":"browserify test-gallery/main.ts -p [tsify -p test-gallery] -d > build/test-gallery/main.js","check:examples":"scripts/check-examples.sh","check:schema":"scripts/check-schema.sh",clean:"rm -rf build && rm -f vega-lite.* & find -E src test site examples -regex \'.*\\\\.(js|js.map|d.ts)\' -delete && rm -f examples/compiled/*.png && find site/examples ! -name \'index.md\' -type f -exec rm -f {} +",data:"rsync -r node_modules/vega-datasets/data/* data",deploy:"scripts/deploy.sh","deploy:gh":"scripts/deploy-gh.sh","deploy:schema":"scripts/deploy-schema.sh",prestart:"npm run data && npm run build && scripts/index-examples",start:"nodemon -x \'npm run build:test-gallery\' & browser-sync start --server --files \'build/test-gallery/main.js\' --index \'test-gallery/index.html\'",poststart:"rm examples/all-examples.json",preschema:"npm run prebuild",schema:"ts-json-schema-generator --path tsconfig.json --type TopLevelSpec > build/vega-lite-schema.json && npm run renameschema && cp build/vega-lite-schema.json _data/",renameschema:"scripts/rename-schema.sh",presite:"npm run prebuild && npm run data && npm run build:site && npm run build:toc && npm run build:versions && scripts/create-example-pages",site:"bundle exec jekyll serve --incremental",lint:"tslint -p .",test:"npm run build:only && npm run test:only && npm run test:runtime && npm run lint",posttest:"npm run schema && npm run data && npm run mocha:examples","test:nocompile":"npm run test:only && npm run test:runtime && npm run lint && npm run mocha:examples","test:only":"nyc --reporter=html --reporter=text-summary npm run mocha:test","test:runtime":"TZ=America/Los_Angeles wdio wdio.conf.js","test:runtime:generate":"rm -Rf test-runtime/resources && VL_GENERATE_TESTS=true npm run test:runtime","test:debug":"tsc && mocha --recursive --debug-brk --inspect build/test","test:debug-examples":"tsc && npm run schema && mocha --recursive --debug-brk --inspect build/examples","mocha:test":"mocha --require source-map-support/register --reporter dot --recursive build/test","mocha:examples":"mocha --require source-map-support/register --reporter dot --recursive build/examples",codecov:"nyc report --reporter=json && codecov -f coverage/*.json","watch:build":"watchify src/index.ts -p tsify -v -d -s vl -o \'exorcist build/vega-lite.js.map > build/vega-lite.js\'","watch:test":"nodemon -x \'npm test\'",watch:"nodemon -x \'npm run build && npm run test:nocompile\' # already ran schema in build"},repository:{type:"git",url:"https://github.com/vega/vega-lite.git"},license:"BSD-3-Clause",bugs:{url:"https://github.com/vega/vega-lite/issues"},devDependencies:{"@types/chai":"^4.1.2","@types/d3":"^4.13.0","@types/highlight.js":"^9.12.2","@types/mkdirp":"^0.5.2","@types/mocha":"^2.2.48","@types/node":"^9.4.7","@types/webdriverio":"^4.10.0",ajv:"^6.2.1","browser-sync":"^2.23.6","browserify-shim":"^3.8.14",browserify:"^16.1.1",chai:"^4.1.2",cheerio:"^1.0.0-rc.2",chromedriver:"^2.36.0",codecov:"^3.0.0",d3:"^4.13.0",exorcist:"^1.0.1","highlight.js":"^9.12.0",mkdirp:"^0.5.1",mocha:"^5.0.4",nodemon:"^1.17.1",nyc:"^11.4.1","source-map-support":"^0.5.3","svg2png-many":"^0.0.7","ts-json-schema-generator":"^0.21.0","ts-node":"^5.0.1",tsify:"^3.0.4","tslint-eslint-rules":"^5.1.0",tslint:"5.9.1",typescript:"^2.7.2","uglify-js":"^3.3.14","vega-datasets":"^1.18.0","vega-embed":"^3.1.1","vega-tooltip":"^0.6.1",vega:"^3.2.1",watchify:"^3.11.0","wdio-chromedriver-service":"^0.1.2","wdio-dot-reporter":"0.0.9","wdio-mocha-framework":"^0.5.13","wdio-static-server-service":"^1.0.1",webdriverio:"^4.12.0","yaml-front-matter":"^4.0.0"},dependencies:{"@types/json-stable-stringify":"^1.0.32","vega-typings":"^0.2.11","json-stable-stringify":"^1.0.1",tslib:"^1.9.0","vega-event-selector":"^2.0.0","vega-util":"^1.7.0",yargs:"^11.0.0"}}},{}],12:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=e("vega-util"),r=e("./util"),o={argmax:1,argmin:1,average:1,count:1,distinct:1,max:1,mean:1,median:1,min:1,missing:1,q1:1,q3:1,ci0:1,ci1:1,stderr:1,stdev:1,stdevp:1,sum:1,valid:1,values:1,variance:1,variancep:1};n.AGGREGATE_OPS=r.flagKeys(o),n.isAggregateOp=function(e){return!!o[e]},n.COUNTING_OPS=["count","valid","missing","distinct"],n.isCountingAggregateOp=function(e){return e&&r.contains(n.COUNTING_OPS,e)},n.SUM_OPS=["count","sum","distinct","valid","missing"],n.SHARED_DOMAIN_OPS=["mean","average","median","q1","q3","min","max"],n.SHARED_DOMAIN_OP_INDEX=i.toSet(n.SHARED_DOMAIN_OPS)},{"./util":125,"vega-util":10}],13:[function(e,t,n){"use strict";var i=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var r=e("./util");n.AXIS_PARTS=["domain","grid","labels","ticks","title"],n.AXIS_PROPERTY_TYPE={grid:"grid",gridScale:"grid",domain:"main",labels:"main",labelFlush:"main",labelOverlap:"main",minExtent:"main",maxExtent:"main",offset:"main",ticks:"main",title:"main",values:"both",scale:"both",zindex:"both"};var o={orient:1,domain:1,format:1,grid:1,labelBound:1,labelFlush:1,labelPadding:1,labels:1,labelOverlap:1,maxExtent:1,minExtent:1,offset:1,position:1,tickCount:1,ticks:1,tickSize:1,title:1,titlePadding:1,values:1,zindex:1},a=i({},o,{encoding:1,labelAngle:1,titleMaxLength:1}),s=i({scale:1},o,{gridScale:1,encode:1});n.isAxisProperty=function(e){return!!a[e]},n.VG_AXIS_PROPERTIES=r.flagKeys(s),n.AXIS_PROPERTIES=r.flagKeys(a)},{"./util":125}],14:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=e("vega-util"),r=e("./channel"),o=e("./util");n.binToString=function(t){return i.isBoolean(t)?"bin":"bin"+o.keys(t).map(function(e){return o.varName("_"+e+"_"+t[e])}).join("")},n.autoMaxBins=function(e){switch(e){case r.ROW:case r.COLUMN:case r.SIZE:case r.COLOR:case r.FILL:case r.STROKE:case r.OPACITY:case r.SHAPE:return 6;default:return 10}}},{"./channel":15,"./util":125,"vega-util":10}],15:[function(e,t,n){"use strict";var i=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},r=this&&this.__rest||function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&(n[i[r]]=e[i[r]])}return n};Object.defineProperty(n,"__esModule",{value:!0});var o,a,s=e("./util");(a=o=n.Channel||(n.Channel={})).ROW="row",a.COLUMN="column",a.X="x",a.Y="y",a.X2="x2",a.Y2="y2",a.LATITUDE="latitude",a.LONGITUDE="longitude",a.LATITUDE2="latitude2",a.LONGITUDE2="longitude2",a.COLOR="color",a.FILL="fill",a.STROKE="stroke",a.SHAPE="shape",a.SIZE="size",a.OPACITY="opacity",a.TEXT="text",a.ORDER="order",a.DETAIL="detail",a.KEY="key",a.TOOLTIP="tooltip",a.HREF="href",n.X=o.X,n.Y=o.Y,n.X2=o.X2,n.Y2=o.Y2,n.LATITUDE=o.LATITUDE,n.LATITUDE2=o.LATITUDE2,n.LONGITUDE=o.LONGITUDE,n.LONGITUDE2=o.LONGITUDE2,n.ROW=o.ROW,n.COLUMN=o.COLUMN,n.SHAPE=o.SHAPE,n.SIZE=o.SIZE,n.COLOR=o.COLOR,n.FILL=o.FILL,n.STROKE=o.STROKE,n.TEXT=o.TEXT,n.DETAIL=o.DETAIL,n.KEY=o.KEY,n.ORDER=o.ORDER,n.OPACITY=o.OPACITY,n.TOOLTIP=o.TOOLTIP,n.HREF=o.HREF,n.GEOPOSITION_CHANNEL_INDEX={longitude:1,longitude2:1,latitude:1,latitude2:1},n.GEOPOSITION_CHANNELS=s.flagKeys(n.GEOPOSITION_CHANNEL_INDEX);var l=i({x:1,y:1,x2:1,y2:1},n.GEOPOSITION_CHANNEL_INDEX,{color:1,fill:1,stroke:1,opacity:1,size:1,shape:1,order:1,text:1,detail:1,key:1,tooltip:1,href:1});n.isColorChannel=function(e){return"color"===e||"fill"===e||"stroke"===e};var c=i({},l,{row:1,column:1});n.CHANNELS=s.flagKeys(c);c.order,c.detail;var u=r(c,["order","detail"]);n.SINGLE_DEF_CHANNELS=s.flagKeys(u),n.isChannel=function(e){return!!c[e]},n.UNIT_CHANNELS=s.flagKeys(l);l.x,l.y,l.x2,l.y2,l.latitude,l.longitude,l.latitude2,l.longitude2;var f=r(l,["x","y","x2","y2","latitude","longitude","latitude2","longitude2"]);n.NONPOSITION_CHANNELS=s.flagKeys(f);var d={x:1,y:1};n.POSITION_SCALE_CHANNELS=s.flagKeys(d);f.text,f.tooltip,f.href,f.detail,f.key,f.order;var p=r(f,["text","tooltip","href","detail","key","order"]);n.NONPOSITION_SCALE_CHANNELS=s.flagKeys(p);var g=i({},d,p);function m(e){switch(e){case n.COLOR:case n.FILL:case n.STROKE:case n.DETAIL:case n.KEY:case n.TOOLTIP:case n.HREF:case n.ORDER:case n.OPACITY:case n.ROW:case n.COLUMN:return{point:!0,tick:!0,rule:!0,circle:!0,square:!0,bar:!0,rect:!0,line:!0,area:!0,text:!0,geoshape:!0};case n.X:case n.Y:case n.LATITUDE:case n.LONGITUDE:return{point:!0,tick:!0,rule:!0,circle:!0,square:!0,bar:!0,rect:!0,line:!0,area:!0,text:!0};case n.X2:case n.Y2:case n.LATITUDE2:case n.LONGITUDE2:return{rule:!0,bar:!0,rect:!0,area:!0};case n.SIZE:return{point:!0,tick:!0,rule:!0,circle:!0,square:!0,bar:!0,text:!0,line:!0};case n.SHAPE:return{point:!0,geoshape:!0};case n.TEXT:return{text:!0}}}n.SCALE_CHANNELS=s.flagKeys(g),n.isScaleChannel=function(e){return!!g[e]},n.supportMark=function(e,t){return t in m(e)},n.getSupportedMark=m,n.rangeType=function(e){switch(e){case n.X:case n.Y:case n.SIZE:case n.OPACITY:case n.X2:case n.Y2:return"continuous";case n.ROW:case n.COLUMN:case n.SHAPE:case n.TEXT:case n.TOOLTIP:case n.HREF:return"discrete";case n.COLOR:case n.FILL:case n.STROKE:return"flexible";case n.LATITUDE:case n.LONGITUDE:case n.LATITUDE2:case n.LONGITUDE2:case n.DETAIL:case n.KEY:case n.ORDER:return}throw new Error("rangeType not implemented for "+e)}},{"./util":125}],16:[function(e,t,n){"use strict";var h=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},v=this&&this.__rest||function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&(n[i[r]]=e[i[r]])}return n};Object.defineProperty(n,"__esModule",{value:!0});var y=e("util"),b=e("../../axis"),O=e("../../fielddef"),_=e("../../util");function a(e,n,t,i){void 0===i&&(i={header:!1});var r=e.combine(),o=r.orient,a=r.scale,s=r.title,l=v(r,["orient","scale","title"]);if(_.keys(l).forEach(function(e){var t=b.AXIS_PROPERTY_TYPE[e];t&&t!==n&&"both"!==t&&delete l[e]}),"grid"===n){if(!l.grid)return;if(l.encode){var c=l.encode.grid;l.encode=h({},c?{grid:c}:{}),0===_.keys(l.encode).length&&delete l.encode}return h({scale:a,orient:o},l,{domain:!1,labels:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:0})}if(i.header||!e.mainExtracted){if(l.encode){for(var u=0,f=b.AXIS_PARTS;u<f.length;u++){var d=f[u];e.hasAxisPart(d)||delete l.encode[d]}0===_.keys(l.encode).length&&delete l.encode}var p,g,m=(p=s,g=t,y.isArray(p)?p.map(function(e){return O.title(e,g)}).join(", "):p);return h({scale:a,orient:o},m?{title:m}:{},l,{zindex:1})}}n.assembleAxis=a,n.assembleAxes=function(e,t){var n=e.x,i=void 0===n?[]:n,r=e.y,o=void 0===r?[]:r;return i.map(function(e){return a(e,"main",t)}).concat(i.map(function(e){return a(e,"grid",t)}),o.map(function(e){return a(e,"main",t)}),o.map(function(e){return a(e,"grid",t)})).filter(function(e){return e})}},{"../../axis":13,"../../fielddef":106,"../../util":125,util:8}],17:[function(e,t,n){"use strict";var i,o=this&&this.__extends||(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(n,"__esModule",{value:!0});var a=e("../../util");var r=function(r){function e(e,t,n){void 0===e&&(e={}),void 0===t&&(t={}),void 0===n&&(n=!1);var i=r.call(this)||this;return i.explicit=e,i.implicit=t,i.mainExtracted=n,i}return o(e,r),e.prototype.clone=function(){return new e(a.duplicate(this.explicit),a.duplicate(this.implicit),this.mainExtracted)},e.prototype.hasAxisPart=function(e){return"axis"===e||("grid"===e||"title"===e?!!this.get(e):!(!1===(t=this.get(e))||null===t));var t},e}(e("../split").Split);n.AxisComponent=r},{"../../util":125,"../split":95}],18:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.getAxisConfig=function(e,t,n,i,r){void 0===i&&(i="");for(var o=0,a=("band"===r?["axisBand"]:[]).concat(["x"===n?"axisX":"axisY","axis"+i.substr(0,1).toUpperCase()+i.substr(1),"axis"]);o<a.length;o++){var s=a[o];if(t[s]&&void 0!==t[s][e])return t[s][e]}}},{}],19:[function(e,t,n){"use strict";var f=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var i=e("../../channel"),d=e("../../fielddef"),p=e("../../scale"),r=e("../../type"),g=e("../../util"),m=e("../common"),h=e("./config");function v(e,t){return"top"===t||"bottom"===t?e<=45||315<=e?{value:"top"===t?"bottom":"top"}:135<=e&&e<=225?{value:"top"===t?"top":"bottom"}:{value:"middle"}:e<=45||315<=e||135<=e&&e<=225?{value:"middle"}:45<=e&&e<=135?{value:"left"===t?"top":"bottom"}:{value:"left"===t?"bottom":"top"}}function y(e,t,n){return void 0!==e.labelAngle?(e.labelAngle%360+360)%360:t===i.X&&g.contains([r.NOMINAL,r.ORDINAL],n.type)?270:void 0}function b(e,t){return e=(e%360+360)%360,"top"===t||"bottom"===t?e%180==0?"center":0<e&&e<180?"top"===t?"right":"left":"top"===t?"left":"right":(e+90)%180==0?"center":90<=e&&e<270?"left"===t?"left":"right":"left"===t?"right":"left"}n.labels=function(e,t,n,i){var r=e.fieldDef(t)||("x"===t?e.fieldDef("x2"):"y"===t?e.fieldDef("y2"):void 0),o=e.axis(t),a=e.config,s={};if(d.isTimeFieldDef(r)){var l=e.getScaleComponent(t).get("type")===p.ScaleType.UTC;s.text={signal:m.timeFormatExpression("datum.value",r.timeUnit,o.format,a.axis.shortTimeLabels,a.timeFormat,l)}}var c=h.getAxisConfig("labelAngle",e.config,t,i,e.getScaleComponent(t).get("type"));if(void 0===c&&(c=y(o,t,r))&&(s.angle={value:c}),void 0!==c){var u=b(c,i);u&&(s.align={value:u}),s.baseline=v(c,i)}return s=f({},s,n),0===g.keys(s).length?void 0:s},n.labelBaseline=v,n.labelAngle=y,n.labelAlign=b},{"../../channel":15,"../../fielddef":106,"../../scale":115,"../../type":124,"../../util":125,"../common":24,"./config":18}],20:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var u=e("../../axis"),S=e("../../channel"),f=e("../../fielddef"),E=e("../../util"),d=e("../common"),x=e("../resolve"),o=e("../split"),l=e("./component"),c=e("./config"),p=e("./encode"),g=e("./properties");n.parseUnitAxis=function(n){return S.POSITION_SCALE_CHANNELS.reduce(function(e,t){return n.component.scales[t]&&n.axis(t)&&(e[t]=[function(r,o){var a=o.axis(r),s=new l.AxisComponent;u.VG_AXIS_PROPERTIES.forEach(function(e){var t=function(e,t,n,i){var r=i.fieldDef(n);switch(e){case"scale":return i.scaleName(n);case"gridScale":return g.gridScale(i,n);case"format":return d.numberFormat(r,t.format,i.config);case"grid":var o=i.getScaleComponent(n).get("type");return d.getSpecifiedOrDefaultValue(t.grid,g.grid(o,r));case"labelFlush":return g.labelFlush(r,n,t);case"labelOverlap":var o=i.getScaleComponent(n).get("type");return g.labelOverlap(r,t,n,o);case"orient":return d.getSpecifiedOrDefaultValue(t.orient,g.orient(n));case"tickCount":var o=i.getScaleComponent(n).get("type"),a="x"===n?"width":"y"===n?"height":void 0,s=a?i.getSizeSignalRef(a):void 0;return d.getSpecifiedOrDefaultValue(t.tickCount,g.tickCount(n,r,o,s));case"title":var l="x"===n?"x2":"y2",c=i.fieldDef(l);return d.getSpecifiedOrDefaultValue(void 0===t.title?void 0:t.title,d.mergeTitleFieldDefs([f.toFieldDefBase(r)],c?[f.toFieldDefBase(c)]:[]));case"values":return g.values(t,i,r)}return u.isAxisProperty(e)?t[e]:void 0}(e,a,r,o);if(void 0!==t){var n="values"===e?!!a.values:"encode"===e?!!a.encoding||!!a.labelAngle:t===a[e],i=c.getAxisConfig(e,o.config,r,s.get("orient"),o.getScaleComponent(r).get("type"));(n||void 0===i)&&s.set(e,t,n)}});var i=a.encoding||{},e=u.AXIS_PARTS.reduce(function(e,t){if(!s.hasAxisPart(t))return e;var n="labels"===t?p.labels(o,r,i.labels||{},s.get("orient")):i[t]||{};return void 0!==n&&0<E.keys(n).length&&(e[t]={update:n}),e},{});return 0<E.keys(e).length&&s.set("encode",e,!!a.encoding||!!a.labelAngle),s}(t,n)]),e},{})};var w={bottom:"top",top:"bottom",left:"right",right:"left"};function N(e,t){if(!e)return t.map(function(e){return e.clone()});if(e.length===t.length){for(var n=e.length,i=0;i<n;i++){var r=e[i],o=t[i];if(!!r!=!!o)return;if(r&&o){var a=r.getWithExplicit("orient"),s=o.getWithExplicit("orient");if(a.explicit&&s.explicit&&a.value!==s.value)return;e[i]=m(r,o)}}return e}}function m(t,i){for(var e=function(n){var e=o.mergeValuesWithExplicit(t.getWithExplicit(n),i.getWithExplicit(n),n,"axis",function(e,t){switch(n){case"title":return d.titleMerger(e,t);case"gridScale":return{explicit:e.explicit,value:e.value||t.value}}return o.defaultTieBreaker(e,t,n,"axis")});t.setWithExplicit(n,e)},n=0,r=u.VG_AXIS_PROPERTIES;n<r.length;n++){e(r[n])}return t}n.parseLayerAxis=function(e){for(var t=e.component,n=t.axes,i=t.resolve,r={top:0,bottom:0,right:0,left:0},o=0,a=e.children;o<a.length;o++){(g=a[o]).parseAxisAndHeader();for(var s=0,l=E.keys(g.component.axes);s<l.length;s++){var c=l[s];i.axis[c]=x.parseGuideResolve(e.component.resolve,c),"shared"===i.axis[c]&&(n[c]=N(n[c],g.component.axes[c]),n[c]||(i.axis[c]="independent",delete n[c]))}}for(var u=0,f=[S.X,S.Y];u<f.length;u++){c=f[u];for(var d=0,p=e.children;d<p.length;d++){var g;if((g=p[d]).component.axes[c]){if("independent"===i.axis[c]){n[c]=(n[c]||[]).concat(g.component.axes[c]);for(var m=0,h=g.component.axes[c];m<h.length;m++){var v=h[m],y=v.getWithExplicit("orient"),b=y.value,O=y.explicit;if(0<r[b]&&!O){var _=w[b];r[b]>r[_]&&v.set("orient",_,!1)}r[b]++}}delete g.component.axes[c]}}}}},{"../../axis":13,"../../channel":15,"../../fielddef":106,"../../util":125,"../common":24,"../resolve":75,"../split":95,"./component":17,"./config":18,"./encode":19,"./properties":21}],21:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("vega-util"),o=e("../../bin"),i=e("../../channel"),a=e("../../datetime"),s=e("../../fielddef"),l=e("../../log"),c=e("../../scale"),u=e("../../type"),f=e("../../util");n.grid=function(e,t){return!c.hasDiscreteDomain(e)&&!t.bin},n.gridScale=function(e,t){var n="x"===t?"y":"x";if(e.getScaleComponent(n))return e.scaleName(n)},n.labelFlush=function(e,t,n){return void 0!==n.labelFlush?n.labelFlush:!("x"!==t||!f.contains(["quantitative","temporal"],e.type))||void 0},n.labelOverlap=function(e,t,n,i){return void 0!==t.labelOverlap?t.labelOverlap:"nominal"!==e.type?"log"!==i||"greedy":void 0},n.orient=function(e){switch(e){case i.X:return"bottom";case i.Y:return"left"}throw new Error(l.message.INVALID_CHANNEL_FOR_AXIS)},n.tickCount=function(e,t,n,i){if(!c.hasDiscreteDomain(n)&&"log"!==n&&!f.contains(["month","hours","day","quarter"],t.timeUnit))return t.bin?{signal:"ceil("+i.signal+"/20)"}:{signal:"ceil("+i.signal+"/40)"}},n.title=function(e,t,n){var i=s.title(t,n);return e?r.truncate(i,e):i},n.values=function(e,t,n){var i=e.values;if(e.values&&a.isDateTime(i[0]))return i.map(function(e){return{signal:a.dateTimeExpr(e,!0)}});if(!i&&n.bin&&n.type===u.QUANTITATIVE){var r=t.getName(o.binToString(n.bin)+"_"+n.field+"_bins");return{signal:"sequence("+r+".start, "+r+".stop + "+r+".step, "+r+".step)"}}return i}},{"../../bin":14,"../../channel":15,"../../datetime":103,"../../fielddef":106,"../../log":110,"../../scale":115,"../../type":124,"../../util":125,"vega-util":10}],22:[function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),a=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var s=e("../util"),l=e("./data/parse"),c=e("./layoutsize/assemble"),o=function(o){function e(e,t,n,i,r){return o.call(this,e,t,n,i,r)||this}return r(e,o),e.prototype.parseData=function(){this.component.data=l.parseData(this),this.children.forEach(function(e){e.parseData()})},e.prototype.parseSelection=function(){var n=this;this.component.selection={};for(var e=function(t){t.parseSelection(),s.keys(t.component.selection).forEach(function(e){n.component.selection[e]=t.component.selection[e]})},t=0,i=this.children;t<i.length;t++){e(i[t])}},e.prototype.parseMarkGroup=function(){for(var e=0,t=this.children;e<t.length;e++){t[e].parseMarkGroup()}},e.prototype.parseAxisAndHeader=function(){for(var e=0,t=this.children;e<t.length;e++){t[e].parseAxisAndHeader()}},e.prototype.assembleSelectionTopLevelSignals=function(e){return this.children.reduce(function(e,t){return t.assembleSelectionTopLevelSignals(e)},e)},e.prototype.assembleSelectionSignals=function(){return this.children.forEach(function(e){return e.assembleSelectionSignals()}),[]},e.prototype.assembleLayoutSignals=function(){return this.children.reduce(function(e,t){return e.concat(t.assembleLayoutSignals())},c.assembleLayoutSignals(this))},e.prototype.assembleSelectionData=function(e){return this.children.reduce(function(e,t){return t.assembleSelectionData(e)},e)},e.prototype.assembleMarks=function(){return this.children.map(function(e){var t=e.assembleTitle(),n=e.assembleGroupStyle(),i=e.assembleLayoutSize();return a({type:"group",name:e.getName("group")},t?{title:t}:{},n?{style:n}:{},i?{encode:{update:i}}:{},e.assembleGroup())})},e}(e("./model").Model);n.BaseConcatModel=o},{"../util":125,"./data/parse":42,"./layoutsize/assemble":49,"./model":69}],23:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var s=e("../log"),l=e("../spec"),c=e("./concat"),u=e("./facet"),f=e("./layer"),d=e("./repeat"),p=e("./unit");n.buildModel=function(e,t,n,i,r,o,a){if(l.isFacetSpec(e))return new u.FacetModel(e,t,n,r,o);if(l.isLayerSpec(e))return new f.LayerModel(e,t,n,i,r,o,a);if(l.isUnitSpec(e))return new p.UnitModel(e,t,n,i,r,o,a);if(l.isRepeatSpec(e))return new d.RepeatModel(e,t,n,r,o);if(l.isConcatSpec(e))return new c.ConcatModel(e,t,n,r,o);throw new Error(s.message.INVALID_SPEC)}},{"../log":110,"../spec":118,"./concat":26,"./facet":46,"./layer":47,"./repeat":73,"./unit":96}],24:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=e("vega-util"),r=e("../channel"),a=e("../fielddef"),s=e("../scale"),l=e("../timeunit"),o=e("../type"),c=e("../util");function u(e){return[].concat(e.type,e.style||[])}function f(e,t,n){var i=n.mark[e],r=n[t.type];void 0!==r[e]&&(i=r[e]);for(var o=0,a=u(t);o<a.length;o++){var s=a[o],l=n.style[s],c=e;l&&void 0!==l[c]&&(i=l[c])}return i}function d(e,t,n){if(e.type===o.QUANTITATIVE)return t||n.numberFormat}function p(e,t){return"format("+e+\', "\'+(t||"")+\'")\'}function g(e,t,n){return p(e,t||n.numberFormat)}function m(e,t,n,i){return e+" === null || isNaN("+e+\') ? "null" : \'+g(e,n,i)+\' + " - " + \'+g(t,n,i)}function h(e,t,n,i,r,o){if(!t||n){var a=n||r;return o?"utcFormat("+e+", \'"+a+"\')":"timeFormat("+e+", \'"+a+"\')"}return l.formatExpression(t,e,i,o)}function v(e,t){var r=e.slice();return t.forEach(function(e){for(var t=0,n=r;t<n.length;t++){var i=n[t];if(c.stringify(i)===c.stringify(e))return}r.push(e)}),r}n.applyConfig=function(e,t,n){for(var i=0,r=n;i<r.length;i++){var o=r[i],a=t[o];void 0!==a&&(e[o]={value:a})}return e},n.applyMarkConfig=function(e,t,n){for(var i=0,r=n;i<r.length;i++){var o=r[i],a=f(o,t.markDef,t.config);void 0!==a&&(e[o]={value:a})}return e},n.getStyles=u,n.getMarkConfig=f,n.formatSignalRef=function(e,t,n,i){var r=d(e,t,i);if(e.bin)return{signal:m(a.vgField(e,{expr:n}),a.vgField(e,{expr:n,binSuffix:"end"}),r,i)};if("quantitative"===e.type)return{signal:""+p(a.vgField(e,{expr:n}),r)};if(a.isTimeFieldDef(e)){var o=a.isScaleFieldDef(e)&&e.scale&&e.scale.type===s.ScaleType.UTC;return{signal:h(a.vgField(e,{expr:n}),e.timeUnit,t,i.text.shortTimeLabels,i.timeFormat,o)}}return{signal:"\'\'+"+a.vgField(e,{expr:n})}},n.getSpecifiedOrDefaultValue=function(e,t){return void 0!==e?e:t},n.numberFormat=d,n.numberFormatExpr=g,n.binFormatExpression=m,n.timeFormatExpression=h,n.sortParams=function(e,n){return(i.isArray(e)?e:[e]).reduce(function(e,t){return e.field.push(a.vgField(t,n)),e.order.push(t.sort||"ascending"),e},{field:[],order:[]})},n.mergeTitleFieldDefs=v,n.titleMerger=function(e,t){if(i.isArray(e.value)&&i.isArray(t.value))return{explicit:e.explicit,value:v(e.value,t.value)};if(!i.isArray(e.value)&&!i.isArray(t.value))return{explicit:e.explicit,value:e.value===t.value?e.value:e.value+", "+t.value};throw new Error("It should never reach here")},n.binRequiresRange=function(e,t){return e.bin?r.isScaleChannel(t)&&c.contains(["ordinal","nominal"],e.type):(console.warn("Only use this method with binned field defs"),!1)}},{"../channel":15,"../fielddef":106,"../scale":115,"../timeunit":120,"../type":124,"../util":125,"vega-util":10}],25:[function(e,t,n){"use strict";var c=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var u=e("../config"),f=e("../fielddef"),d=e("../log"),p=e("../spec"),g=e("../toplevelprops"),m=e("../util"),h=e("./buildmodel"),v=e("./data/assemble"),y=e("./data/optimize");n.compile=function(e,t){void 0===t&&(t={}),t.logger&&d.set(t.logger),t.fieldTitle&&f.setTitleFormatter(t.fieldTitle);try{var n=u.initConfig(m.mergeDeep({},t.config,e.config)),i=p.normalize(e,n),r=g.normalizeAutoSize(e.autosize,n.autosize,p.isLayerSpec(i)||p.isUnitSpec(i)),o=h.buildModel(i,null,"",void 0,void 0,n,"fit"===r.type);return o.parse(),y.optimizeDataflow(o.component.data),function(e,t){var n=e.config?u.stripAndRedirectConfig(e.config):void 0,i=[].concat(e.assembleSelectionData([]),v.assembleRootData(e.component.data,t.datasets||{}));delete t.datasets;var r=e.assembleProjections(),o=e.assembleTitle(),a=e.assembleGroupStyle(),s=e.assembleLayoutSignals();return s=s.filter(function(e){return"width"!==e.name&&"height"!==e.name||void 0===e.value||(t[e.name]=+e.value,!1)}),{spec:c({$schema:"https://vega.github.io/schema/vega/v3.0.json"},e.description?{description:e.description}:{},t,o?{title:o}:{},a?{style:a}:{},{data:i},0<r.length?{projections:r}:{},e.assembleGroup(s.concat(e.assembleSelectionTopLevelSignals([]))),n?{config:n}:{})}}(o,(a=e,s=n,l=r,c({autosize:1===m.keys(l).length&&l.type?l.type:l},g.extractTopLevelProperties(s),g.extractTopLevelProperties(a))))}finally{t.logger&&d.reset(),t.fieldTitle&&f.resetTitleFormatter()}var a,s,l}},{"../config":101,"../fielddef":106,"../log":110,"../spec":118,"../toplevelprops":122,"../util":125,"./buildmodel":23,"./data/assemble":28,"./data/optimize":40}],26:[function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var s=e("../log"),l=e("../spec"),a=e("./baseconcat"),c=e("./buildmodel"),u=e("./layoutsize/parse"),f=function(a){function e(e,t,n,i,r){var o=a.call(this,e,t,n,r,e.resolve)||this;return o.type="concat",e.resolve&&e.resolve.axis&&("shared"===e.resolve.axis.x||"shared"===e.resolve.axis.y)&&s.warn(s.message.CONCAT_CANNOT_SHARE_AXIS),o.isVConcat=l.isVConcatSpec(e),o.children=(l.isVConcatSpec(e)?e.vconcat:e.hconcat).map(function(e,t){return c.buildModel(e,o,o.getName("concat_"+t),void 0,i,r,!1)}),o}return r(e,a),e.prototype.parseLayoutSize=function(){u.parseConcatLayoutSize(this)},e.prototype.parseAxisGroup=function(){return null},e.prototype.assembleLayout=function(){return o({padding:{row:10,column:10},offset:10},this.isVConcat?{columns:1}:{},{bounds:"full",align:"each"})},e}(a.BaseConcatModel);n.ConcatModel=f},{"../log":110,"../spec":118,"./baseconcat":22,"./buildmodel":23,"./layoutsize/parse":50}],27:[function(e,t,n){"use strict";var i,o=this&&this.__extends||(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),a=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var l=e("../../channel"),u=e("../../fielddef"),s=e("../../log"),f=e("../../util"),d=e("../common");var r=function(r){function c(e,t,n){var i=r.call(this,e)||this;return i.dimensions=t,i.measures=n,i}return o(c,r),c.prototype.clone=function(){return new c(null,a({},this.dimensions),f.duplicate(this.measures))},c.makeFromEncoding=function(e,o){var t=!1;o.forEachFieldDef(function(e){e.aggregate&&(t=!0)});var a={},s={};return t?(o.forEachFieldDef(function(e,t){var n,i,r;e.aggregate?"count"===e.aggregate?(a["*"]=a["*"]||{},a["*"].count=u.vgField(e,{aggregate:"count"})):(a[e.field]=a[e.field]||{},a[e.field][e.aggregate]=u.vgField(e),l.isScaleChannel(t)&&"unaggregated"===o.scaleDomain(t)&&(a[e.field].min=u.vgField(e,{aggregate:"min"}),a[e.field].max=u.vgField(e,{aggregate:"max"}))):(n=s,i=t,(r=e).bin?(n[u.vgField(r,{})]=!0,n[u.vgField(r,{binSuffix:"end"})]=!0,d.binRequiresRange(r,i)&&(n[u.vgField(r,{binSuffix:"range"})]=!0)):n[u.vgField(r)]=!0)}),f.keys(s).length+f.keys(a).length===0?null:new c(e,s,a)):null},c.makeFromTransform=function(e,t){for(var n={},i={},r=0,o=t.aggregate;r<o.length;r++){(l=o[r]).op&&("count"===l.op?(i["*"]=i["*"]||{},i["*"].count=l.as||u.vgField(l)):(i[l.field]=i[l.field]||{},i[l.field][l.op]=l.as||u.vgField(l)))}for(var a=0,s=t.groupby||[];a<s.length;a++){var l;n[l=s[a]]=!0}return f.keys(n).length+f.keys(i).length===0?null:new c(e,n,i)},c.prototype.merge=function(e){f.differ(this.dimensions,e.dimensions)?s.debug("different dimensions, cannot merge"):(!function(e,t){for(var n in t)if(t.hasOwnProperty(n)){var i=t[n];for(var r in i)i.hasOwnProperty(r)&&(n in e?e[n][r]=i[r]:e[n]={op:i[r]})}}(this.measures,e.measures),e.remove())},c.prototype.addDimensions=function(e){var t=this;e.forEach(function(e){return t.dimensions[e]=!0})},c.prototype.dependentFields=function(){var t={};return f.keys(this.dimensions).forEach(function(e){return t[e]=!0}),f.keys(this.measures).forEach(function(e){return t[e]=!0}),t},c.prototype.producedFields=function(){var e=this,n={};return f.keys(this.measures).forEach(function(t){f.keys(e.measures[t]).forEach(function(e){n[e+"_"+t]=!0})}),n},c.prototype.assemble=function(){for(var e=[],t=[],n=[],i=0,r=f.keys(this.measures);i<r.length;i++)for(var o=r[i],a=0,s=f.keys(this.measures[o]);a<s.length;a++){var l=s[a];n.push(this.measures[o][l]),e.push(l),t.push(o)}return{type:"aggregate",groupby:f.keys(this.dimensions),ops:e,fields:t,as:n}},c}(e("./dataflow").DataFlowNode);n.AggregateNode=r},{"../../channel":15,"../../fielddef":106,"../../log":110,"../../util":125,"../common":24,"./dataflow":31}],28:[function(e,t,n){"use strict";var a=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var s=e("../../data"),g=e("../../util"),l=e("./aggregate"),c=e("./bin"),u=e("./calculate"),f=e("./dataflow"),d=e("./facet"),p=e("./filter"),m=e("./filterinvalid"),h=e("./formatparse"),v=e("./geojson"),y=e("./geopoint"),b=e("./indentifier"),O=e("./lookup"),_=e("./source"),S=e("./stack"),E=e("./timeunit");function x(r){var o=0;return function t(e,n){e instanceof _.SourceNode&&(s.isUrlData(e.data)||(r.push(n),n={name:null,source:n.name,transform:[]}));if(e instanceof h.ParseNode&&(e.parent instanceof _.SourceNode&&!n.source?n.format=a({},n.format||{},{parse:e.assembleFormatParse()}):n.transform=n.transform.concat(e.assembleTransforms())),e instanceof d.FacetNode)return n.name||(n.name="data_"+o++),!n.source||0<n.transform.length?(r.push(n),e.data=n.name):e.data=n.source,void e.assemble().forEach(function(e){return r.push(e)});(e instanceof p.FilterNode||e instanceof u.CalculateNode||e instanceof y.GeoPointNode||e instanceof v.GeoJSONNode||e instanceof l.AggregateNode||e instanceof O.LookupNode||e instanceof b.IdentifierNode)&&n.transform.push(e.assemble()),(e instanceof m.FilterInvalidNode||e instanceof c.BinNode||e instanceof E.TimeUnitNode||e instanceof S.StackNode)&&(n.transform=n.transform.concat(e.assemble())),e instanceof l.AggregateNode&&(n.name||(n.name="data_"+o++)),e instanceof f.OutputNode&&(n.source&&0===n.transform.length?e.setSource(n.source):e.parent instanceof f.OutputNode?e.setSource(n.name):(n.name||(n.name="data_"+o++),e.setSource(n.name),1===e.numChildren()&&(r.push(n),n={name:null,source:n.name,transform:[]})));switch(e.numChildren()){case 0:e instanceof f.OutputNode&&(!n.source||0<n.transform.length)&&r.push(n);break;case 1:t(e.children[0],n);break;default:n.name||(n.name="data_"+o++);var i=n.name;!n.source||0<n.transform.length?r.push(n):i=n.source,e.children.forEach(function(e){t(e,{name:null,source:i,transform:[]})})}}}n.assembleFacetData=function(t){var e=[],n=x(e);return t.children.forEach(function(e){return n(e,{source:t.name,name:null,transform:[]})}),e},n.assembleRootData=function(e,t){var n=g.vals(e.sources),i=[],r=x(i),o=0;n.forEach(function(e){e.hasName()||(e.dataName="source_"+o++);var t=e.assemble();r(e,t)}),i.forEach(function(e){0===e.transform.length&&delete e.transform}),i.sort(function(e,t){return 0===(e.transform||[]).length?-1:0===(t.transform||[]).length?1:0});for(var a=0,s=i;a<s.length;a++)for(var l=0,c=(p=s[a]).transform||[];l<c.length;l++){var u=c[l];"lookup"===u.type&&(u.from=e.outputNodes[u.from].getSource())}for(var f=0,d=i;f<d.length;f++){var p;(p=d[f]).name in t&&(p.values=t[p.name])}return i}},{"../../data":102,"../../util":125,"./aggregate":27,"./bin":29,"./calculate":30,"./dataflow":31,"./facet":32,"./filter":33,"./filterinvalid":34,"./formatparse":35,"./geojson":36,"./geopoint":37,"./indentifier":38,"./lookup":39,"./source":43,"./stack":44,"./timeunit":45}],29:[function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),d=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var p=e("../../bin"),g=e("../../fielddef"),o=e("../../util"),l=e("../common"),c=e("../model");function u(e,t){var n;n="as"in e?[e.as,e.as+"_end"]:[g.vgField(e,{}),g.vgField(e,{binSuffix:"end"})];var i,r,o,a,s=g.normalizeBin(e.bin,void 0)||{},l=(i=s,r=e.field,p.binToString(i)+"_"+r),c=(a=l,{signal:(o=t).getName(a+"_bins"),extentSignal:o.getName(a+"_extent")}),u=c.signal,f=c.extentSignal;return{key:l,binComponent:d({bin:s,field:e.field,as:n},u?{signal:u}:{},f?{extentSignal:f}:{})}}var a=function(i){function s(e,t){var n=i.call(this,e)||this;return n.bins=t,n}return r(s,i),s.prototype.clone=function(){return new s(null,o.duplicate(this.bins))},s.makeFromEncoding=function(e,a){var t=a.reduceFieldDef(function(e,t,n){if(t.bin){var i=u(t,a),r=i.key,o=i.binComponent;e[r]=d({},o,e[r],function(e,t,n,i){if(l.binRequiresRange(t,n)){var r=c.isUnitModel(e)&&(e.axis(n)||e.legend(n))||{},o=g.vgField(t,{expr:"datum"}),a=g.vgField(t,{expr:"datum",binSuffix:"end"});return{formulaAs:g.vgField(t,{binSuffix:"range"}),formula:l.binFormatExpression(o,a,r.format,i)}}return{}}(a,t,n,a.config))}return e},{});return 0===o.keys(t).length?null:new s(e,t)},s.makeFromTransform=function(e,t,n){var i,r=u(t,n),o=r.key,a=r.binComponent;return new s(e,((i={})[o]=a,i))},s.prototype.merge=function(e){this.bins=d({},this.bins,e.bins),e.remove()},s.prototype.producedFields=function(){var t={};return o.vals(this.bins).forEach(function(e){e.as.forEach(function(e){return t[e]=!0})}),t},s.prototype.dependentFields=function(){var t={};return o.vals(this.bins).forEach(function(e){t[e.field]=!0}),t},s.prototype.assemble=function(){return o.flatten(o.vals(this.bins).map(function(e){var t=[],n=d({type:"bin",field:e.field,as:e.as,signal:e.signal},e.bin);return!e.bin.extent&&e.extentSignal&&(t.push({type:"extent",field:e.field,signal:e.extentSignal}),n.extent={signal:e.extentSignal}),t.push(n),e.formula&&t.push({type:"formula",expr:e.formula,as:e.formulaAs}),t}))},s}(e("./dataflow").DataFlowNode);n.BinNode=a},{"../../bin":14,"../../fielddef":106,"../../util":125,"../common":24,"../model":69,"./dataflow":31}],30:[function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(n,"__esModule",{value:!0});var o=e("../../util"),a=function(i){function e(e,t){var n=i.call(this,e)||this;return n.transform=t,n}return r(e,i),e.prototype.clone=function(){return new e(null,o.duplicate(this.transform))},e.prototype.producedFields=function(){var e={};return e[this.transform.as]=!0,e},e.prototype.assemble=function(){return{type:"formula",expr:this.transform.calculate,as:this.transform.as}},e}(e("./dataflow").DataFlowNode);n.CalculateNode=a},{"../../util":125,"./dataflow":31}],31:[function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(n,"__esModule",{value:!0});var o=function(){function e(e,t){this.debugName=t,this._children=[],this._parent=null,e&&(this.parent=e)}return e.prototype.clone=function(){throw new Error("Cannot clone node")},e.prototype.producedFields=function(){return{}},e.prototype.dependentFields=function(){return{}},Object.defineProperty(e.prototype,"parent",{get:function(){return this._parent},set:function(e){(this._parent=e).addChild(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"children",{get:function(){return this._children},enumerable:!0,configurable:!0}),e.prototype.numChildren=function(){return this._children.length},e.prototype.addChild=function(e){this._children.push(e)},e.prototype.removeChild=function(e){this._children.splice(this._children.indexOf(e),1)},e.prototype.remove=function(){for(var e=0,t=this._children;e<t.length;e++){t[e].parent=this._parent}this._parent.removeChild(this)},e.prototype.insertAsParentOf=function(e){var t=e.parent;t.removeChild(this),this.parent=t,e.parent=this},e.prototype.swapWithParent=function(){for(var e=this._parent,t=e.parent,n=0,i=this._children;n<i.length;n++){i[n].parent=e}this._children=[],e.removeChild(this),e.parent.removeChild(e),this.parent=t,e.parent=this},e}(),a=function(o){function e(e,t,n,i){var r=o.call(this,e,t)||this;return r.type=n,r.refCounts=i,r._source=r._name=t,!r.refCounts||r._name in r.refCounts||(r.refCounts[r._name]=0),r}return r(e,o),e.prototype.clone=function(){var e=new this.constructor;return e.debugName="clone_"+this.debugName,e._source=this._source,e._name="clone_"+this._name,e.type=this.type,e.refCounts=this.refCounts,e.refCounts[e._name]=0,e},e.prototype.getSource=function(){return this.refCounts[this._name]++,this._source},e.prototype.isRequired=function(){return!!this.refCounts[this._name]},e.prototype.setSource=function(e){this._source=e},e}(n.DataFlowNode=o);n.OutputNode=a},{}],32:[function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),a=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var s=e("../../channel"),c=e("../../log"),u=e("../../scale"),f=e("../../vega.schema"),d=e("../scale/domain"),o=function(o){function e(e,t,n,i){var r=o.call(this,e)||this;return r.model=t,r.name=n,r.data=i,t.facet.column&&(r.columnFields=[t.vgField(s.COLUMN)],r.columnName=t.getName("column_domain"),t.fieldDef(s.COLUMN).bin&&r.columnFields.push(t.vgField(s.COLUMN,{binSuffix:"end"}))),t.facet.row&&(r.rowFields=[t.vgField(s.ROW)],r.rowName=t.getName("row_domain"),t.fieldDef(s.ROW).bin&&r.rowFields.push(t.vgField(s.ROW,{binSuffix:"end"}))),r.childModel=t.child,r}return r(e,o),Object.defineProperty(e.prototype,"fields",{get:function(){var e=[];return this.columnFields&&(e=e.concat(this.columnFields)),this.rowFields&&(e=e.concat(this.rowFields)),e},enumerable:!0,configurable:!0}),e.prototype.getSource=function(){return this.name},e.prototype.getChildIndependentFieldsWithStep=function(){for(var e={},t=0,n=["x","y"];t<n.length;t++){var i=n[t],r=this.childModel.component.scales[i];if(r&&!r.merged){var o=r.get("type"),a=r.get("range");if(u.hasDiscreteDomain(o)&&f.isVgRangeStep(a)){var s=d.assembleDomain(this.childModel,i),l=d.getFieldFromDomain(s);l?e[i]=l:c.warn("Unknown field for ${channel}.  Cannot calculate view size.")}}}return e},e.prototype.assembleRowColumnData=function(e,t,n){var i={},r="row"===e?"y":"x";return n[r]&&(i=t?{fields:["distinct_"+n[r]],ops:["max"],as:["distinct_"+n[r]]}:{fields:[n[r]],ops:["distinct"]}),{name:"row"===e?this.rowName:this.columnName,source:t||this.data,transform:[a({type:"aggregate",groupby:"row"===e?this.rowFields:this.columnFields},i)]}},e.prototype.assemble=function(){var e=[],t=null,n=this.getChildIndependentFieldsWithStep();if(this.columnName&&this.rowName&&(n.x||n.y)){t="cross_"+this.columnName+"_"+this.rowName;var i=[].concat(n.x?[n.x]:[],n.y?[n.y]:[]),r=i.map(function(){return"distinct"});e.push({name:t,source:this.data,transform:[{type:"aggregate",groupby:this.columnFields.concat(this.rowFields),fields:i,ops:r}]})}return this.columnName&&e.push(this.assembleRowColumnData("column",t,n)),this.rowName&&e.push(this.assembleRowColumnData("row",t,n)),e},e}(e("./dataflow").DataFlowNode);n.FacetNode=o},{"../../channel":15,"../../log":110,"../../scale":115,"../../vega.schema":127,"../scale/domain":78,"./dataflow":31}],33:[function(e,t,n){"use strict";var i,o=this&&this.__extends||(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(n,"__esModule",{value:!0});var a=e("../../predicate"),s=e("../../util"),r=function(r){function e(e,t,n){var i=r.call(this,e)||this;return i.model=t,i.filter=n,i.expr=a.expression(i.model,i.filter,i),i}return o(e,r),e.prototype.clone=function(){return new e(null,this.model,s.duplicate(this.filter))},e.prototype.assemble=function(){return{type:"filter",expr:this.expr}},e}(e("./dataflow").DataFlowNode);n.FilterNode=r},{"../../predicate":113,"../../util":125,"./dataflow":31}],34:[function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var a=e("../../channel"),s=e("../../fielddef"),l=e("../../scale"),c=e("../../util"),u=function(i){function n(e,t){var n=i.call(this,e)||this;return n.fieldDefs=t,n}return r(n,i),n.prototype.clone=function(){return new n(null,o({},this.fieldDefs))},n.make=function(e,o){if("filter"!==o.config.invalidValues)return null;var t=o.reduceFieldDef(function(e,t,n){var i=a.isScaleChannel(n)&&o.getScaleComponent(n);if(i){var r=i.get("type");l.hasContinuousDomain(r)&&!t.aggregate&&(e[t.field]=t)}return e},{});return c.keys(t).length?new n(e,t):null},Object.defineProperty(n.prototype,"filter",{get:function(){return this.fieldDefs},enumerable:!0,configurable:!0}),n.prototype.assemble=function(){var r=this,e=c.keys(this.filter).reduce(function(e,t){var n=r.fieldDefs[t],i=s.vgField(n,{expr:"datum"});return null!==n&&(e.push(i+" !== null"),e.push("!isNaN("+i+")")),e},[]);return 0<e.length?{type:"filter",expr:e.join(" && ")}:null},n}(e("./dataflow").DataFlowNode);n.FilterInvalidNode=u},{"../../channel":15,"../../fielddef":106,"../../scale":115,"../../util":125,"./dataflow":31}],35:[function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var a=e("vega-util"),l=e("../../aggregate"),c=e("../../fielddef"),u=e("../../log"),f=e("../../logical"),d=e("../../predicate"),p=e("../../transform"),g=e("../../util"),m=e("../model");var s=function(i){function s(e,t){var n=i.call(this,e)||this;return n._parse={},n._parse=t,n}return r(s,i),s.prototype.clone=function(){return new s(null,g.duplicate(this.parse))},s.make=function(e,t){var n={},i={};(t.transforms||[]).forEach(function(e){p.isCalculate(e)?i[e.as]=!0:p.isFilter(e)&&f.forEachLeave(e.filter,function(e){d.isFieldPredicate(e)&&e.timeUnit&&(n[e.field]="date")})},{}),(m.isUnitModel(t)||m.isFacetModel(t))&&t.forEachFieldDef(function(e){if(c.isTimeFieldDef(e))n[e.field]="date";else if(c.isNumberFieldDef(e)){if(i[e.field]||l.isCountingAggregateOp(e.aggregate))return;n[e.field]="number"}});var r=t.data;if(r&&r.format&&r.format.parse){var o=r.format.parse;g.keys(o).forEach(function(e){n[e]=o[e]})}var a=t.component.data.ancestorParse;return g.keys(a).forEach(function(e){n[e]!==a[e]?u.warn(u.message.differentParse(e,n[e],a[e])):delete n[e]}),0===g.keys(n).length?null:new s(e,n)},Object.defineProperty(s.prototype,"parse",{get:function(){return this._parse},enumerable:!0,configurable:!0}),s.prototype.merge=function(e){this._parse=o({},this._parse,e.parse),e.remove()},s.prototype.assembleFormatParse=function(){return this._parse},s.prototype.producedFields=function(){return a.toSet(g.keys(this.parse))},s.prototype.dependentFields=function(){return a.toSet(g.keys(this.parse))},s.prototype.assembleTransforms=function(){var o=this;return g.keys(this._parse).map(function(e){var t,n,i,r=(t=e,n=o._parse[e],i="datum"+g.accessPath(t),"number"===n?"toNumber("+i+")":"boolean"===n?"toBoolean("+i+")":"string"===n?"toString("+i+")":"date"===n?"toDate("+i+")":0===n.indexOf("date:")?"timeParse("+i+","+n.slice(5,n.length)+")":0===n.indexOf("utc:")?"utcParse("+i+","+n.slice(4,n.length)+")":(u.warn(u.message.unrecognizedParse(n)),null));return r?{type:"formula",expr:r,as:e}:null}).filter(function(e){return null!==e})},s}(e("./dataflow").DataFlowNode);n.ParseNode=s},{"../../aggregate":12,"../../fielddef":106,"../../log":110,"../../logical":111,"../../predicate":113,"../../transform":123,"../../util":125,"../model":69,"./dataflow":31,"vega-util":10}],36:[function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),s=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var l=e("../../channel"),c=e("../../type"),u=e("../../util"),o=function(o){function a(e,t,n,i){var r=o.call(this,e)||this;return r.fields=t,r.geojson=n,r.signal=i,r}return r(a,o),a.prototype.clone=function(){return new a(null,u.duplicate(this.fields),this.geojson,this.signal)},a.parseAll=function(n,i){var r=0;if([[l.LONGITUDE,l.LATITUDE],[l.LONGITUDE2,l.LATITUDE2]].forEach(function(e){var t=e.map(function(e){return i.channelHasField(e)?i.fieldDef(e).field:void 0});(t[0]||t[1])&&(n=new a(n,t,null,i.getName("geojson_"+r++)))}),i.channelHasField(l.SHAPE)){var e=i.fieldDef(l.SHAPE);e.type===c.GEOJSON&&(n=new a(n,null,e.field,i.getName("geojson_"+r++)))}return n},a.prototype.assemble=function(){return s({type:"geojson"},this.fields?{fields:this.fields}:{},this.geojson?{geojson:this.geojson}:{},{signal:this.signal})},a}(e("./dataflow").DataFlowNode);n.GeoJSONNode=o},{"../../channel":15,"../../type":124,"../../util":125,"./dataflow":31}],37:[function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(n,"__esModule",{value:!0});var s=e("../../channel"),l=e("../../util"),o=function(o){function a(e,t,n,i){var r=o.call(this,e)||this;return r.projection=t,r.fields=n,r.as=i,r}return r(a,o),a.prototype.clone=function(){return new a(null,this.projection,l.duplicate(this.fields),l.duplicate(this.as))},a.parseAll=function(i,r){return r.projectionName()&&[[s.LONGITUDE,s.LATITUDE],[s.LONGITUDE2,s.LATITUDE2]].forEach(function(e){var t=e.map(function(e){return r.channelHasField(e)?r.fieldDef(e).field:void 0}),n=e[0]===s.LONGITUDE2?"2":"";(t[0]||t[1])&&(i=new a(i,r.projectionName(),t,[r.getName("x"+n),r.getName("y"+n)]))}),i},a.prototype.assemble=function(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}},a}(e("./dataflow").DataFlowNode);n.GeoPointNode=o},{"../../channel":15,"../../util":125,"./dataflow":31}],38:[function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(n,"__esModule",{value:!0});var o=e("../../selection"),a=function(t){function e(e){return t.call(this,e)||this}return r(e,t),e.prototype.clone=function(){return new e(null)},e.prototype.producedFields=function(){return(e={})[o.SELECTION_ID]=!0,e;var e},e.prototype.assemble=function(){return{type:"identifier",as:o.SELECTION_ID}},e}(e("./dataflow").DataFlowNode);n.IdentifierNode=a},{"../../selection":116,"./dataflow":31}],39:[function(e,t,n){"use strict";var i,o=this&&this.__extends||(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),a=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var s=e("vega-util"),l=e("../../log"),u=e("./dataflow"),f=e("./source"),r=function(r){function c(e,t,n){var i=r.call(this,e)||this;return i.transform=t,i.secondary=n,i}return o(c,r),c.make=function(e,t,n,i){var r=t.component.data.sources,o=new f.SourceNode(n.from.data),a=r[o.hash()];a||(a=r[o.hash()]=o);var s=t.getName("lookup_"+i),l=new u.OutputNode(a,s,"lookup",t.component.data.outputNodeRefCounts);return new c(e,n,(t.component.data.outputNodes[s]=l).getSource())},c.prototype.producedFields=function(){return s.toSet(this.transform.from.fields||(this.transform.as instanceof Array?this.transform.as:[this.transform.as]))},c.prototype.assemble=function(){var e;if(this.transform.from.fields)e=a({values:this.transform.from.fields},this.transform.as?{as:this.transform.as instanceof Array?this.transform.as:[this.transform.as]}:{});else{var t=this.transform.as;s.isString(t)||(l.warn(l.message.NO_FIELDS_NEEDS_AS),t="_lookup"),e={as:[t]}}return a({type:"lookup",from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup]},e,this.transform.default?{default:this.transform.default}:{})},c}(u.DataFlowNode);n.LookupNode=r},{"../../log":110,"./dataflow":31,"./source":43,"vega-util":10}],40:[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0});var i=e("../../data"),a=e("../../util"),s=e("./aggregate"),l=e("./dataflow"),c=e("./facet"),n=e("./filterinvalid"),r=e("./optimizers"),u=e("./stack");function f(t){if(t instanceof c.FacetNode)if(1!==t.numChildren()||t.children[0]instanceof l.OutputNode){!function e(t){if(t instanceof l.OutputNode&&t.type===i.MAIN&&1===t.numChildren()){var n=t.children[0];n instanceof c.FacetNode||(n.swapWithParent(),e(t))}}(t.model.component.data.main),a.flatten(t.children.map((r=t,function e(t){if(!(t instanceof c.FacetNode)){var n=t.clone();if(n instanceof l.OutputNode){var i=o.FACET_SCALE_PREFIX+n.getSource();n.setSource(i),r.model.component.data.outputNodes[i]=n}else(n instanceof s.AggregateNode||n instanceof u.StackNode)&&n.addDimensions(r.fields);return a.flatten(t.children.map(e)).forEach(function(e){return e.parent=n}),[n]}return a.flatten(t.children.map(e))}))).forEach(function(e){return e.parent=t.model.component.data.main})}else{var e=t.children[0];(e instanceof s.AggregateNode||e instanceof u.StackNode)&&e.addDimensions(t.fields),e.swapWithParent(),f(t)}else t.children.forEach(f);var r}function d(e){e instanceof n.FilterInvalidNode&&a.every(a.vals(e.filter),function(e){return null===e})&&e.remove(),e instanceof l.OutputNode&&!e.isRequired()&&e.remove(),e.children.forEach(d)}function p(e){var n=[];return e.forEach(function e(t){0===t.numChildren()?n.push(t):t.children.forEach(e)}),n}o.FACET_SCALE_PREFIX="scale_",o.optimizeDataflow=function(t){var e=a.vals(t.sources);e.forEach(d),p(e=e.filter(function(e){return 0<e.numChildren()})).forEach(r.iterateFromLeaves(r.removeUnusedSubtrees)),p(e=e.filter(function(e){return 0<e.numChildren()})).forEach(r.iterateFromLeaves(r.moveParseUp)),p(e).forEach(r.removeDuplicateTimeUnits),e.forEach(f),a.keys(t.sources).forEach(function(e){0===t.sources[e].numChildren()&&delete t.sources[e]})}},{"../../data":102,"../../util":125,"./aggregate":27,"./dataflow":31,"./facet":32,"./filterinvalid":34,"./optimizers":41,"./stack":44}],41:[function(e,t,n){"use strict";var i=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var r=e("../../util"),o=e("./dataflow"),a=e("./facet"),s=e("./formatparse"),l=e("./source"),c=e("./timeunit");function u(i){return function e(t){if(!(t instanceof l.SourceNode)){var n=t.parent;i(t)&&e(n)}}}n.iterateFromLeaves=u,n.moveParseUp=function(e){var t=e.parent;if(e instanceof s.ParseNode){if(t instanceof l.SourceNode)return!1;if(1<t.numChildren())return!0;if(t instanceof s.ParseNode)t.merge(e);else{if(r.hasIntersection(t.producedFields(),e.dependentFields()))return!0;e.swapWithParent()}}return!0},n.removeUnusedSubtrees=function(e){return!(e instanceof o.OutputNode||0<e.numChildren()||e instanceof a.FacetNode||(e.remove(),0))},n.removeDuplicateTimeUnits=function(e){var n={};return u(function(e){if(e instanceof c.TimeUnitNode){var t=e.producedFields();r.keys(t).every(function(e){return!!n[e]})?e.remove():n=i({},n,t)}return!0})(e)}},{"../../util":125,"./dataflow":31,"./facet":32,"./formatparse":35,"./source":43,"./timeunit":45}],42:[function(e,t,n){"use strict";var g=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var s=e("vega-util"),m=e("../../data"),l=e("../../datetime"),c=e("../../log"),u=e("../../predicate"),f=e("../../transform"),d=e("../../util"),h=e("../model"),v=e("../selection/selection"),y=e("./aggregate"),b=e("./bin"),p=e("./calculate"),O=e("./dataflow"),_=e("./facet"),S=e("./filter"),E=e("./filterinvalid"),x=e("./formatparse"),w=e("./geojson"),N=e("./geopoint"),T=e("./indentifier"),P=e("./lookup"),D=e("./source"),k=e("./stack"),j=e("./timeunit");function A(r,o){var a=0;return o.transforms.forEach(function(e){if(f.isCalculate(e))r=new p.CalculateNode(r,e);else if(f.isFilter(e)){var t={},n=e.filter,i=null;u.isFieldEqualPredicate(n)?i=n.equal:u.isFieldRangePredicate(n)?i=n.range[0]:u.isFieldOneOfPredicate(n)&&(i=(n.oneOf||n.in)[0]),i&&(l.isDateTime(i)?t[n.field]="date":s.isNumber(i)?t[n.field]="number":s.isString(i)&&(t[n.field]="string")),0<d.keys(t).length&&(r=new x.ParseNode(r,t)),r=new S.FilterNode(r,o,e.filter)}else if(f.isBin(e))r=b.BinNode.makeFromTransform(r,e,o);else if(f.isTimeUnit(e))r=j.TimeUnitNode.makeFromTransform(r,e);else if(f.isAggregate(e))r=y.AggregateNode.makeFromTransform(r,e),v.requiresSelectionId(o)&&(r=new T.IdentifierNode(r));else{if(!f.isLookup(e))return void c.warn(c.message.invalidTransformIgnored(e));r=P.LookupNode.make(r,o,e,a++)}}),r}n.parseTransformArray=A,n.parseData=function(e){var t=function(e,t){if(e.data||!e.parent){var n=new D.SourceNode(e.data),i=n.hash();return i in t?t[i]:t[i]=n}return e.parent.component.data.facetRoot?e.parent.component.data.facetRoot:e.parent.component.data.main}(e,e.component.data.sources),n=e.component.data.outputNodes,i=e.component.data.outputNodeRefCounts;v.requiresSelectionId(e)&&!e.parent&&(t=new T.IdentifierNode(t));var r=e.parent&&h.isLayerModel(e.parent);(h.isUnitModel(e)||h.isFacetModel(e))&&r&&(t=b.BinNode.makeFromEncoding(t,e)||t),0<e.transforms.length&&(t=A(t,e));var o=x.ParseNode.make(t,e);o&&(t=o),h.isUnitModel(e)&&(t=w.GeoJSONNode.parseAll(t,e),t=N.GeoPointNode.parseAll(t,e)),(h.isUnitModel(e)||h.isFacetModel(e))&&(r||(t=b.BinNode.makeFromEncoding(t,e)||t),t=j.TimeUnitNode.makeFromEncoding(t,e)||t);var a=e.getName(m.RAW),s=new O.OutputNode(t,a,m.RAW,i);if(t=n[a]=s,h.isUnitModel(e)){var l=y.AggregateNode.makeFromEncoding(t,e);l&&(t=l,v.requiresSelectionId(e)&&(t=new T.IdentifierNode(t))),t=k.StackNode.make(t,e)||t}h.isUnitModel(e)&&(t=E.FilterInvalidNode.make(t,e)||t);var c=e.getName(m.MAIN),u=new O.OutputNode(t,c,m.MAIN,i);t=n[c]=u;var f=null;if(h.isFacetModel(e)){var d=e.getName("facet");f=new _.FacetNode(t,e,d,u.getSource()),t=n[d]=f}var p=g({},e.component.data.ancestorParse,o?o.parse:{});return g({},e.component.data,{outputNodes:n,outputNodeRefCounts:i,raw:s,main:u,facetRoot:f,ancestorParse:p})}},{"../../data":102,"../../datetime":103,"../../log":110,"../../predicate":113,"../../transform":123,"../../util":125,"../model":69,"../selection/selection":85,"./aggregate":27,"./bin":29,"./calculate":30,"./dataflow":31,"./facet":32,"./filter":33,"./filterinvalid":34,"./formatparse":35,"./geojson":36,"./geopoint":37,"./indentifier":38,"./lookup":39,"./source":43,"./stack":44,"./timeunit":45,"vega-util":10}],43:[function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),a=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},s=this&&this.__rest||function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&(n[i[r]]=e[i[r]])}return n};Object.defineProperty(n,"__esModule",{value:!0});var l=e("../../data"),c=e("../../util"),o=function(o){function e(e){var t=o.call(this,null)||this;if(e=e||{name:"source"},l.isInlineData(e))t._data={values:e.values};else if(l.isUrlData(e)){if(t._data={url:e.url},e.format||(e.format={}),!e.format||!e.format.type){var n=/(?:\\.([^.]+))?$/.exec(e.url)[1];c.contains(["json","csv","tsv","topojson"],n)||(n="json"),e.format.type=n}}else l.isNamedData(e)&&(t._name=e.name,t._data={});if(!l.isNamedData(e)&&e.format){var i=e.format,r=(i.parse,s(i,["parse"]));t._data.format=r}return t}return r(e,o),Object.defineProperty(e.prototype,"data",{get:function(){return this._data},enumerable:!0,configurable:!0}),e.prototype.hasName=function(){return!!this._name},Object.defineProperty(e.prototype,"dataName",{get:function(){return this._name},set:function(e){this._name=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"parent",{set:function(e){throw new Error("Source nodes have to be roots.")},enumerable:!0,configurable:!0}),e.prototype.remove=function(){throw new Error("Source nodes are roots and cannot be removed.")},e.prototype.hash=function(){return l.isInlineData(this._data)?(this._hash||(this._hash=c.hash(this._data)),this._hash):l.isUrlData(this._data)?c.hash([this._data.url,this._data.format]):this._name},e.prototype.assemble=function(){return a({name:this._name},this._data,{transform:[]})},e}(e("./dataflow").DataFlowNode);n.SourceNode=o},{"../../data":102,"../../util":125,"./dataflow":31}],44:[function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(n,"__esModule",{value:!0});var o=e("vega-util"),u=e("../../fielddef"),a=e("../../util"),l=e("../common");var s=function(i){function s(e,t){var n=i.call(this,e)||this;return n._stack=t,n}return r(s,i),s.prototype.clone=function(){return new s(null,a.duplicate(this._stack))},s.make=function(e,t){var n,i=t.stack;if(!i)return null;i.groupbyChannel&&(n=t.fieldDef(i.groupbyChannel));var r,o=t.stack.stackBy.reduce(function(e,t){var n=t.fieldDef,i=u.vgField(n);return i&&e.push(i),e},[]),a=t.encoding.order;return r=a?l.sortParams(a):o.reduce(function(e,t){return e.field.push(t),e.order.push("descending"),e},{field:[],order:[]}),new s(e,{dimensionFieldDef:n,field:t.vgField(i.fieldChannel),facetby:[],stackby:o,sort:r,offset:i.offset,impute:i.impute})},Object.defineProperty(s.prototype,"stack",{get:function(){return this._stack},enumerable:!0,configurable:!0}),s.prototype.addDimensions=function(e){this._stack.facetby=this._stack.facetby.concat(e)},s.prototype.dependentFields=function(){var t={};t[this._stack.field]=!0,this.getGroupbyFields().forEach(function(e){return t[e]=!0}),this._stack.facetby.forEach(function(e){return t[e]=!0});var e=this._stack.sort.field;return o.isArray(e)?e.forEach(function(e){return t[e]=!0}):t[e]=!0,t},s.prototype.producedFields=function(){var e={};return e[this._stack.field+"_start"]=!0,e[this._stack.field+"_end"]=!0,e},s.prototype.getGroupbyFields=function(){var e=this._stack,t=e.dimensionFieldDef,n=e.impute;return t?t.bin?n?[u.vgField(t,{binSuffix:"mid"})]:[u.vgField(t,{}),u.vgField(t,{binSuffix:"end"})]:[u.vgField(t)]:[]},s.prototype.assemble=function(){var e=[],t=this._stack,n=t.facetby,i=t.field,r=t.dimensionFieldDef,o=t.impute,a=t.offset,s=t.sort,l=t.stackby;if(o&&r){var c=r?u.vgField(r,{binSuffix:"mid"}):void 0;r.bin&&e.push({type:"formula",expr:"("+u.vgField(r,{expr:"datum"})+"+"+u.vgField(r,{expr:"datum",binSuffix:"end"})+")/2",as:c}),e.push({type:"impute",field:i,groupby:l,key:c,method:"value",value:0})}return e.push({type:"stack",groupby:this.getGroupbyFields().concat(n),field:i,sort:s,as:[i+"_start",i+"_end"],offset:a}),e},s}(e("./dataflow").DataFlowNode);n.StackNode=s},{"../../fielddef":106,"../../util":125,"../common":24,"./dataflow":31,"vega-util":10}],45:[function(e,t,n){"use strict";var i,o=this&&this.__extends||(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),a=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var s=e("../../fielddef"),l=e("../../timeunit"),c=e("../../util"),r=function(i){function r(e,t){var n=i.call(this,e)||this;return n.formula=t,n}return o(r,i),r.prototype.clone=function(){return new r(null,c.duplicate(this.formula))},r.makeFromEncoding=function(e,t){var n=t.reduceFieldDef(function(e,t){if(t.timeUnit){var n=s.vgField(t);e[n]={as:n,timeUnit:t.timeUnit,field:t.field}}return e},{});return 0===c.keys(n).length?null:new r(e,n)},r.makeFromTransform=function(e,t){return new r(e,((n={})[t.field]={as:t.as,timeUnit:t.timeUnit,field:t.field},n));var n},r.prototype.merge=function(e){this.formula=a({},this.formula,e.formula),e.remove()},r.prototype.producedFields=function(){var t={};return c.vals(this.formula).forEach(function(e){t[e.as]=!0}),t},r.prototype.dependentFields=function(){var t={};return c.vals(this.formula).forEach(function(e){t[e.field]=!0}),t},r.prototype.assemble=function(){return c.vals(this.formula).map(function(e){return{type:"formula",as:e.as,expr:l.fieldExpr(e.timeUnit,e.field)}})},r}(e("./dataflow").DataFlowNode);n.TimeUnitNode=r},{"../../fielddef":106,"../../timeunit":120,"../../util":125,"./dataflow":31}],46:[function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),f=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var d=e("../channel"),o=e("../encoding"),p=e("../fielddef"),g=e("../log"),m=e("../scale"),a=e("../util"),h=e("../vega.schema"),v=e("./axis/assemble"),l=e("./buildmodel"),y=e("./data/assemble"),c=e("./data/parse"),b=e("./layout/header"),O=e("./layoutsize/parse"),s=e("./model"),_=e("./repeater"),S=e("./resolve"),E=e("./scale/domain"),u=function(s){function u(e,t,n,i,r){var o=s.call(this,e,t,n,r,e.resolve)||this;o.type="facet",o.child=l.buildModel(e.spec,o,o.getName("child"),void 0,i,r,!1),o.children=[o.child];var a=_.replaceRepeaterInFacet(e.facet,i);return o.facet=o.initFacet(a),o}return r(u,s),u.prototype.initFacet=function(e){return o.reduce(e,function(e,t,n){return a.contains([d.ROW,d.COLUMN],n)?void 0===t.field?g.warn(g.message.emptyFieldDef(t,n)):e[n]=p.normalize(t,n):g.warn(g.message.incompatibleChannel(n,"facet")),e},{})},u.prototype.channelHasField=function(e){return!!this.facet[e]},u.prototype.fieldDef=function(e){return this.facet[e]},u.prototype.parseData=function(){this.component.data=c.parseData(this),this.child.parseData()},u.prototype.parseLayoutSize=function(){O.parseChildrenLayoutSize(this)},u.prototype.parseSelection=function(){this.child.parseSelection(),this.component.selection=this.child.component.selection},u.prototype.parseMarkGroup=function(){this.child.parseMarkGroup()},u.prototype.parseAxisAndHeader=function(){this.child.parseAxisAndHeader(),this.parseHeader("column"),this.parseHeader("row"),this.mergeChildAxis("x"),this.mergeChildAxis("y")},u.prototype.parseHeader=function(e){if(this.channelHasField(e)){var t=this.facet[e],n=t.header||{},i=void 0!==n.title?n.title:p.title(t,this.config);this.child.component.layoutHeaders[e].title&&(i+=" / "+this.child.component.layoutHeaders[e].title,this.child.component.layoutHeaders[e].title=null),this.component.layoutHeaders[e]={title:i,facetFieldDef:t,header:[this.makeHeaderComponent(e,!0)]}}},u.prototype.makeHeaderComponent=function(e,t){var n="row"===e?"height":"width";return{labels:t,sizeSignal:this.child.component.layoutSize.get(n)?this.child.getSizeSignalRef(n):void 0,axes:[]}},u.prototype.mergeChildAxis=function(e){var t=this.child;if(t.component.axes[e]){var n=this.component,i=n.layoutHeaders,r=n.resolve;if(r.axis[e]=S.parseGuideResolve(r,e),"shared"===r.axis[e])for(var o="x"===e?"column":"row",a=i[o],s=0,l=t.component.axes[e];s<l.length;s++){var c=l[s],u=b.getHeaderType(c.get("orient"));a[u]=a[u]||[this.makeHeaderComponent(o,!1)];var f=v.assembleAxis(c,"main",this.config,{header:!0});a[u][0].axes.push(f),c.mainExtracted=!0}}},u.prototype.assembleSelectionTopLevelSignals=function(e){return this.child.assembleSelectionTopLevelSignals(e)},u.prototype.assembleSelectionSignals=function(){return this.child.assembleSelectionSignals(),[]},u.prototype.assembleSelectionData=function(e){return this.child.assembleSelectionData(e)},u.prototype.getLayoutBandMixins=function(e){for(var t={},n="header"===e?"headerBand":"footerBand",i=0,r=["row","column"];i<r.length;i++){var o=r[i],a=this.component.layoutHeaders[o][e];if(a&&a[0]){var s="row"===o?"height":"width";this.child.component.layoutSize.get(s)||(t[n]=t[n]||{},t[n][o]=.5)}}return t},u.prototype.assembleLayout=function(){var e=this.channelHasField("column")?this.columnDistinctSignal():1;return f({padding:{row:10,column:10}},this.getLayoutBandMixins("header"),this.getLayoutBandMixins("footer"),{offset:10,columns:e,bounds:"full",align:"all"})},u.prototype.assembleLayoutSignals=function(){return this.child.assembleLayoutSignals()},u.prototype.columnDistinctSignal=function(){if(!(this.parent&&this.parent instanceof u))return{signal:"length(data(\'"+this.getName("column_domain")+"\'))"}},u.prototype.assembleGroup=function(e){return this.parent&&this.parent instanceof u?f({},this.channelHasField("column")?{encode:{update:{columns:{field:p.vgField(this.facet.column,{prefix:"distinct"})}}}}:{},s.prototype.assembleGroup.call(this,e)):s.prototype.assembleGroup.call(this,e)},u.prototype.getCardinalityAggregateForChild=function(){var e=[],t=[];if(this.child instanceof u)this.child.channelHasField("column")&&(e.push(p.vgField(this.child.facet.column)),t.push("distinct"));else for(var n=0,i=["x","y"];n<i.length;n++){var r=i[n],o=this.child.component.scales[r];if(o&&!o.merged){var a=o.get("type"),s=o.get("range");if(m.hasDiscreteDomain(a)&&h.isVgRangeStep(s)){var l=E.assembleDomain(this.child,r),c=E.getFieldFromDomain(l);c?(e.push(c),t.push("distinct")):g.warn("Unknown field for ${channel}.  Cannot calculate view size.")}}}return e.length?{fields:e,ops:t}:void 0},u.prototype.assembleMarks=function(){var e=this.child,t=this.facet,n=this.component.data.facetRoot,i=y.assembleFacetData(n),r=this.channelHasField(d.ROW),o=this.channelHasField(d.COLUMN),a=e.assembleLayoutSize(),s={};r&&o&&(s.aggregate={cross:!0});var l=this.getCardinalityAggregateForChild();l&&(s.aggregate=f({},s.aggregate,l));var c=e.assembleTitle(),u=e.assembleGroupStyle();return[f({name:this.getName("cell"),type:"group"},c?{title:c}:{},u?{style:u}:{},{from:{facet:f({name:n.name,data:n.data,groupby:[].concat(r?[this.vgField(d.ROW)]:[],o?[this.vgField(d.COLUMN)]:[])},s)},sort:{field:[].concat(r?[this.vgField(d.ROW,{expr:"datum"})]:[],o?[this.vgField(d.COLUMN,{expr:"datum"})]:[]),order:[].concat(r?[t.row.sort||"ascending"]:[],o?[t.column.sort||"ascending"]:[])}},0<i.length?{data:i}:{},a?{encode:{update:a}}:{},e.assembleGroup())]},u.prototype.getMapping=function(){return this.facet},u}(s.ModelWithField);n.FacetModel=u},{"../channel":15,"../encoding":104,"../fielddef":106,"../log":110,"../scale":115,"../util":125,"../vega.schema":127,"./axis/assemble":16,"./buildmodel":23,"./data/assemble":28,"./data/parse":42,"./layout/header":48,"./layoutsize/parse":50,"./model":69,"./repeater":74,"./resolve":75,"./scale/domain":78}],47:[function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),f=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var d=e("../log"),p=e("../spec"),o=e("../util"),a=e("./axis/parse"),s=e("./data/parse"),l=e("./layoutsize/assemble"),g=e("./layoutsize/parse"),m=e("./legend/assemble"),c=e("./model"),h=e("./selection/selection"),v=e("./unit"),u=function(c){function u(e,t,n,i,r,o,a){var s=c.call(this,e,t,n,o,e.resolve)||this;s.type="layer";var l=f({},i,e.width?{width:e.width}:{},e.height?{height:e.height}:{});return s.initSize(l),s.children=e.layer.map(function(e,t){if(p.isLayerSpec(e))return new u(e,s,s.getName("layer_"+t),l,r,o,a);if(p.isUnitSpec(e))return new v.UnitModel(e,s,s.getName("layer_"+t),l,r,o,a);throw new Error(d.message.INVALID_SPEC)}),s}return r(u,c),u.prototype.parseData=function(){this.component.data=s.parseData(this);for(var e=0,t=this.children;e<t.length;e++){t[e].parseData()}},u.prototype.parseLayoutSize=function(){g.parseLayerLayoutSize(this)},u.prototype.parseSelection=function(){var n=this;this.component.selection={};for(var e=function(t){t.parseSelection(),o.keys(t.component.selection).forEach(function(e){n.component.selection[e]=t.component.selection[e]})},t=0,i=this.children;t<i.length;t++){e(i[t])}},u.prototype.parseMarkGroup=function(){for(var e=0,t=this.children;e<t.length;e++){t[e].parseMarkGroup()}},u.prototype.parseAxisAndHeader=function(){a.parseLayerAxis(this)},u.prototype.assembleSelectionTopLevelSignals=function(e){return this.children.reduce(function(e,t){return t.assembleSelectionTopLevelSignals(e)},e)},u.prototype.assembleSelectionSignals=function(){return this.children.reduce(function(e,t){return e.concat(t.assembleSelectionSignals())},[])},u.prototype.assembleLayoutSignals=function(){return this.children.reduce(function(e,t){return e.concat(t.assembleLayoutSignals())},l.assembleLayoutSignals(this))},u.prototype.assembleSelectionData=function(e){return this.children.reduce(function(e,t){return t.assembleSelectionData(e)},e)},u.prototype.assembleTitle=function(){var e=c.prototype.assembleTitle.call(this);if(e)return e;for(var t=0,n=this.children;t<n.length;t++){if(e=n[t].assembleTitle())return e}},u.prototype.assembleLayout=function(){return null},u.prototype.assembleMarks=function(){return h.assembleLayerSelectionMarks(this,o.flatten(this.children.map(function(e){return e.assembleMarks()})))},u.prototype.assembleLegends=function(){return this.children.reduce(function(e,t){return e.concat(t.assembleLegends())},m.assembleLegends(this))},u}(c.Model);n.LayerModel=u},{"../log":110,"../spec":118,"../util":125,"./axis/parse":20,"./data/parse":42,"./layoutsize/assemble":49,"./layoutsize/parse":50,"./legend/assemble":51,"./model":69,"./selection/selection":85,"./unit":96}],48:[function(e,t,u){"use strict";var h=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(u,"__esModule",{value:!0});var v=e("../../fielddef"),y=e("../../util"),b=e("../common");function O(e){return((e=(e%360+360)%360)+90)%180==0?{}:e<90||270<e?{align:{value:"right"}}:135<=e&&e<225?{align:{value:"left"}}:{}}function _(e){return 45<=(e=(e%360+360)%360)&&e<=135?{baseline:{value:"top"}}:{}}function f(e,t,n,i,r){if(r){var o=null,a=i.facetFieldDef;if(a&&r.labels){var s=a.header,l=void 0===s?{}:s,c=l.format,u=l.labelAngle,f=h({},void 0!==u?{angle:{value:u}}:{},O(u),_(u));o=h({text:b.formatSignalRef(a,c,"parent",e.config),offset:10,orient:"row"===t?"left":"top",style:"guide-label"},0<y.keys(f).length?{encode:{update:f}}:{})}var d=r.axes,p=d&&0<d.length;if(o||p){var g="row"===t?"height":"width";return h({name:e.getName(t+"_"+n),type:"group",role:t+"-"+n},i.facetFieldDef?{from:{data:e.getName(t+"_domain")},sort:{field:v.vgField(a,{expr:"datum"}),order:a.sort||"ascending"}}:{},o?{title:o}:{},r.sizeSignal?{encode:{update:(m={},m[g]=r.sizeSignal,m)}}:{},p?{axes:d}:{})}}return null;var m}u.HEADER_CHANNELS=["row","column"],u.HEADER_TYPES=["header","footer"],u.getHeaderType=function(e){return"top"===e||"left"===e?"header":"footer"},u.getTitleGroup=function(e,t){var n=e.component.layoutHeaders[t].title,i=h({align:{value:"center"},text:{value:n}},"vertical"===("row"===t?"vertical":void 0)?{angle:{value:270}}:{});return{name:e.getName(t+"_title"),role:t+"-title",type:"group",marks:[h({type:"text",role:t+"-title-text",style:"guide-title"},0<y.keys(i).length?{encode:{update:i}}:{})]}},u.getHeaderGroups=function(e,t){for(var n=e.component.layoutHeaders[t],i=[],r=0,o=u.HEADER_TYPES;r<o.length;r++){var a=o[r];if(n[a])for(var s=0,l=n[a];s<l.length;s++){var c=l[s];i.push(f(e,t,a,n,c))}}return i},u.labelAlign=O,u.labelBaseline=_},{"../../fielddef":106,"../../util":125,"../common":24}],49:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var c=e("../../scale"),u=e("../../vega.schema"),f=e("../model");function i(e,t){var n="width"===t?"x":"y",i=e.component.layoutSize.get(t);if(!i||"merged"===i)return[];var r=e.getSizeSignalRef(t).signal;if("range-step"===i){var o=e.getScaleComponent(n);if(o){var a=o.get("type"),s=o.get("range");if(c.hasDiscreteDomain(a)&&u.isVgRangeStep(s)){var l=e.scaleName(n);if(f.isFacetModel(e.parent))if("independent"===e.parent.component.resolve.scale[n])return[d(l,s)];return[d(l,s),{name:r,update:p(l,o,"domain(\'"+l+"\').length")}]}}throw new Error("layout size is range step although there is no rangeStep.")}return[{name:r,value:i}]}function d(e,t){return{name:e+"_step",value:t.step}}function p(e,t,n){var i=t.get("type"),r=t.get("padding"),o=t.get("paddingOuter");o=void 0!==o?o:r;var a=t.get("paddingInner");return"bandspace("+n+", "+(a="band"===i?void 0!==a?a:r:1)+", "+o+") * "+e+"_step"}n.assembleLayoutSignals=function(e){return[].concat(i(e,"width"),i(e,"height"))},n.sizeSignals=i,n.sizeExpr=p},{"../../scale":115,"../../vega.schema":127,"../model":69}],50:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var s=e("../../scale"),l=e("../../vega.schema"),d=e("../split");function i(e){r(e);var t=e.component.layoutSize;t.setWithExplicit("width",o(e,"width")),t.setWithExplicit("height",o(e,"height"))}function r(e){for(var t=0,n=e.children;t<n.length;t++){n[t].parseLayoutSize()}}function o(e,t){for(var n,i="width"===t?"x":"y",r=e.component.resolve,o=0,a=e.children;o<a.length;o++){var s=(f=a[o]).component.layoutSize.getWithExplicit(t),l=r.scale[i];if("independent"===l&&"range-step"===s.value){n=void 0;break}if(n){if("independent"===l&&n.value!==s.value){n=void 0;break}n=d.mergeValuesWithExplicit(n,s,t,"")}else n=s}if(n){for(var c=0,u=e.children;c<u.length;c++){var f=u[c];e.renameLayoutSize(f.getName(t),e.getName(t)),f.component.layoutSize.set(t,"merged",!1)}return n}return{explicit:!1,value:void 0}}function a(e,t){var n="width"===t?"x":"y",i=e.config,r=e.getScaleComponent(n);if(r){var o=r.get("type"),a=r.get("range");return s.hasDiscreteDomain(o)&&l.isVgRangeStep(a)?"range-step":i.view[t]}return"width"===t&&"text"===e.mark()?i.scale.textXRangeStep:i.scale.rangeStep||s.defaultScaleConfig.rangeStep}n.parseLayerLayoutSize=i,n.parseRepeatLayoutSize=i,n.parseConcatLayoutSize=function(e){r(e);var t=e.component.layoutSize,n=e.isVConcat?"width":"height";t.setWithExplicit(n,o(e,n))},n.parseChildrenLayoutSize=r,n.parseUnitLayoutSize=function(e){var t=e.component.layoutSize;if(!t.explicit.width){var n=a(e,"width");t.set("width",n,!1)}if(!t.explicit.height){var i=a(e,"height");t.set("height",i,!1)}}},{"../../scale":115,"../../vega.schema":127,"../split":95}],51:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var f=e("../../util"),d=e("./parse");n.assembleLegends=function(e){for(var t=e.component.legends,n={},i=0,r=f.keys(t);i<r.length;i++){var o=r[i],a=e.getScaleComponent(o),s=f.stringify(a.domains);if(n[s])for(var l=0,c=n[s];l<c.length;l++){var u=c[l];d.mergeLegendComponent(u,t[o])||n[s].push(t[o])}else n[s]=[t[o].clone()]}return f.flatten(f.vals(n)).map(function(e){return e.combine()})}},{"../../util":125,"./parse":54}],52:[function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(n,"__esModule",{value:!0});var o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(e("../split").Split);n.LegendComponent=o},{"../split":95}],53:[function(e,t,n){"use strict";var d=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var i=e("vega-util"),p=e("../../channel"),g=e("../../fielddef"),m=e("../../mark"),c=e("../../scale"),h=e("../../util"),v=e("../common"),y=e("../mark/mixins");function b(e){if(g.isValueDef(e)){if(g.hasConditionalValueDef(e)){var t=i.isArray(e.condition)?e.condition.map(function(e){return e.value}):[e.condition.value];return Math.max.apply(null,[e.value].concat(t))}return e.value}}n.symbols=function(e,t,n,i,r){if("gradient"!==r){var o={},a=n.mark();switch(a){case m.BAR:case m.TICK:case m.TEXT:o.shape={value:"square"};break;case m.CIRCLE:case m.SQUARE:o.shape={value:a};break;case m.POINT:case m.LINE:case m.GEOSHAPE:case m.AREA:}var s=n.markDef.filled,l=i===p.COLOR?h.without(m.FILL_STROKE_CONFIG,[s?"fill":"stroke","strokeDash","strokeDashOffset"]):m.FILL_STROKE_CONFIG;if(l=h.without(l,["strokeDash","strokeDashOffset"]),v.applyMarkConfig(o,n,l),i!==p.COLOR){var c=y.color(n);c.fill&&(c.fill.field||"transparent"===c.fill.value)&&delete c.fill,c.stroke&&(c.stroke.field||"transparent"===c.stroke.value)&&delete c.stroke,o=d({},o,c)}if(i!==p.SHAPE){var u=n.encoding.shape;g.isValueDef(u)&&(o.shape={value:u.value})}if(i!==p.OPACITY){var f=b(n.encoding.opacity)||n.markDef.opacity;f&&(o.opacity={value:f})}return o=d({},o,t),0<h.keys(o).length?o:void 0}},n.gradient=function(e,t,n,i,r){var o={};if("gradient"===r){var a=b(n.encoding.opacity)||n.markDef.opacity;a&&(o.opacity={value:a})}return o=d({},o,t),0<h.keys(o).length?o:void 0},n.labels=function(e,t,n,i,r){var o=n.legend(i),a=n.config,s={};if(g.isTimeFieldDef(e)){var l=n.getScaleComponent(i).get("type")===c.ScaleType.UTC;t=d({text:{signal:v.timeFormatExpression("datum.value",e.timeUnit,o.format,a.legend.shortTimeLabels,a.timeFormat,l)}},t)}return s=d({},s,t),0<h.keys(s).length?s:void 0}},{"../../channel":15,"../../fielddef":106,"../../mark":112,"../../scale":115,"../../util":125,"../common":24,"../mark/mixins":62,"vega-util":10}],54:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var c=e("../../channel"),u=e("../../fielddef"),f=e("../../legend"),o=e("../../type"),d=e("../../util"),p=e("../common"),a=e("../model"),l=e("../resolve"),g=e("../split"),m=e("../split"),h=e("./component"),v=e("./encode"),y=e("./properties");function b(e){var i,r;a.isUnitModel(e)?e.component.legends=(r=(i=e).encoding,[c.COLOR,c.FILL,c.STROKE,c.SIZE,c.SHAPE,c.OPACITY].reduce(function(e,t){var n=r[t];return!i.legend(t)||!i.getScaleComponent(t)||u.isFieldDef(n)&&t===c.SHAPE&&n.type===o.GEOJSON||(e[t]=s(i,t)),e},{})):e.component.legends=function(r){for(var e=r.component,n=e.legends,o=e.resolve,t=function(t){b(t),d.keys(t.component.legends).forEach(function(e){o.legend[e]=l.parseGuideResolve(r.component.resolve,e),"shared"===o.legend[e]&&(n[e]=O(n[e],t.component.legends[e]),n[e]||(o.legend[e]="independent",delete n[e]))})},i=0,a=r.children;i<a.length;i++){var s=a[i];t(s)}return d.keys(n).forEach(function(e){for(var t=0,n=r.children;t<n.length;t++){var i=n[t];i.component.legends[e]&&"shared"===o.legend[e]&&delete i.component.legends[e]}}),n}(e)}function s(i,r){var o=i.fieldDef(r),a=i.legend(r),s=new h.LegendComponent({},function(e,t){switch(t){case c.COLOR:var n=e.scaleName(c.COLOR);return e.markDef.filled?{fill:n}:{stroke:n};case c.FILL:case c.STROKE:case c.SIZE:case c.SHAPE:case c.OPACITY:return(i={})[t]=e.scaleName(t),i}var i}(i,r));f.LEGEND_PROPERTIES.forEach(function(e){var t=function(e,t,n,i){var r=i.fieldDef(n);switch(e){case"format":return p.numberFormat(r,t.format,i.config);case"title":return p.getSpecifiedOrDefaultValue(t.title||(void 0===t.title?void 0:null),u.title(r,i.config))||void 0;case"values":return y.values(t);case"type":return p.getSpecifiedOrDefaultValue(t.type,y.type(r.type,n,i.getScaleComponent(n).get("type")))}return t[e]}(e,a,r,i);if(void 0!==t){var n="values"===e?!!a.values:t===a[e];(n||void 0===i.config.legend[e])&&s.set(e,t,n)}});var l=a.encoding||{},e=["labels","legend","title","symbols","gradient"].reduce(function(e,t){var n=v[t]?v[t](o,l[t],i,r,s.get("type")):l[t];return void 0!==n&&0<d.keys(n).length&&(e[t]={update:n}),e},{});return 0<d.keys(e).length&&s.set("encode",e,!!a.encoding),s}function O(t,i){if(!t)return i.clone();var e=t.getWithExplicit("orient"),n=i.getWithExplicit("orient");if(!e.explicit||!n.explicit||e.value===n.value){for(var r=!1,o=function(n){var e=m.mergeValuesWithExplicit(t.getWithExplicit(n),i.getWithExplicit(n),n,"legend",function(e,t){switch(n){case"title":return p.titleMerger(e,t);case"type":return r=!0,g.makeImplicit("symbol")}return m.defaultTieBreaker(e,t,n,"legend")});t.setWithExplicit(n,e)},a=0,s=f.VG_LEGEND_PROPERTIES;a<s.length;a++){o(s[a])}return r&&(((t.implicit||{}).encode||{}).gradient&&d.deleteNestedProperty(t.implicit,["encode","gradient"]),((t.explicit||{}).encode||{}).gradient&&d.deleteNestedProperty(t.explicit,["encode","gradient"])),t}}n.parseLegend=b,n.parseLegendForChannel=s,n.mergeLegendComponent=O},{"../../channel":15,"../../fielddef":106,"../../legend":109,"../../type":124,"../../util":125,"../common":24,"../model":69,"../resolve":75,"../split":95,"./component":52,"./encode":53,"./properties":55}],55:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=e("../../channel"),r=e("../../datetime"),o=e("../../scale"),a=e("../../util");n.values=function(e){var t=e.values;return t&&r.isDateTime(t[0])?t.map(function(e){return{signal:r.dateTimeExpr(e,!0)}}):t},n.type=function(e,t,n){if(i.isColorChannel(t)&&("quantitative"===e&&!o.isBinScale(n)||"temporal"===e&&a.contains(["time","utc"],n)))return"gradient"}},{"../../channel":15,"../../datetime":103,"../../scale":115,"../../util":125}],56:[function(e,t,n){"use strict";var i=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var r=e("./mixins");n.area={vgMark:"area",encodeEntry:function(e){return i({},r.baseEncodeEntry(e,{size:"ignore",orient:"include"}),r.pointPosition("x",e,"zeroOrMin"),r.pointPosition("y",e,"zeroOrMin"),r.pointPosition2(e,"zeroOrMin"))}}},{"./mixins":62}],57:[function(e,t,n){"use strict";var f=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var a=e("vega-util"),d=e("../../channel"),p=e("../../fielddef"),s=e("../../log"),g=e("../../scale"),l=e("../../vega.schema"),m=e("./mixins"),h=e("./valueref");function v(e,t,n,i){if(void 0!==e.size)return{value:e.size};if(i.bar.discreteBandSize)return{value:i.bar.discreteBandSize};if(n){var r=n.get("type");if(r!==g.ScaleType.POINT)return r===g.ScaleType.BAND?h.bandRef(t):{value:i.bar.continuousBandSize};var o=n.get("range");if(l.isVgRangeStep(o)&&a.isNumber(o.step))return{value:o.step-1};s.warn(s.message.BAR_WITH_POINT_SCALE_AND_RANGESTEP_NULL)}else if(i.scale.rangeStep&&null!==i.scale.rangeStep)return{value:i.scale.rangeStep-1};return{value:20}}n.bar={vgMark:"rect",encodeEntry:function(e){return f({},m.baseEncodeEntry(e,{size:"ignore",orient:"ignore"}),function(e){var t=e.config,n=e.encoding,i=e.markDef,r=e.width,o=i.orient,a=n.size,s=n.x,l=e.scaleName(d.X),c=e.getScaleComponent(d.X);{if("horizontal"===o)return f({},m.pointPosition("x",e,"zeroOrMin"),m.pointPosition2(e,"zeroOrMin"));if(p.isFieldDef(s)){var u=c.get("type");if(s.bin&&!a&&!g.hasDiscreteDomain(u))return m.binnedPosition(s,"x",e.scaleName("x"),t.bar.binSpacing,c.get("reverse"));if(u===g.ScaleType.BAND)return m.bandPosition(s,"x",e)}return m.centeredBandPosition("x",e,f({},h.mid(r)),v(i,l,c,t))}}(e),function(e){var t=e.config,n=e.encoding,i=e.height,r=e.markDef,o=r.orient,a=n.size,s=n.y,l=e.scaleName(d.Y),c=e.getScaleComponent(d.Y);{if("vertical"===o)return f({},m.pointPosition("y",e,"zeroOrMin"),m.pointPosition2(e,"zeroOrMin"));if(p.isFieldDef(s)){var u=c.get("type");if(s.bin&&!a&&!g.hasDiscreteDomain(u))return m.binnedPosition(s,"y",e.scaleName("y"),t.bar.binSpacing,c.get("reverse"));if(u===g.ScaleType.BAND)return m.bandPosition(s,"y",e)}return m.centeredBandPosition("y",e,h.mid(i),v(r,l,c,t))}}(e))}}},{"../../channel":15,"../../fielddef":106,"../../log":110,"../../scale":115,"../../vega.schema":127,"./mixins":62,"./valueref":68,"vega-util":10}],58:[function(e,t,n){"use strict";var i=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var r=e("./mixins"),o=e("../../fielddef"),a=e("../../type");n.geoshape={vgMark:"shape",encodeEntry:function(e){return i({},r.baseEncodeEntry(e,{size:"ignore",orient:"ignore"}))},postEncodingTransform:function(e){var t=e.encoding.shape;return[i({type:"geoshape",projection:e.projectionName()},t&&o.isFieldDef(t)&&t.type===a.GEOJSON?{field:o.vgField(t,{expr:"datum"})}:{})]}}},{"../../fielddef":106,"../../type":124,"./mixins":62}],59:[function(e,t,n){"use strict";var c=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var u=e("../../encoding"),f=e("../../fielddef"),d=e("../../log"),p=e("../../mark"),g=e("../../type"),m=e("../../util"),h=e("../common");n.normalizeMarkDef=function(e,t,n){var i,r,o,a,s=p.isMarkDef(e)?c({},e):{type:e},l=s.orient||h.getMarkConfig("orient",s,n);return s.orient=function(e,t,n){switch(e){case p.POINT:case p.CIRCLE:case p.SQUARE:case p.TEXT:case p.RECT:return}var i=t.y2,r=t.x2;switch(e){case p.RULE:if(r&&i)return;case p.BAR:case p.AREA:if(i)return"vertical";if(r)return"horizontal";if(e===p.RULE){if(t.x&&!t.y)return"vertical";if(t.y&&!t.x)return"horizontal"}case p.LINE:case p.TICK:var o=f.isFieldDef(t.x)&&f.isContinuous(t.x),a=f.isFieldDef(t.y)&&f.isContinuous(t.y);if(o&&!a)return"tick"!==e?"horizontal":"vertical";if(!o&&a)return"tick"!==e?"vertical":"horizontal";if(o&&a){var s=t.x,l=t.y,c=s.type===g.TEMPORAL,u=l.type===g.TEMPORAL;return c&&!u?"tick"!==e?"vertical":"horizontal":!c&&u?"tick"!==e?"horizontal":"vertical":!s.aggregate&&l.aggregate?"tick"!==e?"vertical":"horizontal":s.aggregate&&!l.aggregate?"tick"!==e?"horizontal":"vertical":n||(e===p.LINE&&t.order||d.warn(d.message.unclearOrientContinuous(e)),"vertical")}return void d.warn(d.message.unclearOrientDiscreteOrEmpty(e))}return"vertical"}(s.type,t,l),void 0!==l&&l!==s.orient&&d.warn(d.message.orientOverridden(s.orient,l)),void 0===(s.opacity||h.getMarkConfig("opacity",s,n))&&(s.opacity=function(e,t){if(m.contains([p.POINT,p.TICK,p.CIRCLE,p.SQUARE],e)&&!u.isAggregate(t))return.7}(s.type,t)),void 0===s.filled&&(s.filled=(i=s,r=n,o=h.getMarkConfig("filled",i,r),a=i.type,void 0!==o?o:a!==p.POINT&&a!==p.LINE&&a!==p.RULE)),s}},{"../../encoding":104,"../../fielddef":106,"../../log":110,"../../mark":112,"../../type":124,"../../util":125,"../common":24}],60:[function(e,t,n){"use strict";var i=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var r=e("./mixins"),o=e("./valueref");n.line={vgMark:"line",encodeEntry:function(e){var t=e.width,n=e.height;return i({},r.baseEncodeEntry(e,{size:"ignore",orient:"ignore"}),r.pointPosition("x",e,o.mid(t)),r.pointPosition("y",e,o.mid(n)),r.nonPosition("size",e,{vgChannel:"strokeWidth"}))}}},{"./mixins":62,"./valueref":68}],61:[function(e,t,n){"use strict";var f=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var o=e("vega-util"),d=e("../../data"),r=e("../../encoding"),a=e("../../fielddef"),s=e("../../mark"),l=e("../../sort"),c=e("../../util"),p=e("../common"),i=e("./area"),u=e("./bar"),g=e("./geoshape"),m=e("./line"),h=e("./point"),v=e("./rect"),y=e("./rule"),b=e("./text"),O=e("./tick"),_={area:i.area,bar:u.bar,line:m.line,point:h.point,text:b.text,tick:O.tick,rect:v.rect,rule:y.rule,circle:h.circle,square:h.square,geoshape:g.geoshape};n.parseMarkGroup=function(e){return c.contains([s.LINE,s.AREA],e.mark())?(n=w((t=e).encoding),i=x(t,{fromPrefix:0<n.length?S:""}),0<n.length?[{name:t.getName("pathgroup"),type:"group",from:{facet:{name:S+t.requestDataName(d.MAIN),data:t.requestDataName(d.MAIN),groupby:n}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:i}]:i):x(e);var t,n,i};var S="faceted_path_";function E(e){if(e.channelHasField("order")&&!e.stack)return p.sortParams(e.encoding.order,{expr:"datum"});if(c.contains(["line","area"],e.mark())){var t="horizontal"===e.markDef.orient?"y":"x",n=e.sort(t),i=l.isSortField(n)?a.vgField({aggregate:r.isAggregate(e.encoding)?n.op:void 0,field:n.field},{expr:"datum"}):e.vgField(t,{binSuffix:e.stack&&e.stack.impute?"mid":void 0,expr:"datum"});return i?{field:i,order:"descending"}:void 0}}function x(e,t){void 0===t&&(t={fromPrefix:""});var n,i,r,o=e.mark(),a=void 0!==e.markDef.clip?!!e.markDef.clip:(i=(n=e).getScaleComponent("x"),r=n.getScaleComponent("y"),!!(i&&i.get("domainRaw")||r&&r.get("domainRaw"))),s=p.getStyles(e.markDef),l=e.encoding.key,c=E(e),u=_[o].postEncodingTransform?_[o].postEncodingTransform(e):null;return[f({name:e.getName("marks"),type:_[o].vgMark},a?{clip:!0}:{},s?{style:s}:{},l?{key:{field:l.field}}:{},c?{sort:c}:{},{from:{data:t.fromPrefix+e.requestDataName(d.MAIN)},encode:{update:_[o].encodeEntry(e)}},u?{transform:u}:{})]}function w(r){return c.keys(r).reduce(function(t,e){switch(e){case"x":case"y":case"order":case"tooltip":case"href":case"x2":case"y2":case"latitude":case"longitude":case"latitude2":case"longitude2":case"text":case"shape":return t;case"detail":case"key":var n=r[e];return n&&(o.isArray(n)?n:[n]).forEach(function(e){e.aggregate||t.push(a.vgField(e,{}))}),t;case"color":case"fill":case"stroke":case"size":case"opacity":var i=a.getFieldDef(r[e]);return i&&!i.aggregate&&t.push(a.vgField(i,{})),t;default:throw new Error("Bug: Channel "+e+" unimplemented for line mark")}},[])}n.getSort=E,n.pathGroupingFields=w},{"../../data":102,"../../encoding":104,"../../fielddef":106,"../../mark":112,"../../sort":117,"../../util":125,"../common":24,"./area":56,"./bar":57,"./geoshape":58,"./line":60,"./point":63,"./rect":64,"./rule":65,"./text":66,"./tick":67,"vega-util":10}],62:[function(e,t,n){"use strict";var c=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var u=e("vega-util"),f=e("../../fielddef"),d=e("../../log"),p=e("../../predicate"),a=e("../../util"),r=e("../../vega.schema"),s=e("../common"),g=e("../selection/selection"),m=e("./valueref");function o(e){var t=e.config,n=e.markDef,i=n.filled,r=n.type,o=i?"fill":"stroke";return c({},a.contains(["bar","point","circle","square","geoshape"],r)?{fill:{value:"transparent"}}:{},h("color",e,{vgChannel:o,defaultValue:e.markDef[o]||e.markDef.color||s.getMarkConfig(o,e.markDef,t)||s.getMarkConfig("color",e.markDef,t)}),h("fill",e),h("stroke",e))}function h(t,n,e){void 0===e&&(e={});var i=e.defaultValue,r=e.vgChannel,o=e.defaultRef||(void 0!==i?{value:i}:void 0),a=n.encoding[t];return l(n,a,r||t,function(e){return m.midPoint(t,e,n.scaleName(t),n.getScaleComponent(t),null,o)})}function l(i,e,t,r){var n,o,a=e&&e.condition,s=r(e);if(a){var l=(u.isArray(a)?a:[a]).map(function(e){var t=r(e),n=f.isConditionalSelection(e)?g.selectionPredicate(i,e.selection):p.expression(i,e.test);return c({test:n},t)});return(n={})[t]=l.concat(void 0!==s?[s]:[]),n}return void 0!==s?((o={})[t]=s,o):{}}function v(t,e){void 0===e&&(e="text");var n=t.encoding[e];return l(t,n,e,function(e){return m.text(e,t.config)})}function y(e,t,n,i){var r,o=t.encoding,a=t.stack,s=o[e]||!o.latitude&&!o.longitude?m.stackable(e,o[e],t.scaleName(e),t.getScaleComponent(e),a,n):{field:t.getName(e)};return(r={})[i||e]=s,r}n.color=o,n.baseEncodeEntry=function(e,t){return c({},(n=e.markDef,i=t,r.VG_MARK_CONFIGS.reduce(function(e,t){return void 0!==n[t]&&"ignore"!==i[t]&&(e[t]={value:n[t]}),e},{})),o(e),h("opacity",e),v(e,"tooltip"),v(e,"href"));var n,i},n.valueIfDefined=function(e,t){if(void 0!==t)return(n={})[e]={value:t},n;var n},n.nonPosition=h,n.text=v,n.bandPosition=function(e,t,n){var i,r,o,a=n.scaleName(t),s="x"===t?"width":"height";if(n.encoding.size||void 0!==n.markDef.size)if(n.markDef.orient){var l=((i={})[t+"c"]=m.fieldRef(e,a,{},{band:.5}),i);if(f.getFieldDef(n.encoding.size))d.warn(d.message.cannotUseSizeFieldWithBandSize(t));else{if(f.isValueDef(n.encoding.size))return c({},l,h("size",n,{vgChannel:s}));if(void 0!==n.markDef.size)return c({},l,((r={})[s]={value:n.markDef.size},r))}}else d.warn(d.message.cannotApplySizeToNonOrientedMark(n.markDef.type));return(o={})[t]=m.fieldRef(e,a,{binSuffix:"range"}),o[s]=m.bandRef(a),o},n.centeredBandPosition=function(e,t,n,i){var r="x"===e?"width":"height";return c({},y(e,t,n,"x"===e?"xc":"yc"),h("size",t,{defaultRef:i,vgChannel:r}))},n.binnedPosition=function(e,t,n,i,r){return"x"===t?{x2:m.bin(e,n,"start",r?0:i),x:m.bin(e,n,"end",r?i:0)}:{y2:m.bin(e,n,"start",r?i:0),y:m.bin(e,n,"end",r?0:i)}},n.pointPosition=y,n.pointPosition2=function(e,t,n){var i,r=e.encoding,o=e.markDef,a=e.stack,s="x2"===(n=n||("horizontal"===o.orient?"x2":"y2"))?"x":"y",l=r[s],c=l||!r.latitude&&!r.longitude?m.stackable2(n,l,r[n],e.scaleName(s),e.getScaleComponent(s),a,t):{field:e.getName(n)};return(i={})[n]=c,i}},{"../../fielddef":106,"../../log":110,"../../predicate":113,"../../util":125,"../../vega.schema":127,"../common":24,"../selection/selection":85,"./valueref":68,"vega-util":10}],63:[function(e,t,n){"use strict";var o=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var i=e("../common"),a=e("./mixins"),s=e("./valueref");function r(e,t){var n=e.config,i=e.width,r=e.height;return o({},a.baseEncodeEntry(e,{size:"include",orient:"ignore"}),a.pointPosition("x",e,s.mid(i)),a.pointPosition("y",e,s.mid(r)),a.nonPosition("size",e),l(e,n,t))}function l(e,t,n){return n?{shape:{value:n}}:a.nonPosition("shape",e,{defaultValue:i.getMarkConfig("shape",e.markDef,t)})}n.shapeMixins=l,n.point={vgMark:"symbol",encodeEntry:function(e){return r(e)}},n.circle={vgMark:"symbol",encodeEntry:function(e){return r(e,"circle")}},n.square={vgMark:"symbol",encodeEntry:function(e){return r(e,"square")}}},{"../common":24,"./mixins":62,"./valueref":68}],64:[function(e,t,n){"use strict";var o=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var a=e("../../channel"),s=e("../../fielddef"),l=e("../../log"),c=e("../../mark"),u=e("../../scale"),f=e("./mixins");n.rect={vgMark:"rect",encodeEntry:function(e){return o({},f.baseEncodeEntry(e,{size:"ignore",orient:"ignore"}),function(e){var t=e.encoding.x,n=e.encoding.x2,i=e.getScaleComponent(a.X),r=i?i.get("type"):void 0;{if(s.isFieldDef(t)&&t.bin&&!n)return f.binnedPosition(t,"x",e.scaleName("x"),0,i.get("reverse"));if(s.isFieldDef(t)&&i&&u.hasDiscreteDomain(r)){if(r===u.ScaleType.BAND)return f.bandPosition(t,"x",e);throw new Error(l.message.scaleTypeNotWorkWithMark(c.RECT,r))}return o({},f.pointPosition("x",e,"zeroOrMax"),f.pointPosition2(e,"zeroOrMin","x2"))}}(e),function(e){var t=e.encoding.y,n=e.encoding.y2,i=e.getScaleComponent(a.Y),r=i?i.get("type"):void 0;{if(s.isFieldDef(t)&&t.bin&&!n)return f.binnedPosition(t,"y",e.scaleName("y"),0,i.get("reverse"));if(s.isFieldDef(t)&&i&&u.hasDiscreteDomain(r)){if(r===u.ScaleType.BAND)return f.bandPosition(t,"y",e);throw new Error(l.message.scaleTypeNotWorkWithMark(c.RECT,r))}return o({},f.pointPosition("y",e,"zeroOrMax"),f.pointPosition2(e,"zeroOrMin","y2"))}}(e))}}},{"../../channel":15,"../../fielddef":106,"../../log":110,"../../mark":112,"../../scale":115,"./mixins":62}],65:[function(e,t,n){"use strict";var o=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var a=e("./mixins"),s=e("./valueref");n.rule={vgMark:"rule",encodeEntry:function(e){e.config;var t=e.markDef,n=e.width,i=e.height,r=t.orient;return e.encoding.x||e.encoding.y||e.encoding.latitude||e.encoding.longitude?o({},a.baseEncodeEntry(e,{size:"ignore",orient:"ignore"}),a.pointPosition("x",e,"horizontal"===r?"zeroOrMin":s.mid(n)),a.pointPosition("y",e,"vertical"===r?"zeroOrMin":s.mid(i)),"vertical"!==r?a.pointPosition2(e,"zeroOrMax","x2"):{},"horizontal"!==r?a.pointPosition2(e,"zeroOrMax","y2"):{},a.nonPosition("size",e,{vgChannel:"strokeWidth"})):{}}}},{"./mixins":62,"./valueref":68}],66:[function(e,t,n){"use strict";var a=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var s=e("../../channel"),l=e("../../encoding"),c=e("../../fielddef"),u=e("../../type"),f=e("../common"),d=e("./mixins"),p=e("./valueref");n.text={vgMark:"text",encodeEntry:function(e){var t=e.config,n=e.encoding,i=e.height,r=e.markDef,o=n.text;return a({},d.baseEncodeEntry(e,{size:"ignore",orient:"ignore"}),d.pointPosition("x",e,function(e,t){if(c.isFieldDef(t)&&t.type===u.QUANTITATIVE)return{field:{group:"width"},offset:-5};return{value:e.scale.textXRangeStep/2}}(t,o)),d.pointPosition("y",e,p.mid(i)),d.text(e),d.nonPosition("size",e,a({},r.size?{defaultValue:r.size}:{},{vgChannel:"fontSize"})),d.valueIfDefined("align",function(e,t,n){if(void 0===(e.align||f.getMarkConfig("align",e,n)))return l.channelHasField(t,s.X)||l.channelHasField(t,s.LONGITUDE)?"center":"right";return}(e.markDef,n,t)))}}},{"../../channel":15,"../../encoding":104,"../../fielddef":106,"../../type":124,"../common":24,"./mixins":62,"./valueref":68}],67:[function(e,t,n){"use strict";var c=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var u=e("../../vega.schema"),f=e("./mixins"),d=e("./valueref");n.tick={vgMark:"rect",encodeEntry:function(e){var t,n=e.config,i=e.markDef,r=e.width,o=e.height,a=i.orient,s="horizontal"===a?"width":"height",l="horizontal"===a?"height":"width";return c({},f.baseEncodeEntry(e,{size:"ignore",orient:"ignore"}),f.pointPosition("x",e,d.mid(r),"xc"),f.pointPosition("y",e,d.mid(o),"yc"),f.nonPosition("size",e,{defaultValue:function(e){var t=e.config,n=e.markDef,i=n.orient,r=e.getScaleComponent("horizontal"===i?"x":"y");{if(void 0!==n.size)return n.size;if(void 0!==t.tick.bandSize)return t.tick.bandSize;var o=r?r.get("range"):void 0,a=o&&u.isVgRangeStep(o)?o.step:t.scale.rangeStep;if("number"!=typeof a)throw new Error("Function does not handle non-numeric rangeStep");return a/1.5}}(e),vgChannel:s}),((t={})[l]={value:n.tick.thickness},t))}}},{"../../vega.schema":127,"./mixins":62,"./valueref":68}],68:[function(e,t,n){"use strict";var o=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var c=e("../../channel"),u=e("../../fielddef"),f=e("../../scale"),d=e("../../type"),p=e("../../util"),g=e("../common");function m(e,t,n,i){var r=o({},t?{scale:t}:{},{field:u.vgField(e,n)});return i?o({},r,i):r}function s(e,t,n,i,r,o){if(t){if(u.isFieldDef(t)){if(t.bin)return p.contains([c.X,c.Y],e)&&t.type===d.QUANTITATIVE?r&&r.impute?m(t,n,{binSuffix:"mid"}):(s=t,{signal:\'(scale("\'+(l=n)+\'", \'+u.vgField(s,{expr:"datum"})+\') + scale("\'+l+\'", \'+u.vgField(s,{binSuffix:"end",expr:"datum"})+"))/2"}):m(t,n,g.binRequiresRange(t,e)?{binSuffix:"range"}:{});if(i){var a=i.get("type");if(f.hasDiscreteDomain(a))return"band"===a?m(t,n,{binSuffix:"range"},{band:.5}):m(t,n,{binSuffix:"range"})}return m(t,n,{})}if(u.isValueDef(t))return{value:t.value}}var s,l;if("zeroOrMin"===o){if(e===c.X||e===c.X2)return function(e,t){if(e&&!p.contains([f.ScaleType.LOG,f.ScaleType.TIME,f.ScaleType.UTC],t.get("type"))&&!1!==t.get("zero"))return{scale:e,value:0};return{value:0}}(n,i);if(e===c.Y||e===c.Y2)return function(e,t){if(e&&!p.contains([f.ScaleType.LOG,f.ScaleType.TIME,f.ScaleType.UTC],t.get("type"))&&!1!==t.get("zero"))return{scale:e,value:0};return{field:{group:"height"}}}(n,i);throw new Error("Unsupported channel "+e+" for base function")}if("zeroOrMax"===o){if(e===c.X||e===c.X2)return function(e,t){if(e&&!p.contains([f.ScaleType.LOG,f.ScaleType.TIME,f.ScaleType.UTC],t.get("type"))&&!1!==t.get("zero"))return{scale:e,value:0};return{field:{group:"width"}}}(n,i);if(e===c.Y||e===c.Y2)return function(e,t){if(e&&!p.contains([f.ScaleType.LOG,f.ScaleType.TIME,f.ScaleType.UTC],t.get("type"))&&!1!==t.get("zero"))return{scale:e,value:0};return{value:0}}(n,i);throw new Error("Unsupported channel "+e+" for base function")}return o}n.stackable=function(e,t,n,i,r,o){return u.isFieldDef(t)&&r&&e===r.fieldChannel?m(t,n,{suffix:"end"}):s(e,t,n,i,r,o)},n.stackable2=function(e,t,n,i,r,o,a){return u.isFieldDef(t)&&o&&e.charAt(0)===o.fieldChannel.charAt(0)?m(t,i,{suffix:"start"}):s(e,n,i,r,o,a)},n.bin=function(e,t,n,i){return m(e,t,{binSuffix:"start"===n?void 0:"end"},i?{offset:i}:{})},n.fieldRef=m,n.bandRef=function(e,t){return void 0===t&&(t=!0),{scale:e,band:t}},n.midPoint=s,n.text=function(e,t){if(e){if(u.isFieldDef(e))return g.formatSignalRef(e,e.format,"datum",t);if(u.isValueDef(e))return{value:e.value}}},n.mid=function(e){return o({},e,{mult:.5})}},{"../../channel":15,"../../fielddef":106,"../../scale":115,"../../type":124,"../../util":125,"../common":24}],69:[function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),a=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var s=e("vega-util"),o=e("../channel"),l=e("../encoding"),c=e("../fielddef"),u=e("../log"),f=e("../scale"),d=e("../spec"),p=e("../title"),g=e("../transform"),m=e("../util"),h=e("../vega.schema"),v=e("./axis/assemble"),y=e("./layout/header"),b=e("./layoutsize/assemble"),O=e("./legend/assemble"),_=e("./legend/parse"),S=e("./projection/assemble"),E=e("./projection/parse"),x=e("./scale/assemble"),w=e("./scale/domain"),N=e("./scale/parse"),T=e("./split"),P=function(){function e(){this.nameMap={}}return e.prototype.rename=function(e,t){this.nameMap[e]=t},e.prototype.has=function(e){return void 0!==this.nameMap[e]},e.prototype.get=function(e){for(;this.nameMap[e]&&e!==this.nameMap[e];)e=this.nameMap[e];return e},e}();function D(e){return e&&"unit"===e.type}function k(e){return e&&"facet"===e.type}n.NameMap=P,n.isUnitModel=D,n.isFacetModel=k,n.isRepeatModel=function(e){return e&&"repeat"===e.type},n.isConcatModel=function(e){return e&&"concat"===e.type},n.isLayerModel=function(e){return e&&"layer"===e.type};var j=function(){function e(e,t,n,i,r){var o=this;this.children=[],this.correctDataNames=function(e){return e.from&&e.from.data&&(e.from.data=o.lookupDataSource(e.from.data)),e.from&&e.from.facet&&e.from.facet.data&&(e.from.facet.data=o.lookupDataSource(e.from.facet.data)),e},this.parent=t,this.config=i,this.name=e.name||n,this.title=s.isString(e.title)?{text:e.title}:e.title,this.scaleNameMap=t?t.scaleNameMap:new P,this.projectionNameMap=t?t.projectionNameMap:new P,this.layoutSizeNameMap=t?t.layoutSizeNameMap:new P,this.data=e.data,this.description=e.description,this.transforms=g.normalizeTransform(e.transform||[]),this.component={data:{sources:t?t.component.data.sources:{},outputNodes:t?t.component.data.outputNodes:{},outputNodeRefCounts:t?t.component.data.outputNodeRefCounts:{},ancestorParse:t?a({},t.component.data.ancestorParse):{},isFaceted:d.isFacetSpec(e)||t&&t.component.data.isFaceted&&!e.data},layoutSize:new T.Split,layoutHeaders:{row:{},column:{}},mark:null,resolve:a({scale:{},axis:{},legend:{}},r||{}),selection:null,scales:null,projection:null,axes:{},legends:{}}}return Object.defineProperty(e.prototype,"width",{get:function(){return this.getSizeSignalRef("width")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.getSizeSignalRef("height")},enumerable:!0,configurable:!0}),e.prototype.initSize=function(e){var t=e.width,n=e.height;t&&this.component.layoutSize.set("width",t,!0),n&&this.component.layoutSize.set("height",n,!0)},e.prototype.parse=function(){this.parseScale(),this.parseLayoutSize(),this.renameTopLevelLayoutSize(),this.parseSelection(),this.parseProjection(),this.parseData(),this.parseAxisAndHeader(),this.parseLegend(),this.parseMarkGroup()},e.prototype.parseScale=function(){N.parseScale(this)},e.prototype.parseProjection=function(){E.parseProjection(this)},e.prototype.renameTopLevelLayoutSize=function(){"width"!==this.getName("width")&&this.renameLayoutSize(this.getName("width"),"width"),"height"!==this.getName("height")&&this.renameLayoutSize(this.getName("height"),"height")},e.prototype.parseLegend=function(){_.parseLegend(this)},e.prototype.assembleGroupStyle=function(){if("unit"===this.type||"layer"===this.type)return"cell"},e.prototype.assembleLayoutSize=function(){if("unit"===this.type||"layer"===this.type)return{width:this.getSizeSignalRef("width"),height:this.getSizeSignalRef("height")}},e.prototype.assembleHeaderMarks=function(){for(var e=this.component.layoutHeaders,t=[],n=0,i=y.HEADER_CHANNELS;n<i.length;n++){e[a=i[n]].title&&t.push(y.getTitleGroup(this,a))}for(var r=0,o=y.HEADER_CHANNELS;r<o.length;r++){var a=o[r];t=t.concat(y.getHeaderGroups(this,a))}return t},e.prototype.assembleAxes=function(){return v.assembleAxes(this.component.axes,this.config)},e.prototype.assembleLegends=function(){return O.assembleLegends(this)},e.prototype.assembleProjections=function(){return S.assembleProjections(this)},e.prototype.assembleTitle=function(){var e=a({},p.extractTitleConfig(this.config.title).nonMark,this.title);if(e.text)return m.contains(["unit","layer"],this.type)||(e.anchor&&"start"!==e.anchor&&u.warn(u.message.cannotSetTitleAnchor(this.type)),e.anchor="start"),0<m.keys(e).length?e:void 0},e.prototype.assembleGroup=function(e){void 0===e&&(e=[]);var t={};0<(e=e.concat(this.assembleSelectionSignals())).length&&(t.signals=e);var n=this.assembleLayout();n&&(t.layout=n),t.marks=[].concat(this.assembleHeaderMarks(),this.assembleMarks());var i=!this.parent||k(this.parent)?x.assembleScales(this):[];0<i.length&&(t.scales=i);var r=this.assembleAxes();0<r.length&&(t.axes=r);var o=this.assembleLegends();return 0<o.length&&(t.legends=o),t},e.prototype.hasDescendantWithFieldOnChannel=function(e){for(var t=0,n=this.children;t<n.length;t++){var i=n[t];if(D(i)){if(i.channelHasField(e))return!0}else if(i.hasDescendantWithFieldOnChannel(e))return!0}return!1},e.prototype.getName=function(e){return m.varName((this.name?this.name+"_":"")+e)},e.prototype.requestDataName=function(e){var t=this.getName(e),n=this.component.data.outputNodeRefCounts;return n[t]=(n[t]||0)+1,t},e.prototype.getSizeSignalRef=function(e){if(k(this.parent)){var t="width"===e?"x":"y",n=this.component.scales[t];if(n&&!n.merged){var i=n.get("type"),r=n.get("range");if(f.hasDiscreteDomain(i)&&h.isVgRangeStep(r)){var o=n.get("name"),a=w.assembleDomain(this,t),s=w.getFieldFromDomain(a);if(s){var l=c.vgField({aggregate:"distinct",field:s},{expr:"datum"});return{signal:b.sizeExpr(o,n,l)}}return u.warn("Unknown field for ${channel}.  Cannot calculate view size."),null}}}return{signal:this.layoutSizeNameMap.get(this.getName(e))}},e.prototype.lookupDataSource=function(e){var t=this.component.data.outputNodes[e];return t?t.getSource():e},e.prototype.getSizeName=function(e){return this.layoutSizeNameMap.get(e)},e.prototype.renameLayoutSize=function(e,t){this.layoutSizeNameMap.rename(e,t)},e.prototype.renameScale=function(e,t){this.scaleNameMap.rename(e,t)},e.prototype.renameProjection=function(e,t){this.projectionNameMap.rename(e,t)},e.prototype.scaleName=function(e,t){return t?this.getName(e):o.isChannel(e)&&o.isScaleChannel(e)&&this.component.scales[e]||this.scaleNameMap.has(this.getName(e))?this.scaleNameMap.get(this.getName(e)):void 0},e.prototype.projectionName=function(e){return e?this.getName("projection"):this.component.projection&&!this.component.projection.merged||this.projectionNameMap.has(this.getName("projection"))?this.projectionNameMap.get(this.getName("projection")):void 0},e.prototype.getScaleComponent=function(e){if(!this.component.scales)throw new Error("getScaleComponent cannot be called before parseScale().  Make sure you have called parseScale or use parseUnitModelWithScale().");var t=this.component.scales[e];return t&&!t.merged?t:this.parent?this.parent.getScaleComponent(e):void 0},e.prototype.getSelectionComponent=function(e,t){var n=this.component.selection[e];if(!n&&this.parent&&(n=this.parent.getSelectionComponent(e,t)),!n)throw new Error(u.message.selectionNotFound(t));return n},e}(),A=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.vgField=function(e,t){void 0===t&&(t={});var n=this.fieldDef(e);if(n)return c.vgField(n,t)},t.prototype.reduceFieldDef=function(r,e,t){return l.reduce(this.getMapping(),function(e,t,n){var i=c.getFieldDef(t);return i?r(e,i,n):e},e,t)},t.prototype.forEachFieldDef=function(i,e){l.forEach(this.getMapping(),function(e,t){var n=c.getFieldDef(e);n&&i(n,t)},e)},t}(n.Model=j);n.ModelWithField=A},{"../channel":15,"../encoding":104,"../fielddef":106,"../log":110,"../scale":115,"../spec":118,"../title":121,"../transform":123,"../util":125,"../vega.schema":127,"./axis/assemble":16,"./layout/header":48,"./layoutsize/assemble":49,"./legend/assemble":51,"./legend/parse":54,"./projection/assemble":70,"./projection/parse":72,"./scale/assemble":76,"./scale/domain":78,"./scale/parse":79,"./split":95,"vega-util":10}],70:[function(e,t,n){"use strict";var s=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},l=this&&this.__rest||function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&(n[i[r]]=e[i[r]])}return n};Object.defineProperty(n,"__esModule",{value:!0});var c=e("../../util"),u=e("../../vega.schema"),i=e("../model");function r(e){return e.children.reduce(function(e,t){return e.concat(t.assembleProjections())},o(e))}function o(i){var e=i.component.projection;if(!e||e.merged)return[];var t=e.combine(),n=t.name,r=l(t,["name"]),o={signal:"["+e.size.map(function(e){return e.signal}).join(", ")+"]"},a=e.data.reduce(function(e,t){var n=u.isVgSignalRef(t)?t.signal:"data(\'"+i.lookupDataSource(t)+"\')";return c.contains(e,n)||e.push(n),e},[]);if(a.length<=0)throw new Error("Projection\'s fit didn\'t find any data sources");return[s({name:n,size:o,fit:{signal:1<a.length?"["+a.join(", ")+"]":a[0]}},r)]}n.assembleProjections=function(e){return i.isLayerModel(e)||i.isConcatModel(e)||i.isRepeatModel(e)?r(e):o(e)},n.assembleProjectionsForModelAndChildren=r,n.assembleProjectionForModel=o},{"../../util":125,"../../vega.schema":127,"../model":69}],71:[function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),a=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var o=function(o){function e(e,t,n,i){var r=o.call(this,a({},t),{name:e})||this;return r.specifiedProjection=t,r.size=n,r.data=i,r.merged=!1,r}return r(e,o),e}(e("../split").Split);n.ProjectionComponent=o},{"../split":95}],72:[function(e,t,n){"use strict";var l=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var c=e("../../channel"),u=e("../../data"),f=e("../../fielddef"),d=e("../../mark"),o=e("../../projection"),p=e("../../type"),a=e("../../util"),i=e("../model"),g=e("./component");function s(e){i.isUnitModel(e)?e.component.projection=function(t){var e=t.specifiedProjection,n=t.markDef,i=t.config,r=t.encoding,o=n&&n.type===d.GEOSHAPE,a=r&&c.GEOPOSITION_CHANNELS.some(function(e){return f.isFieldDef(r[e])});if(o||a){var s=[];return[[c.LONGITUDE,c.LATITUDE],[c.LONGITUDE2,c.LATITUDE2]].forEach(function(e){(t.channelHasField(e[0])||t.channelHasField(e[1]))&&s.push({signal:t.getName("geojson_"+s.length)})}),t.channelHasField(c.SHAPE)&&t.fieldDef(c.SHAPE).type===p.GEOJSON&&s.push({signal:t.getName("geojson_"+s.length)}),0===s.length&&s.push(t.requestDataName(u.MAIN)),new g.ProjectionComponent(t.projectionName(!0),l({},i.projection||{},e||{}),[t.getSizeSignalRef("width"),t.getSizeSignalRef("height")],s)}return}(e):e.component.projection=function(e){if(0===e.children.length)return;var i,t=a.every(e.children,function(e){s(e);var t=e.component.projection;if(t){if(i){var n=function(t,n){var e=a.every(o.PROJECTION_PROPERTIES,function(e){return!t.explicit.hasOwnProperty(e)&&!n.explicit.hasOwnProperty(e)||!(!t.explicit.hasOwnProperty(e)||!n.explicit.hasOwnProperty(e)||a.stringify(t.get(e))!==a.stringify(n.get(e)))});if(a.stringify(t.size)===a.stringify(n.size)){if(e)return t;if(a.stringify(t.explicit)===a.stringify({}))return n;if(a.stringify(n.explicit)===a.stringify({}))return t}return null}(i,t);return n&&(i=n),!!n}return i=t,!0}return!0});if(i&&t){var n=e.projectionName(!0),r=new g.ProjectionComponent(n,i.specifiedProjection,i.size,a.duplicate(i.data));return e.children.forEach(function(e){e.component.projection&&(r.data=r.data.concat(e.component.projection.data),e.renameProjection(e.component.projection.get("name"),n),e.component.projection.merged=!0)}),r}return}(e)}n.parseProjection=s},{"../../channel":15,"../../data":102,"../../fielddef":106,"../../mark":112,"../../projection":114,"../../type":124,"../../util":125,"../model":69,"./component":71}],73:[function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(n,"__esModule",{value:!0});var s=e("../log"),o=e("./baseconcat"),m=e("./buildmodel"),l=e("./layoutsize/parse"),a=function(a){function e(e,t,n,i,r){var o=a.call(this,e,t,n,r,e.resolve)||this;return o.type="repeat",e.resolve&&e.resolve.axis&&("shared"===e.resolve.axis.x||"shared"===e.resolve.axis.y)&&s.warn(s.message.REPEAT_CANNOT_SHARE_AXIS),o.repeat=e.repeat,o.children=o._initChildren(e,o.repeat,i,r),o}return r(e,a),e.prototype._initChildren=function(e,t,n,i){for(var r=[],o=t.row||[n?n.row:null],a=t.column||[n?n.column:null],s=0,l=o;s<l.length;s++)for(var c=l[s],u=0,f=a;u<f.length;u++){var d=f[u],p=(c?"_"+c:"")+(d?"_"+d:""),g={row:c,column:d};r.push(m.buildModel(e.spec,this,this.getName("child"+p),void 0,g,i,!1))}return r},e.prototype.parseLayoutSize=function(){l.parseRepeatLayoutSize(this)},e.prototype.assembleLayout=function(){return{padding:{row:10,column:10},offset:10,columns:this.repeat&&this.repeat.column?this.repeat.column.length:1,bounds:"full",align:"all"}},e}(o.BaseConcatModel);n.RepeatModel=a},{"../log":110,"./baseconcat":22,"./buildmodel":23,"./layoutsize/parse":50}],74:[function(e,t,n){"use strict";var i=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},r=this&&this.__rest||function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&(n[i[r]]=e[i[r]])}return n};Object.defineProperty(n,"__esModule",{value:!0});var a=e("vega-util"),o=e("../fielddef"),s=e("../log"),l=e("../sort");function c(e,t){return o.isRepeatRef(e.field)?e.field.repeat in t?i({},e,{field:t[e.field.repeat]}):void s.warn(s.message.noSuchRepeatedValue(e.field.repeat)):e}function u(e,t){if(void 0!==(e=c(e,t))){if(e.sort&&l.isSortField(e.sort)){var n=c(e.sort,t);e=i({},e,n?{sort:n}:{})}return e}}function f(e,t){if(!o.isFieldDef(e)){if(o.hasConditionalFieldDef(e)){if(n=u(e.condition,t))return i({},e,{condition:n});e.condition;return r(e,["condition"])}return e}var n;return(n=u(e,t))?n:o.isConditionalDef(e)?{condition:e.condition}:void 0}function d(e,t){var n={};for(var i in e)if(e.hasOwnProperty(i)){var r=e[i];if(a.isArray(r))n[i]=r.map(function(e){return f(e,t)}).filter(function(e){return e});else{var o=f(r,t);o&&(n[i]=o)}}return n}n.replaceRepeaterInFacet=function(e,t){return d(e,t)},n.replaceRepeaterInEncoding=function(e,t){return d(e,t)}},{"../fielddef":106,"../log":110,"../sort":117,"vega-util":10}],75:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("../channel"),o=e("../log"),a=e("../util"),i=e("./model");n.defaultScaleResolve=function(e,t){if(i.isLayerModel(t)||i.isFacetModel(t))return"shared";if(i.isConcatModel(t)||i.isRepeatModel(t))return a.contains(r.POSITION_SCALE_CHANNELS,e)?"independent":"shared";throw new Error("invalid model type for resolve")},n.parseGuideResolve=function(e,t){var n=e.scale[t],i=a.contains(r.POSITION_SCALE_CHANNELS,t)?"axis":"legend";return"independent"===n?("shared"===e[i][t]&&o.warn(o.message.independentScaleMeansIndependentGuide(t)),"independent"):e[i][t]||"shared"}},{"../channel":15,"../log":110,"../util":125,"./model":69}],76:[function(e,t,n){"use strict";var u=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},f=this&&this.__rest||function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&(n[i[r]]=e[i[r]])}return n};Object.defineProperty(n,"__esModule",{value:!0});var a=e("vega-util"),i=e("../../util"),s=e("../../vega.schema"),r=e("../model"),d=e("../selection/selection"),p=e("./domain");function o(c){return i.keys(c.component.scales).reduce(function(e,t){var n=c.component.scales[t];if(n.merged)return e;var i=n.combine(),r=i.domainRaw,o=i.range,a=i.name,s=i.type,l=(i.domainRaw,i.range,f(i,["name","type","domainRaw","range"]));return o=g(o,a,c,t),r&&d.isRawSelectionDomain(r)&&(r=d.selectionScaleDomain(c,r)),e.push(u({name:a,type:s,domain:p.assembleDomain(c,t)},r?{domainRaw:r}:{},{range:o},l)),e},[])}function g(e,t,n,i){if("x"===i||"y"===i){if(s.isVgRangeStep(e))return{step:{signal:t+"_step"}};if(a.isArray(e)&&2===e.length){var r=e[0],o=e[1];if(0===r&&s.isVgSignalRef(o))return[0,{signal:n.getSizeName(o.signal)}];if(s.isVgSignalRef(r)&&0===o)return[{signal:n.getSizeName(r.signal)},0]}}return e}n.assembleScales=function n(e){return r.isLayerModel(e)||r.isConcatModel(e)||r.isRepeatModel(e)?e.children.reduce(function(e,t){return e.concat(n(t))},o(e)):o(e)},n.assembleScalesForModel=o,n.assembleScaleRange=g},{"../../util":125,"../../vega.schema":127,"../model":69,"../selection/selection":85,"./domain":78,"vega-util":10}],77:[function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(n,"__esModule",{value:!0});var o=function(i){function e(e,t){var n=i.call(this,{},{name:e})||this;return n.merged=!1,n.domains=[],n.setWithExplicit("type",t),n}return r(e,i),e}(e("../split").Split);n.ScaleComponent=o},{"../split":95}],78:[function(e,t,n){"use strict";var l=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},c=this&&this.__rest||function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&(n[i[r]]=e[i[r]])}return n};Object.defineProperty(n,"__esModule",{value:!0});var o=e("vega-util"),i=e("../../aggregate"),u=e("../../bin"),f=e("../../channel"),d=e("../../data"),p=e("../../datetime"),g=e("../../log"),m=e("../../scale"),h=e("../../sort"),v=e("../../util"),y=e("../../util"),a=e("../../vega.schema"),b=e("../../vega.schema"),O=e("../common"),_=e("../data/optimize"),S=e("../model"),E=e("../selection/selection");function r(e){var u,f,d;S.isUnitModel(e)?(f=(u=e).specifiedScales,d=u.component.scales,y.keys(d).forEach(function(e){var t=f[e],n=t?t.domain:void 0,i=x(u,e),r=d[e];if(r.domains=i,m.isSelectionDomain(n)&&r.set("domainRaw",{signal:E.SELECTION_DOMAIN+v.hash(n)},!0),u.component.data.isFaceted){for(var o=u;!S.isFacetModel(o)&&o.parent;)o=o.parent;var a=o.component.resolve.scale[e];if("shared"===a)for(var s=0,l=i;s<l.length;s++){var c=l[s];b.isDataRefDomain(c)&&(c.data=_.FACET_SCALE_PREFIX+c.data.replace(_.FACET_SCALE_PREFIX,""))}}})):function(a){for(var e=0,t=a.children;e<t.length;e++){var n=t[e];r(n)}var s=a.component.scales;y.keys(s).forEach(function(e){for(var t,n=0,i=a.children;n<i.length;n++){var r=i[n],o=r.component.scales[e];o&&(t=void 0===t?o.domains:t.concat(o.domains))}s[e].domains=t})}(e)}function x(e,t){var n=e.getScaleComponent(t).get("type"),i=function(e,t,n,i){if("unaggregated"===e){var r=N(t,n),o=r.valid,a=r.reason;if(!o)return void g.warn(a)}else if(void 0===e&&i.useUnaggregatedDomain&&(o=N(t,n).valid))return"unaggregated";return e}(e.scaleDomain(t),e.fieldDef(t),n,e.config.scale);return i!==e.scaleDomain(t)&&(e.specifiedScales[t]=l({},e.specifiedScales[t],{domain:i})),"x"===t&&e.channelHasField("x2")?e.channelHasField("x")?s(n,i,e,"x").concat(s(n,i,e,"x2")):s(n,i,e,"x2"):"y"===t&&e.channelHasField("y2")?e.channelHasField("y")?s(n,i,e,"y").concat(s(n,i,e,"y2")):s(n,i,e,"y2"):s(n,i,e,t)}function s(e,t,n,i){var r=n.fieldDef(i);if(t&&"unaggregated"!==t&&!m.isSelectionDomain(t)){if(!r.bin)return p.isDateTime(t[0])?t.map(function(e){return{signal:"{data: "+p.dateTimeExpr(e,!0)+"}"}}):[t];g.warn(g.message.conflictedDomain(i))}var o=n.stack;if(o&&i===o.fieldChannel)return"normalize"===o.offset?[[0,1]]:[{data:a=n.requestDataName(d.MAIN),field:n.vgField(i,{suffix:"start"})},{data:a,field:n.vgField(i,{suffix:"end"})}];var a,s=f.isScaleChannel(i)?w(n,i,e):void 0;if("unaggregated"===t)return[{data:a=n.requestDataName(d.MAIN),field:n.vgField(i,{aggregate:"min"})},{data:a,field:n.vgField(i,{aggregate:"max"})}];if(!r.bin)return s?[{data:y.isBoolean(s)?n.requestDataName(d.MAIN):n.requestDataName(d.RAW),field:n.vgField(i),sort:s}]:[{data:n.requestDataName(d.MAIN),field:n.vgField(i)}];if(m.isBinScale(e)){var l=n.getName(u.binToString(r.bin)+"_"+r.field+"_bins");return[{signal:"sequence("+l+".start, "+l+".stop + "+l+".step, "+l+".step)"}]}return m.hasDiscreteDomain(e)?[{data:y.isBoolean(s)?n.requestDataName(d.MAIN):n.requestDataName(d.RAW),field:n.vgField(i,O.binRequiresRange(r,i)?{binSuffix:"range"}:{}),sort:!0!==s&&h.isSortField(s)?s:{field:n.vgField(i,{}),op:"min"}}]:"x"===i||"y"===i?[{data:a=n.requestDataName(d.MAIN),field:n.vgField(i,{})},{data:a,field:n.vgField(i,{binSuffix:"end"})}]:[{data:n.requestDataName(d.MAIN),field:n.vgField(i,{})}]}function w(e,t,n){if(m.hasDiscreteDomain(n)){var i=e.sort(t);return h.isSortField(i)?i:"descending"===i?{op:"min",field:e.vgField(t),order:"descending"}:!!y.contains(["ascending",void 0],i)||void 0}}function N(e,t){return e.aggregate?i.SHARED_DOMAIN_OP_INDEX[e.aggregate]?"quantitative"===e.type&&"log"===t?{valid:!1,reason:g.message.unaggregatedDomainWithLogScale(e)}:{valid:!0}:{valid:!1,reason:g.message.unaggregateDomainWithNonSharedDomainOp(e.aggregate)}:{valid:!1,reason:g.message.unaggregateDomainHasNoEffectForRawField(e)}}function T(e){var t=y.unique(e.map(function(e){if(b.isDataRefDomain(e)){e.sort;return c(e,["sort"])}return e}),y.hash),n=y.unique(e.map(function(e){if(b.isDataRefDomain(e)){var t=e.sort;return void 0===t||y.isBoolean(t)||("count"===t.op&&delete t.field,"ascending"===t.order&&delete t.order),t}}).filter(function(e){return void 0!==e}),y.hash);if(1===t.length){var i=e[0];if(b.isDataRefDomain(i)&&0<n.length){var r=n[0];return 1<n.length&&(g.warn(g.message.MORE_THAN_ONE_SORT),r=!0),l({},i,{sort:r})}return i}var o=y.unique(n.map(function(e){return!0===e?e:"count"===e.op?e:(g.warn(g.message.domainSortDropped(e)),!0)}),y.hash),a=void 0;1===o.length?a=o[0]:1<o.length&&(g.warn(g.message.MORE_THAN_ONE_SORT),a=!0);var s=y.unique(e.map(function(e){return b.isDataRefDomain(e)?e.data:null}),function(e){return e});return 1===s.length&&null!==s[0]?i=l({data:s[0],fields:t.map(function(e){return e.field})},a?{sort:a}:{}):l({fields:t},a?{sort:a}:{})}n.parseScaleDomain=r,n.parseDomainForChannel=x,n.domainSort=w,n.canUseUnaggregatedDomain=N,n.mergeDomains=T,n.getFieldFromDomain=function(e){if(b.isDataRefDomain(e)&&o.isString(e.field))return e.field;if(a.isDataRefUnionedDomain(e)){for(var t=void 0,n=0,i=e.fields;n<i.length;n++){var r=i[n];if(b.isDataRefDomain(r)&&o.isString(r.field))if(t){if(t!==r.field)return g.warn("Detected faceted independent scales that union domain of multiple fields from different data sources.  We will use the first field.  The result view size may be incorrect."),t}else t=r.field}return g.warn("Detected faceted independent scales that union domain of identical fields from different source detected.  We will assume that this is the same field from a different fork of the same data source.  However, if this is not case, the result view size maybe incorrect."),t}if(a.isFieldRefUnionDomain(e))return g.warn("Detected faceted independent scales that union domain of multiple fields from the same data source.  We will use the first field.  The result view size may be incorrect."),t=e.fields[0],o.isString(t)?t:void 0},n.assembleDomain=function(t,e){return T(t.component.scales[e].domains.map(function(e){return b.isDataRefDomain(e)&&(e.data=t.lookupDataSource(e.data)),e}))}},{"../../aggregate":12,"../../bin":14,"../../channel":15,"../../data":102,"../../datetime":103,"../../log":110,"../../scale":115,"../../sort":117,"../../util":125,"../../vega.schema":127,"../common":24,"../data/optimize":40,"../model":69,"../selection/selection":85,"vega-util":10}],79:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var f=e("../../channel"),d=e("../../fielddef"),p=e("../../mark"),o=e("../../scale"),g=e("../../type"),a=e("../../util"),i=e("../model"),m=e("../resolve"),h=e("../split"),v=e("./component"),r=e("./domain"),s=e("./properties"),l=e("./range"),y=e("./type");function b(e){var s,l,c,u;i.isUnitModel(e)?e.component.scales=(l=(s=e).encoding,c=s.config,u=s.mark(),f.SCALE_CHANNELS.reduce(function(e,t){var n,i=void 0,r=l[t];if(d.isFieldDef(r)&&u===p.GEOSHAPE&&t===f.SHAPE&&r.type===g.GEOJSON)return e;if(d.isFieldDef(r)?i=(n=r).scale:d.hasConditionalFieldDef(r)?(n=r.condition,i=r.condition.scale):t===f.X?n=d.getFieldDef(l.x2):t===f.Y&&(n=d.getFieldDef(l.y2)),n&&null!==i&&!1!==i){var o=(i=i||{}).type,a=y.scaleType(i.type,t,n,u,c.scale);e[t]=new v.ScaleComponent(s.scaleName(t+"",!0),{value:a,explicit:o===a})}return e},{})):e.component.scales=function(s){for(var l=s.component.scales={},c={},r=s.component.resolve,e=function(i){b(i),a.keys(i.component.scales).forEach(function(e){if(r.scale[e]=r.scale[e]||m.defaultScaleResolve(e,s),"shared"===r.scale[e]){var t=c[e],n=i.component.scales[e].getWithExplicit("type");t?o.scaleCompatible(t.value,n.value)?c[e]=h.mergeValuesWithExplicit(t,n,"type","scale",O):(r.scale[e]="independent",delete c[e]):c[e]=n}})},t=0,n=s.children;t<n.length;t++){var i=n[t];e(i)}return a.keys(c).forEach(function(e){var t=s.scaleName(e,!0),n=c[e];l[e]=new v.ScaleComponent(t,n);for(var i=0,r=s.children;i<r.length;i++){var o=r[i],a=o.component.scales[e];a&&(o.renameScale(a.get("name"),t),a.merged=!0)}}),l}(e)}n.parseScale=function(e){b(e),r.parseScaleDomain(e);for(var t=0,n=o.NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES;t<n.length;t++){var i=n[t];s.parseScaleProperty(e,i)}l.parseScaleRange(e)},n.parseScaleCore=b;var O=h.tieBreakByComparing(function(e,t){return o.scaleTypePrecedence(e)-o.scaleTypePrecedence(t)})},{"../../channel":15,"../../fielddef":106,"../../mark":112,"../../scale":115,"../../type":124,"../../util":125,"../model":69,"../resolve":75,"../split":95,"./component":77,"./domain":78,"./properties":80,"./range":81,"./type":82}],80:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var l=e("../../channel"),m=e("../../log"),h=e("../../scale"),i=e("../../util"),c=e("../../util"),r=e("../model"),u=e("../split"),o=e("./range");function f(e,t){var d,p,g;r.isUnitModel(e)?(p=t,g=(d=e).component.scales,i.keys(g).forEach(function(e){var t=d.specifiedScales[e],n=g[e],i=d.getScaleComponent(e),r=d.fieldDef(e),o=d.sort(e),a=d.config,s=t[p],l=i.get("type"),c=h.scaleTypeSupportProperty(l,p),u=h.channelScalePropertyIncompatability(e,p);if(void 0!==s&&(c?u&&m.warn(u):m.warn(m.message.scalePropertyNotWorkWithScaleType(l,p,e))),c&&void 0===u)if(void 0!==s)n.copyKeyFromObject(p,t);else{var f=v(p,e,r,o,i.get("type"),i.get("padding"),i.get("paddingInner"),t.domain,d.markDef,a);void 0!==f&&n.set(p,f,!1)}})):a(e,t)}function v(e,t,n,i,r,o,a,s,l,c){var u=c.scale;switch(e){case"nice":return d(r,t,n);case"padding":return p(t,r,u,n,l,c.bar);case"paddingInner":return g(o,t,u);case"paddingOuter":return y(o,t,r,a,u);case"reverse":return b(r,i);case"zero":return O(t,n,s)}return u[e]}function a(a,s){for(var l=a.component.scales,e=0,t=a.children;e<t.length;e++){var n=t[e];"range"===s?o.parseScaleRange(n):f(n,s)}i.keys(l).forEach(function(e){for(var t,n=0,i=a.children;n<i.length;n++){var r=i[n].component.scales[e];if(r){var o=r.getWithExplicit(s);t=u.mergeValuesWithExplicit(t,o,s,"scale",u.tieBreakByComparing(function(e,t){switch(s){case"range":return e.step&&t.step?e.step-t.step:0}return 0}))}}l[e].setWithExplicit(s,t)})}function d(e,t,n){if(!n.bin&&!c.contains([h.ScaleType.TIME,h.ScaleType.UTC],e))return c.contains([l.X,l.Y],t)}function p(e,t,n,i,r,o){if(c.contains([l.X,l.Y],e)){if(h.isContinuousToContinuous(t)){if(void 0!==n.continuousPadding)return n.continuousPadding;var a=r.type,s=r.orient;if("bar"===a&&!i.bin&&("vertical"===s&&"x"===e||"horizontal"===s&&"y"===e))return o.continuousBandSize}if(t===h.ScaleType.POINT)return n.pointPadding}}function g(e,t,n){if(void 0===e)return c.contains([l.X,l.Y],t)?n.bandPaddingInner:void 0}function y(e,t,n,i,r){if(void 0===e)return c.contains([l.X,l.Y],t)&&n===h.ScaleType.BAND?void 0!==r.bandPaddingOuter?r.bandPaddingOuter:i/2:void 0}function b(e,t){if(h.hasContinuousDomain(e)&&"descending"===t)return!0}function O(e,t,n){return"size"===e&&"quantitative"===t.type||!(!!n&&"unaggregated"!==n||t.bin||!c.contains([l.X,l.Y],e))}n.parseScaleProperty=f,n.getDefaultValue=v,n.parseNonUnitScaleProperty=a,n.nice=d,n.padding=p,n.paddingInner=g,n.paddingOuter=y,n.reverse=b,n.zero=O},{"../../channel":15,"../../log":110,"../../scale":115,"../../util":125,"../model":69,"../split":95,"./range":81}],81:[function(e,t,v){"use strict";Object.defineProperty(v,"__esModule",{value:!0});var p=e("vega-util"),c=e("../../channel"),y=e("../../log"),b=e("../../scale"),u=e("../../scale"),g=e("../../util"),m=e("../../vega.schema"),n=e("../model"),O=e("../split"),i=e("./properties");function h(e,t,n,i,r,o,a,s,l,c){for(var u=s||null===i.rangeStep,f=0,d=v.RANGE_PROPERTIES;f<d.length;f++){var p=d[f];if(void 0!==i[p]){var g=b.scaleTypeSupportProperty(t,p),m=b.channelScalePropertyIncompatability(e,p);if(g)if(m)y.warn(m);else switch(p){case"range":return O.makeExplicit(i[p]);case"scheme":return O.makeExplicit(_(i[p]));case"rangeStep":var h=i[p];if(null!==h){if(!s)return O.makeExplicit({step:h});y.warn(y.message.rangeStepDropped(e))}}else y.warn(y.message.scalePropertyNotWorkWithScaleType(t,p,e))}}return O.makeImplicit(S(e,t,n,r,o,a,l,c,u))}function _(e){if(b.isExtendedScheme(e)){var t={scheme:e.name};return e.count&&(t.count=e.count),e.extent&&(t.extent=e.extent),t}return{scheme:e}}function S(e,t,n,i,r,o,a,s,l){switch(e){case c.X:case c.Y:if(g.contains(["point","band"],t)&&!l)if(e===c.X&&"text"===o){if(i.scale.textXRangeStep)return{step:i.scale.textXRangeStep}}else if(i.scale.rangeStep)return{step:i.scale.rangeStep};return e===c.Y&&u.hasContinuousDomain(t)?[{signal:a},0]:[0,{signal:a}];case c.SIZE:return[function(e,t,n){if(t)return 0;switch(e){case"bar":case"tick":return n.scale.minBandSize;case"line":case"rule":return n.scale.minStrokeWidth;case"text":return n.scale.minFontSize;case"point":case"square":case"circle":return n.scale.minSize}throw new Error(y.message.incompatibleChannel("size",e))}(o,r,i),function(e,t,n){var i=n.scale;switch(e){case"bar":case"tick":return void 0!==n.scale.maxBandSize?n.scale.maxBandSize:f(t,n.scale)-1;case"line":case"rule":return n.scale.maxStrokeWidth;case"text":return n.scale.maxFontSize;case"point":case"square":case"circle":if(n.scale.maxSize)return n.scale.maxSize;var r=f(t,i);return(r-2)*(r-2)}throw new Error(y.message.incompatibleChannel("size",e))}(o,s,i)];case c.SHAPE:return"symbol";case c.COLOR:case c.FILL:case c.STROKE:return"ordinal"===t?"nominal"===n?"category":"ordinal":"rect"===o||"geoshape"===o?"heatmap":"ramp";case c.OPACITY:return[i.scale.minOpacity,i.scale.maxOpacity]}throw new Error("Scale range undefined for channel "+e)}function f(e,t){return 0<e.length?Math.min.apply(null,e):t.rangeStep?t.rangeStep:21}v.RANGE_PROPERTIES=["range","rangeStep","scheme"],v.parseScaleRange=function(e){var f,d;n.isUnitModel(e)?(d=(f=e).component.scales,c.SCALE_CHANNELS.forEach(function(e){var t=d[e];if(t){var n=f.getScaleComponent(e),i=f.specifiedScales[e],r=f.fieldDef(e),o="x"===e?"width":"y"===e?"height":void 0,a=o?!!f.component.layoutSize.get(o):void 0,s=n.get("type"),l=g.contains(["point","band"],s)||!!i.rangeStep;o&&f.fit&&!a&&l&&(y.warn(y.message.CANNOT_FIX_RANGE_STEP_WITH_FIT),a=!0);var c=function(e){var t=[],n=e.getScaleComponent("x"),i=n&&n.get("range");i&&m.isVgRangeStep(i)&&p.isNumber(i.step)&&t.push(i.step);var r=e.getScaleComponent("y"),o=r&&r.get("range");return o&&m.isVgRangeStep(o)&&p.isNumber(o.step)&&t.push(o.step),t}(f),u=h(e,s,r.type,i,f.config,t.get("zero"),f.mark(),a,f.getName(o),c);t.setWithExplicit("range",u)}})):i.parseNonUnitScaleProperty(e,"range")},v.parseRangeForChannel=h,v.defaultRange=S},{"../../channel":15,"../../log":110,"../../scale":115,"../../util":125,"../../vega.schema":127,"../model":69,"../split":95,"./properties":80,"vega-util":10}],82:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var a=e("../../channel"),s=e("../../log"),l=e("../../scale"),i=e("../../scale"),r=e("../../type"),c=e("../../util"),o=e("../../util");function u(e,t){var n=t.type;return o.contains([r.Type.ORDINAL,r.Type.NOMINAL],n)?void 0===e||i.hasDiscreteDomain(e):n===r.Type.TEMPORAL?o.contains([l.ScaleType.TIME,l.ScaleType.UTC,l.ScaleType.SEQUENTIAL,void 0],e):n!==r.Type.QUANTITATIVE||(t.bin?o.contains([l.ScaleType.BIN_LINEAR,l.ScaleType.BIN_ORDINAL,l.ScaleType.LINEAR],e):o.contains([l.ScaleType.LOG,l.ScaleType.POW,l.ScaleType.SQRT,l.ScaleType.QUANTILE,l.ScaleType.QUANTIZE,l.ScaleType.LINEAR,l.ScaleType.SEQUENTIAL,void 0],e))}n.scaleType=function(e,t,n,i,r){var o=function(e,t,n,i){switch(t.type){case"nominal":case"ordinal":if(a.isColorChannel(e)||"discrete"===a.rangeType(e))return"shape"===e&&"ordinal"===t.type&&s.warn(s.message.discreteChannelCannotEncode(e,"ordinal")),"ordinal";if(c.contains(["x","y"],e)){if(c.contains(["rect","bar","rule"],n))return"band";if("bar"===n)return"band"}return"point";case"temporal":return a.isColorChannel(e)?"sequential":"discrete"===a.rangeType(e)?(s.warn(s.message.discreteChannelCannotEncode(e,"temporal")),"ordinal"):"time";case"quantitative":return a.isColorChannel(e)?t.bin?"bin-ordinal":"sequential":"discrete"===a.rangeType(e)?(s.warn(s.message.discreteChannelCannotEncode(e,"quantitative")),"ordinal"):t.bin&&"x"!==e&&"y"!==e?"bin-linear":"linear";case"latitude":case"longitude":case"geojson":return}throw new Error(s.message.invalidFieldType(t.type))}(t,n,i);return a.isScaleChannel(t)?void 0!==e?l.channelSupportScaleType(t,e)?u(e,n)?e:(s.warn(s.message.scaleTypeNotWorkWithFieldDef(e,o)),o):(s.warn(s.message.scaleTypeNotWorkWithChannel(t,e,o)),o):o:null},n.fieldDefMatchScaleType=u},{"../../channel":15,"../../log":110,"../../scale":115,"../../type":124,"../../util":125}],83:[function(e,t,T){"use strict";var v=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},y=this&&this.__rest||function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&(n[i[r]]=e[i[r]])}return n};Object.defineProperty(T,"__esModule",{value:!0});var P=e("vega-util"),D=e("../../channel"),k=e("../../log"),j=e("../../scale"),b=e("../../util"),A=e("./selection"),C=e("./transforms/scales");T.BRUSH="_brush",T.SCALE_TRIGGER="_scale_trigger";var n={predicate:"vlInterval",scaleDomain:"vlIntervalDomain",signals:function(_,S){var e=S.name,t=C.default.has(S),E=[],x=[],w=[],N=[];if(S.translate&&!t){var i="!event.item || event.item.mark.name !== "+P.stringValue(e+T.BRUSH);M(S,function(e,t){var n=t.between[0].filter||(t.between[0].filter=[]);n.indexOf(i)<0&&n.push(i)})}return S.project.forEach(function(e){var t=e.channel;if(t===D.X||t===D.Y){var n,i,r,o,a,s,l,c,u,f,d,p,g,m=(n=_,i=S,r=t,o=A.channelSignalName(i,r,"visual"),a=A.channelSignalName(i,r,"data"),s=C.default.has(i),l=n.scaleName(r),c=P.stringValue(l),u=n.getScaleComponent(r),f=u?u.get("type"):void 0,d=n.getSizeSignalRef(r===D.X?"width":"height").signal,p=r+"(unit)",(g=M(i,function(e,t){return e.concat({events:t.between[0],update:"["+p+", "+p+"]"},{events:t,update:"["+o+"[0], clamp("+p+", 0, "+d+")]"})})).push({events:{signal:i.name+T.SCALE_TRIGGER},update:j.hasContinuousDomain(f)&&!j.isBinScale(f)?"[scale("+c+", "+a+"[0]), scale("+c+", "+a+"[1])]":"[0, 0]"}),s?[{name:a,on:[]}]:[{name:o,value:[],on:g},{name:a,on:[{events:{signal:o},update:o+"[0] === "+o+"[1] ? null : invert("+c+", "+o+")"}]}]),h=A.channelSignalName(S,t,"data"),v=A.channelSignalName(S,t,"visual"),y=P.stringValue(_.scaleName(t)),b=_.getScaleComponent(t).get("type"),O=j.hasContinuousDomain(b)?"+":"";E.push.apply(E,m),w.push(h),x.push("{encoding: "+P.stringValue(t)+", field: "+P.stringValue(e.field)+", extent: "+h+"}"),N.push({scaleName:_.scaleName(t),expr:"(!isArray("+h+") || ("+O+"invert("+y+", "+v+")[0] === "+O+h+"[0] && "+O+"invert("+y+", "+v+")[1] === "+O+h+"[1]))"})}else k.warn("Interval selections only support x and y encoding channels.")}),t||E.push({name:e+T.SCALE_TRIGGER,update:N.map(function(e){return e.expr}).join(" && ")+" ? "+(e+T.SCALE_TRIGGER)+" : {}"}),E.concat({name:e+A.TUPLE,on:[{events:w.map(function(e){return{signal:e}}),update:w.join(" && ")+" ? {unit: "+A.unitName(_)+", intervals: ["+x.join(", ")+"]} : null"}]})},modifyExpr:function(e,t){return t.name+A.TUPLE+", "+("global"===t.resolve?"true":"{unit: "+A.unitName(e)+"}")},marks:function(e,t,n){var i=t.name,r=A.positionalProjections(t),o=r.xi,a=r.yi,s="data("+P.stringValue(t.name+A.STORE)+")";if(C.default.has(t))return n;var l={x:null!==o?{signal:i+"_x[0]"}:{value:0},y:null!==a?{signal:i+"_y[0]"}:{value:0},x2:null!==o?{signal:i+"_x[1]"}:{field:{group:"width"}},y2:null!==a?{signal:i+"_y[1]"}:{field:{group:"height"}}};if("global"===t.resolve)for(var c=0,u=b.keys(l);c<u.length;c++){var f=u[c];l[f]=[v({test:s+".length && "+s+"[0].unit === "+A.unitName(e)},l[f]),{value:0}]}var d=t.mark,p=d.fill,g=d.fillOpacity,m=y(d,["fill","fillOpacity"]),h=b.keys(m).reduce(function(e,t){return e[t]={value:m[t]},e},{});return[{name:i+T.BRUSH+"_bg",type:"rect",clip:!0,encode:{enter:{fill:{value:p},fillOpacity:{value:g}},update:l}}].concat(n,{name:i+T.BRUSH,type:"rect",clip:!0,encode:{enter:v({fill:{value:"transparent"}},h),update:l}})}};function M(e,n){return e.events.reduce(function(e,t){return t.between?n(e,t):(k.warn(t+" is not an ordered event stream for interval selections"),e)},[])}T.default=n},{"../../channel":15,"../../log":110,"../../scale":115,"../../util":125,"./selection":85,"./transforms/scales":90,"vega-util":10}],84:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var l=e("vega-util"),c=e("../../util"),u=e("./selection"),f=e("./transforms/nearest"),i={predicate:"vlMulti",scaleDomain:"vlMultiDomain",signals:function(i,e){var t=e.project,r=f.default.has(e)?"(item().isVoronoi ? datum.datum : datum)":"datum",o=[],n=t.map(function(e){return l.stringValue(e.channel)}).filter(function(e){return e}).join(", "),a=t.map(function(e){return l.stringValue(e.field)}).join(", "),s=t.map(function(e){var t=e.channel,n=i.fieldDef(t);return n&&n.bin?(o.push(e.field),"["+r+c.accessPath(i.vgField(t,{}))+", "+r+c.accessPath(i.vgField(t,{binSuffix:"end"}))+"]"):""+r+c.accessPath(e.field)}).join(", ");return[{name:e.name+u.TUPLE,value:{},on:[{events:e.events,update:"datum && item().mark.marktype !== \'group\' ? {unit: "+u.unitName(i)+", encodings: ["+n+"], fields: ["+a+"], values: ["+s+"]"+(o.length?", "+o.map(function(e){return l.stringValue("bin_"+e)+": 1"}).join(", "):"")+"} : null",force:!0}]}]},modifyExpr:function(e,t){return t.name+u.TUPLE+", "+("global"===t.resolve?"null":"{unit: "+u.unitName(e)+"}")}};n.default=i},{"../../util":125,"./selection":85,"./transforms/nearest":88,"vega-util":10}],85:[function(e,t,c){"use strict";var u=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(c,"__esModule",{value:!0});var f=e("vega-event-selector"),d=e("vega-util"),a=e("../../channel"),o=e("../../log"),n=e("../../selection"),p=e("../../util"),i=e("../model"),r=e("./interval"),s=e("./multi"),l=e("./single"),g=e("./transforms/transforms");function m(n,i){return h(n,function(t,e){i=e.marks?e.marks(n,t,i):i,g.forEachTransform(t,function(e){e.marks&&(i=e.marks(n,t,i))})}),i}function h(e,t){var n=e.component.selection;for(var i in n)if(n.hasOwnProperty(i)){var r=n[i];t(r,v(r.type))}}function v(e){switch(e){case"single":return l.default;case"multi":return s.default;case"interval":return r.default}return null}function y(e){for(var t=e.parent;t&&!i.isFacetModel(t);)t=t.parent;return t}c.STORE="_store",c.TUPLE="_tuple",c.MODIFY="_modify",c.SELECTION_DOMAIN="_selection_domain_",c.parseUnitSelection=function(o,a){var s={},l=o.config.selection,e=function(e){if(!a.hasOwnProperty(e))return"continue";var t=a[e],n=l[t.type];for(var i in n)"encodings"===i&&t.fields||"fields"===i&&t.encodings||("mark"===i&&(t[i]=u({},n[i],t[i])),void 0!==t[i]&&!0!==t[i]||(t[i]=n[i]||t[i]));e=p.varName(e);var r=s[e]=u({},t,{name:e,events:d.isString(t.on)?f.selector(t.on,"scope"):t.on});g.forEachTransform(r,function(e){e.parse&&e.parse(o,t,r)})};for(var t in a)e(t);return s},c.assembleUnitSelectionSignals=function(r,o){h(r,function(t,e){var n=t.name,i=e.modifyExpr(r,t);o.push.apply(o,e.signals(r,t)),g.forEachTransform(t,function(e){e.signals&&(o=e.signals(r,t,o)),e.modifyExpr&&(i=e.modifyExpr(r,t,i))}),o.push({name:n+c.MODIFY,on:[{events:{signal:n+c.TUPLE},update:"modify("+d.stringValue(t.name+c.STORE)+", "+i+")"}]})});var e=y(r);if(o.length&&e){var t=d.stringValue(e.getName("cell"));o.unshift({name:"facet",value:{},on:[{events:f.selector("mousemove","scope"),update:"isTuple(facet) ? facet : group("+t+").datum"}]})}return o},c.assembleTopLevelSignals=function(n,i){var r=!1;return h(n,function(t,e){e.topLevelSignals&&(i=e.topLevelSignals(n,t,i)),g.forEachTransform(t,function(e){e.topLevelSignals&&(i=e.topLevelSignals(n,t,i))}),r=!0}),r&&(i.filter(function(e){return"unit"===e.name}).length||i.unshift({name:"unit",value:{},on:[{events:"mousemove",update:"isTuple(group()) ? group() : unit"}]})),i},c.assembleUnitSelectionData=function(e,n){return h(e,function(t){n.filter(function(e){return e.name===t.name+c.STORE}).length||n.push({name:t.name+c.STORE})}),n},c.assembleUnitSelectionMarks=m,c.assembleLayerSelectionMarks=function(e,t){return e.children.forEach(function(e){i.isUnitModel(e)&&(t=m(e,t))}),t},c.selectionPredicate=function(a,e,s){var l=[],t=p.logicalExpr(e,function(e){var t=p.varName(e),n=a.getSelectionComponent(t,e),i=d.stringValue(t+c.STORE);if(n.timeUnit){var r=s||a.component.data.raw,o=n.timeUnit.clone();r.parent?o.insertAsParentOf(r):r.parent=o}return"none"!==n.empty&&l.push(i),v(n.type).predicate+"("+i+", datum"+("global"===n.resolve?")":", "+d.stringValue(n.resolve)+")")});return(l.length?"!("+l.map(function(e){return"length(data("+e+"))"}).join(" || ")+") || ":"")+"("+t+")"},c.isRawSelectionDomain=function(e){return 0<=e.signal.indexOf(c.SELECTION_DOMAIN)},c.selectionScaleDomain=function(e,t){var n=JSON.parse(t.signal.replace(c.SELECTION_DOMAIN,"")),i=p.varName(n.selection),r=e.component.selection&&e.component.selection[i];return r?(o.warn(\'Use "bind": "scales" to setup a binding for scales and selections within the same view.\'),{signal:"null"}):(r=e.getSelectionComponent(i,n.selection),n.encoding||n.field||(n.field=r.project[0].field,1<r.project.length&&o.warn(\'A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": \'+d.stringValue(n.field)+".")),{signal:v(r.type).scaleDomain+"("+d.stringValue(i+c.STORE)+", "+d.stringValue(n.encoding||null)+", "+d.stringValue(n.field||null)+("global"===r.resolve?")":", "+d.stringValue(r.resolve)+")")})},c.unitName=function(e){var t=d.stringValue(e.name),n=y(e);return n&&(t+=(n.facet.row?" + \'_\' + facet"+p.accessPath(n.vgField("row")):"")+(n.facet.column?" + \'_\' + facet"+p.accessPath(n.vgField("column")):"")),t},c.requiresSelectionId=function(e){var t=!1;return h(e,function(e){t=t||e.project.some(function(e){return e.field===n.SELECTION_ID})}),t},c.channelSignalName=function(e,t,n){return p.varName(e.name+"_"+("visual"===n?t:e.fields[t]))},c.positionalProjections=function(e){var n=null,i=null,r=null,o=null;return e.project.forEach(function(e,t){e.channel===a.X?(n=e,i=t):e.channel===a.Y&&(r=e,o=t)}),{x:n,xi:i,y:r,yi:o}}},{"../../channel":15,"../../log":110,"../../selection":116,"../../util":125,"../model":69,"./interval":83,"./multi":84,"./single":86,"./transforms/transforms":92,"vega-event-selector":9,"vega-util":10}],86:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var a=e("vega-util"),i=e("./multi"),s=e("./selection"),r={predicate:"vlSingle",scaleDomain:"vlSingleDomain",signals:i.default.signals,topLevelSignals:function(e,t,n){var i=n.filter(function(e){return e.name===t.name}),r="data("+a.stringValue(t.name+s.STORE)+")",o=r+"[0].values";return i.length?n:n.concat({name:t.name,update:r+".length && {"+t.project.map(function(e,t){return e.field+": "+o+"["+t+"]"}).join(", ")+"}"})},modifyExpr:function(e,t){return t.name+s.TUPLE+", "+("global"===t.resolve?"true":"{unit: "+s.unitName(e)+"}")}};n.default=r},{"./multi":84,"./selection":85,"vega-util":10}],87:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var l=e("vega-util"),c=e("../../../util"),u=e("../selection"),s=e("./nearest"),i={has:function(e){return"single"===e.type&&"global"===e.resolve&&e.bind&&"scales"!==e.bind},topLevelSignals:function(e,n,i){var r=n.name,t=n.project,o=n.bind,a=s.default.has(n)?"(item().isVoronoi ? datum.datum : datum)":"datum";return t.forEach(function(e){var t=c.varName(r+"_"+e.field);i.filter(function(e){return e.name===t}).length||i.unshift({name:t,value:"",on:[{events:n.events,update:"datum && item().mark.marktype !== \'group\' ? "+a+c.accessPath(e.field)+" : null"}],bind:o[e.field]||o[e.channel]||o})}),i},signals:function(e,t,n){var i=t.name,r=t.project,o=n.filter(function(e){return e.name===i+u.TUPLE})[0],a=r.map(function(e){return l.stringValue(e.field)}).join(", "),s=r.map(function(e){return c.varName(i+"_"+e.field)});return o.update=s.join(" && ")+" ? {fields: ["+a+"], values: ["+s.join(", ")+"]} : null",delete o.value,delete o.on,n}};n.default=i},{"../../../util":125,"../selection":85,"./nearest":88,"vega-util":10}],88:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var u=e("../../../log"),f=e("../selection"),i={has:function(e){return"interval"!==e.type&&e.nearest},marks:function(i,e,t){var n=f.positionalProjections(e),r=n.x,o=n.y,a=i.mark();if("line"===a||"area"===a)return u.warn(u.message.nearestNotSupportForContinuous(a)),t;var s={name:i.getName("voronoi"),type:"path",from:{data:i.getName("marks")},encode:{enter:{fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0}}},transform:[{type:"voronoi",x:r||!r&&!o?"datum.x":{expr:"0"},y:o||!r&&!o?"datum.y":{expr:"0"},size:[i.getSizeSignalRef("width"),i.getSizeSignalRef("height")]}]},l=0,c=!1;return t.forEach(function(e,t){var n=e.name||"";n===i.component.mark[0].name?l=t:0<=n.indexOf("voronoi")&&(c=!0)}),c||t.splice(l+1,0,s),t}};n.default=i},{"../../../log":110,"../selection":85}],89:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var l=e("../../../log"),c=e("../../../util"),u=e("../../data/timeunit"),i={has:function(e){var t=e;return void 0!==t.fields||void 0!==t.encodings},parse:function(i,e,t){var r={},o={};(e.fields||[]).forEach(function(e){return r[e]=null}),(e.encodings||[]).forEach(function(e){var t=i.fieldDef(e);if(t)if(t.timeUnit){var n=i.vgField(e);r[n]=e,o[n]={as:n,field:t.field,timeUnit:t.timeUnit}}else r[t.field]=e;else l.warn(l.message.cannotProjectOnChannelWithoutField(e))});var n=t.project||(t.project=[]);for(var a in r)r.hasOwnProperty(a)&&n.push({field:a,channel:r[a]});var s=t.fields||(t.fields={});n.filter(function(e){return e.channel}).forEach(function(e){return s[e.channel]=e.field}),c.keys(o).length&&(t.timeUnit=new u.TimeUnitNode(null,o))}};n.default=i},{"../../../log":110,"../../../util":125,"../../data/timeunit":45}],90:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=e("vega-util"),s=e("../../../log"),l=e("../../../scale"),c=e("../selection"),r={has:function(e){return"interval"===e.type&&"global"===e.resolve&&e.bind&&"scales"===e.bind},parse:function(r,e,o){var a=o.scales=[];o.project.forEach(function(e){var t=e.channel,n=r.getScaleComponent(t),i=n?n.get("type"):void 0;n&&l.hasContinuousDomain(i)&&!l.isBinScale(i)?(n.set("domainRaw",{signal:c.channelSignalName(o,t,"data")},!0),a.push(t)):s.warn(s.message.SCALE_BINDINGS_CONTINUOUS)})},topLevelSignals:function(e,n,i){if(!e.parent)return i;var t=n.scales.filter(function(t){return!i.filter(function(e){return e.name===c.channelSignalName(n,t,"data")}).length});return i.concat(t.map(function(e){return{name:c.channelSignalName(n,e,"data")}}))},signals:function(e,n,i){return e.parent&&n.scales.forEach(function(t){var e=i.filter(function(e){return e.name===c.channelSignalName(n,t,"data")})[0];e.push="outer",delete e.value,delete e.update}),i}};n.default=r,n.domain=function(e,t){return"domain("+i.stringValue(e.scaleName(t))+")"}},{"../../../log":110,"../../../scale":115,"../selection":85,"vega-util":10}],91:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var o=e("../selection"),i={has:function(e){return"multi"===e.type&&e.toggle},signals:function(e,t,n){return n.concat({name:t.name+"_toggle",value:!1,on:[{events:t.events,update:t.toggle}]})},modifyExpr:function(e,t,n){var i=t.name+o.TUPLE,r=t.name+"_toggle";return r+" ? null : "+i+", "+("global"===t.resolve?r+" ? null : true, ":r+" ? null : {unit: "+o.unitName(e)+"}, ")+r+" ? "+i+" : null"}};n.default=i},{"../selection":85}],92:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=e("./inputs"),r=e("./nearest"),o=e("./project"),a=e("./scales"),s=e("./toggle"),l=e("./translate"),c=e("./zoom"),u={project:o.default,toggle:s.default,scales:a.default,translate:l.default,zoom:c.default,inputs:i.default,nearest:r.default};n.forEachTransform=function(e,t){for(var n in u)u[n].has(e)&&t(u[n])}},{"./inputs":87,"./nearest":88,"./project":89,"./scales":90,"./toggle":91,"./translate":93,"./zoom":94}],93:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var u=e("vega-event-selector"),h=e("../../../channel"),f=e("../interval"),v=e("../selection"),y=e("./scales"),b="_translate_anchor",O="_translate_delta",i={has:function(e){return"interval"===e.type&&e.translate},signals:function(e,t,n){var i=t.name,r=y.default.has(t),o=i+b,a=v.positionalProjections(t),s=a.x,l=a.y,c=u.selector(t.translate,"scope");return r||(c=c.map(function(e){return e.between[0].markname=i+f.BRUSH,e})),n.push({name:o,value:{},on:[{events:c.map(function(e){return e.between[0]}),update:"{x: x(unit), y: y(unit)"+(null!==s?", extent_x: "+(r?y.domain(e,h.X):"slice("+v.channelSignalName(t,"x","visual")+")"):"")+(null!==l?", extent_y: "+(r?y.domain(e,h.Y):"slice("+v.channelSignalName(t,"y","visual")+")"):"")+"}"}]},{name:i+O,value:{},on:[{events:c,update:"{x: "+o+".x - x(unit), y: "+o+".y - y(unit)}"}]}),null!==s&&d(e,t,h.X,"width",n),null!==l&&d(e,t,h.Y,"height",n),n}};function d(e,t,n,i,r){var o=t.name,a=y.default.has(t),s=r.filter(function(e){return e.name===v.channelSignalName(t,n,a?"data":"visual")})[0],l=o+b,c=o+O,u=e.getSizeSignalRef(i).signal,f=e.getScaleComponent(n),d=f.get("type"),p=a&&n===h.X?"-":"",g=l+".extent_"+n,m=(a?"log"===d?"panLog":"pow"===d?"panPow":"panLinear":"panLinear")+"("+g+", "+(""+p+c+"."+n+" / "+(a?""+u:"span("+g+")"))+(a&&"pow"===d?", "+(f.get("exponent")||1):"")+")";s.on.push({events:{signal:c},update:a?m:"clampRange("+m+", 0, "+u+")"})}n.default=i},{"../../../channel":15,"../interval":83,"../selection":85,"./scales":90,"vega-event-selector":9}],94:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var d=e("vega-event-selector"),p=e("vega-util"),g=e("../../../channel"),m=e("../interval"),h=e("../selection"),v=e("./scales"),y="_zoom_anchor",b="_zoom_delta",i={has:function(e){return"interval"===e.type&&e.zoom},signals:function(e,t,n){var i=t.name,r=v.default.has(t),o=i+b,a=h.positionalProjections(t),s=a.x,l=a.y,c=p.stringValue(e.scaleName(g.X)),u=p.stringValue(e.scaleName(g.Y)),f=d.selector(t.zoom,"scope");return r||(f=f.map(function(e){return e.markname=i+m.BRUSH,e})),n.push({name:i+y,on:[{events:f,update:r?"{"+[c?"x: invert("+c+", x(unit))":"",u?"y: invert("+u+", y(unit))":""].filter(function(e){return!!e}).join(", ")+"}":"{x: x(unit), y: y(unit)}"}]},{name:o,on:[{events:f,force:!0,update:"pow(1.001, event.deltaY * pow(16, event.deltaMode))"}]}),null!==s&&O(e,t,"x","width",n),null!==l&&O(e,t,"y","height",n),n}};function O(e,t,n,i,r){var o=t.name,a=v.default.has(t),s=r.filter(function(e){return e.name===h.channelSignalName(t,n,a?"data":"visual")})[0],l=e.getSizeSignalRef(i).signal,c=e.getScaleComponent(n),u=c.get("type"),f=a?v.domain(e,n):s.name,d=o+b,p=(a?"log"===u?"zoomLog":"pow"===u?"zoomPow":"zoomLinear":"zoomLinear")+"("+f+", "+(""+o+y+"."+n)+", "+d+(a&&"pow"===u?", "+(c.get("exponent")||1):"")+")";s.on.push({events:{signal:d},update:a?p:"clampRange("+p+", 0, "+l+")"})}n.default=i},{"../../../channel":15,"../interval":83,"../selection":85,"./scales":90,"vega-event-selector":9,"vega-util":10}],95:[function(e,t,n){"use strict";var i=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var r=e("../log"),o=e("../util"),a=function(){function e(e,t){void 0===e&&(e={}),void 0===t&&(t={}),this.explicit=e,this.implicit=t}return e.prototype.clone=function(){return new e(o.duplicate(this.explicit),o.duplicate(this.implicit))},e.prototype.combine=function(){return i({},this.explicit,this.implicit)},e.prototype.get=function(e){return void 0!==this.explicit[e]?this.explicit[e]:this.implicit[e]},e.prototype.getWithExplicit=function(e){return void 0!==this.explicit[e]?{explicit:!0,value:this.explicit[e]}:void 0!==this.implicit[e]?{explicit:!1,value:this.implicit[e]}:{explicit:!1,value:void 0}},e.prototype.setWithExplicit=function(e,t){void 0!==t.value&&this.set(e,t.value,t.explicit)},e.prototype.set=function(e,t,n){return delete this[n?"implicit":"explicit"][e],this[n?"explicit":"implicit"][e]=t,this},e.prototype.copyKeyFromSplit=function(e,t){void 0!==t.explicit[e]?this.set(e,t.explicit[e],!0):void 0!==t.implicit[e]&&this.set(e,t.implicit[e],!1)},e.prototype.copyKeyFromObject=function(e,t){void 0!==t[e]&&this.set(e,t[e],!0)},e}();function s(e,t,n,i){return e.explicit&&t.explicit&&r.warn(r.message.mergeConflictingProperty(n,i,e.value,t.value)),e}n.Split=a,n.makeExplicit=function(e){return{explicit:!0,value:e}},n.makeImplicit=function(e){return{explicit:!1,value:e}},n.tieBreakByComparing=function(o){return function(e,t,n,i){var r=o(e.value,t.value);return 0<r?e:r<0?t:s(e,t,n,i)}},n.defaultTieBreaker=s,n.mergeValuesWithExplicit=function(e,t,n,i,r){return void 0===r&&(r=s),void 0===e||void 0===e.value?t:e.explicit&&!t.explicit?e:t.explicit&&!e.explicit?t:o.stringify(e.value)===o.stringify(t.value)?e:r(e,t,n,i)}},{"../log":110,"../util":125}],96:[function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),f=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var a=e("../channel"),o=e("../encoding"),d=e("../encoding"),s=e("../fielddef"),p=e("../mark"),g=e("../stack"),l=e("../util"),c=e("./axis/parse"),m=e("./data/parse"),h=e("./layoutsize/assemble"),v=e("./layoutsize/parse"),y=e("./mark/init"),b=e("./mark/mark"),O=e("./model"),_=e("./repeater"),S=e("./selection/selection"),u=function(u){function e(e,t,n,i,r,o,a){void 0===i&&(i={});var s=u.call(this,e,t,n,o,void 0)||this;s.fit=a,s.type="unit",s.specifiedScales={},s.specifiedAxes={},s.specifiedLegends={},s.specifiedProjection={},s.selection={},s.children=[],s.initSize(f({},i,e.width?{width:e.width}:{},e.height?{height:e.height}:{}));var l=p.isMarkDef(e.mark)?e.mark.type:e.mark,c=s.encoding=d.normalizeEncoding(_.replaceRepeaterInEncoding(e.encoding||{},r),l);return s.markDef=y.normalizeMarkDef(e.mark,c,o),s.stack=g.stack(l,c,s.config.stack),s.specifiedScales=s.initScales(l,c),s.specifiedAxes=s.initAxes(c),s.specifiedLegends=s.initLegend(c),s.specifiedProjection=e.projection,s.selection=e.selection,s}return r(e,u),e.prototype.scaleDomain=function(e){var t=this.specifiedScales[e];return t?t.domain:void 0},e.prototype.sort=function(e){return(this.getMapping()[e]||{}).sort},e.prototype.axis=function(e){return this.specifiedAxes[e]},e.prototype.legend=function(e){return this.specifiedLegends[e]},e.prototype.initScales=function(e,o){return a.SCALE_CHANNELS.reduce(function(e,t){var n,i,r=o[t];return s.isFieldDef(r)?i=(n=r).scale:s.hasConditionalFieldDef(r)?(n=r.condition,i=r.condition.scale):"x"===t?n=s.getFieldDef(o.x2):"y"===t&&(n=s.getFieldDef(o.y2)),n&&(e[t]=i||{}),e},{})},e.prototype.initAxes=function(r){return[a.X,a.Y].reduce(function(e,t){var n=r[t];if(s.isFieldDef(n)||t===a.X&&s.isFieldDef(r.x2)||t===a.Y&&s.isFieldDef(r.y2)){var i=s.isFieldDef(n)?n.axis:null;null!==i&&!1!==i&&(e[t]=f({},i))}return e},{})},e.prototype.initLegend=function(r){return a.NONPOSITION_SCALE_CHANNELS.reduce(function(e,t){var n=r[t];if(n){var i=s.isFieldDef(n)?n.legend:s.hasConditionalFieldDef(n)?n.condition.legend:null;null!==i&&!1!==i&&(e[t]=f({},i))}return e},{})},e.prototype.parseData=function(){this.component.data=m.parseData(this)},e.prototype.parseLayoutSize=function(){v.parseUnitLayoutSize(this)},e.prototype.parseSelection=function(){this.component.selection=S.parseUnitSelection(this,this.selection)},e.prototype.parseMarkGroup=function(){this.component.mark=b.parseMarkGroup(this)},e.prototype.parseAxisAndHeader=function(){this.component.axes=c.parseUnitAxis(this)},e.prototype.assembleSelectionTopLevelSignals=function(e){return S.assembleTopLevelSignals(this,e)},e.prototype.assembleSelectionSignals=function(){return S.assembleUnitSelectionSignals(this,[])},e.prototype.assembleSelectionData=function(e){return S.assembleUnitSelectionData(this,e)},e.prototype.assembleLayout=function(){return null},e.prototype.assembleLayoutSignals=function(){return h.assembleLayoutSignals(this)},e.prototype.assembleMarks=function(){var e=this.component.mark||[];return this.parent&&O.isLayerModel(this.parent)||(e=S.assembleUnitSelectionMarks(this,e)),e.map(this.correctDataNames)},e.prototype.assembleLayoutSize=function(){return{width:this.getSizeSignalRef("width"),height:this.getSizeSignalRef("height")}},e.prototype.getMapping=function(){return this.encoding},e.prototype.toSpec=function(e,t){var n,i=l.duplicate(this.encoding);return n={mark:this.markDef,encoding:i},e||(n.config=l.duplicate(this.config)),t||(n.data=l.duplicate(this.data)),n},e.prototype.mark=function(){return this.markDef.type},e.prototype.channelHasField=function(e){return o.channelHasField(this.encoding,e)},e.prototype.fieldDef=function(e){var t=this.encoding[e];return s.getFieldDef(t)},e}(O.ModelWithField);n.UnitModel=u},{"../channel":15,"../encoding":104,"../fielddef":106,"../mark":112,"../stack":119,"../util":125,"./axis/parse":20,"./data/parse":42,"./layoutsize/assemble":49,"./layoutsize/parse":50,"./mark/init":59,"./mark/mark":61,"./model":69,"./repeater":74,"./selection/selection":85}],97:[function(e,t,b){"use strict";var O=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},_=this&&this.__rest||function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&(n[i[r]]=e[i[r]])}return n};Object.defineProperty(b,"__esModule",{value:!0});var S=e("vega-util"),n=e("../encoding"),E=e("./../encoding"),x=e("./../fielddef"),w=e("./../log"),N=e("./common");function T(e){return!!e.type}b.BOXPLOT="box-plot",b.isBoxPlotDef=T,b.BOXPLOT_STYLES=["boxWhisker","box","boxMid"],b.VL_ONLY_BOXPLOT_CONFIG_PROPERTY_INDEX={box:["size","color","extent"],boxWhisker:["color"],boxMid:["color"]};var i=["x","y","color","detail","opacity","size"];function P(e){return O({},e,{encoding:n.reduce(e.encoding,function(e,t,n){return-1<i.indexOf(n)?e[n]=t:w.warn(w.message.incompatibleChannel(n,b.BOXPLOT)),e},{})})}b.filterUnsupportedChannels=P,b.normalizeBoxPlot=function(e,t){var n=(e=P(e)).mark,i=(e.encoding,e.selection),r=(e.projection,_(e,["mark","encoding","selection","projection"])),o=void 0;S.isNumber(t.box.extent)&&(o=t.box.extent),T(n)&&n.extent&&"min-max"===n.extent&&(o=void 0);var a,s,l,c,u=function(e,t,n){var i=function(e,t){e.mark;var n,i,r=e.encoding;if(e.projection,_(e,["mark","encoding","projection"]),"vertical"===t?(i="y",n=r.y):(i="x",n=r.x),n&&n.aggregate){var o=n.aggregate,a=_(n,["aggregate"]);o!==b.BOXPLOT&&w.warn("Continuous axis should not have customized aggregation function "+o),n=a}return{continuousAxisChannelDef:n,continuousAxis:i}}(e,t),r=i.continuousAxisChannelDef,a=i.continuousAxis,s=e.encoding,o=void 0===n,l=[{op:"q1",field:r.field,as:"lower_box_"+r.field},{op:"q3",field:r.field,as:"upper_box_"+r.field},{op:"median",field:r.field,as:"mid_box_"+r.field}],c=[];l.push({op:"min",field:r.field,as:(o?"lower_whisker_":"min_")+r.field}),l.push({op:"max",field:r.field,as:(o?"upper_whisker_":"max_")+r.field}),o||(c=[{calculate:"datum.upper_box_"+r.field+" - datum.lower_box_"+r.field,as:"iqr_"+r.field},{calculate:"min(datum.upper_box_"+r.field+" + datum.iqr_"+r.field+" * "+n+", datum.max_"+r.field+")",as:"upper_whisker_"+r.field},{calculate:"max(datum.lower_box_"+r.field+" - datum.iqr_"+r.field+" * "+n+", datum.min_"+r.field+")",as:"lower_whisker_"+r.field}]);var u=[],f=[],d=[],p={};return E.forEach(s,function(e,t){if(t!==a)if(x.isFieldDef(e)){if(e.aggregate&&e.aggregate!==b.BOXPLOT)l.push({op:e.aggregate,field:e.field,as:x.vgField(e)});else if(void 0===e.aggregate){var n=x.vgField(e),i=e.bin;if(i){var r=e.field;f.push({bin:i,field:r,as:n})}else if(e.timeUnit){var o=e.timeUnit;r=e.field,d.push({timeUnit:o,field:r,as:n})}u.push(n)}p[t]={field:x.vgField(e),type:e.type}}else p[t]=s[t]}),{transform:[].concat(f,d,[{aggregate:l,groupby:u}],c),continuousAxisChannelDef:r,continuousAxis:a,encodingWithoutContinuousAxis:p}}(e,function(e){var t=e.mark,n=e.encoding;if(e.projection,_(e,["mark","encoding","projection"]),x.isFieldDef(n.x)&&x.isContinuous(n.x)){if(x.isFieldDef(n.y)&&x.isContinuous(n.y)){if(void 0===n.x.aggregate&&n.y.aggregate===b.BOXPLOT)return"vertical";if(void 0===n.y.aggregate&&n.x.aggregate===b.BOXPLOT)return"horizontal";if(n.x.aggregate===b.BOXPLOT&&n.y.aggregate===b.BOXPLOT)throw new Error("Both x and y cannot have aggregate");return T(t)&&t.orient?t.orient:"vertical"}return"horizontal"}if(x.isFieldDef(n.y)&&x.isContinuous(n.y))return"vertical";throw new Error("Need a valid continuous axis for boxplots")}(e),o),f=u.transform,d=u.continuousAxisChannelDef,p=u.continuousAxis,g=u.encodingWithoutContinuousAxis,m=(g.color,g.size),h=_(g,["color","size"]),v=m?{size:m}:N.getMarkSpecificConfigMixins(t.box,"size"),y={};return d.scale&&(y.scale=d.scale),d.axis&&(y.axis=d.axis),O({},r,{transform:f,layer:[{mark:{type:"rule",style:"boxWhisker"},encoding:O((a={},a[p]=O({field:"lower_whisker_"+d.field,type:d.type},y),a[p+"2"]={field:"lower_box_"+d.field,type:d.type},a),h,N.getMarkSpecificConfigMixins(t.boxWhisker,"color"))},{mark:{type:"rule",style:"boxWhisker"},encoding:O((s={},s[p]={field:"upper_box_"+d.field,type:d.type},s[p+"2"]={field:"upper_whisker_"+d.field,type:d.type},s),h,N.getMarkSpecificConfigMixins(t.boxWhisker,"color"))},O({},i?{selection:i}:{},{mark:{type:"bar",style:"box"},encoding:O((l={},l[p]={field:"lower_box_"+d.field,type:d.type},l[p+"2"]={field:"upper_box_"+d.field,type:d.type},l),g,g.color?{}:N.getMarkSpecificConfigMixins(t.box,"color"),v)}),{mark:{type:"tick",style:"boxMid"},encoding:O((c={},c[p]={field:"mid_box_"+d.field,type:d.type},c),h,N.getMarkSpecificConfigMixins(t.boxMid,"color"),v)}]})}},{"../encoding":104,"./../encoding":104,"./../fielddef":106,"./../log":110,"./common":98,"vega-util":10}],98:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.getMarkSpecificConfigMixins=function(e,t){var n,i=e[t];return void 0!==i?((n={})[t]={value:i},n):{}}},{}],99:[function(e,t,n){"use strict";var a=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},s=this&&this.__rest||function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&(n[i[r]]=e[i[r]])}return n};Object.defineProperty(n,"__esModule",{value:!0}),n.ERRORBAR="error-bar",n.normalizeErrorBar=function(e){e.mark,e.selection,e.projection;var t=e.encoding,n=s(e,["mark","selection","projection","encoding"]),i=(t.size,s(t,["size"])),r=(t.x2,t.y2,s(t,["x2","y2"])),o=(r.x,r.y,s(r,["x","y"]));if(!t.x2&&!t.y2)throw new Error("Neither x2 or y2 provided");return a({},n,{layer:[{mark:"rule",encoding:i},{mark:"tick",encoding:r},{mark:"tick",encoding:t.x2?a({x:t.x2,y:t.y},o):a({x:t.x,y:t.y2},o)}]})}},{}],100:[function(e,t,n){"use strict";var i=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var r=e("./../mark"),o=e("./boxplot"),a=e("./errorbar"),s={};function l(e,t){s[e]=t}n.add=l,n.remove=function(e){delete s[e]},n.COMPOSITE_MARK_STYLES=o.BOXPLOT_STYLES,n.VL_ONLY_COMPOSITE_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX=i({},o.VL_ONLY_BOXPLOT_CONFIG_PROPERTY_INDEX),l(o.BOXPLOT,o.normalizeBoxPlot),l(a.ERRORBAR,a.normalizeErrorBar),n.normalize=function(e,t){var n=r.isMarkDef(e.mark)?e.mark.type:e.mark,i=s[n];if(i)return i(e,t);throw new Error(\'Invalid mark type "\'+n+\'"\')}},{"./../mark":112,"./boxplot":97,"./errorbar":99}],101:[function(e,t,n){"use strict";var o=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var y=e("vega-util"),i=e("./compositemark"),r=e("./compositemark/index"),b=e("./guide"),a=e("./legend"),O=e("./mark"),s=e("./mark"),l=e("./scale"),c=e("./selection"),u=e("./title"),_=e("./util");n.defaultViewConfig={width:200,height:200},n.defaultConfig={padding:5,timeFormat:"%b %d, %Y",countTitle:"Number of Records",invalidValues:"filter",view:n.defaultViewConfig,mark:s.defaultMarkConfig,area:{},bar:s.defaultBarConfig,circle:{},geoshape:{},line:{},point:{},rect:{},rule:{color:"black"},square:{},text:{color:"black"},tick:s.defaultTickConfig,box:{size:14,extent:1.5},boxWhisker:{},boxMid:{color:"white"},scale:l.defaultScaleConfig,projection:{},axis:{},axisX:{},axisY:{minExtent:30},axisLeft:{},axisRight:{},axisTop:{},axisBottom:{},axisBand:{},legend:a.defaultLegendConfig,selection:c.defaultConfig,style:{},title:{}},n.initConfig=function(e){return _.mergeDeep(_.duplicate(n.defaultConfig),e)};var S=["view"].concat(O.PRIMITIVE_MARKS,i.COMPOSITE_MARK_STYLES),E=["padding","numberFormat","timeFormat","countTitle","stack","scale","selection","invalidValues","overlay"],x=o({view:["width","height"]},O.VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX,r.VL_ONLY_COMPOSITE_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX);function w(e,t,n){var i="title"===t?u.extractTitleConfig(e.title).mark:e[t];"view"===t&&(n="cell");var r=o({},i,e.style[t]);0<_.keys(r).length&&(e.style[n||t]=r),delete e[t]}n.stripAndRedirectConfig=function(e){e=_.duplicate(e);for(var t=0,n=E;t<n.length;t++)delete e[o=n[t]];if(e.axis)for(var i=0,r=b.VL_ONLY_GUIDE_CONFIG;i<r.length;i++){var o=r[i];delete e.axis[o]}if(e.legend)for(var a=0,s=b.VL_ONLY_GUIDE_CONFIG;a<s.length;a++)o=s[a],delete e.legend[o];if(e.mark)for(var l=0,c=O.VL_ONLY_MARK_CONFIG_PROPERTIES;l<c.length;l++)o=c[l],delete e.mark[o];for(var u=0,f=S;u<f.length;u++){for(var d=f[u],p=0,g=O.VL_ONLY_MARK_CONFIG_PROPERTIES;p<g.length;p++)o=g[p],delete e[d][o];var m=x[d];if(m)for(var h=0,v=m;h<v.length;h++)o=v[h],delete e[d][o];w(e,d)}for(var o in w(e,"title","group-title"),e)y.isObject(e[o])&&0===_.keys(e[o]).length&&delete e[o];return 0<_.keys(e).length?e:void 0}},{"./compositemark":100,"./compositemark/index":100,"./guide":107,"./legend":109,"./mark":112,"./scale":115,"./selection":116,"./title":121,"./util":125,"vega-util":10}],102:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.isUrlData=function(e){return!!e.url},n.isInlineData=function(e){return!!e.values},n.isNamedData=function(e){return!!e.name},n.MAIN="main",n.RAW="raw"},{}],103:[function(e,t,c){"use strict";Object.defineProperty(c,"__esModule",{value:!0});var u=e("vega-util"),f=e("./log"),d=e("./util"),p=2006;c.isDateTime=function(e){return!(!e||!(e.year||e.quarter||e.month||e.date||e.day||e.hours||e.minutes||e.seconds||e.milliseconds))},c.MONTHS=["january","february","march","april","may","june","july","august","september","october","november","december"],c.SHORT_MONTHS=c.MONTHS.map(function(e){return e.substr(0,3)}),c.DAYS=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],c.SHORT_DAYS=c.DAYS.map(function(e){return e.substr(0,3)}),c.dateTimeExpr=function(e,t){void 0===t&&(t=!1);var n=[];if(t&&void 0!==e.day&&1<d.keys(e).length&&(f.warn(f.message.droppedDay(e)),delete(e=d.duplicate(e)).day),void 0!==e.year?n.push(e.year):void 0!==e.day?n.push(p):n.push(0),void 0!==e.month){var i=t?function(e){if(u.isNumber(e))return e-1+"";var t=e.toLowerCase(),n=c.MONTHS.indexOf(t);if(-1!==n)return n+"";var i=t.substr(0,3),r=c.SHORT_MONTHS.indexOf(i);if(-1!==r)return r+"";throw new Error(f.message.invalidTimeUnit("month",e))}(e.month):e.month;n.push(i)}else if(void 0!==e.quarter){var r=t?function(e){if(u.isNumber(e))return 4<e&&f.warn(f.message.invalidTimeUnit("quarter",e)),e-1+"";throw new Error(f.message.invalidTimeUnit("quarter",e))}(e.quarter):e.quarter;n.push(r+"*3")}else n.push(0);if(void 0!==e.date)n.push(e.date);else if(void 0!==e.day){var o=t?function(e){if(u.isNumber(e))return e%7+"";var t=e.toLowerCase(),n=c.DAYS.indexOf(t);if(-1!==n)return n+"";var i=t.substr(0,3),r=c.SHORT_DAYS.indexOf(i);if(-1!==r)return r+"";throw new Error(f.message.invalidTimeUnit("day",e))}(e.day):e.day;n.push(o+"+1")}else n.push(1);for(var a=0,s=["hours","minutes","seconds","milliseconds"];a<s.length;a++){var l=s[a];void 0!==e[l]?n.push(e[l]):n.push(0)}return e.utc?"utc("+n.join(", ")+")":"datetime("+n.join(", ")+")"}},{"./log":110,"./util":125,"vega-util":10}],104:[function(e,t,n){"use strict";var u=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},f=this&&this.__rest||function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&(n[i[r]]=e[i[r]])}return n};Object.defineProperty(n,"__esModule",{value:!0});var d=e("vega-util"),p=e("./channel"),g=e("./fielddef"),m=e("./log"),h=e("./type"),v=e("./util");function r(e,t){var n=e&&e[t];return!!n&&(d.isArray(n)?v.some(n,function(e){return!!e.field}):g.isFieldDef(n)||g.hasConditionalFieldDef(n))}n.channelHasField=r,n.isAggregate=function(i){return v.some(p.CHANNELS,function(e){if(r(i,e)){var t=i[e];if(d.isArray(t))return v.some(t,function(e){return!!e.aggregate});var n=g.getFieldDef(t);return n&&!!n.aggregate}return!1})},n.normalizeEncoding=function(l,c){return v.keys(l).reduce(function(e,n){if(!p.isChannel(n))return m.warn(m.message.invalidEncodingChannel(n)),e;if(!p.supportMark(n,c))return m.warn(m.message.incompatibleChannel(n,c)),e;var t;if("size"===n&&"line"===c&&(i=g.getFieldDef(l[n]))&&i.aggregate)return m.warn(m.message.incompatibleChannel(n,c,"when the field is aggregated.")),e;if("detail"===n||"order"===n)(r=l[n])&&(e[n]=(d.isArray(r)?r:[r]).reduce(function(e,t){return g.isFieldDef(t)?e.push(g.normalizeFieldDef(t,n)):m.warn(m.message.emptyFieldDef(t,n)),e},[]));else{var i,r=l[n];if((i=g.getFieldDef(l[n]))&&v.contains([h.Type.LATITUDE,h.Type.LONGITUDE],i.type)){var o=n,a=(e[o],f(e,["symbol"==typeof o?o:o+""])),s="x"===n?"longitude":"y"===n?"latitude":"x2"===n?"longitude2":"y2"===n?"latitude2":void 0;return m.warn(m.message.latLongDeprecated(n,i.type,s)),u({},a,((t={})[s]=u({},g.normalize(i,n),{type:"quantitative"}),t))}if(!g.isFieldDef(r)&&!g.isValueDef(r)&&!g.isConditionalDef(r))return m.warn(m.message.emptyFieldDef(r,n)),e;e[n]=g.normalize(r,n)}return e},{})},n.isRanged=function(e){return e&&(!!e.x&&!!e.x2||!!e.y&&!!e.y2)},n.fieldDefs=function(n){var i=[];return p.CHANNELS.forEach(function(e){if(r(n,e)){var t=n[e];(d.isArray(t)?t:[t]).forEach(function(e){g.isFieldDef(e)?i.push(e):g.hasConditionalFieldDef(e)&&i.push(e.condition)})}}),i},n.forEach=function(e,n,i){if(e)for(var t=function(t){d.isArray(e[t])?e[t].forEach(function(e){n.call(i,e,t)}):n.call(i,e[t],t)},r=0,o=v.keys(e);r<o.length;r++)t(o[r])},n.reduce=function(i,r,e,o){return i?v.keys(i).reduce(function(e,n){var t=i[n];return d.isArray(t)?t.reduce(function(e,t){return r.call(o,e,t,n)},e):r.call(o,e,t,n)},e):e}},{"./channel":15,"./fielddef":106,"./log":110,"./type":124,"./util":125,"vega-util":10}],105:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0})},{}],106:[function(e,t,n){"use strict";var l=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},c=this&&this.__rest||function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&(n[i[r]]=e[i[r]])}return n};Object.defineProperty(n,"__esModule",{value:!0});var i=e("vega-util"),u=e("./aggregate"),a=e("./bin"),r=e("./channel"),f=e("./log"),d=e("./timeunit"),p=e("./type"),s=e("./util");function o(e){return!!e&&!!e.condition&&!i.isArray(e.condition)&&g(e.condition)}function g(e){return!(!e||!e.field&&"count"!==e.aggregate)}function m(e){return e&&"value"in e&&void 0!==e.value}function h(e){switch(e.type){case"nominal":case"ordinal":case"geojson":return!0;case"quantitative":return!!e.bin;case"latitude":case"longitude":case"temporal":return!1}throw new Error(f.message.invalidFieldType(e.type))}function v(e){return!h(e)}function y(e){return"count"===e.aggregate}function b(e,t){var n=e.field,i=e.bin,r=e.timeUnit,o=e.aggregate;return"count"===o?t.countTitle:i?n+" (binned)":r?n+" ("+d.getTimeUnitParts(r).join("-")+")":o?s.titlecase(o)+" of "+n:n}function O(e,t){var n=e.aggregate||e.timeUnit||e.bin&&"bin";return n?n.toUpperCase()+"("+e.field+")":e.field}n.isConditionalSelection=function(e){return e.selection},n.isRepeatRef=function(e){return e&&!i.isString(e)&&"repeat"in e},n.toFieldDefBase=function(e){var t=e.field,n=e.timeUnit,i=e.bin,r=e.aggregate;return l({},n?{timeUnit:n}:{},i?{bin:i}:{},r?{aggregate:r}:{},{field:t})},n.isConditionalDef=function(e){return!!e&&!!e.condition},n.hasConditionalFieldDef=o,n.hasConditionalValueDef=function(e){return!!e&&!!e.condition&&(i.isArray(e.condition)||m(e.condition))},n.isFieldDef=g,n.isStringFieldDef=function(e){return g(e)&&i.isString(e.field)},n.isValueDef=m,n.isScaleFieldDef=function(e){return!(!e||!e.scale&&!e.sort)},n.vgField=function(e,t){void 0===t&&(t={});var n=e.field,i=t.prefix,r=t.suffix;if(y(e))n="count_*";else{var o=void 0;t.nofn||(e.bin?(o=a.binToString(e.bin),r=t.binSuffix||""):e.aggregate?o=String(t.aggregate||e.aggregate):e.timeUnit&&(o=String(e.timeUnit))),o&&(n=o+"_"+n)}return r&&(n=n+"_"+r),i&&(n=i+"_"+n),t.expr&&(n=""+t.expr+s.accessPath(n)),n},n.isDiscrete=h,n.isContinuous=v,n.isCount=y,n.verbalTitleFormatter=b,n.functionalTitleFormatter=O,n.defaultTitleFormatter=function(e,t){switch(t.fieldTitle){case"plain":return e.field;case"functional":return O(e);default:return b(e,t)}};var _=n.defaultTitleFormatter;function S(e){_=e}function E(e,t){if(e.timeUnit)return"temporal";if(e.bin)return"quantitative";switch(r.rangeType(t)){case"continuous":return"quantitative";case"discrete":case"flexible":return"nominal";default:return"quantitative"}}function x(e,t){if(e.aggregate&&!u.isAggregateOp(e.aggregate)){e.aggregate;var n=c(e,["aggregate"]);f.warn(f.message.invalidAggregate(e.aggregate)),e=n}if(e.timeUnit&&(e=l({},e,{timeUnit:d.normalizeTimeUnit(e.timeUnit)})),e.bin&&(e=l({},e,{bin:w(e.bin,t)})),e.type){var i=p.getFullName(e.type);e.type!==i&&(e=l({},e,{type:i})),"quantitative"!==e.type&&u.isCountingAggregateOp(e.aggregate)&&(f.warn(f.message.invalidFieldTypeForCountAggregate(e.type,e.aggregate)),e=l({},e,{type:"quantitative"}))}else{var r=E(e,t);f.warn(f.message.emptyOrInvalidFieldType(e.type,t,r)),e=l({},e,{type:r})}var o=T(e,t),a=o.compatible,s=o.warning;return a||f.warn(s),e}function w(e,t){return i.isBoolean(e)?{maxbins:a.autoMaxBins(t)}:e.maxbins||e.step?e:l({},e,{maxbins:a.autoMaxBins(t)})}n.setTitleFormatter=S,n.resetTitleFormatter=function(){S(n.defaultTitleFormatter)},n.title=function(e,t){return _(e,t)},n.defaultType=E,n.getFieldDef=function(e){return g(e)?e:o(e)?e.condition:void 0},n.normalize=function(e,t){if(i.isString(e)||i.isNumber(e)||i.isBoolean(e)){var n=i.isString(e)?"string":i.isNumber(e)?"number":"boolean";return f.warn(f.message.primitiveChannelDef(t,n,e)),{value:e}}return g(e)?x(e,t):o(e)?l({},e,{condition:x(e.condition,t)}):e},n.normalizeFieldDef=x,n.normalizeBin=w;var N={compatible:!0};function T(e,t){switch(t){case"row":case"column":return v(e)&&!e.timeUnit?{compatible:!1,warning:f.message.facetChannelShouldBeDiscrete(t)}:N;case"x":case"y":case"color":case"fill":case"stroke":case"text":case"detail":case"key":case"tooltip":case"href":return N;case"longitude":case"longitude2":case"latitude":case"latitude2":return e.type!==p.QUANTITATIVE?{compatible:!1,warning:"Channel "+t+" should not be used with "+e.type+" field."}:N;case"opacity":case"size":case"x2":case"y2":return h(e)&&!e.bin?{compatible:!1,warning:"Channel "+t+" should not be used with discrete field."}:N;case"shape":return"nominal"!==e.type&&"geojson"!==e.type?{compatible:!1,warning:"Shape channel should be used with nominal data or geojson only"}:N;case"order":return"nominal"===e.type?{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}:N}throw new Error("channelCompatability not implemented for channel "+t)}n.channelCompatibility=T,n.isNumberFieldDef=function(e){return"quantitative"===e.type||!!e.bin},n.isTimeFieldDef=function(e){return"temporal"===e.type||!!e.timeUnit}},{"./aggregate":12,"./bin":14,"./channel":15,"./log":110,"./timeunit":120,"./type":124,"./util":125,"vega-util":10}],107:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.VL_ONLY_GUIDE_CONFIG=["shortTimeLabels"]},{}],108:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.aggregate=e("./aggregate"),n.axis=e("./axis"),n.bin=e("./bin"),n.channel=e("./channel"),n.compositeMark=e("./compositemark");var i=e("./compile/compile");n.compile=i.compile,n.config=e("./config"),n.data=e("./data"),n.datetime=e("./datetime"),n.encoding=e("./encoding"),n.facet=e("./facet"),n.fieldDef=e("./fielddef"),n.legend=e("./legend"),n.mark=e("./mark"),n.scale=e("./scale"),n.sort=e("./sort"),n.spec=e("./spec"),n.stack=e("./stack"),n.timeUnit=e("./timeunit"),n.transform=e("./transform"),n.type=e("./type"),n.util=e("./util"),n.validate=e("./validate"),n.version=e("../package.json").version},{"../package.json":11,"./aggregate":12,"./axis":13,"./bin":14,"./channel":15,"./compile/compile":25,"./compositemark":100,"./config":101,"./data":102,"./datetime":103,"./encoding":104,"./facet":105,"./fielddef":106,"./legend":109,"./mark":112,"./scale":115,"./sort":117,"./spec":118,"./stack":119,"./timeunit":120,"./transform":123,"./type":124,"./util":125,"./validate":126}],109:[function(e,t,n){"use strict";var i=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var r=e("./util");n.defaultLegendConfig={};var o={entryPadding:1,format:1,offset:1,orient:1,padding:1,tickCount:1,title:1,type:1,values:1,zindex:1},a=i({},o,{opacity:1,shape:1,stroke:1,fill:1,size:1,encode:1});n.LEGEND_PROPERTIES=r.flagKeys(o),n.VG_LEGEND_PROPERTIES=r.flagKeys(a)},{"./util":125}],110:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i,r=e("vega-util"),o=e("./util"),a=r.logger(r.Warn),s=a,l=function(){function e(){this.warns=[],this.infos=[],this.debugs=[]}return e.prototype.level=function(){return this},e.prototype.warn=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return(e=this.warns).push.apply(e,t),this},e.prototype.info=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return(e=this.infos).push.apply(e,t),this},e.prototype.debug=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return(e=this.debugs).push.apply(e,t),this},e}();function c(){return s=a}n.LocalLogger=l,n.wrap=function(e){return function(){s=new l,e(s),c()}},n.set=function(e){return s=e},n.reset=c,n.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];s.warn.apply(s,arguments)},n.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];s.info.apply(s,arguments)},n.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];s.debug.apply(s,arguments)},(i=n.message||(n.message={})).INVALID_SPEC="Invalid spec",i.FIT_NON_SINGLE=\'Autosize "fit" only works for single views and layered views.\',i.CANNOT_FIX_RANGE_STEP_WITH_FIT=\'Cannot use a fixed value of "rangeStep" when "autosize" is "fit".\',i.cannotProjectOnChannelWithoutField=function(e){return\'Cannot project a selection on encoding channel "\'+e+\'", which has no field.\'},i.nearestNotSupportForContinuous=function(e){return\'The "nearest" transform is not supported for \'+e+" marks."},i.selectionNotFound=function(e){return\'Cannot find a selection named "\'+e+\'"\'},i.SCALE_BINDINGS_CONTINUOUS="Scale bindings are currently only supported for scales with unbinned, continuous domains.",i.noSuchRepeatedValue=function(e){return\'Unknown repeated value "\'+e+\'".\'},i.CONCAT_CANNOT_SHARE_AXIS="Axes cannot be shared in concatenated views.",i.REPEAT_CANNOT_SHARE_AXIS="Axes cannot be shared in repeated views.",i.cannotSetTitleAnchor=function(e){return\'Cannot set title "anchor" for a \'+e+" spec"},i.unrecognizedParse=function(e){return\'Unrecognized parse "\'+e+\'".\'},i.differentParse=function(e,t,n){return\'An ancestor parsed field "\'+e+\'" as \'+n+" but a child wants to parse the field as "+t+"."},i.invalidTransformIgnored=function(e){return"Ignoring an invalid transform: "+o.stringify(e)+"."},i.NO_FIELDS_NEEDS_AS=\'If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the the data from the secondary source.\',i.encodingOverridden=function(e){return"Layer\'s shared "+e.join(",")+" channel "+(1===e.length?"is":"are")+" overriden"},i.projectionOverridden=function(e){var t=e.parentProjection,n=e.projection;return"Layer\'s shared projection "+o.stringify(t)+" is overridden by a child projection "+o.stringify(n)+"."},i.primitiveChannelDef=function(e,t,n){return"Channel "+e+" is a "+t+". Converted to {value: "+o.stringify(n)+"}."},i.invalidFieldType=function(e){return\'Invalid field type "\'+e+\'"\'},i.invalidFieldTypeForCountAggregate=function(e,t){return\'Invalid field type "\'+e+\'" for aggregate: "\'+t+\'", using "quantitative" instead.\'},i.invalidAggregate=function(e){return\'Invalid aggregation operator "\'+e+\'"\'},i.emptyOrInvalidFieldType=function(e,t,n){return\'Invalid field type "\'+e+\'" for channel "\'+t+\'", using "\'+n+\'" instead.\'},i.emptyFieldDef=function(e,t){return"Dropping "+o.stringify(e)+\' from channel "\'+t+\'" since it does not contain data field or value.\'},i.latLongDeprecated=function(e,t,n){return e+"-encoding with type "+t+" is deprecated. Replacing with "+n+"-encoding."},i.incompatibleChannel=function(e,t,n){return e+\' dropped as it is incompatible with "\'+t+\'"\'+(n?" when "+n:"")+"."},i.invalidEncodingChannel=function(e){return e+"-encoding is dropped as "+e+" is not a valid encoding channel."},i.facetChannelShouldBeDiscrete=function(e){return e+" encoding should be discrete (ordinal / nominal / binned)."},i.discreteChannelCannotEncode=function(e,t){return\'Using discrete channel "\'+e+\'" to encode "\'+t+\'" field can be misleading as it does not encode \'+("ordinal"===t?"order":"magnitude")+"."},i.BAR_WITH_POINT_SCALE_AND_RANGESTEP_NULL="Bar mark should not be used with point scale when rangeStep is null. Please use band scale instead.",i.unclearOrientContinuous=function(e){return\'Cannot clearly determine orientation for "\'+e+\'" since both x and y channel encode continuous fields. In this case, we use vertical by default\'},i.unclearOrientDiscreteOrEmpty=function(e){return\'Cannot clearly determine orientation for "\'+e+\'" since both x and y channel encode discrete or empty fields.\'},i.orientOverridden=function(e,t){return\'Specified orient "\'+e+\'" overridden with "\'+t+\'"\'},i.CANNOT_UNION_CUSTOM_DOMAIN_WITH_FIELD_DOMAIN="custom domain scale cannot be unioned with default field-based domain",i.cannotUseScalePropertyWithNonColor=function(e){return\'Cannot use the scale property "\'+e+\'" with non-color channel.\'},i.unaggregateDomainHasNoEffectForRawField=function(e){return"Using unaggregated domain with raw field has no effect ("+o.stringify(e)+")."},i.unaggregateDomainWithNonSharedDomainOp=function(e){return\'Unaggregated domain not applicable for "\'+e+\'" since it produces values outside the origin domain of the source data.\'},i.unaggregatedDomainWithLogScale=function(e){return"Unaggregated domain is currently unsupported for log scale ("+o.stringify(e)+")."},i.cannotUseSizeFieldWithBandSize=function(e){return"Using size field when "+e+"-channel has a band scale is not supported."},i.cannotApplySizeToNonOrientedMark=function(e){return\'Cannot apply size to non-oriented mark "\'+e+\'".\'},i.rangeStepDropped=function(e){return\'rangeStep for "\'+e+\'" is dropped as top-level \'+("x"===e?"width":"height")+" is provided."},i.scaleTypeNotWorkWithChannel=function(e,t,n){return\'Channel "\'+e+\'" does not work with "\'+t+\'" scale. We are using "\'+n+\'" scale instead.\'},i.scaleTypeNotWorkWithFieldDef=function(e,t){return\'FieldDef does not work with "\'+e+\'" scale. We are using "\'+t+\'" scale instead.\'},i.scalePropertyNotWorkWithScaleType=function(e,t,n){return n+"-scale\'s \\""+t+\'" is dropped as it does not work with \'+e+" scale."},i.scaleTypeNotWorkWithMark=function(e,t){return\'Scale type "\'+t+\'" does not work with mark "\'+e+\'".\'},i.mergeConflictingProperty=function(e,t,n,i){return"Conflicting "+t+\' property "\'+e+\'" (\'+o.stringify(n)+" and "+o.stringify(i)+").  Using "+o.stringify(n)+"."},i.independentScaleMeansIndependentGuide=function(e){return\'Setting the scale to be independent for "\'+e+\'" means we also have to set the guide (axis or legend) to be independent.\'},i.conflictedDomain=function(e){return"Cannot set "+e+\'-scale\\\'s "domain" as it is binned. Please use "bin"\\\'s "extent" instead.\'},i.domainSortDropped=function(e){return"Dropping sort property "+o.stringify(e)+" as unioned domains only support boolean or op \'count\'."},i.UNABLE_TO_MERGE_DOMAINS="Unable to merge domains",i.MORE_THAN_ONE_SORT="Domains that should be unioned has conflicting sort properties. Sort will be set to true.",i.INVALID_CHANNEL_FOR_AXIS="Invalid channel for axis.",i.cannotStackRangedMark=function(e){return\'Cannot stack "\'+e+\'" if there is already "\'+e+\'2"\'},i.cannotStackNonLinearScale=function(e){return"Cannot stack non-linear scale ("+e+")"},i.stackNonSummativeAggregate=function(e){return\'Stacking is applied even though the aggregate function is non-summative ("\'+e+\'")\'},i.invalidTimeUnit=function(e,t){return"Invalid "+e+": "+o.stringify(t)},i.dayReplacedWithDate=function(e){return\'Time unit "\'+e+\'" is not supported. We are replacing it with \'+e.replace("day","date")+"."},i.droppedDay=function(e){return"Dropping day from datetime "+o.stringify(e)+" as day cannot be combined with other units."}},{"./util":125,"vega-util":10}],111:[function(e,t,n){"use strict";function s(e){return!!e.or}function l(e){return!!e.and}function c(e){return!!e.not}Object.defineProperty(n,"__esModule",{value:!0}),n.isLogicalOr=s,n.isLogicalAnd=l,n.isLogicalNot=c,n.forEachLeave=function e(t,n){if(c(t))e(t.not,n);else if(l(t))for(var i=0,r=t.and;i<r.length;i++)e(r[i],n);else if(s(t))for(var o=0,a=t.or;o<a.length;o++)e(a[o],n);else n(t)},n.normalizeLogicalOperand=function t(e,n){return c(e)?{not:t(e.not,n)}:l(e)?{and:e.and.map(function(e){return t(e,n)})}:s(e)?{or:e.or.map(function(e){return t(e,n)})}:n(e)}},{}],112:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i,r,o=e("vega-util"),a=e("./util");(r=i=n.Mark||(n.Mark={})).AREA="area",r.BAR="bar",r.LINE="line",r.POINT="point",r.RECT="rect",r.RULE="rule",r.TEXT="text",r.TICK="tick",r.CIRCLE="circle",r.SQUARE="square",r.GEOSHAPE="geoshape",n.AREA=i.AREA,n.BAR=i.BAR,n.LINE=i.LINE,n.POINT=i.POINT,n.TEXT=i.TEXT,n.TICK=i.TICK,n.RECT=i.RECT,n.RULE=i.RULE,n.GEOSHAPE=i.GEOSHAPE,n.CIRCLE=i.CIRCLE,n.SQUARE=i.SQUARE;var s={area:1,bar:1,line:1,point:1,text:1,tick:1,rect:1,geoshape:1,rule:1,circle:1,square:1};function l(e){return e.type}n.isMark=function(e){return!!s[e]},n.PRIMITIVE_MARKS=a.flagKeys(s),n.isMarkDef=l;var c=o.toSet(n.PRIMITIVE_MARKS);n.isPrimitiveMark=function(e){return(l(e)?e.type:e)in c},n.STROKE_CONFIG=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity"],n.FILL_CONFIG=["fill","fillOpacity"],n.FILL_STROKE_CONFIG=[].concat(n.STROKE_CONFIG,n.FILL_CONFIG),n.VL_ONLY_MARK_CONFIG_PROPERTIES=["filled","color"],n.VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX={bar:["binSpacing","continuousBandSize","discreteBandSize"],text:["shortTimeLabels"],tick:["bandSize","thickness"]},n.defaultMarkConfig={color:"#4c78a8"},n.defaultBarConfig={binSpacing:1,continuousBandSize:5},n.defaultTickConfig={thickness:1}},{"./util":125,"vega-util":10}],113:[function(e,t,n){"use strict";var i=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var r=e("vega-util"),o=e("./compile/selection/selection"),a=e("./datetime"),s=e("./fielddef"),l=e("./timeunit"),c=e("./util");function u(e){return e&&e.selection}function f(e){return e&&!!e.field&&void 0!==e.equal}function d(e){return!!(e&&e.field&&r.isArray(e.range)&&2===e.range.length)}function p(e){return e&&!!e.field&&(r.isArray(e.oneOf)||r.isArray(e.in))}function g(e){return p(e)||f(e)||d(e)}function m(t,e){void 0===e&&(e=!0);var n=t.timeUnit?"time("+l.fieldExpr(t.timeUnit,t.field)+")":s.vgField(t,{expr:"datum"});if(f(t))return n+"==="+h(t.equal,t.timeUnit);if(p(t))return"indexof(["+(t.oneOf||t.in).map(function(e){return h(e,t.timeUnit)}).join(",")+"], "+n+") !== -1";if(d(t)){var i=t.range[0],r=t.range[1];if(null!==i&&null!==r&&e)return"inrange("+n+", ["+h(i,t.timeUnit)+", "+h(r,t.timeUnit)+"])";var o=[];return null!==i&&o.push(n+" >= "+h(i,t.timeUnit)),null!==r&&o.push(n+" <= "+h(r,t.timeUnit)),0<o.length?o.join(" && "):"true"}throw new Error("Invalid field predicate: "+JSON.stringify(t))}function h(e,t){if(a.isDateTime(e))return"time("+a.dateTimeExpr(e,!0)+")";if(l.isLocalSingleTimeUnit(t)){var n={};return n[t]=e,"time("+a.dateTimeExpr(n,!0)+")"}return l.isUtcSingleTimeUnit(t)?h(e,l.getLocalTimeUnit(t)):JSON.stringify(e)}n.isSelectionPredicate=u,n.isFieldEqualPredicate=f,n.isFieldRangePredicate=d,n.isFieldOneOfPredicate=p,n.isFieldPredicate=g,n.expression=function(t,e,n){return c.logicalExpr(e,function(e){return r.isString(e)?e:u(e)?o.selectionPredicate(t,e.selection,n):m(e)})},n.fieldFilterExpression=m,n.normalizePredicate=function(e){return g(e)&&e.timeUnit?i({},e,{timeUnit:l.normalizeTimeUnit(e.timeUnit)}):e}},{"./compile/selection/selection":85,"./datetime":103,"./fielddef":106,"./timeunit":120,"./util":125,"vega-util":10}],114:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.PROJECTION_PROPERTIES=["type","clipAngle","clipExtent","center","rotate","precision","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"]},{}],115:[function(e,t,n){"use strict";var i=this&&this.__rest||function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&(n[i[r]]=e[i[r]])}return n};Object.defineProperty(n,"__esModule",{value:!0});var r,o=e("vega-util"),a=e("./channel"),s=e("./log"),l=e("./util");(r=n.ScaleType||(n.ScaleType={})).LINEAR="linear",r.BIN_LINEAR="bin-linear",r.LOG="log",r.POW="pow",r.SQRT="sqrt",r.TIME="time",r.UTC="utc",r.SEQUENTIAL="sequential",r.QUANTILE="quantile",r.QUANTIZE="quantize",r.THRESHOLD="threshold",r.ORDINAL="ordinal",r.BIN_ORDINAL="bin-ordinal",r.POINT="point",r.BAND="band";var c={linear:"numeric",log:"numeric",pow:"numeric",sqrt:"numeric","bin-linear":"bin-linear",time:"time",utc:"time",sequential:"sequential",ordinal:"ordinal","bin-ordinal":"bin-ordinal",point:"ordinal-position",band:"ordinal-position"};n.SCALE_TYPES=l.keys(c),n.scaleCompatible=function(e,t){var n=c[e],i=c[t];return n===i||"ordinal-position"===n&&"time"===i||"ordinal-position"===i&&"time"===n};var u={linear:0,log:1,pow:1,sqrt:1,time:0,utc:0,point:10,band:11,"bin-linear":0,sequential:0,ordinal:0,"bin-ordinal":0};n.scaleTypePrecedence=function(e){return u[e]},n.CONTINUOUS_TO_CONTINUOUS_SCALES=["linear","bin-linear","log","pow","sqrt","time","utc"];var f=o.toSet(n.CONTINUOUS_TO_CONTINUOUS_SCALES);n.CONTINUOUS_DOMAIN_SCALES=n.CONTINUOUS_TO_CONTINUOUS_SCALES.concat(["sequential"]);var d=o.toSet(n.CONTINUOUS_DOMAIN_SCALES);n.DISCRETE_DOMAIN_SCALES=["ordinal","bin-ordinal","point","band"];var p=o.toSet(n.DISCRETE_DOMAIN_SCALES),g=o.toSet(["bin-linear","bin-ordinal"]);function m(e){return e in d}function h(e){return e in f}n.TIME_SCALE_TYPES=["time","utc"],n.hasDiscreteDomain=function(e){return e in p},n.isBinScale=function(e){return e in g},n.hasContinuousDomain=m,n.isContinuousToContinuous=h,n.defaultScaleConfig={textXRangeStep:90,rangeStep:21,pointPadding:.5,bandPaddingInner:.1,facetSpacing:16,minBandSize:2,minFontSize:8,maxFontSize:40,minOpacity:.3,maxOpacity:.8,minSize:9,minStrokeWidth:1,maxStrokeWidth:4},n.isExtendedScheme=function(e){return e&&!!e.name},n.isSelectionDomain=function(e){return e&&e.selection};var v={type:1,domain:1,range:1,rangeStep:1,scheme:1,reverse:1,round:1,clamp:1,nice:1,base:1,exponent:1,interpolate:1,zero:1,padding:1,paddingInner:1,paddingOuter:1};n.SCALE_PROPERTIES=l.flagKeys(v);var y=i(v,["type","domain","range","rangeStep","scheme"]);n.NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES=l.flagKeys(y),n.scaleTypeSupportProperty=function(e,t){switch(t){case"type":case"domain":case"reverse":case"range":return!0;case"scheme":return l.contains(["sequential","ordinal","bin-ordinal","quantile","quantize"],e);case"interpolate":return l.contains(["linear","bin-linear","pow","log","sqrt","utc","time"],e);case"round":return h(e)||"band"===e||"point"===e;case"padding":return h(e)||l.contains(["point","band"],e);case"paddingOuter":case"rangeStep":return l.contains(["point","band"],e);case"paddingInner":return"band"===e;case"clamp":return h(e)||"sequential"===e;case"nice":return h(e)||"sequential"===e||"quantize"===e;case"exponent":return"pow"===e;case"base":return"log"===e;case"zero":return m(e)&&!l.contains(["log","time","utc","bin-linear","threshold","quantile"],e)}throw new Error("Invalid scale property "+t+".")},n.channelScalePropertyIncompatability=function(e,t){switch(t){case"interpolate":case"scheme":return a.isColorChannel(e)?void 0:s.message.cannotUseScalePropertyWithNonColor(e);case"type":case"domain":case"range":case"base":case"exponent":case"nice":case"padding":case"paddingInner":case"paddingOuter":case"rangeStep":case"reverse":case"round":case"clamp":case"zero":return}throw new Error(\'Invalid scale property "\'+t+\'".\')},n.channelSupportScaleType=function(e,t){switch(e){case a.Channel.X:case a.Channel.Y:case a.Channel.SIZE:case a.Channel.OPACITY:return h(t)||l.contains(["band","point"],t);case a.Channel.COLOR:case a.Channel.FILL:case a.Channel.STROKE:return"band"!==t;case a.Channel.SHAPE:return"ordinal"===t}return!1}},{"./channel":15,"./log":110,"./util":125,"vega-util":10}],116:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.SELECTION_ID="_vgsid_",n.defaultConfig={single:{on:"click",fields:[n.SELECTION_ID],resolve:"global",empty:"all"},multi:{on:"click",fields:[n.SELECTION_ID],toggle:"event.shiftKey",resolve:"global",empty:"all"},interval:{on:"[mousedown, window:mouseup] > window:mousemove!",encodings:["x","y"],translate:"[mousedown, window:mouseup] > window:mousemove!",zoom:"wheel!",mark:{fill:"#333",fillOpacity:.125,stroke:"white"},resolve:"global"}}},{}],117:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.isSortField=function(e){return!(!e||"count"!==e.op&&!e.field||!e.op)}},{}],118:[function(e,t,n){"use strict";var A=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},C=this&&this.__rest||function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&(n[i[r]]=e[i[r]])}return n};Object.defineProperty(n,"__esModule",{value:!0});var M=e("./channel"),d=e("./compositemark"),I=e("./encoding"),i=e("./encoding"),F=e("./log"),p=e("./mark"),m=e("./stack"),g=e("./util");function L(e){return void 0!==e.facet}function R(e){return!!e.mark}function U(e){return void 0!==e.layer}function z(e){return void 0!==e.repeat}function r(e){return H(e)||G(e)}function H(e){return void 0!==e.vconcat}function G(e){return void 0!==e.hconcat}function B(e,t){if(L(e))return i=t,r=(n=e).spec,o=C(n,["spec"]),A({},o,{spec:B(r,i)});var n,i,r,o,a,s,l,c,u,f,d,p,g,m,h,v,y,b,O,_,S,E,x,w,N,T,P,D;if(U(e))return function t(e,n,i,r){var o=e.layer,a=e.encoding,s=e.projection,l=C(e,["layer","encoding","projection"]);var c=q({parentEncoding:i,encoding:a});var u=W({parentProjection:r,projection:s});return A({},l,{layer:o.map(function(e){return U(e)?t(e,n,c,u):V(e,n,c,u)})})}(e,t);if(z(e))return s=t,l=(a=e).spec,c=C(a,["spec"]),A({},c,{spec:B(l,s)});if(H(e))return f=t,d=(u=e).vconcat,p=C(u,["vconcat"]),A({},p,{vconcat:d.map(function(e){return B(e,f)})});if(G(e))return m=t,h=(g=e).hconcat,v=C(g,["hconcat"]),A({},v,{hconcat:h.map(function(e){return B(e,m)})});if(R(e)){var k=I.channelHasField(e.encoding,M.ROW),j=I.channelHasField(e.encoding,M.COLUMN);return k||j?(b=t,O=(y=e).encoding,_=O.row,S=O.column,E=C(O,["row","column"]),x=y.mark,w=y.width,N=y.projection,T=y.height,P=y.selection,y.encoding,D=C(y,["mark","width","projection","height","selection","encoding"]),A({},D,{facet:A({},_?{row:_}:{},S?{column:S}:{}),spec:V(A({},N?{projection:N}:{},{mark:x},w?{width:w}:{},T?{height:T}:{},{encoding:E},P?{selection:P}:{}),b)})):V(e,t)}throw new Error(F.message.INVALID_SPEC)}function q(e){var t=e.parentEncoding,n=e.encoding;if(t&&n){var i=g.keys(t).reduce(function(e,t){return n[t]&&e.push(t),e},[]);0<i.length&&F.warn(F.message.encodingOverridden(i))}var r=A({},t||{},n||{});return 0<g.keys(r).length?r:void 0}function W(e){var t=e.parentProjection,n=e.projection;return t&&n&&F.warn(F.message.projectionOverridden({parentProjection:t,projection:n})),n||t}function V(e,t,n,i){var r,o=e.encoding,a=e.projection;if(n||i){var s=W({parentProjection:i,projection:a}),l=q({parentEncoding:n,encoding:o});return V(A({},e,s?{projection:s}:{},l?{encoding:l}:{}),t)}if(r=e,p.isPrimitiveMark(r.mark)){if(I.isRanged(o))return function(e){var t=I.channelHasField(e.encoding,M.X),n=I.channelHasField(e.encoding,M.Y),i=I.channelHasField(e.encoding,M.X2),r=I.channelHasField(e.encoding,M.Y2);if(i&&!t||r&&!n){var o=g.duplicate(e);return i&&!t&&(o.encoding.x=o.encoding.x2,delete o.encoding.x2),r&&!n&&(o.encoding.y=o.encoding.y2,delete o.encoding.y2),o}return e}(e);var c=t&&t.overlay,u=c&&e.mark===p.AREA&&g.contains(["linepoint","line"],c.area),f=c&&(c.line&&e.mark===p.LINE||"linepoint"===c.area&&e.mark===p.AREA);return f||u?function(e,t,n,i){var r,o=e.mark,a=e.selection,s=e.projection,l=e.encoding,c=C(e,["mark","selection","projection","encoding"]),u=[{mark:o,encoding:l}],f=m.stack(o,l,i?i.stack:void 0),d=l;if(f){var p=f.fieldChannel,g=f.offset;d=A({},l,((r={})[p]=A({},l[p],g?{stack:g}:{}),r))}n&&u.push(A({},s?{projection:s}:{},{mark:{type:"line",style:"lineOverlay"}},a?{selection:a}:{},{encoding:d}));t&&u.push(A({},s?{projection:s}:{},{mark:{type:"point",filled:!0,style:"pointOverlay"}},a?{selection:a}:{},{encoding:d}));return A({},c,{layer:u})}(e,f,u,t):e}return d.normalize(e,t)}function o(i,e){return e.forEach(function(n){var e=["field","type","value","timeUnit","bin","aggregate"].reduce(function(e,t){return void 0!==n[t]&&(e[t]=n[t]),e},{}),t=g.hash(e);i[t]=i[t]||n}),i}n.isFacetSpec=L,n.isUnitSpec=R,n.isLayerSpec=U,n.isRepeatSpec=z,n.isConcatSpec=r,n.isVConcatSpec=H,n.isHConcatSpec=G,n.normalize=B,n.fieldDefs=function(e){return g.vals(function t(e,n){return void 0===n&&(n={}),U(e)?e.layer.forEach(function(e){R(e)?o(n,i.fieldDefs(e.encoding)):t(e,n)}):L(e)?(o(n,i.fieldDefs(e.facet)),t(e.spec,n)):z(e)?t(e.spec,n):r(e)?(H(e)?e.vconcat:e.hconcat).forEach(function(e){return t(e,n)}):o(n,i.fieldDefs(e.encoding)),n}(e))},n.isStacked=function(e,t){return t=t||e.config,!!p.isPrimitiveMark(e.mark)&&null!==m.stack(e.mark,e.encoding,t?t.stack:void 0)}},{"./channel":15,"./compositemark":100,"./encoding":104,"./log":110,"./mark":112,"./stack":119,"./util":125}],119:[function(e,t,d){"use strict";Object.defineProperty(d,"__esModule",{value:!0});var p=e("vega-util"),g=e("./aggregate"),m=e("./channel"),h=e("./encoding"),v=e("./fielddef"),y=e("./log"),b=e("./mark"),O=e("./scale"),_=e("./util"),n={zero:1,center:1,normalize:1};function S(e){return!!n[e]}d.isStackOffset=S,d.STACKABLE_MARKS=[b.BAR,b.AREA,b.RULE,b.POINT,b.CIRCLE,b.SQUARE,b.LINE,b.TEXT,b.TICK],d.STACK_BY_DEFAULT_MARKS=[b.BAR,b.AREA],d.stack=function(e,t,n){var i=b.isMarkDef(e)?e.type:e;if(!_.contains(d.STACKABLE_MARKS,i))return null;var r=function(e){var t=e.x,n=e.y;if(v.isFieldDef(t)&&v.isFieldDef(n))if("quantitative"===t.type&&"quantitative"===n.type){if(t.stack)return"x";if(n.stack)return"y";if(!!t.aggregate!=!!n.aggregate)return t.aggregate?"x":"y"}else{if("quantitative"===t.type)return"x";if("quantitative"===n.type)return"y"}else{if(v.isFieldDef(t)&&"quantitative"===t.type)return"x";if(v.isFieldDef(n)&&"quantitative"===n.type)return"y"}}(t);if(!r)return null;var o=t[r],a=v.isStringFieldDef(o)?v.vgField(o,{}):void 0,s="x"===r?"y":"x",l=t[s],c=v.isStringFieldDef(l)?v.vgField(l,{}):void 0,u=m.NONPOSITION_CHANNELS.reduce(function(i,r){if(h.channelHasField(t,r)){var e=t[r];(p.isArray(e)?e:[e]).forEach(function(e){var t=v.getFieldDef(e);if(!t.aggregate){var n=v.isStringFieldDef(t)?v.vgField(t,{}):void 0;(!n||n!==c&&n!==a)&&i.push({channel:r,fieldDef:t})}})}return i},[]);if(0===u.length)return null;var f=void 0;return(f=void 0!==o.stack?o.stack:_.contains(d.STACK_BY_DEFAULT_MARKS,i)&&void 0===n?"zero":n)&&S(f)?o.scale&&o.scale.type&&o.scale.type!==O.ScaleType.LINEAR?(y.warn(y.message.cannotStackNonLinearScale(o.scale.type)),null):h.channelHasField(t,r===m.X?m.X2:m.Y2)?(y.warn(y.message.cannotStackRangedMark(r)),null):(o.aggregate&&!_.contains(g.SUM_OPS,o.aggregate)&&y.warn(y.message.stackNonSummativeAggregate(o.aggregate)),{groupbyChannel:l?s:void 0,fieldChannel:r,impute:_.contains(["area","line"],i),stackBy:u,offset:f}):null}},{"./aggregate":12,"./channel":15,"./encoding":104,"./fielddef":106,"./log":110,"./mark":112,"./scale":115,"./util":125,"vega-util":10}],120:[function(e,t,f){"use strict";var n=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(f,"__esModule",{value:!0});var d,i,a=e("./datetime"),r=e("./log"),s=e("./util");(i=d=f.TimeUnit||(f.TimeUnit={})).YEAR="year",i.MONTH="month",i.DAY="day",i.DATE="date",i.HOURS="hours",i.MINUTES="minutes",i.SECONDS="seconds",i.MILLISECONDS="milliseconds",i.YEARMONTH="yearmonth",i.YEARMONTHDATE="yearmonthdate",i.YEARMONTHDATEHOURS="yearmonthdatehours",i.YEARMONTHDATEHOURSMINUTES="yearmonthdatehoursminutes",i.YEARMONTHDATEHOURSMINUTESSECONDS="yearmonthdatehoursminutesseconds",i.MONTHDATE="monthdate",i.HOURSMINUTES="hoursminutes",i.HOURSMINUTESSECONDS="hoursminutesseconds",i.MINUTESSECONDS="minutesseconds",i.SECONDSMILLISECONDS="secondsmilliseconds",i.QUARTER="quarter",i.YEARQUARTER="yearquarter",i.QUARTERMONTH="quartermonth",i.YEARQUARTERMONTH="yearquartermonth",i.UTCYEAR="utcyear",i.UTCMONTH="utcmonth",i.UTCDAY="utcday",i.UTCDATE="utcdate",i.UTCHOURS="utchours",i.UTCMINUTES="utcminutes",i.UTCSECONDS="utcseconds",i.UTCMILLISECONDS="utcmilliseconds",i.UTCYEARMONTH="utcyearmonth",i.UTCYEARMONTHDATE="utcyearmonthdate",i.UTCYEARMONTHDATEHOURS="utcyearmonthdatehours",i.UTCYEARMONTHDATEHOURSMINUTES="utcyearmonthdatehoursminutes",i.UTCYEARMONTHDATEHOURSMINUTESSECONDS="utcyearmonthdatehoursminutesseconds",i.UTCMONTHDATE="utcmonthdate",i.UTCHOURSMINUTES="utchoursminutes",i.UTCHOURSMINUTESSECONDS="utchoursminutesseconds",i.UTCMINUTESSECONDS="utcminutesseconds",i.UTCSECONDSMILLISECONDS="utcsecondsmilliseconds",i.UTCQUARTER="utcquarter",i.UTCYEARQUARTER="utcyearquarter",i.UTCQUARTERMONTH="utcquartermonth",i.UTCYEARQUARTERMONTH="utcyearquartermonth";var o={year:1,quarter:1,month:1,day:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1};f.TIMEUNIT_PARTS=s.flagKeys(o),f.isLocalSingleTimeUnit=function(e){return!!o[e]};var l={utcyear:1,utcquarter:1,utcmonth:1,utcday:1,utcdate:1,utchours:1,utcminutes:1,utcseconds:1,utcmilliseconds:1};f.isUtcSingleTimeUnit=function(e){return!!l[e]};var c={utcyearquarter:1,utcyearquartermonth:1,utcyearmonth:1,utcyearmonthdate:1,utcyearmonthdatehours:1,utcyearmonthdatehoursminutes:1,utcyearmonthdatehoursminutesseconds:1,utcquartermonth:1,utcmonthdate:1,utchoursminutes:1,utchoursminutesseconds:1,utcminutesseconds:1,utcsecondsmilliseconds:1},u=n({},l,c);function p(e){return!!u[e]}f.isUTCTimeUnit=p,f.getLocalTimeUnit=function(e){return e.substr(3)};var g=n({},o,l,{yearquarter:1,yearquartermonth:1,yearmonth:1,yearmonthdate:1,yearmonthdatehours:1,yearmonthdatehoursminutes:1,yearmonthdatehoursminutesseconds:1,quartermonth:1,monthdate:1,hoursminutes:1,hoursminutesseconds:1,minutesseconds:1,secondsmilliseconds:1},c);f.TIMEUNITS=s.flagKeys(g),f.isTimeUnit=function(e){return!!g[e]};var m={year:"setFullYear",month:"setMonth",date:"setDate",hours:"setHours",minutes:"setMinutes",seconds:"setSeconds",milliseconds:"setMilliseconds",quarter:null,day:null};function h(e,t){var n=m[e];return{setDateMethod:t?"setUTC"+n.substr(3):n,getDateMethod:"get"+(t?"UTC":"")+n.substr(3)}}function v(e,t){var n=e.indexOf(t);return-1<n&&(t!==d.SECONDS||0===n||"i"!==e.charAt(n-1))}f.convert=function(e,t){for(var n=p(e),i=n?new Date(Date.UTC(0,0,1,0,0,0,0)):new Date(0,0,1,0,0,0,0),r=0,o=f.TIMEUNIT_PARTS;r<o.length;r++){var a=o[r];if(v(e,a))switch(a){case d.DAY:throw new Error("Cannot convert to TimeUnits containing \'day\'");case d.QUARTER:var s=h("month",n),l=s.getDateMethod;i[s.setDateMethod](3*Math.floor(t[l]()/3));break;default:var c=h(a,n),u=c.getDateMethod;i[c.setDateMethod](t[u]())}}return i},f.getTimeUnitParts=function(n){return f.TIMEUNIT_PARTS.reduce(function(e,t){return v(n,t)?e.concat(t):e},[])},f.containsTimeUnit=v,f.fieldExpr=function(i,e){var r="datum"+s.accessPath(e),o=p(i)?"utc":"",t=f.TIMEUNIT_PARTS.reduce(function(e,t){var n;return v(i,t)&&(e[t]=(n=t)===d.QUARTER?"("+o+"quarter("+r+")-1)":""+o+n+"("+r+")"),e},{});return a.dateTimeExpr(t)},f.formatExpression=function(e,t,n,i){if(e){var r=[],o="",a=v(e,d.YEAR);v(e,d.QUARTER)&&(o="\'Q\' + quarter("+t+")"),v(e,d.MONTH)&&r.push(!1!==n?"%b":"%B"),v(e,d.DAY)?r.push(n?"%a":"%A"):v(e,d.DATE)&&r.push("%d"+(a?",":"")),a&&r.push(n?"%y":"%Y");var s=[];v(e,d.HOURS)&&s.push("%H"),v(e,d.MINUTES)&&s.push("%M"),v(e,d.SECONDS)&&s.push("%S"),v(e,d.MILLISECONDS)&&s.push("%L");var l=[];return 0<r.length&&l.push(r.join(" ")),0<s.length&&l.push(s.join(":")),0<l.length&&(o&&(o+=" + \' \' + "),o+=i?"utcFormat("+t+", \'"+l.join(" ")+"\')":"timeFormat("+t+", \'"+l.join(" ")+"\')"),o||void 0}},f.normalizeTimeUnit=function(e){return"day"!==e&&0<=e.indexOf("day")?(r.warn(r.message.dayReplacedWithDate(e)),e.replace("day","date")):e}},{"./datetime":103,"./log":110,"./util":125}],121:[function(e,t,n){"use strict";var a=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},s=this&&this.__rest||function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&(n[i[r]]=e[i[r]])}return n};Object.defineProperty(n,"__esModule",{value:!0}),n.extractTitleConfig=function(e){var t=e.anchor,n=e.offset,i=e.orient,r=e.color,o=s(e,["anchor","offset","orient","color"]);return{mark:a({},o,r?{fill:r}:{}),nonMark:a({},t?{anchor:t}:{},n?{offset:n}:{},i?{orient:i}:{})}}},{}],122:[function(e,t,n){"use strict";var r=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(n,"__esModule",{value:!0});var i=e("vega-util"),o=e("./log");function a(e){return i.isString(e)?{type:e}:e||{}}n.normalizeAutoSize=function(e,t,n){void 0===n&&(n=!0);var i=r({type:"pad"},a(t),a(e));return"fit"===i.type&&(n||(o.warn(o.message.FIT_NON_SINGLE),i.type="pad")),i};var s=["background","padding","datasets"];n.extractTopLevelProperties=function(n){return s.reduce(function(e,t){return n&&void 0!==n[t]&&(e[t]=n[t]),e},{})}},{"./log":110,"vega-util":10}],123:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=e("./logical"),r=e("./predicate");function o(e){return void 0!==e.filter}n.isFilter=o,n.isLookup=function(e){return void 0!==e.lookup},n.isCalculate=function(e){return void 0!==e.calculate},n.isBin=function(e){return!!e.bin},n.isTimeUnit=function(e){return void 0!==e.timeUnit},n.isAggregate=function(e){return void 0!==e.aggregate},n.normalizeTransform=function(e){return e.map(function(e){return o(e)?{filter:i.normalizeLogicalOperand(e.filter,r.normalizePredicate)}:e})}},{"./logical":111,"./predicate":113}],124:[function(e,t,n){"use strict";var i,r;Object.defineProperty(n,"__esModule",{value:!0}),(r=i=n.Type||(n.Type={})).QUANTITATIVE="quantitative",r.ORDINAL="ordinal",r.TEMPORAL="temporal",r.NOMINAL="nominal",r.LATITUDE="latitude",r.LONGITUDE="longitude",r.GEOJSON="geojson";var o={quantitative:1,ordinal:1,temporal:1,nominal:1,latitude:1,longitude:1,geojson:1};n.isType=function(e){return!!o[e]},n.QUANTITATIVE=i.QUANTITATIVE,n.ORDINAL=i.ORDINAL,n.TEMPORAL=i.TEMPORAL,n.NOMINAL=i.NOMINAL,n.GEOJSON=i.GEOJSON,n.getFullName=function(e){if(e)switch(e=e.toLowerCase()){case"q":case n.QUANTITATIVE:return"quantitative";case"t":case n.TEMPORAL:return"temporal";case"o":case n.ORDINAL:return"ordinal";case"n":case n.NOMINAL:return"nominal";case i.LATITUDE:return"latitude";case i.LONGITUDE:return"longitude";case n.GEOJSON:return"geojson"}}},{}],125:[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0});var r=e("json-stable-stringify"),a=e("vega-util"),i=e("./logical");function n(e,t){return-1<e.indexOf(t)}function s(e,t){return e.filter(function(e){return!n(t,e)})}function l(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var i=0,r=t;i<r.length;i++){e=c(e,r[i])}return e}function c(e,t){if("object"!=typeof t||null===t)return e;for(var n in t)t.hasOwnProperty(n)&&void 0!==t[n]&&("object"!=typeof t[n]||a.isArray(t[n])||null===t[n]?e[n]=t[n]:"object"!=typeof e[n]||null===e[n]?e[n]=l(a.isArray(t[n].constructor)?[]:{},t[n]):l(e[n],t[n]));return e}function u(e){return JSON.parse(JSON.stringify(e))}o.pick=function(e,t){for(var n={},i=0,r=t;i<r.length;i++){var o=r[i];e.hasOwnProperty(o)&&(n[o]=e[o])}return n},o.omit=function(e,t){for(var n=u(e),i=0,r=t;i<r.length;i++)delete n[r[i]];return n},o.stringify=r,o.hash=function(e){if(a.isNumber(e))return e;var t=a.isString(e)?e:r(e);if(t.length<100)return t;for(var n=0,i=0;i<t.length;i++)n=(n<<5)-n+t.charCodeAt(i),n&=n;return n},o.contains=n,o.without=s,o.union=function(e,t){return e.concat(s(t,e))},o.some=function(e,t){for(var n=0,i=0;i<e.length;i++)if(t(e[i],i,n++))return!0;return!1},o.every=function(e,t){for(var n=0,i=0;i<e.length;i++)if(!t(e[i],i,n++))return!1;return!0},o.flatten=function(e){return[].concat.apply([],e)},o.mergeDeep=l,o.unique=function(e,t){for(var n,i=[],r={},o=0,a=e;o<a.length;o++){var s=a[o];(n=t(s))in r||(r[n]=1,i.push(s))}return i},o.differ=function(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t[n]&&e[n]&&t[n]!==e[n])return!0;return!1},o.hasIntersection=function(e,t){for(var n in e)if(n in t)return!0;return!1},o.isNumeric=function(e){return!isNaN(e)},o.differArray=function(e,t){if(e.length!==t.length)return!0;e.sort(),t.sort();for(var n=0;n<e.length;n++)if(t[n]!==e[n])return!0;return!1},o.keys=Object.keys,o.vals=function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(e[n]);return t},o.flagKeys=function(e){return o.keys(e)},o.duplicate=u,o.isBoolean=function(e){return!0===e||!1===e},o.varName=function(e){var t=e.replace(/\\W/g,"_");return(e.match(/^\\d+/)?"_":"")+t},o.logicalExpr=function t(e,n){return i.isLogicalNot(e)?"!("+t(e.not,n)+")":i.isLogicalAnd(e)?"("+e.and.map(function(e){return t(e,n)}).join(") && (")+")":i.isLogicalOr(e)?"("+e.or.map(function(e){return t(e,n)}).join(") || (")+")":n(e)},o.deleteNestedProperty=function(e,t){for(var n=!0;0<t.length&&n;){for(var i=e,r=0;r<t.length-1;r++)i=i[t[r]];delete i[t.pop()],0!==o.keys(i).length&&(n=!1)}},o.titlecase=function(e){return e.charAt(0).toUpperCase()+e.substr(1)},o.accessPath=function(e){return"["+a.splitAccessPath(e).map(a.stringValue).join("][")+"]"}},{"./logical":111,"json-stable-stringify":1,"vega-util":10}],126:[function(e,t,c){"use strict";Object.defineProperty(c,"__esModule",{value:!0});var n=e("vega-util"),u=e("./mark"),f=e("./mark");c.DEFAULT_REQUIRED_CHANNEL_MAP={text:["text"],line:["x","y"],area:["x","y"]},c.DEFAULT_SUPPORTED_CHANNEL_TYPE={bar:n.toSet(["row","column","x","y","size","color","fill","stroke","detail"]),line:n.toSet(["row","column","x","y","color","fill","stroke","color","detail"]),area:n.toSet(["row","column","x","y","color","fill","stroke","detail"]),tick:n.toSet(["row","column","x","y","color","fill","stroke","detail"]),circle:n.toSet(["row","column","x","y","color","fill","stroke","size","detail"]),square:n.toSet(["row","column","x","y","color","fill","stroke","size","detail"]),point:n.toSet(["row","column","x","y","color","fill","stroke","size","detail","shape"]),geoshape:n.toSet(["row","column","color","fill","stroke","detail","shape"]),text:n.toSet(["row","column","size","color","fill","stroke","text"])},c.getEncodingMappingError=function(e,t,n){void 0===t&&(t=c.DEFAULT_REQUIRED_CHANNEL_MAP),void 0===n&&(n=c.DEFAULT_SUPPORTED_CHANNEL_TYPE);var i=u.isMarkDef(e.mark)?e.mark.type:e.mark,r=e.encoding,o=t[i],a=n[i];for(var s in o)if(!(o[s]in r))return\'Missing encoding channel "\'+o[s]+\'" for mark "\'+i+\'"\';for(var l in r)if(!a[l])return\'Encoding channel "\'+l+\'" is not supported by mark type "\'+i+\'"\';return i!==f.BAR||r.x||r.y?null:"Missing both x and y for bar"}},{"./mark":112,"vega-util":10}],127:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=e("vega-util"),r=e("./util");n.isVgSignalRef=function(e){return!!e.signal},n.isVgRangeStep=function(e){return!!e.step},n.isDataRefUnionedDomain=function(e){return!i.isArray(e)&&"fields"in e&&!("data"in e)},n.isFieldRefUnionDomain=function(e){return!i.isArray(e)&&"fields"in e&&"data"in e},n.isDataRefDomain=function(e){return!i.isArray(e)&&"field"in e&&"data"in e},n.isSignalRefDomain=function(e){return!i.isArray(e)&&"signal"in e};n.VG_MARK_CONFIGS=r.flagKeys({opacity:1,fill:1,fillOpacity:1,stroke:1,strokeWidth:1,strokeOpacity:1,strokeDash:1,strokeDashOffset:1,size:1,shape:1,interpolate:1,tension:1,orient:1,align:1,baseline:1,text:1,limit:1,dx:1,dy:1,radius:1,theta:1,angle:1,font:1,fontSize:1,fontWeight:1,fontStyle:1,cursor:1,href:1})},{"./util":125,"vega-util":10}]},{},[108])(108)});'

# vega-embed-3.2.0.min.js
Canvas._vegaembed = b'!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).vegaEmbed=e()}}(function(){return function(){return function e(t,n,r){function i(u,a){if(!n[u]){if(!t[u]){var s="function"==typeof require&&require;if(!a&&s)return s(u,!0);if(o)return o(u,!0);var c=new Error("Cannot find module \'"+u+"\'");throw c.code="MODULE_NOT_FOUND",c}var l=n[u]={exports:{}};t[u][0].call(l.exports,function(e){var n=t[u][1][e];return i(n||e)},l,l.exports,e,t,n,r)}return n[u].exports}for(var o="function"==typeof require&&require,u=0;u<r.length;u++)i(r[u]);return i}}()({1:[function(e,t,n){var r,i;r=this,i=function(){var e=/^v?(?:\\d+)(\\.(?:[x*]|\\d+)(\\.(?:[x*]|\\d+)(?:-[\\da-z\\-]+(?:\\.[\\da-z\\-]+)*)?(?:\\+[\\da-z\\-]+(?:\\.[\\da-z\\-]+)*)?)?)?$/i,t=/-([0-9A-Za-z-.]+)/;function n(e){var t=e.replace(/^v/,"").split("."),n=t.splice(0,2);return n.push(t.join(".")),n}function r(e){return isNaN(Number(e))?e:Number(e)}function i(t){if("string"!=typeof t)throw new TypeError("Invalid argument expected string");if(!e.test(t))throw new Error("Invalid argument not valid semver")}return function(e,o){[e,o].forEach(i);for(var u=n(e),a=n(o),s=0;s<3;s++){var c=parseInt(u[s]||0,10),l=parseInt(a[s]||0,10);if(c>l)return 1;if(l>c)return-1}if([u[2],a[2]].every(t.test.bind(t))){var f=t.exec(u[2])[1].split(".").map(r),h=t.exec(a[2])[1].split(".").map(r);for(s=0;s<Math.max(f.length,h.length);s++){if(void 0===f[s]||"string"==typeof h[s]&&"number"==typeof f[s])return-1;if(void 0===h[s]||"string"==typeof f[s]&&"number"==typeof h[s])return 1;if(f[s]>h[s])return 1;if(h[s]>f[s])return-1}}else if([u[2],a[2]].some(t.test.bind(t)))return t.test(u[2])?-1:1;return 0}},"object"==typeof n?t.exports=i():r.compareVersions=i()},{}],2:[function(e,t,n){var r;r=this,function(e){"use strict";var t="http://www.w3.org/1999/xhtml",n={svg:"http://www.w3.org/2000/svg",xhtml:t,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function r(e){var t=e+="",r=t.indexOf(":");return r>=0&&"xmlns"!==(t=e.slice(0,r))&&(e=e.slice(r+1)),n.hasOwnProperty(t)?{space:n[t],local:e}:e}function i(e){var n=r(e);return(n.local?function(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}:function(e){return function(){var n=this.ownerDocument,r=this.namespaceURI;return r===t&&n.documentElement.namespaceURI===t?n.createElement(e):n.createElementNS(r,e)}})(n)}function o(){}function u(e){return null==e?o:function(){return this.querySelector(e)}}function a(){return[]}function s(e){return null==e?a:function(){return this.querySelectorAll(e)}}var c=function(e){return function(){return this.matches(e)}};if("undefined"!=typeof document){var l=document.documentElement;if(!l.matches){var f=l.webkitMatchesSelector||l.msMatchesSelector||l.mozMatchesSelector||l.oMatchesSelector;c=function(e){return function(){return f.call(this,e)}}}}var h=c;function p(e){return new Array(e.length)}function d(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}d.prototype={constructor:d,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};var v="$";function g(e,t,n,r,i,o){for(var u,a=0,s=t.length,c=o.length;a<c;++a)(u=t[a])?(u.__data__=o[a],r[a]=u):n[a]=new d(e,o[a]);for(;a<s;++a)(u=t[a])&&(i[a]=u)}function m(e,t,n,r,i,o,u){var a,s,c,l={},f=t.length,h=o.length,p=new Array(f);for(a=0;a<f;++a)(s=t[a])&&(p[a]=c=v+u.call(s,s.__data__,a,t),c in l?i[a]=s:l[c]=s);for(a=0;a<h;++a)(s=l[c=v+u.call(e,o[a],a,o)])?(r[a]=s,s.__data__=o[a],l[c]=null):n[a]=new d(e,o[a]);for(a=0;a<f;++a)(s=t[a])&&l[p[a]]===s&&(i[a]=s)}function y(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function _(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function w(e,t){return e.style.getPropertyValue(t)||_(e).getComputedStyle(e,null).getPropertyValue(t)}function b(e){return e.trim().split(/^|\\s+/)}function x(e){return e.classList||new S(e)}function S(e){this._node=e,this._names=b(e.getAttribute("class")||"")}function A(e,t){for(var n=x(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function E(e,t){for(var n=x(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function N(){this.textContent=""}function O(){this.innerHTML=""}function P(){this.nextSibling&&this.parentNode.appendChild(this)}function L(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function M(){return null}function T(){var e=this.parentNode;e&&e.removeChild(this)}function j(){return this.parentNode.insertBefore(this.cloneNode(!1),this.nextSibling)}function C(){return this.parentNode.insertBefore(this.cloneNode(!0),this.nextSibling)}S.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var V={};(e.event=null,"undefined"!=typeof document)&&("onmouseenter"in document.documentElement||(V={mouseenter:"mouseover",mouseleave:"mouseout"}));function q(e,t,n){return e=z(e,t,n),function(t){var n=t.relatedTarget;n&&(n===this||8&n.compareDocumentPosition(this))||e.call(this,t)}}function z(t,n,r){return function(i){var o=e.event;e.event=i;try{t.call(this,this.__data__,n,r)}finally{e.event=o}}}function D(e){return function(){var t=this.__on;if(t){for(var n,r=0,i=-1,o=t.length;r<o;++r)n=t[r],e.type&&n.type!==e.type||n.name!==e.name?t[++i]=n:this.removeEventListener(n.type,n.listener,n.capture);++i?t.length=i:delete this.__on}}}function B(e,t,n){var r=V.hasOwnProperty(e.type)?q:z;return function(i,o,u){var a,s=this.__on,c=r(t,o,u);if(s)for(var l=0,f=s.length;l<f;++l)if((a=s[l]).type===e.type&&a.name===e.name)return this.removeEventListener(a.type,a.listener,a.capture),this.addEventListener(a.type,a.listener=c,a.capture=n),void(a.value=t);this.addEventListener(e.type,c,n),a={type:e.type,name:e.name,value:t,listener:c,capture:n},s?s.push(a):this.__on=[a]}}function I(e,t,n){var r=_(e),i=r.CustomEvent;"function"==typeof i?i=new i(t,n):(i=r.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}var U=[null];function $(e,t){this._groups=e,this._parents=t}function k(){return new $([[document.documentElement]],U)}function R(e){return"string"==typeof e?new $([[document.querySelector(e)]],[document.documentElement]):new $([[e]],U)}$.prototype=k.prototype={constructor:$,select:function(e){"function"!=typeof e&&(e=u(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o,a,s=t[i],c=s.length,l=r[i]=new Array(c),f=0;f<c;++f)(o=s[f])&&(a=e.call(o,o.__data__,f,s))&&("__data__"in o&&(a.__data__=o.__data__),l[f]=a);return new $(r,this._parents)},selectAll:function(e){"function"!=typeof e&&(e=s(e));for(var t=this._groups,n=t.length,r=[],i=[],o=0;o<n;++o)for(var u,a=t[o],c=a.length,l=0;l<c;++l)(u=a[l])&&(r.push(e.call(u,u.__data__,l,a)),i.push(u));return new $(r,i)},filter:function(e){"function"!=typeof e&&(e=h(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o,u=t[i],a=u.length,s=r[i]=[],c=0;c<a;++c)(o=u[c])&&e.call(o,o.__data__,c,u)&&s.push(o);return new $(r,this._parents)},data:function(e,t){if(!e)return d=new Array(this.size()),l=-1,this.each(function(e){d[++l]=e}),d;var n,r=t?m:g,i=this._parents,o=this._groups;"function"!=typeof e&&(n=e,e=function(){return n});for(var u=o.length,a=new Array(u),s=new Array(u),c=new Array(u),l=0;l<u;++l){var f=i[l],h=o[l],p=h.length,d=e.call(f,f&&f.__data__,l,i),v=d.length,y=s[l]=new Array(v),_=a[l]=new Array(v);r(f,h,y,_,c[l]=new Array(p),d,t);for(var w,b,x=0,S=0;x<v;++x)if(w=y[x]){for(x>=S&&(S=x+1);!(b=_[S])&&++S<v;);w._next=b||null}}return(a=new $(a,i))._enter=s,a._exit=c,a},enter:function(){return new $(this._enter||this._groups.map(p),this._parents)},exit:function(){return new $(this._exit||this._groups.map(p),this._parents)},merge:function(e){for(var t=this._groups,n=e._groups,r=t.length,i=n.length,o=Math.min(r,i),u=new Array(r),a=0;a<o;++a)for(var s,c=t[a],l=n[a],f=c.length,h=u[a]=new Array(f),p=0;p<f;++p)(s=c[p]||l[p])&&(h[p]=s);for(;a<r;++a)u[a]=t[a];return new $(u,this._parents)},order:function(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r,i=e[t],o=i.length-1,u=i[o];--o>=0;)(r=i[o])&&(u&&u!==r.nextSibling&&u.parentNode.insertBefore(r,u),u=r);return this},sort:function(e){function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}e||(e=y);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var u,a=n[o],s=a.length,c=i[o]=new Array(s),l=0;l<s;++l)(u=a[l])&&(c[l]=u);c.sort(t)}return new $(i,this._parents).order()},call:function(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this},nodes:function(){var e=new Array(this.size()),t=-1;return this.each(function(){e[++t]=this}),e},node:function(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,o=r.length;i<o;++i){var u=r[i];if(u)return u}return null},size:function(){var e=0;return this.each(function(){++e}),e},empty:function(){return!this.node()},each:function(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i,o=t[n],u=0,a=o.length;u<a;++u)(i=o[u])&&e.call(i,i.__data__,u,o);return this},attr:function(e,t){var n=r(e);if(arguments.length<2){var i=this.node();return n.local?i.getAttributeNS(n.space,n.local):i.getAttribute(n)}return this.each((null==t?n.local?function(e){return function(){this.removeAttributeNS(e.space,e.local)}}:function(e){return function(){this.removeAttribute(e)}}:"function"==typeof t?n.local?function(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}:function(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}:n.local?function(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}:function(e,t){return function(){this.setAttribute(e,t)}})(n,t))},style:function(e,t,n){return arguments.length>1?this.each((null==t?function(e){return function(){this.style.removeProperty(e)}}:"function"==typeof t?function(e,t,n){return function(){var r=t.apply(this,arguments);null==r?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}:function(e,t,n){return function(){this.style.setProperty(e,t,n)}})(e,t,null==n?"":n)):w(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?function(e){return function(){delete this[e]}}:"function"==typeof t?function(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}:function(e,t){return function(){this[e]=t}})(e,t)):this.node()[e]},classed:function(e,t){var n=b(e+"");if(arguments.length<2){for(var r=x(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each(("function"==typeof t?function(e,t){return function(){(t.apply(this,arguments)?A:E)(this,e)}}:t?function(e){return function(){A(this,e)}}:function(e){return function(){E(this,e)}})(n,t))},text:function(e){return arguments.length?this.each(null==e?N:("function"==typeof e?function(e){return function(){var t=e.apply(this,arguments);this.textContent=null==t?"":t}}:function(e){return function(){this.textContent=e}})(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?O:("function"==typeof e?function(e){return function(){var t=e.apply(this,arguments);this.innerHTML=null==t?"":t}}:function(e){return function(){this.innerHTML=e}})(e)):this.node().innerHTML},raise:function(){return this.each(P)},lower:function(){return this.each(L)},append:function(e){var t="function"==typeof e?e:i(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})},insert:function(e,t){var n="function"==typeof e?e:i(e),r=null==t?M:"function"==typeof t?t:u(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(T)},clone:function(e){return this.select(e?C:j)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,t,n){var r,i,o=function(e){return e.trim().split(/^|\\s+/).map(function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}(e+""),u=o.length;if(!(arguments.length<2)){for(a=t?B:D,null==n&&(n=!1),r=0;r<u;++r)this.each(a(o[r],t,n));return this}var a=this.node().__on;if(a)for(var s,c=0,l=a.length;c<l;++c)for(r=0,s=a[c];r<u;++r)if((i=o[r]).type===s.type&&i.name===s.name)return s.value},dispatch:function(e,t){return this.each(("function"==typeof t?function(e,t){return function(){return I(this,e,t.apply(this,arguments))}}:function(e,t){return function(){return I(this,e,t)}})(e,t))}};var H=0;function J(){return new G}function G(){this._="@"+(++H).toString(36)}function X(){for(var t,n=e.event;t=n.sourceEvent;)n=t;return n}function F(e,t){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,[(r=r.matrixTransform(e.getScreenCTM().inverse())).x,r.y]}var i=e.getBoundingClientRect();return[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]}G.prototype=J.prototype={constructor:G,get:function(e){for(var t=this._;!(t in e);)if(!(e=e.parentNode))return;return e[t]},set:function(e,t){return e[this._]=t},remove:function(e){return this._ in e&&delete e[this._]},toString:function(){return this._}},e.create=function(e){return R(i(e).call(document.documentElement))},e.creator=i,e.local=J,e.matcher=h,e.mouse=function(e){var t=X();return t.changedTouches&&(t=t.changedTouches[0]),F(e,t)},e.namespace=r,e.namespaces=n,e.clientPoint=F,e.select=R,e.selectAll=function(e){return"string"==typeof e?new $([document.querySelectorAll(e)],[document.documentElement]):new $([null==e?[]:e],U)},e.selection=k,e.selector=u,e.selectorAll=s,e.style=w,e.touch=function(e,t,n){arguments.length<3&&(n=t,t=X().changedTouches);for(var r,i=0,o=t?t.length:0;i<o;++i)if((r=t[i]).identifier===n)return F(e,r);return null},e.touches=function(e,t){null==t&&(t=X().touches);for(var n=0,r=t?t.length:0,i=new Array(r);n<r;++n)i[n]=F(e,t[n]);return i},e.window=_,e.customEvent=function(t,n,r,i){var o=e.event;t.sourceEvent=e.event,e.event=t;try{return n.apply(r,i)}finally{e.event=o}},Object.defineProperty(e,"__esModule",{value:!0})}("object"==typeof n&&void 0!==t?n:r.d3=r.d3||{})},{}],3:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(e){var t=/\\/schema\\/([\\w-]+)\\/([\\w\\.\\-]+)\\.json$/g.exec(e).slice(1,3);return{library:t[0],version:t[1]}}},{}],4:[function(e,t,n){(function(t){"use strict";var r=this&&this.__assign||Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e};Object.defineProperty(n,"__esModule",{value:!0});var i=e("compare-versions"),o=e("d3-selection"),u="undefined"!=typeof window?window.vega:void 0!==t?t.vega:null,a="undefined"!=typeof window?window.vl:void 0!==t?t.vl:null,s=e("vega-schema-url-parser"),c=e("./post");n.vega=u,n.vl=a;var l={vega:"Vega","vega-lite":"Vega-Lite"},f={vega:n.vega.version,"vega-lite":n.vl?n.vl.version:"not available"},h={vega:function(e,t){return e},"vega-lite":function(e,t){return n.vl.compile(e,{config:t}).spec}};n.default=function e(t,u,a){try{var p=void 0===(a=a||{}).actions||a.actions,d=a.loader||n.vega.loader(),v=a.renderer||"canvas",g=a.logLevel||n.vega.Warn;if(n.vega.isString(u))return d.load(u).then(function(n){return e(t,JSON.parse(n),a)}).catch(Promise.reject);var m=a.config;if(n.vega.isString(m))return d.load(m).then(function(n){return e(t,u,r({},a,{config:JSON.parse(n)}))}).catch(Promise.reject);var y,_=void 0;u.$schema?(_=s.default(u.$schema),a.mode&&a.mode!==_.library&&console.warn("The given visualization spec is written in "+l[_.library]+", but mode argument sets "+l[a.mode]+"."),y=_.library,i(_.version,f[y])>0&&console.warn("The input spec uses "+y+" "+_.version+", but the current version of "+l[y]+" is "+f[y]+".")):y=a.mode||"vega";var w=h[y](u,m);"vega-lite"===y&&w.$schema&&(_=s.default(w.$schema),i(_.version,f.vega)>0&&console.warn("The compiled spec uses Vega "+_.version+", but current version is "+f.vega+"."));var b=o.select(t).classed("vega-embed",!0).html("");a.onBeforeParse&&(w=a.onBeforeParse(w));var x=n.vega.parse(w,"vega-lite"===y?{}:m),S=new n.vega.View(x,{loader:d,logLevel:g,renderer:v}).initialize(t);if("vega-lite"!==y&&S.hover(),a&&(a.width&&S.width(a.width),a.height&&S.height(a.height),a.padding&&S.padding(a.padding)),S.run(),!1!==p){var A=b.append("div").attr("class","vega-actions");if(!0===p||!1!==p.export){var E="canvas"===v?"png":"svg";A.append("a").text("Export as "+E.toUpperCase()).attr("href","#").attr("target","_blank").attr("download","visualization."+E).on("mousedown",function(){var e=this;S.toImageURL(E).then(function(t){e.href=t}).catch(function(e){throw e}),o.event.preventDefault()})}if(!0!==p&&!1===p.source||A.append("a").text("View Source").attr("href","#").on("click",function(){var e,t,n,r,i,s;e=JSON.stringify(u,null,2),t=a.sourceHeader||"",n=a.sourceFooter||"",r="<html><head>"+t+\'</head><body><pre><code class="json">\',i="</code></pre>"+n+"</body></html>",(s=window.open("")).document.write(r+e+i),s.document.title="Vega JSON Source",o.event.preventDefault()}),!0===p||!1!==p.editor){var N=a.editorUrl||"https://vega.github.io/editor/";A.append("a").text("Open in Vega Editor").attr("href","#").on("click",function(){c.post(window,N,{mode:y,spec:JSON.stringify(u,null,2)}),o.event.preventDefault()})}}return Promise.resolve({view:S,spec:u})}catch(e){return Promise.reject(e)}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./post":6,"compare-versions":1,"d3-selection":2,"vega-schema-url-parser":3}],5:[function(e,t,n){(function(n){"use strict";var r="undefined"!=typeof window?window.vega:void 0!==n?n.vega:null,i="undefined"!=typeof window?window.vl:void 0!==n?n.vl:null,o=e("./embed"),u=o.default;u.default=o.default,u.vega=r,u.vl=i,t.exports=u}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./embed":4}],6:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.post=function(e,t,n){var r=e.open(t),i=250,o=~~(1e4/i);e.addEventListener("message",function t(n){n.source===r&&(o=0,e.removeEventListener("message",t,!1))},!1),setTimeout(function e(){o<=0||(r.postMessage(n,"*"),setTimeout(e,i),o-=1)},i)}},{}]},{},[5])(5)});\n'

if __name__ == "__main__":
    argumentparser = argparse.ArgumentParser(description="VegaScope can be used within Python (import vegascope) or a shell command.")
    argumentparser.add_argument("FILE", nargs="?", default="-", help="file to watch for changes; default is '-' for lines on stdin (stdin requires one JSON object per line)")
    argumentparser.add_argument("-w", "--wait", type=float, default="0.1", help="poll wait time in seconds; default is 0.1 (100 ms); not applicable to stdin")
    argumentparser.add_argument("-t", "--type", default="LocalCanvas", choices=["Canvas", "LocalCanvas", "TunnelCanvas"], help="type of Canvas; default is LocalCanvas")
    argumentparser.add_argument("-T", "--title", default=None, help="browser window title and saved file name prefix")
    argumentparser.add_argument("-b", "--host", default="0.0.0.0", help="host name to bind to; default is 0.0.0.0 for any address (not applicable to LocalCanvas or TunnelVanvas)")
    argumentparser.add_argument("-p", "--port", type=int, default=0, help="port to bind to; default is 0 for any open port")
    argumentparser.add_argument("-q", "--no-verbose", action="store_true", default=False, help="if supplied, do not log output to stdout (opposite of verbose)")
    argumentparser.add_argument("-Q", "--no-newtab", action="store_true", default=False, help="if supplied, do not open a browser window (opposite of newtab, only applicable to LocalCanvas)")

    args = argumentparser.parse_args()

    if args.type == "Canvas":
        canvas = Canvas(title=args.title, host=args.host, port=args.port, verbose=args.verbose)
    elif args.type == "LocalCanvas":
        canvas = LocalCanvas(title=args.title, port=args.port, verbose=(not args.no_verbose), newtab=(not args.no_newtab))
    elif args.type == "TunnelCanvas":
        canvas = TunnelCanvas(title=args.title, port=args.port, verbose=(not args.no_verbose))
    else:
        raise AssertionError(args.type)

    if not args.no_verbose:
        canvas.how()

    if args.FILE == "-":
        while True:
            line = sys.stdin.readline()
            try:
                canvas(json.loads(line))
            except Exception as err:
                sys.stderr.write(str(err))

    else:
        lasttime = None
        while True:
            if os.path.exists(args.FILE) and os.stat(args.FILE).st_mtime != lasttime:
                lasttime = os.stat(args.FILE).st_mtime
                try:
                    canvas(json.load(open(args.FILE)))
                except Exception as err:
                    sys.stderr.write(str(err))
            time.sleep(args.wait)
