From ad713b890456ebd0824c8a4c6c88578bb4a9c6fc Mon Sep 17 00:00:00 2001 From: Michael Zhang Date: Thu, 5 May 2016 17:54:52 -0500 Subject: [PATCH] Remove platform stuff. --- .gitignore | 49 - Vagrantfile | 26 - ctf.nginx | 41 - deploy | 13 - problems/programming/cancer/description.md | 1 - problems/programming/cancer/problem.json | 12 - scripts/gunicorn.py.ini | 4 - scripts/requirements.txt | 9 - scripts/setup.sh | 31 - server/api/__init__.py | 8 - server/api/admin.py | 45 - server/api/decorators.py | 68 - server/api/logger.py | 34 - server/api/models.py | 212 -- server/api/problem.py | 163 -- server/api/schemas.py | 24 - server/api/stats.py | 25 - server/api/team.py | 329 --- server/api/user.py | 334 --- server/api/utils.py | 102 - server/app.py | 120 - server/config.py | 27 - web/css/c3.css | 158 -- web/css/easyctf.css | 31 - web/css/style.css | 192 -- web/fonts/ProximaNova.woff2 | Bin 17997 -> 0 bytes web/fonts/ProximaNovaBold.woff2 | Bin 18009 -> 0 bytes web/images/chat.png | Bin 516 -> 0 bytes web/images/info.png | Bin 466 -> 0 bytes web/images/login.png | Bin 293 -> 0 bytes web/images/problems.png | Bin 592 -> 0 bytes web/images/programming.png | Bin 458 -> 0 bytes web/images/register.png | Bin 461 -> 0 bytes web/images/rules.png | Bin 349 -> 0 bytes web/images/scoreboard.png | Bin 430 -> 0 bytes web/images/terminal.png | Bin 335 -> 0 bytes web/images/updates.png | Bin 466 -> 0 bytes web/includes/meta.html | 35 - web/index.html | 96 - web/js/admin.js | 5 - web/js/admin/problems.old.js | 121 - web/js/c3.min.js | 5 - web/js/d3.v3.min.js | 5 - web/js/easyctf.js | 423 --- web/js/epiceditor.js | 2899 -------------------- web/js/epiceditor.min.js | 5 - web/js/problems.js | 44 - web/js/scoreboard.js | 45 - web/pages/404.html | 5 - web/pages/about.html | 93 - web/pages/admin/problems.html | 71 - web/pages/blank.html | 0 web/pages/chat.html | 6 - web/pages/forgot.html | 92 - web/pages/home.html | 5 - web/pages/learn.html | 0 web/pages/login.html | 54 - web/pages/problems.html | 11 - web/pages/profile.html | 115 - web/pages/programming.html | 11 - web/pages/register.html | 103 - web/pages/rules.html | 43 - web/pages/scoreboard.html | 22 - web/pages/settings.html | 192 -- web/pages/shell.html | 11 - web/pages/team.html | 224 -- web/pages/updates.html | 18 - web/themes/base/epiceditor.css | 70 - web/themes/editor/epic-dark.css | 13 - web/themes/editor/epic-light.css | 12 - web/themes/preview/bartik.css | 167 -- web/themes/preview/github.css | 368 --- web/themes/preview/preview-dark.css | 121 - 73 files changed, 7568 deletions(-) delete mode 100644 .gitignore delete mode 100644 Vagrantfile delete mode 100644 ctf.nginx delete mode 100644 deploy delete mode 100644 problems/programming/cancer/description.md delete mode 100644 problems/programming/cancer/problem.json delete mode 100644 scripts/gunicorn.py.ini delete mode 100644 scripts/requirements.txt delete mode 100644 scripts/setup.sh delete mode 100644 server/api/__init__.py delete mode 100644 server/api/admin.py delete mode 100644 server/api/decorators.py delete mode 100644 server/api/logger.py delete mode 100644 server/api/models.py delete mode 100644 server/api/problem.py delete mode 100644 server/api/schemas.py delete mode 100644 server/api/stats.py delete mode 100644 server/api/team.py delete mode 100644 server/api/user.py delete mode 100644 server/api/utils.py delete mode 100644 server/app.py delete mode 100644 server/config.py delete mode 100644 web/css/c3.css delete mode 100644 web/css/easyctf.css delete mode 100644 web/css/style.css delete mode 100644 web/fonts/ProximaNova.woff2 delete mode 100644 web/fonts/ProximaNovaBold.woff2 delete mode 100644 web/images/chat.png delete mode 100644 web/images/info.png delete mode 100644 web/images/login.png delete mode 100644 web/images/problems.png delete mode 100644 web/images/programming.png delete mode 100644 web/images/register.png delete mode 100644 web/images/rules.png delete mode 100644 web/images/scoreboard.png delete mode 100644 web/images/terminal.png delete mode 100644 web/images/updates.png delete mode 100644 web/includes/meta.html delete mode 100644 web/index.html delete mode 100644 web/js/admin.js delete mode 100644 web/js/admin/problems.old.js delete mode 100644 web/js/c3.min.js delete mode 100644 web/js/d3.v3.min.js delete mode 100644 web/js/easyctf.js delete mode 100644 web/js/epiceditor.js delete mode 100644 web/js/epiceditor.min.js delete mode 100644 web/js/problems.js delete mode 100644 web/js/scoreboard.js delete mode 100644 web/pages/404.html delete mode 100644 web/pages/about.html delete mode 100644 web/pages/admin/problems.html delete mode 100644 web/pages/blank.html delete mode 100644 web/pages/chat.html delete mode 100644 web/pages/forgot.html delete mode 100644 web/pages/home.html delete mode 100644 web/pages/learn.html delete mode 100644 web/pages/login.html delete mode 100644 web/pages/problems.html delete mode 100644 web/pages/profile.html delete mode 100644 web/pages/programming.html delete mode 100644 web/pages/register.html delete mode 100644 web/pages/rules.html delete mode 100644 web/pages/scoreboard.html delete mode 100644 web/pages/settings.html delete mode 100644 web/pages/shell.html delete mode 100644 web/pages/team.html delete mode 100644 web/pages/updates.html delete mode 100644 web/themes/base/epiceditor.css delete mode 100644 web/themes/editor/epic-dark.css delete mode 100644 web/themes/editor/epic-light.css delete mode 100644 web/themes/preview/bartik.css delete mode 100644 web/themes/preview/github.css delete mode 100644 web/themes/preview/preview-dark.css diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 3052973..0000000 --- a/.gitignore +++ /dev/null @@ -1,49 +0,0 @@ -.vagrant -.secret_key -.bundle/config -logs/ -files/ -pfp/ - -# Object files -*.o -*.ko -*.obj -*.elf - -# Precompiled Headers -*.gch -*.pch - -# Libraries -*.lib -*.a -*.la -*.lo - -# Shared objects (inc. Windows DLLs) -*.dll -*.so -*.so.* -*.dylib - -# Text Backup Files # -*.s[a-w][a-z] -*~ -\#*\# -.\#* - -# OS X Files # -.DS_Store -._* -.Spotlight* -.Trashes - -# Windows Files # -Thumbs.db -ehthumbs.db - -a.out -*.project -*.class -*.pyc diff --git a/Vagrantfile b/Vagrantfile deleted file mode 100644 index 5d5c108..0000000 --- a/Vagrantfile +++ /dev/null @@ -1,26 +0,0 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : - -Vagrant.configure(2) do |config| - config.vm.box = "ubuntu/trusty64" - # config.vm.box_check_update = false - - config.vm.network :forwarded_port, guest: 80, host: 8080, auto_correct: true - config.vm.network :forwarded_port, guest: 8000, host: 8000, auto_correct: true - config.vm.network :forwarded_port, guest: 27017, host: 27017, auto_correct: true - - config.vm.synced_folder "server", "/home/vagrant/server" - config.vm.synced_folder "scripts", "/home/vagrant/scripts" - config.vm.synced_folder "web", "/srv/http/ctf" - - config.vm.provision :shell, :path => "scripts/setup.sh" - config.ssh.forward_agent = true - - config.vm.provider "virtualbox" do |vb| - vb.customize ["modifyvm", :id, "--memory", "2048"] - end - config.vm.provider :virtualbox do |vb| - vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] - vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"] - end -end diff --git a/ctf.nginx b/ctf.nginx deleted file mode 100644 index 81b7abc..0000000 --- a/ctf.nginx +++ /dev/null @@ -1,41 +0,0 @@ -server { - listen 80 default_server; - listen [::]:80 default_server ipv6only=on; - sendfile off; - - root /srv/http/ctf; - index index.html index.htm; - - server_name localhost; - error_page 404 /index.html; - - # location / { - # try_files $uri $uri/ =404; - # } - - # Put all the pages here so Angular doesn't fail. - location ~^/(about|chat|help|learn|login|logout|profile|register|scoreboard|settings|team|forgot)$ { - default_type text/html; - try_files /index.html /index.html; - } - location ~^/admin/(problems|settings|stats|teams)$ { - default_type text/html; - try_files /index.html /index.html; - } - location ~^/(profile|team|forgot)/(.*)$ { - default_type text/html; - try_files /index.html /index.html; - } - - location /static { - alias /srv/http/static; - } - - location ~ /api { - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_pass http://localhost:8000; - proxy_redirect off; - } -} diff --git a/deploy b/deploy deleted file mode 100644 index 04bce76..0000000 --- a/deploy +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -echo "Stopping the server..." -pkill gunicorn -sudo service nginx stop -tmux kill-session -t ctf 2> /dev/null - -sudo cp /vagrant/ctf.nginx /etc/nginx/sites-enabled/ctf - -echo "Starting the server..." -cd /home/vagrant/server -sudo service nginx start -tmux new-session -s ctf -d 'tmux set remain-on-exit on && gunicorn "app:app" -c /home/vagrant/scripts/gunicorn.py.ini' \ No newline at end of file diff --git a/problems/programming/cancer/description.md b/problems/programming/cancer/description.md deleted file mode 100644 index 01077f5..0000000 --- a/problems/programming/cancer/description.md +++ /dev/null @@ -1 +0,0 @@ -Help! I started growing this array culture, but it outgrew its petri dish! Using standard array syntax (either JavaScript or Python), indicate which element of the array contains the value ${value}. \ No newline at end of file diff --git a/problems/programming/cancer/problem.json b/problems/programming/cancer/problem.json deleted file mode 100644 index 1820e3b..0000000 --- a/problems/programming/cancer/problem.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "pid": "cancer", - "title": "Cancer", - "hint": "No hint!", - "category": "Miscellaneous", - "autogen": true, - "programming": false, - "value": 100, - "bonus": 0, - "threshold": 0, - "weightmap": { } -} \ No newline at end of file diff --git a/scripts/gunicorn.py.ini b/scripts/gunicorn.py.ini deleted file mode 100644 index d8cdb2c..0000000 --- a/scripts/gunicorn.py.ini +++ /dev/null @@ -1,4 +0,0 @@ -from multiprocessing import cpu_count - -bind = "0.0.0.0:8000" -workers = cpu_count() * 2 + 1 diff --git a/scripts/requirements.txt b/scripts/requirements.txt deleted file mode 100644 index 103f3bf..0000000 --- a/scripts/requirements.txt +++ /dev/null @@ -1,9 +0,0 @@ -Flask -mysql-python -Flask-SQLAlchemy -SQLAlchemy -gunicorn -requests -voluptuous -Pillow -markdown2 \ No newline at end of file diff --git a/scripts/setup.sh b/scripts/setup.sh deleted file mode 100644 index 0d46ac4..0000000 --- a/scripts/setup.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -MYSQL_ROOT_PASSWORD="i_hate_passwords" - -echo "Updating system..." -apt-get -y update -apt-get -y upgrade - -echo "Preparing for MySQL installation..." -sudo debconf-set-selections <<< "mysql-server mysql-server/root_password password $MYSQL_ROOT_PASSWORD" -sudo debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $MYSQL_ROOT_PASSWORD" - -echo "Installing dependencies..." -apt-get -y install python -apt-get -y install python-pip libjpeg-dev -apt-get -y install python-dev libmysqlclient-dev -apt-get -y install nginx -apt-get -y install mysql-server -apt-get -y install tmux - -echo "Installing pip dependencies..." -pip install -r /vagrant/scripts/requirements.txt - -echo "PATH=$PATH:/vagrant" >> /etc/profile -source /etc/profile -cp /vagrant/ctf.nginx /etc/nginx/sites-enabled/ctf -rm /etc/nginx/sites-*/default - -sudo service nginx restart - -mysql -u root -p"$MYSQL_ROOT_PASSWORD" -e "CREATE DATABASE easyctf;" diff --git a/server/api/__init__.py b/server/api/__init__.py deleted file mode 100644 index 4c362a8..0000000 --- a/server/api/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -import admin -import logger -import models -import problem -import user -import stats -import team -import utils diff --git a/server/api/admin.py b/server/api/admin.py deleted file mode 100644 index 14bc52a..0000000 --- a/server/api/admin.py +++ /dev/null @@ -1,45 +0,0 @@ -from flask import Blueprint, jsonify -from decorators import admins_only, api_wrapper -from models import db, Problems, Files -from schemas import verify_to_schema, check - -import cPickle as pickle - -blueprint = Blueprint("admin", __name__) - -@blueprint.route("/problems/list", methods=["GET"]) -@api_wrapper -@admins_only -def problem_data(): - problems = Problems.query.order_by(Problems.value).all() - problems_return = [ ] - for problem in problems: - problems_return.append({ - "pid": problem.pid, - "title": problem.title, - "category": problem.category, - "description": problem.description, - "hint": problem.hint, - "value": problem.value, - "threshold": problem.threshold, - "weightmap": problem.weightmap - }) - problems_return.sort(key=lambda prob: prob["value"]) - return { "success": 1, "problems": problems_return } - -""" -@blueprint.route("/problems/submit", methods=["POST"]) -@api_wrapper -@admins_only -def problem_submit(): - params = utils.flat_multi(request.form) - verify_to_schema(UserSchema, params) - - title = params.get("title") - -ProblemSubmissionSchema = Schema({ - Required("title"): check( - ([str, Length(min=4, max=64)], "The title should be between 4 and 64 characters long."), - ), -}, extra=True) -""" \ No newline at end of file diff --git a/server/api/decorators.py b/server/api/decorators.py deleted file mode 100644 index 8730dc1..0000000 --- a/server/api/decorators.py +++ /dev/null @@ -1,68 +0,0 @@ -from functools import wraps -from flask import abort, request, session, make_response - -import json -import traceback - -import utils - -class WebException(Exception): pass -class InternalException(Exception): pass -response_header = { "Content-Type": "application/json; charset=utf-8" } - -def api_wrapper(f): - @wraps(f) - def wrapper(*args, **kwds): - if request.method == "POST": - try: - token = str(session.pop("csrf_token")) - provided_token = str(request.form.get("csrf_token")) - if not token or token != provided_token: - raise Exception - except Exception, e: - response = make_response(json.dumps({ "success": 0, "message": "Token has been tampered with." }), 403, response_header) - token = utils.generate_string() - response.set_cookie("csrf_token", token) - session["csrf_token"] = token - return response - - web_result = {} - response = 200 - try: - web_result = f(*args, **kwds) - except WebException as error: - response = 200 - web_result = { "success": 0, "message": str(error) } - except Exception as error: - response = 200 - traceback.print_exc() - web_result = { "success": 0, "message": "Something went wrong! Please notify us about this immediately.", "error": [ str(error), traceback.format_exc() ] } - result = (json.dumps(web_result), response, response_header) - response = make_response(result) - - # Setting CSRF token - if "csrf_token" not in session: - token = utils.generate_string() - response.set_cookie("csrf_token", token) - session["csrf_token"] = token - - return response - return wrapper - -def login_required(f): - @wraps(f) - def decorated_function(*args, **kwargs): - if not user.is_logged_in(): - return { "success": 0, "message": "Not logged in." } - return f(*args, **kwargs) - return decorated_function - -import user # Must go below api_wrapper to prevent import loops - -def admins_only(f): - @wraps(f) - def decorated_function(*args, **kwargs): - if not user.is_admin(): - return { "success": 0, "message": "Not authorized." } - return f(*args, **kwargs) - return decorated_function diff --git a/server/api/logger.py b/server/api/logger.py deleted file mode 100644 index 1d886b7..0000000 --- a/server/api/logger.py +++ /dev/null @@ -1,34 +0,0 @@ -import datetime -import logging -import logging.handlers -import os -import pkgutil - -import api - -NOTSET = 0 -DEBUG = 10 -INFO = 20 -WARNING = 30 -ERROR = 40 -CRITICAL = 50 - -def initialize_logs(): - def create_logger(name): - new_logger = logging.getLogger(name) - new_logger.setLevel(logging.INFO) - - base = os.path.dirname(__file__).strip("api") - log_path = os.path.join(base, "logs") - if not os.path.exists(log_path): - os.mkdir(log_path) - - log_handler = logging.handlers.RotatingFileHandler(os.path.join(log_path, name + ".log")) - new_logger.addHandler(log_handler) - for importer, modname, ispkg in pkgutil.walk_packages(path="../api"): - create_logger(modname) - -def log(logname, message, level=INFO): - logger = logging.getLogger(logname) - message = "[%s] %s" % (datetime.datetime.now().strftime("%m/%d/%Y %X"), message) - logger.log(level, message) \ No newline at end of file diff --git a/server/api/models.py b/server/api/models.py deleted file mode 100644 index 3270b09..0000000 --- a/server/api/models.py +++ /dev/null @@ -1,212 +0,0 @@ -from flask.ext.sqlalchemy import SQLAlchemy - -import time -import traceback -import utils -import cPickle as pickle - -db = SQLAlchemy() - -class Users(db.Model): - uid = db.Column(db.Integer, unique=True, primary_key=True) - tid = db.Column(db.Integer) - name = db.Column(db.String(64)) - username = db.Column(db.String(64), unique=True) - username_lower = db.Column(db.String(64), unique=True) - email = db.Column(db.String(64), unique=True) - password = db.Column(db.String(128)) - admin = db.Column(db.Boolean) - utype = db.Column(db.Integer) - tid = db.Column(db.Integer) - registertime = db.Column(db.Integer) - reset_token = db.Column(db.String(64)) - - def __init__(self, name, username, email, password, utype=1): - self.name = name - self.username = username - self.username_lower = username.lower() - self.email = email.lower() - self.password = utils.hash_password(password) - self.utype = utype - self.admin = False - self.registertime = int(time.time()) - - def get_invitations(self): - invitations = db.session.query(TeamInvitations).filter_by(rtype=0, toid=self.uid).all() - result = [ ] - for inv in invitations: - team = db.session.query(Teams).filter_by(tid=inv.frid).first() - result.append({ - "team": team.teamname, - "tid": team.tid - }) - return result - -class Teams(db.Model): - tid = db.Column(db.Integer, primary_key=True) - teamname = db.Column(db.String(64), unique=True) - teamname_lower = db.Column(db.String(64), unique=True) - school = db.Column(db.Text) - owner = db.Column(db.Integer) - observer = db.Column(db.Boolean) - - def __init__(self, teamname, school, owner, observer): - self.teamname = teamname - self.teamname_lower = teamname.lower() - self.school = school - self.owner = owner - self.observer = observer - - def get_members(self): - members = [ ] - for member in Users.query.filter_by(tid=self.tid).all(): - members.append({ - "username": member.username, - "name": member.name, - "captain": member.uid == self.owner, - "type": member.utype, - "admin": member.admin == True, - "observer": member.utype == 3 - }) - return members - - def points(self): - """ TODO: Implement scoring with Bonus Points """ - return 0 - - def place(self, ranked=True): - # score = db.func.sum(Problems.value).label("score") - # quickest = db.func.max(Solves.date).label("quickest") - # teams = db.session.query(Solves.tid).join(Teams).join(Problems).filter().group_by(Solves.tid).order_by(score.desc(), quickest).all() - teams = [ self.tid ] - try: - i = teams.index((self.tid,)) + 1 - k = i % 10 - return (i, "%d%s" % (i, "tsnrhtdd"[(i / 10 % 10 != 1) * (k < 4) * k::4])) - except ValueError: - return (-1, "--") - - def get_invitation_requests(self, frid=None): - if frid is not None: - req = db.session.query(TeamInvitations).filter_by(rtype=1, frid=frid, toid=self.tid).first() - if req is None: - return None - else: - user = db.session.query(Users).filter_by(uid=req.frid).first() - return { "username": user.username, "name": user.name, "uid": user.uid } - result = [ ] - requests = db.session.query(TeamInvitations).filter_by(rtype=1, toid=self.tid).all() - for req in requests: - user = db.session.query(Users).filter_by(uid=req.frid).first() - result.append({ - "username": user.username, - "name": user.name, - "uid": user.uid - }) - return result - - def get_pending_invitations(self, toid=None): - if toid is not None: - invitation = db.session.query(TeamInvitations).filter_by(rtype=0, frid=self.tid, toid=toid).first() - if invitation is None: - return None - else: - user = db.session.query(Users).filter_by(uid=invitation.toid).first() - return { "username": user.username, "name": user.name, "uid": user.uid } - result = [ ] - invitations = db.session.query(TeamInvitations).filter_by(rtype=0, frid=self.tid).all() - for invitation in invitations: - user = db.session.query(Users).filter_by(uid=invitation.toid).first() - result.append({ - "username": user.username, - "name": user.name, - "uid": user.uid - }) - return result - - def is_observer(self): - members = self.get_members() - for member in members: - if member["observer"] == True or member["admin"] == True: - return True - return False - -class Problems(db.Model): - pid = db.Column(db.String(128), primary_key=True, autoincrement=False) - title = db.Column(db.String(128)) - category = db.Column(db.String(128)) - description = db.Column(db.Text) - value = db.Column(db.Integer) - hint = db.Column(db.Text) - autogen = db.Column(db.Boolean) - bonus = db.Column(db.Integer) - threshold = db.Column(db.Integer) - weightmap = db.Column(db.PickleType) - - def __init__(self, pid, title, category, description, value, hint="", autogen=False, bonus=0, threshold=0, weightmap={}): - self.pid = pid - self.title = title - self.category = category - self.description = description - self.value = value - self.hint = hint - self.autogen = autogen - self.bonus = bonus - self.threshold = threshold - self.weightmap = weightmap - -class Files(db.Model): - fid = db.Column(db.Integer, primary_key=True) - pid = db.Column(db.Integer) - location = db.Column(db.Text) - - def __init__(self, pid, location): - self.pid = pid - self.location = location - -class Solves(db.Model): - __table_args__ = (db.UniqueConstraint("pid", "tid"), {}) - sid = db.Column(db.Integer, primary_key=True) - pid = db.Column(db.Integer) - tid = db.Column(db.Integer) - date = db.Column(db.Integer, default=utils.get_time_since_epoch()) - correct = db.Column(db.Boolean) - flag = db.Column(db.Text) - - def __init__(self, pid, tid, flag, correct): - self.pid = pid - self.tid = tid - self.flag = flag - self.correct = correct - -class LoginTokens(db.Model): - sid = db.Column(db.String(64), unique=True, primary_key=True) - uid = db.Column(db.Integer) - username = db.Column(db.String(32)) - active = db.Column(db.Boolean) - issued = db.Column(db.Integer) - expiry = db.Column(db.Integer) - ua = db.Column(db.String(128)) - ip = db.Column(db.String(16)) - - def __init__(self, uid, username, expiry=int(time.time()), active=True, ua=None, ip=None): - self.sid = utils.generate_string() - self.uid = uid - self.username = username - self.issued = int(time.time()) - self.expiry = expiry - self.active = active - self.ua = ua - self.ip = ip - -class TeamInvitations(db.Model): - rid = db.Column(db.Integer, primary_key=True) - rtype = db.Column(db.Integer) - frid = db.Column(db.Integer) - toid = db.Column(db.Integer) - date = db.Column(db.Integer, default=utils.get_time_since_epoch()) - - def __init__(self, rtype, frid, toid): - self.rtype = rtype - self.frid = frid - self.toid = toid diff --git a/server/api/problem.py b/server/api/problem.py deleted file mode 100644 index 8e410a4..0000000 --- a/server/api/problem.py +++ /dev/null @@ -1,163 +0,0 @@ -import hashlib -import logger -import os - -from flask import Blueprint, jsonify, session, request -from flask import current_app as app -from werkzeug import secure_filename - -from models import db, Files, Problems, Solves, Teams -from decorators import admins_only, api_wrapper, login_required, InternalException, WebException - -blueprint = Blueprint("problem", __name__) - -@blueprint.route("/add", methods=["POST"]) -@admins_only -@api_wrapper -def problem_add(): - name = request.form["name"] - category = request.form["category"] - description = request.form["description"] - hint = request.form["problem-hint"] - flag = request.form["flag"] - value = request.form["value"] - - name_exists = Problems.query.filter_by(name=name).first() - if name_exists: - raise WebException("Problem name already taken.") - problem = Problems(name, category, description, hint, flag, value) - db.session.add(problem) - db.session.commit() - - files = request.files.getlist("files[]") - for _file in files: - filename = secure_filename(_file.filename) - - if len(filename) == 0: - continue - - file_path = os.path.join(app.config["UPLOAD_FOLDER"], filename) - - _file.save(file_path) - db_file = Files(problem.pid, "/".join(file_path.split("/")[2:])) - db.session.add(db_file) - - db.session.commit() - - return { "success": 1, "message": "Success!" } - -@blueprint.route("/delete", methods=["POST"]) -@admins_only -@api_wrapper -def problem_delete(): - pid = request.form["pid"] - problem = Problems.query.filter_by(pid=pid).first() - if problem: - Solves.query.filter_by(pid=pid).delete() - Problems.query.filter_by(pid=pid).delete() - db.session.commit() - return { "success": 1, "message": "Success!" } - raise WebException("Problem does not exist!") - -@blueprint.route("/update", methods=["POST"]) -@admins_only -@api_wrapper -def problem_update(): - pid = request.form["pid"] - name = request.form["name"] - category = request.form["category"] - description = request.form["description"] - hint = request.form["hint"] - flag = request.form["flag"] - disabled = request.form.get("disabled", 0) - value = request.form["value"] - - problem = Problems.query.filter_by(pid=pid).first() - if problem: - problem.name = name - problem.category = category - problem.description = description - problem.hint = hint - problem.flag = flag - problem.disabled = disabled - problem.value = value - - db.session.add(problem) - db.session.commit() - - return { "success": 1, "message": "Success!" } - raise WebException("Problem does not exist!") - -@blueprint.route("/submit", methods=["POST"]) -@api_wrapper -@login_required -def problem_submit(): - pid = request.form["pid"] - flag = request.form["flag"] - tid = session["tid"] - - problem = Problems.query.filter_by(pid=pid).first() - team = Teams.query.filter_by(tid=tid).first() - if problem: - if flag == problem.flag: - solve = Solves(pid, tid) - team.score += problem.value - problem.solves += 1 - db.session.add(solve) - db.session.add(team) - db.session.add(problem) - db.session.commit() - - logger.log(__name__, logger.WARNING, "%s has solved %s by submitting %s" % (team.name, problem.name, flag)) - return { "success": 1, "message": "Correct!" } - - else: - logger.log(__name__, logger.WARNING, "%s has incorrectly submitted %s to %s" % (team.name, flag, problem.name)) - raise WebException("Incorrect.") - - else: - raise WebException("Problem does not exist!") - -@blueprint.route("/data", methods=["POST"]) -#@api_wrapper # Disable atm due to json serialization issues: will fix -@login_required -def problem_data(): - problems = Problems.query.add_columns("pid", "name", "category", "description", "hint", "value", "solves").order_by(Problems.value).filter_by(disabled=False).all() - jason = [] - - for problem in problems: - problem_files = [ str(_file.location) for _file in Files.query.filter_by(pid=int(problem.pid)).all() ] - jason.append({"pid": problem[1], "name": problem[2] ,"category": problem[3], "description": problem[4], "hint": problem[5], "value": problem[6], "solves": problem[7], "files": problem_files}) - - return jsonify(data=jason) - -def insert_problem(data, force=False): - with app.app_context(): - if len(list(get_problem(pid=data["pid"]).all())) > 0: - if force == True: - _problem = Problems.query.filter_by(pid=data["pid"]).first() - db.session.delete(_problem) - db.session.commit() - else: - raise InternalException("Problem already exists.") - - insert = Problems(data["pid"], data["title"], data["category"], data["description"], data["value"]) - if "hint" in data: insert.hint = data["hint"] - if "autogen" in data: insert.autogen = data["autogen"] - if "bonus" in data: insert.bonus = data["bonus"] - if "threshold" in data: insert.threshold = data["threshold"] - if "weightmap" in data: insert.weightmap = data["weightmap"] - db.session.add(insert) - db.session.commit() - - return True - -def get_problem(title=None, pid=None): - match = {} - if title != None: - match.update({ "title": title }) - elif pid != None: - match.update({ "pid": pid }) - with app.app_context(): - result = Problems.query.filter_by(**match) - return result \ No newline at end of file diff --git a/server/api/schemas.py b/server/api/schemas.py deleted file mode 100644 index 1648950..0000000 --- a/server/api/schemas.py +++ /dev/null @@ -1,24 +0,0 @@ -import api -import re - -from voluptuous import Required, Length, Schema, Invalid, MultipleInvalid -from decorators import WebException - -def check(*callback_tuples): - def v(value): - for callbacks, msg in callback_tuples: - for callback in callbacks: - try: - result = callback(value) - if not result and type(result) == bool: - raise Invalid(msg) - except Exception: - raise WebException(msg) - return value - return v - -def verify_to_schema(schema, data): - try: - schema(data) - except MultipleInvalid as error: - raise WebException(str(error)) \ No newline at end of file diff --git a/server/api/stats.py b/server/api/stats.py deleted file mode 100644 index 1b9c88f..0000000 --- a/server/api/stats.py +++ /dev/null @@ -1,25 +0,0 @@ -from flask import Blueprint, request, session -from flask import current_app as app - -from decorators import api_wrapper - -import team - -blueprint = Blueprint("stats", __name__) - -@blueprint.route("/scoreboard") -@api_wrapper -def all_teams_stats(): - teams = team.get_team().all() - result = [ ] - count = 0 - for _team in teams: - count += 1 - result.append({ - "rank": count, - "teamname": _team.teamname, - "tid": _team.tid, - "school": _team.school, - "points": _team.points() - }) - return { "success": 1, "scoreboard": result } \ No newline at end of file diff --git a/server/api/team.py b/server/api/team.py deleted file mode 100644 index cbde6be..0000000 --- a/server/api/team.py +++ /dev/null @@ -1,329 +0,0 @@ -from flask import Blueprint, request, session -from flask import current_app as app -from voluptuous import Schema, Length, Required - -from models import db, Teams, Users, TeamInvitations -from decorators import api_wrapper, login_required, WebException -from schemas import verify_to_schema, check - -import user -import utils - -blueprint = Blueprint("team", __name__) - -############### -# TEAM ROUTES # -############### - -@blueprint.route("/create", methods=["POST"]) -@api_wrapper -@login_required -def team_create(): - params = utils.flat_multi(request.form) - _user = user.get_user().first() - if (_user.tid is not None and _user.tid >= 0) or get_team(owner=_user.uid).first() is not None: - raise WebException("You're already in a team!") - - verify_to_schema(TeamSchema, params) - teamname = params.get("teamname") - school = params.get("school") - - team = Teams(teamname, school, _user.uid, _user.utype != 1) - tid = team.tid - with app.app_context(): - db.session.add(team) - db.session.commit() - Users.query.filter_by(uid=_user.uid).update({ "tid": team.tid }) - db.session.commit() - db.session.close() - - session["tid"] = team.tid - return { "success": 1, "message": "Success!" } - -@blueprint.route("/delete", methods=["POST"]) -@api_wrapper -@login_required -def team_delete(): - username = session["username"] - tid = session["tid"] - team = Teams.query.filter_by(tid=tid).first() - usr = Users.query.filter_by(username=username).first() - owner = team.owner - if usr.uid == owner or usr.admin: - with app.app_context(): - for member in Users.query.filter_by(tid=tid).all(): - member.tid = -1 - db.session.add(member) - db.session.delete(team) - db.session.commit() - db.session.close() - session.pop("tid") - return { "success": 1, "message": "Success!" } - else: - raise WebException("Not authorized.") - -@blueprint.route("/remove_member", methods=["POST"]) -@api_wrapper -@login_required -def team_remove_member(): - username = session["username"] - tid = session["tid"] - team = Teams.query.filter_by(tid=tid).first() - usr = Users.query.filter_by(username=username).first() - owner = team.owner - if usr.uid == owner or usr.admin: - params = utils.flat_multi(request.form) - user_to_remove = Users.query.filter_by(username=params.get("user")) - user_to_remove.tid = -1 - with app.app_context(): - db.session.add(user_to_remove) - db.session.commit() - db.session.close() - return { "success": 1, "message": "Success!" } - else: - raise WebException("Not authorized.") - -@blueprint.route("/invite", methods=["POST"]) -@api_wrapper -@login_required -def team_invite(): - params = utils.flat_multi(request.form) - _user = user.get_user().first() - if not user.in_team(_user): - raise WebException("You must be in a team!") - _team = get_team(tid=_user.tid).first() - if _user.uid != _team.owner: - raise WebException("You must be the captain of your team to invite members!") - - new_member = params.get("new_member") - if new_member is None: - raise WebException("Please provide a username!") - _user2 = user.get_user(username_lower=new_member.lower()).first() - if _user2 is None: - raise WebException("User doesn't exist!") - if _user2.tid > 0: - raise WebException("This user is already a part of a team!") - - if _team.get_pending_invitations(toid=_user2.uid) is not None: - raise WebException("You've already invited this member!") - - req = TeamInvitations(0, _team.tid, _user2.uid) - with app.app_context(): - db.session.add(req) - db.session.commit() - db.session.close() - - return { "success": 1, "message": "Success!" } - -@blueprint.route("/invite/rescind", methods=["POST"]) -@api_wrapper -@login_required -def team_invite_rescind(): - params = utils.flat_multi(request.form) - _user = user.get_user().first() - if not user.in_team(_user): - raise WebException("You must be in a team!") - _team = get_team(tid=_user.tid).first() - if _user.uid != _team.owner: - raise WebException("You must be the captain of your team to rescind invitations!") - - uid = params.get("uid") - if uid is None: - raise WebException("Please provide a user.") - invitation = TeamInvitations.query.filter_by(rtype=0, frid=_team.tid, toid=uid).first() - if invitation is None: - raise WebException("Invitation doesn't exist.") - - with app.app_context(): - db.session.delete(invitation) - db.session.commit() - db.session.close() - - return { "success": 1, "message": "Success!" } - -@blueprint.route("/invite/request", methods=["POST"]) -@api_wrapper -@login_required -def team_invite_request(): - params = utils.flat_multi(request.form) - _user = user.get_user().first() - if user.in_team(_user): - raise WebException("You're already in a team!") - - tid = params.get("tid") - _team = get_team(tid=tid).first() - if _team is None: - raise WebException("Team not found.") - - if _team.get_invitation_requests(frid=_user.uid) is not None: - raise WebException("You've already requested to join this team!") - - req = TeamInvitations(1, _user.uid, _team.tid) - with app.app_context(): - db.session.add(req) - db.session.commit() - db.session.close() - - return { "success": 1, "message": "Success!" } - -@blueprint.route("/invite/accept", methods=["POST"]) -@api_wrapper -def team_accept_invite(): - params = utils.flat_multi(request.form) - _user = user.get_user().first() - if user.in_team(_user): - raise WebException("You're already in a team!") - - tid = params.get("tid") - _team = get_team(tid=tid).first() - if _team is None: - raise WebException("Team not found.") - - if len(_team.get_members()) >= 5: - raise WebException("This team is full.") - - invitation = TeamInvitations.query.filter_by(rtype=0, frid=tid, toid=_user.uid).first() - if invitation is None: - raise WebException("Invitation doesn't exist.") - - with app.app_context(): - _user = Users.query.filter_by(uid=_user.uid).first() - _user.tid = tid - db.session.delete(invitation) - invitation2 = TeamInvitations.query.filter_by(rtype=1, frid=_user.uid, toid=tid).first() - if invitation2 is not None: - db.session.delete(invitation2) - db.session.commit() - db.session.close() - - return { "success": 1, "message": "Success!" } - -@blueprint.route("/invite/request/accept", methods=["POST"]) -@api_wrapper -def team_accept_invite_request(): - params = utils.flat_multi(request.form) - _user = user.get_user().first() - if not user.in_team(_user): - raise WebException("You must be in a team!") - _team = get_team(tid=_user.tid).first() - tid = _team.tid - if _user.uid != _team.owner: - raise WebException("You must be the captain of your team to rescind invitations!") - - if len(_team.get_members()) >= 5: - raise WebException("Your team is full.") - - uid = params.get("uid") - _user2 = user.get_user(uid=uid).first() - if user.in_team(_user2): - raise WebException("This user is already in a team!") - - invitation = TeamInvitations.query.filter_by(rtype=1, frid=_user2.uid, toid=tid).first() - if invitation is None: - raise WebException("Invitation doesn't exist.") - - with app.app_context(): - _user2 = Users.query.filter_by(uid=_user2.uid).first() - _user2.tid = tid - db.session.delete(invitation) - invitation2 = TeamInvitations.query.filter_by(rtype=0, frid=tid, toid=_user2.uid).first() - if invitation2 is not None: - db.session.delete(invitation2) - db.session.commit() - db.session.close() - - return { "success": 1, "message": "Success!" } - -@blueprint.route("/info", methods=["GET"]) -@api_wrapper -def team_info(): - logged_in = user.is_logged_in() - in_team = False - owner = False - _user = None - teamdata = { } - search = { } - teamname = utils.flat_multi(request.args).get("teamname") - if teamname: - search.update({ "teamname_lower": teamname.lower() }) - if logged_in: - _user = user.get_user().first() - if user.in_team(_user): - if "teamname_lower" not in search: - search.update({ "tid": _user.tid }) - in_team = True - if bool(search) != False: - team = get_team(**search).first() - teamdata = get_team_info(**search) - if logged_in: - in_team = teamdata["tid"] == _user.tid - owner = teamdata["captain"] == _user.uid - teamdata["in_team"] = in_team - if in_team: - teamdata["is_owner"] = owner - if owner: - teamdata["pending_invitations"] = team.get_pending_invitations() - teamdata["invitation_requests"] = team.get_invitation_requests() - else: - if logged_in: - teamdata["invited"] = team.get_pending_invitations(toid=_user.uid) is not None - teamdata["requested"] = team.get_invitation_requests(frid=_user.uid) is not None - else: - if logged_in: - teamdata["invitations"] = _user.get_invitations() - return { "success": 1, "team": teamdata } - -################## -# TEAM FUNCTIONS # -################## - -__check_teamname = lambda teamname: get_team(teamname_lower=teamname.lower()).first() is None - -TeamSchema = Schema({ - Required("teamname"): check( - ([str, Length(min=4, max=32)], "Your teamname should be between 4 and 32 characters long."), - ([utils.__check_ascii], "Please only use ASCII characters in your teamname."), - ([__check_teamname], "This teamname is taken, did you forget your password?") - ), - Required("school"): check( - ([str, Length(min=4, max=40)], "Your school name should be between 4 and 40 characters long."), - ([utils.__check_ascii], "Please only use ASCII characters in your school name."), - ), -}, extra=True) - -def get_team_info(tid=None, teamname=None, teamname_lower=None, owner=None): - team = get_team(tid=tid, teamname=teamname, teamname_lower=teamname_lower, owner=owner).first() - if team is None: - raise WebException("Team not found.") - - place_number, place = team.place() - result = { - "tid": team.tid, - "teamname": team.teamname, - "school": team.school, - "place": place, - "place_number": place_number, - "points": team.points(), - "members": team.get_members(), - "captain": team.owner, - "observer": team.is_observer() - } - return result - -def get_team(tid=None, teamname=None, teamname_lower=None, owner=None): - match = {} - if teamname != None: - match.update({ "teamname": teamname }) - elif teamname_lower != None: - match.update({ "teamname_lower": teamname_lower }) - elif tid != None: - match.update({ "tid": tid }) - elif owner != None: - match.update({ "owner": owner }) - elif user.is_logged_in(): - _user = user.get_user().first() - if _user.tid is not None: - match.update({ "tid": _user.tid }) - with app.app_context(): - result = Teams.query.filter_by(**match) - return result diff --git a/server/api/user.py b/server/api/user.py deleted file mode 100644 index 93b56b1..0000000 --- a/server/api/user.py +++ /dev/null @@ -1,334 +0,0 @@ -from flask import Blueprint, make_response, session, request, redirect, url_for, send_file, abort -from werkzeug import secure_filename -from flask import current_app as app -from voluptuous import Schema, Length, Required - -from models import db, LoginTokens, Users -from decorators import api_wrapper, WebException -from schemas import verify_to_schema, check - -import datetime -import logger, logging -import os -import re -import requests -import team -import utils - -from PIL import Image - -############### -# USER ROUTES # -############### - -blueprint = Blueprint("user", __name__) - -@blueprint.route("/forgot", methods=["POST"]) -@blueprint.route("/forgot/", methods=["GET", "POST"]) -@api_wrapper -def user_forgot_password(token=None): - params = utils.flat_multi(request.form) - if token is not None: - user = get_user(reset_token=token).first() - if user is None: - raise WebException("Invalid reset token.") - - # We are viewing the actual reset form - if request.method == "GET": - return { "success": 1, "message": ""} - - # Submission of actual reset form - if request.method == "POST": - password = params.get("password") - confirm_password = params.get("confirm_password") - if password != confirm_password: - raise WebException("Passwords do not match.") - else: - user.password = utils.hash_password(password) - user.reset_token = None - current_session = db.session.object_session(user) - current_session.add(user) - current_session.commit() - return { "success": 1, "message": "Success!" } - else: - email = params.get("email").lower() - - user = get_user(email=email).first() - if user is None: - raise WebException("User with that email does not exist.") - - token = utils.generate_string(length=64) - user.reset_token = token - current_session = db.session.object_session(user) - current_session.add(user) - current_session.commit() - - reset_link = "%s/forgot/%s" % ("127.0.0.1:8000", token) - subject = "EasyCTF password reset" - body = """%s,\n\nA request to reset your EasyCTF password has been made. If you did not request this password reset, you may safely ignore this email and delete it.\n\nYou may reset your password by clicking this link or pasting it to your browser.\n\n%s\n\nThis link can only be used once, and will lead you to a page where you can reset your password.\n\nGood luck!\n\n- The EasyCTF Team""" % (user.username, reset_link) - response = utils.send_email(email, subject, body).json() - if "Queued" in response["message"]: - return { "success": 1, "message": "Email sent to %s" % email } - else: - raise WebException(response["message"]) - -@blueprint.route("/register", methods=["POST"]) -@api_wrapper -def user_register(): - params = utils.flat_multi(request.form) - - name = params.get("name") - email = params.get("email") - username = params.get("username") - password = params.get("password") - password_confirm = params.get("password_confirm") - utype = int(params.get("type")) - - if password != password_confirm: - raise WebException("Passwords do not match.") - verify_to_schema(UserSchema, params) - - user = Users(name, username, email, password, utype) - with app.app_context(): - db.session.add(user) - db.session.commit() - utils.generate_identicon(email, user.uid) - - logger.log(__name__, "%s registered with %s" % (name.encode("utf-8"), email.encode("utf-8"))) - login_user(username, password) - - return { "success": 1, "message": "Success!" } - -@blueprint.route("/logout", methods=["GET"]) -@api_wrapper -def user_logout(): - sid = session["sid"] - username = session["username"] - with app.app_context(): - expired = LoginTokens.query.filter_by(username=username).all() - for expired_token in expired: db.session.delete(expired_token) - db.session.commit() - session.clear() - -@blueprint.route("/login", methods=["POST"]) -@api_wrapper -def user_login(): - params = utils.flat_multi(request.form) - - username = params.get("username") - password = params.get("password") - - result = login_user(username, password) - if result != True: - raise WebException("Please check if your username/password are correct.") - - return { "success": 1, "message": "Success!" } - -@blueprint.route("/status", methods=["GET"]) -@api_wrapper -def user_status(): - logged_in = is_logged_in() - result = { - "success": 1, - "logged_in": logged_in, - "admin": is_admin(), - "competition": is_admin(), - "in_team": in_team(get_user()), - "username": session["username"] if logged_in else "", - } - if logged_in: - result["has_team"] = in_team(get_user().first()) - - return result - -@blueprint.route("/info", methods=["GET"]) -@api_wrapper -def user_info(): - logged_in = is_logged_in() - username = utils.flat_multi(request.args).get("username") - if username is None: - if logged_in: - username = session["username"] - if username is None: - raise WebException("No user specified.") - me = False if not("username" in session) else username.lower() == session["username"].lower() - user = get_user(username_lower=username.lower()).first() - if user is None: - raise WebException("User not found.") - - show_email = me if logged_in else False - user_in_team = in_team(user) - userdata = { - "user_found": True, - "name": user.name, - "username": user.username, - "type": ["Student", "Instructor", "Observer"][user.utype - 1], - "admin": user.admin, - "registertime": datetime.datetime.fromtimestamp(user.registertime).isoformat() + "Z", - "me": me, - "show_email": show_email, - "in_team": user_in_team, - "uid": user.uid - } - if show_email: - userdata["email"] = user.email - if user_in_team: - userdata["team"] = team.get_team_info(tid=user.tid) - if me and not(user_in_team): - invitations = user.get_invitations() - userdata["invitations"] = invitations - return { "success": 1, "user": userdata } - -@blueprint.route("/avatar/", methods=["GET"]) -def user_avatar(uid): - uid = int(uid) - try: - return send_file("pfp/%d.png" % uid, mimetype="image/png") - except: - user = get_user(uid=uid).first() - if user is not None: - utils.generate_identicon(user.email, user.uid) - return send_file("pfp/%d.png" % uid, mimetype="image/png") - return abort(404) - -@blueprint.route("/avatar/upload", methods=["POST"]) -@api_wrapper -def user_avatar_upload(): - logged_in = is_logged_in() - if not logged_in: - raise WebException("You're not logged in.") - - _user = get_user().first() - f = request.files["file"] - if f is None: - raise WebException("Please upload something.") - - fname = "/tmp/" + secure_filename(utils.generate_string()) - f.save(fname) - - try: - pfp = "pfp/%d.png" % _user.uid - os.remove(pfp) - im = Image.open(fname) - im = im.resize((256, 256), Image.ANTIALIAS) - im.save(open(pfp, "w"), "PNG") - return { "success": 1, "message": "Uploaded!" } - except Exception, e: - raise WebException(str(e)) - -@blueprint.route("/avatar/remove", methods=["POST"]) -@api_wrapper -def user_avatar_remove(): - logged_in = is_logged_in() - if not logged_in: - raise WebException("You're not logged in.") - _user = get_user().first() - - try: - pfp = "pfp/%d.png" % _user.uid - os.remove(pfp) - return { "success": 1, "message": "Removed!" } - except Exception, e: - raise WebException(str(e)) - -################## -# USER FUNCTIONS # -################## - -__check_username = lambda username: get_user(username_lower=username.lower()).first() is None -__check_email = lambda email: get_user(email=email.lower()).first() is None - -UserSchema = Schema({ - Required("email"): check( - ([str, Length(min=4, max=128)], "Your email should be between 4 and 128 characters long."), - ([__check_email], "Someone already registered this email."), - ([utils.__check_email_format], "Please enter a legit email.") - ), - Required("name"): check( - ([str, Length(min=4, max=128)], "Your name should be between 4 and 128 characters long.") - ), - Required("username"): check( - ([str, Length(min=4, max=32)], "Your username should be between 4 and 32 characters long."), - ([utils.__check_alphanumeric], "Please only use alphanumeric characters in your username."), - ([__check_username], "This username is taken, did you forget your password?") - ), - Required("password"): check( - ([str, Length(min=4, max=64)], "Your password should be between 4 and 64 characters long."), - ([utils.__check_ascii], "Please only use ASCII characters in your password."), - ), - Required("type"): check( - ([str, lambda x: x.isdigit()], "Please use the online form.") - ), - "notify": str -}, extra=True) - -def login_user(username, password): - user = get_user(username_lower=username.lower()).first() - if user is None: return False - correct = utils.check_password(user.password, password) - if not correct: return False - - useragent = request.headers.get("User-Agent") - ip = request.remote_addr - - with app.app_context(): - expired = LoginTokens.query.filter_by(username=username).all() - for expired_token in expired: db.session.delete(expired_token) - - token = LoginTokens(user.uid, user.username, ua=useragent, ip=ip) - db.session.add(token) - db.session.commit() - - session["sid"] = token.sid - session["username"] = token.username - session["admin"] = user.admin == True - if user.tid is not None and user.tid >= 0: - session["tid"] = user.tid - - return True - -def is_logged_in(): - if not("sid" in session and "username" in session): return False - sid = session["sid"] - username = session["username"] - token = LoginTokens.query.filter_by(sid=sid).first() - if token is None: return False - - useragent = request.headers.get("User-Agent") - ip = request.remote_addr - - if token.username != username: return False - if token.ua != useragent: return False - return True - -def get_user(username=None, username_lower=None, email=None, uid=None, reset_token=None): - match = {} - if username != None: - match.update({ "username": username }) - elif username_lower != None: - match.update({ "username_lower": username_lower }) - elif uid != None: - match.update({ "uid": uid }) - elif email != None: - match.update({ "email": email }) - elif is_logged_in(): - match.update({ "username": session["username"] }) - elif reset_token != None: - match.update({ "reset_token": reset_token }) - with app.app_context(): - result = Users.query.filter_by(**match) - return result - -def is_admin(): - return is_logged_in() and "admin" in session and session["admin"] - -def in_team(user): - return hasattr(user, "tid") and user.tid >= 0 - -def validate_captcha(form): - if "captcha_response" not in form: - return False - captcha_response = form["captcha_response"] - data = {"secret": "6Lc4xhMTAAAAACFaG2NyuKoMdZQtSa_1LI76BCEu", "response": captcha_response} - response = requests.post("https://www.google.com/recaptcha/api/siteverify", data=data) - return response.json()["success"] diff --git a/server/api/utils.py b/server/api/utils.py deleted file mode 100644 index c2adef0..0000000 --- a/server/api/utils.py +++ /dev/null @@ -1,102 +0,0 @@ -import datetime -import hashlib -import json -import random -import re -import requests -import string -import traceback -import unicodedata - -from PIL import Image, ImageDraw - -from flask import current_app as app -from functools import wraps -from werkzeug.security import generate_password_hash, check_password_hash - -__check_email_format = lambda email: re.match(".+@.+\..{2,}", email) is not None -__check_ascii = lambda s: all(c in string.printable for c in s) -__check_alphanumeric = lambda s: all(c in string.digits + string.ascii_uppercase + string.ascii_lowercase for c in s) - -def hash_password(s): - return generate_password_hash(s) - -def check_password(hashed_password, try_password): - return check_password_hash(hashed_password, try_password) - -def generate_string(length=32, alpha=string.hexdigits): - return "".join([random.choice(alpha) for x in range(length)]) - -def unix_time_millis(dt): - epoch = datetime.datetime.utcfromtimestamp(0) - return (dt - epoch).total_seconds() * 1000.0 - -def get_time_since_epoch(): - return unix_time_millis(datetime.datetime.now()) - -def flat_multi(multidict): - flat = {} - for key, values in multidict.items(): - value = values[0] if type(values) == list and len(values) == 1 else values - flat[key] = value.encode("utf-8") - return flat - -def send_email(recipient, subject, body): - api_key = app.config["MG_API_KEY"] - data = {"from": "EasyCTF Administrator <%s>" % (app.config["ADMIN_EMAIL"]), - "to": recipient, - "subject": subject, - "text": body - } - auth = ("api", api_key) - return requests.post("https://api.mailgun.net/v3/%s/messages" % (app.config["MG_HOST"]), auth=auth, data=data) - -def generate_identicon(email, filename): - email = email.strip().lower() - h = hashlib.sha1(email).hexdigest() - size = 256 - margin = 0.08 - baseMargin = int(size * margin) - cell = int((size - baseMargin * 2.0) / 5) - margin = int((size - cell * 5.0) / 2) - image = Image.new("RGB", (size, size)) - draw = ImageDraw.Draw(image) - - def hsl2rgb(h, s, b): - h *= 6 - s1 = [] - s *= b if b < 0.5 else 1-b - b += s - s1.append(b) - s1.append(b - h % 1 * s * 2) - s *= 2 - b -= s - s1.append(b) - s1.append(b) - s1.append(b + h % 1 * s) - s1.append(b + s) - - return [ - s1[~~h % 6], s1[(h|16) % 6], s1[(h|8) % 6] - ] - - rgb = hsl2rgb(int(h[-7:], 16) & 0xfffffff, 0.5, 0.7) - bg = (255, 255, 255) - fg = (int(rgb[0] * 255), int(rgb[1] * 255), int(rgb[2] * 255)) - - # print fg, bg - draw.rectangle([(0, 0), (size, size)], fill=bg) - - for i in range(15): - c = bg if int(h[i], 16) % 2 == 1 else fg - if i < 5: - draw.rectangle([(2*cell + margin, i*cell + margin), (3*cell + margin, (i+1)*cell + margin)], fill=c) - elif i < 10: - draw.rectangle([(1*cell + margin, (i-5)*cell + margin), (2*cell + margin, (i-4)*cell + margin)], fill=c) - draw.rectangle([(3*cell + margin, (i-5)*cell + margin), (4*cell + margin, (i-4)*cell + margin)], fill=c) - elif i < 15: - draw.rectangle([(0*cell + margin, (i-10)*cell + margin), (1*cell + margin, (i-9)*cell + margin)], fill=c) - draw.rectangle([(4*cell + margin, (i-10)*cell + margin), (5*cell + margin, (i-9)*cell + margin)], fill=c) - - image.save(open("pfp/%s.png" % filename, "w"), "PNG") - return \ No newline at end of file diff --git a/server/app.py b/server/app.py deleted file mode 100644 index ec403b2..0000000 --- a/server/app.py +++ /dev/null @@ -1,120 +0,0 @@ -#!/usr/bin/python - -from argparse import ArgumentParser -from flask import Flask, send_file - -app = Flask(__name__) - -import api -import config -import json -import logging -import os -import traceback - -from api.decorators import api_wrapper - -app.config.from_object(config) - -if not os.path.exists(app.config["UPLOAD_FOLDER"]): - os.makedirs(app.config["UPLOAD_FOLDER"]) -if not os.path.exists("pfp"): - os.makedirs("pfp") - -with app.app_context(): - from api.models import db, Files, Teams, Problems, Solves, Users - db.init_app(app) - db.create_all() - - app.db = db - -app.secret_key = config.SECRET_KEY - -app.register_blueprint(api.admin.blueprint, url_prefix="/api/admin") -app.register_blueprint(api.problem.blueprint, url_prefix="/api/problem") -app.register_blueprint(api.stats.blueprint, url_prefix="/api/stats") -app.register_blueprint(api.team.blueprint, url_prefix="/api/team") -app.register_blueprint(api.user.blueprint, url_prefix="/api/user") -api.logger.initialize_logs() - -@app.route("/api") -@api_wrapper -def api_main(): - return { "success": 1, "message": "The API is online." } - -@app.errorhandler(404) -def page_not_found(e): - return send_file("../web/index.html") - -def run(args=None): - with app.app_context(): - try: - keyword_args = dict(args._get_kwargs()) - app.debug = keyword_args["debug"] if "debug" in keyword_args else False - except: pass - app.run(host="0.0.0.0", port=8000) - -def load_problems(args): - keyword_args = dict(args._get_kwargs()) - force = keyword_args["force"] if "force" in keyword_args else False - - if not os.path.exists(config.PROBLEM_DIR): - api.logger.log("api.problem.log", "Problems directory doesn't exist.") - return - - for (dirpath, dirnames, filenames) in os.walk(config.PROBLEM_DIR): - if "problem.json" in filenames: - json_file = os.path.join(dirpath, "problem.json") - contents = open(json_file).read() - try: - data = json.loads(contents) - except ValueError as e: - api.logger.log("api.problem.log", "Invalid JSON format in file {filename} ({exception})".format(filename=json_file, exception=e)) - continue - if not isinstance(data, dict): - api.logger.log("api.problem.log", "{filename} is not a dict.".format(filename=json_file)) - continue - - missing_keys = [] - for key in ["pid", "title", "category", "value"]: - if key not in data: - missing_keys.append(key) - if len(missing_keys) > 0: - api.logger.log("api.problem.log", "{filename} is missing the following keys: {keys}".format(filename=json_file, keys=", ".join(missing_keys))) - continue - - relative_path = os.path.relpath(dirpath, config.PROBLEM_DIR) - data["description"] = open(os.path.join(dirpath, "description.md"), "r").read() - api.logger.log("api.problem.log", "Found problem '{}'".format(data["title"])) - with app.app_context(): - try: - api.problem.insert_problem(data, force=force) - except Exception as e: - api.logger.log("api.problem.log", "Problem '{}' was not added to the database. Error: {}".format(data["title"], e)) - api.logger.log("api.problem.log", "{}".format(traceback.format_exc())) - - api.logger.log("api.problem.log", "Finished.") - -def main(): - parser = ArgumentParser(description="EasyCTF Server Management") - - subparser = parser.add_subparsers(help="Select one of the following actions.") - parser_problems = subparser.add_parser("problems", help="Manage problems.") - subparser_problems = parser_problems.add_subparsers(help="Select one of the following actions.") - parser_problems_load = subparser_problems.add_parser("load", help="Load all problems into database.") - parser_problems_load.add_argument("-f", "--force", action="store_true", help="Force overwrite problems.", default=False) - parser_problems_load.set_defaults(func=load_problems) - - parser_run = subparser.add_parser("run", help="Run the server.") - parser_run.add_argument("-d", "--debug", action="store_true", help="Run the server in debug mode.", default=False) - parser_run.set_defaults(func=run) - - args = parser.parse_args() - - if "func" in args: - args.func(args) - else: - parser.print_help() - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/server/config.py b/server/config.py deleted file mode 100644 index 44f2c2e..0000000 --- a/server/config.py +++ /dev/null @@ -1,27 +0,0 @@ -import os - -secret = open(".secret_key", "a+b") -contents = secret.read() -if not contents: - key = os.urandom(128) - secret.write(key) - secret.flush() -else: - key = contents -secret.close() - -SECRET_KEY = key - -SQLALCHEMY_DATABASE_URI = "mysql://root:i_hate_passwords@localhost/easyctf" -SQLALCHEMY_TRACK_MODIFICATIONS = False - -UPLOAD_FOLDER = os.path.normpath("../web/files") - -CTF_BEGIN = 0 # To be used later -CTF_END = 0 # To be used later - -MG_HOST = "" -MG_API_KEY = "" -ADMIN_EMAIL = "" - -PROBLEM_DIR = "../problems" \ No newline at end of file diff --git a/web/css/c3.css b/web/css/c3.css deleted file mode 100644 index ab0b70a..0000000 --- a/web/css/c3.css +++ /dev/null @@ -1,158 +0,0 @@ -/*-- Chart --*/ -.c3 svg { - font: 10px sans-serif; } - -.c3 path, .c3 line { - fill: none; - stroke: #000; } - -.c3 text { - -webkit-user-select: none; - -moz-user-select: none; - user-select: none; } - -.c3-legend-item-tile, .c3-xgrid-focus, .c3-ygrid, .c3-event-rect, .c3-bars path { - shape-rendering: crispEdges; } - -.c3-chart-arc path { - stroke: #fff; } - -.c3-chart-arc text { - fill: #fff; - font-size: 13px; } - -/*-- Axis --*/ -/*-- Grid --*/ -.c3-grid line { - stroke: #aaa; } - -.c3-grid text { - fill: #aaa; } - -.c3-xgrid, .c3-ygrid { - stroke-dasharray: 3 3; } - -/*-- Text on Chart --*/ -.c3-text.c3-empty { - fill: #808080; - font-size: 2em; } - -/*-- Line --*/ -.c3-line { - stroke-width: 1px; } - -/*-- Point --*/ -.c3-circle._expanded_ { - stroke-width: 1px; - stroke: white; } - -.c3-selected-circle { - fill: white; - stroke-width: 2px; } - -/*-- Bar --*/ -.c3-bar { - stroke-width: 0; } - -.c3-bar._expanded_ { - fill-opacity: 0.75; } - -/*-- Focus --*/ -.c3-target.c3-focused { - opacity: 1; } - -.c3-target.c3-focused path.c3-line, .c3-target.c3-focused path.c3-step { - stroke-width: 2px; } - -.c3-target.c3-defocused { - opacity: 0.3 !important; } - -/*-- Region --*/ -.c3-region { - fill: steelblue; - fill-opacity: 0.1; } - -/*-- Brush --*/ -.c3-brush .extent { - fill-opacity: 0.1; } - -/*-- Select - Drag --*/ -/*-- Legend --*/ -.c3-legend-item { - font-size: 12px; } - -.c3-legend-item-hidden { - opacity: 0.15; } - -.c3-legend-background { - opacity: 0.75; - fill: white; - stroke: lightgray; - stroke-width: 1; } - -/*-- Tooltip --*/ -.c3-tooltip-container { - z-index: 10; } - -.c3-tooltip { - border-collapse: collapse; - border-spacing: 0; - background-color: #fff; - empty-cells: show; - -webkit-box-shadow: 7px 7px 12px -9px #777777; - -moz-box-shadow: 7px 7px 12px -9px #777777; - box-shadow: 7px 7px 12px -9px #777777; - opacity: 0.9; } - -.c3-tooltip tr { - border: 1px solid #CCC; } - -.c3-tooltip th { - background-color: #aaa; - font-size: 14px; - padding: 2px 5px; - text-align: left; - color: #FFF; } - -.c3-tooltip td { - font-size: 13px; - padding: 3px 6px; - background-color: #fff; - border-left: 1px dotted #999; } - -.c3-tooltip td > span { - display: inline-block; - width: 10px; - height: 10px; - margin-right: 6px; } - -.c3-tooltip td.value { - text-align: right; } - -/*-- Area --*/ -.c3-area { - stroke-width: 0; - opacity: 0.2; } - -/*-- Arc --*/ -.c3-chart-arcs-title { - dominant-baseline: middle; - font-size: 1.3em; } - -.c3-chart-arcs .c3-chart-arcs-background { - fill: #e0e0e0; - stroke: none; } - -.c3-chart-arcs .c3-chart-arcs-gauge-unit { - fill: #000; - font-size: 16px; } - -.c3-chart-arcs .c3-chart-arcs-gauge-max { - fill: #777; } - -.c3-chart-arcs .c3-chart-arcs-gauge-min { - fill: #777; } - -.c3-chart-arc .c3-gauge-value { - fill: #000; - /* font-size: 28px !important;*/ } diff --git a/web/css/easyctf.css b/web/css/easyctf.css deleted file mode 100644 index f1da53c..0000000 --- a/web/css/easyctf.css +++ /dev/null @@ -1,31 +0,0 @@ -@font-face { - font-family: "Proxima Nova"; - src: url("/fonts/ProximaNova.woff2"); -} -@font-face { - font-family: "Proxima Nova"; - src: url("/fonts/ProximaNovaBold.woff2"); - font-weight: bold; -} - -body { - font-family: "Proxima Nova", Helvetica Neue, Helvetica, Arial, sans-serif; -} - -.tab-content { - padding: 15px; - > .tab-pane { - display: none; - } - > .active { - display: block; - } -} - -.NO_HOVER_UNDERLINE_DAMMIT:hover, .NO_HOVER_UNDERLINE_DAMMIT:focus, .NO_HOVER_UNDERLINE_DAMMIT:active { - text-decoration:none; -} - -#avatar { - border: 1px solid rgb(221, 221, 221); -} \ No newline at end of file diff --git a/web/css/style.css b/web/css/style.css deleted file mode 100644 index 5b5d85c..0000000 --- a/web/css/style.css +++ /dev/null @@ -1,192 +0,0 @@ -@import url(https://fonts.googleapis.com/css?family=Exo+2); -.heading1 { - font-size: 75px !important; - color: #62AC5B !important; - font-family: "Exo 2" !important; -} -.charts { - width:100%; - border:4px double black; -} -.charted { - width:5em; - height:5em; -} -#map { - height:45em; - background-image: url(../images/placeholdermap.jpg); - background-size: cover; - width:97%; - margin-right:auto; - margin-left:auto; -} -::-webkit-input-placeholder, :-moz-placeholder, ::-moz-placeholder, :-ms-input-placeholder { - color: #999999; -} -.navbar-default .navbar-nav>.open>a, .navbar-default .navbar-nav>.open>a:focus, .navbar-default .navbar-nav>.open>a:hover, .dropdown-menu>li>a:focus, .dropdown-menu>li>a:hover { - background-color:#0066CC; -} -#menubox { - border:none; -} -.pointvalue { - float:right; -} -.panel.panel-info { - margin: 2.5em; -} -.paragraph { - width:50em; - text-align: justify; - margin-left:auto; - margin-right:auto; -} -.prizes { - width:100%; -} -#hint { - background:#0080FF; - border-color:#0180FF; -} -#check { - border-color:#449D44; -} -.probfile { - display:inline; - color:#62AC5B; - margin-right:1em; - margin-left:1em; -} -.filelink, .filelink:hover { - text-decoration:none; -} -#style1 { - background-color: #0080FF; - margin: -0.1em; -} -#style1 .dropdown-menu { - background-color: #1a8dff; -} -#email, #password { - margin-bottom: 1em; -} -.style4 { - margin-left: 10em; - margin-right: 10em; -} -.icn { - position: relative; - bottom: 1px; -} -.style2 { - margin: 0px 0px 0px 0px; - padding: 0px 0px 0px 0px; -} -.style3 { - margin-top: 1em; -} -#question-text { - height: 4em; -} -#question-title { - background-color: #D9EDF7; - text-align: center; - padding: 0px 0px 0px 0px; - font-size: 1.2em; -} -.intro { - text-align: center; -} -.column { - max-width: 450px; -} -.mainbody { - background-color: #FAFAFA; -} -.ui.menu .item img.logo { - margin-right: 1.5em; -} -.main.container { - margin-top: 7em; -} -.wireframe { - margin-top: 2em; -} -.ui.footer.segment { - margin: 5em 0em 0em; - padding: 5em 0em; -} -.heading2, table { - color: #226C1B; -} -li { - transition-duration: 0.5s; -} -li:hover { - background-color: #0066cc; -} -tr { - transition-duration: 0.5s; -} -tr:hover { - background-color: #DDDDDD; -} -li a, .navbar-brand { - color: white !important; -} -#imp-files { - margin-right: auto; - padding-left: 2em; -} -@-webkit-keyframes fadeIn { - from { - opacity: 0; - } - to { - opacity: 1; - } -} -@-moz-keyframes fadeIn { - from { - opacity: 0; - } - to { - opacity: 1; - } -} -@keyframes fadeIn { - from { - opacity: 0; - } - to { - opacity: 1; - } -} -.fade_in { - opacity: 0; - -webkit-animation: fadeIn ease-in-out 1; - -moz-animation: fadeIn ease-in-out 1; - animation: fadeIn ease-in-out 1; - -webkit-animation-fill-mode: forwards; - -moz-animation-fill-mode: forwards; - animation-fill-mode: forwards; - -webkit-animation-duration: 1s; - -moz-animation-duration: 1s; - animation-duration: 1s; -} -.modal { - text-align: center; -} -@media screen and (min-width: 768px) { - .modal:before { - display: inline-block; - vertical-align: middle; - content: " "; - height: 100%; - } -} -.modal-dialog { - display: inline-block; - text-align: left; - vertical-align: middle; -} diff --git a/web/fonts/ProximaNova.woff2 b/web/fonts/ProximaNova.woff2 deleted file mode 100644 index a0ccdbca6d3f81b3dca7e01aeb3df0df5c5fe54f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 17997 zcma&N1C(UjvNl?_ZQC}wY+GHnUDajVHnVKIx@_CFx~j{3z4yN7-gE97@BM#_FC$j2 zl{sh3h%e@vBiBrK1#uQ2V4y!DE(e74m(42!0uoIE0>RGsW1oS5fYpG2KpOtK@|OsT zi>u1vK^Oo9X+s5AK*t#%Bf$hD(!CJ_bAXV6hT5QBbHN7j0D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zlZCzWGfUO=rx6{FXg1JS7tp2Etq_UbXA%KdQUJeAM!=LhxzVFn$>!+tvUWi z>6`VK5AA*^UqnDHe@40A0roG45^PY|YTWRko7J$|6h$9%wtJW0au+{kBq!lyL&iC=iY4c4%Vb!=h-TX+l$Z2eH{JN~Fn zxZ%NXY-1NY*uw$#@fuHXghL$T1b^`#Z^;*5py9<={K7Xp#WTFbE8IN%M|^?LxWY$# z!h7-~e+r;L3Zh^N33P3(mXy>r1~kswEwj$BC5y}Ma9J1as}{Rolgn-?bl+uVrR71E zt;M2+Ez4$*(_`7VI>fnRUrgT!MxAZ_->iMGF=2RhIEk|cGld5;WPUh;2UNfGbs6sM zG~AOMFWt!yp&=QhA(PjyL=Q$U?%zj!dWS9>7}1&OqaAu-h;(sX5f}G4py#&H2(KaFB{W27tZSHbr-e%!PxoUDX}5ES|o~z(~{32Fhtd4!B#@7Tb~x+j)A6_6(jU>s9VD9Fd@8|ey|5^-_JlU9_2R{bF5p9c4k;I356@pI+yDRo diff --git a/web/images/chat.png b/web/images/chat.png deleted file mode 100644 index ff33eaa09e2b8e1f27119cfafa42c8a2c9678a18..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 516 zcmV+f0{i`mP)N2bZe?^J zG%heMH;ao?NdN!=f=NU{R5(x7le;ejQ5eOqjcTJ33Y94Q1tQUjLQR%RD7KJjH9}A* zbrM265|u)smu!V7G;}13hD@>DWFnJ!kKeuXZ5FX>cQu^kv0^H;1lr+yoJZGkfv#;v^IuiS$PCIFhW!p)XQ*GWZ#3nJiEEhBtHYg5Kh^)-7OZM zf!Vh7HVq8l;37OE>=G-b9LMP)>1S=N0o@jSg*TN-B{L1fa6;-W1EV{5s^^??&lr-J zGu1YL$s_tBJ!cGHuL^=-#8le=2IrVwNSJckN&SU$6v|nuHSoVK>77Za7nrRcdz_VG z$u|Wwm+(MB1L9$0s6j9T6R9->ZCC7WG%p!-CkI;J;=(LA~POj;lG)b6es zc%CN2bZe?^J zG%heMH;ao?NdN!=P)S5VR5(wCk}XffKoEwvlBAyG90DY$6M*3(K|#O}6c&r(M_>>b zuz&ys;u73>MCBO*_7XV4nZxY$i)VHx?Jkh;ByXql&c5w5sR^m7Y7QNvep!}dBz(~K z&;jb`(U!WdlcFdN84gfEUsK=EBbsP$DH(N}nrPG*3G#-q917S+DYGNrdI-OuMHl2o zRvqZ90dJX-P`A9(f_FKFX2z^ zBk))Cvo_RLqG}A)HCk9-#*`LOF+r=o)pAU)5pEH)FEp3Uj?wXaE2J07*qo IM6N<$g84PV+W-In diff --git a/web/images/login.png b/web/images/login.png deleted file mode 100644 index 205724592ce50020c2f820e681fa5f5e1a42e74c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 293 zcmeAS@N?(olHy`uVBq!ia0vp^{2&q9iy!t)x7$D3zfgF*C13FE6!3!9>qM z&%C=k*b}H`nx~6nh=u>!N!EM~3IZ;akCxmP1F4(Oo=PAguH*4Bo zmn~YA6V9LQyTY&}W0}F6BTMF;Ww?}at%~#6M2#E&NN2bZe?^J zG%heMH;ao?NdN!=&PhZ;R5(wSlf6rVQ542sOUr5~XeuQ70|K+rYG{yxK8B#CK%#K$ ze`u(wmWGy`g3P6%tf3E-h@uu7Z4HMO14S!8UVZzW*K2Aj)B_Lao^zh(aNm3HtF?k* z7#*cj$x|#A{X`deo2uK$`-P^k6%g7HEi>Smm?AzBXQ&Sl*T~O_hj6+wybct5bzNUY z7(-MfH;6iUxKJqU)4M0nQchAkX5FQ%RZw&zyb^OQ#E9t~eyWmz?vl{0tmY2-a=Dxn z@dCn41W{Aj1ZdJ|Zi!w}t2uzA2a|kjfVe{LV7*tiGy+Y6{w})mr$izVJM|?BFCw5R z2j(SSNZt(e3Jkho=c7KK&!$DAQ4a;V1@jR9fvu?8-D|k1$3K+&<2vd@H1gnSmS72_(DF4zH ebf|I@XxcXq0R(*IKAhqJ0000N2bZe?^J zG%heMH;ao?NdN!=NJ&INR5(wile|c0PfSCMc=3&}R_KGy%I5LTqB8 zU}f+PEX0?vu@<~w5CV!t3L|Qxi-N(8d-0oLER+>O^25)b`7bADmlIK>X*!c6$$lKi zEqKg&$_xkd0{RWSV_k<6Ziz%uR7L2)K7msUh-W35%;`2 z$UDE2U2)08;lDP+&d_B_cEjKiEb>k{w+zgAI8XT;|Mv}JSc4x>@AgFy1O>MY6w7#B zsOZ3=TV_sD(tp)6ykh=a)?dAbx16%ZJT4;g4Y9eYqZ^qRyZ`_I07*qoM6N<$f;g+a AwEzGB diff --git a/web/images/register.png b/web/images/register.png deleted file mode 100644 index fca67b0f30d80e0f4725672dc073ba930236daec..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 461 zcmV;;0W$uHP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02p*dSaefwW^{L9 za%BK;VQFr3E^cLXAT%y8E;oydQ%L{-0X|7YK~y+Tg^|531YsD3$5tdZ5~YHOWZ6iT z2GI}{8iiV-aS=L&OF%@o63JFt7a=MxfrtX*FW6{i_Bmh9&h9LBPx9n@=e+04&dx+> zn)WA2asc-b!wb9$c5m%?r`(Zx5yLUuz&gys+&^fy0Lop%iOP?#8ubvFB9uI@z>|hg z9$_{lx`^C4{J^&IoL@4(VaAz1#eR!IQ=42@psq!|TbbPm#A>Ci;XJ1$Bawttsl*Fn8~U5~-Ly{dab-nafUjKi(N&v4~g-jI7i zcv(4n+nf_{r;@}ht%XLL@Un95J9DiYG@szmc23H(3*T9fxNJX&!lvI6;>1s;*b3=H-{Ak4US@}`eKL5ULAh?3y^w370~qEv>0#LT=By}Z;C1rt33 zJ@fAFU{9c$bDl1aAsWHG6BM}*1&FlXXVVIsofNqErjnUqhXiYV^UZ`Uod?y-nia&F zANfZKim@1;$$g(&CoXn3S$yBz&3lUzzH6@is_i++d)6{-6PM!S5|6dz1P@y8(hcAc zUC8;RNg?BNZrl9lg2z8b2o@a-^m&$RAtZI-os)2z!KMq-Wu4CO-d%7_)`CB!oj;~B zUR-0((hCizu$VU^`B)eO;?e&DFLrnph6rcA=YslFGL=jgmyn(*M@C2NyO^=G9| pp3?m}!&v9x?74qs*M9xXuHyaMWTN#ub)e4}JYD@<);T3K0RWE|exLvV diff --git a/web/images/scoreboard.png b/web/images/scoreboard.png deleted file mode 100644 index 8e57384a2fc56564b02742fb25b8b3834573b1b8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 430 zcmV;f0a5;mP)N2bZe?^J zG%heMH;ao?NdN!=EJ;K`R5(wCkiBXGK@^2YQkVn;g-9TFu7#aVnm~$Fc?N9_=>iEB zwt|&~T1y09AXQ!=O+W-6!6Jp7&4Mh;{`g(@E@*aj4;<#sz2BJ`#)M&54T8YJZR$+H zHI=uF@B2UaQ>^o|f}7wOUK&pL#tr&6(Ku5@_-Dck3BP-u_e%4cI*8`!()lI90hz9` zZTnWAF=Dojuyny}33cG6xGW!*!zDHyhO0ewLd@52V_adIGl!yiF9)z5J)bRYf6jWR zXi{(&uIoMkP2vM&MMGR;dwkn}2>^J-O?_-rzu~-&v!w^L2ydt#GjEJVsDgWVO-MfJ zkNN`_6iJukICY>o0at>t=sEZcmlaKl;fwO8^rUD~gu4o*ig`=Xq-G2cog=CK)Uj~LMRR)HJW(J0z|AF*N z28L1t28LG&3=CE?7#PI!C&eFi1FGdL@Q5sCVBiKC!Y#;HpAtV2C@4|l8c`CQpH@uY5bu0So(eGZSgT~3>&9IJeNO*-G?k&61voil$MS>OB+y<|#M)HC7aJIM=k z<#=X1o-FMv@^j&xloO2W*Zl7KYp|eQ+@|iU+mz!xl@Edf<#=u^FbsIo{OHZyer{Jg zjlK_k(RQmB{wUTc)tK)at^LjM=Dmk)&aTte7KA^Rx@{FFsxv1m`ryBo)ZTB_C8dAr bIUcfBo;)GPXsjR!bUcHntDnm{r-UW|JF|Jd diff --git a/web/images/updates.png b/web/images/updates.png deleted file mode 100644 index 3ae0df6b95af6647adbf88ba2ce79568434098a7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 466 zcmV;@0WJQCP)N2bZe?^J zG%heMH;ao?NdN!=P)S5VR5(wKlRYm)K@^6s^^w?wR)Wx=l@O~!qfx1pDjT9wDkY*& zlBguwP5c5Cl}=$3l|-eGC@4hkn)@;1Idf00jE}W%^5mU4=e%?0-pxjxC`po9nx-qx zxr&zl7DHXu+6jCaUxHI;!l;h?E(YfFJio+W;Y~3hYUtQc(OiWm!Y}wEJVVM2O0i$Z z!s}CGcJKvb%rq{yXcRH$Sii$Q%RY^j@3;r!tb4TVC9eP<^v+-k`n6SvKt<4P zDFz1#9^-TJ04@J7J+SkDh(MJm)p_EfmIBfLdS8(g2u#8@p$FXZ;p*D z2Tej(xLh~^QbOKlWIpFWp{x6%*F#Q*>R07*qo IM6N<$f>o!+WB>pF diff --git a/web/includes/meta.html b/web/includes/meta.html deleted file mode 100644 index 9fc18a5..0000000 --- a/web/includes/meta.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/web/index.html b/web/index.html deleted file mode 100644 index de8ae3f..0000000 --- a/web/index.html +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - EasyCTF 2016 - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - - - diff --git a/web/js/admin.js b/web/js/admin.js deleted file mode 100644 index c6b7fd6..0000000 --- a/web/js/admin.js +++ /dev/null @@ -1,5 +0,0 @@ -$(document).ready(function() { - $(".panel-title > a[data-toggle=collapse]").click(function(e) { - e.preventDefault(); - }); -}); \ No newline at end of file diff --git a/web/js/admin/problems.old.js b/web/js/admin/problems.old.js deleted file mode 100644 index 0061b19..0000000 --- a/web/js/admin/problems.old.js +++ /dev/null @@ -1,121 +0,0 @@ -function render_problems() { - $.post("/api/admin/problem/data", { - }, function(data) { - data = data["data"]; - for (var i = 0; i < data.length; i++) { - files = data[i]["files"]; - var checked = ""; - if (data[i]["disabled"]) { - checked = "checked"; - } - problem = -`
    -
    - -
    -
    -
    - -
    -
    - -
    -
    -
    -
    - -

    -
    -
    - -
    -
    - -
    -
    -
    -
    - - -
    -
    -
    ` - $("#problems").append(problem); - } - $("[name=update]").click(function(e) { - var problem = $(this).parents("form:first"); - var pid = $("input[name=pid]", problem).val(); - var name = $("input[name=name]", problem).val(); - var description = $("textarea[name=description]", problem).val(); - var hint = $("input[name=hint]", problem).val(); - var category = $("input[name=category]", problem).val(); - var value = $("input[name=value]", problem).val(); - var flag = $("input[name=flag]", problem).val(); - var disabled = $("input[name=disabled]", problem).prop("checked") ? 1 : 0; - update_problem(pid, name, category, description, hint, flag, disabled, value); - }); - $("[name=delete-modal]").click(function(e) { - var problem = $(this).parents("form:first"); - var pid = $("input[name=pid]", problem).val(); - var div = $(this).closest("div.panel"); - $("#delete").off().click(function(e) { - delete_problem(pid, div); - }); - }); - }); -} - -function update_problem(pid, name, category, description, hint, flag, disabled, value) { - $.post("/api/problem/update", { - pid: pid, - name: name, - category: category, - description: description, - hint: hint, - flag: flag, - disabled: disabled, - value: value - }, function(data) { - if (data.success == 1) { - display_message("status_" + pid, "success", data.message, function() {}); - } else { - display_message("status_" + pid, "danger", data.message, function() {}); - } - }); -} - -function delete_problem(pid, div) { - $.post("/api/problem/delete", { - pid: pid - }, function(data) { - if (data.success == 1) { - display_message("delete_status", "success", data.message, function() { - div.slideUp("normal", function() { - $(this).remove(); - $("#delete-modal").modal("hide"); - } ); - }); - } else { - display_message("delete_status", "warning", data.message, function() {}); - } - }); -} - -$(function() { - render_problems(); -}); diff --git a/web/js/c3.min.js b/web/js/c3.min.js deleted file mode 100644 index d99c28b..0000000 --- a/web/js/c3.min.js +++ /dev/null @@ -1,5 +0,0 @@ -!function(a){"use strict";function b(a){this.owner=a}function c(a,b){if(Object.create)b.prototype=Object.create(a.prototype);else{var c=function(){};c.prototype=a.prototype,b.prototype=new c}return b.prototype.constructor=b,b}function d(a){var b=this.internal=new e(this);b.loadConfig(a),b.init(),function c(a,b,d){Object.keys(a).forEach(function(e){b[e]=a[e].bind(d),Object.keys(a[e]).length>0&&c(a[e],b[e],d)})}(h,this,this)}function e(b){var c=this;c.d3=a.d3?a.d3:"undefined"!=typeof require?require("d3"):void 0,c.api=b,c.config=c.getDefaultConfig(),c.data={},c.cache={},c.axes={}}function f(a){b.call(this,a)}function g(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+u)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,n);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=p.copy();return b.isCategory&&(a=p.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var b=m?m(a):a;return"undefined"!=typeof b?b:""}function i(a){if(z)return z;var b={h:11.5,w:5.5};return a.select("text").text(h).each(function(a){var c=this.getBoundingClientRect(),d=h(a),e=c.height,f=d?c.width/d.length:void 0;e&&f&&(b.h=e,b.w=f)}).text(""),z=b,b}function j(c){return b.withoutTransition?c:a.transition(c)}function k(m){m.each(function(){function m(a,c){function d(a,b){f=void 0;for(var h=1;hc)return d(a.concat(b.substr(0,f?f:h)),b.slice(f?f+1:h));return a.concat(b)}var e,f,g,i=h(a),j=[];return"[object Array]"===Object.prototype.toString.call(i)?i:((!c||0>=c)&&(c=X?95:b.isCategory?Math.ceil(F(G[1])-F(G[0]))-12:110),d(j,i+""))}function n(a,b){var c=U.h;return 0===b&&(c="left"===q||"right"===q?-((V[a.index]-1)*(U.h/2)-3):".71em"),c}function v(a){var b=p(a)+(o?0:u);return L[0]0?"start":"end":"middle"}function x(a){return a?"rotate("+a+")":""}function y(a){return a?8*Math.sin(Math.PI*(a/180)):0}function z(a){return a?11.5-2.5*(a/15)*(a>0?1:-1):W}var A,B,C,D=k.g=a.select(this),E=this.__chart__||p,F=this.__chart__=g(),G=t?t:f(F),H=D.selectAll(".tick").data(G,F),I=H.enter().insert("g",".domain").attr("class","tick").style("opacity",1e-6),J=H.exit().remove(),K=j(H).style("opacity",1),L=p.rangeExtent?p.rangeExtent():e(p.range()),M=D.selectAll(".domain").data([0]),N=(M.enter().append("path").attr("class","domain"),j(M));I.append("line"),I.append("text");var O=I.select("line"),P=K.select("line"),Q=I.select("text"),R=K.select("text");b.isCategory?(u=Math.ceil((F(1)-F(0))/2),B=o?0:u,C=o?u:0):u=B=0;var S,T,U=i(D.select(".tick")),V=[],W=Math.max(r,0)+s,X="left"===q||"right"===q;S=H.select("text"),T=S.selectAll("tspan").data(function(a,c){var d=b.tickMultiline?m(a,b.tickWidth):[].concat(h(a));return V[c]=d.length,d.map(function(a){return{index:c,splitted:a}})}),T.enter().append("tspan"),T.exit().remove(),T.text(function(a){return a.splitted});var Y=b.tickTextRotate;switch(q){case"bottom":A=c,O.attr("y2",r),Q.attr("y",W),P.attr("x1",B).attr("x2",B).attr("y2",v),R.attr("x",0).attr("y",z(Y)).style("text-anchor",w(Y)).attr("transform",x(Y)),T.attr("x",0).attr("dy",n).attr("dx",y(Y)),N.attr("d","M"+L[0]+","+l+"V0H"+L[1]+"V"+l);break;case"top":A=c,O.attr("y2",-r),Q.attr("y",-W),P.attr("x2",0).attr("y2",-r),R.attr("x",0).attr("y",-W),S.style("text-anchor","middle"),T.attr("x",0).attr("dy","0em"),N.attr("d","M"+L[0]+","+-l+"V0H"+L[1]+"V"+-l);break;case"left":A=d,O.attr("x2",-r),Q.attr("x",-W),P.attr("x2",-r).attr("y1",C).attr("y2",C),R.attr("x",-W).attr("y",u),S.style("text-anchor","end"),T.attr("x",-W).attr("dy",n),N.attr("d","M"+-l+","+L[0]+"H0V"+L[1]+"H"+-l);break;case"right":A=d,O.attr("x2",r),Q.attr("x",W),P.attr("x2",r).attr("y2",0),R.attr("x",W).attr("y",0),S.style("text-anchor","start"),T.attr("x",W).attr("dy",n),N.attr("d","M"+l+","+L[0]+"H0V"+L[1]+"H"+l)}if(F.rangeBand){var Z=F,$=Z.rangeBand()/2;E=F=function(a){return Z(a)+$}}else E.rangeBand?E=F:J.call(A,F);I.call(A,E),K.call(A,F)})}var l,m,n,o,p=a.scale.linear(),q="bottom",r=6,s=3,t=null,u=0,v=!0;return b=b||{},l=b.withOuterTick?6:0,k.scale=function(a){return arguments.length?(p=a,k):p},k.orient=function(a){return arguments.length?(q=a in{top:1,right:1,bottom:1,left:1}?a+"":"bottom",k):q},k.tickFormat=function(a){return arguments.length?(m=a,k):m},k.tickCentered=function(a){return arguments.length?(o=a,k):o},k.tickOffset=function(){return u},k.tickInterval=function(){var a,c;return b.isCategory?a=2*u:(c=k.g.select("path.domain").node().getTotalLength()-2*l,a=c/k.g.selectAll("line").size()),1/0===a?0:a},k.ticks=function(){return arguments.length?(n=arguments,k):n},k.tickCulling=function(a){return arguments.length?(v=a,k):v},k.tickValues=function(a){if("function"==typeof a)t=function(){return a(p.domain())};else{if(!arguments.length)return t;t=a}return k},k}var h,i,j,k={version:"0.4.10"};k.generate=function(a){return new d(a)},k.chart={fn:d.prototype,internal:{fn:e.prototype,axis:{fn:f.prototype}}},h=k.chart.fn,i=k.chart.internal.fn,j=k.chart.internal.axis.fn,i.init=function(){var a=this,b=a.config;if(a.initParams(),b.data_url)a.convertUrlToData(b.data_url,b.data_mimeType,b.data_keys,a.initWithData);else if(b.data_json)a.initWithData(a.convertJsonToData(b.data_json,b.data_keys));else if(b.data_rows)a.initWithData(a.convertRowsToData(b.data_rows));else{if(!b.data_columns)throw Error("url or json or rows or columns is required.");a.initWithData(a.convertColumnsToData(b.data_columns))}},i.initParams=function(){var a=this,b=a.d3,c=a.config;a.clipId="c3-"+ +new Date+"-clip",a.clipIdForXAxis=a.clipId+"-xaxis",a.clipIdForYAxis=a.clipId+"-yaxis",a.clipIdForGrid=a.clipId+"-grid",a.clipIdForSubchart=a.clipId+"-subchart",a.clipPath=a.getClipPath(a.clipId),a.clipPathForXAxis=a.getClipPath(a.clipIdForXAxis),a.clipPathForYAxis=a.getClipPath(a.clipIdForYAxis),a.clipPathForGrid=a.getClipPath(a.clipIdForGrid),a.clipPathForSubchart=a.getClipPath(a.clipIdForSubchart),a.dragStart=null,a.dragging=!1,a.flowing=!1,a.cancelClick=!1,a.mouseover=!1,a.transiting=!1,a.color=a.generateColor(),a.levelColor=a.generateLevelColor(),a.dataTimeFormat=c.data_xLocaltime?b.time.format:b.time.format.utc,a.axisTimeFormat=c.axis_x_localtime?b.time.format:b.time.format.utc,a.defaultAxisTimeFormat=a.axisTimeFormat.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),a.hiddenTargetIds=[],a.hiddenLegendIds=[],a.focusedTargetIds=[],a.defocusedTargetIds=[],a.xOrient=c.axis_rotated?"left":"bottom",a.yOrient=c.axis_rotated?c.axis_y_inner?"top":"bottom":c.axis_y_inner?"right":"left",a.y2Orient=c.axis_rotated?c.axis_y2_inner?"bottom":"top":c.axis_y2_inner?"left":"right",a.subXOrient=c.axis_rotated?"left":"bottom",a.isLegendRight="right"===c.legend_position,a.isLegendInset="inset"===c.legend_position,a.isLegendTop="top-left"===c.legend_inset_anchor||"top-right"===c.legend_inset_anchor,a.isLegendLeft="top-left"===c.legend_inset_anchor||"bottom-left"===c.legend_inset_anchor,a.legendStep=0,a.legendItemWidth=0,a.legendItemHeight=0,a.currentMaxTickWidths={x:0,y:0,y2:0},a.rotated_padding_left=30,a.rotated_padding_right=c.axis_rotated&&!c.axis_x_show?0:30,a.rotated_padding_top=5,a.withoutFadeIn={},a.intervalForObserveInserted=void 0,a.axes.subx=b.selectAll([])},i.initChartElements=function(){this.initBar&&this.initBar(),this.initLine&&this.initLine(),this.initArc&&this.initArc(),this.initGauge&&this.initGauge(),this.initText&&this.initText()},i.initWithData=function(b){var c,d,e=this,g=e.d3,h=e.config,i=!0;e.axis=new f(e),e.initPie&&e.initPie(),e.initBrush&&e.initBrush(),e.initZoom&&e.initZoom(),e.selectChart=h.bindto?"function"==typeof h.bindto.node?h.bindto:g.select(h.bindto):g.selectAll([]),e.selectChart.empty()&&(e.selectChart=g.select(document.createElement("div")).style("opacity",0),e.observeInserted(e.selectChart),i=!1),e.selectChart.html("").classed("c3",!0),e.data.xs={},e.data.targets=e.convertDataToTargets(b),h.data_filter&&(e.data.targets=e.data.targets.filter(h.data_filter)),h.data_hide&&e.addHiddenTargetIds(h.data_hide===!0?e.mapToIds(e.data.targets):h.data_hide),h.legend_hide&&e.addHiddenLegendIds(h.legend_hide===!0?e.mapToIds(e.data.targets):h.legend_hide),e.hasType("gauge")&&(h.legend_show=!1),e.updateSizes(),e.updateScales(),e.x.domain(g.extent(e.getXDomain(e.data.targets))),e.y.domain(e.getYDomain(e.data.targets,"y")),e.y2.domain(e.getYDomain(e.data.targets,"y2")),e.subX.domain(e.x.domain()),e.subY.domain(e.y.domain()),e.subY2.domain(e.y2.domain()),e.orgXDomain=e.x.domain(),e.brush&&e.brush.scale(e.subX),h.zoom_enabled&&e.zoom.scale(e.x),e.svg=e.selectChart.append("svg").style("overflow","hidden").on("mouseenter",function(){return h.onmouseover.call(e)}).on("mouseleave",function(){return h.onmouseout.call(e)}),c=e.svg.append("defs"),e.clipChart=e.appendClip(c,e.clipId),e.clipXAxis=e.appendClip(c,e.clipIdForXAxis),e.clipYAxis=e.appendClip(c,e.clipIdForYAxis),e.clipGrid=e.appendClip(c,e.clipIdForGrid),e.clipSubchart=e.appendClip(c,e.clipIdForSubchart),e.updateSvgSize(),d=e.main=e.svg.append("g").attr("transform",e.getTranslate("main")),e.initSubchart&&e.initSubchart(),e.initTooltip&&e.initTooltip(),e.initLegend&&e.initLegend(),d.append("text").attr("class",l.text+" "+l.empty).attr("text-anchor","middle").attr("dominant-baseline","middle"),e.initRegion(),e.initGrid(),d.append("g").attr("clip-path",e.clipPath).attr("class",l.chart),h.grid_lines_front&&e.initGridLines(),e.initEventRect(),e.initChartElements(),d.insert("rect",h.zoom_privileged?null:"g."+l.regions).attr("class",l.zoomRect).attr("width",e.width).attr("height",e.height).style("opacity",0).on("dblclick.zoom",null),h.axis_x_extent&&e.brush.extent(e.getDefaultExtent()),e.axis.init(),e.updateTargets(e.data.targets),i&&(e.updateDimension(),e.config.oninit.call(e),e.redraw({withTransition:!1,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1})),null==a.onresize&&(a.onresize=e.generateResize()),a.onresize.add&&(a.onresize.add(function(){h.onresize.call(e)}),a.onresize.add(function(){e.api.flush()}),a.onresize.add(function(){h.onresized.call(e)})),e.api.element=e.selectChart.node()},i.smoothLines=function(a,b){var c=this;"grid"===b&&a.each(function(){var a=c.d3.select(this),b=a.attr("x1"),d=a.attr("x2"),e=a.attr("y1"),f=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(d),y1:Math.ceil(e),y2:Math.ceil(f)})})},i.updateSizes=function(){var a=this,b=a.config,c=a.legend?a.getLegendHeight():0,d=a.legend?a.getLegendWidth():0,e=a.isLegendRight||a.isLegendInset?0:c,f=a.hasArcType(),g=b.axis_rotated||f?0:a.getHorizontalAxisHeight("x"),h=b.subchart_show&&!f?b.subchart_size_height+g:0;a.currentWidth=a.getCurrentWidth(),a.currentHeight=a.getCurrentHeight(),a.margin=b.axis_rotated?{top:a.getHorizontalAxisHeight("y2")+a.getCurrentPaddingTop(),right:f?0:a.getCurrentPaddingRight(),bottom:a.getHorizontalAxisHeight("y")+e+a.getCurrentPaddingBottom(),left:h+(f?0:a.getCurrentPaddingLeft())}:{top:4+a.getCurrentPaddingTop(),right:f?0:a.getCurrentPaddingRight(),bottom:g+h+e+a.getCurrentPaddingBottom(),left:f?0:a.getCurrentPaddingLeft()},a.margin2=b.axis_rotated?{top:a.margin.top,right:0/0,bottom:20+e,left:a.rotated_padding_left}:{top:a.currentHeight-h-e,right:0/0,bottom:g+e,left:a.margin.left},a.margin3={top:0,right:0/0,bottom:0,left:0},a.updateSizeForLegend&&a.updateSizeForLegend(c,d),a.width=a.currentWidth-a.margin.left-a.margin.right,a.height=a.currentHeight-a.margin.top-a.margin.bottom,a.width<0&&(a.width=0),a.height<0&&(a.height=0),a.width2=b.axis_rotated?a.margin.left-a.rotated_padding_left-a.rotated_padding_right:a.width,a.height2=b.axis_rotated?a.height:a.currentHeight-a.margin2.top-a.margin2.bottom,a.width2<0&&(a.width2=0),a.height2<0&&(a.height2=0),a.arcWidth=a.width-(a.isLegendRight?d+10:0),a.arcHeight=a.height-(a.isLegendRight?0:10),a.hasType("gauge")&&(a.arcHeight+=a.height-a.getGaugeLabelHeight()),a.updateRadius&&a.updateRadius(),a.isLegendRight&&f&&(a.margin3.left=a.arcWidth/2+1.1*a.radiusExpanded)},i.updateTargets=function(a){var b=this;b.updateTargetsForText(a),b.updateTargetsForBar(a),b.updateTargetsForLine(a),b.hasArcType()&&b.updateTargetsForArc&&b.updateTargetsForArc(a),b.updateTargetsForSubchart&&b.updateTargetsForSubchart(a),b.showTargets()},i.showTargets=function(){var a=this;a.svg.selectAll("."+l.target).filter(function(b){return a.isTargetToShow(b.id)}).transition().duration(a.config.transition_duration).style("opacity",1)},i.redraw=function(a,b){var c,d,e,f,g,h,i,j,k,m,n,o,p,q,r,s,t,u,v,x,y,z,A,B,C,D,E,F,G,H=this,I=H.main,J=H.d3,K=H.config,L=H.getShapeIndices(H.isAreaType),M=H.getShapeIndices(H.isBarType),N=H.getShapeIndices(H.isLineType),O=H.hasArcType(),P=H.filterTargetsToShow(H.data.targets),Q=H.xv.bind(H);if(a=a||{},c=w(a,"withY",!0),d=w(a,"withSubchart",!0),e=w(a,"withTransition",!0),h=w(a,"withTransform",!1),i=w(a,"withUpdateXDomain",!1),j=w(a,"withUpdateOrgXDomain",!1),k=w(a,"withTrimXDomain",!0),p=w(a,"withUpdateXAxis",i),m=w(a,"withLegend",!1),n=w(a,"withEventRect",!0),o=w(a,"withDimension",!0),f=w(a,"withTransitionForExit",e),g=w(a,"withTransitionForAxis",e),v=e?K.transition_duration:0,x=f?v:0,y=g?v:0,b=b||H.axis.generateTransitions(y),m&&K.legend_show?H.updateLegend(H.mapToIds(H.data.targets),a,b):o&&H.updateDimension(!0),H.isCategorized()&&0===P.length&&H.x.domain([0,H.axes.x.selectAll(".tick").size()]),P.length?(H.updateXDomain(P,i,j,k),K.axis_x_tick_values||(B=H.axis.updateXAxisTickValues(P))):(H.xAxis.tickValues([]),H.subXAxis.tickValues([])),K.zoom_rescale&&!a.flow&&(E=H.x.orgDomain()),H.y.domain(H.getYDomain(P,"y",E)),H.y2.domain(H.getYDomain(P,"y2",E)),!K.axis_y_tick_values&&K.axis_y_tick_count&&H.yAxis.tickValues(H.axis.generateTickValues(H.y.domain(),K.axis_y_tick_count)),!K.axis_y2_tick_values&&K.axis_y2_tick_count&&H.y2Axis.tickValues(H.axis.generateTickValues(H.y2.domain(),K.axis_y2_tick_count)),H.axis.redraw(b,O),H.axis.updateLabels(e),(i||p)&&P.length)if(K.axis_x_tick_culling&&B){for(C=1;C=0&&J.select(this).style("display",b%D?"none":"block")})}else H.svg.selectAll("."+l.axisX+" .tick text").style("display","block");q=H.generateDrawArea?H.generateDrawArea(L,!1):void 0,r=H.generateDrawBar?H.generateDrawBar(M):void 0,s=H.generateDrawLine?H.generateDrawLine(N,!1):void 0,t=H.generateXYForText(L,M,N,!0),u=H.generateXYForText(L,M,N,!1),c&&(H.subY.domain(H.getYDomain(P,"y")),H.subY2.domain(H.getYDomain(P,"y2"))),H.tooltip.style("display","none"),H.updateXgridFocus(),I.select("text."+l.text+"."+l.empty).attr("x",H.width/2).attr("y",H.height/2).text(K.data_empty_label_text).transition().style("opacity",P.length?0:1),H.updateGrid(v),H.updateRegion(v),H.updateBar(x),H.updateLine(x),H.updateArea(x),H.updateCircle(),H.hasDataLabel()&&H.updateText(x),H.redrawArc&&H.redrawArc(v,x,h),H.redrawSubchart&&H.redrawSubchart(d,b,v,x,L,M,N),I.selectAll("."+l.selectedCircles).filter(H.isBarType.bind(H)).selectAll("circle").remove(),K.interaction_enabled&&!a.flow&&n&&(H.redrawEventRect(),H.updateZoom&&H.updateZoom()),H.updateCircleY(),F=(H.config.axis_rotated?H.circleY:H.circleX).bind(H),G=(H.config.axis_rotated?H.circleX:H.circleY).bind(H),a.flow&&(A=H.generateFlow({targets:P,flow:a.flow,duration:a.flow.duration,drawBar:r,drawLine:s,drawArea:q,cx:F,cy:G,xv:Q,xForText:t,yForText:u})),(v||A)&&H.isTabVisible()?J.transition().duration(v).each(function(){var b=[];[H.redrawBar(r,!0),H.redrawLine(s,!0),H.redrawArea(q,!0),H.redrawCircle(F,G,!0),H.redrawText(t,u,a.flow,!0),H.redrawRegion(!0),H.redrawGrid(!0)].forEach(function(a){a.forEach(function(a){b.push(a)})}),z=H.generateWait(),b.forEach(function(a){z.add(a)})}).call(z,function(){A&&A(),K.onrendered&&K.onrendered.call(H)}):(H.redrawBar(r),H.redrawLine(s),H.redrawArea(q),H.redrawCircle(F,G),H.redrawText(t,u,a.flow),H.redrawRegion(),H.redrawGrid(),K.onrendered&&K.onrendered.call(H)),H.mapToIds(H.data.targets).forEach(function(a){H.withoutFadeIn[a]=!0})},i.updateAndRedraw=function(a){var b,c=this,d=c.config;a=a||{},a.withTransition=w(a,"withTransition",!0),a.withTransform=w(a,"withTransform",!1),a.withLegend=w(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withTransitionForTransform=w(a,"withTransitionForTransform",a.withTransition),c.updateSizes(),a.withLegend&&d.legend_show||(b=c.axis.generateTransitions(a.withTransitionForAxis?d.transition_duration:0),c.updateScales(),c.updateSvgSize(),c.transformAll(a.withTransitionForTransform,b)),c.redraw(a,b)},i.redrawWithoutRescale=function(){this.redraw({withY:!1,withSubchart:!1,withEventRect:!1,withTransitionForAxis:!1})},i.isTimeSeries=function(){return"timeseries"===this.config.axis_x_type},i.isCategorized=function(){return this.config.axis_x_type.indexOf("categor")>=0},i.isCustomX=function(){var a=this,b=a.config;return!a.isTimeSeries()&&(b.data_x||v(b.data_xs))},i.isTimeSeriesY=function(){return"timeseries"===this.config.axis_y_type},i.getTranslate=function(a){var b,c,d=this,e=d.config;return"main"===a?(b=s(d.margin.left),c=s(d.margin.top)):"context"===a?(b=s(d.margin2.left),c=s(d.margin2.top)):"legend"===a?(b=d.margin3.left,c=d.margin3.top):"x"===a?(b=0,c=e.axis_rotated?0:d.height):"y"===a?(b=0,c=e.axis_rotated?d.height:0):"y2"===a?(b=e.axis_rotated?0:d.width,c=e.axis_rotated?1:0):"subx"===a?(b=0,c=e.axis_rotated?0:d.height2):"arc"===a&&(b=d.arcWidth/2,c=d.arcHeight/2),"translate("+b+","+c+")"},i.initialOpacity=function(a){return null!==a.value&&this.withoutFadeIn[a.id]?1:0},i.initialOpacityForCircle=function(a){return null!==a.value&&this.withoutFadeIn[a.id]?this.opacityForCircle(a):0},i.opacityForCircle=function(a){var b=this.config.point_show?1:0;return m(a.value)?this.isScatterType(a)?.5:b:0},i.opacityForText=function(){return this.hasDataLabel()?1:0},i.xx=function(a){return a?this.x(a.x):null},i.xv=function(a){var b=this,c=a.value;return b.isTimeSeries()?c=b.parseDate(a.value):b.isCategorized()&&"string"==typeof a.value&&(c=b.config.axis_x_categories.indexOf(a.value)),Math.ceil(b.x(c))},i.yv=function(a){var b=this,c=a.axis&&"y2"===a.axis?b.y2:b.y;return Math.ceil(c(a.value))},i.subxx=function(a){return a?this.subX(a.x):null},i.transformMain=function(a,b){var c,d,e,f=this;b&&b.axisX?c=b.axisX:(c=f.main.select("."+l.axisX),a&&(c=c.transition())),b&&b.axisY?d=b.axisY:(d=f.main.select("."+l.axisY),a&&(d=d.transition())),b&&b.axisY2?e=b.axisY2:(e=f.main.select("."+l.axisY2),a&&(e=e.transition())),(a?f.main.transition():f.main).attr("transform",f.getTranslate("main")),c.attr("transform",f.getTranslate("x")),d.attr("transform",f.getTranslate("y")),e.attr("transform",f.getTranslate("y2")),f.main.select("."+l.chartArcs).attr("transform",f.getTranslate("arc"))},i.transformAll=function(a,b){var c=this;c.transformMain(a,b),c.config.subchart_show&&c.transformContext(a,b),c.legend&&c.transformLegend(a)},i.updateSvgSize=function(){var a=this,b=a.svg.select(".c3-brush .background");a.svg.attr("width",a.currentWidth).attr("height",a.currentHeight),a.svg.selectAll(["#"+a.clipId,"#"+a.clipIdForGrid]).select("rect").attr("width",a.width).attr("height",a.height),a.svg.select("#"+a.clipIdForXAxis).select("rect").attr("x",a.getXAxisClipX.bind(a)).attr("y",a.getXAxisClipY.bind(a)).attr("width",a.getXAxisClipWidth.bind(a)).attr("height",a.getXAxisClipHeight.bind(a)),a.svg.select("#"+a.clipIdForYAxis).select("rect").attr("x",a.getYAxisClipX.bind(a)).attr("y",a.getYAxisClipY.bind(a)).attr("width",a.getYAxisClipWidth.bind(a)).attr("height",a.getYAxisClipHeight.bind(a)),a.svg.select("#"+a.clipIdForSubchart).select("rect").attr("width",a.width).attr("height",b.size()?b.attr("height"):0),a.svg.select("."+l.zoomRect).attr("width",a.width).attr("height",a.height),a.selectChart.style("max-height",a.currentHeight+"px")},i.updateDimension=function(a){var b=this;a||(b.config.axis_rotated?(b.axes.x.call(b.xAxis),b.axes.subx.call(b.subXAxis)):(b.axes.y.call(b.yAxis),b.axes.y2.call(b.y2Axis))),b.updateSizes(),b.updateScales(),b.updateSvgSize(),b.transformAll(!1)},i.observeInserted=function(b){var c,d=this;return"undefined"==typeof MutationObserver?void a.console.error("MutationObserver not defined."):(c=new MutationObserver(function(e){e.forEach(function(e){"childList"===e.type&&e.previousSibling&&(c.disconnect(),d.intervalForObserveInserted=a.setInterval(function(){b.node().parentNode&&(a.clearInterval(d.intervalForObserveInserted),d.updateDimension(),d.config.oninit.call(d),d.redraw({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransition:!1,withTransitionForTransform:!1,withLegend:!0}),b.transition().style("opacity",1))},10))})}),void c.observe(b.node(),{attributes:!0,childList:!0,characterData:!0}))},i.generateResize=function(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a},i.endall=function(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})},i.generateWait=function(){var a=[],b=function(b,c){var d=setInterval(function(){var b=0;a.forEach(function(a){if(a.empty())return void(b+=1);try{a.transition()}catch(c){b+=1}}),b===a.length&&(clearInterval(d),c&&c())},10)};return b.add=function(b){a.push(b)},b},i.parseDate=function(b){var c,d=this;return b instanceof Date?c=b:"string"==typeof b?c=d.dataTimeFormat(d.config.data_xFormat).parse(b):"number"!=typeof b&&isNaN(b)||(c=new Date(+b)),(!c||isNaN(+c))&&a.console.error("Failed to parse x '"+b+"' to Date object"),c},i.isTabVisible=function(){var a;return"undefined"!=typeof document.hidden?a="hidden":"undefined"!=typeof document.mozHidden?a="mozHidden":"undefined"!=typeof document.msHidden?a="msHidden":"undefined"!=typeof document.webkitHidden&&(a="webkitHidden"),document[a]?!1:!0},i.getDefaultConfig=function(){var a={bindto:"#chart",size_width:void 0,size_height:void 0,padding_left:void 0,padding_right:void 0,padding_top:void 0,padding_bottom:void 0,zoom_enabled:!1,zoom_extent:void 0,zoom_privileged:!1,zoom_rescale:!1,zoom_onzoom:function(){},zoom_onzoomstart:function(){},zoom_onzoomend:function(){},interaction_enabled:!0,onmouseover:function(){},onmouseout:function(){},onresize:function(){},onresized:function(){},oninit:function(){},onrendered:function(){},transition_duration:350,data_x:void 0,data_xs:{},data_xFormat:"%Y-%m-%d",data_xLocaltime:!0,data_xSort:!0,data_idConverter:function(a){return a},data_names:{},data_classes:{},data_groups:[],data_axes:{},data_type:void 0,data_types:{},data_labels:{},data_order:"desc",data_regions:{},data_color:void 0,data_colors:{},data_hide:!1,data_filter:void 0,data_selection_enabled:!1,data_selection_grouped:!1,data_selection_isselectable:function(){return!0},data_selection_multiple:!0,data_selection_draggable:!1,data_onclick:function(){},data_onmouseover:function(){},data_onmouseout:function(){},data_onselected:function(){},data_onunselected:function(){},data_url:void 0,data_json:void 0,data_rows:void 0,data_columns:void 0,data_mimeType:void 0,data_keys:void 0,data_empty_label_text:"",subchart_show:!1,subchart_size_height:60,subchart_onbrush:function(){},color_pattern:[],color_threshold:{},legend_show:!0,legend_hide:!1,legend_position:"bottom",legend_inset_anchor:"top-left",legend_inset_x:10,legend_inset_y:0,legend_inset_step:void 0,legend_item_onclick:void 0,legend_item_onmouseover:void 0,legend_item_onmouseout:void 0,legend_equally:!1,axis_rotated:!1,axis_x_show:!0,axis_x_type:"indexed",axis_x_localtime:!0,axis_x_categories:[],axis_x_tick_centered:!1,axis_x_tick_format:void 0,axis_x_tick_culling:{},axis_x_tick_culling_max:10,axis_x_tick_count:void 0,axis_x_tick_fit:!0,axis_x_tick_values:null,axis_x_tick_rotate:0,axis_x_tick_outer:!0,axis_x_tick_multiline:!0,axis_x_tick_width:null,axis_x_max:void 0,axis_x_min:void 0,axis_x_padding:{},axis_x_height:void 0,axis_x_extent:void 0,axis_x_label:{},axis_y_show:!0,axis_y_type:void 0,axis_y_max:void 0,axis_y_min:void 0,axis_y_inverted:!1,axis_y_center:void 0,axis_y_inner:void 0,axis_y_label:{},axis_y_tick_format:void 0,axis_y_tick_outer:!0,axis_y_tick_values:null,axis_y_tick_count:void 0,axis_y_tick_time_value:void 0,axis_y_tick_time_interval:void 0,axis_y_padding:{},axis_y_default:void 0,axis_y2_show:!1,axis_y2_max:void 0,axis_y2_min:void 0,axis_y2_inverted:!1,axis_y2_center:void 0,axis_y2_inner:void 0,axis_y2_label:{},axis_y2_tick_format:void 0,axis_y2_tick_outer:!0,axis_y2_tick_values:null,axis_y2_tick_count:void 0,axis_y2_padding:{},axis_y2_default:void 0,grid_x_show:!1,grid_x_type:"tick",grid_x_lines:[],grid_y_show:!1,grid_y_lines:[],grid_y_ticks:10,grid_focus_show:!0,grid_lines_front:!0,point_show:!0,point_r:2.5,point_focus_expand_enabled:!0,point_focus_expand_r:void 0,point_select_r:void 0,line_connectNull:!1,line_step_type:"step",bar_width:void 0,bar_width_ratio:.6,bar_width_max:void 0,bar_zerobased:!0,area_zerobased:!0,pie_label_show:!0,pie_label_format:void 0,pie_label_threshold:.05,pie_expand:!0,gauge_label_show:!0,gauge_label_format:void 0,gauge_expand:!0,gauge_min:0,gauge_max:100,gauge_units:void 0,gauge_width:void 0,donut_label_show:!0,donut_label_format:void 0,donut_label_threshold:.05,donut_width:void 0,donut_expand:!0,donut_title:"",regions:[],tooltip_show:!0,tooltip_grouped:!0,tooltip_format_title:void 0,tooltip_format_name:void 0,tooltip_format_value:void 0,tooltip_position:void 0,tooltip_contents:function(a,b,c,d){return this.getTooltipContent?this.getTooltipContent(a,b,c,d):""},tooltip_init_show:!1,tooltip_init_x:0,tooltip_init_position:{top:"0px",left:"50px"}};return Object.keys(this.additionalConfig).forEach(function(b){a[b]=this.additionalConfig[b]},this),a},i.additionalConfig={},i.loadConfig=function(a){function b(){var a=d.shift();return a&&c&&"object"==typeof c&&a in c?(c=c[a],b()):a?void 0:c}var c,d,e,f=this.config;Object.keys(f).forEach(function(g){c=a,d=g.split("_"),e=b(),q(e)&&(f[g]=e)})},i.getScale=function(a,b,c){return(c?this.d3.time.scale():this.d3.scale.linear()).range([a,b])},i.getX=function(a,b,c,d){var e,f=this,g=f.getScale(a,b,f.isTimeSeries()),h=c?g.domain(c):g;f.isCategorized()?(d=d||function(){return 0},g=function(a,b){var c=h(a)+d(a);return b?c:Math.ceil(c)}):g=function(a,b){var c=h(a);return b?c:Math.ceil(c)};for(e in h)g[e]=h[e];return g.orgDomain=function(){return h.domain()},f.isCategorized()&&(g.domain=function(a){return arguments.length?(h.domain(a),g):(a=this.orgDomain(),[a[0],a[1]+1])}),g},i.getY=function(a,b,c){var d=this.getScale(a,b,this.isTimeSeriesY());return c&&d.domain(c),d},i.getYScale=function(a){return"y2"===this.axis.getId(a)?this.y2:this.y},i.getSubYScale=function(a){return"y2"===this.axis.getId(a)?this.subY2:this.subY},i.updateScales=function(){var a=this,b=a.config,c=!a.x;a.xMin=b.axis_rotated?1:0,a.xMax=b.axis_rotated?a.height:a.width,a.yMin=b.axis_rotated?0:a.height,a.yMax=b.axis_rotated?a.width:1,a.subXMin=a.xMin,a.subXMax=a.xMax,a.subYMin=b.axis_rotated?0:a.height2,a.subYMax=b.axis_rotated?a.width2:1,a.x=a.getX(a.xMin,a.xMax,c?void 0:a.x.orgDomain(),function(){return a.xAxis.tickOffset()}),a.y=a.getY(a.yMin,a.yMax,c?b.axis_y_default:a.y.domain()),a.y2=a.getY(a.yMin,a.yMax,c?b.axis_y2_default:a.y2.domain()),a.subX=a.getX(a.xMin,a.xMax,a.orgXDomain,function(b){return b%1?0:a.subXAxis.tickOffset()}),a.subY=a.getY(a.subYMin,a.subYMax,c?b.axis_y_default:a.subY.domain()),a.subY2=a.getY(a.subYMin,a.subYMax,c?b.axis_y2_default:a.subY2.domain()),a.xAxisTickFormat=a.axis.getXAxisTickFormat(),a.xAxisTickValues=a.axis.getXAxisTickValues(),a.yAxisTickValues=a.axis.getYAxisTickValues(),a.y2AxisTickValues=a.axis.getY2AxisTickValues(),a.xAxis=a.axis.getXAxis(a.x,a.xOrient,a.xAxisTickFormat,a.xAxisTickValues,b.axis_x_tick_outer),a.subXAxis=a.axis.getXAxis(a.subX,a.subXOrient,a.xAxisTickFormat,a.xAxisTickValues,b.axis_x_tick_outer),a.yAxis=a.axis.getYAxis(a.y,a.yOrient,b.axis_y_tick_format,a.yAxisTickValues,b.axis_y_tick_outer),a.y2Axis=a.axis.getYAxis(a.y2,a.y2Orient,b.axis_y2_tick_format,a.y2AxisTickValues,b.axis_y2_tick_outer),c||(a.brush&&a.brush.scale(a.subX),b.zoom_enabled&&a.zoom.scale(a.x)),a.updateArc&&a.updateArc()},i.getYDomainMin=function(a){var b,c,d,e,f,g,h=this,i=h.config,j=h.mapToIds(a),k=h.getValuesAsIdKeyed(a);if(i.data_groups.length>0)for(g=h.hasNegativeValueInTargets(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&k[d]&&k[d].forEach(function(a,b){k[d][b]=0>a?a:0}),c=1;c0||(k[d][b]+=+a)});return h.d3.min(Object.keys(k).map(function(a){return h.d3.min(k[a])}))},i.getYDomainMax=function(a){var b,c,d,e,f,g,h=this,i=h.config,j=h.mapToIds(a),k=h.getValuesAsIdKeyed(a);if(i.data_groups.length>0)for(g=h.hasPositiveValueInTargets(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&k[d]&&k[d].forEach(function(a,b){k[d][b]=a>0?a:0}),c=1;c+a||(k[d][b]+=+a)});return h.d3.max(Object.keys(k).map(function(a){return h.d3.max(k[a])}))},i.getYDomain=function(a,b,c){var d,e,f,g,h,i,j,k,l,n,o,p=this,q=p.config,r=a.filter(function(a){return p.axis.getId(a.id)===b}),s=c?p.filterByXDomain(r,c):r,u="y2"===b?q.axis_y2_min:q.axis_y_min,w="y2"===b?q.axis_y2_max:q.axis_y_max,x=p.getYDomainMin(s),y=p.getYDomainMax(s),z="y2"===b?q.axis_y2_center:q.axis_y_center,A=p.hasType("bar",s)&&q.bar_zerobased||p.hasType("area",s)&&q.area_zerobased,B="y2"===b?q.axis_y2_inverted:q.axis_y_inverted,C=p.hasDataLabel()&&q.axis_rotated,D=p.hasDataLabel()&&!q.axis_rotated;return x=m(u)?u:m(w)?w>x?x:w-10:x,y=m(w)?w:m(u)?y>u?y:u+10:y,0===s.length?"y2"===b?p.y2.domain():p.y.domain():(isNaN(x)&&(x=0),isNaN(y)&&(y=x),x===y&&(0>x?y=0:x=0),n=x>=0&&y>=0,o=0>=x&&0>=y,(m(u)&&n||m(w)&&o)&&(A=!1),A&&(n&&(x=0),o&&(y=0)),e=Math.abs(y-x),f=g=h=.1*e,"undefined"!=typeof z&&(i=Math.max(Math.abs(x),Math.abs(y)),y=z+i,x=z-i),C?(j=p.getDataLabelLength(x,y,"width"),k=t(p.y.range()),l=[j[0]/k,j[1]/k],g+=e*(l[1]/(1-l[0]-l[1])),h+=e*(l[0]/(1-l[0]-l[1]))):D&&(j=p.getDataLabelLength(x,y,"height"),g+=p.axis.convertPixelsToAxisPadding(j[1],e),h+=p.axis.convertPixelsToAxisPadding(j[0],e)),"y"===b&&v(q.axis_y_padding)&&(g=p.axis.getPadding(q.axis_y_padding,"top",g,e),h=p.axis.getPadding(q.axis_y_padding,"bottom",h,e)),"y2"===b&&v(q.axis_y2_padding)&&(g=p.axis.getPadding(q.axis_y2_padding,"top",g,e),h=p.axis.getPadding(q.axis_y2_padding,"bottom",h,e)),A&&(n&&(h=x),o&&(g=-y)),d=[x-h,y+g],B?d.reverse():d)},i.getXDomainMin=function(a){var b=this,c=b.config;return q(c.axis_x_min)?b.isTimeSeries()?this.parseDate(c.axis_x_min):c.axis_x_min:b.d3.min(a,function(a){return b.d3.min(a.values,function(a){return a.x})})},i.getXDomainMax=function(a){var b=this,c=b.config;return q(c.axis_x_max)?b.isTimeSeries()?this.parseDate(c.axis_x_max):c.axis_x_max:b.d3.max(a,function(a){return b.d3.max(a.values,function(a){return a.x})})},i.getXDomainPadding=function(a){var b,c,d,e,f=this,g=f.config,h=a[1]-a[0];return f.isCategorized()?c=0:f.hasType("bar")?(b=f.getMaxDataCount(),c=b>1?h/(b-1)/2:.5):c=.01*h,"object"==typeof g.axis_x_padding&&v(g.axis_x_padding)?(d=m(g.axis_x_padding.left)?g.axis_x_padding.left:c,e=m(g.axis_x_padding.right)?g.axis_x_padding.right:c):d=e="number"==typeof g.axis_x_padding?g.axis_x_padding:c,{left:d,right:e}},i.getXDomain=function(a){var b=this,c=[b.getXDomainMin(a),b.getXDomainMax(a)],d=c[0],e=c[1],f=b.getXDomainPadding(c),g=0,h=0; -return d-e!==0||b.isCategorized()||(b.isTimeSeries()?(d=new Date(.5*d.getTime()),e=new Date(1.5*e.getTime())):(d=0===d?1:.5*d,e=0===e?-1:1.5*e)),(d||0===d)&&(g=b.isTimeSeries()?new Date(d.getTime()-f.left):d-f.left),(e||0===e)&&(h=b.isTimeSeries()?new Date(e.getTime()+f.right):e+f.right),[g,h]},i.updateXDomain=function(a,b,c,d,e){var f=this,g=f.config;return c&&(f.x.domain(e?e:f.d3.extent(f.getXDomain(a))),f.orgXDomain=f.x.domain(),g.zoom_enabled&&f.zoom.scale(f.x).updateScaleExtent(),f.subX.domain(f.x.domain()),f.brush&&f.brush.scale(f.subX)),b&&(f.x.domain(e?e:!f.brush||f.brush.empty()?f.orgXDomain:f.brush.extent()),g.zoom_enabled&&f.zoom.scale(f.x).updateScaleExtent()),d&&f.x.domain(f.trimXDomain(f.x.orgDomain())),f.x.domain()},i.trimXDomain=function(a){var b=this;return a[0]<=b.orgXDomain[0]&&(a[1]=+a[1]+(b.orgXDomain[0]-a[0]),a[0]=b.orgXDomain[0]),b.orgXDomain[1]<=a[1]&&(a[0]=+a[0]-(a[1]-b.orgXDomain[1]),a[1]=b.orgXDomain[1]),a},i.isX=function(a){var b=this,c=b.config;return c.data_x&&a===c.data_x||v(c.data_xs)&&x(c.data_xs,a)},i.isNotX=function(a){return!this.isX(a)},i.getXKey=function(a){var b=this,c=b.config;return c.data_x?c.data_x:v(c.data_xs)?c.data_xs[a]:null},i.getXValuesOfXKey=function(a,b){var c,d=this,e=b&&v(b)?d.mapToIds(b):[];return e.forEach(function(b){d.getXKey(b)===a&&(c=d.data.xs[b])}),c},i.getIndexByX=function(a){var b=this,c=b.filterByX(b.data.targets,a);return c.length?c[0].index:null},i.getXValue=function(a,b){var c=this;return a in c.data.xs&&c.data.xs[a]&&m(c.data.xs[a][b])?c.data.xs[a][b]:b},i.getOtherTargetXs=function(){var a=this,b=Object.keys(a.data.xs);return b.length?a.data.xs[b[0]]:null},i.getOtherTargetX=function(a){var b=this.getOtherTargetXs();return b&&a1},i.isMultipleX=function(){return v(this.config.data_xs)||!this.config.data_xSort||this.hasType("scatter")},i.addName=function(a){var b,c=this;return a&&(b=c.config.data_names[a.id],a.name=b?b:a.id),a},i.getValueOnIndex=function(a,b){var c=a.filter(function(a){return a.index===b});return c.length?c[0]:null},i.updateTargetX=function(a,b){var c=this;a.forEach(function(a){a.values.forEach(function(d,e){d.x=c.generateTargetX(b[e],a.id,e)}),c.data.xs[a.id]=b})},i.updateTargetXs=function(a,b){var c=this;a.forEach(function(a){b[a.id]&&c.updateTargetX([a],b[a.id])})},i.generateTargetX=function(a,b,c){var d,e=this;return d=e.isTimeSeries()?e.parseDate(a?a:e.getXValue(b,c)):e.isCustomX()&&!e.isCategorized()?m(a)?+a:e.getXValue(b,c):c},i.cloneTarget=function(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}},i.updateXs=function(){var a=this;a.data.targets.length&&(a.xs=[],a.data.targets[0].values.forEach(function(b){a.xs[b.index]=b.x}))},i.getPrevX=function(a){var b=this.xs[a-1];return"undefined"!=typeof b?b:null},i.getNextX=function(a){var b=this.xs[a+1];return"undefined"!=typeof b?b:null},i.getMaxDataCount=function(){var a=this;return a.d3.max(a.data.targets,function(a){return a.values.length})},i.getMaxDataCountTarget=function(a){var b,c=a.length,d=0;return c>1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b},i.getEdgeX=function(a){var b=this;return a.length?[b.d3.min(a,function(a){return a.values[0].x}),b.d3.max(a,function(a){return a.values[a.values.length-1].x})]:[0,0]},i.mapToIds=function(a){return a.map(function(a){return a.id})},i.mapToTargetIds=function(a){var b=this;return a?o(a)?[a]:a:b.mapToIds(b.data.targets)},i.hasTarget=function(a,b){var c,d=this.mapToIds(a);for(c=0;ca})},i.hasPositiveValueInTargets=function(a){return this.checkValueInTargets(a,function(a){return a>0})},i.isOrderDesc=function(){var a=this.config;return"string"==typeof a.data_order&&"desc"===a.data_order.toLowerCase()},i.isOrderAsc=function(){var a=this.config;return"string"==typeof a.data_order&&"asc"===a.data_order.toLowerCase()},i.orderTargets=function(a){var b=this,c=b.config,d=b.isOrderAsc(),e=b.isOrderDesc();return d||e?a.sort(function(a,b){var c=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(c,0),f=b.values.reduce(c,0);return d?f-e:e-f}):n(c.data_order)&&a.sort(c.data_order),a},i.filterByX=function(a,b){return this.d3.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})},i.filterRemoveNull=function(a){return a.filter(function(a){return m(a.value)})},i.filterByXDomain=function(a,b){return a.map(function(a){return{id:a.id,id_org:a.id_org,values:a.values.filter(function(a){return b[0]<=a.x&&a.x<=b[1]})}})},i.hasDataLabel=function(){var a=this.config;return"boolean"==typeof a.data_labels&&a.data_labels?!0:"object"==typeof a.data_labels&&v(a.data_labels)?!0:!1},i.getDataLabelLength=function(a,b,c){var d=this,e=[0,0],f=1.3;return d.selectChart.select("svg").selectAll(".dummy").data([a,b]).enter().append("text").text(function(a){return d.dataLabelFormat(a.id)(a)}).each(function(a,b){e[b]=this.getBoundingClientRect()[c]*f}).remove(),e},i.isNoneArc=function(a){return this.hasTarget(this.data.targets,a.id)},i.isArc=function(a){return"data"in a&&this.hasTarget(this.data.targets,a.data.id)},i.findSameXOfValues=function(a,b){var c,d=a[b].x,e=[];for(c=b-1;c>=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;cf&&(e=f,c=a)}),c},i.dist=function(a,b){var c=this,d=c.config,e=d.axis_rotated?1:0,f=d.axis_rotated?0:1,g=c.circleY(a,a.index),h=c.x(a.x);return Math.pow(h-b[e],2)+Math.pow(g-b[f],2)},i.convertValuesToStep=function(a){var b,c=[].concat(a);if(!this.isCategorized())return a;for(b=a.length+1;b>0;b--)c[b]=c[b-1];return c[0]={x:c[0].x-1,value:c[0].value,id:c[0].id},c[a.length+1]={x:c[a.length].x+1,value:c[a.length].value,id:c[a.length].id},c},i.updateDataAttributes=function(a,b){var c=this,d=c.config,e=d["data_"+a];return"undefined"==typeof b?e:(Object.keys(b).forEach(function(a){e[a]=b[a]}),c.redraw({withLegend:!0}),e)},i.convertUrlToData=function(a,b,c,d){var e=this,f=b?b:"csv";e.d3.xhr(a,function(a,b){var g;if(!b)throw new Error(a.responseURL+" "+a.status+" ("+a.statusText+")");g="json"===f?e.convertJsonToData(JSON.parse(b.response),c):"tsv"===f?e.convertTsvToData(b.response):e.convertCsvToData(b.response),d.call(e,g)})},i.convertXsvToData=function(a,b){var c,d=b.parseRows(a);return 1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=b.parse(a),c},i.convertCsvToData=function(a){return this.convertXsvToData(a,this.d3.csv)},i.convertTsvToData=function(a){return this.convertXsvToData(a,this.d3.tsv)},i.convertJsonToData=function(a,b){var c,d,e=this,f=[];return b?(b.x?(c=b.value.concat(b.x),e.config.data_x=b.x):c=b.value,f.push(c),a.forEach(function(a){var b=[];c.forEach(function(c){var d=p(a[c])?null:a[c];b.push(d)}),f.push(b)}),d=e.convertRowsToData(f)):(Object.keys(a).forEach(function(b){f.push([b].concat(a[b]))}),d=e.convertColumnsToData(f)),d},i.convertRowsToData=function(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?d.data.xs[c]=(b&&d.data.xs[c]?d.data.xs[c]:[]).concat(a.map(function(a){return a[f]}).filter(m).map(function(a,b){return d.generateTargetX(a,c,b)})):e.data_x?d.data.xs[c]=d.getOtherTargetXs():v(e.data_xs)&&(d.data.xs[c]=d.getXValuesOfXKey(f,d.data.targets)):d.data.xs[c]=a.map(function(a,b){return b})}),f.forEach(function(a){if(!d.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=f.map(function(b,c){var f=e.data_idConverter(b);return{id:f,id_org:b,values:a.map(function(a,g){var h=d.getXKey(b),i=a[h],j=d.generateTargetX(i,b,g);return d.isCustomX()&&d.isCategorized()&&0===c&&i&&(0===g&&(e.axis_x_categories=[]),e.axis_x_categories.push(i)),(p(a[b])||d.data.xs[b].length<=g)&&(j=void 0),{x:j,value:null===a[b]||isNaN(a[b])?null:+a[b],id:f}}).filter(function(a){return q(a.x)})}}),c.forEach(function(a){var b;e.data_xSort&&(a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d})),b=0,a.values.forEach(function(a){a.index=b++}),d.data.xs[a.id].sort(function(a,b){return a-b})}),e.data_type&&d.setTargetType(d.mapToIds(c).filter(function(a){return!(a in e.data_types)}),e.data_type),c.forEach(function(a){d.addCache(a.id_org,a)}),c},i.load=function(a,b){var c=this;a&&(b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){var d=b.types&&b.types[a.id]?b.types[a.id]:b.type;c.setTargetType(a.id,d)}),c.data.targets.forEach(function(b){for(var c=0;c0?c:320/(a.hasType("gauge")?2:1)},i.getCurrentPaddingTop=function(){var a=this.config;return m(a.padding_top)?a.padding_top:0},i.getCurrentPaddingBottom=function(){var a=this.config;return m(a.padding_bottom)?a.padding_bottom:0},i.getCurrentPaddingLeft=function(a){var b=this,c=b.config;return m(c.padding_left)?c.padding_left:c.axis_rotated?c.axis_x_show?Math.max(r(b.getAxisWidthByAxisId("x",a)),40):1:!c.axis_y_show||c.axis_y_inner?b.axis.getYAxisLabelPosition().isOuter?30:1:r(b.getAxisWidthByAxisId("y",a))},i.getCurrentPaddingRight=function(){var a=this,b=a.config,c=10,d=a.isLegendRight?a.getLegendWidth()+20:0;return m(b.padding_right)?b.padding_right+1:b.axis_rotated?c+d:!b.axis_y2_show||b.axis_y2_inner?2+d+(a.axis.getY2AxisLabelPosition().isOuter?20:0):r(a.getAxisWidthByAxisId("y2"))+d},i.getParentRectValue=function(a){for(var b,c=this.selectChart.node();c&&"BODY"!==c.tagName;){try{b=c.getBoundingClientRect()[a]}catch(d){"width"===a&&(b=c.offsetWidth)}if(b)break;c=c.parentNode}return b},i.getParentWidth=function(){return this.getParentRectValue("width")},i.getParentHeight=function(){var a=this.selectChart.style("height");return a.indexOf("px")>0?+a.replace("px",""):0},i.getSvgLeft=function(a){var b=this,c=b.config,d=c.axis_rotated||!c.axis_rotated&&!c.axis_y_inner,e=c.axis_rotated?l.axisX:l.axisY,f=b.main.select("."+e).node(),g=f&&d?f.getBoundingClientRect():{right:0},h=b.selectChart.node().getBoundingClientRect(),i=b.hasArcType(),j=g.right-h.left-(i?0:b.getCurrentPaddingLeft(a));return j>0?j:0},i.getAxisWidthByAxisId=function(a,b){var c=this,d=c.axis.getLabelPositionById(a);return c.axis.getMaxTickWidth(a,b)+(d.isInner?20:40)},i.getHorizontalAxisHeight=function(a){var b=this,c=b.config,d=30;return"x"!==a||c.axis_x_show?"x"===a&&c.axis_x_height?c.axis_x_height:"y"!==a||c.axis_y_show?"y2"!==a||c.axis_y2_show?("x"===a&&!c.axis_rotated&&c.axis_x_tick_rotate&&(d=30+b.axis.getMaxTickWidth(a)*Math.cos(Math.PI*(90-c.axis_x_tick_rotate)/180)),d+(b.axis.getLabelPositionById(a).isInner?0:10)+("y2"===a?-10:0)):b.rotated_padding_top:!c.legend_show||b.isLegendRight||b.isLegendInset?1:10:8},i.getEventRectWidth=function(){return Math.max(0,this.xAxis.tickInterval())},i.getShapeIndices=function(a){var b,c,d=this,e=d.config,f={},g=0;return d.filterTargetsToShow(d.data.targets.filter(a,d)).forEach(function(a){for(b=0;b=0&&(j+=h(e[g].value)-i)}),j}},i.isWithinShape=function(a,b){var c,d=this,e=d.d3.select(a);return d.isTargetToShow(b.id)?"circle"===a.nodeName?c=d.isStepType(b)?d.isWithinStep(a,d.getYScale(b.id)(b.value)):d.isWithinCircle(a,1.5*d.pointSelectR(b)):"path"===a.nodeName&&(c=e.classed(l.bar)?d.isWithinBar(a):!0):c=!1,c},i.getInterpolate=function(a){var b=this;return b.isSplineType(a)?"cardinal":b.isStepType(a)?b.config.line_step_type:"linear"},i.initLine=function(){var a=this;a.main.select("."+l.chart).append("g").attr("class",l.chartLines)},i.updateTargetsForLine=function(a){var b,c,d=this,e=d.config,f=d.classChartLine.bind(d),g=d.classLines.bind(d),h=d.classAreas.bind(d),i=d.classCircles.bind(d),j=d.classFocus.bind(d);b=d.main.select("."+l.chartLines).selectAll("."+l.chartLine).data(a).attr("class",function(a){return f(a)+j(a)}),c=b.enter().append("g").attr("class",f).style("opacity",0).style("pointer-events","none"),c.append("g").attr("class",g),c.append("g").attr("class",h),c.append("g").attr("class",function(a){return d.generateClass(l.selectedCircles,a.id)}),c.append("g").attr("class",i).style("cursor",function(a){return e.data_selection_isselectable(a)?"pointer":null}),a.forEach(function(a){d.main.selectAll("."+l.selectedCircles+d.getTargetSelectorSuffix(a.id)).selectAll("."+l.selectedCircle).each(function(b){b.value=a.values[b.index].value})})},i.updateLine=function(a){var b=this;b.mainLine=b.main.selectAll("."+l.lines).selectAll("."+l.line).data(b.lineData.bind(b)),b.mainLine.enter().append("path").attr("class",b.classLine.bind(b)).style("stroke",b.color),b.mainLine.style("opacity",b.initialOpacity.bind(b)).style("shape-rendering",function(a){return b.isStepType(a)?"crispEdges":""}).attr("transform",null),b.mainLine.exit().transition().duration(a).style("opacity",0).remove()},i.redrawLine=function(a,b){return[(b?this.mainLine.transition():this.mainLine).attr("d",a).style("stroke",this.color).style("opacity",1)]},i.generateDrawLine=function(a,b){var c=this,d=c.config,e=c.d3.svg.line(),f=c.generateGetLinePoints(a,b),g=b?c.getSubYScale:c.getYScale,h=function(a){return(b?c.subxx:c.xx).call(c,a)},i=function(a,b){return d.data_groups.length>0?f(a,b)[0][1]:g.call(c,a.id)(a.value)};return e=d.axis_rotated?e.x(i).y(h):e.x(h).y(i),d.line_connectNull||(e=e.defined(function(a){return null!=a.value})),function(a){var f,h=d.line_connectNull?c.filterRemoveNull(a.values):a.values,i=b?c.x:c.subX,j=g.call(c,a.id),k=0,l=0;return c.isLineType(a)?d.data_regions[a.id]?f=c.lineWithRegions(h,i,j,d.data_regions[a.id]):(c.isStepType(a)&&(h=c.convertValuesToStep(h)),f=e.interpolate(c.getInterpolate(a))(h)):(h[0]&&(k=i(h[0].x),l=j(h[0].value)),f=d.axis_rotated?"M "+l+" "+k:"M "+k+" "+l),f?f:"M 0 0"}},i.generateGetLinePoints=function(a,b){var c=this,d=c.config,e=a.__max__+1,f=c.getShapeX(0,e,a,!!b),g=c.getShapeY(!!b),h=c.getShapeOffset(c.isLineType,a,!!b),i=b?c.getSubYScale:c.getYScale;return function(a,b){var e=i.call(c,a.id)(0),j=h(a,b)||e,k=f(a),l=g(a);return d.axis_rotated&&(0l||a.value<0&&l>e)&&(l=e),[[k,l-(e-j)],[k,l-(e-j)],[k,l-(e-j)],[k,l-(e-j)]]}},i.lineWithRegions=function(a,b,c,d){function e(a,b){var c;for(c=0;c=h;h+=r)x+=i(a[g-1],a[g],h,o);w=a[g].x}return x},i.updateArea=function(a){var b=this,c=b.d3;b.mainArea=b.main.selectAll("."+l.areas).selectAll("."+l.area).data(b.lineData.bind(b)),b.mainArea.enter().append("path").attr("class",b.classArea.bind(b)).style("fill",b.color).style("opacity",function(){return b.orgAreaOpacity=+c.select(this).style("opacity"),0}),b.mainArea.style("opacity",b.orgAreaOpacity),b.mainArea.exit().transition().duration(a).style("opacity",0).remove()},i.redrawArea=function(a,b){return[(b?this.mainArea.transition():this.mainArea).attr("d",a).style("fill",this.color).style("opacity",this.orgAreaOpacity)]},i.generateDrawArea=function(a,b){var c=this,d=c.config,e=c.d3.svg.area(),f=c.generateGetAreaPoints(a,b),g=b?c.getSubYScale:c.getYScale,h=function(a){return(b?c.subxx:c.xx).call(c,a)},i=function(a,b){return d.data_groups.length>0?f(a,b)[0][1]:g.call(c,a.id)(c.getAreaBaseValue(a.id))},j=function(a,b){return d.data_groups.length>0?f(a,b)[1][1]:g.call(c,a.id)(a.value)};return e=d.axis_rotated?e.x0(i).x1(j).y(h):e.x(h).y0(i).y1(j),d.line_connectNull||(e=e.defined(function(a){return null!==a.value})),function(a){var b,f=d.line_connectNull?c.filterRemoveNull(a.values):a.values,g=0,h=0;return c.isAreaType(a)?(c.isStepType(a)&&(f=c.convertValuesToStep(f)),b=e.interpolate(c.getInterpolate(a))(f)):(f[0]&&(g=c.x(f[0].x),h=c.getYScale(a.id)(f[0].value)),b=d.axis_rotated?"M "+h+" "+g:"M "+g+" "+h),b?b:"M 0 0"}},i.getAreaBaseValue=function(){return 0},i.generateGetAreaPoints=function(a,b){var c=this,d=c.config,e=a.__max__+1,f=c.getShapeX(0,e,a,!!b),g=c.getShapeY(!!b),h=c.getShapeOffset(c.isAreaType,a,!!b),i=b?c.getSubYScale:c.getYScale;return function(a,b){var e=i.call(c,a.id)(0),j=h(a,b)||e,k=f(a),l=g(a);return d.axis_rotated&&(0l||a.value<0&&l>e)&&(l=e),[[k,j],[k,l-(e-j)],[k,l-(e-j)],[k,j]]}},i.updateCircle=function(){var a=this;a.mainCircle=a.main.selectAll("."+l.circles).selectAll("."+l.circle).data(a.lineOrScatterData.bind(a)),a.mainCircle.enter().append("circle").attr("class",a.classCircle.bind(a)).attr("r",a.pointR.bind(a)).style("fill",a.color),a.mainCircle.style("opacity",a.initialOpacityForCircle.bind(a)),a.mainCircle.exit().remove()},i.redrawCircle=function(a,b,c){var d=this.main.selectAll("."+l.selectedCircle);return[(c?this.mainCircle.transition():this.mainCircle).style("opacity",this.opacityForCircle.bind(this)).style("fill",this.color).attr("cx",a).attr("cy",b),(c?d.transition():d).attr("cx",a).attr("cy",b)]},i.circleX=function(a){return a.x||0===a.x?this.x(a.x):null},i.updateCircleY=function(){var a,b,c=this;c.config.data_groups.length>0?(a=c.getShapeIndices(c.isLineType),b=c.generateGetLinePoints(a),c.circleY=function(a,c){return b(a,c)[0][1]}):c.circleY=function(a){return c.getYScale(a.id)(a.value)}},i.getCircles=function(a,b){var c=this;return(b?c.main.selectAll("."+l.circles+c.getTargetSelectorSuffix(b)):c.main).selectAll("."+l.circle+(m(a)?"-"+a:""))},i.expandCircles=function(a,b,c){var d=this,e=d.pointExpandedR.bind(d);c&&d.unexpandCircles(),d.getCircles(a,b).classed(l.EXPANDED,!0).attr("r",e)},i.unexpandCircles=function(a){var b=this,c=b.pointR.bind(b);b.getCircles(a).filter(function(){return b.d3.select(this).classed(l.EXPANDED)}).classed(l.EXPANDED,!1).attr("r",c)},i.pointR=function(a){var b=this,c=b.config;return b.isStepType(a)?0:n(c.point_r)?c.point_r(a):c.point_r},i.pointExpandedR=function(a){var b=this,c=b.config;return c.point_focus_expand_enabled?c.point_focus_expand_r?c.point_focus_expand_r:1.75*b.pointR(a):b.pointR(a)},i.pointSelectR=function(a){var b=this,c=b.config;return c.point_select_r?c.point_select_r:4*b.pointR(a)},i.isWithinCircle=function(a,b){var c=this.d3,d=c.mouse(a),e=c.select(a),f=+e.attr("cx"),g=+e.attr("cy");return Math.sqrt(Math.pow(f-d[0],2)+Math.pow(g-d[1],2))d.bar_width_max?d.bar_width_max:e},i.getBars=function(a,b){var c=this;return(b?c.main.selectAll("."+l.bars+c.getTargetSelectorSuffix(b)):c.main).selectAll("."+l.bar+(m(a)?"-"+a:""))},i.expandBars=function(a,b,c){var d=this;c&&d.unexpandBars(),d.getBars(a,b).classed(l.EXPANDED,!0)},i.unexpandBars=function(a){var b=this;b.getBars(a).classed(l.EXPANDED,!1)},i.generateDrawBar=function(a,b){var c=this,d=c.config,e=c.generateGetBarPoints(a,b);return function(a,b){var c=e(a,b),f=d.axis_rotated?1:0,g=d.axis_rotated?0:1,h="M "+c[0][f]+","+c[0][g]+" L"+c[1][f]+","+c[1][g]+" L"+c[2][f]+","+c[2][g]+" L"+c[3][f]+","+c[3][g]+" z";return h}},i.generateGetBarPoints=function(a,b){var c=this,d=b?c.subXAxis:c.xAxis,e=a.__max__+1,f=c.getBarW(d,e),g=c.getShapeX(f,e,a,!!b),h=c.getShapeY(!!b),i=c.getShapeOffset(c.isBarType,a,!!b),j=b?c.getSubYScale:c.getYScale; -return function(a,b){var d=j.call(c,a.id)(0),e=i(a,b)||d,k=g(a),l=h(a);return c.config.axis_rotated&&(0l||a.value<0&&l>d)&&(l=d),[[k,e],[k,l-(d-e)],[k+f,l-(d-e)],[k+f,e]]}},i.isWithinBar=function(a){var b=this.d3.mouse(a),c=a.getBoundingClientRect(),d=a.pathSegList.getItem(0),e=a.pathSegList.getItem(1),f=Math.min(d.x,e.x),g=Math.min(d.y,e.y),h=c.width,i=c.height,j=2,k=f-j,l=f+h+j,m=g+i+j,n=g-j;return kf.width?d=f.width-g.width:0>d&&(d=4)),d},i.getYForText=function(a,b,c){var d,e=this,f=c.getBoundingClientRect();return e.config.axis_rotated?d=(a[0][0]+a[2][0]+.6*f.height)/2:(d=a[2][1],b.value<0?(d+=f.height,e.isBarType(b)&&e.isSafari()?d-=3:!e.isBarType(b)&&e.isChrome()&&(d+=3)):d+=e.isBarType(b)?-3:-6),null!==b.value||e.config.axis_rotated||(dthis.height&&(d=this.height-4)),d},i.setTargetType=function(a,b){var c=this,d=c.config;c.mapToTargetIds(a).forEach(function(a){c.withoutFadeIn[a]=b===d.data_types[a],d.data_types[a]=b}),a||(d.data_type=b)},i.hasType=function(a,b){var c=this,d=c.config.data_types,e=!1;return b=b||c.data.targets,b&&b.length?b.forEach(function(b){var c=d[b.id];(c&&c.indexOf(a)>=0||!c&&"line"===a)&&(e=!0)}):Object.keys(d).length?Object.keys(d).forEach(function(b){d[b]===a&&(e=!0)}):e=c.config.data_type===a,e},i.hasArcType=function(a){return this.hasType("pie",a)||this.hasType("donut",a)||this.hasType("gauge",a)},i.isLineType=function(a){var b=this.config,c=o(a)?a:a.id;return!b.data_types[c]||["line","spline","area","area-spline","step","area-step"].indexOf(b.data_types[c])>=0},i.isStepType=function(a){var b=o(a)?a:a.id;return["step","area-step"].indexOf(this.config.data_types[b])>=0},i.isSplineType=function(a){var b=o(a)?a:a.id;return["spline","area-spline"].indexOf(this.config.data_types[b])>=0},i.isAreaType=function(a){var b=o(a)?a:a.id;return["area","area-spline","area-step"].indexOf(this.config.data_types[b])>=0},i.isBarType=function(a){var b=o(a)?a:a.id;return"bar"===this.config.data_types[b]},i.isScatterType=function(a){var b=o(a)?a:a.id;return"scatter"===this.config.data_types[b]},i.isPieType=function(a){var b=o(a)?a:a.id;return"pie"===this.config.data_types[b]},i.isGaugeType=function(a){var b=o(a)?a:a.id;return"gauge"===this.config.data_types[b]},i.isDonutType=function(a){var b=o(a)?a:a.id;return"donut"===this.config.data_types[b]},i.isArcType=function(a){return this.isPieType(a)||this.isDonutType(a)||this.isGaugeType(a)},i.lineData=function(a){return this.isLineType(a)?[a]:[]},i.arcData=function(a){return this.isArcType(a.data)?[a]:[]},i.barData=function(a){return this.isBarType(a)?a.values:[]},i.lineOrScatterData=function(a){return this.isLineType(a)||this.isScatterType(a)?a.values:[]},i.barOrLineData=function(a){return this.isBarType(a)||this.isLineType(a)?a.values:[]},i.initGrid=function(){var a=this,b=a.config,c=a.d3;a.grid=a.main.append("g").attr("clip-path",a.clipPathForGrid).attr("class",l.grid),b.grid_x_show&&a.grid.append("g").attr("class",l.xgrids),b.grid_y_show&&a.grid.append("g").attr("class",l.ygrids),b.grid_focus_show&&a.grid.append("g").attr("class",l.xgridFocus).append("line").attr("class",l.xgridFocus),a.xgrid=c.selectAll([]),b.grid_lines_front||a.initGridLines()},i.initGridLines=function(){var a=this,b=a.d3;a.gridLines=a.main.append("g").attr("clip-path",a.clipPathForGrid).attr("class",l.grid+" "+l.gridLines),a.gridLines.append("g").attr("class",l.xgridLines),a.gridLines.append("g").attr("class",l.ygridLines),a.xgridLines=b.selectAll([])},i.updateXGrid=function(a){var b=this,c=b.config,d=b.d3,e=b.generateGridData(c.grid_x_type,b.x),f=b.isCategorized()?b.xAxis.tickOffset():0;b.xgridAttr=c.axis_rotated?{x1:0,x2:b.width,y1:function(a){return b.x(a)-f},y2:function(a){return b.x(a)-f}}:{x1:function(a){return b.x(a)+f},x2:function(a){return b.x(a)+f},y1:0,y2:b.height},b.xgrid=b.main.select("."+l.xgrids).selectAll("."+l.xgrid).data(e),b.xgrid.enter().append("line").attr("class",l.xgrid),a||b.xgrid.attr(b.xgridAttr).style("opacity",function(){return+d.select(this).attr(c.axis_rotated?"y1":"x1")===(c.axis_rotated?b.height:0)?0:1}),b.xgrid.exit().remove()},i.updateYGrid=function(){var a=this,b=a.config,c=a.yAxis.tickValues()||a.y.ticks(b.grid_y_ticks);a.ygrid=a.main.select("."+l.ygrids).selectAll("."+l.ygrid).data(c),a.ygrid.enter().append("line").attr("class",l.ygrid),a.ygrid.attr("x1",b.axis_rotated?a.y:0).attr("x2",b.axis_rotated?a.y:a.width).attr("y1",b.axis_rotated?0:a.y).attr("y2",b.axis_rotated?a.height:a.y),a.ygrid.exit().remove(),a.smoothLines(a.ygrid,"grid")},i.gridTextAnchor=function(a){return a.position?a.position:"end"},i.gridTextDx=function(a){return"start"===a.position?4:"middle"===a.position?0:-4},i.xGridTextX=function(a){return"start"===a.position?-this.height:"middle"===a.position?-this.height/2:0},i.yGridTextX=function(a){return"start"===a.position?0:"middle"===a.position?this.width/2:this.width},i.updateGrid=function(a){var b,c,d,e=this,f=e.main,g=e.config;e.grid.style("visibility",e.hasArcType()?"hidden":"visible"),f.select("line."+l.xgridFocus).style("visibility","hidden"),g.grid_x_show&&e.updateXGrid(),e.xgridLines=f.select("."+l.xgridLines).selectAll("."+l.xgridLine).data(g.grid_x_lines),b=e.xgridLines.enter().append("g").attr("class",function(a){return l.xgridLine+(a["class"]?" "+a["class"]:"")}),b.append("line").style("opacity",0),b.append("text").attr("text-anchor",e.gridTextAnchor).attr("transform",g.axis_rotated?"":"rotate(-90)").attr("dx",e.gridTextDx).attr("dy",-5).style("opacity",0),e.xgridLines.exit().transition().duration(a).style("opacity",0).remove(),g.grid_y_show&&e.updateYGrid(),e.ygridLines=f.select("."+l.ygridLines).selectAll("."+l.ygridLine).data(g.grid_y_lines),c=e.ygridLines.enter().append("g").attr("class",function(a){return l.ygridLine+(a["class"]?" "+a["class"]:"")}),c.append("line").style("opacity",0),c.append("text").attr("text-anchor",e.gridTextAnchor).attr("transform",g.axis_rotated?"rotate(-90)":"").attr("dx",e.gridTextDx).attr("dy",-5).style("opacity",0),d=e.yv.bind(e),e.ygridLines.select("line").transition().duration(a).attr("x1",g.axis_rotated?d:0).attr("x2",g.axis_rotated?d:e.width).attr("y1",g.axis_rotated?0:d).attr("y2",g.axis_rotated?e.height:d).style("opacity",1),e.ygridLines.select("text").transition().duration(a).attr("x",g.axis_rotated?e.xGridTextX.bind(e):e.yGridTextX.bind(e)).attr("y",d).text(function(a){return a.text}).style("opacity",1),e.ygridLines.exit().transition().duration(a).style("opacity",0).remove()},i.redrawGrid=function(a){var b=this,c=b.config,d=b.xv.bind(b),e=b.xgridLines.select("line"),f=b.xgridLines.select("text");return[(a?e.transition():e).attr("x1",c.axis_rotated?0:d).attr("x2",c.axis_rotated?b.width:d).attr("y1",c.axis_rotated?d:0).attr("y2",c.axis_rotated?d:b.height).style("opacity",1),(a?f.transition():f).attr("x",c.axis_rotated?b.yGridTextX.bind(b):b.xGridTextX.bind(b)).attr("y",d).text(function(a){return a.text}).style("opacity",1)]},i.showXGridFocus=function(a){var b=this,c=b.config,d=a.filter(function(a){return a&&m(a.value)}),e=b.main.selectAll("line."+l.xgridFocus),f=b.xx.bind(b);c.tooltip_show&&(b.hasType("scatter")||b.hasArcType()||(e.style("visibility","visible").data([d[0]]).attr(c.axis_rotated?"y1":"x1",f).attr(c.axis_rotated?"y2":"x2",f),b.smoothLines(e,"grid")))},i.hideXGridFocus=function(){this.main.select("line."+l.xgridFocus).style("visibility","hidden")},i.updateXgridFocus=function(){var a=this,b=a.config;a.main.select("line."+l.xgridFocus).attr("x1",b.axis_rotated?0:-10).attr("x2",b.axis_rotated?a.width:-10).attr("y1",b.axis_rotated?-10:0).attr("y2",b.axis_rotated?-10:a.height)},i.generateGridData=function(a,b){var c,d,e,f,g=this,h=[],i=g.main.select("."+l.axisX).selectAll(".tick").size();if("year"===a)for(c=g.getXDomain(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10),h.length>i&&(h=h.filter(function(a){return(""+a).indexOf(".")<0}));return h},i.getGridFilterToRemove=function(a){return a?function(b){var c=!1;return[].concat(a).forEach(function(a){("value"in a&&b.value===a.value||"class"in a&&b["class"]===a["class"])&&(c=!0)}),c}:function(){return!0}},i.removeGridLines=function(a,b){var c=this,d=c.config,e=c.getGridFilterToRemove(a),f=function(a){return!e(a)},g=b?l.xgridLines:l.ygridLines,h=b?l.xgridLine:l.ygridLine;c.main.select("."+g).selectAll("."+h).filter(e).transition().duration(d.transition_duration).style("opacity",0).remove(),b?d.grid_x_lines=d.grid_x_lines.filter(f):d.grid_y_lines=d.grid_y_lines.filter(f)},i.initTooltip=function(){var a,b=this,c=b.config;if(b.tooltip=b.selectChart.style("position","relative").append("div").attr("class",l.tooltipContainer).style("position","absolute").style("pointer-events","none").style("display","none"),c.tooltip_init_show){if(b.isTimeSeries()&&o(c.tooltip_init_x)){for(c.tooltip_init_x=b.parseDate(c.tooltip_init_x),a=0;a"+(g||0===g?""+g+"":"")),h=p(a[f].value,a[f].ratio,a[f].id,a[f].index),void 0!==h&&(i=o(a[f].name,a[f].ratio,a[f].id,a[f].index),j=k.levelColor?k.levelColor(a[f].value):d(a[f].id),e+="",e+=""+i+"",e+=""+h+"",e+=""));return e+""},i.tooltipPosition=function(a,b,c,d){var e,f,g,h,i,j=this,k=j.config,l=j.d3,m=j.hasArcType(),n=l.mouse(d);return m?(f=(j.width-(j.isLegendRight?j.getLegendWidth():0))/2+n[0],h=j.height/2+n[1]+20):(e=j.getSvgLeft(!0),k.axis_rotated?(f=e+n[0]+100,g=f+b,i=j.currentWidth-j.getCurrentPaddingRight(),h=j.x(a[0].x)+20):(f=e+j.getCurrentPaddingLeft(!0)+j.x(a[0].x)+20,g=f+b,i=e+j.currentWidth-j.getCurrentPaddingRight(),h=n[1]+15),g>i&&(f-=g-i+20),h+c>j.currentHeight&&(h-=c+30)),0>h&&(h=0),{top:h,left:f}},i.showTooltip=function(a,b){var c,d,e,f=this,g=f.config,h=f.hasArcType(),j=a.filter(function(a){return a&&m(a.value)}),k=g.tooltip_position||i.tooltipPosition;0!==j.length&&g.tooltip_show&&(f.tooltip.html(g.tooltip_contents.call(f,a,f.axis.getXAxisTickFormat(),f.getYFormat(h),f.color)).style("display","block"),c=f.tooltip.property("offsetWidth"),d=f.tooltip.property("offsetHeight"),e=k.call(this,j,c,d,b),f.tooltip.style("top",e.top+"px").style("left",e.left+"px"))},i.hideTooltip=function(){this.tooltip.style("display","none")},i.initLegend=function(){var a=this;return a.legendItemTextBox={},a.legendHasRendered=!1,a.legend=a.svg.append("g").attr("transform",a.getTranslate("legend")),a.config.legend_show?void a.updateLegendWithDefaults():(a.legend.style("visibility","hidden"),void(a.hiddenLegendIds=a.mapToIds(a.data.targets)))},i.updateLegendWithDefaults=function(){var a=this;a.updateLegend(a.mapToIds(a.data.targets),{withTransform:!1,withTransitionForTransform:!1,withTransition:!1})},i.updateSizeForLegend=function(a,b){var c=this,d=c.config,e={top:c.isLegendTop?c.getCurrentPaddingTop()+d.legend_inset_y+5.5:c.currentHeight-a-c.getCurrentPaddingBottom()-d.legend_inset_y,left:c.isLegendLeft?c.getCurrentPaddingLeft()+d.legend_inset_x+.5:c.currentWidth-b-c.getCurrentPaddingRight()-d.legend_inset_x+.5};c.margin3={top:c.isLegendRight?0:c.isLegendInset?e.top:c.currentHeight-a,right:0/0,bottom:0,left:c.isLegendRight?c.currentWidth-b:c.isLegendInset?e.left:0}},i.transformLegend=function(a){var b=this;(a?b.legend.transition():b.legend).attr("transform",b.getTranslate("legend"))},i.updateLegendStep=function(a){this.legendStep=a},i.updateLegendItemWidth=function(a){this.legendItemWidth=a},i.updateLegendItemHeight=function(a){this.legendItemHeight=a},i.getLegendWidth=function(){var a=this;return a.config.legend_show?a.isLegendRight||a.isLegendInset?a.legendItemWidth*(a.legendStep+1):a.currentWidth:0},i.getLegendHeight=function(){var a=this,b=0;return a.config.legend_show&&(b=a.isLegendRight?a.currentHeight:Math.max(20,a.legendItemHeight)*(a.legendStep+1)),b},i.opacityForLegend=function(a){return a.classed(l.legendItemHidden)?null:1},i.opacityForUnfocusedLegend=function(a){return a.classed(l.legendItemHidden)?null:.3},i.toggleFocusLegend=function(a,b){var c=this;a=c.mapToTargetIds(a),c.legend.selectAll("."+l.legendItem).filter(function(b){return a.indexOf(b)>=0}).classed(l.legendItemFocused,b).transition().duration(100).style("opacity",function(){var a=b?c.opacityForLegend:c.opacityForUnfocusedLegend;return a.call(c,c.d3.select(this))})},i.revertLegend=function(){var a=this,b=a.d3;a.legend.selectAll("."+l.legendItem).classed(l.legendItemFocused,!1).transition().duration(100).style("opacity",function(){return a.opacityForLegend(b.select(this))})},i.showLegend=function(a){var b=this,c=b.config;c.legend_show||(c.legend_show=!0,b.legend.style("visibility","visible"),b.legendHasRendered||b.updateLegendWithDefaults()),b.removeHiddenLegendIds(a),b.legend.selectAll(b.selectorLegends(a)).style("visibility","visible").transition().style("opacity",function(){return b.opacityForLegend(b.d3.select(this))})},i.hideLegend=function(a){var b=this,c=b.config;c.legend_show&&u(a)&&(c.legend_show=!1,b.legend.style("visibility","hidden")),b.addHiddenLegendIds(a),b.legend.selectAll(b.selectorLegends(a)).style("opacity",0).style("visibility","hidden")},i.clearLegendItemTextBoxCache=function(){this.legendItemTextBox={}},i.updateLegend=function(a,b,c){function d(a,b){return u.legendItemTextBox[b]||(u.legendItemTextBox[b]=u.getTextRect(a.textContent,l.legendItem)),u.legendItemTextBox[b]}function e(b,c,e){function f(a,b){b||(g=(o-D-n)/2,B>g&&(g=(o-n)/2,D=0,J++)),I[a]=J,H[J]=u.isLegendInset?10:g,E[a]=D,D+=n}var g,h,i=0===e,j=e===a.length-1,k=d(b,c),l=k.width+C+(!j||u.isLegendRight||u.isLegendInset?y:0),m=k.height+x,n=u.isLegendRight||u.isLegendInset?m:l,o=u.isLegendRight||u.isLegendInset?u.getLegendHeight():u.getLegendWidth();return i&&(D=0,J=0,z=0,A=0),v.legend_show&&!u.isLegendToShow(c)?void(F[c]=G[c]=I[c]=E[c]=0):(F[c]=l,G[c]=m,(!z||l>=z)&&(z=l),(!A||m>=A)&&(A=m),h=u.isLegendRight||u.isLegendInset?A:z,void(v.legend_equally?(Object.keys(F).forEach(function(a){F[a]=z}),Object.keys(G).forEach(function(a){G[a]=A}),g=(o-h*a.length)/2,B>g?(D=0,J=0,a.forEach(function(a){f(a)})):f(c,!0)):f(c)))}var f,g,h,i,j,k,m,n,o,p,r,s,t,u=this,v=u.config,x=4,y=10,z=0,A=0,B=10,C=15,D=0,E={},F={},G={},H=[0],I={},J=0;b=b||{},n=w(b,"withTransition",!0),o=w(b,"withTransitionForTransform",!0),u.isLegendInset&&(J=v.legend_inset_step?v.legend_inset_step:a.length,u.updateLegendStep(J)),u.isLegendRight?(f=function(a){return z*I[a]},i=function(a){return H[I[a]]+E[a]}):u.isLegendInset?(f=function(a){return z*I[a]+10},i=function(a){return H[I[a]]+E[a]}):(f=function(a){return H[I[a]]+E[a]},i=function(a){return A*I[a]}),g=function(a,b){return f(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return f(a,b)},k=function(a,b){return i(a,b)-5},m=u.legend.selectAll("."+l.legendItem).data(a).enter().append("g").attr("class",function(a){return u.generateClass(l.legendItem,a)}).style("visibility",function(a){return u.isLegendToShow(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){v.legend_item_onclick?v.legend_item_onclick.call(u,a):u.d3.event.altKey?(u.api.hide(),u.api.show(a)):(u.api.toggle(a),u.isTargetToShow(a)?u.api.focus(a):u.api.revert())}).on("mouseover",function(a){u.d3.select(this).classed(l.legendItemFocused,!0),!u.transiting&&u.isTargetToShow(a)&&u.api.focus(a),v.legend_item_onmouseover&&v.legend_item_onmouseover.call(u,a)}).on("mouseout",function(a){u.d3.select(this).classed(l.legendItemFocused,!1),u.api.revert(),v.legend_item_onmouseout&&v.legend_item_onmouseout.call(u,a)}),m.append("text").text(function(a){return q(v.data_names[a])?v.data_names[a]:a}).each(function(a,b){e(this,a,b)}).style("pointer-events","none").attr("x",u.isLegendRight||u.isLegendInset?g:-200).attr("y",u.isLegendRight||u.isLegendInset?-200:j),m.append("rect").attr("class",l.legendItemEvent).style("fill-opacity",0).attr("x",u.isLegendRight||u.isLegendInset?h:-200).attr("y",u.isLegendRight||u.isLegendInset?-200:k),m.append("rect").attr("class",l.legendItemTile).style("pointer-events","none").style("fill",u.color).attr("x",u.isLegendRight||u.isLegendInset?g:-200).attr("y",u.isLegendRight||u.isLegendInset?-200:i).attr("width",10).attr("height",10),t=u.legend.select("."+l.legendBackground+" rect"),u.isLegendInset&&z>0&&0===t.size()&&(t=u.legend.insert("g","."+l.legendItem).attr("class",l.legendBackground).append("rect")),p=u.legend.selectAll("text").data(a).text(function(a){return q(v.data_names[a])?v.data_names[a]:a}).each(function(a,b){e(this,a,b)}),(n?p.transition():p).attr("x",g).attr("y",j),r=u.legend.selectAll("rect."+l.legendItemEvent).data(a),(n?r.transition():r).attr("width",function(a){return F[a]}).attr("height",function(a){return G[a]}).attr("x",h).attr("y",k),s=u.legend.selectAll("rect."+l.legendItemTile).data(a),(n?s.transition():s).style("fill",u.color).attr("x",f).attr("y",i),t&&(n?t.transition():t).attr("height",u.getLegendHeight()-12).attr("width",z*(J+1)+10),u.legend.selectAll("."+l.legendItem).classed(l.legendItemHidden,function(a){return!u.isTargetToShow(a)}),u.updateLegendItemWidth(z),u.updateLegendItemHeight(A),u.updateLegendStep(J),u.updateSizes(),u.updateScales(),u.updateSvgSize(),u.transformAll(o,c),u.legendHasRendered=!0},c(b,f),f.prototype.init=function(){var a=this.owner,b=a.config,c=a.main;a.axes.x=c.append("g").attr("class",l.axis+" "+l.axisX).attr("clip-path",a.clipPathForXAxis).attr("transform",a.getTranslate("x")).style("visibility",b.axis_x_show?"visible":"hidden"),a.axes.x.append("text").attr("class",l.axisXLabel).attr("transform",b.axis_rotated?"rotate(-90)":"").style("text-anchor",this.textAnchorForXAxisLabel.bind(this)),a.axes.y=c.append("g").attr("class",l.axis+" "+l.axisY).attr("clip-path",b.axis_y_inner?"":a.clipPathForYAxis).attr("transform",a.getTranslate("y")).style("visibility",b.axis_y_show?"visible":"hidden"),a.axes.y.append("text").attr("class",l.axisYLabel).attr("transform",b.axis_rotated?"":"rotate(-90)").style("text-anchor",this.textAnchorForYAxisLabel.bind(this)),a.axes.y2=c.append("g").attr("class",l.axis+" "+l.axisY2).attr("transform",a.getTranslate("y2")).style("visibility",b.axis_y2_show?"visible":"hidden"),a.axes.y2.append("text").attr("class",l.axisY2Label).attr("transform",b.axis_rotated?"":"rotate(-90)").style("text-anchor",this.textAnchorForY2AxisLabel.bind(this))},f.prototype.getXAxis=function(a,b,c,d,e,f,h){var i=this.owner,j=i.config,k={isCategory:i.isCategorized(),withOuterTick:e,tickMultiline:j.axis_x_tick_multiline,tickWidth:j.axis_x_tick_width,tickTextRotate:h?0:j.axis_x_tick_rotate,withoutTransition:f},l=g(i.d3,k).scale(a).orient(b);return i.isTimeSeries()&&d&&(d=d.map(function(a){return i.parseDate(a)})),l.tickFormat(c).tickValues(d),i.isCategorized()&&(l.tickCentered(j.axis_x_tick_centered),u(j.axis_x_tick_culling)&&(j.axis_x_tick_culling=!1)),l},f.prototype.updateXAxisTickValues=function(a,b){var c,d=this.owner,e=d.config;return(e.axis_x_tick_fit||e.axis_x_tick_count)&&(c=this.generateTickValues(d.mapTargetsToUniqueXs(a),e.axis_x_tick_count,d.isTimeSeries())),b?b.tickValues(c):(d.xAxis.tickValues(c),d.subXAxis.tickValues(c)),c},f.prototype.getYAxis=function(a,b,c,d,e,f){var h={withOuterTick:e,withoutTransition:f},i=this.owner,j=i.d3,k=i.config,l=g(j,h).scale(a).orient(b).tickFormat(c);return i.isTimeSeriesY()?l.ticks(j.time[k.axis_y_tick_time_value],k.axis_y_tick_time_interval):l.tickValues(d),l},f.prototype.getId=function(a){var b=this.owner.config;return a in b.data_axes?b.data_axes[a]:"y"},f.prototype.getXAxisTickFormat=function(){var a=this.owner,b=a.config,c=a.isTimeSeries()?a.defaultAxisTimeFormat:a.isCategorized()?a.categoryName:function(a){return 0>a?a.toFixed(0):a};return b.axis_x_tick_format&&(n(b.axis_x_tick_format)?c=b.axis_x_tick_format:a.isTimeSeries()&&(c=function(c){return c?a.axisTimeFormat(b.axis_x_tick_format)(c):""})),n(c)?function(b){return c.call(a,b)}:c},f.prototype.getTickValues=function(a,b){return a?a:b?b.tickValues():void 0},f.prototype.getXAxisTickValues=function(){return this.getTickValues(this.owner.config.axis_x_tick_values,this.owner.xAxis)},f.prototype.getYAxisTickValues=function(){return this.getTickValues(this.owner.config.axis_y_tick_values,this.owner.yAxis)},f.prototype.getY2AxisTickValues=function(){return this.getTickValues(this.owner.config.axis_y2_tick_values,this.owner.y2Axis)},f.prototype.getLabelOptionByAxisId=function(a){var b,c=this.owner,d=c.config;return"y"===a?b=d.axis_y_label:"y2"===a?b=d.axis_y2_label:"x"===a&&(b=d.axis_x_label),b},f.prototype.getLabelText=function(a){var b=this.getLabelOptionByAxisId(a);return o(b)?b:b?b.text:null},f.prototype.setLabelText=function(a,b){var c=this.owner,d=c.config,e=this.getLabelOptionByAxisId(a);o(e)?"y"===a?d.axis_y_label=b:"y2"===a?d.axis_y2_label=b:"x"===a&&(d.axis_x_label=b):e&&(e.text=b)},f.prototype.getLabelPosition=function(a,b){var c=this.getLabelOptionByAxisId(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}},f.prototype.getXAxisLabelPosition=function(){return this.getLabelPosition("x",this.owner.config.axis_rotated?"inner-top":"inner-right")},f.prototype.getYAxisLabelPosition=function(){return this.getLabelPosition("y",this.owner.config.axis_rotated?"inner-right":"inner-top")},f.prototype.getY2AxisLabelPosition=function(){return this.getLabelPosition("y2",this.owner.config.axis_rotated?"inner-right":"inner-top")},f.prototype.getLabelPositionById=function(a){return"y2"===a?this.getY2AxisLabelPosition():"y"===a?this.getYAxisLabelPosition():this.getXAxisLabelPosition()},f.prototype.textForXAxisLabel=function(){return this.getLabelText("x")},f.prototype.textForYAxisLabel=function(){return this.getLabelText("y")},f.prototype.textForY2AxisLabel=function(){return this.getLabelText("y2")},f.prototype.xForAxisLabel=function(a,b){var c=this.owner;return a?b.isLeft?0:b.isCenter?c.width/2:c.width:b.isBottom?-c.height:b.isMiddle?-c.height/2:0},f.prototype.dxForAxisLabel=function(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"},f.prototype.textAnchorForAxisLabel=function(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"},f.prototype.xForXAxisLabel=function(){return this.xForAxisLabel(!this.owner.config.axis_rotated,this.getXAxisLabelPosition())},f.prototype.xForYAxisLabel=function(){return this.xForAxisLabel(this.owner.config.axis_rotated,this.getYAxisLabelPosition())},f.prototype.xForY2AxisLabel=function(){return this.xForAxisLabel(this.owner.config.axis_rotated,this.getY2AxisLabelPosition())},f.prototype.dxForXAxisLabel=function(){return this.dxForAxisLabel(!this.owner.config.axis_rotated,this.getXAxisLabelPosition())},f.prototype.dxForYAxisLabel=function(){return this.dxForAxisLabel(this.owner.config.axis_rotated,this.getYAxisLabelPosition())},f.prototype.dxForY2AxisLabel=function(){return this.dxForAxisLabel(this.owner.config.axis_rotated,this.getY2AxisLabelPosition())},f.prototype.dyForXAxisLabel=function(){var a=this.owner,b=a.config,c=this.getXAxisLabelPosition();return b.axis_rotated?c.isInner?"1.2em":-25-this.getMaxTickWidth("x"):c.isInner?"-0.5em":b.axis_x_height?b.axis_x_height-10:"3em"},f.prototype.dyForYAxisLabel=function(){var a=this.owner,b=this.getYAxisLabelPosition();return a.config.axis_rotated?b.isInner?"-0.5em":"3em":b.isInner?"1.2em":-10-(a.config.axis_y_inner?0:this.getMaxTickWidth("y")+10)},f.prototype.dyForY2AxisLabel=function(){var a=this.owner,b=this.getY2AxisLabelPosition();return a.config.axis_rotated?b.isInner?"1.2em":"-2.2em":b.isInner?"-0.5em":15+(a.config.axis_y2_inner?0:this.getMaxTickWidth("y2")+15)},f.prototype.textAnchorForXAxisLabel=function(){var a=this.owner;return this.textAnchorForAxisLabel(!a.config.axis_rotated,this.getXAxisLabelPosition())},f.prototype.textAnchorForYAxisLabel=function(){var a=this.owner;return this.textAnchorForAxisLabel(a.config.axis_rotated,this.getYAxisLabelPosition())},f.prototype.textAnchorForY2AxisLabel=function(){var a=this.owner;return this.textAnchorForAxisLabel(a.config.axis_rotated,this.getY2AxisLabelPosition())},f.prototype.getMaxTickWidth=function(a,b){var c,d,e,f,g,h=this.owner,i=h.config,j=0;return b&&h.currentMaxTickWidths[a]?h.currentMaxTickWidths[a]:(h.svg&&(c=h.filterTargetsToShow(h.data.targets),"y"===a?(d=h.y.copy().domain(h.getYDomain(c,"y")),e=this.getYAxis(d,h.yOrient,i.axis_y_tick_format,h.yAxisTickValues,!1,!0)):"y2"===a?(d=h.y2.copy().domain(h.getYDomain(c,"y2")),e=this.getYAxis(d,h.y2Orient,i.axis_y2_tick_format,h.y2AxisTickValues,!1,!0)):(d=h.x.copy().domain(h.getXDomain(c)),e=this.getXAxis(d,h.xOrient,h.xAxisTickFormat,h.xAxisTickValues,!1,!0,!0),this.updateXAxisTickValues(c,e)),f=h.d3.select("body").append("div").classed("c3",!0),g=f.append("svg").style("visibility","hidden").style("position","fixed").style("top",0).style("left",0),g.append("g").call(e).each(function(){h.d3.select(this).selectAll("text").each(function(){var a=this.getBoundingClientRect();j=j?h.currentMaxTickWidths[a]:j,h.currentMaxTickWidths[a])},f.prototype.updateLabels=function(a){var b=this.owner,c=b.main.select("."+l.axisX+" ."+l.axisXLabel),d=b.main.select("."+l.axisY+" ."+l.axisYLabel),e=b.main.select("."+l.axisY2+" ."+l.axisY2Label);(a?c.transition():c).attr("x",this.xForXAxisLabel.bind(this)).attr("dx",this.dxForXAxisLabel.bind(this)).attr("dy",this.dyForXAxisLabel.bind(this)).text(this.textForXAxisLabel.bind(this)),(a?d.transition():d).attr("x",this.xForYAxisLabel.bind(this)).attr("dx",this.dxForYAxisLabel.bind(this)).attr("dy",this.dyForYAxisLabel.bind(this)).text(this.textForYAxisLabel.bind(this)),(a?e.transition():e).attr("x",this.xForY2AxisLabel.bind(this)).attr("dx",this.dxForY2AxisLabel.bind(this)).attr("dy",this.dyForY2AxisLabel.bind(this)).text(this.textForY2AxisLabel.bind(this))},f.prototype.getPadding=function(a,b,c,d){return m(a[b])?"ratio"===a.unit?a[b]*d:this.convertPixelsToAxisPadding(a[b],d):c},f.prototype.convertPixelsToAxisPadding=function(a,b){var c=this.owner,d=c.config.axis_rotated?c.width:c.height;return b*(a/d)},f.prototype.generateTickValues=function(a,b,c){var d,e,f,g,h,i,j,k=a;if(b)if(d=n(b)?b():b,1===d)k=[a[0]];else if(2===d)k=[a[0],a[a.length-1]];else if(d>2){for(g=d-2,e=a[0],f=a[a.length-1],h=(f-e)/(g+1),k=[e],i=0;g>i;i++)j=+e+h*(i+1),k.push(c?new Date(j):j);k.push(f)}return c||(k=k.sort(function(a,b){return a-b})),k},f.prototype.generateTransitions=function(a){var b=this.owner,c=b.axes;return{axisX:a?c.x.transition().duration(a):c.x,axisY:a?c.y.transition().duration(a):c.y,axisY2:a?c.y2.transition().duration(a):c.y2,axisSubX:a?c.subx.transition().duration(a):c.subx}},f.prototype.redraw=function(a,b){var c=this.owner;c.axes.x.style("opacity",b?0:1),c.axes.y.style("opacity",b?0:1),c.axes.y2.style("opacity",b?0:1),c.axes.subx.style("opacity",b?0:1),a.axisX.call(c.xAxis),a.axisY.call(c.yAxis),a.axisY2.call(c.y2Axis),a.axisSubX.call(c.subXAxis)},i.getClipPath=function(b){var c=a.navigator.appVersion.toLowerCase().indexOf("msie 9.")>=0;return"url("+(c?"":document.URL.split("#")[0])+"#"+b+")"},i.appendClip=function(a,b){return a.append("clipPath").attr("id",b).append("rect")},i.getAxisClipX=function(a){var b=Math.max(30,this.margin.left);return a?-(1+b):-(b-1)},i.getAxisClipY=function(a){return a?-20:-this.margin.top},i.getXAxisClipX=function(){var a=this;return a.getAxisClipX(!a.config.axis_rotated)},i.getXAxisClipY=function(){var a=this;return a.getAxisClipY(!a.config.axis_rotated)},i.getYAxisClipX=function(){var a=this;return a.config.axis_y_inner?-1:a.getAxisClipX(a.config.axis_rotated)},i.getYAxisClipY=function(){var a=this;return a.getAxisClipY(a.config.axis_rotated)},i.getAxisClipWidth=function(a){var b=this,c=Math.max(30,b.margin.left),d=Math.max(30,b.margin.right);return a?b.width+2+c+d:b.margin.left+20},i.getAxisClipHeight=function(a){return(a?this.margin.bottom:this.margin.top+this.height)+20},i.getXAxisClipWidth=function(){var a=this;return a.getAxisClipWidth(!a.config.axis_rotated)},i.getXAxisClipHeight=function(){var a=this;return a.getAxisClipHeight(!a.config.axis_rotated)},i.getYAxisClipWidth=function(){var a=this;return a.getAxisClipWidth(a.config.axis_rotated)+(a.config.axis_y_inner?20:0)},i.getYAxisClipHeight=function(){var a=this;return a.getAxisClipHeight(a.config.axis_rotated)},i.initPie=function(){var a=this,b=a.d3,c=a.config;a.pie=b.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)}),c.data_order||a.pie.sort(null)},i.updateRadius=function(){var a=this,b=a.config,c=b.gauge_width||b.donut_width;a.radiusExpanded=Math.min(a.arcWidth,a.arcHeight)/2,a.radius=.95*a.radiusExpanded,a.innerRadiusRatio=c?(a.radius-c)/a.radius:.6,a.innerRadius=a.hasType("donut")||a.hasType("gauge")?a.radius*a.innerRadiusRatio:0},i.updateArc=function(){var a=this;a.svgArc=a.getSvgArc(),a.svgArcExpanded=a.getSvgArcExpanded(),a.svgArcExpandedSub=a.getSvgArcExpanded(.98)},i.updateAngle=function(a){var b,c,d=this,e=d.config,f=!1,g=0,h=e.gauge_min,i=e.gauge_max; -return d.pie(d.filterTargetsToShow(d.data.targets)).forEach(function(b){f||b.data.id!==a.data.id||(f=!0,a=b,a.index=g),g++}),isNaN(a.startAngle)&&(a.startAngle=0),isNaN(a.endAngle)&&(a.endAngle=a.startAngle),d.isGaugeType(a.data)&&(b=Math.PI/(i-h),c=a.value.375?1.175-36/g.radius:.8)*g.radius/e:0,i="translate("+c*f+","+d*f+")"),i},i.getArcRatio=function(a){var b=this,c=b.hasType("gauge")?Math.PI:2*Math.PI;return a?(a.endAngle-a.startAngle)/c:null},i.convertToArcData=function(a){return this.addName({id:a.data.id,value:a.value,ratio:this.getArcRatio(a),index:a.index})},i.textForArcLabel=function(a){var b,c,d,e,f,g=this;return g.shouldShowArcLabel()?(b=g.updateAngle(a),c=b?b.value:null,d=g.getArcRatio(b),e=a.data.id,g.hasType("gauge")||g.meetsArcLabelThreshold(d)?(f=g.getArcLabelFormat(),f?f(c,d,e):g.defaultArcValueFormat(c,d)):""):""},i.expandArc=function(b){var c,d=this;return d.transiting?void(c=a.setInterval(function(){d.transiting||(a.clearInterval(c),d.legend.selectAll(".c3-legend-item-focused").size()>0&&d.expandArc(b))},10)):(b=d.mapToTargetIds(b),void d.svg.selectAll(d.selectorTargets(b,"."+l.chartArc)).each(function(a){d.shouldExpand(a.data.id)&&d.d3.select(this).selectAll("path").transition().duration(50).attr("d",d.svgArcExpanded).transition().duration(100).attr("d",d.svgArcExpandedSub).each(function(a){d.isDonutType(a.data)})}))},i.unexpandArc=function(a){var b=this;b.transiting||(a=b.mapToTargetIds(a),b.svg.selectAll(b.selectorTargets(a,"."+l.chartArc)).selectAll("path").transition().duration(50).attr("d",b.svgArc),b.svg.selectAll("."+l.arc).style("opacity",1))},i.shouldExpand=function(a){var b=this,c=b.config;return b.isDonutType(a)&&c.donut_expand||b.isGaugeType(a)&&c.gauge_expand||b.isPieType(a)&&c.pie_expand},i.shouldShowArcLabel=function(){var a=this,b=a.config,c=!0;return a.hasType("donut")?c=b.donut_label_show:a.hasType("pie")&&(c=b.pie_label_show),c},i.meetsArcLabelThreshold=function(a){var b=this,c=b.config,d=b.hasType("donut")?c.donut_label_threshold:c.pie_label_threshold;return a>=d},i.getArcLabelFormat=function(){var a=this,b=a.config,c=b.pie_label_format;return a.hasType("gauge")?c=b.gauge_label_format:a.hasType("donut")&&(c=b.donut_label_format),c},i.getArcTitle=function(){var a=this;return a.hasType("donut")?a.config.donut_title:""},i.updateTargetsForArc=function(a){var b,c,d=this,e=d.main,f=d.classChartArc.bind(d),g=d.classArcs.bind(d),h=d.classFocus.bind(d);b=e.select("."+l.chartArcs).selectAll("."+l.chartArc).data(d.pie(a)).attr("class",function(a){return f(a)+h(a.data)}),c=b.enter().append("g").attr("class",f),c.append("g").attr("class",g),c.append("text").attr("dy",d.hasType("gauge")?"-.1em":".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none")},i.initArc=function(){var a=this;a.arcs=a.main.select("."+l.chart).append("g").attr("class",l.chartArcs).attr("transform",a.getTranslate("arc")),a.arcs.append("text").attr("class",l.chartArcsTitle).style("text-anchor","middle").text(a.getArcTitle())},i.redrawArc=function(a,b,c){var d,e=this,f=e.d3,g=e.config,h=e.main;d=h.selectAll("."+l.arcs).selectAll("."+l.arc).data(e.arcData.bind(e)),d.enter().append("path").attr("class",e.classArc.bind(e)).style("fill",function(a){return e.color(a.data)}).style("cursor",function(a){return g.interaction_enabled&&g.data_selection_isselectable(a)?"pointer":null}).style("opacity",0).each(function(a){e.isGaugeType(a.data)&&(a.startAngle=a.endAngle=-1*(Math.PI/2)),this._current=a}),d.attr("transform",function(a){return!e.isGaugeType(a.data)&&c?"scale(0)":""}).style("opacity",function(a){return a===this._current?0:1}).on("mouseover",g.interaction_enabled?function(a){var b,c;e.transiting||(b=e.updateAngle(a),c=e.convertToArcData(b),e.expandArc(b.data.id),e.api.focus(b.data.id),e.toggleFocusLegend(b.data.id,!0),e.config.data_onmouseover(c,this))}:null).on("mousemove",g.interaction_enabled?function(a){var b=e.updateAngle(a),c=e.convertToArcData(b),d=[c];e.showTooltip(d,this)}:null).on("mouseout",g.interaction_enabled?function(a){var b,c;e.transiting||(b=e.updateAngle(a),c=e.convertToArcData(b),e.unexpandArc(b.data.id),e.api.revert(),e.revertLegend(),e.hideTooltip(),e.config.data_onmouseout(c,this))}:null).on("click",g.interaction_enabled?function(a,b){var c=e.updateAngle(a),d=e.convertToArcData(c);e.toggleShape&&e.toggleShape(this,d,b),e.config.data_onclick.call(e.api,d,this)}:null).each(function(){e.transiting=!0}).transition().duration(a).attrTween("d",function(a){var b,c=e.updateAngle(a);return c?(isNaN(this._current.startAngle)&&(this._current.startAngle=0),isNaN(this._current.endAngle)&&(this._current.endAngle=this._current.startAngle),b=f.interpolate(this._current,c),this._current=b(0),function(c){var d=b(c);return d.data=a.data,e.getArc(d,!0)}):function(){return"M 0 0"}}).attr("transform",c?"scale(1)":"").style("fill",function(a){return e.levelColor?e.levelColor(a.data.values[0].value):e.color(a.data.id)}).style("opacity",1).call(e.endall,function(){e.transiting=!1}),d.exit().transition().duration(b).style("opacity",0).remove(),h.selectAll("."+l.chartArc).select("text").style("opacity",0).attr("class",function(a){return e.isGaugeType(a.data)?l.gaugeValue:""}).text(e.textForArcLabel.bind(e)).attr("transform",e.transformForArcLabel.bind(e)).style("font-size",function(a){return e.isGaugeType(a.data)?Math.round(e.radius/5)+"px":""}).transition().duration(a).style("opacity",function(a){return e.isTargetToShow(a.data.id)&&e.isArcType(a.data)?1:0}),h.select("."+l.chartArcsTitle).style("opacity",e.hasType("donut")||e.hasType("gauge")?1:0),e.hasType("gauge")&&(e.arcs.select("."+l.chartArcsBackground).attr("d",function(){var a={data:[{value:g.gauge_max}],startAngle:-1*(Math.PI/2),endAngle:Math.PI/2};return e.getArc(a,!0,!0)}),e.arcs.select("."+l.chartArcsGaugeUnit).attr("dy",".75em").text(g.gauge_label_show?g.gauge_units:""),e.arcs.select("."+l.chartArcsGaugeMin).attr("dx",-1*(e.innerRadius+(e.radius-e.innerRadius)/2)+"px").attr("dy","1.2em").text(g.gauge_label_show?g.gauge_min:""),e.arcs.select("."+l.chartArcsGaugeMax).attr("dx",e.innerRadius+(e.radius-e.innerRadius)/2+"px").attr("dy","1.2em").text(g.gauge_label_show?g.gauge_max:""))},i.initGauge=function(){var a=this.arcs;this.hasType("gauge")&&(a.append("path").attr("class",l.chartArcsBackground),a.append("text").attr("class",l.chartArcsGaugeUnit).style("text-anchor","middle").style("pointer-events","none"),a.append("text").attr("class",l.chartArcsGaugeMin).style("text-anchor","middle").style("pointer-events","none"),a.append("text").attr("class",l.chartArcsGaugeMax).style("text-anchor","middle").style("pointer-events","none"))},i.getGaugeLabelHeight=function(){return this.config.gauge_label_show?20:0},i.initRegion=function(){var a=this;a.region=a.main.append("g").attr("clip-path",a.clipPath).attr("class",l.regions)},i.updateRegion=function(a){var b=this,c=b.config;b.region.style("visibility",b.hasArcType()?"hidden":"visible"),b.mainRegion=b.main.select("."+l.regions).selectAll("."+l.region).data(c.regions),b.mainRegion.enter().append("g").attr("class",b.classRegion.bind(b)).append("rect").style("fill-opacity",0),b.mainRegion.exit().transition().duration(a).style("opacity",0).remove()},i.redrawRegion=function(a){var b=this,c=b.mainRegion.selectAll("rect"),d=b.regionX.bind(b),e=b.regionY.bind(b),f=b.regionWidth.bind(b),g=b.regionHeight.bind(b);return[(a?c.transition():c).attr("x",d).attr("y",e).attr("width",f).attr("height",g).style("fill-opacity",function(a){return m(a.opacity)?a.opacity:.1})]},i.regionX=function(a){var b,c=this,d=c.config,e="y"===a.axis?c.y:c.y2;return b="y"===a.axis||"y2"===a.axis?d.axis_rotated&&"start"in a?e(a.start):0:d.axis_rotated?0:"start"in a?c.x(c.isTimeSeries()?c.parseDate(a.start):a.start):0},i.regionY=function(a){var b,c=this,d=c.config,e="y"===a.axis?c.y:c.y2;return b="y"===a.axis||"y2"===a.axis?d.axis_rotated?0:"end"in a?e(a.end):0:d.axis_rotated&&"start"in a?c.x(c.isTimeSeries()?c.parseDate(a.start):a.start):0},i.regionWidth=function(a){var b,c=this,d=c.config,e=c.regionX(a),f="y"===a.axis?c.y:c.y2;return b="y"===a.axis||"y2"===a.axis?d.axis_rotated&&"end"in a?f(a.end):c.width:d.axis_rotated?c.width:"end"in a?c.x(c.isTimeSeries()?c.parseDate(a.end):a.end):c.width,e>b?0:b-e},i.regionHeight=function(a){var b,c=this,d=c.config,e=this.regionY(a),f="y"===a.axis?c.y:c.y2;return b="y"===a.axis||"y2"===a.axis?d.axis_rotated?c.height:"start"in a?f(a.start):c.height:d.axis_rotated&&"end"in a?c.x(c.isTimeSeries()?c.parseDate(a.end):a.end):c.height,e>b?0:b-e},i.isRegionOnX=function(a){return!a.axis||"x"===a.axis},i.drag=function(a){var b,c,d,e,f,g,h,i,j=this,k=j.config,m=j.main,n=j.d3;j.hasArcType()||k.data_selection_enabled&&(!k.zoom_enabled||j.zoom.altDomain)&&k.data_selection_multiple&&(b=j.dragStart[0],c=j.dragStart[1],d=a[0],e=a[1],f=Math.min(b,d),g=Math.max(b,d),h=k.data_selection_grouped?j.margin.top:Math.min(c,e),i=k.data_selection_grouped?j.height:Math.max(c,e),m.select("."+l.dragarea).attr("x",f).attr("y",h).attr("width",g-f).attr("height",i-h),m.selectAll("."+l.shapes).selectAll("."+l.shape).filter(function(a){return k.data_selection_isselectable(a)}).each(function(a,b){var c,d,e,k,m,o,p=n.select(this),q=p.classed(l.SELECTED),r=p.classed(l.INCLUDED),s=!1;if(p.classed(l.circle))c=1*p.attr("cx"),d=1*p.attr("cy"),m=j.togglePoint,s=c>f&&g>c&&d>h&&i>d;else{if(!p.classed(l.bar))return;o=y(this),c=o.x,d=o.y,e=o.width,k=o.height,m=j.togglePath,s=!(c>g||f>c+e||d>i||h>d+k)}s^r&&(p.classed(l.INCLUDED,!r),p.classed(l.SELECTED,!q),m.call(j,!q,p,a,b))}))},i.dragstart=function(a){var b=this,c=b.config;b.hasArcType()||c.data_selection_enabled&&(b.dragStart=a,b.main.select("."+l.chart).append("rect").attr("class",l.dragarea).style("opacity",.1),b.dragging=!0)},i.dragend=function(){var a=this,b=a.config;a.hasArcType()||b.data_selection_enabled&&(a.main.select("."+l.dragarea).transition().duration(100).style("opacity",0).remove(),a.main.selectAll("."+l.shape).classed(l.INCLUDED,!1),a.dragging=!1)},i.selectPoint=function(a,b,c){var d=this,e=d.config,f=(e.axis_rotated?d.circleY:d.circleX).bind(d),g=(e.axis_rotated?d.circleX:d.circleY).bind(d),h=d.pointSelectR.bind(d);e.data_onselected.call(d.api,b,a.node()),d.main.select("."+l.selectedCircles+d.getTargetSelectorSuffix(b.id)).selectAll("."+l.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return d.generateClass(l.selectedCircle,c)}).attr("cx",f).attr("cy",g).attr("stroke",function(){return d.color(b)}).attr("r",function(a){return 1.4*d.pointSelectR(a)}).transition().duration(100).attr("r",h)},i.unselectPoint=function(a,b,c){var d=this;d.config.data_onunselected(b,a.node()),d.main.select("."+l.selectedCircles+d.getTargetSelectorSuffix(b.id)).selectAll("."+l.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()},i.togglePoint=function(a,b,c,d){a?this.selectPoint(b,c,d):this.unselectPoint(b,c,d)},i.selectPath=function(a,b){var c=this;c.config.data_onselected.call(c,b,a.node()),a.transition().duration(100).style("fill",function(){return c.d3.rgb(c.color(b)).brighter(.75)})},i.unselectPath=function(a,b){var c=this;c.config.data_onunselected.call(c,b,a.node()),a.transition().duration(100).style("fill",function(){return c.color(b)})},i.togglePath=function(a,b,c,d){a?this.selectPath(b,c,d):this.unselectPath(b,c,d)},i.getToggle=function(a,b){var c,d=this;return"circle"===a.nodeName?c=d.isStepType(b)?function(){}:d.togglePoint:"path"===a.nodeName&&(c=d.togglePath),c},i.toggleShape=function(a,b,c){var d=this,e=d.d3,f=d.config,g=e.select(a),h=g.classed(l.SELECTED),i=d.getToggle(a,b).bind(d);f.data_selection_enabled&&f.data_selection_isselectable(b)&&(f.data_selection_multiple||d.main.selectAll("."+l.shapes+(f.data_selection_grouped?d.getTargetSelectorSuffix(b.id):"")).selectAll("."+l.shape).each(function(a,b){var c=e.select(this);c.classed(l.SELECTED)&&i(!1,c.classed(l.SELECTED,!1),a,b)}),g.classed(l.SELECTED,!h),i(!h,g,b,c))},i.initBrush=function(){var a=this,b=a.d3;a.brush=b.svg.brush().on("brush",function(){a.redrawForBrush()}),a.brush.update=function(){return a.context&&a.context.select("."+l.brush).call(this),this},a.brush.scale=function(b){return a.config.axis_rotated?this.y(b):this.x(b)}},i.initSubchart=function(){var a=this,b=a.config,c=a.context=a.svg.append("g").attr("transform",a.getTranslate("context"));c.style("visibility",b.subchart_show?"visible":"hidden"),c.append("g").attr("clip-path",a.clipPathForSubchart).attr("class",l.chart),c.select("."+l.chart).append("g").attr("class",l.chartBars),c.select("."+l.chart).append("g").attr("class",l.chartLines),c.append("g").attr("clip-path",a.clipPath).attr("class",l.brush).call(a.brush),a.axes.subx=c.append("g").attr("class",l.axisX).attr("transform",a.getTranslate("subx")).attr("clip-path",b.axis_rotated?"":a.clipPathForXAxis)},i.updateTargetsForSubchart=function(a){var b,c,d,e,f=this,g=f.context,h=f.config,i=f.classChartBar.bind(f),j=f.classBars.bind(f),k=f.classChartLine.bind(f),m=f.classLines.bind(f),n=f.classAreas.bind(f);h.subchart_show&&(e=g.select("."+l.chartBars).selectAll("."+l.chartBar).data(a).attr("class",i),d=e.enter().append("g").style("opacity",0).attr("class",i),d.append("g").attr("class",j),c=g.select("."+l.chartLines).selectAll("."+l.chartLine).data(a).attr("class",k),b=c.enter().append("g").style("opacity",0).attr("class",k),b.append("g").attr("class",m),b.append("g").attr("class",n),g.selectAll("."+l.brush+" rect").attr(h.axis_rotated?"width":"height",h.axis_rotated?f.width2:f.height2))},i.updateBarForSubchart=function(a){var b=this;b.contextBar=b.context.selectAll("."+l.bars).selectAll("."+l.bar).data(b.barData.bind(b)),b.contextBar.enter().append("path").attr("class",b.classBar.bind(b)).style("stroke","none").style("fill",b.color),b.contextBar.style("opacity",b.initialOpacity.bind(b)),b.contextBar.exit().transition().duration(a).style("opacity",0).remove()},i.redrawBarForSubchart=function(a,b,c){(b?this.contextBar.transition().duration(c):this.contextBar).attr("d",a).style("opacity",1)},i.updateLineForSubchart=function(a){var b=this;b.contextLine=b.context.selectAll("."+l.lines).selectAll("."+l.line).data(b.lineData.bind(b)),b.contextLine.enter().append("path").attr("class",b.classLine.bind(b)).style("stroke",b.color),b.contextLine.style("opacity",b.initialOpacity.bind(b)),b.contextLine.exit().transition().duration(a).style("opacity",0).remove()},i.redrawLineForSubchart=function(a,b,c){(b?this.contextLine.transition().duration(c):this.contextLine).attr("d",a).style("opacity",1)},i.updateAreaForSubchart=function(a){var b=this,c=b.d3;b.contextArea=b.context.selectAll("."+l.areas).selectAll("."+l.area).data(b.lineData.bind(b)),b.contextArea.enter().append("path").attr("class",b.classArea.bind(b)).style("fill",b.color).style("opacity",function(){return b.orgAreaOpacity=+c.select(this).style("opacity"),0}),b.contextArea.style("opacity",0),b.contextArea.exit().transition().duration(a).style("opacity",0).remove()},i.redrawAreaForSubchart=function(a,b,c){(b?this.contextArea.transition().duration(c):this.contextArea).attr("d",a).style("fill",this.color).style("opacity",this.orgAreaOpacity)},i.redrawSubchart=function(a,b,c,d,e,f,g){var h,i,j,k=this,l=k.d3,m=k.config;k.context.style("visibility",m.subchart_show?"visible":"hidden"),m.subchart_show&&(l.event&&"zoom"===l.event.type&&k.brush.extent(k.x.orgDomain()).update(),a&&(k.brush.empty()||k.brush.extent(k.x.orgDomain()).update(),h=k.generateDrawArea(e,!0),i=k.generateDrawBar(f,!0),j=k.generateDrawLine(g,!0),k.updateBarForSubchart(c),k.updateLineForSubchart(c),k.updateAreaForSubchart(c),k.redrawBarForSubchart(i,c,c),k.redrawLineForSubchart(j,c,c),k.redrawAreaForSubchart(h,c,c)))},i.redrawForBrush=function(){var a=this,b=a.x;a.redraw({withTransition:!1,withY:a.config.zoom_rescale,withSubchart:!1,withUpdateXDomain:!0,withDimension:!1}),a.config.subchart_onbrush.call(a.api,b.orgDomain())},i.transformContext=function(a,b){var c,d=this;b&&b.axisSubX?c=b.axisSubX:(c=d.context.select("."+l.axisX),a&&(c=c.transition())),d.context.attr("transform",d.getTranslate("context")),c.attr("transform",d.getTranslate("subx"))},i.getDefaultExtent=function(){var a=this,b=a.config,c=n(b.axis_x_extent)?b.axis_x_extent(a.getXDomain(a.data.targets)):b.axis_x_extent;return a.isTimeSeries()&&(c=[a.parseDate(c[0]),a.parseDate(c[1])]),c},i.initZoom=function(){var a,b=this,c=b.d3,d=b.config;b.zoom=c.behavior.zoom().on("zoomstart",function(){a=c.event.sourceEvent,b.zoom.altDomain=c.event.sourceEvent.altKey?b.x.orgDomain():null,d.zoom_onzoomstart.call(b.api,c.event.sourceEvent)}).on("zoom",function(){b.redrawForZoom.call(b)}).on("zoomend",function(){var e=c.event.sourceEvent;e&&a.clientX===e.clientX&&a.clientY===e.clientY||(b.redrawEventRect(),b.updateZoom(),d.zoom_onzoomend.call(b.api,b.x.orgDomain()))}),b.zoom.scale=function(a){return d.axis_rotated?this.y(a):this.x(a)},b.zoom.orgScaleExtent=function(){var a=d.zoom_extent?d.zoom_extent:[1,10];return[a[0],Math.max(b.getMaxDataCount()/a[1],a[1])]},b.zoom.updateScaleExtent=function(){var a=t(b.x.orgDomain())/t(b.orgXDomain),c=this.orgScaleExtent();return this.scaleExtent([c[0]*a,c[1]*a]),this}},i.updateZoom=function(){var a=this,b=a.config.zoom_enabled?a.zoom:function(){};a.main.select("."+l.zoomRect).call(b).on("dblclick.zoom",null),a.main.selectAll("."+l.eventRect).call(b).on("dblclick.zoom",null)},i.redrawForZoom=function(){var a=this,b=a.d3,c=a.config,d=a.zoom,e=a.x;if(c.zoom_enabled&&0!==a.filterTargetsToShow(a.data.targets).length){if("mousemove"===b.event.sourceEvent.type&&d.altDomain)return e.domain(d.altDomain),void d.scale(e).updateScaleExtent();a.isCategorized()&&e.orgDomain()[0]===a.orgXDomain[0]&&e.domain([a.orgXDomain[0]-1e-10,e.orgDomain()[1]]),a.redraw({withTransition:!1,withY:c.zoom_rescale,withSubchart:!1,withEventRect:!1,withDimension:!1}),"mousemove"===b.event.sourceEvent.type&&(a.cancelClick=!0),c.zoom_onzoom.call(a.api,e.orgDomain())}},i.generateColor=function(){var a=this,b=a.config,c=a.d3,d=b.data_colors,e=v(b.color_pattern)?b.color_pattern:c.scale.category10().range(),f=b.data_color,g=[];return function(a){var b,c=a.id||a.data&&a.data.id||a;return d[c]instanceof Function?b=d[c](a):d[c]?b=d[c]:(g.indexOf(c)<0&&g.push(c),b=e[g.indexOf(c)%e.length],d[c]=b),f instanceof Function?f(b,a):b}},i.generateLevelColor=function(){var a=this,b=a.config,c=b.color_pattern,d=b.color_threshold,e="value"===d.unit,f=d.values&&d.values.length?d.values:[],g=d.max||100;return v(b.color_threshold)?function(a){var b,d,h=c[c.length-1];for(b=0;b=0?l.focused:"")},i.classDefocused=function(a){return" "+(this.defocusedTargetIds.indexOf(a.id)>=0?l.defocused:"")},i.classChartText=function(a){return l.chartText+this.classTarget(a.id)},i.classChartLine=function(a){return l.chartLine+this.classTarget(a.id)},i.classChartBar=function(a){return l.chartBar+this.classTarget(a.id)},i.classChartArc=function(a){return l.chartArc+this.classTarget(a.data.id)},i.getTargetSelectorSuffix=function(a){return a||0===a?("-"+a).replace(/[\s?!@#$%^&*()_=+,.<>'":;\[\]\/|~`{}\\]/g,"-"):""},i.selectorTarget=function(a,b){return(b||"")+"."+l.target+this.getTargetSelectorSuffix(a)},i.selectorTargets=function(a,b){var c=this;return a=a||[],a.length?a.map(function(a){return c.selectorTarget(a,b)}):null},i.selectorLegend=function(a){return"."+l.legendItem+this.getTargetSelectorSuffix(a)},i.selectorLegends=function(a){var b=this;return a&&a.length?a.map(function(a){return b.selectorLegend(a)}):null};var m=i.isValue=function(a){return a||0===a},n=i.isFunction=function(a){return"function"==typeof a},o=i.isString=function(a){return"string"==typeof a},p=i.isUndefined=function(a){return"undefined"==typeof a},q=i.isDefined=function(a){return"undefined"!=typeof a},r=i.ceil10=function(a){return 10*Math.ceil(a/10)},s=i.asHalfPixel=function(a){return Math.ceil(a)+.5},t=i.diffDomain=function(a){return a[1]-a[0]},u=i.isEmpty=function(a){return!a||o(a)&&0===a.length||"object"==typeof a&&0===Object.keys(a).length},v=i.notEmpty=function(a){return Object.keys(a).length>0},w=i.getOption=function(a,b,c){return q(a[b])?a[b]:c},x=i.hasValue=function(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c},y=i.getPathBox=function(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}};h.focus=function(a){var b,c=this.internal;a=c.mapToTargetIds(a),b=c.svg.selectAll(c.selectorTargets(a.filter(c.isTargetToShow,c))),this.revert(),this.defocus(),b.classed(l.focused,!0).classed(l.defocused,!1),c.hasArcType()&&c.expandArc(a),c.toggleFocusLegend(a,!0),c.focusedTargetIds=a,c.defocusedTargetIds=c.defocusedTargetIds.filter(function(b){return a.indexOf(b)<0})},h.defocus=function(a){var b,c=this.internal;a=c.mapToTargetIds(a),b=c.svg.selectAll(c.selectorTargets(a.filter(c.isTargetToShow,c))),b.classed(l.focused,!1).classed(l.defocused,!0),c.hasArcType()&&c.unexpandArc(a),c.toggleFocusLegend(a,!1),c.focusedTargetIds=c.focusedTargetIds.filter(function(b){return a.indexOf(b)<0}),c.defocusedTargetIds=a},h.revert=function(a){var b,c=this.internal;a=c.mapToTargetIds(a),b=c.svg.selectAll(c.selectorTargets(a)),b.classed(l.focused,!1).classed(l.defocused,!1),c.hasArcType()&&c.unexpandArc(a),c.config.legend_show&&(c.showLegend(a.filter(c.isLegendToShow.bind(c))),c.legend.selectAll(c.selectorLegends(a)).filter(function(){return c.d3.select(this).classed(l.legendItemFocused)}).classed(l.legendItemFocused,!1)),c.focusedTargetIds=[],c.defocusedTargetIds=[]},h.show=function(a,b){var c,d=this.internal;a=d.mapToTargetIds(a),b=b||{},d.removeHiddenTargetIds(a),c=d.svg.selectAll(d.selectorTargets(a)),c.transition().style("opacity",1,"important").call(d.endall,function(){c.style("opacity",null).style("opacity",1)}),b.withLegend&&d.showLegend(a),d.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},h.hide=function(a,b){var c,d=this.internal;a=d.mapToTargetIds(a),b=b||{},d.addHiddenTargetIds(a),c=d.svg.selectAll(d.selectorTargets(a)),c.transition().style("opacity",0,"important").call(d.endall,function(){c.style("opacity",null).style("opacity",0)}),b.withLegend&&d.hideLegend(a),d.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},h.toggle=function(a,b){var c=this,d=this.internal;d.mapToTargetIds(a).forEach(function(a){d.isTargetToShow(a)?c.hide(a,b):c.show(a,b)})},h.zoom=function(a){var b=this.internal;return a&&(b.isTimeSeries()&&(a=a.map(function(a){return b.parseDate(a)})),b.brush.extent(a),b.redraw({withUpdateXDomain:!0,withY:b.config.zoom_rescale}),b.config.zoom_onzoom.call(this,b.x.orgDomain())),b.brush.extent()},h.zoom.enable=function(a){var b=this.internal;b.config.zoom_enabled=a,b.updateAndRedraw()},h.unzoom=function(){var a=this.internal;a.brush.clear().update(),a.redraw({withUpdateXDomain:!0})},h.load=function(a){var b=this.internal,c=b.config;return a.xs&&b.addXs(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){c.data_classes[b]=a.classes[b]}),"categories"in a&&b.isCategorized()&&(c.axis_x_categories=a.categories),"axes"in a&&Object.keys(a.axes).forEach(function(b){c.data_axes[b]=a.axes[b]}),"colors"in a&&Object.keys(a.colors).forEach(function(b){c.data_colors[b]=a.colors[b]}),"cacheIds"in a&&b.hasCaches(a.cacheIds)?void b.load(b.getCaches(a.cacheIds),a.done):void("unload"in a?b.unload(b.mapToTargetIds("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){b.loadFromArgs(a)}):b.loadFromArgs(a))},h.unload=function(a){var b=this.internal;a=a||{},a instanceof Array?a={ids:a}:"string"==typeof a&&(a={ids:[a]}),b.unload(b.mapToTargetIds(a.ids),function(){b.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),a.done&&a.done()})},h.flow=function(a){var b,c,d,e,f,g,h,i,j=this.internal,k=[],l=j.getMaxDataCount(),n=0,o=0;if(a.json)c=j.convertJsonToData(a.json,a.keys);else if(a.rows)c=j.convertRowsToData(a.rows);else{if(!a.columns)return;c=j.convertColumnsToData(a.columns)}b=j.convertDataToTargets(c,!0),j.data.targets.forEach(function(a){var c,d,e=!1;for(c=0;cd;d++)b[c].values[d].index=o+d,j.isTimeSeries()||(b[c].values[d].x=o+d);a.values=a.values.concat(b[c].values),b.splice(c,1);break}e||k.push(a.id)}),j.data.targets.forEach(function(a){var b,c;for(b=0;bc;c++)a.values.push({id:a.id,index:o+c,x:j.isTimeSeries()?j.getOtherTargetX(o+c):o+c,value:null})}),j.data.targets.length&&b.forEach(function(a){var b,c=[];for(b=j.data.targets[0].values[0].index;o>b;b++)c.push({id:a.id,index:b,x:j.isTimeSeries()?j.getOtherTargetX(b):b,value:null});a.values.forEach(function(a){a.index+=o,j.isTimeSeries()||(a.x+=o)}),a.values=c.concat(a.values)}),j.data.targets=j.data.targets.concat(b),d=j.getMaxDataCount(),f=j.data.targets[0],g=f.values[0],q(a.to)?(n=0,i=j.isTimeSeries()?j.parseDate(a.to):a.to,f.values.forEach(function(a){a.x1?f.values[f.values.length-1].x-g.x:g.x-j.getXDomain(j.data.targets)[0]:1,e=[g.x-h,g.x],j.updateXDomain(null,!0,!0,!1,e)),j.updateTargets(j.data.targets),j.redraw({flow:{index:g.index,length:n,duration:m(a.duration)?a.duration:j.config.transition_duration,done:a.done,orgDataCount:l},withLegend:!0,withTransition:l>1,withTrimXDomain:!1,withUpdateXAxis:!0})},i.generateFlow=function(a){var b=this,c=b.config,d=b.d3;return function(){var e,f,g,h=a.targets,i=a.flow,j=a.drawBar,k=a.drawLine,m=a.drawArea,n=a.cx,o=a.cy,p=a.xv,q=a.xForText,r=a.yForText,s=a.duration,u=1,v=i.index,w=i.length,x=b.getValueOnIndex(b.data.targets[0].values,v),y=b.getValueOnIndex(b.data.targets[0].values,v+w),z=b.x.domain(),A=i.duration||s,B=i.done||function(){},C=b.generateWait(),D=b.xgrid||d.selectAll([]),E=b.xgridLines||d.selectAll([]),F=b.mainRegion||d.selectAll([]),G=b.mainText||d.selectAll([]),H=b.mainBar||d.selectAll([]),I=b.mainLine||d.selectAll([]),J=b.mainArea||d.selectAll([]),K=b.mainCircle||d.selectAll([]);b.flowing=!0,b.data.targets.forEach(function(a){a.values.splice(0,w)}),g=b.updateXDomain(h,!0,!0),b.updateXGrid&&b.updateXGrid(!0),i.orgDataCount?e=1===i.orgDataCount||x.x===y.x?b.x(z[0])-b.x(g[0]):b.isTimeSeries()?b.x(z[0])-b.x(g[0]):b.x(x.x)-b.x(y.x):1!==b.data.targets[0].values.length?e=b.x(z[0])-b.x(g[0]):b.isTimeSeries()?(x=b.getValueOnIndex(b.data.targets[0].values,0),y=b.getValueOnIndex(b.data.targets[0].values,b.data.targets[0].values.length-1),e=b.x(x.x)-b.x(y.x)):e=t(g)/2,u=t(z)/t(g),f="translate("+e+",0) scale("+u+",1)",b.hideXGridFocus(),b.hideTooltip(),d.transition().ease("linear").duration(A).each(function(){C.add(b.axes.x.transition().call(b.xAxis)),C.add(H.transition().attr("transform",f)),C.add(I.transition().attr("transform",f)),C.add(J.transition().attr("transform",f)),C.add(K.transition().attr("transform",f)),C.add(G.transition().attr("transform",f)),C.add(F.filter(b.isRegionOnX).transition().attr("transform",f)),C.add(D.transition().attr("transform",f)),C.add(E.transition().attr("transform",f)) -}).call(C,function(){var a,d=[],e=[],f=[];if(w){for(a=0;w>a;a++)d.push("."+l.shape+"-"+(v+a)),e.push("."+l.text+"-"+(v+a)),f.push("."+l.eventRect+"-"+(v+a));b.svg.selectAll("."+l.shapes).selectAll(d).remove(),b.svg.selectAll("."+l.texts).selectAll(e).remove(),b.svg.selectAll("."+l.eventRects).selectAll(f).remove(),b.svg.select("."+l.xgrid).remove()}D.attr("transform",null).attr(b.xgridAttr),E.attr("transform",null),E.select("line").attr("x1",c.axis_rotated?0:p).attr("x2",c.axis_rotated?b.width:p),E.select("text").attr("x",c.axis_rotated?b.width:0).attr("y",p),H.attr("transform",null).attr("d",j),I.attr("transform",null).attr("d",k),J.attr("transform",null).attr("d",m),K.attr("transform",null).attr("cx",n).attr("cy",o),G.attr("transform",null).attr("x",q).attr("y",r).style("fill-opacity",b.opacityForText.bind(b)),F.attr("transform",null),F.select("rect").filter(b.isRegionOnX).attr("x",b.regionX.bind(b)).attr("width",b.regionWidth.bind(b)),c.interaction_enabled&&b.redrawEventRect(),B(),b.flowing=!1})}},h.selected=function(a){var b=this.internal,c=b.d3;return c.merge(b.main.selectAll("."+l.shapes+b.getTargetSelectorSuffix(a)).selectAll("."+l.shape).filter(function(){return c.select(this).classed(l.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},h.select=function(a,b,c){var d=this.internal,e=d.d3,f=d.config;f.data_selection_enabled&&d.main.selectAll("."+l.shapes).selectAll("."+l.shape).each(function(g,h){var i=e.select(this),j=g.data?g.data.id:g.id,k=d.getToggle(this,g).bind(d),m=f.data_selection_grouped||!a||a.indexOf(j)>=0,n=!b||b.indexOf(h)>=0,o=i.classed(l.SELECTED);i.classed(l.line)||i.classed(l.area)||(m&&n?f.data_selection_isselectable(g)&&!o&&k(!0,i.classed(l.SELECTED,!0),g,h):q(c)&&c&&o&&k(!1,i.classed(l.SELECTED,!1),g,h))})},h.unselect=function(a,b){var c=this.internal,d=c.d3,e=c.config;e.data_selection_enabled&&c.main.selectAll("."+l.shapes).selectAll("."+l.shape).each(function(f,g){var h=d.select(this),i=f.data?f.data.id:f.id,j=c.getToggle(this,f).bind(c),k=e.data_selection_grouped||!a||a.indexOf(i)>=0,m=!b||b.indexOf(g)>=0,n=h.classed(l.SELECTED);h.classed(l.line)||h.classed(l.area)||k&&m&&e.data_selection_isselectable(f)&&n&&j(!1,h.classed(l.SELECTED,!1),f,g)})},h.transform=function(a,b){var c=this.internal,d=["pie","donut"].indexOf(a)>=0?{withTransform:!0}:null;c.transformTo(b,a,d)},i.transformTo=function(a,b,c){var d=this,e=!d.hasArcType(),f=c||{withTransitionForAxis:e};f.withTransitionForTransform=!1,d.transiting=!1,d.setTargetType(a,b),d.updateTargets(d.data.targets),d.updateAndRedraw(f)},h.groups=function(a){var b=this.internal,c=b.config;return p(a)?c.data_groups:(c.data_groups=a,b.redraw(),c.data_groups)},h.xgrids=function(a){var b=this.internal,c=b.config;return a?(c.grid_x_lines=a,b.redrawWithoutRescale(),c.grid_x_lines):c.grid_x_lines},h.xgrids.add=function(a){var b=this.internal;return this.xgrids(b.config.grid_x_lines.concat(a?a:[]))},h.xgrids.remove=function(a){var b=this.internal;b.removeGridLines(a,!0)},h.ygrids=function(a){var b=this.internal,c=b.config;return a?(c.grid_y_lines=a,b.redrawWithoutRescale(),c.grid_y_lines):c.grid_y_lines},h.ygrids.add=function(a){var b=this.internal;return this.ygrids(b.config.grid_y_lines.concat(a?a:[]))},h.ygrids.remove=function(a){var b=this.internal;b.removeGridLines(a,!1)},h.regions=function(a){var b=this.internal,c=b.config;return a?(c.regions=a,b.redrawWithoutRescale(),c.regions):c.regions},h.regions.add=function(a){var b=this.internal,c=b.config;return a?(c.regions=c.regions.concat(a),b.redrawWithoutRescale(),c.regions):c.regions},h.regions.remove=function(a){var b,c,d,e=this.internal,f=e.config;return a=a||{},b=e.getOption(a,"duration",f.transition_duration),c=e.getOption(a,"classes",[l.region]),d=e.main.select("."+l.regions).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),f.regions=f.regions.filter(function(a){var b=!1;return a["class"]?(a["class"].split(" ").forEach(function(a){c.indexOf(a)>=0&&(b=!0)}),!b):!0}),f.regions},h.data=function(a){var b=this.internal.data.targets;return"undefined"==typeof a?b:b.filter(function(b){return[].concat(a).indexOf(b.id)>=0})},h.data.shown=function(a){return this.internal.filterTargetsToShow(this.data(a))},h.data.values=function(a){var b,c=null;return a&&(b=this.data(a),c=b[0]?b[0].values.map(function(a){return a.value}):null),c},h.data.names=function(a){return this.internal.clearLegendItemTextBoxCache(),this.internal.updateDataAttributes("names",a)},h.data.colors=function(a){return this.internal.updateDataAttributes("colors",a)},h.data.axes=function(a){return this.internal.updateDataAttributes("axes",a)},h.category=function(a,b){var c=this.internal,d=c.config;return arguments.length>1&&(d.axis_x_categories[a]=b,c.redraw()),d.axis_x_categories[a]},h.categories=function(a){var b=this.internal,c=b.config;return arguments.length?(c.axis_x_categories=a,b.redraw(),c.axis_x_categories):c.axis_x_categories},h.color=function(a){var b=this.internal;return b.color(a)},h.x=function(a){var b=this.internal;return arguments.length&&(b.updateTargetX(b.data.targets,a),b.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),b.data.xs},h.xs=function(a){var b=this.internal;return arguments.length&&(b.updateTargetXs(b.data.targets,a),b.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),b.data.xs},h.axis=function(){},h.axis.labels=function(a){var b=this.internal;arguments.length&&(Object.keys(a).forEach(function(c){b.axis.setLabelText(c,a[c])}),b.axis.updateLabels())},h.axis.max=function(a){var b=this.internal,c=b.config;return arguments.length?("object"==typeof a?(m(a.x)&&(c.axis_x_max=a.x),m(a.y)&&(c.axis_y_max=a.y),m(a.y2)&&(c.axis_y2_max=a.y2)):c.axis_y_max=c.axis_y2_max=a,void b.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})):{x:c.axis_x_max,y:c.axis_y_max,y2:c.axis_y2_max}},h.axis.min=function(a){var b=this.internal,c=b.config;return arguments.length?("object"==typeof a?(m(a.x)&&(c.axis_x_min=a.x),m(a.y)&&(c.axis_y_min=a.y),m(a.y2)&&(c.axis_y2_min=a.y2)):c.axis_y_min=c.axis_y2_min=a,void b.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})):{x:c.axis_x_min,y:c.axis_y_min,y2:c.axis_y2_min}},h.axis.range=function(a){return arguments.length?(q(a.max)&&this.axis.max(a.max),void(q(a.min)&&this.axis.min(a.min))):{max:this.axis.max(),min:this.axis.min()}},h.legend=function(){},h.legend.show=function(a){var b=this.internal;b.showLegend(b.mapToTargetIds(a)),b.updateAndRedraw({withLegend:!0})},h.legend.hide=function(a){var b=this.internal;b.hideLegend(b.mapToTargetIds(a)),b.updateAndRedraw({withLegend:!0})},h.resize=function(a){var b=this.internal,c=b.config;c.size_width=a?a.width:null,c.size_height=a?a.height:null,this.flush()},h.flush=function(){var a=this.internal;a.updateAndRedraw({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},h.destroy=function(){var b=this.internal;return a.clearInterval(b.intervalForObserveInserted),a.onresize=null,b.selectChart.classed("c3",!1).html(""),Object.keys(b).forEach(function(a){b[a]=null}),null},h.tooltip=function(){},h.tooltip.show=function(a){var b,c,d=this.internal;a.mouse&&(c=a.mouse),a.data?d.isMultipleX()?(c=[d.x(a.data.x),d.getYScale(a.data.id)(a.data.value)],b=null):b=m(a.data.index)?a.data.index:d.getIndexByX(a.data.x):"undefined"!=typeof a.x?b=d.getIndexByX(a.x):"undefined"!=typeof a.index&&(b=a.index),d.dispatchEvent("mouseover",b,c),d.dispatchEvent("mousemove",b,c)},h.tooltip.hide=function(){this.internal.dispatchEvent("mouseout",0)};var z;i.isSafari=function(){var b=a.navigator.userAgent;return b.indexOf("Safari")>=0&&b.indexOf("Chrome")<0},i.isChrome=function(){var b=a.navigator.userAgent;return b.indexOf("Chrome")>=0},Function.prototype.bind||(Function.prototype.bind=function(a){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var b=Array.prototype.slice.call(arguments,1),c=this,d=function(){},e=function(){return c.apply(this instanceof d?this:a,b.concat(Array.prototype.slice.call(arguments)))};return d.prototype=this.prototype,e.prototype=new d,e}),"function"==typeof define&&define.amd?define("c3",["d3"],k):"undefined"!=typeof exports&&"undefined"!=typeof module?module.exports=k:a.c3=k}(window); \ No newline at end of file diff --git a/web/js/d3.v3.min.js b/web/js/d3.v3.min.js deleted file mode 100644 index ca05c71..0000000 --- a/web/js/d3.v3.min.js +++ /dev/null @@ -1,5 +0,0 @@ -!function(){function n(n){return n&&(n.ownerDocument||n.document||n).documentElement}function t(n){return n&&(n.ownerDocument&&n.ownerDocument.defaultView||n.document&&n||n.defaultView)}function e(n,t){return t>n?-1:n>t?1:n>=t?0:NaN}function r(n){return null===n?NaN:+n}function u(n){return!isNaN(n)}function i(n){return{left:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)<0?r=i+1:u=i}return r},right:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)>0?u=i:r=i+1}return r}}}function a(n){return n.length}function o(n){for(var t=1;n*t%1;)t*=10;return t}function l(n,t){for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}function c(){this._=Object.create(null)}function s(n){return(n+="")===xa||n[0]===ba?ba+n:n}function f(n){return(n+="")[0]===ba?n.slice(1):n}function h(n){return s(n)in this._}function g(n){return(n=s(n))in this._&&delete this._[n]}function p(){var n=[];for(var t in this._)n.push(f(t));return n}function v(){var n=0;for(var t in this._)++n;return n}function d(){for(var n in this._)return!1;return!0}function m(){this._=Object.create(null)}function y(n){return n}function M(n,t,e){return function(){var r=e.apply(t,arguments);return r===t?n:r}}function x(n,t){if(t in n)return t;t=t.charAt(0).toUpperCase()+t.slice(1);for(var e=0,r=_a.length;r>e;++e){var u=_a[e]+t;if(u in n)return u}}function b(){}function _(){}function w(n){function t(){for(var t,r=e,u=-1,i=r.length;++ue;e++)for(var u,i=n[e],a=0,o=i.length;o>a;a++)(u=i[a])&&t(u,a,e);return n}function Z(n){return Sa(n,za),n}function V(n){var t,e;return function(r,u,i){var a,o=n[i].update,l=o.length;for(i!=e&&(e=i,t=0),u>=t&&(t=u+1);!(a=o[t])&&++t0&&(n=n.slice(0,o));var c=La.get(n);return c&&(n=c,l=B),o?t?u:r:t?b:i}function $(n,t){return function(e){var r=oa.event;oa.event=e,t[0]=this.__data__;try{n.apply(this,t)}finally{oa.event=r}}}function B(n,t){var e=$(n,t);return function(n){var t=this,r=n.relatedTarget;r&&(r===t||8&r.compareDocumentPosition(t))||e.call(t,n)}}function W(e){var r=".dragsuppress-"+ ++Ta,u="click"+r,i=oa.select(t(e)).on("touchmove"+r,S).on("dragstart"+r,S).on("selectstart"+r,S);if(null==qa&&(qa="onselectstart"in e?!1:x(e.style,"userSelect")),qa){var a=n(e).style,o=a[qa];a[qa]="none"}return function(n){if(i.on(r,null),qa&&(a[qa]=o),n){var t=function(){i.on(u,null)};i.on(u,function(){S(),t()},!0),setTimeout(t,0)}}}function J(n,e){e.changedTouches&&(e=e.changedTouches[0]);var r=n.ownerSVGElement||n;if(r.createSVGPoint){var u=r.createSVGPoint();if(0>Ra){var i=t(n);if(i.scrollX||i.scrollY){r=oa.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var a=r[0][0].getScreenCTM();Ra=!(a.f||a.e),r.remove()}}return Ra?(u.x=e.pageX,u.y=e.pageY):(u.x=e.clientX,u.y=e.clientY),u=u.matrixTransform(n.getScreenCTM().inverse()),[u.x,u.y]}var o=n.getBoundingClientRect();return[e.clientX-o.left-n.clientLeft,e.clientY-o.top-n.clientTop]}function G(){return oa.event.changedTouches[0].identifier}function K(n){return n>0?1:0>n?-1:0}function Q(n,t,e){return(t[0]-n[0])*(e[1]-n[1])-(t[1]-n[1])*(e[0]-n[0])}function nn(n){return n>1?0:-1>n?ja:Math.acos(n)}function tn(n){return n>1?Ha:-1>n?-Ha:Math.asin(n)}function en(n){return((n=Math.exp(n))-1/n)/2}function rn(n){return((n=Math.exp(n))+1/n)/2}function un(n){return((n=Math.exp(2*n))-1)/(n+1)}function an(n){return(n=Math.sin(n/2))*n}function on(){}function ln(n,t,e){return this instanceof ln?(this.h=+n,this.s=+t,void(this.l=+e)):arguments.length<2?n instanceof ln?new ln(n.h,n.s,n.l):_n(""+n,wn,ln):new ln(n,t,e)}function cn(n,t,e){function r(n){return n>360?n-=360:0>n&&(n+=360),60>n?i+(a-i)*n/60:180>n?a:240>n?i+(a-i)*(240-n)/60:i}function u(n){return Math.round(255*r(n))}var i,a;return n=isNaN(n)?0:(n%=360)<0?n+360:n,t=isNaN(t)?0:0>t?0:t>1?1:t,e=0>e?0:e>1?1:e,a=.5>=e?e*(1+t):e+t-e*t,i=2*e-a,new yn(u(n+120),u(n),u(n-120))}function sn(n,t,e){return this instanceof sn?(this.h=+n,this.c=+t,void(this.l=+e)):arguments.length<2?n instanceof sn?new sn(n.h,n.c,n.l):n instanceof hn?pn(n.l,n.a,n.b):pn((n=Sn((n=oa.rgb(n)).r,n.g,n.b)).l,n.a,n.b):new sn(n,t,e)}function fn(n,t,e){return isNaN(n)&&(n=0),isNaN(t)&&(t=0),new hn(e,Math.cos(n*=Oa)*t,Math.sin(n)*t)}function hn(n,t,e){return this instanceof hn?(this.l=+n,this.a=+t,void(this.b=+e)):arguments.length<2?n instanceof hn?new hn(n.l,n.a,n.b):n instanceof sn?fn(n.h,n.c,n.l):Sn((n=yn(n)).r,n.g,n.b):new hn(n,t,e)}function gn(n,t,e){var r=(n+16)/116,u=r+t/500,i=r-e/200;return u=vn(u)*Ka,r=vn(r)*Qa,i=vn(i)*no,new yn(mn(3.2404542*u-1.5371385*r-.4985314*i),mn(-.969266*u+1.8760108*r+.041556*i),mn(.0556434*u-.2040259*r+1.0572252*i))}function pn(n,t,e){return n>0?new sn(Math.atan2(e,t)*Ia,Math.sqrt(t*t+e*e),n):new sn(NaN,NaN,n)}function vn(n){return n>.206893034?n*n*n:(n-4/29)/7.787037}function dn(n){return n>.008856?Math.pow(n,1/3):7.787037*n+4/29}function mn(n){return Math.round(255*(.00304>=n?12.92*n:1.055*Math.pow(n,1/2.4)-.055))}function yn(n,t,e){return this instanceof yn?(this.r=~~n,this.g=~~t,void(this.b=~~e)):arguments.length<2?n instanceof yn?new yn(n.r,n.g,n.b):_n(""+n,yn,cn):new yn(n,t,e)}function Mn(n){return new yn(n>>16,n>>8&255,255&n)}function xn(n){return Mn(n)+""}function bn(n){return 16>n?"0"+Math.max(0,n).toString(16):Math.min(255,n).toString(16)}function _n(n,t,e){var r,u,i,a=0,o=0,l=0;if(r=/([a-z]+)\((.*)\)/.exec(n=n.toLowerCase()))switch(u=r[2].split(","),r[1]){case"hsl":return e(parseFloat(u[0]),parseFloat(u[1])/100,parseFloat(u[2])/100);case"rgb":return t(Nn(u[0]),Nn(u[1]),Nn(u[2]))}return(i=ro.get(n))?t(i.r,i.g,i.b):(null==n||"#"!==n.charAt(0)||isNaN(i=parseInt(n.slice(1),16))||(4===n.length?(a=(3840&i)>>4,a=a>>4|a,o=240&i,o=o>>4|o,l=15&i,l=l<<4|l):7===n.length&&(a=(16711680&i)>>16,o=(65280&i)>>8,l=255&i)),t(a,o,l))}function wn(n,t,e){var r,u,i=Math.min(n/=255,t/=255,e/=255),a=Math.max(n,t,e),o=a-i,l=(a+i)/2;return o?(u=.5>l?o/(a+i):o/(2-a-i),r=n==a?(t-e)/o+(e>t?6:0):t==a?(e-n)/o+2:(n-t)/o+4,r*=60):(r=NaN,u=l>0&&1>l?0:r),new ln(r,u,l)}function Sn(n,t,e){n=kn(n),t=kn(t),e=kn(e);var r=dn((.4124564*n+.3575761*t+.1804375*e)/Ka),u=dn((.2126729*n+.7151522*t+.072175*e)/Qa),i=dn((.0193339*n+.119192*t+.9503041*e)/no);return hn(116*u-16,500*(r-u),200*(u-i))}function kn(n){return(n/=255)<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function Nn(n){var t=parseFloat(n);return"%"===n.charAt(n.length-1)?Math.round(2.55*t):t}function En(n){return"function"==typeof n?n:function(){return n}}function An(n){return function(t,e,r){return 2===arguments.length&&"function"==typeof e&&(r=e,e=null),Cn(t,e,n,r)}}function Cn(n,t,e,r){function u(){var n,t=l.status;if(!t&&Ln(l)||t>=200&&300>t||304===t){try{n=e.call(i,l)}catch(r){return void a.error.call(i,r)}a.load.call(i,n)}else a.error.call(i,l)}var i={},a=oa.dispatch("beforesend","progress","load","error"),o={},l=new XMLHttpRequest,c=null;return!this.XDomainRequest||"withCredentials"in l||!/^(http(s)?:)?\/\//.test(n)||(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=u:l.onreadystatechange=function(){l.readyState>3&&u()},l.onprogress=function(n){var t=oa.event;oa.event=n;try{a.progress.call(i,l)}finally{oa.event=t}},i.header=function(n,t){return n=(n+"").toLowerCase(),arguments.length<2?o[n]:(null==t?delete o[n]:o[n]=t+"",i)},i.mimeType=function(n){return arguments.length?(t=null==n?null:n+"",i):t},i.responseType=function(n){return arguments.length?(c=n,i):c},i.response=function(n){return e=n,i},["get","post"].forEach(function(n){i[n]=function(){return i.send.apply(i,[n].concat(ca(arguments)))}}),i.send=function(e,r,u){if(2===arguments.length&&"function"==typeof r&&(u=r,r=null),l.open(e,n,!0),null==t||"accept"in o||(o.accept=t+",*/*"),l.setRequestHeader)for(var s in o)l.setRequestHeader(s,o[s]);return null!=t&&l.overrideMimeType&&l.overrideMimeType(t),null!=c&&(l.responseType=c),null!=u&&i.on("error",u).on("load",function(n){u(null,n)}),a.beforesend.call(i,l),l.send(null==r?null:r),i},i.abort=function(){return l.abort(),i},oa.rebind(i,a,"on"),null==r?i:i.get(zn(r))}function zn(n){return 1===n.length?function(t,e){n(null==t?e:null)}:n}function Ln(n){var t=n.responseType;return t&&"text"!==t?n.response:n.responseText}function qn(n,t,e){var r=arguments.length;2>r&&(t=0),3>r&&(e=Date.now());var u=e+t,i={c:n,t:u,n:null};return io?io.n=i:uo=i,io=i,ao||(oo=clearTimeout(oo),ao=1,lo(Tn)),i}function Tn(){var n=Rn(),t=Dn()-n;t>24?(isFinite(t)&&(clearTimeout(oo),oo=setTimeout(Tn,t)),ao=0):(ao=1,lo(Tn))}function Rn(){for(var n=Date.now(),t=uo;t;)n>=t.t&&t.c(n-t.t)&&(t.c=null),t=t.n;return n}function Dn(){for(var n,t=uo,e=1/0;t;)t.c?(t.t8?function(n){return n/e}:function(n){return n*e},symbol:n}}function Un(n){var t=n.decimal,e=n.thousands,r=n.grouping,u=n.currency,i=r&&e?function(n,t){for(var u=n.length,i=[],a=0,o=r[0],l=0;u>0&&o>0&&(l+o+1>t&&(o=Math.max(1,t-l)),i.push(n.substring(u-=o,u+o)),!((l+=o+1)>t));)o=r[a=(a+1)%r.length];return i.reverse().join(e)}:y;return function(n){var e=so.exec(n),r=e[1]||" ",a=e[2]||">",o=e[3]||"-",l=e[4]||"",c=e[5],s=+e[6],f=e[7],h=e[8],g=e[9],p=1,v="",d="",m=!1,y=!0;switch(h&&(h=+h.substring(1)),(c||"0"===r&&"="===a)&&(c=r="0",a="="),g){case"n":f=!0,g="g";break;case"%":p=100,d="%",g="f";break;case"p":p=100,d="%",g="r";break;case"b":case"o":case"x":case"X":"#"===l&&(v="0"+g.toLowerCase());case"c":y=!1;case"d":m=!0,h=0;break;case"s":p=-1,g="r"}"$"===l&&(v=u[0],d=u[1]),"r"!=g||h||(g="g"),null!=h&&("g"==g?h=Math.max(1,Math.min(21,h)):("e"==g||"f"==g)&&(h=Math.max(0,Math.min(20,h)))),g=fo.get(g)||Fn;var M=c&&f;return function(n){var e=d;if(m&&n%1)return"";var u=0>n||0===n&&0>1/n?(n=-n,"-"):"-"===o?"":o;if(0>p){var l=oa.formatPrefix(n,h);n=l.scale(n),e=l.symbol+d}else n*=p;n=g(n,h);var x,b,_=n.lastIndexOf(".");if(0>_){var w=y?n.lastIndexOf("e"):-1;0>w?(x=n,b=""):(x=n.substring(0,w),b=n.substring(w))}else x=n.substring(0,_),b=t+n.substring(_+1);!c&&f&&(x=i(x,1/0));var S=v.length+x.length+b.length+(M?0:u.length),k=s>S?new Array(S=s-S+1).join(r):"";return M&&(x=i(k+x,k.length?s-b.length:1/0)),u+=v,n=x+b,("<"===a?u+n+k:">"===a?k+u+n:"^"===a?k.substring(0,S>>=1)+u+n+k.substring(S):u+(M?n:k+n))+e}}}function Fn(n){return n+""}function Hn(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function On(n,t,e){function r(t){var e=n(t),r=i(e,1);return r-t>t-e?e:r}function u(e){return t(e=n(new go(e-1)),1),e}function i(n,e){return t(n=new go(+n),e),n}function a(n,r,i){var a=u(n),o=[];if(i>1)for(;r>a;)e(a)%i||o.push(new Date(+a)),t(a,1);else for(;r>a;)o.push(new Date(+a)),t(a,1);return o}function o(n,t,e){try{go=Hn;var r=new Hn;return r._=n,a(r,t,e)}finally{go=Date}}n.floor=n,n.round=r,n.ceil=u,n.offset=i,n.range=a;var l=n.utc=In(n);return l.floor=l,l.round=In(r),l.ceil=In(u),l.offset=In(i),l.range=o,n}function In(n){return function(t,e){try{go=Hn;var r=new Hn;return r._=t,n(r,e)._}finally{go=Date}}}function Yn(n){function t(n){function t(t){for(var e,u,i,a=[],o=-1,l=0;++oo;){if(r>=c)return-1;if(u=t.charCodeAt(o++),37===u){if(a=t.charAt(o++),i=C[a in vo?t.charAt(o++):a],!i||(r=i(n,e,r))<0)return-1}else if(u!=e.charCodeAt(r++))return-1}return r}function r(n,t,e){_.lastIndex=0;var r=_.exec(t.slice(e));return r?(n.w=w.get(r[0].toLowerCase()),e+r[0].length):-1}function u(n,t,e){x.lastIndex=0;var r=x.exec(t.slice(e));return r?(n.w=b.get(r[0].toLowerCase()),e+r[0].length):-1}function i(n,t,e){N.lastIndex=0;var r=N.exec(t.slice(e));return r?(n.m=E.get(r[0].toLowerCase()),e+r[0].length):-1}function a(n,t,e){S.lastIndex=0;var r=S.exec(t.slice(e));return r?(n.m=k.get(r[0].toLowerCase()),e+r[0].length):-1}function o(n,t,r){return e(n,A.c.toString(),t,r)}function l(n,t,r){return e(n,A.x.toString(),t,r)}function c(n,t,r){return e(n,A.X.toString(),t,r)}function s(n,t,e){var r=M.get(t.slice(e,e+=2).toLowerCase());return null==r?-1:(n.p=r,e)}var f=n.dateTime,h=n.date,g=n.time,p=n.periods,v=n.days,d=n.shortDays,m=n.months,y=n.shortMonths;t.utc=function(n){function e(n){try{go=Hn;var t=new go;return t._=n,r(t)}finally{go=Date}}var r=t(n);return e.parse=function(n){try{go=Hn;var t=r.parse(n);return t&&t._}finally{go=Date}},e.toString=r.toString,e},t.multi=t.utc.multi=ct;var M=oa.map(),x=Vn(v),b=Xn(v),_=Vn(d),w=Xn(d),S=Vn(m),k=Xn(m),N=Vn(y),E=Xn(y);p.forEach(function(n,t){M.set(n.toLowerCase(),t)});var A={a:function(n){return d[n.getDay()]},A:function(n){return v[n.getDay()]},b:function(n){return y[n.getMonth()]},B:function(n){return m[n.getMonth()]},c:t(f),d:function(n,t){return Zn(n.getDate(),t,2)},e:function(n,t){return Zn(n.getDate(),t,2)},H:function(n,t){return Zn(n.getHours(),t,2)},I:function(n,t){return Zn(n.getHours()%12||12,t,2)},j:function(n,t){return Zn(1+ho.dayOfYear(n),t,3)},L:function(n,t){return Zn(n.getMilliseconds(),t,3)},m:function(n,t){return Zn(n.getMonth()+1,t,2)},M:function(n,t){return Zn(n.getMinutes(),t,2)},p:function(n){return p[+(n.getHours()>=12)]},S:function(n,t){return Zn(n.getSeconds(),t,2)},U:function(n,t){return Zn(ho.sundayOfYear(n),t,2)},w:function(n){return n.getDay()},W:function(n,t){return Zn(ho.mondayOfYear(n),t,2)},x:t(h),X:t(g),y:function(n,t){return Zn(n.getFullYear()%100,t,2)},Y:function(n,t){return Zn(n.getFullYear()%1e4,t,4)},Z:ot,"%":function(){return"%"}},C={a:r,A:u,b:i,B:a,c:o,d:tt,e:tt,H:rt,I:rt,j:et,L:at,m:nt,M:ut,p:s,S:it,U:Bn,w:$n,W:Wn,x:l,X:c,y:Gn,Y:Jn,Z:Kn,"%":lt};return t}function Zn(n,t,e){var r=0>n?"-":"",u=(r?-n:n)+"",i=u.length;return r+(e>i?new Array(e-i+1).join(t)+u:u)}function Vn(n){return new RegExp("^(?:"+n.map(oa.requote).join("|")+")","i")}function Xn(n){for(var t=new c,e=-1,r=n.length;++e68?1900:2e3)}function nt(n,t,e){mo.lastIndex=0;var r=mo.exec(t.slice(e,e+2));return r?(n.m=r[0]-1,e+r[0].length):-1}function tt(n,t,e){mo.lastIndex=0;var r=mo.exec(t.slice(e,e+2));return r?(n.d=+r[0],e+r[0].length):-1}function et(n,t,e){mo.lastIndex=0;var r=mo.exec(t.slice(e,e+3));return r?(n.j=+r[0],e+r[0].length):-1}function rt(n,t,e){mo.lastIndex=0;var r=mo.exec(t.slice(e,e+2));return r?(n.H=+r[0],e+r[0].length):-1}function ut(n,t,e){mo.lastIndex=0;var r=mo.exec(t.slice(e,e+2));return r?(n.M=+r[0],e+r[0].length):-1}function it(n,t,e){mo.lastIndex=0;var r=mo.exec(t.slice(e,e+2));return r?(n.S=+r[0],e+r[0].length):-1}function at(n,t,e){mo.lastIndex=0;var r=mo.exec(t.slice(e,e+3));return r?(n.L=+r[0],e+r[0].length):-1}function ot(n){var t=n.getTimezoneOffset(),e=t>0?"-":"+",r=Ma(t)/60|0,u=Ma(t)%60;return e+Zn(r,"0",2)+Zn(u,"0",2)}function lt(n,t,e){yo.lastIndex=0;var r=yo.exec(t.slice(e,e+1));return r?e+r[0].length:-1}function ct(n){for(var t=n.length,e=-1;++e=0?1:-1,o=a*e,l=Math.cos(t),c=Math.sin(t),s=i*c,f=u*l+s*Math.cos(o),h=s*a*Math.sin(o);So.add(Math.atan2(h,f)),r=n,u=l,i=c}var t,e,r,u,i;ko.point=function(a,o){ko.point=n,r=(t=a)*Oa,u=Math.cos(o=(e=o)*Oa/2+ja/4),i=Math.sin(o)},ko.lineEnd=function(){n(t,e)}}function dt(n){var t=n[0],e=n[1],r=Math.cos(e);return[r*Math.cos(t),r*Math.sin(t),Math.sin(e)]}function mt(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]}function yt(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function Mt(n,t){n[0]+=t[0],n[1]+=t[1],n[2]+=t[2]}function xt(n,t){return[n[0]*t,n[1]*t,n[2]*t]}function bt(n){var t=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}function _t(n){return[Math.atan2(n[1],n[0]),tn(n[2])]}function wt(n,t){return Ma(n[0]-t[0])o;++o)u.point((e=n[o])[0],e[1]);return void u.lineEnd()}var l=new Tt(e,n,null,!0),c=new Tt(e,null,l,!1);l.o=c,i.push(l),a.push(c),l=new Tt(r,n,null,!1),c=new Tt(r,null,l,!0),l.o=c,i.push(l),a.push(c)}}),a.sort(t),qt(i),qt(a),i.length){for(var o=0,l=e,c=a.length;c>o;++o)a[o].e=l=!l;for(var s,f,h=i[0];;){for(var g=h,p=!0;g.v;)if((g=g.n)===h)return;s=g.z,u.lineStart();do{if(g.v=g.o.v=!0,g.e){if(p)for(var o=0,c=s.length;c>o;++o)u.point((f=s[o])[0],f[1]);else r(g.x,g.n.x,1,u);g=g.n}else{if(p){s=g.p.z;for(var o=s.length-1;o>=0;--o)u.point((f=s[o])[0],f[1])}else r(g.x,g.p.x,-1,u);g=g.p}g=g.o,s=g.z,p=!p}while(!g.v);u.lineEnd()}}}function qt(n){if(t=n.length){for(var t,e,r=0,u=n[0];++r0){for(b||(i.polygonStart(),b=!0),i.lineStart();++a1&&2&t&&e.push(e.pop().concat(e.shift())),g.push(e.filter(Dt))}var g,p,v,d=t(i),m=u.invert(r[0],r[1]),y={point:a,lineStart:l,lineEnd:c,polygonStart:function(){y.point=s,y.lineStart=f,y.lineEnd=h,g=[],p=[]},polygonEnd:function(){y.point=a,y.lineStart=l,y.lineEnd=c,g=oa.merge(g);var n=Ot(m,p);g.length?(b||(i.polygonStart(),b=!0),Lt(g,jt,n,e,i)):n&&(b||(i.polygonStart(),b=!0),i.lineStart(),e(null,null,1,i),i.lineEnd()),b&&(i.polygonEnd(),b=!1),g=p=null},sphere:function(){i.polygonStart(),i.lineStart(),e(null,null,1,i),i.lineEnd(),i.polygonEnd()}},M=Pt(),x=t(M),b=!1;return y}}function Dt(n){return n.length>1}function Pt(){var n,t=[];return{lineStart:function(){t.push(n=[])},point:function(t,e){n.push([t,e])},lineEnd:b,buffer:function(){var e=t;return t=[],n=null,e},rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))}}}function jt(n,t){return((n=n.x)[0]<0?n[1]-Ha-Da:Ha-n[1])-((t=t.x)[0]<0?t[1]-Ha-Da:Ha-t[1])}function Ut(n){var t,e=NaN,r=NaN,u=NaN;return{lineStart:function(){n.lineStart(),t=1},point:function(i,a){var o=i>0?ja:-ja,l=Ma(i-e);Ma(l-ja)0?Ha:-Ha),n.point(u,r),n.lineEnd(),n.lineStart(),n.point(o,r),n.point(i,r),t=0):u!==o&&l>=ja&&(Ma(e-u)Da?Math.atan((Math.sin(t)*(i=Math.cos(r))*Math.sin(e)-Math.sin(r)*(u=Math.cos(t))*Math.sin(n))/(u*i*a)):(t+r)/2}function Ht(n,t,e,r){var u;if(null==n)u=e*Ha,r.point(-ja,u),r.point(0,u),r.point(ja,u),r.point(ja,0),r.point(ja,-u),r.point(0,-u),r.point(-ja,-u),r.point(-ja,0),r.point(-ja,u);else if(Ma(n[0]-t[0])>Da){var i=n[0]o;++o){var c=t[o],s=c.length;if(s)for(var f=c[0],h=f[0],g=f[1]/2+ja/4,p=Math.sin(g),v=Math.cos(g),d=1;;){d===s&&(d=0),n=c[d];var m=n[0],y=n[1]/2+ja/4,M=Math.sin(y),x=Math.cos(y),b=m-h,_=b>=0?1:-1,w=_*b,S=w>ja,k=p*M;if(So.add(Math.atan2(k*_*Math.sin(w),v*x+k*Math.cos(w))),i+=S?b+_*Ua:b,S^h>=e^m>=e){var N=yt(dt(f),dt(n));bt(N);var E=yt(u,N);bt(E);var A=(S^b>=0?-1:1)*tn(E[2]);(r>A||r===A&&(N[0]||N[1]))&&(a+=S^b>=0?1:-1)}if(!d++)break;h=m,p=M,v=x,f=n}}return(-Da>i||Da>i&&0>So)^1&a}function It(n){function t(n,t){return Math.cos(n)*Math.cos(t)>i}function e(n){var e,i,l,c,s;return{lineStart:function(){c=l=!1,s=1},point:function(f,h){var g,p=[f,h],v=t(f,h),d=a?v?0:u(f,h):v?u(f+(0>f?ja:-ja),h):0;if(!e&&(c=l=v)&&n.lineStart(),v!==l&&(g=r(e,p),(wt(e,g)||wt(p,g))&&(p[0]+=Da,p[1]+=Da,v=t(p[0],p[1]))),v!==l)s=0,v?(n.lineStart(),g=r(p,e),n.point(g[0],g[1])):(g=r(e,p),n.point(g[0],g[1]),n.lineEnd()),e=g;else if(o&&e&&a^v){var m;d&i||!(m=r(p,e,!0))||(s=0,a?(n.lineStart(),n.point(m[0][0],m[0][1]),n.point(m[1][0],m[1][1]),n.lineEnd()):(n.point(m[1][0],m[1][1]),n.lineEnd(),n.lineStart(),n.point(m[0][0],m[0][1])))}!v||e&&wt(e,p)||n.point(p[0],p[1]),e=p,l=v,i=d},lineEnd:function(){l&&n.lineEnd(),e=null},clean:function(){return s|(c&&l)<<1}}}function r(n,t,e){var r=dt(n),u=dt(t),a=[1,0,0],o=yt(r,u),l=mt(o,o),c=o[0],s=l-c*c;if(!s)return!e&&n;var f=i*l/s,h=-i*c/s,g=yt(a,o),p=xt(a,f),v=xt(o,h);Mt(p,v);var d=g,m=mt(p,d),y=mt(d,d),M=m*m-y*(mt(p,p)-1);if(!(0>M)){var x=Math.sqrt(M),b=xt(d,(-m-x)/y);if(Mt(b,p),b=_t(b),!e)return b;var _,w=n[0],S=t[0],k=n[1],N=t[1];w>S&&(_=w,w=S,S=_);var E=S-w,A=Ma(E-ja)E;if(!A&&k>N&&(_=k,k=N,N=_),C?A?k+N>0^b[1]<(Ma(b[0]-w)ja^(w<=b[0]&&b[0]<=S)){var z=xt(d,(-m+x)/y);return Mt(z,p),[b,_t(z)]}}}function u(t,e){var r=a?n:ja-n,u=0;return-r>t?u|=1:t>r&&(u|=2),-r>e?u|=4:e>r&&(u|=8),u}var i=Math.cos(n),a=i>0,o=Ma(i)>Da,l=ve(n,6*Oa);return Rt(t,e,l,a?[0,-n]:[-ja,n-ja])}function Yt(n,t,e,r){return function(u){var i,a=u.a,o=u.b,l=a.x,c=a.y,s=o.x,f=o.y,h=0,g=1,p=s-l,v=f-c;if(i=n-l,p||!(i>0)){if(i/=p,0>p){if(h>i)return;g>i&&(g=i)}else if(p>0){if(i>g)return;i>h&&(h=i)}if(i=e-l,p||!(0>i)){if(i/=p,0>p){if(i>g)return;i>h&&(h=i)}else if(p>0){if(h>i)return;g>i&&(g=i)}if(i=t-c,v||!(i>0)){if(i/=v,0>v){if(h>i)return;g>i&&(g=i)}else if(v>0){if(i>g)return;i>h&&(h=i)}if(i=r-c,v||!(0>i)){if(i/=v,0>v){if(i>g)return;i>h&&(h=i)}else if(v>0){if(h>i)return;g>i&&(g=i)}return h>0&&(u.a={x:l+h*p,y:c+h*v}),1>g&&(u.b={x:l+g*p,y:c+g*v}),u}}}}}}function Zt(n,t,e,r){function u(r,u){return Ma(r[0]-n)0?0:3:Ma(r[0]-e)0?2:1:Ma(r[1]-t)0?1:0:u>0?3:2}function i(n,t){return a(n.x,t.x)}function a(n,t){var e=u(n,1),r=u(t,1);return e!==r?e-r:0===e?t[1]-n[1]:1===e?n[0]-t[0]:2===e?n[1]-t[1]:t[0]-n[0]}return function(o){function l(n){for(var t=0,e=d.length,r=n[1],u=0;e>u;++u)for(var i,a=1,o=d[u],l=o.length,c=o[0];l>a;++a)i=o[a],c[1]<=r?i[1]>r&&Q(c,i,n)>0&&++t:i[1]<=r&&Q(c,i,n)<0&&--t,c=i;return 0!==t}function c(i,o,l,c){var s=0,f=0;if(null==i||(s=u(i,l))!==(f=u(o,l))||a(i,o)<0^l>0){do c.point(0===s||3===s?n:e,s>1?r:t);while((s=(s+l+4)%4)!==f)}else c.point(o[0],o[1])}function s(u,i){return u>=n&&e>=u&&i>=t&&r>=i}function f(n,t){s(n,t)&&o.point(n,t)}function h(){C.point=p,d&&d.push(m=[]),S=!0,w=!1,b=_=NaN}function g(){v&&(p(y,M),x&&w&&E.rejoin(),v.push(E.buffer())),C.point=f,w&&o.lineEnd()}function p(n,t){n=Math.max(-Fo,Math.min(Fo,n)),t=Math.max(-Fo,Math.min(Fo,t));var e=s(n,t);if(d&&m.push([n,t]),S)y=n,M=t,x=e,S=!1,e&&(o.lineStart(),o.point(n,t));else if(e&&w)o.point(n,t);else{var r={a:{x:b,y:_},b:{x:n,y:t}};A(r)?(w||(o.lineStart(),o.point(r.a.x,r.a.y)),o.point(r.b.x,r.b.y),e||o.lineEnd(),k=!1):e&&(o.lineStart(),o.point(n,t),k=!1)}b=n,_=t,w=e}var v,d,m,y,M,x,b,_,w,S,k,N=o,E=Pt(),A=Yt(n,t,e,r),C={point:f,lineStart:h,lineEnd:g,polygonStart:function(){o=E,v=[],d=[],k=!0},polygonEnd:function(){o=N,v=oa.merge(v);var t=l([n,r]),e=k&&t,u=v.length;(e||u)&&(o.polygonStart(),e&&(o.lineStart(),c(null,null,1,o),o.lineEnd()),u&&Lt(v,i,t,c,o),o.polygonEnd()),v=d=m=null}};return C}}function Vt(n){var t=0,e=ja/3,r=oe(n),u=r(t,e);return u.parallels=function(n){return arguments.length?r(t=n[0]*ja/180,e=n[1]*ja/180):[t/ja*180,e/ja*180]},u}function Xt(n,t){function e(n,t){var e=Math.sqrt(i-2*u*Math.sin(t))/u;return[e*Math.sin(n*=u),a-e*Math.cos(n)]}var r=Math.sin(n),u=(r+Math.sin(t))/2,i=1+r*(2*u-r),a=Math.sqrt(i)/u;return e.invert=function(n,t){var e=a-t;return[Math.atan2(n,e)/u,tn((i-(n*n+e*e)*u*u)/(2*u))]},e}function $t(){function n(n,t){Oo+=u*n-r*t,r=n,u=t}var t,e,r,u;Xo.point=function(i,a){Xo.point=n,t=r=i,e=u=a},Xo.lineEnd=function(){n(t,e)}}function Bt(n,t){Io>n&&(Io=n),n>Zo&&(Zo=n),Yo>t&&(Yo=t),t>Vo&&(Vo=t)}function Wt(){function n(n,t){a.push("M",n,",",t,i)}function t(n,t){a.push("M",n,",",t),o.point=e}function e(n,t){a.push("L",n,",",t)}function r(){o.point=n}function u(){a.push("Z")}var i=Jt(4.5),a=[],o={point:n,lineStart:function(){o.point=t},lineEnd:r,polygonStart:function(){o.lineEnd=u},polygonEnd:function(){o.lineEnd=r,o.point=n},pointRadius:function(n){return i=Jt(n),o},result:function(){if(a.length){var n=a.join("");return a=[],n}}};return o}function Jt(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function Gt(n,t){Ao+=n,Co+=t,++zo}function Kt(){function n(n,r){var u=n-t,i=r-e,a=Math.sqrt(u*u+i*i);Lo+=a*(t+n)/2,qo+=a*(e+r)/2,To+=a,Gt(t=n,e=r)}var t,e;Bo.point=function(r,u){Bo.point=n,Gt(t=r,e=u)}}function Qt(){Bo.point=Gt}function ne(){function n(n,t){var e=n-r,i=t-u,a=Math.sqrt(e*e+i*i);Lo+=a*(r+n)/2,qo+=a*(u+t)/2,To+=a,a=u*n-r*t,Ro+=a*(r+n),Do+=a*(u+t),Po+=3*a,Gt(r=n,u=t)}var t,e,r,u;Bo.point=function(i,a){Bo.point=n,Gt(t=r=i,e=u=a)},Bo.lineEnd=function(){n(t,e)}}function te(n){function t(t,e){n.moveTo(t+a,e),n.arc(t,e,a,0,Ua)}function e(t,e){n.moveTo(t,e),o.point=r}function r(t,e){n.lineTo(t,e)}function u(){o.point=t}function i(){n.closePath()}var a=4.5,o={point:t,lineStart:function(){o.point=e},lineEnd:u,polygonStart:function(){o.lineEnd=i},polygonEnd:function(){o.lineEnd=u,o.point=t},pointRadius:function(n){return a=n,o},result:b};return o}function ee(n){function t(n){return(o?r:e)(n)}function e(t){return ie(t,function(e,r){e=n(e,r),t.point(e[0],e[1])})}function r(t){function e(e,r){e=n(e,r),t.point(e[0],e[1])}function r(){M=NaN,S.point=i,t.lineStart()}function i(e,r){var i=dt([e,r]),a=n(e,r);u(M,x,y,b,_,w,M=a[0],x=a[1],y=e,b=i[0],_=i[1],w=i[2],o,t),t.point(M,x)}function a(){S.point=e,t.lineEnd()}function l(){r(),S.point=c,S.lineEnd=s}function c(n,t){ -i(f=n,h=t),g=M,p=x,v=b,d=_,m=w,S.point=i}function s(){u(M,x,y,b,_,w,g,p,f,v,d,m,o,t),S.lineEnd=a,a()}var f,h,g,p,v,d,m,y,M,x,b,_,w,S={point:e,lineStart:r,lineEnd:a,polygonStart:function(){t.polygonStart(),S.lineStart=l},polygonEnd:function(){t.polygonEnd(),S.lineStart=r}};return S}function u(t,e,r,o,l,c,s,f,h,g,p,v,d,m){var y=s-t,M=f-e,x=y*y+M*M;if(x>4*i&&d--){var b=o+g,_=l+p,w=c+v,S=Math.sqrt(b*b+_*_+w*w),k=Math.asin(w/=S),N=Ma(Ma(w)-1)i||Ma((y*z+M*L)/x-.5)>.3||a>o*g+l*p+c*v)&&(u(t,e,r,o,l,c,A,C,N,b/=S,_/=S,w,d,m),m.point(A,C),u(A,C,N,b,_,w,s,f,h,g,p,v,d,m))}}var i=.5,a=Math.cos(30*Oa),o=16;return t.precision=function(n){return arguments.length?(o=(i=n*n)>0&&16,t):Math.sqrt(i)},t}function re(n){var t=ee(function(t,e){return n([t*Ia,e*Ia])});return function(n){return le(t(n))}}function ue(n){this.stream=n}function ie(n,t){return{point:t,sphere:function(){n.sphere()},lineStart:function(){n.lineStart()},lineEnd:function(){n.lineEnd()},polygonStart:function(){n.polygonStart()},polygonEnd:function(){n.polygonEnd()}}}function ae(n){return oe(function(){return n})()}function oe(n){function t(n){return n=o(n[0]*Oa,n[1]*Oa),[n[0]*h+l,c-n[1]*h]}function e(n){return n=o.invert((n[0]-l)/h,(c-n[1])/h),n&&[n[0]*Ia,n[1]*Ia]}function r(){o=Ct(a=fe(m,M,x),i);var n=i(v,d);return l=g-n[0]*h,c=p+n[1]*h,u()}function u(){return s&&(s.valid=!1,s=null),t}var i,a,o,l,c,s,f=ee(function(n,t){return n=i(n,t),[n[0]*h+l,c-n[1]*h]}),h=150,g=480,p=250,v=0,d=0,m=0,M=0,x=0,b=Uo,_=y,w=null,S=null;return t.stream=function(n){return s&&(s.valid=!1),s=le(b(a,f(_(n)))),s.valid=!0,s},t.clipAngle=function(n){return arguments.length?(b=null==n?(w=n,Uo):It((w=+n)*Oa),u()):w},t.clipExtent=function(n){return arguments.length?(S=n,_=n?Zt(n[0][0],n[0][1],n[1][0],n[1][1]):y,u()):S},t.scale=function(n){return arguments.length?(h=+n,r()):h},t.translate=function(n){return arguments.length?(g=+n[0],p=+n[1],r()):[g,p]},t.center=function(n){return arguments.length?(v=n[0]%360*Oa,d=n[1]%360*Oa,r()):[v*Ia,d*Ia]},t.rotate=function(n){return arguments.length?(m=n[0]%360*Oa,M=n[1]%360*Oa,x=n.length>2?n[2]%360*Oa:0,r()):[m*Ia,M*Ia,x*Ia]},oa.rebind(t,f,"precision"),function(){return i=n.apply(this,arguments),t.invert=i.invert&&e,r()}}function le(n){return ie(n,function(t,e){n.point(t*Oa,e*Oa)})}function ce(n,t){return[n,t]}function se(n,t){return[n>ja?n-Ua:-ja>n?n+Ua:n,t]}function fe(n,t,e){return n?t||e?Ct(ge(n),pe(t,e)):ge(n):t||e?pe(t,e):se}function he(n){return function(t,e){return t+=n,[t>ja?t-Ua:-ja>t?t+Ua:t,e]}}function ge(n){var t=he(n);return t.invert=he(-n),t}function pe(n,t){function e(n,t){var e=Math.cos(t),o=Math.cos(n)*e,l=Math.sin(n)*e,c=Math.sin(t),s=c*r+o*u;return[Math.atan2(l*i-s*a,o*r-c*u),tn(s*i+l*a)]}var r=Math.cos(n),u=Math.sin(n),i=Math.cos(t),a=Math.sin(t);return e.invert=function(n,t){var e=Math.cos(t),o=Math.cos(n)*e,l=Math.sin(n)*e,c=Math.sin(t),s=c*i-l*a;return[Math.atan2(l*i+c*a,o*r+s*u),tn(s*r-o*u)]},e}function ve(n,t){var e=Math.cos(n),r=Math.sin(n);return function(u,i,a,o){var l=a*t;null!=u?(u=de(e,u),i=de(e,i),(a>0?i>u:u>i)&&(u+=a*Ua)):(u=n+a*Ua,i=n-.5*l);for(var c,s=u;a>0?s>i:i>s;s-=l)o.point((c=_t([e,-r*Math.cos(s),-r*Math.sin(s)]))[0],c[1])}}function de(n,t){var e=dt(t);e[0]-=n,bt(e);var r=nn(-e[1]);return((-e[2]<0?-r:r)+2*Math.PI-Da)%(2*Math.PI)}function me(n,t,e){var r=oa.range(n,t-Da,e).concat(t);return function(n){return r.map(function(t){return[n,t]})}}function ye(n,t,e){var r=oa.range(n,t-Da,e).concat(t);return function(n){return r.map(function(t){return[t,n]})}}function Me(n){return n.source}function xe(n){return n.target}function be(n,t,e,r){var u=Math.cos(t),i=Math.sin(t),a=Math.cos(r),o=Math.sin(r),l=u*Math.cos(n),c=u*Math.sin(n),s=a*Math.cos(e),f=a*Math.sin(e),h=2*Math.asin(Math.sqrt(an(r-t)+u*a*an(e-n))),g=1/Math.sin(h),p=h?function(n){var t=Math.sin(n*=h)*g,e=Math.sin(h-n)*g,r=e*l+t*s,u=e*c+t*f,a=e*i+t*o;return[Math.atan2(u,r)*Ia,Math.atan2(a,Math.sqrt(r*r+u*u))*Ia]}:function(){return[n*Ia,t*Ia]};return p.distance=h,p}function _e(){function n(n,u){var i=Math.sin(u*=Oa),a=Math.cos(u),o=Ma((n*=Oa)-t),l=Math.cos(o);Wo+=Math.atan2(Math.sqrt((o=a*Math.sin(o))*o+(o=r*i-e*a*l)*o),e*i+r*a*l),t=n,e=i,r=a}var t,e,r;Jo.point=function(u,i){t=u*Oa,e=Math.sin(i*=Oa),r=Math.cos(i),Jo.point=n},Jo.lineEnd=function(){Jo.point=Jo.lineEnd=b}}function we(n,t){function e(t,e){var r=Math.cos(t),u=Math.cos(e),i=n(r*u);return[i*u*Math.sin(t),i*Math.sin(e)]}return e.invert=function(n,e){var r=Math.sqrt(n*n+e*e),u=t(r),i=Math.sin(u),a=Math.cos(u);return[Math.atan2(n*i,r*a),Math.asin(r&&e*i/r)]},e}function Se(n,t){function e(n,t){a>0?-Ha+Da>t&&(t=-Ha+Da):t>Ha-Da&&(t=Ha-Da);var e=a/Math.pow(u(t),i);return[e*Math.sin(i*n),a-e*Math.cos(i*n)]}var r=Math.cos(n),u=function(n){return Math.tan(ja/4+n/2)},i=n===t?Math.sin(n):Math.log(r/Math.cos(t))/Math.log(u(t)/u(n)),a=r*Math.pow(u(n),i)/i;return i?(e.invert=function(n,t){var e=a-t,r=K(i)*Math.sqrt(n*n+e*e);return[Math.atan2(n,e)/i,2*Math.atan(Math.pow(a/r,1/i))-Ha]},e):Ne}function ke(n,t){function e(n,t){var e=i-t;return[e*Math.sin(u*n),i-e*Math.cos(u*n)]}var r=Math.cos(n),u=n===t?Math.sin(n):(r-Math.cos(t))/(t-n),i=r/u+n;return Ma(u)u;u++){for(;r>1&&Q(n[e[r-2]],n[e[r-1]],n[u])<=0;)--r;e[r++]=u}return e.slice(0,r)}function qe(n,t){return n[0]-t[0]||n[1]-t[1]}function Te(n,t,e){return(e[0]-t[0])*(n[1]-t[1])<(e[1]-t[1])*(n[0]-t[0])}function Re(n,t,e,r){var u=n[0],i=e[0],a=t[0]-u,o=r[0]-i,l=n[1],c=e[1],s=t[1]-l,f=r[1]-c,h=(o*(l-c)-f*(u-i))/(f*a-o*s);return[u+h*a,l+h*s]}function De(n){var t=n[0],e=n[n.length-1];return!(t[0]-e[0]||t[1]-e[1])}function Pe(){rr(this),this.edge=this.site=this.circle=null}function je(n){var t=ll.pop()||new Pe;return t.site=n,t}function Ue(n){Be(n),il.remove(n),ll.push(n),rr(n)}function Fe(n){var t=n.circle,e=t.x,r=t.cy,u={x:e,y:r},i=n.P,a=n.N,o=[n];Ue(n);for(var l=i;l.circle&&Ma(e-l.circle.x)s;++s)c=o[s],l=o[s-1],nr(c.edge,l.site,c.site,u);l=o[0],c=o[f-1],c.edge=Ke(l.site,c.site,null,u),$e(l),$e(c)}function He(n){for(var t,e,r,u,i=n.x,a=n.y,o=il._;o;)if(r=Oe(o,a)-i,r>Da)o=o.L;else{if(u=i-Ie(o,a),!(u>Da)){r>-Da?(t=o.P,e=o):u>-Da?(t=o,e=o.N):t=e=o;break}if(!o.R){t=o;break}o=o.R}var l=je(n);if(il.insert(t,l),t||e){if(t===e)return Be(t),e=je(t.site),il.insert(l,e),l.edge=e.edge=Ke(t.site,l.site),$e(t),void $e(e);if(!e)return void(l.edge=Ke(t.site,l.site));Be(t),Be(e);var c=t.site,s=c.x,f=c.y,h=n.x-s,g=n.y-f,p=e.site,v=p.x-s,d=p.y-f,m=2*(h*d-g*v),y=h*h+g*g,M=v*v+d*d,x={x:(d*y-g*M)/m+s,y:(h*M-v*y)/m+f};nr(e.edge,c,p,x),l.edge=Ke(c,n,null,x),e.edge=Ke(n,p,null,x),$e(t),$e(e)}}function Oe(n,t){var e=n.site,r=e.x,u=e.y,i=u-t;if(!i)return r;var a=n.P;if(!a)return-(1/0);e=a.site;var o=e.x,l=e.y,c=l-t;if(!c)return o;var s=o-r,f=1/i-1/c,h=s/c;return f?(-h+Math.sqrt(h*h-2*f*(s*s/(-2*c)-l+c/2+u-i/2)))/f+r:(r+o)/2}function Ie(n,t){var e=n.N;if(e)return Oe(e,t);var r=n.site;return r.y===t?r.x:1/0}function Ye(n){this.site=n,this.edges=[]}function Ze(n){for(var t,e,r,u,i,a,o,l,c,s,f=n[0][0],h=n[1][0],g=n[0][1],p=n[1][1],v=ul,d=v.length;d--;)if(i=v[d],i&&i.prepare())for(o=i.edges,l=o.length,a=0;l>a;)s=o[a].end(),r=s.x,u=s.y,c=o[++a%l].start(),t=c.x,e=c.y,(Ma(r-t)>Da||Ma(u-e)>Da)&&(o.splice(a,0,new tr(Qe(i.site,s,Ma(r-f)Da?{x:f,y:Ma(t-f)Da?{x:Ma(e-p)Da?{x:h,y:Ma(t-h)Da?{x:Ma(e-g)=-Pa)){var g=l*l+c*c,p=s*s+f*f,v=(f*g-c*p)/h,d=(l*p-s*g)/h,f=d+o,m=cl.pop()||new Xe;m.arc=n,m.site=u,m.x=v+a,m.y=f+Math.sqrt(v*v+d*d),m.cy=f,n.circle=m;for(var y=null,M=ol._;M;)if(m.yd||d>=o)return;if(h>p){if(i){if(i.y>=c)return}else i={x:d,y:l};e={x:d,y:c}}else{if(i){if(i.yr||r>1)if(h>p){if(i){if(i.y>=c)return}else i={x:(l-u)/r,y:l};e={x:(c-u)/r,y:c}}else{if(i){if(i.yg){if(i){if(i.x>=o)return}else i={x:a,y:r*a+u};e={x:o,y:r*o+u}}else{if(i){if(i.xi||f>a||r>h||u>g)){if(p=n.point){var p,v=t-n.x,d=e-n.y,m=v*v+d*d;if(l>m){var y=Math.sqrt(l=m);r=t-y,u=e-y,i=t+y,a=e+y,o=p}}for(var M=n.nodes,x=.5*(s+h),b=.5*(f+g),_=t>=x,w=e>=b,S=w<<1|_,k=S+4;k>S;++S)if(n=M[3&S])switch(3&S){case 0:c(n,s,f,x,b);break;case 1:c(n,x,f,h,b);break;case 2:c(n,s,b,x,g);break;case 3:c(n,x,b,h,g)}}}(n,r,u,i,a),o}function vr(n,t){n=oa.rgb(n),t=oa.rgb(t);var e=n.r,r=n.g,u=n.b,i=t.r-e,a=t.g-r,o=t.b-u;return function(n){return"#"+bn(Math.round(e+i*n))+bn(Math.round(r+a*n))+bn(Math.round(u+o*n))}}function dr(n,t){var e,r={},u={};for(e in n)e in t?r[e]=Mr(n[e],t[e]):u[e]=n[e];for(e in t)e in n||(u[e]=t[e]);return function(n){for(e in r)u[e]=r[e](n);return u}}function mr(n,t){return n=+n,t=+t,function(e){return n*(1-e)+t*e}}function yr(n,t){var e,r,u,i=fl.lastIndex=hl.lastIndex=0,a=-1,o=[],l=[];for(n+="",t+="";(e=fl.exec(n))&&(r=hl.exec(t));)(u=r.index)>i&&(u=t.slice(i,u),o[a]?o[a]+=u:o[++a]=u),(e=e[0])===(r=r[0])?o[a]?o[a]+=r:o[++a]=r:(o[++a]=null,l.push({i:a,x:mr(e,r)})),i=hl.lastIndex;return ir;++r)o[(e=l[r]).i]=e.x(n);return o.join("")})}function Mr(n,t){for(var e,r=oa.interpolators.length;--r>=0&&!(e=oa.interpolators[r](n,t)););return e}function xr(n,t){var e,r=[],u=[],i=n.length,a=t.length,o=Math.min(n.length,t.length);for(e=0;o>e;++e)r.push(Mr(n[e],t[e]));for(;i>e;++e)u[e]=n[e];for(;a>e;++e)u[e]=t[e];return function(n){for(e=0;o>e;++e)u[e]=r[e](n);return u}}function br(n){return function(t){return 0>=t?0:t>=1?1:n(t)}}function _r(n){return function(t){return 1-n(1-t)}}function wr(n){return function(t){return.5*(.5>t?n(2*t):2-n(2-2*t))}}function Sr(n){return n*n}function kr(n){return n*n*n}function Nr(n){if(0>=n)return 0;if(n>=1)return 1;var t=n*n,e=t*n;return 4*(.5>n?e:3*(n-t)+e-.75)}function Er(n){return function(t){return Math.pow(t,n)}}function Ar(n){return 1-Math.cos(n*Ha)}function Cr(n){return Math.pow(2,10*(n-1))}function zr(n){return 1-Math.sqrt(1-n*n)}function Lr(n,t){var e;return arguments.length<2&&(t=.45),arguments.length?e=t/Ua*Math.asin(1/n):(n=1,e=t/4),function(r){return 1+n*Math.pow(2,-10*r)*Math.sin((r-e)*Ua/t)}}function qr(n){return n||(n=1.70158),function(t){return t*t*((n+1)*t-n)}}function Tr(n){return 1/2.75>n?7.5625*n*n:2/2.75>n?7.5625*(n-=1.5/2.75)*n+.75:2.5/2.75>n?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375}function Rr(n,t){n=oa.hcl(n),t=oa.hcl(t);var e=n.h,r=n.c,u=n.l,i=t.h-e,a=t.c-r,o=t.l-u;return isNaN(a)&&(a=0,r=isNaN(r)?t.c:r),isNaN(i)?(i=0,e=isNaN(e)?t.h:e):i>180?i-=360:-180>i&&(i+=360),function(n){return fn(e+i*n,r+a*n,u+o*n)+""}}function Dr(n,t){n=oa.hsl(n),t=oa.hsl(t);var e=n.h,r=n.s,u=n.l,i=t.h-e,a=t.s-r,o=t.l-u;return isNaN(a)&&(a=0,r=isNaN(r)?t.s:r),isNaN(i)?(i=0,e=isNaN(e)?t.h:e):i>180?i-=360:-180>i&&(i+=360),function(n){return cn(e+i*n,r+a*n,u+o*n)+""}}function Pr(n,t){n=oa.lab(n),t=oa.lab(t);var e=n.l,r=n.a,u=n.b,i=t.l-e,a=t.a-r,o=t.b-u;return function(n){return gn(e+i*n,r+a*n,u+o*n)+""}}function jr(n,t){return t-=n,function(e){return Math.round(n+t*e)}}function Ur(n){var t=[n.a,n.b],e=[n.c,n.d],r=Hr(t),u=Fr(t,e),i=Hr(Or(e,t,-u))||0;t[0]*e[1]180?t+=360:t-n>180&&(n+=360),r.push({i:e.push(Ir(e)+"rotate(",null,")")-2,x:mr(n,t)})):t&&e.push(Ir(e)+"rotate("+t+")")}function Vr(n,t,e,r){n!==t?r.push({i:e.push(Ir(e)+"skewX(",null,")")-2,x:mr(n,t)}):t&&e.push(Ir(e)+"skewX("+t+")")}function Xr(n,t,e,r){if(n[0]!==t[0]||n[1]!==t[1]){var u=e.push(Ir(e)+"scale(",null,",",null,")");r.push({i:u-4,x:mr(n[0],t[0])},{i:u-2,x:mr(n[1],t[1])})}else(1!==t[0]||1!==t[1])&&e.push(Ir(e)+"scale("+t+")")}function $r(n,t){var e=[],r=[];return n=oa.transform(n),t=oa.transform(t),Yr(n.translate,t.translate,e,r),Zr(n.rotate,t.rotate,e,r),Vr(n.skew,t.skew,e,r),Xr(n.scale,t.scale,e,r),n=t=null,function(n){for(var t,u=-1,i=r.length;++u=0;)e.push(u[r])}function au(n,t){for(var e=[n],r=[];null!=(n=e.pop());)if(r.push(n),(i=n.children)&&(u=i.length))for(var u,i,a=-1;++ae;++e)(t=n[e][1])>u&&(r=e,u=t);return r}function mu(n){return n.reduce(yu,0)}function yu(n,t){return n+t[1]}function Mu(n,t){return xu(n,Math.ceil(Math.log(t.length)/Math.LN2+1))}function xu(n,t){for(var e=-1,r=+n[0],u=(n[1]-r)/t,i=[];++e<=t;)i[e]=u*e+r;return i}function bu(n){return[oa.min(n),oa.max(n)]}function _u(n,t){return n.value-t.value}function wu(n,t){var e=n._pack_next;n._pack_next=t,t._pack_prev=n,t._pack_next=e,e._pack_prev=t}function Su(n,t){n._pack_next=t,t._pack_prev=n}function ku(n,t){var e=t.x-n.x,r=t.y-n.y,u=n.r+t.r;return.999*u*u>e*e+r*r}function Nu(n){function t(n){s=Math.min(n.x-n.r,s),f=Math.max(n.x+n.r,f),h=Math.min(n.y-n.r,h),g=Math.max(n.y+n.r,g)}if((e=n.children)&&(c=e.length)){var e,r,u,i,a,o,l,c,s=1/0,f=-(1/0),h=1/0,g=-(1/0);if(e.forEach(Eu),r=e[0],r.x=-r.r,r.y=0,t(r),c>1&&(u=e[1],u.x=u.r,u.y=0,t(u),c>2))for(i=e[2],zu(r,u,i),t(i),wu(r,i),r._pack_prev=i,wu(i,u),u=r._pack_next,a=3;c>a;a++){zu(r,u,i=e[a]);var p=0,v=1,d=1;for(o=u._pack_next;o!==u;o=o._pack_next,v++)if(ku(o,i)){p=1;break}if(1==p)for(l=r._pack_prev;l!==o._pack_prev&&!ku(l,i);l=l._pack_prev,d++);p?(d>v||v==d&&u.ra;a++)i=e[a],i.x-=m,i.y-=y,M=Math.max(M,i.r+Math.sqrt(i.x*i.x+i.y*i.y));n.r=M,e.forEach(Au)}}function Eu(n){n._pack_next=n._pack_prev=n}function Au(n){delete n._pack_next,delete n._pack_prev}function Cu(n,t,e,r){var u=n.children;if(n.x=t+=r*n.x,n.y=e+=r*n.y,n.r*=r,u)for(var i=-1,a=u.length;++i=0;)t=u[i],t.z+=e,t.m+=e,e+=t.s+(r+=t.c)}function Pu(n,t,e){return n.a.parent===t.parent?n.a:e}function ju(n){return 1+oa.max(n,function(n){return n.y})}function Uu(n){return n.reduce(function(n,t){return n+t.x},0)/n.length}function Fu(n){var t=n.children;return t&&t.length?Fu(t[0]):n}function Hu(n){var t,e=n.children;return e&&(t=e.length)?Hu(e[t-1]):n}function Ou(n){return{x:n.x,y:n.y,dx:n.dx,dy:n.dy}}function Iu(n,t){var e=n.x+t[3],r=n.y+t[0],u=n.dx-t[1]-t[3],i=n.dy-t[0]-t[2];return 0>u&&(e+=u/2,u=0),0>i&&(r+=i/2,i=0),{x:e,y:r,dx:u,dy:i}}function Yu(n){var t=n[0],e=n[n.length-1];return e>t?[t,e]:[e,t]}function Zu(n){return n.rangeExtent?n.rangeExtent():Yu(n.range())}function Vu(n,t,e,r){var u=e(n[0],n[1]),i=r(t[0],t[1]);return function(n){return i(u(n))}}function Xu(n,t){var e,r=0,u=n.length-1,i=n[r],a=n[u];return i>a&&(e=r,r=u,u=e,e=i,i=a,a=e),n[r]=t.floor(i),n[u]=t.ceil(a),n}function $u(n){return n?{floor:function(t){return Math.floor(t/n)*n},ceil:function(t){return Math.ceil(t/n)*n}}:wl}function Bu(n,t,e,r){var u=[],i=[],a=0,o=Math.min(n.length,t.length)-1;for(n[o]2?Bu:Vu,l=r?Wr:Br;return a=u(n,t,l,e),o=u(t,n,l,Mr),i}function i(n){return a(n)}var a,o;return i.invert=function(n){return o(n)},i.domain=function(t){return arguments.length?(n=t.map(Number),u()):n},i.range=function(n){return arguments.length?(t=n,u()):t},i.rangeRound=function(n){return i.range(n).interpolate(jr)},i.clamp=function(n){return arguments.length?(r=n,u()):r},i.interpolate=function(n){return arguments.length?(e=n,u()):e},i.ticks=function(t){return Qu(n,t)},i.tickFormat=function(t,e){return ni(n,t,e)},i.nice=function(t){return Gu(n,t),u()},i.copy=function(){return Wu(n,t,e,r)},u()}function Ju(n,t){return oa.rebind(n,t,"range","rangeRound","interpolate","clamp")}function Gu(n,t){return Xu(n,$u(Ku(n,t)[2])),Xu(n,$u(Ku(n,t)[2])),n}function Ku(n,t){null==t&&(t=10);var e=Yu(n),r=e[1]-e[0],u=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),i=t/r*u;return.15>=i?u*=10:.35>=i?u*=5:.75>=i&&(u*=2),e[0]=Math.ceil(e[0]/u)*u,e[1]=Math.floor(e[1]/u)*u+.5*u,e[2]=u,e}function Qu(n,t){return oa.range.apply(oa,Ku(n,t))}function ni(n,t,e){var r=Ku(n,t);if(e){var u=so.exec(e);if(u.shift(),"s"===u[8]){var i=oa.formatPrefix(Math.max(Ma(r[0]),Ma(r[1])));return u[7]||(u[7]="."+ti(i.scale(r[2]))),u[8]="f",e=oa.format(u.join("")),function(n){return e(i.scale(n))+i.symbol}}u[7]||(u[7]="."+ei(u[8],r)),e=u.join("")}else e=",."+ti(r[2])+"f";return oa.format(e)}function ti(n){return-Math.floor(Math.log(n)/Math.LN10+.01)}function ei(n,t){var e=ti(t[2]);return n in Sl?Math.abs(e-ti(Math.max(Ma(t[0]),Ma(t[1]))))+ +("e"!==n):e-2*("%"===n)}function ri(n,t,e,r){function u(n){return(e?Math.log(0>n?0:n):-Math.log(n>0?0:-n))/Math.log(t)}function i(n){return e?Math.pow(t,n):-Math.pow(t,-n)}function a(t){return n(u(t))}return a.invert=function(t){return i(n.invert(t))},a.domain=function(t){return arguments.length?(e=t[0]>=0,n.domain((r=t.map(Number)).map(u)),a):r},a.base=function(e){return arguments.length?(t=+e,n.domain(r.map(u)),a):t},a.nice=function(){var t=Xu(r.map(u),e?Math:Nl);return n.domain(t),r=t.map(i),a},a.ticks=function(){var n=Yu(r),a=[],o=n[0],l=n[1],c=Math.floor(u(o)),s=Math.ceil(u(l)),f=t%1?2:t;if(isFinite(s-c)){if(e){for(;s>c;c++)for(var h=1;f>h;h++)a.push(i(c)*h);a.push(i(c))}else for(a.push(i(c));c++0;h--)a.push(i(c)*h);for(c=0;a[c]l;s--);a=a.slice(c,s)}return a},a.tickFormat=function(n,e){if(!arguments.length)return kl;arguments.length<2?e=kl:"function"!=typeof e&&(e=oa.format(e));var r=Math.max(1,t*n/a.ticks().length);return function(n){var a=n/i(Math.round(u(n)));return t-.5>a*t&&(a*=t),r>=a?e(n):""}},a.copy=function(){return ri(n.copy(),t,e,r)},Ju(a,n)}function ui(n,t,e){function r(t){return n(u(t))}var u=ii(t),i=ii(1/t);return r.invert=function(t){return i(n.invert(t))},r.domain=function(t){return arguments.length?(n.domain((e=t.map(Number)).map(u)),r):e},r.ticks=function(n){return Qu(e,n)},r.tickFormat=function(n,t){return ni(e,n,t)},r.nice=function(n){return r.domain(Gu(e,n))},r.exponent=function(a){return arguments.length?(u=ii(t=a),i=ii(1/t),n.domain(e.map(u)),r):t},r.copy=function(){return ui(n.copy(),t,e)},Ju(r,n)}function ii(n){return function(t){return 0>t?-Math.pow(-t,n):Math.pow(t,n)}}function ai(n,t){function e(e){return i[((u.get(e)||("range"===t.t?u.set(e,n.push(e)):NaN))-1)%i.length]}function r(t,e){return oa.range(n.length).map(function(n){return t+e*n})}var u,i,a;return e.domain=function(r){if(!arguments.length)return n;n=[],u=new c;for(var i,a=-1,o=r.length;++ae?[NaN,NaN]:[e>0?o[e-1]:n[0],et?NaN:t/i+n,[t,t+1/i]},r.copy=function(){return li(n,t,e)},u()}function ci(n,t){function e(e){return e>=e?t[oa.bisect(n,e)]:void 0}return e.domain=function(t){return arguments.length?(n=t,e):n},e.range=function(n){return arguments.length?(t=n,e):t},e.invertExtent=function(e){return e=t.indexOf(e),[n[e-1],n[e]]},e.copy=function(){return ci(n,t)},e}function si(n){function t(n){return+n}return t.invert=t,t.domain=t.range=function(e){return arguments.length?(n=e.map(t),t):n},t.ticks=function(t){return Qu(n,t)},t.tickFormat=function(t,e){return ni(n,t,e)},t.copy=function(){return si(n)},t}function fi(){return 0}function hi(n){return n.innerRadius}function gi(n){return n.outerRadius}function pi(n){return n.startAngle}function vi(n){return n.endAngle}function di(n){return n&&n.padAngle}function mi(n,t,e,r){return(n-e)*t-(t-r)*n>0?0:1}function yi(n,t,e,r,u){var i=n[0]-t[0],a=n[1]-t[1],o=(u?r:-r)/Math.sqrt(i*i+a*a),l=o*a,c=-o*i,s=n[0]+l,f=n[1]+c,h=t[0]+l,g=t[1]+c,p=(s+h)/2,v=(f+g)/2,d=h-s,m=g-f,y=d*d+m*m,M=e-r,x=s*g-h*f,b=(0>m?-1:1)*Math.sqrt(Math.max(0,M*M*y-x*x)),_=(x*m-d*b)/y,w=(-x*d-m*b)/y,S=(x*m+d*b)/y,k=(-x*d+m*b)/y,N=_-p,E=w-v,A=S-p,C=k-v;return N*N+E*E>A*A+C*C&&(_=S,w=k),[[_-l,w-c],[_*e/M,w*e/M]]}function Mi(n){function t(t){function a(){c.push("M",i(n(s),o))}for(var l,c=[],s=[],f=-1,h=t.length,g=En(e),p=En(r);++f1?n.join("L"):n+"Z"}function bi(n){return n.join("L")+"Z"}function _i(n){for(var t=0,e=n.length,r=n[0],u=[r[0],",",r[1]];++t1&&u.push("H",r[0]),u.join("")}function wi(n){for(var t=0,e=n.length,r=n[0],u=[r[0],",",r[1]];++t1){o=t[1],i=n[l],l++,r+="C"+(u[0]+a[0])+","+(u[1]+a[1])+","+(i[0]-o[0])+","+(i[1]-o[1])+","+i[0]+","+i[1];for(var c=2;c9&&(u=3*t/Math.sqrt(u),a[o]=u*e,a[o+1]=u*r));for(o=-1;++o<=l;)u=(n[Math.min(l,o+1)][0]-n[Math.max(0,o-1)][0])/(6*(1+a[o]*a[o])),i.push([u||0,a[o]*u||0]);return i}function Fi(n){return n.length<3?xi(n):n[0]+Ai(n,Ui(n))}function Hi(n){for(var t,e,r,u=-1,i=n.length;++u=t?a(n-t):void(s.c=a)}function a(e){var u=p.active,i=p[u];i&&(i.timer.c=null,i.timer.t=NaN,--p.count,delete p[u],i.event&&i.event.interrupt.call(n,n.__data__,i.index));for(var a in p)if(r>+a){var c=p[a];c.timer.c=null,c.timer.t=NaN,--p.count,delete p[a]}s.c=o,qn(function(){return s.c&&o(e||1)&&(s.c=null,s.t=NaN),1},0,l),p.active=r,v.event&&v.event.start.call(n,n.__data__,t),g=[],v.tween.forEach(function(e,r){(r=r.call(n,n.__data__,t))&&g.push(r)}),h=v.ease,f=v.duration}function o(u){for(var i=u/f,a=h(i),o=g.length;o>0;)g[--o].call(n,a);return i>=1?(v.event&&v.event.end.call(n,n.__data__,t),--p.count?delete p[r]:delete n[e],1):void 0}var l,s,f,h,g,p=n[e]||(n[e]={active:0,count:0}),v=p[r];v||(l=u.time,s=qn(i,0,l),v=p[r]={tween:new c,time:l,timer:s,delay:u.delay,duration:u.duration,ease:u.ease,index:t},u=null,++p.count)}function na(n,t,e){n.attr("transform",function(n){var r=t(n);return"translate("+(isFinite(r)?r:e(n))+",0)"})}function ta(n,t,e){n.attr("transform",function(n){var r=t(n);return"translate(0,"+(isFinite(r)?r:e(n))+")"})}function ea(n){return n.toISOString()}function ra(n,t,e){function r(t){return n(t)}function u(n,e){var r=n[1]-n[0],u=r/e,i=oa.bisect(Gl,u);return i==Gl.length?[t.year,Ku(n.map(function(n){return n/31536e6}),e)[2]]:i?t[u/Gl[i-1]1?{floor:function(t){for(;e(t=n.floor(t));)t=ua(t-1);return t},ceil:function(t){for(;e(t=n.ceil(t));)t=ua(+t+1);return t}}:n))},r.ticks=function(n,t){var e=Yu(r.domain()),i=null==n?u(e,10):"number"==typeof n?u(e,n):!n.range&&[{range:n},t];return i&&(n=i[0],t=i[1]),n.range(e[0],ua(+e[1]+1),1>t?1:t)},r.tickFormat=function(){return e},r.copy=function(){return ra(n.copy(),t,e)},Ju(r,n)}function ua(n){return new Date(n)}function ia(n){return JSON.parse(n.responseText)}function aa(n){var t=sa.createRange();return t.selectNode(sa.body),t.createContextualFragment(n.responseText)}var oa={version:"3.5.12"},la=[].slice,ca=function(n){return la.call(n)},sa=this.document;if(sa)try{ca(sa.documentElement.childNodes)[0].nodeType}catch(fa){ca=function(n){for(var t=n.length,e=new Array(t);t--;)e[t]=n[t];return e}}if(Date.now||(Date.now=function(){return+new Date}),sa)try{sa.createElement("DIV").style.setProperty("opacity",0,"")}catch(ha){var ga=this.Element.prototype,pa=ga.setAttribute,va=ga.setAttributeNS,da=this.CSSStyleDeclaration.prototype,ma=da.setProperty;ga.setAttribute=function(n,t){pa.call(this,n,t+"")},ga.setAttributeNS=function(n,t,e){va.call(this,n,t,e+"")},da.setProperty=function(n,t,e){ma.call(this,n,t+"",e)}}oa.ascending=e,oa.descending=function(n,t){return n>t?-1:t>n?1:t>=n?0:NaN},oa.min=function(n,t){var e,r,u=-1,i=n.length;if(1===arguments.length){for(;++u=r){e=r;break}for(;++ur&&(e=r)}else{for(;++u=r){e=r;break}for(;++ur&&(e=r)}return e},oa.max=function(n,t){var e,r,u=-1,i=n.length;if(1===arguments.length){for(;++u=r){e=r;break}for(;++ue&&(e=r)}else{for(;++u=r){e=r;break}for(;++ue&&(e=r)}return e},oa.extent=function(n,t){var e,r,u,i=-1,a=n.length;if(1===arguments.length){for(;++i=r){e=u=r;break}for(;++ir&&(e=r),r>u&&(u=r))}else{for(;++i=r){e=u=r;break}for(;++ir&&(e=r),r>u&&(u=r))}return[e,u]},oa.sum=function(n,t){var e,r=0,i=n.length,a=-1;if(1===arguments.length)for(;++a1?l/(s-1):void 0},oa.deviation=function(){var n=oa.variance.apply(this,arguments);return n?Math.sqrt(n):n};var ya=i(e);oa.bisectLeft=ya.left,oa.bisect=oa.bisectRight=ya.right,oa.bisector=function(n){return i(1===n.length?function(t,r){return e(n(t),r)}:n)},oa.shuffle=function(n,t,e){(i=arguments.length)<3&&(e=n.length,2>i&&(t=0));for(var r,u,i=e-t;i;)u=Math.random()*i--|0,r=n[i+t],n[i+t]=n[u+t],n[u+t]=r;return n},oa.permute=function(n,t){for(var e=t.length,r=new Array(e);e--;)r[e]=n[t[e]];return r},oa.pairs=function(n){for(var t,e=0,r=n.length-1,u=n[0],i=new Array(0>r?0:r);r>e;)i[e]=[t=u,u=n[++e]];return i},oa.zip=function(){if(!(r=arguments.length))return[];for(var n=-1,t=oa.min(arguments,a),e=new Array(t);++n=0;)for(r=n[u],t=r.length;--t>=0;)e[--a]=r[t];return e};var Ma=Math.abs;oa.range=function(n,t,e){if(arguments.length<3&&(e=1,arguments.length<2&&(t=n,n=0)),(t-n)/e===1/0)throw new Error("infinite range");var r,u=[],i=o(Ma(e)),a=-1;if(n*=i,t*=i,e*=i,0>e)for(;(r=n+e*++a)>t;)u.push(r/i);else for(;(r=n+e*++a)=i.length)return r?r.call(u,a):e?a.sort(e):a;for(var l,s,f,h,g=-1,p=a.length,v=i[o++],d=new c;++g=i.length)return n;var r=[],u=a[e++];return n.forEach(function(n,u){r.push({key:n,values:t(u,e)})}),u?r.sort(function(n,t){return u(n.key,t.key)}):r}var e,r,u={},i=[],a=[];return u.map=function(t,e){return n(e,t,0)},u.entries=function(e){return t(n(oa.map,e,0),0)},u.key=function(n){return i.push(n),u},u.sortKeys=function(n){return a[i.length-1]=n,u},u.sortValues=function(n){return e=n,u},u.rollup=function(n){return r=n,u},u},oa.set=function(n){var t=new m;if(n)for(var e=0,r=n.length;r>e;++e)t.add(n[e]);return t},l(m,{has:h,add:function(n){return this._[s(n+="")]=!0,n},remove:g,values:p,size:v,empty:d,forEach:function(n){for(var t in this._)n.call(this,f(t))}}),oa.behavior={},oa.rebind=function(n,t){for(var e,r=1,u=arguments.length;++r=0&&(r=n.slice(e+1),n=n.slice(0,e)),n)return arguments.length<2?this[n].on(r):this[n].on(r,t);if(2===arguments.length){if(null==t)for(n in this)this.hasOwnProperty(n)&&this[n].on(r,null);return this}},oa.event=null,oa.requote=function(n){return n.replace(wa,"\\$&")};var wa=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Sa={}.__proto__?function(n,t){n.__proto__=t}:function(n,t){for(var e in t)n[e]=t[e]},ka=function(n,t){return t.querySelector(n)},Na=function(n,t){return t.querySelectorAll(n)},Ea=function(n,t){var e=n.matches||n[x(n,"matchesSelector")];return(Ea=function(n,t){return e.call(n,t)})(n,t)};"function"==typeof Sizzle&&(ka=function(n,t){return Sizzle(n,t)[0]||null},Na=Sizzle,Ea=Sizzle.matchesSelector),oa.selection=function(){return oa.select(sa.documentElement)};var Aa=oa.selection.prototype=[];Aa.select=function(n){var t,e,r,u,i=[];n=A(n);for(var a=-1,o=this.length;++a=0&&"xmlns"!==(e=n.slice(0,t))&&(n=n.slice(t+1)),Ca.hasOwnProperty(e)?{space:Ca[e],local:n}:n}},Aa.attr=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node();return n=oa.ns.qualify(n),n.local?e.getAttributeNS(n.space,n.local):e.getAttribute(n)}for(t in n)this.each(z(t,n[t]));return this}return this.each(z(n,t))},Aa.classed=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node(),r=(n=T(n)).length,u=-1;if(t=e.classList){for(;++uu){if("string"!=typeof n){2>u&&(e="");for(r in n)this.each(P(r,n[r],e));return this}if(2>u){var i=this.node();return t(i).getComputedStyle(i,null).getPropertyValue(n)}r=""}return this.each(P(n,e,r))},Aa.property=function(n,t){if(arguments.length<2){if("string"==typeof n)return this.node()[n];for(t in n)this.each(j(t,n[t]));return this}return this.each(j(n,t))},Aa.text=function(n){return arguments.length?this.each("function"==typeof n?function(){var t=n.apply(this,arguments);this.textContent=null==t?"":t}:null==n?function(){this.textContent=""}:function(){this.textContent=n}):this.node().textContent},Aa.html=function(n){return arguments.length?this.each("function"==typeof n?function(){var t=n.apply(this,arguments);this.innerHTML=null==t?"":t}:null==n?function(){this.innerHTML=""}:function(){this.innerHTML=n}):this.node().innerHTML},Aa.append=function(n){return n=U(n),this.select(function(){return this.appendChild(n.apply(this,arguments))})},Aa.insert=function(n,t){return n=U(n),t=A(t),this.select(function(){return this.insertBefore(n.apply(this,arguments),t.apply(this,arguments)||null)})},Aa.remove=function(){return this.each(F)},Aa.data=function(n,t){function e(n,e){var r,u,i,a=n.length,f=e.length,h=Math.min(a,f),g=new Array(f),p=new Array(f),v=new Array(a);if(t){var d,m=new c,y=new Array(a);for(r=-1;++rr;++r)p[r]=H(e[r]);for(;a>r;++r)v[r]=n[r]}p.update=g,p.parentNode=g.parentNode=v.parentNode=n.parentNode,o.push(p),l.push(g),s.push(v)}var r,u,i=-1,a=this.length;if(!arguments.length){for(n=new Array(a=(r=this[0]).length);++ii;i++){u.push(t=[]),t.parentNode=(e=this[i]).parentNode;for(var o=0,l=e.length;l>o;o++)(r=e[o])&&n.call(r,r.__data__,o,i)&&t.push(r)}return E(u)},Aa.order=function(){for(var n=-1,t=this.length;++n=0;)(e=r[u])&&(i&&i!==e.nextSibling&&i.parentNode.insertBefore(e,i),i=e);return this},Aa.sort=function(n){n=I.apply(this,arguments);for(var t=-1,e=this.length;++tn;n++)for(var e=this[n],r=0,u=e.length;u>r;r++){var i=e[r];if(i)return i}return null},Aa.size=function(){var n=0;return Y(this,function(){++n}),n};var za=[];oa.selection.enter=Z,oa.selection.enter.prototype=za,za.append=Aa.append,za.empty=Aa.empty,za.node=Aa.node,za.call=Aa.call,za.size=Aa.size,za.select=function(n){for(var t,e,r,u,i,a=[],o=-1,l=this.length;++or){if("string"!=typeof n){2>r&&(t=!1);for(e in n)this.each(X(e,n[e],t));return this}if(2>r)return(r=this.node()["__on"+n])&&r._;e=!1}return this.each(X(n,t,e))};var La=oa.map({mouseenter:"mouseover",mouseleave:"mouseout"});sa&&La.forEach(function(n){"on"+n in sa&&La.remove(n)});var qa,Ta=0;oa.mouse=function(n){return J(n,k())};var Ra=this.navigator&&/WebKit/.test(this.navigator.userAgent)?-1:0;oa.touch=function(n,t,e){if(arguments.length<3&&(e=t,t=k().changedTouches),t)for(var r,u=0,i=t.length;i>u;++u)if((r=t[u]).identifier===e)return J(n,r)},oa.behavior.drag=function(){function n(){this.on("mousedown.drag",i).on("touchstart.drag",a)}function e(n,t,e,i,a){return function(){function o(){var n,e,r=t(h,v);r&&(n=r[0]-M[0],e=r[1]-M[1],p|=n|e,M=r,g({type:"drag",x:r[0]+c[0],y:r[1]+c[1],dx:n,dy:e}))}function l(){t(h,v)&&(m.on(i+d,null).on(a+d,null),y(p),g({type:"dragend"}))}var c,s=this,f=oa.event.target,h=s.parentNode,g=r.of(s,arguments),p=0,v=n(),d=".drag"+(null==v?"":"-"+v),m=oa.select(e(f)).on(i+d,o).on(a+d,l),y=W(f),M=t(h,v);u?(c=u.apply(s,arguments),c=[c.x-M[0],c.y-M[1]]):c=[0,0],g({type:"dragstart"})}}var r=N(n,"drag","dragstart","dragend"),u=null,i=e(b,oa.mouse,t,"mousemove","mouseup"),a=e(G,oa.touch,y,"touchmove","touchend");return n.origin=function(t){return arguments.length?(u=t,n):u},oa.rebind(n,r,"on")},oa.touches=function(n,t){return arguments.length<2&&(t=k().touches),t?ca(t).map(function(t){var e=J(n,t);return e.identifier=t.identifier,e}):[]};var Da=1e-6,Pa=Da*Da,ja=Math.PI,Ua=2*ja,Fa=Ua-Da,Ha=ja/2,Oa=ja/180,Ia=180/ja,Ya=Math.SQRT2,Za=2,Va=4;oa.interpolateZoom=function(n,t){var e,r,u=n[0],i=n[1],a=n[2],o=t[0],l=t[1],c=t[2],s=o-u,f=l-i,h=s*s+f*f;if(Pa>h)r=Math.log(c/a)/Ya,e=function(n){return[u+n*s,i+n*f,a*Math.exp(Ya*n*r)]};else{var g=Math.sqrt(h),p=(c*c-a*a+Va*h)/(2*a*Za*g),v=(c*c-a*a-Va*h)/(2*c*Za*g),d=Math.log(Math.sqrt(p*p+1)-p),m=Math.log(Math.sqrt(v*v+1)-v);r=(m-d)/Ya,e=function(n){var t=n*r,e=rn(d),o=a/(Za*g)*(e*un(Ya*t+d)-en(d));return[u+o*s,i+o*f,a*e/rn(Ya*t+d)]}}return e.duration=1e3*r,e},oa.behavior.zoom=function(){function n(n){n.on(L,f).on($a+".zoom",g).on("dblclick.zoom",p).on(R,h)}function e(n){return[(n[0]-k.x)/k.k,(n[1]-k.y)/k.k]}function r(n){return[n[0]*k.k+k.x,n[1]*k.k+k.y]}function u(n){k.k=Math.max(A[0],Math.min(A[1],n))}function i(n,t){t=r(t),k.x+=n[0]-t[0],k.y+=n[1]-t[1]}function a(t,e,r,a){t.__chart__={x:k.x,y:k.y,k:k.k},u(Math.pow(2,a)),i(d=e,r),t=oa.select(t),C>0&&(t=t.transition().duration(C)),t.call(n.event)}function o(){b&&b.domain(x.range().map(function(n){return(n-k.x)/k.k}).map(x.invert)),w&&w.domain(_.range().map(function(n){return(n-k.y)/k.k}).map(_.invert))}function l(n){z++||n({type:"zoomstart"})}function c(n){o(),n({type:"zoom",scale:k.k,translate:[k.x,k.y]})}function s(n){--z||(n({type:"zoomend"}),d=null)}function f(){function n(){o=1,i(oa.mouse(u),h),c(a)}function r(){f.on(q,null).on(T,null),g(o),s(a)}var u=this,a=D.of(u,arguments),o=0,f=oa.select(t(u)).on(q,n).on(T,r),h=e(oa.mouse(u)),g=W(u);Ol.call(u),l(a)}function h(){function n(){var n=oa.touches(p);return g=k.k,n.forEach(function(n){n.identifier in d&&(d[n.identifier]=e(n))}),n}function t(){var t=oa.event.target;oa.select(t).on(x,r).on(b,o),_.push(t);for(var e=oa.event.changedTouches,u=0,i=e.length;i>u;++u)d[e[u].identifier]=null;var l=n(),c=Date.now();if(1===l.length){if(500>c-M){var s=l[0];a(p,s,d[s.identifier],Math.floor(Math.log(k.k)/Math.LN2)+1),S()}M=c}else if(l.length>1){var s=l[0],f=l[1],h=s[0]-f[0],g=s[1]-f[1];m=h*h+g*g}}function r(){var n,t,e,r,a=oa.touches(p);Ol.call(p);for(var o=0,l=a.length;l>o;++o,r=null)if(e=a[o],r=d[e.identifier]){if(t)break;n=e,t=r}if(r){var s=(s=e[0]-n[0])*s+(s=e[1]-n[1])*s,f=m&&Math.sqrt(s/m);n=[(n[0]+e[0])/2,(n[1]+e[1])/2],t=[(t[0]+r[0])/2,(t[1]+r[1])/2],u(f*g)}M=null,i(n,t),c(v)}function o(){if(oa.event.touches.length){for(var t=oa.event.changedTouches,e=0,r=t.length;r>e;++e)delete d[t[e].identifier];for(var u in d)return void n()}oa.selectAll(_).on(y,null),w.on(L,f).on(R,h),N(),s(v)}var g,p=this,v=D.of(p,arguments),d={},m=0,y=".zoom-"+oa.event.changedTouches[0].identifier,x="touchmove"+y,b="touchend"+y,_=[],w=oa.select(p),N=W(p);t(),l(v),w.on(L,null).on(R,t)}function g(){var n=D.of(this,arguments);y?clearTimeout(y):(Ol.call(this),v=e(d=m||oa.mouse(this)),l(n)),y=setTimeout(function(){y=null,s(n)},50),S(),u(Math.pow(2,.002*Xa())*k.k),i(d,v),c(n)}function p(){var n=oa.mouse(this),t=Math.log(k.k)/Math.LN2;a(this,n,e(n),oa.event.shiftKey?Math.ceil(t)-1:Math.floor(t)+1)}var v,d,m,y,M,x,b,_,w,k={x:0,y:0,k:1},E=[960,500],A=Ba,C=250,z=0,L="mousedown.zoom",q="mousemove.zoom",T="mouseup.zoom",R="touchstart.zoom",D=N(n,"zoomstart","zoom","zoomend");return $a||($a="onwheel"in sa?(Xa=function(){return-oa.event.deltaY*(oa.event.deltaMode?120:1)},"wheel"):"onmousewheel"in sa?(Xa=function(){return oa.event.wheelDelta},"mousewheel"):(Xa=function(){return-oa.event.detail},"MozMousePixelScroll")),n.event=function(n){n.each(function(){var n=D.of(this,arguments),t=k;Fl?oa.select(this).transition().each("start.zoom",function(){k=this.__chart__||{x:0,y:0,k:1},l(n)}).tween("zoom:zoom",function(){var e=E[0],r=E[1],u=d?d[0]:e/2,i=d?d[1]:r/2,a=oa.interpolateZoom([(u-k.x)/k.k,(i-k.y)/k.k,e/k.k],[(u-t.x)/t.k,(i-t.y)/t.k,e/t.k]);return function(t){var r=a(t),o=e/r[2];this.__chart__=k={x:u-r[0]*o,y:i-r[1]*o,k:o},c(n)}}).each("interrupt.zoom",function(){s(n)}).each("end.zoom",function(){s(n)}):(this.__chart__=k,l(n),c(n),s(n))})},n.translate=function(t){return arguments.length?(k={x:+t[0],y:+t[1],k:k.k},o(),n):[k.x,k.y]},n.scale=function(t){return arguments.length?(k={x:k.x,y:k.y,k:null},u(+t),o(),n):k.k},n.scaleExtent=function(t){return arguments.length?(A=null==t?Ba:[+t[0],+t[1]],n):A},n.center=function(t){return arguments.length?(m=t&&[+t[0],+t[1]],n):m},n.size=function(t){return arguments.length?(E=t&&[+t[0],+t[1]],n):E},n.duration=function(t){return arguments.length?(C=+t,n):C},n.x=function(t){return arguments.length?(b=t,x=t.copy(),k={x:0,y:0,k:1},n):b},n.y=function(t){return arguments.length?(w=t,_=t.copy(),k={x:0,y:0,k:1},n):w},oa.rebind(n,D,"on")};var Xa,$a,Ba=[0,1/0];oa.color=on,on.prototype.toString=function(){return this.rgb()+""},oa.hsl=ln;var Wa=ln.prototype=new on;Wa.brighter=function(n){return n=Math.pow(.7,arguments.length?n:1),new ln(this.h,this.s,this.l/n)},Wa.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),new ln(this.h,this.s,n*this.l)},Wa.rgb=function(){return cn(this.h,this.s,this.l)},oa.hcl=sn;var Ja=sn.prototype=new on;Ja.brighter=function(n){return new sn(this.h,this.c,Math.min(100,this.l+Ga*(arguments.length?n:1)))},Ja.darker=function(n){return new sn(this.h,this.c,Math.max(0,this.l-Ga*(arguments.length?n:1)))},Ja.rgb=function(){return fn(this.h,this.c,this.l).rgb()},oa.lab=hn;var Ga=18,Ka=.95047,Qa=1,no=1.08883,to=hn.prototype=new on;to.brighter=function(n){return new hn(Math.min(100,this.l+Ga*(arguments.length?n:1)),this.a,this.b)},to.darker=function(n){return new hn(Math.max(0,this.l-Ga*(arguments.length?n:1)),this.a,this.b)},to.rgb=function(){return gn(this.l,this.a,this.b)},oa.rgb=yn;var eo=yn.prototype=new on;eo.brighter=function(n){n=Math.pow(.7,arguments.length?n:1);var t=this.r,e=this.g,r=this.b,u=30;return t||e||r?(t&&u>t&&(t=u),e&&u>e&&(e=u),r&&u>r&&(r=u),new yn(Math.min(255,t/n),Math.min(255,e/n),Math.min(255,r/n))):new yn(u,u,u)},eo.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),new yn(n*this.r,n*this.g,n*this.b)},eo.hsl=function(){return wn(this.r,this.g,this.b)},eo.toString=function(){return"#"+bn(this.r)+bn(this.g)+bn(this.b)};var ro=oa.map({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});ro.forEach(function(n,t){ro.set(n,Mn(t))}),oa.functor=En,oa.xhr=An(y),oa.dsv=function(n,t){function e(n,e,i){arguments.length<3&&(i=e,e=null);var a=Cn(n,t,null==e?r:u(e),i);return a.row=function(n){return arguments.length?a.response(null==(e=n)?r:u(n)):e},a}function r(n){return e.parse(n.responseText)}function u(n){return function(t){return e.parse(t.responseText,n)}}function i(t){return t.map(a).join(n)}function a(n){return o.test(n)?'"'+n.replace(/\"/g,'""')+'"':n}var o=new RegExp('["'+n+"\n]"),l=n.charCodeAt(0);return e.parse=function(n,t){var r;return e.parseRows(n,function(n,e){if(r)return r(n,e-1);var u=new Function("d","return {"+n.map(function(n,t){return JSON.stringify(n)+": d["+t+"]"}).join(",")+"}");r=t?function(n,e){return t(u(n),e)}:u})},e.parseRows=function(n,t){function e(){if(s>=c)return a;if(u)return u=!1,i;var t=s;if(34===n.charCodeAt(t)){for(var e=t;e++s;){var r=n.charCodeAt(s++),o=1;if(10===r)u=!0;else if(13===r)u=!0,10===n.charCodeAt(s)&&(++s,++o);else if(r!==l)continue;return n.slice(t,s-o)}return n.slice(t)}for(var r,u,i={},a={},o=[],c=n.length,s=0,f=0;(r=e())!==a;){for(var h=[];r!==i&&r!==a;)h.push(r),r=e();t&&null==(h=t(h,f++))||o.push(h)}return o},e.format=function(t){if(Array.isArray(t[0]))return e.formatRows(t);var r=new m,u=[];return t.forEach(function(n){for(var t in n)r.has(t)||u.push(r.add(t))}),[u.map(a).join(n)].concat(t.map(function(t){return u.map(function(n){return a(t[n])}).join(n)})).join("\n")},e.formatRows=function(n){return n.map(i).join("\n")},e},oa.csv=oa.dsv(",","text/csv"),oa.tsv=oa.dsv(" ","text/tab-separated-values");var uo,io,ao,oo,lo=this[x(this,"requestAnimationFrame")]||function(n){setTimeout(n,17)};oa.timer=function(){qn.apply(this,arguments)},oa.timer.flush=function(){Rn(),Dn()},oa.round=function(n,t){return t?Math.round(n*(t=Math.pow(10,t)))/t:Math.round(n)};var co=["y","z","a","f","p","n","\xb5","m","","k","M","G","T","P","E","Z","Y"].map(jn);oa.formatPrefix=function(n,t){var e=0;return(n=+n)&&(0>n&&(n*=-1),t&&(n=oa.round(n,Pn(n,t))),e=1+Math.floor(1e-12+Math.log(n)/Math.LN10),e=Math.max(-24,Math.min(24,3*Math.floor((e-1)/3)))),co[8+e/3]};var so=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,fo=oa.map({b:function(n){return n.toString(2)},c:function(n){return String.fromCharCode(n)},o:function(n){return n.toString(8)},x:function(n){return n.toString(16)},X:function(n){return n.toString(16).toUpperCase()},g:function(n,t){return n.toPrecision(t)},e:function(n,t){return n.toExponential(t)},f:function(n,t){return n.toFixed(t)},r:function(n,t){return(n=oa.round(n,Pn(n,t))).toFixed(Math.max(0,Math.min(20,Pn(n*(1+1e-15),t))))}}),ho=oa.time={},go=Date;Hn.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){po.setUTCDate.apply(this._,arguments)},setDay:function(){po.setUTCDay.apply(this._,arguments)},setFullYear:function(){po.setUTCFullYear.apply(this._,arguments)},setHours:function(){po.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){po.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){po.setUTCMinutes.apply(this._,arguments)},setMonth:function(){po.setUTCMonth.apply(this._,arguments)},setSeconds:function(){po.setUTCSeconds.apply(this._,arguments)},setTime:function(){po.setTime.apply(this._,arguments)}};var po=Date.prototype;ho.year=On(function(n){return n=ho.day(n),n.setMonth(0,1),n},function(n,t){n.setFullYear(n.getFullYear()+t)},function(n){return n.getFullYear()}),ho.years=ho.year.range,ho.years.utc=ho.year.utc.range,ho.day=On(function(n){var t=new go(2e3,0);return t.setFullYear(n.getFullYear(),n.getMonth(),n.getDate()),t},function(n,t){n.setDate(n.getDate()+t)},function(n){return n.getDate()-1}),ho.days=ho.day.range,ho.days.utc=ho.day.utc.range,ho.dayOfYear=function(n){var t=ho.year(n);return Math.floor((n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(n,t){t=7-t;var e=ho[n]=On(function(n){return(n=ho.day(n)).setDate(n.getDate()-(n.getDay()+t)%7),n},function(n,t){n.setDate(n.getDate()+7*Math.floor(t))},function(n){var e=ho.year(n).getDay();return Math.floor((ho.dayOfYear(n)+(e+t)%7)/7)-(e!==t)});ho[n+"s"]=e.range,ho[n+"s"].utc=e.utc.range,ho[n+"OfYear"]=function(n){var e=ho.year(n).getDay();return Math.floor((ho.dayOfYear(n)+(e+t)%7)/7)}}),ho.week=ho.sunday,ho.weeks=ho.sunday.range,ho.weeks.utc=ho.sunday.utc.range,ho.weekOfYear=ho.sundayOfYear;var vo={"-":"",_:" ",0:"0"},mo=/^\s*\d+/,yo=/^%/;oa.locale=function(n){return{numberFormat:Un(n),timeFormat:Yn(n)}};var Mo=oa.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",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"]});oa.format=Mo.numberFormat,oa.geo={},st.prototype={s:0,t:0,add:function(n){ft(n,this.t,xo),ft(xo.s,this.s,this),this.s?this.t+=xo.t:this.s=xo.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var xo=new st;oa.geo.stream=function(n,t){n&&bo.hasOwnProperty(n.type)?bo[n.type](n,t):ht(n,t)};var bo={Feature:function(n,t){ht(n.geometry,t)},FeatureCollection:function(n,t){for(var e=n.features,r=-1,u=e.length;++rn?4*ja+n:n,ko.lineStart=ko.lineEnd=ko.point=b}};oa.geo.bounds=function(){function n(n,t){M.push(x=[s=n,h=n]),f>t&&(f=t),t>g&&(g=t)}function t(t,e){var r=dt([t*Oa,e*Oa]);if(m){var u=yt(m,r),i=[u[1],-u[0],0],a=yt(i,u);bt(a),a=_t(a);var l=t-p,c=l>0?1:-1,v=a[0]*Ia*c,d=Ma(l)>180;if(d^(v>c*p&&c*t>v)){var y=a[1]*Ia;y>g&&(g=y)}else if(v=(v+360)%360-180,d^(v>c*p&&c*t>v)){var y=-a[1]*Ia;f>y&&(f=y)}else f>e&&(f=e),e>g&&(g=e);d?p>t?o(s,t)>o(s,h)&&(h=t):o(t,h)>o(s,h)&&(s=t):h>=s?(s>t&&(s=t),t>h&&(h=t)):t>p?o(s,t)>o(s,h)&&(h=t):o(t,h)>o(s,h)&&(s=t)}else n(t,e);m=r,p=t}function e(){b.point=t}function r(){x[0]=s,x[1]=h,b.point=n,m=null}function u(n,e){if(m){var r=n-p;y+=Ma(r)>180?r+(r>0?360:-360):r}else v=n,d=e;ko.point(n,e),t(n,e)}function i(){ko.lineStart()}function a(){u(v,d),ko.lineEnd(),Ma(y)>Da&&(s=-(h=180)),x[0]=s,x[1]=h,m=null}function o(n,t){return(t-=n)<0?t+360:t}function l(n,t){return n[0]-t[0]}function c(n,t){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:nSo?(s=-(h=180),f=-(g=90)):y>Da?g=90:-Da>y&&(f=-90),x[0]=s,x[1]=h}};return function(n){g=h=-(s=f=1/0),M=[],oa.geo.stream(n,b);var t=M.length;if(t){M.sort(l);for(var e,r=1,u=M[0],i=[u];t>r;++r)e=M[r],c(e[0],u)||c(e[1],u)?(o(u[0],e[1])>o(u[0],u[1])&&(u[1]=e[1]),o(e[0],u[1])>o(u[0],u[1])&&(u[0]=e[0])):i.push(u=e);for(var a,e,p=-(1/0),t=i.length-1,r=0,u=i[t];t>=r;u=e,++r)e=i[r],(a=o(u[1],e[0]))>p&&(p=a,s=e[0],h=u[1])}return M=x=null,s===1/0||f===1/0?[[NaN,NaN],[NaN,NaN]]:[[s,f],[h,g]]}}(),oa.geo.centroid=function(n){No=Eo=Ao=Co=zo=Lo=qo=To=Ro=Do=Po=0,oa.geo.stream(n,jo);var t=Ro,e=Do,r=Po,u=t*t+e*e+r*r;return Pa>u&&(t=Lo,e=qo,r=To,Da>Eo&&(t=Ao,e=Co,r=zo),u=t*t+e*e+r*r,Pa>u)?[NaN,NaN]:[Math.atan2(e,t)*Ia,tn(r/Math.sqrt(u))*Ia]};var No,Eo,Ao,Co,zo,Lo,qo,To,Ro,Do,Po,jo={sphere:b,point:St,lineStart:Nt,lineEnd:Et,polygonStart:function(){jo.lineStart=At},polygonEnd:function(){jo.lineStart=Nt}},Uo=Rt(zt,Ut,Ht,[-ja,-ja/2]),Fo=1e9;oa.geo.clipExtent=function(){var n,t,e,r,u,i,a={stream:function(n){return u&&(u.valid=!1),u=i(n),u.valid=!0,u},extent:function(o){return arguments.length?(i=Zt(n=+o[0][0],t=+o[0][1],e=+o[1][0],r=+o[1][1]),u&&(u.valid=!1,u=null),a):[[n,t],[e,r]]}};return a.extent([[0,0],[960,500]])},(oa.geo.conicEqualArea=function(){return Vt(Xt)}).raw=Xt,oa.geo.albers=function(){return oa.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},oa.geo.albersUsa=function(){function n(n){var i=n[0],a=n[1];return t=null,e(i,a),t||(r(i,a),t)||u(i,a),t}var t,e,r,u,i=oa.geo.albers(),a=oa.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),o=oa.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(n,e){t=[n,e]}};return n.invert=function(n){var t=i.scale(),e=i.translate(),r=(n[0]-e[0])/t,u=(n[1]-e[1])/t;return(u>=.12&&.234>u&&r>=-.425&&-.214>r?a:u>=.166&&.234>u&&r>=-.214&&-.115>r?o:i).invert(n)},n.stream=function(n){var t=i.stream(n),e=a.stream(n),r=o.stream(n);return{point:function(n,u){t.point(n,u),e.point(n,u),r.point(n,u)},sphere:function(){t.sphere(),e.sphere(),r.sphere()},lineStart:function(){t.lineStart(),e.lineStart(),r.lineStart()},lineEnd:function(){t.lineEnd(),e.lineEnd(),r.lineEnd()},polygonStart:function(){t.polygonStart(),e.polygonStart(),r.polygonStart()},polygonEnd:function(){t.polygonEnd(),e.polygonEnd(),r.polygonEnd()}}},n.precision=function(t){return arguments.length?(i.precision(t),a.precision(t),o.precision(t),n):i.precision()},n.scale=function(t){return arguments.length?(i.scale(t),a.scale(.35*t),o.scale(t),n.translate(i.translate())):i.scale()},n.translate=function(t){if(!arguments.length)return i.translate();var c=i.scale(),s=+t[0],f=+t[1];return e=i.translate(t).clipExtent([[s-.455*c,f-.238*c],[s+.455*c,f+.238*c]]).stream(l).point,r=a.translate([s-.307*c,f+.201*c]).clipExtent([[s-.425*c+Da,f+.12*c+Da],[s-.214*c-Da,f+.234*c-Da]]).stream(l).point,u=o.translate([s-.205*c,f+.212*c]).clipExtent([[s-.214*c+Da,f+.166*c+Da],[s-.115*c-Da,f+.234*c-Da]]).stream(l).point,n},n.scale(1070)};var Ho,Oo,Io,Yo,Zo,Vo,Xo={point:b,lineStart:b,lineEnd:b,polygonStart:function(){Oo=0,Xo.lineStart=$t},polygonEnd:function(){Xo.lineStart=Xo.lineEnd=Xo.point=b,Ho+=Ma(Oo/2)}},$o={point:Bt,lineStart:b,lineEnd:b,polygonStart:b,polygonEnd:b},Bo={point:Gt,lineStart:Kt,lineEnd:Qt,polygonStart:function(){Bo.lineStart=ne},polygonEnd:function(){Bo.point=Gt,Bo.lineStart=Kt,Bo.lineEnd=Qt}};oa.geo.path=function(){function n(n){return n&&("function"==typeof o&&i.pointRadius(+o.apply(this,arguments)),a&&a.valid||(a=u(i)),oa.geo.stream(n,a)),i.result()}function t(){return a=null,n}var e,r,u,i,a,o=4.5;return n.area=function(n){return Ho=0,oa.geo.stream(n,u(Xo)),Ho},n.centroid=function(n){return Ao=Co=zo=Lo=qo=To=Ro=Do=Po=0,oa.geo.stream(n,u(Bo)),Po?[Ro/Po,Do/Po]:To?[Lo/To,qo/To]:zo?[Ao/zo,Co/zo]:[NaN,NaN]},n.bounds=function(n){return Zo=Vo=-(Io=Yo=1/0),oa.geo.stream(n,u($o)),[[Io,Yo],[Zo,Vo]]},n.projection=function(n){return arguments.length?(u=(e=n)?n.stream||re(n):y,t()):e},n.context=function(n){return arguments.length?(i=null==(r=n)?new Wt:new te(n),"function"!=typeof o&&i.pointRadius(o),t()):r},n.pointRadius=function(t){return arguments.length?(o="function"==typeof t?t:(i.pointRadius(+t),+t),n):o},n.projection(oa.geo.albersUsa()).context(null)},oa.geo.transform=function(n){return{stream:function(t){var e=new ue(t);for(var r in n)e[r]=n[r];return e}}},ue.prototype={point:function(n,t){this.stream.point(n,t)},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()}},oa.geo.projection=ae,oa.geo.projectionMutator=oe,(oa.geo.equirectangular=function(){return ae(ce)}).raw=ce.invert=ce,oa.geo.rotation=function(n){function t(t){return t=n(t[0]*Oa,t[1]*Oa),t[0]*=Ia,t[1]*=Ia,t}return n=fe(n[0]%360*Oa,n[1]*Oa,n.length>2?n[2]*Oa:0),t.invert=function(t){return t=n.invert(t[0]*Oa,t[1]*Oa),t[0]*=Ia,t[1]*=Ia,t},t},se.invert=ce,oa.geo.circle=function(){function n(){var n="function"==typeof r?r.apply(this,arguments):r,t=fe(-n[0]*Oa,-n[1]*Oa,0).invert,u=[];return e(null,null,1,{point:function(n,e){u.push(n=t(n,e)),n[0]*=Ia,n[1]*=Ia}}),{type:"Polygon",coordinates:[u]}}var t,e,r=[0,0],u=6;return n.origin=function(t){return arguments.length?(r=t,n):r},n.angle=function(r){return arguments.length?(e=ve((t=+r)*Oa,u*Oa),n):t},n.precision=function(r){return arguments.length?(e=ve(t*Oa,(u=+r)*Oa),n):u},n.angle(90)},oa.geo.distance=function(n,t){var e,r=(t[0]-n[0])*Oa,u=n[1]*Oa,i=t[1]*Oa,a=Math.sin(r),o=Math.cos(r),l=Math.sin(u),c=Math.cos(u),s=Math.sin(i),f=Math.cos(i);return Math.atan2(Math.sqrt((e=f*a)*e+(e=c*s-l*f*o)*e),l*s+c*f*o)},oa.geo.graticule=function(){function n(){return{type:"MultiLineString",coordinates:t()}}function t(){return oa.range(Math.ceil(i/d)*d,u,d).map(h).concat(oa.range(Math.ceil(c/m)*m,l,m).map(g)).concat(oa.range(Math.ceil(r/p)*p,e,p).filter(function(n){return Ma(n%d)>Da}).map(s)).concat(oa.range(Math.ceil(o/v)*v,a,v).filter(function(n){return Ma(n%m)>Da}).map(f))}var e,r,u,i,a,o,l,c,s,f,h,g,p=10,v=p,d=90,m=360,y=2.5;return n.lines=function(){return t().map(function(n){return{type:"LineString",coordinates:n}})},n.outline=function(){return{type:"Polygon",coordinates:[h(i).concat(g(l).slice(1),h(u).reverse().slice(1),g(c).reverse().slice(1))]}},n.extent=function(t){return arguments.length?n.majorExtent(t).minorExtent(t):n.minorExtent()},n.majorExtent=function(t){return arguments.length?(i=+t[0][0],u=+t[1][0],c=+t[0][1],l=+t[1][1],i>u&&(t=i,i=u,u=t),c>l&&(t=c,c=l,l=t),n.precision(y)):[[i,c],[u,l]]},n.minorExtent=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],o=+t[0][1],a=+t[1][1],r>e&&(t=r,r=e,e=t),o>a&&(t=o,o=a,a=t),n.precision(y)):[[r,o],[e,a]]},n.step=function(t){return arguments.length?n.majorStep(t).minorStep(t):n.minorStep()},n.majorStep=function(t){return arguments.length?(d=+t[0],m=+t[1],n):[d,m]},n.minorStep=function(t){return arguments.length?(p=+t[0],v=+t[1],n):[p,v]},n.precision=function(t){return arguments.length?(y=+t,s=me(o,a,90),f=ye(r,e,y),h=me(c,l,90),g=ye(i,u,y),n):y},n.majorExtent([[-180,-90+Da],[180,90-Da]]).minorExtent([[-180,-80-Da],[180,80+Da]])},oa.geo.greatArc=function(){function n(){return{type:"LineString",coordinates:[t||r.apply(this,arguments),e||u.apply(this,arguments)]}}var t,e,r=Me,u=xe;return n.distance=function(){return oa.geo.distance(t||r.apply(this,arguments),e||u.apply(this,arguments))},n.source=function(e){return arguments.length?(r=e,t="function"==typeof e?null:e,n):r},n.target=function(t){return arguments.length?(u=t,e="function"==typeof t?null:t,n):u},n.precision=function(){return arguments.length?n:0},n},oa.geo.interpolate=function(n,t){return be(n[0]*Oa,n[1]*Oa,t[0]*Oa,t[1]*Oa)},oa.geo.length=function(n){return Wo=0,oa.geo.stream(n,Jo),Wo};var Wo,Jo={sphere:b,point:b,lineStart:_e,lineEnd:b,polygonStart:b,polygonEnd:b},Go=we(function(n){return Math.sqrt(2/(1+n))},function(n){return 2*Math.asin(n/2)});(oa.geo.azimuthalEqualArea=function(){return ae(Go)}).raw=Go;var Ko=we(function(n){var t=Math.acos(n);return t&&t/Math.sin(t)},y);(oa.geo.azimuthalEquidistant=function(){return ae(Ko)}).raw=Ko,(oa.geo.conicConformal=function(){return Vt(Se)}).raw=Se,(oa.geo.conicEquidistant=function(){return Vt(ke)}).raw=ke;var Qo=we(function(n){return 1/n},Math.atan);(oa.geo.gnomonic=function(){return ae(Qo)}).raw=Qo,Ne.invert=function(n,t){return[n,2*Math.atan(Math.exp(t))-Ha]},(oa.geo.mercator=function(){return Ee(Ne)}).raw=Ne;var nl=we(function(){return 1},Math.asin);(oa.geo.orthographic=function(){return ae(nl)}).raw=nl;var tl=we(function(n){return 1/(1+n)},function(n){return 2*Math.atan(n)});(oa.geo.stereographic=function(){return ae(tl)}).raw=tl,Ae.invert=function(n,t){return[-t,2*Math.atan(Math.exp(n))-Ha]},(oa.geo.transverseMercator=function(){var n=Ee(Ae),t=n.center,e=n.rotate;return n.center=function(n){return n?t([-n[1],n[0]]):(n=t(),[n[1],-n[0]])},n.rotate=function(n){return n?e([n[0],n[1],n.length>2?n[2]+90:90]):(n=e(),[n[0],n[1],n[2]-90])},e([0,0,90])}).raw=Ae,oa.geom={},oa.geom.hull=function(n){function t(n){if(n.length<3)return[];var t,u=En(e),i=En(r),a=n.length,o=[],l=[];for(t=0;a>t;t++)o.push([+u.call(this,n[t],t),+i.call(this,n[t],t),t]);for(o.sort(qe),t=0;a>t;t++)l.push([o[t][0],-o[t][1]]);var c=Le(o),s=Le(l),f=s[0]===c[0],h=s[s.length-1]===c[c.length-1],g=[];for(t=c.length-1;t>=0;--t)g.push(n[o[c[t]][2]]);for(t=+f;t=r&&c.x<=i&&c.y>=u&&c.y<=a?[[r,a],[i,a],[i,u],[r,u]]:[];s.point=n[o]}),t}function e(n){return n.map(function(n,t){return{x:Math.round(i(n,t)/Da)*Da,y:Math.round(a(n,t)/Da)*Da,i:t}})}var r=Ce,u=ze,i=r,a=u,o=sl;return n?t(n):(t.links=function(n){return or(e(n)).edges.filter(function(n){return n.l&&n.r}).map(function(t){return{source:n[t.l.i],target:n[t.r.i]}})},t.triangles=function(n){var t=[];return or(e(n)).cells.forEach(function(e,r){for(var u,i,a=e.site,o=e.edges.sort(Ve),l=-1,c=o.length,s=o[c-1].edge,f=s.l===a?s.r:s.l;++l=c,h=r>=s,g=h<<1|f;n.leaf=!1,n=n.nodes[g]||(n.nodes[g]=hr()),f?u=c:o=c,h?a=s:l=s,i(n,t,e,r,u,a,o,l)}var s,f,h,g,p,v,d,m,y,M=En(o),x=En(l);if(null!=t)v=t,d=e,m=r,y=u;else if(m=y=-(v=d=1/0),f=[],h=[],p=n.length,a)for(g=0;p>g;++g)s=n[g],s.xm&&(m=s.x),s.y>y&&(y=s.y),f.push(s.x),h.push(s.y);else for(g=0;p>g;++g){var b=+M(s=n[g],g),_=+x(s,g);v>b&&(v=b),d>_&&(d=_),b>m&&(m=b),_>y&&(y=_),f.push(b),h.push(_)}var w=m-v,S=y-d;w>S?y=d+w:m=v+S;var k=hr();if(k.add=function(n){i(k,n,+M(n,++g),+x(n,g),v,d,m,y)},k.visit=function(n){gr(n,k,v,d,m,y)},k.find=function(n){return pr(k,n[0],n[1],v,d,m,y)},g=-1,null==t){for(;++g=0?n.slice(0,t):n,r=t>=0?n.slice(t+1):"in";return e=pl.get(e)||gl,r=vl.get(r)||y,br(r(e.apply(null,la.call(arguments,1))))},oa.interpolateHcl=Rr,oa.interpolateHsl=Dr,oa.interpolateLab=Pr,oa.interpolateRound=jr,oa.transform=function(n){var t=sa.createElementNS(oa.ns.prefix.svg,"g");return(oa.transform=function(n){if(null!=n){t.setAttribute("transform",n);var e=t.transform.baseVal.consolidate()}return new Ur(e?e.matrix:dl)})(n)},Ur.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var dl={a:1,b:0,c:0,d:1,e:0,f:0};oa.interpolateTransform=$r,oa.layout={},oa.layout.bundle=function(){return function(n){for(var t=[],e=-1,r=n.length;++eo*o/m){if(v>l){var c=t.charge/l;n.px-=i*c,n.py-=a*c}return!0}if(t.point&&l&&v>l){var c=t.pointCharge/l;n.px-=i*c,n.py-=a*c}}return!t.charge}}function t(n){n.px=oa.event.x,n.py=oa.event.y,l.resume()}var e,r,u,i,a,o,l={},c=oa.dispatch("start","tick","end"),s=[1,1],f=.9,h=ml,g=yl,p=-30,v=Ml,d=.1,m=.64,M=[],x=[];return l.tick=function(){if((u*=.99)<.005)return e=null,c.end({type:"end",alpha:u=0}),!0;var t,r,l,h,g,v,m,y,b,_=M.length,w=x.length;for(r=0;w>r;++r)l=x[r],h=l.source,g=l.target,y=g.x-h.x,b=g.y-h.y,(v=y*y+b*b)&&(v=u*a[r]*((v=Math.sqrt(v))-i[r])/v,y*=v,b*=v,g.x-=y*(m=h.weight+g.weight?h.weight/(h.weight+g.weight):.5),g.y-=b*m,h.x+=y*(m=1-m),h.y+=b*m);if((m=u*d)&&(y=s[0]/2,b=s[1]/2,r=-1,m))for(;++r<_;)l=M[r],l.x+=(y-l.x)*m,l.y+=(b-l.y)*m;if(p)for(ru(t=oa.geom.quadtree(M),u,o),r=-1;++r<_;)(l=M[r]).fixed||t.visit(n(l));for(r=-1;++r<_;)l=M[r],l.fixed?(l.x=l.px,l.y=l.py):(l.x-=(l.px-(l.px=l.x))*f,l.y-=(l.py-(l.py=l.y))*f);c.tick({type:"tick",alpha:u})},l.nodes=function(n){return arguments.length?(M=n,l):M},l.links=function(n){return arguments.length?(x=n,l):x},l.size=function(n){return arguments.length?(s=n,l):s},l.linkDistance=function(n){return arguments.length?(h="function"==typeof n?n:+n,l):h},l.distance=l.linkDistance,l.linkStrength=function(n){return arguments.length?(g="function"==typeof n?n:+n,l):g},l.friction=function(n){return arguments.length?(f=+n,l):f},l.charge=function(n){return arguments.length?(p="function"==typeof n?n:+n,l):p},l.chargeDistance=function(n){return arguments.length?(v=n*n,l):Math.sqrt(v)},l.gravity=function(n){return arguments.length?(d=+n,l):d},l.theta=function(n){return arguments.length?(m=n*n,l):Math.sqrt(m)},l.alpha=function(n){return arguments.length?(n=+n,u?n>0?u=n:(e.c=null,e.t=NaN,e=null,c.end({type:"end",alpha:u=0})):n>0&&(c.start({type:"start",alpha:u=n}),e=qn(l.tick)),l):u},l.start=function(){function n(n,r){if(!e){for(e=new Array(u),l=0;u>l;++l)e[l]=[];for(l=0;c>l;++l){var i=x[l];e[i.source.index].push(i.target),e[i.target.index].push(i.source)}}for(var a,o=e[t],l=-1,s=o.length;++lt;++t)(r=M[t]).index=t,r.weight=0;for(t=0;c>t;++t)r=x[t],"number"==typeof r.source&&(r.source=M[r.source]),"number"==typeof r.target&&(r.target=M[r.target]),++r.source.weight,++r.target.weight;for(t=0;u>t;++t)r=M[t],isNaN(r.x)&&(r.x=n("x",f)),isNaN(r.y)&&(r.y=n("y",v)),isNaN(r.px)&&(r.px=r.x),isNaN(r.py)&&(r.py=r.y);if(i=[],"function"==typeof h)for(t=0;c>t;++t)i[t]=+h.call(this,x[t],t);else for(t=0;c>t;++t)i[t]=h;if(a=[],"function"==typeof g)for(t=0;c>t;++t)a[t]=+g.call(this,x[t],t);else for(t=0;c>t;++t)a[t]=g;if(o=[],"function"==typeof p)for(t=0;u>t;++t)o[t]=+p.call(this,M[t],t);else for(t=0;u>t;++t)o[t]=p;return l.resume()},l.resume=function(){return l.alpha(.1)},l.stop=function(){return l.alpha(0)},l.drag=function(){return r||(r=oa.behavior.drag().origin(y).on("dragstart.force",Qr).on("drag.force",t).on("dragend.force",nu)),arguments.length?void this.on("mouseover.force",tu).on("mouseout.force",eu).call(r):r},oa.rebind(l,c,"on")};var ml=20,yl=1,Ml=1/0;oa.layout.hierarchy=function(){function n(u){var i,a=[u],o=[];for(u.depth=0;null!=(i=a.pop());)if(o.push(i),(c=e.call(n,i,i.depth))&&(l=c.length)){for(var l,c,s;--l>=0;)a.push(s=c[l]),s.parent=i,s.depth=i.depth+1;r&&(i.value=0),i.children=c}else r&&(i.value=+r.call(n,i,i.depth)||0),delete i.children;return au(u,function(n){var e,u;t&&(e=n.children)&&e.sort(t),r&&(u=n.parent)&&(u.value+=n.value)}),o}var t=cu,e=ou,r=lu;return n.sort=function(e){return arguments.length?(t=e,n):t},n.children=function(t){return arguments.length?(e=t,n):e},n.value=function(t){return arguments.length?(r=t,n):r},n.revalue=function(t){return r&&(iu(t,function(n){n.children&&(n.value=0)}),au(t,function(t){var e;t.children||(t.value=+r.call(n,t,t.depth)||0),(e=t.parent)&&(e.value+=t.value)})),t},n},oa.layout.partition=function(){function n(t,e,r,u){var i=t.children;if(t.x=e,t.y=t.depth*u,t.dx=r,t.dy=u,i&&(a=i.length)){var a,o,l,c=-1;for(r=t.value?r/t.value:0;++cf?-1:1),p=oa.sum(c),v=p?(f-l*g)/p:0,d=oa.range(l),m=[];return null!=e&&d.sort(e===xl?function(n,t){return c[t]-c[n]}:function(n,t){return e(a[n],a[t])}),d.forEach(function(n){m[n]={data:a[n],value:o=c[n],startAngle:s,endAngle:s+=o*v+g,padAngle:h}}),m}var t=Number,e=xl,r=0,u=Ua,i=0;return n.value=function(e){return arguments.length?(t=e,n):t},n.sort=function(t){return arguments.length?(e=t,n):e},n.startAngle=function(t){return arguments.length?(r=t,n):r},n.endAngle=function(t){return arguments.length?(u=t,n):u},n.padAngle=function(t){return arguments.length?(i=t,n):i},n};var xl={};oa.layout.stack=function(){function n(o,l){if(!(h=o.length))return o;var c=o.map(function(e,r){return t.call(n,e,r)}),s=c.map(function(t){return t.map(function(t,e){return[i.call(n,t,e),a.call(n,t,e)]})}),f=e.call(n,s,l);c=oa.permute(c,f),s=oa.permute(s,f);var h,g,p,v,d=r.call(n,s,l),m=c[0].length;for(p=0;m>p;++p)for(u.call(n,c[0][p],v=d[p],s[0][p][1]),g=1;h>g;++g)u.call(n,c[g][p],v+=s[g-1][p][1],s[g][p][1]);return o}var t=y,e=pu,r=vu,u=gu,i=fu,a=hu;return n.values=function(e){return arguments.length?(t=e,n):t},n.order=function(t){return arguments.length?(e="function"==typeof t?t:bl.get(t)||pu,n):e},n.offset=function(t){return arguments.length?(r="function"==typeof t?t:_l.get(t)||vu,n):r},n.x=function(t){return arguments.length?(i=t,n):i},n.y=function(t){return arguments.length?(a=t,n):a},n.out=function(t){return arguments.length?(u=t,n):u},n};var bl=oa.map({"inside-out":function(n){var t,e,r=n.length,u=n.map(du),i=n.map(mu),a=oa.range(r).sort(function(n,t){return u[n]-u[t]}),o=0,l=0,c=[],s=[];for(t=0;r>t;++t)e=a[t],l>o?(o+=i[e],c.push(e)):(l+=i[e],s.push(e));return s.reverse().concat(c)},reverse:function(n){return oa.range(n.length).reverse()},"default":pu}),_l=oa.map({silhouette:function(n){var t,e,r,u=n.length,i=n[0].length,a=[],o=0,l=[];for(e=0;i>e;++e){for(t=0,r=0;u>t;t++)r+=n[t][e][1];r>o&&(o=r),a.push(r)}for(e=0;i>e;++e)l[e]=(o-a[e])/2;return l},wiggle:function(n){var t,e,r,u,i,a,o,l,c,s=n.length,f=n[0],h=f.length,g=[];for(g[0]=l=c=0,e=1;h>e;++e){for(t=0,u=0;s>t;++t)u+=n[t][e][1];for(t=0,i=0,o=f[e][0]-f[e-1][0];s>t;++t){for(r=0,a=(n[t][e][1]-n[t][e-1][1])/(2*o);t>r;++r)a+=(n[r][e][1]-n[r][e-1][1])/o;i+=a*n[t][e][1]}g[e]=l-=u?i/u*o:0,c>l&&(c=l)}for(e=0;h>e;++e)g[e]-=c;return g},expand:function(n){var t,e,r,u=n.length,i=n[0].length,a=1/u,o=[];for(e=0;i>e;++e){for(t=0,r=0;u>t;t++)r+=n[t][e][1];if(r)for(t=0;u>t;t++)n[t][e][1]/=r;else for(t=0;u>t;t++)n[t][e][1]=a}for(e=0;i>e;++e)o[e]=0;return o},zero:vu});oa.layout.histogram=function(){function n(n,i){for(var a,o,l=[],c=n.map(e,this),s=r.call(this,c,i),f=u.call(this,s,c,i),i=-1,h=c.length,g=f.length-1,p=t?1:1/h;++i0)for(i=-1;++i=s[0]&&o<=s[1]&&(a=l[oa.bisect(f,o,1,g)-1],a.y+=p,a.push(n[i]));return l}var t=!0,e=Number,r=bu,u=Mu;return n.value=function(t){return arguments.length?(e=t,n):e},n.range=function(t){return arguments.length?(r=En(t),n):r},n.bins=function(t){return arguments.length?(u="number"==typeof t?function(n){return xu(n,t)}:En(t),n):u},n.frequency=function(e){return arguments.length?(t=!!e,n):t},n},oa.layout.pack=function(){function n(n,i){var a=e.call(this,n,i),o=a[0],l=u[0],c=u[1],s=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(o.x=o.y=0,au(o,function(n){n.r=+s(n.value)}),au(o,Nu),r){var f=r*(t?1:Math.max(2*o.r/l,2*o.r/c))/2;au(o,function(n){n.r+=f}),au(o,Nu),au(o,function(n){n.r-=f})}return Cu(o,l/2,c/2,t?1:1/Math.max(2*o.r/l,2*o.r/c)),a}var t,e=oa.layout.hierarchy().sort(_u),r=0,u=[1,1];return n.size=function(t){return arguments.length?(u=t,n):u},n.radius=function(e){return arguments.length?(t=null==e||"function"==typeof e?e:+e,n):t},n.padding=function(t){return arguments.length?(r=+t,n):r},uu(n,e)},oa.layout.tree=function(){function n(n,u){var s=a.call(this,n,u),f=s[0],h=t(f);if(au(h,e),h.parent.m=-h.z,iu(h,r),c)iu(f,i);else{var g=f,p=f,v=f;iu(f,function(n){n.xp.x&&(p=n),n.depth>v.depth&&(v=n)});var d=o(g,p)/2-g.x,m=l[0]/(p.x+o(p,g)/2+d),y=l[1]/(v.depth||1);iu(f,function(n){n.x=(n.x+d)*m,n.y=n.depth*y})}return s}function t(n){for(var t,e={A:null,children:[n]},r=[e];null!=(t=r.pop());)for(var u,i=t.children,a=0,o=i.length;o>a;++a)r.push((i[a]=u={_:i[a],parent:t,children:(u=i[a].children)&&u.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:a}).a=u);return e.children[0]}function e(n){var t=n.children,e=n.parent.children,r=n.i?e[n.i-1]:null;if(t.length){Du(n);var i=(t[0].z+t[t.length-1].z)/2;r?(n.z=r.z+o(n._,r._),n.m=n.z-i):n.z=i}else r&&(n.z=r.z+o(n._,r._));n.parent.A=u(n,r,n.parent.A||e[0])}function r(n){n._.x=n.z+n.parent.m,n.m+=n.parent.m}function u(n,t,e){if(t){for(var r,u=n,i=n,a=t,l=u.parent.children[0],c=u.m,s=i.m,f=a.m,h=l.m;a=Tu(a),u=qu(u),a&&u;)l=qu(l),i=Tu(i),i.a=n,r=a.z+f-u.z-c+o(a._,u._),r>0&&(Ru(Pu(a,n,e),n,r),c+=r,s+=r),f+=a.m,c+=u.m,h+=l.m,s+=i.m;a&&!Tu(i)&&(i.t=a,i.m+=f-s),u&&!qu(l)&&(l.t=u,l.m+=c-h,e=n)}return e}function i(n){n.x*=l[0],n.y=n.depth*l[1]}var a=oa.layout.hierarchy().sort(null).value(null),o=Lu,l=[1,1],c=null;return n.separation=function(t){return arguments.length?(o=t,n):o},n.size=function(t){return arguments.length?(c=null==(l=t)?i:null,n):c?null:l},n.nodeSize=function(t){return arguments.length?(c=null==(l=t)?null:i,n):c?l:null},uu(n,a)},oa.layout.cluster=function(){function n(n,i){var a,o=t.call(this,n,i),l=o[0],c=0;au(l,function(n){var t=n.children;t&&t.length?(n.x=Uu(t),n.y=ju(t)):(n.x=a?c+=e(n,a):0,n.y=0,a=n)});var s=Fu(l),f=Hu(l),h=s.x-e(s,f)/2,g=f.x+e(f,s)/2;return au(l,u?function(n){n.x=(n.x-l.x)*r[0],n.y=(l.y-n.y)*r[1]}:function(n){n.x=(n.x-h)/(g-h)*r[0],n.y=(1-(l.y?n.y/l.y:1))*r[1]}),o}var t=oa.layout.hierarchy().sort(null).value(null),e=Lu,r=[1,1],u=!1;return n.separation=function(t){return arguments.length?(e=t,n):e},n.size=function(t){return arguments.length?(u=null==(r=t),n):u?null:r},n.nodeSize=function(t){return arguments.length?(u=null!=(r=t),n):u?r:null},uu(n,t)},oa.layout.treemap=function(){function n(n,t){for(var e,r,u=-1,i=n.length;++ut?0:t),e.area=isNaN(r)||0>=r?0:r}function t(e){var i=e.children;if(i&&i.length){var a,o,l,c=f(e),s=[],h=i.slice(),p=1/0,v="slice"===g?c.dx:"dice"===g?c.dy:"slice-dice"===g?1&e.depth?c.dy:c.dx:Math.min(c.dx,c.dy);for(n(h,c.dx*c.dy/e.value),s.area=0;(l=h.length)>0;)s.push(a=h[l-1]),s.area+=a.area,"squarify"!==g||(o=r(s,v))<=p?(h.pop(),p=o):(s.area-=s.pop().area,u(s,v,c,!1),v=Math.min(c.dx,c.dy),s.length=s.area=0,p=1/0);s.length&&(u(s,v,c,!0),s.length=s.area=0),i.forEach(t)}}function e(t){var r=t.children;if(r&&r.length){var i,a=f(t),o=r.slice(),l=[];for(n(o,a.dx*a.dy/t.value),l.area=0;i=o.pop();)l.push(i),l.area+=i.area,null!=i.z&&(u(l,i.z?a.dx:a.dy,a,!o.length),l.length=l.area=0);r.forEach(e)}}function r(n,t){for(var e,r=n.area,u=0,i=1/0,a=-1,o=n.length;++ae&&(i=e),e>u&&(u=e));return r*=r,t*=t,r?Math.max(t*u*p/r,r/(t*i*p)):1/0}function u(n,t,e,r){var u,i=-1,a=n.length,o=e.x,c=e.y,s=t?l(n.area/t):0; -if(t==e.dx){for((r||s>e.dy)&&(s=e.dy);++ie.dx)&&(s=e.dx);++ie&&(t=1),1>e&&(n=0),function(){var e,r,u;do e=2*Math.random()-1,r=2*Math.random()-1,u=e*e+r*r;while(!u||u>1);return n+t*e*Math.sqrt(-2*Math.log(u)/u)}},logNormal:function(){var n=oa.random.normal.apply(oa,arguments);return function(){return Math.exp(n())}},bates:function(n){var t=oa.random.irwinHall(n);return function(){return t()/n}},irwinHall:function(n){return function(){for(var t=0,e=0;n>e;e++)t+=Math.random();return t}}},oa.scale={};var wl={floor:y,ceil:y};oa.scale.linear=function(){return Wu([0,1],[0,1],Mr,!1)};var Sl={s:1,g:1,p:1,r:1,e:1};oa.scale.log=function(){return ri(oa.scale.linear().domain([0,1]),10,!0,[1,10])};var kl=oa.format(".0e"),Nl={floor:function(n){return-Math.ceil(-n)},ceil:function(n){return-Math.floor(-n)}};oa.scale.pow=function(){return ui(oa.scale.linear(),1,[0,1])},oa.scale.sqrt=function(){return oa.scale.pow().exponent(.5)},oa.scale.ordinal=function(){return ai([],{t:"range",a:[[]]})},oa.scale.category10=function(){return oa.scale.ordinal().range(El)},oa.scale.category20=function(){return oa.scale.ordinal().range(Al)},oa.scale.category20b=function(){return oa.scale.ordinal().range(Cl)},oa.scale.category20c=function(){return oa.scale.ordinal().range(zl)};var El=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(xn),Al=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(xn),Cl=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(xn),zl=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(xn);oa.scale.quantile=function(){return oi([],[])},oa.scale.quantize=function(){return li(0,1,[0,1])},oa.scale.threshold=function(){return ci([.5],[0,1])},oa.scale.identity=function(){return si([0,1])},oa.svg={},oa.svg.arc=function(){function n(){var n=Math.max(0,+e.apply(this,arguments)),c=Math.max(0,+r.apply(this,arguments)),s=a.apply(this,arguments)-Ha,f=o.apply(this,arguments)-Ha,h=Math.abs(f-s),g=s>f?0:1;if(n>c&&(p=c,c=n,n=p),h>=Fa)return t(c,g)+(n?t(n,1-g):"")+"Z";var p,v,d,m,y,M,x,b,_,w,S,k,N=0,E=0,A=[];if((m=(+l.apply(this,arguments)||0)/2)&&(d=i===Ll?Math.sqrt(n*n+c*c):+i.apply(this,arguments),g||(E*=-1),c&&(E=tn(d/c*Math.sin(m))),n&&(N=tn(d/n*Math.sin(m)))),c){y=c*Math.cos(s+E),M=c*Math.sin(s+E),x=c*Math.cos(f-E),b=c*Math.sin(f-E);var C=Math.abs(f-s-2*E)<=ja?0:1;if(E&&mi(y,M,x,b)===g^C){var z=(s+f)/2;y=c*Math.cos(z),M=c*Math.sin(z),x=b=null}}else y=M=0;if(n){_=n*Math.cos(f-N),w=n*Math.sin(f-N),S=n*Math.cos(s+N),k=n*Math.sin(s+N);var L=Math.abs(s-f+2*N)<=ja?0:1;if(N&&mi(_,w,S,k)===1-g^L){var q=(s+f)/2;_=n*Math.cos(q),w=n*Math.sin(q),S=k=null}}else _=w=0;if(h>Da&&(p=Math.min(Math.abs(c-n)/2,+u.apply(this,arguments)))>.001){v=c>n^g?0:1;var T=p,R=p;if(ja>h){var D=null==S?[_,w]:null==x?[y,M]:Re([y,M],[S,k],[x,b],[_,w]),P=y-D[0],j=M-D[1],U=x-D[0],F=b-D[1],H=1/Math.sin(Math.acos((P*U+j*F)/(Math.sqrt(P*P+j*j)*Math.sqrt(U*U+F*F)))/2),O=Math.sqrt(D[0]*D[0]+D[1]*D[1]);R=Math.min(p,(n-O)/(H-1)),T=Math.min(p,(c-O)/(H+1))}if(null!=x){var I=yi(null==S?[_,w]:[S,k],[y,M],c,T,g),Y=yi([x,b],[_,w],c,T,g);p===T?A.push("M",I[0],"A",T,",",T," 0 0,",v," ",I[1],"A",c,",",c," 0 ",1-g^mi(I[1][0],I[1][1],Y[1][0],Y[1][1]),",",g," ",Y[1],"A",T,",",T," 0 0,",v," ",Y[0]):A.push("M",I[0],"A",T,",",T," 0 1,",v," ",Y[0])}else A.push("M",y,",",M);if(null!=S){var Z=yi([y,M],[S,k],n,-R,g),V=yi([_,w],null==x?[y,M]:[x,b],n,-R,g);p===R?A.push("L",V[0],"A",R,",",R," 0 0,",v," ",V[1],"A",n,",",n," 0 ",g^mi(V[1][0],V[1][1],Z[1][0],Z[1][1]),",",1-g," ",Z[1],"A",R,",",R," 0 0,",v," ",Z[0]):A.push("L",V[0],"A",R,",",R," 0 0,",v," ",Z[0])}else A.push("L",_,",",w)}else A.push("M",y,",",M),null!=x&&A.push("A",c,",",c," 0 ",C,",",g," ",x,",",b),A.push("L",_,",",w),null!=S&&A.push("A",n,",",n," 0 ",L,",",1-g," ",S,",",k);return A.push("Z"),A.join("")}function t(n,t){return"M0,"+n+"A"+n+","+n+" 0 1,"+t+" 0,"+-n+"A"+n+","+n+" 0 1,"+t+" 0,"+n}var e=hi,r=gi,u=fi,i=Ll,a=pi,o=vi,l=di;return n.innerRadius=function(t){return arguments.length?(e=En(t),n):e},n.outerRadius=function(t){return arguments.length?(r=En(t),n):r},n.cornerRadius=function(t){return arguments.length?(u=En(t),n):u},n.padRadius=function(t){return arguments.length?(i=t==Ll?Ll:En(t),n):i},n.startAngle=function(t){return arguments.length?(a=En(t),n):a},n.endAngle=function(t){return arguments.length?(o=En(t),n):o},n.padAngle=function(t){return arguments.length?(l=En(t),n):l},n.centroid=function(){var n=(+e.apply(this,arguments)+ +r.apply(this,arguments))/2,t=(+a.apply(this,arguments)+ +o.apply(this,arguments))/2-Ha;return[Math.cos(t)*n,Math.sin(t)*n]},n};var Ll="auto";oa.svg.line=function(){return Mi(y)};var ql=oa.map({linear:xi,"linear-closed":bi,step:_i,"step-before":wi,"step-after":Si,basis:zi,"basis-open":Li,"basis-closed":qi,bundle:Ti,cardinal:Ei,"cardinal-open":ki,"cardinal-closed":Ni,monotone:Fi});ql.forEach(function(n,t){t.key=n,t.closed=/-closed$/.test(n)});var Tl=[0,2/3,1/3,0],Rl=[0,1/3,2/3,0],Dl=[0,1/6,2/3,1/6];oa.svg.line.radial=function(){var n=Mi(Hi);return n.radius=n.x,delete n.x,n.angle=n.y,delete n.y,n},wi.reverse=Si,Si.reverse=wi,oa.svg.area=function(){return Oi(y)},oa.svg.area.radial=function(){var n=Oi(Hi);return n.radius=n.x,delete n.x,n.innerRadius=n.x0,delete n.x0,n.outerRadius=n.x1,delete n.x1,n.angle=n.y,delete n.y,n.startAngle=n.y0,delete n.y0,n.endAngle=n.y1,delete n.y1,n},oa.svg.chord=function(){function n(n,o){var l=t(this,i,n,o),c=t(this,a,n,o);return"M"+l.p0+r(l.r,l.p1,l.a1-l.a0)+(e(l,c)?u(l.r,l.p1,l.r,l.p0):u(l.r,l.p1,c.r,c.p0)+r(c.r,c.p1,c.a1-c.a0)+u(c.r,c.p1,l.r,l.p0))+"Z"}function t(n,t,e,r){var u=t.call(n,e,r),i=o.call(n,u,r),a=l.call(n,u,r)-Ha,s=c.call(n,u,r)-Ha;return{r:i,a0:a,a1:s,p0:[i*Math.cos(a),i*Math.sin(a)],p1:[i*Math.cos(s),i*Math.sin(s)]}}function e(n,t){return n.a0==t.a0&&n.a1==t.a1}function r(n,t,e){return"A"+n+","+n+" 0 "+ +(e>ja)+",1 "+t}function u(n,t,e,r){return"Q 0,0 "+r}var i=Me,a=xe,o=Ii,l=pi,c=vi;return n.radius=function(t){return arguments.length?(o=En(t),n):o},n.source=function(t){return arguments.length?(i=En(t),n):i},n.target=function(t){return arguments.length?(a=En(t),n):a},n.startAngle=function(t){return arguments.length?(l=En(t),n):l},n.endAngle=function(t){return arguments.length?(c=En(t),n):c},n},oa.svg.diagonal=function(){function n(n,u){var i=t.call(this,n,u),a=e.call(this,n,u),o=(i.y+a.y)/2,l=[i,{x:i.x,y:o},{x:a.x,y:o},a];return l=l.map(r),"M"+l[0]+"C"+l[1]+" "+l[2]+" "+l[3]}var t=Me,e=xe,r=Yi;return n.source=function(e){return arguments.length?(t=En(e),n):t},n.target=function(t){return arguments.length?(e=En(t),n):e},n.projection=function(t){return arguments.length?(r=t,n):r},n},oa.svg.diagonal.radial=function(){var n=oa.svg.diagonal(),t=Yi,e=n.projection;return n.projection=function(n){return arguments.length?e(Zi(t=n)):t},n},oa.svg.symbol=function(){function n(n,r){return(Pl.get(t.call(this,n,r))||$i)(e.call(this,n,r))}var t=Xi,e=Vi;return n.type=function(e){return arguments.length?(t=En(e),n):t},n.size=function(t){return arguments.length?(e=En(t),n):e},n};var Pl=oa.map({circle:$i,cross:function(n){var t=Math.sqrt(n/5)/2;return"M"+-3*t+","+-t+"H"+-t+"V"+-3*t+"H"+t+"V"+-t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+-t+"V"+t+"H"+-3*t+"Z"},diamond:function(n){var t=Math.sqrt(n/(2*Ul)),e=t*Ul;return"M0,"+-t+"L"+e+",0 0,"+t+" "+-e+",0Z"},square:function(n){var t=Math.sqrt(n)/2;return"M"+-t+","+-t+"L"+t+","+-t+" "+t+","+t+" "+-t+","+t+"Z"},"triangle-down":function(n){var t=Math.sqrt(n/jl),e=t*jl/2;return"M0,"+e+"L"+t+","+-e+" "+-t+","+-e+"Z"},"triangle-up":function(n){var t=Math.sqrt(n/jl),e=t*jl/2;return"M0,"+-e+"L"+t+","+e+" "+-t+","+e+"Z"}});oa.svg.symbolTypes=Pl.keys();var jl=Math.sqrt(3),Ul=Math.tan(30*Oa);Aa.transition=function(n){for(var t,e,r=Fl||++Yl,u=Ki(n),i=[],a=Hl||{time:Date.now(),ease:Nr,delay:0,duration:250},o=-1,l=this.length;++oi;i++){u.push(t=[]);for(var e=this[i],o=0,l=e.length;l>o;o++)(r=e[o])&&n.call(r,r.__data__,o,i)&&t.push(r)}return Wi(u,this.namespace,this.id)},Il.tween=function(n,t){var e=this.id,r=this.namespace;return arguments.length<2?this.node()[r][e].tween.get(n):Y(this,null==t?function(t){t[r][e].tween.remove(n)}:function(u){u[r][e].tween.set(n,t)})},Il.attr=function(n,t){function e(){this.removeAttribute(o)}function r(){this.removeAttributeNS(o.space,o.local)}function u(n){return null==n?e:(n+="",function(){var t,e=this.getAttribute(o);return e!==n&&(t=a(e,n),function(n){this.setAttribute(o,t(n))})})}function i(n){return null==n?r:(n+="",function(){var t,e=this.getAttributeNS(o.space,o.local);return e!==n&&(t=a(e,n),function(n){this.setAttributeNS(o.space,o.local,t(n))})})}if(arguments.length<2){for(t in n)this.attr(t,n[t]);return this}var a="transform"==n?$r:Mr,o=oa.ns.qualify(n);return Ji(this,"attr."+n,t,o.local?i:u)},Il.attrTween=function(n,t){function e(n,e){var r=t.call(this,n,e,this.getAttribute(u));return r&&function(n){this.setAttribute(u,r(n))}}function r(n,e){var r=t.call(this,n,e,this.getAttributeNS(u.space,u.local));return r&&function(n){this.setAttributeNS(u.space,u.local,r(n))}}var u=oa.ns.qualify(n);return this.tween("attr."+n,u.local?r:e)},Il.style=function(n,e,r){function u(){this.style.removeProperty(n)}function i(e){return null==e?u:(e+="",function(){var u,i=t(this).getComputedStyle(this,null).getPropertyValue(n);return i!==e&&(u=Mr(i,e),function(t){this.style.setProperty(n,u(t),r)})})}var a=arguments.length;if(3>a){if("string"!=typeof n){2>a&&(e="");for(r in n)this.style(r,n[r],e);return this}r=""}return Ji(this,"style."+n,e,i)},Il.styleTween=function(n,e,r){function u(u,i){var a=e.call(this,u,i,t(this).getComputedStyle(this,null).getPropertyValue(n));return a&&function(t){this.style.setProperty(n,a(t),r)}}return arguments.length<3&&(r=""),this.tween("style."+n,u)},Il.text=function(n){return Ji(this,"text",n,Gi)},Il.remove=function(){var n=this.namespace;return this.each("end.transition",function(){var t;this[n].count<2&&(t=this.parentNode)&&t.removeChild(this)})},Il.ease=function(n){var t=this.id,e=this.namespace;return arguments.length<1?this.node()[e][t].ease:("function"!=typeof n&&(n=oa.ease.apply(oa,arguments)),Y(this,function(r){r[e][t].ease=n}))},Il.delay=function(n){var t=this.id,e=this.namespace;return arguments.length<1?this.node()[e][t].delay:Y(this,"function"==typeof n?function(r,u,i){r[e][t].delay=+n.call(r,r.__data__,u,i)}:(n=+n,function(r){r[e][t].delay=n}))},Il.duration=function(n){var t=this.id,e=this.namespace;return arguments.length<1?this.node()[e][t].duration:Y(this,"function"==typeof n?function(r,u,i){r[e][t].duration=Math.max(1,n.call(r,r.__data__,u,i))}:(n=Math.max(1,n),function(r){r[e][t].duration=n}))},Il.each=function(n,t){var e=this.id,r=this.namespace;if(arguments.length<2){var u=Hl,i=Fl;try{Fl=e,Y(this,function(t,u,i){Hl=t[r][e],n.call(t,t.__data__,u,i)})}finally{Hl=u,Fl=i}}else Y(this,function(u){var i=u[r][e];(i.event||(i.event=oa.dispatch("start","end","interrupt"))).on(n,t)});return this},Il.transition=function(){for(var n,t,e,r,u=this.id,i=++Yl,a=this.namespace,o=[],l=0,c=this.length;c>l;l++){o.push(n=[]);for(var t=this[l],s=0,f=t.length;f>s;s++)(e=t[s])&&(r=e[a][u],Qi(e,s,a,i,{time:r.time,ease:r.ease,delay:r.delay+r.duration,duration:r.duration})),n.push(e)}return Wi(o,a,i)},oa.svg.axis=function(){function n(n){n.each(function(){var n,c=oa.select(this),s=this.__chart__||e,f=this.__chart__=e.copy(),h=null==l?f.ticks?f.ticks.apply(f,o):f.domain():l,g=null==t?f.tickFormat?f.tickFormat.apply(f,o):y:t,p=c.selectAll(".tick").data(h,f),v=p.enter().insert("g",".domain").attr("class","tick").style("opacity",Da),d=oa.transition(p.exit()).style("opacity",Da).remove(),m=oa.transition(p.order()).style("opacity",1),M=Math.max(u,0)+a,x=Zu(f),b=c.selectAll(".domain").data([0]),_=(b.enter().append("path").attr("class","domain"),oa.transition(b));v.append("line"),v.append("text");var w,S,k,N,E=v.select("line"),A=m.select("line"),C=p.select("text").text(g),z=v.select("text"),L=m.select("text"),q="top"===r||"left"===r?-1:1;if("bottom"===r||"top"===r?(n=na,w="x",k="y",S="x2",N="y2",C.attr("dy",0>q?"0em":".71em").style("text-anchor","middle"),_.attr("d","M"+x[0]+","+q*i+"V0H"+x[1]+"V"+q*i)):(n=ta,w="y",k="x",S="y2",N="x2",C.attr("dy",".32em").style("text-anchor",0>q?"end":"start"),_.attr("d","M"+q*i+","+x[0]+"H0V"+x[1]+"H"+q*i)),E.attr(N,q*u),z.attr(k,q*M),A.attr(S,0).attr(N,q*u),L.attr(w,0).attr(k,q*M),f.rangeBand){var T=f,R=T.rangeBand()/2;s=f=function(n){return T(n)+R}}else s.rangeBand?s=f:d.call(n,f,s);v.call(n,s,f),m.call(n,f,f)})}var t,e=oa.scale.linear(),r=Zl,u=6,i=6,a=3,o=[10],l=null;return n.scale=function(t){return arguments.length?(e=t,n):e},n.orient=function(t){return arguments.length?(r=t in Vl?t+"":Zl,n):r},n.ticks=function(){return arguments.length?(o=ca(arguments),n):o},n.tickValues=function(t){return arguments.length?(l=t,n):l},n.tickFormat=function(e){return arguments.length?(t=e,n):t},n.tickSize=function(t){var e=arguments.length;return e?(u=+t,i=+arguments[e-1],n):u},n.innerTickSize=function(t){return arguments.length?(u=+t,n):u},n.outerTickSize=function(t){return arguments.length?(i=+t,n):i},n.tickPadding=function(t){return arguments.length?(a=+t,n):a},n.tickSubdivide=function(){return arguments.length&&n},n};var Zl="bottom",Vl={top:1,right:1,bottom:1,left:1};oa.svg.brush=function(){function n(t){t.each(function(){var t=oa.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",i).on("touchstart.brush",i),a=t.selectAll(".background").data([0]);a.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),t.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var o=t.selectAll(".resize").data(v,y);o.exit().remove(),o.enter().append("g").attr("class",function(n){return"resize "+n}).style("cursor",function(n){return Xl[n]}).append("rect").attr("x",function(n){return/[ew]$/.test(n)?-3:null}).attr("y",function(n){return/^[ns]/.test(n)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),o.style("display",n.empty()?"none":null);var l,f=oa.transition(t),h=oa.transition(a);c&&(l=Zu(c),h.attr("x",l[0]).attr("width",l[1]-l[0]),r(f)),s&&(l=Zu(s),h.attr("y",l[0]).attr("height",l[1]-l[0]),u(f)),e(f)})}function e(n){n.selectAll(".resize").attr("transform",function(n){return"translate("+f[+/e$/.test(n)]+","+h[+/^s/.test(n)]+")"})}function r(n){n.select(".extent").attr("x",f[0]),n.selectAll(".extent,.n>rect,.s>rect").attr("width",f[1]-f[0])}function u(n){n.select(".extent").attr("y",h[0]),n.selectAll(".extent,.e>rect,.w>rect").attr("height",h[1]-h[0])}function i(){function i(){32==oa.event.keyCode&&(C||(M=null,L[0]-=f[1],L[1]-=h[1],C=2),S())}function v(){32==oa.event.keyCode&&2==C&&(L[0]+=f[1],L[1]+=h[1],C=0,S())}function d(){var n=oa.mouse(b),t=!1;x&&(n[0]+=x[0],n[1]+=x[1]),C||(oa.event.altKey?(M||(M=[(f[0]+f[1])/2,(h[0]+h[1])/2]),L[0]=f[+(n[0]s?(u=r,r=s):u=s),v[0]!=r||v[1]!=u?(e?o=null:a=null,v[0]=r,v[1]=u,!0):void 0}function y(){d(),k.style("pointer-events","all").selectAll(".resize").style("display",n.empty()?"none":null),oa.select("body").style("cursor",null),q.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),z(),w({type:"brushend"})}var M,x,b=this,_=oa.select(oa.event.target),w=l.of(b,arguments),k=oa.select(b),N=_.datum(),E=!/^(n|s)$/.test(N)&&c,A=!/^(e|w)$/.test(N)&&s,C=_.classed("extent"),z=W(b),L=oa.mouse(b),q=oa.select(t(b)).on("keydown.brush",i).on("keyup.brush",v);if(oa.event.changedTouches?q.on("touchmove.brush",d).on("touchend.brush",y):q.on("mousemove.brush",d).on("mouseup.brush",y),k.interrupt().selectAll("*").interrupt(),C)L[0]=f[0]-L[0],L[1]=h[0]-L[1];else if(N){var T=+/w$/.test(N),R=+/^n/.test(N);x=[f[1-T]-L[0],h[1-R]-L[1]],L[0]=f[T],L[1]=h[R]}else oa.event.altKey&&(M=L.slice());k.style("pointer-events","none").selectAll(".resize").style("display",null),oa.select("body").style("cursor",_.style("cursor")),w({type:"brushstart"}),d()}var a,o,l=N(n,"brushstart","brush","brushend"),c=null,s=null,f=[0,0],h=[0,0],g=!0,p=!0,v=$l[0];return n.event=function(n){n.each(function(){var n=l.of(this,arguments),t={x:f,y:h,i:a,j:o},e=this.__chart__||t;this.__chart__=t,Fl?oa.select(this).transition().each("start.brush",function(){a=e.i,o=e.j,f=e.x,h=e.y,n({type:"brushstart"})}).tween("brush:brush",function(){var e=xr(f,t.x),r=xr(h,t.y);return a=o=null,function(u){f=t.x=e(u),h=t.y=r(u),n({type:"brush",mode:"resize"})}}).each("end.brush",function(){a=t.i,o=t.j,n({type:"brush",mode:"resize"}),n({type:"brushend"})}):(n({type:"brushstart"}),n({type:"brush",mode:"resize"}),n({type:"brushend"}))})},n.x=function(t){return arguments.length?(c=t,v=$l[!c<<1|!s],n):c},n.y=function(t){return arguments.length?(s=t,v=$l[!c<<1|!s],n):s},n.clamp=function(t){return arguments.length?(c&&s?(g=!!t[0],p=!!t[1]):c?g=!!t:s&&(p=!!t),n):c&&s?[g,p]:c?g:s?p:null},n.extent=function(t){var e,r,u,i,l;return arguments.length?(c&&(e=t[0],r=t[1],s&&(e=e[0],r=r[0]),a=[e,r],c.invert&&(e=c(e),r=c(r)),e>r&&(l=e,e=r,r=l),(e!=f[0]||r!=f[1])&&(f=[e,r])),s&&(u=t[0],i=t[1],c&&(u=u[1],i=i[1]),o=[u,i],s.invert&&(u=s(u),i=s(i)),u>i&&(l=u,u=i,i=l),(u!=h[0]||i!=h[1])&&(h=[u,i])),n):(c&&(a?(e=a[0],r=a[1]):(e=f[0],r=f[1],c.invert&&(e=c.invert(e),r=c.invert(r)),e>r&&(l=e,e=r,r=l))),s&&(o?(u=o[0],i=o[1]):(u=h[0],i=h[1],s.invert&&(u=s.invert(u),i=s.invert(i)),u>i&&(l=u,u=i,i=l))),c&&s?[[e,u],[r,i]]:c?[e,r]:s&&[u,i])},n.clear=function(){return n.empty()||(f=[0,0],h=[0,0],a=o=null),n},n.empty=function(){return!!c&&f[0]==f[1]||!!s&&h[0]==h[1]},oa.rebind(n,l,"on")};var Xl={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},$l=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],Bl=ho.format=Mo.timeFormat,Wl=Bl.utc,Jl=Wl("%Y-%m-%dT%H:%M:%S.%LZ");Bl.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?ea:Jl,ea.parse=function(n){var t=new Date(n);return isNaN(t)?null:t},ea.toString=Jl.toString,ho.second=On(function(n){return new go(1e3*Math.floor(n/1e3))},function(n,t){n.setTime(n.getTime()+1e3*Math.floor(t))},function(n){return n.getSeconds()}),ho.seconds=ho.second.range,ho.seconds.utc=ho.second.utc.range,ho.minute=On(function(n){return new go(6e4*Math.floor(n/6e4))},function(n,t){n.setTime(n.getTime()+6e4*Math.floor(t))},function(n){return n.getMinutes()}),ho.minutes=ho.minute.range,ho.minutes.utc=ho.minute.utc.range,ho.hour=On(function(n){var t=n.getTimezoneOffset()/60;return new go(36e5*(Math.floor(n/36e5-t)+t))},function(n,t){n.setTime(n.getTime()+36e5*Math.floor(t))},function(n){return n.getHours()}),ho.hours=ho.hour.range,ho.hours.utc=ho.hour.utc.range,ho.month=On(function(n){return n=ho.day(n),n.setDate(1),n},function(n,t){n.setMonth(n.getMonth()+t)},function(n){return n.getMonth()}),ho.months=ho.month.range,ho.months.utc=ho.month.utc.range;var Gl=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Kl=[[ho.second,1],[ho.second,5],[ho.second,15],[ho.second,30],[ho.minute,1],[ho.minute,5],[ho.minute,15],[ho.minute,30],[ho.hour,1],[ho.hour,3],[ho.hour,6],[ho.hour,12],[ho.day,1],[ho.day,2],[ho.week,1],[ho.month,1],[ho.month,3],[ho.year,1]],Ql=Bl.multi([[".%L",function(n){return n.getMilliseconds()}],[":%S",function(n){return n.getSeconds()}],["%I:%M",function(n){return n.getMinutes()}],["%I %p",function(n){return n.getHours()}],["%a %d",function(n){return n.getDay()&&1!=n.getDate()}],["%b %d",function(n){return 1!=n.getDate()}],["%B",function(n){return n.getMonth()}],["%Y",zt]]),nc={range:function(n,t,e){return oa.range(Math.ceil(n/e)*e,+t,e).map(ua)},floor:y,ceil:y};Kl.year=ho.year,ho.scale=function(){return ra(oa.scale.linear(),Kl,Ql)};var tc=Kl.map(function(n){return[n[0].utc,n[1]]}),ec=Wl.multi([[".%L",function(n){return n.getUTCMilliseconds()}],[":%S",function(n){return n.getUTCSeconds()}],["%I:%M",function(n){return n.getUTCMinutes()}],["%I %p",function(n){return n.getUTCHours()}],["%a %d",function(n){return n.getUTCDay()&&1!=n.getUTCDate()}],["%b %d",function(n){return 1!=n.getUTCDate()}],["%B",function(n){return n.getUTCMonth()}],["%Y",zt]]);tc.year=ho.year.utc,ho.scale.utc=function(){return ra(oa.scale.linear(),tc,ec)},oa.text=An(function(n){return n.responseText}),oa.json=function(n,t){return Cn(n,"application/json",ia,t)},oa.html=function(n,t){return Cn(n,"text/html",aa,t)},oa.xml=An(function(n){return n.responseXML}),"function"==typeof define&&define.amd?(this.d3=oa,define(oa)):"object"==typeof module&&module.exports?module.exports=oa:this.d3=oa}(); \ No newline at end of file diff --git a/web/js/easyctf.js b/web/js/easyctf.js deleted file mode 100644 index de1d7e4..0000000 --- a/web/js/easyctf.js +++ /dev/null @@ -1,423 +0,0 @@ -var app = angular.module("easyctf", [ "ngRoute" ]); - -app.config(["$compileProvider", function($compileProvider) { - $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|javascript):/); -}]); -app.config(function($routeProvider, $locationProvider) { - $routeProvider.when("/", { - templateUrl: "pages/home.html", - controller: "mainController" - }) - .when("/about", { - templateUrl: "pages/about.html", - controller: "mainController" - }) - .when("/chat", { - templateUrl: "pages/chat.html", - controller: "mainController" - }) - .when("/learn", { - templateUrl: "pages/learn.html", - controller: "mainController" - }) - .when("/login", { - templateUrl: "pages/login.html", - controller: "mainController" - }) - .when("/logout", { - templateUrl: "pages/blank.html", - controller: "logoutController" - }) - .when("/profile", { - templateUrl: "pages/profile.html", - controller: "profileController" - }) - .when("/profile/:username", { - templateUrl: "pages/profile.html", - controller: "profileController" - }) - .when("/register", { - templateUrl: "pages/register.html", - controller: "mainController" - }) - .when("/scoreboard", { - templateUrl: "pages/scoreboard.html", - controller: "scoreboardController" - }) - .when("/settings", { - templateUrl: "pages/settings.html", - controller: "settingsController" - }) - .when("/forgot", { - templateUrl: "pages/forgot.html", - controller: "resetController" - }) - .when("/forgot/:token", { - templateUrl: "pages/forgot.html", - controller: "resetController" - }) - .when("/team", { - templateUrl: "pages/team.html", - controller: "teamController" - }) - .when("/team/:teamname", { - templateUrl: "pages/team.html", - controller: "teamController" - }) - .when("/admin/problems", { - templateUrl: "pages/admin/problems.html", - controller: "adminProblemsController" - }) - .otherwise({ - templateUrl: "pages/404.html", - controller: "mainController" - }); - $locationProvider.html5Mode(true); -}); - -function api_call(method, url, data, callback_success, callback_fail) { - if (method.toLowerCase() == "post") { - data["csrf_token"] = $.cookie("csrf_token"); - } - $.ajax({ - "type": method, - "datatype": "json", - "data": data, - "url": url, - "cache": false - }).done(callback_success).fail(callback_fail); -} - -function permanent_message(containerId, alertType, message, callback) { - $("#" + containerId).html("
    " + message + "
    "); - $("#" + containerId).hide().slideDown("fast", "swing"); -}; - -function display_message(containerId, alertType, message, callback) { - $("#" + containerId).html("
    " + message + "
    "); - $("#" + containerId).hide().slideDown("fast", "swing", function() { - window.setTimeout(function () { - $("#" + containerId).slideUp("fast", "swing", callback); - }, message.length * 55); - }); -}; - -app.controller("mainController", ["$scope", "$http", function($scope, $http) { - $scope.config = { navbar: { } }; - $scope.timestamp = Date.now(); - api_call("GET", "/api/user/status", {}, function(result) { - if (result["success"] == 1) { - delete result["success"]; - $scope.config.navbar = result; - $scope.$emit("loginStatus"); - } else { - $scope.config.navbar.logged_in = false; - } - $scope.$apply(); - }, function() { - $scope.config.navbar.logged_in = false; - $scope.$apply(); - permanent_message("site-message", "danger", "
    The EasyCTF API server is currently down. We're working to fix this error right away. Follow @easyctf for status updates.
    "); - }); -}]); - -app.controller("logoutController", function() { - api_call("GET", "/api/user/logout", {}, function(result) { - location.href = "/"; - }); -}); - -app.controller("profileController", ["$controller", "$scope", "$http", "$routeParams", function($controller, $scope, $http, $routeParams) { - var data = { }; - if ("username" in $routeParams) data["username"] = $routeParams["username"]; - $controller("mainController", { $scope: $scope }); - api_call("GET", "/api/user/info", data, function(result) { - if (result["success"] == 1) { - $scope.user = result["user"]; - } - $scope.$apply(); - $(".timeago").timeago(); - }); -}]); - -app.controller("loginController", ["$controller", "$scope", "$http", function($controller, $scope, $http) { - $controller("mainController", { $scope: $scope }); - $scope.$on("loginStatus", function() { - if ($scope.config["navbar"].logged_in != true) { - location.href = "/login"; - return; - } - }); -}]); - -app.controller("teamController", ["$controller", "$scope", "$http", "$routeParams", function($controller, $scope, $http, $routeParams) { - var data = { }; - if ("teamname" in $routeParams) { - data["teamname"] = $routeParams["teamname"]; - } else { - $controller("loginController", { $scope: $scope }); - } - api_call("GET", "/api/team/info", data, function(result) { - if (result["success"] == 1) { - $scope.team = result["team"]; - } - $scope.$apply(); - $(".timeago").timeago(); - }); -}]); - -app.controller("scoreboardController", ["$controller", "$scope", "$http", function($controller, $scope, $http) { - $controller("mainController", { $scope: $scope }); - api_call("GET", "/api/stats/scoreboard", { }, function(result) { - if (result["success"] == 1) { - $scope.scoreboard = result["scoreboard"]; - $scope.$apply(); - } - }); -}]); - -app.controller("resetController", ["$controller", "$scope", "$http", "$routeParams", function($controller, $scope, $http, $routeParams) { - var data = { }; - $scope.token = false; - data["csrf_token"] = $.cookie("csrf_token"); - if ("token" in $routeParams) { - $scope.token = true; - token = $routeParams["token"]; - api_call("GET", "/api/user/forgot/" + token, data, function(data) { - $scope.body = data["message"]; - $scope.success = data["success"] - $scope.$apply(); - }); - } else { - $controller("mainController", { $scope: $scope }); - } -}]); - -app.controller("adminController", ["$controller", "$scope", "$http", function($controller, $scope, $http) { - $controller("mainController", { $scope: $scope }); - $scope.$on("loginStatus", function() { - if ($scope.config["navbar"].logged_in != true) { - location.href = "/login"; - return; - } - if ($scope.config["navbar"].admin != true) { - location.href = "/profile"; - return; - } - }); -}]); - -app.controller("adminProblemsController", ["$controller", "$scope", "$http", function($controller, $scope, $http) { - $controller("adminController", { $scope: $scope }); - api_call("GET", "/api/admin/problems/list", {}, function(result) { - if (result["success"] == 1) { - $scope.problems = result["problems"]; - } else { - $scope.problems = []; - } - $scope.$apply(); - }); -}]); - -app.controller("settingsController", ["$controller", "$scope", "$http", function($controller, $scope, $http) { - $controller("loginController", { $scope: $scope }); - api_call("GET", "/api/user/info", {}, function(result) { - if (result["success"] == 1) { - $scope.user = result["user"]; - } - $scope.$apply(); - }); -}]); - -$.fn.serializeObject = function() { - var a, o; - o = {}; - a = this.serializeArray(); - $.each(a, function() { - if (o[this.name]) { - if (!o[this.name].push) { - o[this.name] = [o[this.name]]; - } - return o[this.name].push(this.value || ""); - } else { - return o[this.name] = this.value || ""; - } - }); - return o; -}; - -// register page - -var register_form = function() { - var input = "#register_form input"; - var data = $("#register_form").serializeObject(); - $(input).attr("disabled", "disabled"); - api_call("POST", "/api/user/register", data, function(result) { - if (result["success"] == 1) { - location.href = "/profile"; - } else { - display_message("register_msg", "danger", result["message"], function() { - $(input).removeAttr("disabled"); - }); - } - }, function(jqXHR, status, error) { - var result = jqXHR["responseText"]; - display_message("register_msg", "danger", "Error " + jqXHR["status"] + ": " + result["message"], function() { - $(input).removeAttr("disabled"); - }); - }); -}; - -// password reset -var request_reset_form = function() { - var data = $("#request_reset_form").serializeObject(); - $(input).attr("disabled", "disabled"); - api_call("POST", "/api/user/forgot", data, function(result) { - if (result["success"] == 1) { - display_message("reset_msg", "success", result["message"]); - } else { - display_message("reset_msg", "danger", result["message"], function() { - $(input).removeAttr("disabled"); - }); - } - }, function(jqXHR, status, error) { - var result = jqXHR["responseText"]; - display_message("reset_msg", "danger", "Error " + jqXHR["status"] + ": " + result["message"], function() { - $(input).removeAttr("disabled"); - }); - }); -} - -var reset_form = function() { - var data = $("#reset_form").serializeObject(); - data["csrf_token"] = $.cookie("csrf_token"); - var url = window.location.href; - var token = url.substr(url.lastIndexOf("/")+1); - $(input).attr("disabled", "disabled"); - api_call("POST", "/api/user/forgot/" + token, data, function(result) { - if (result["success"] == 1) { - display_message("reset_msg", "success", result["message"], function() { - location.href = "/login"; - }); - } else { - display_message("reset_msg", "danger", result["message"], function() { - $(input).removeAttr("disabled"); - }); - } - }, function(jqXHR, status, error) { - var result = jqXHR["responseText"]; - display_message("reset_msg", "danger", "Error " + jqXHR["status"] + ": " + result["message"], function() { - $(input).removeAttr("disabled"); - }); - }); -} - -// login page - -var login_form = function() { - var input = "#login_form input"; - var data = $("#login_form").serializeObject(); - $(input).attr("disabled", "disabled"); - api_call("POST", "/api/user/login", data, function(result) { - if (result["success"] == 1) { - location.href = "/profile"; - } else { - display_message("login_msg", "danger", result["message"], function() { - $(input).removeAttr("disabled"); - }); - } - }, function(jqXHR, status, error) { - var result = jqXHR["responseText"]; - display_message("login_msg", "danger", "Error " + jqXHR["status"] + ": " + result["message"], function() { - $(input).removeAttr("disabled"); - }); - }); -}; - -// team page - -var create_team = function() { - var input = "#create_team input"; - var data = $("#create_team").serializeObject(); - $(input).attr("disabled", "disabled"); - api_call("POST", "/api/team/create", data, function(result) { - if (result["success"] == 1) { - location.reload(true); - } else { - display_message("create_team_msg", "danger", result["message"], function() { - $(input).removeAttr("disabled"); - }); - } - }, function(jqXHR, status, error) { - var result = JSON.parse(jqXHR["responseText"]); - display_message("create_team_msg", "danger", "Error " + jqXHR["status"] + ": " + result["message"], function() { - $(input).removeAttr("disabled"); - }); - }); -}; - -var add_member = function() { - var input = "#add_member input"; - var data = $("#add_member").serializeObject(); - $(input).attr("disabled", "disabled"); - api_call("POST", "/api/team/invite", data, function(result) { - if (result["success"] == 1) { - location.reload(true); - } else { - $(input).removeAttr("disabled"); - } - }, function(jqXHR, status, error) { - var result = JSON.parse(jqXHR["responseText"]); - display_message("create_team_msg", "danger", "Error " + jqXHR["status"] + ": " + result["message"], function() { - $(input).removeAttr("disabled"); - }); - }); -}; - -var rescind_invitation = function(uid) { - var input = "#add_member input"; - var data = { "uid": uid }; - api_call("POST", "/api/team/invite/rescind", data, function(result) { - if (result["success"] == 1) { - location.reload(true); - } - }); -}; - -var request_invitation = function(tid) { - var input = "#add_member input"; - var data = { "tid": tid }; - api_call("POST", "/api/team/invite/request", data, function(result) { - if (result["success"] == 1) { - location.reload(true); - } - }); -}; - -var accept_invitation = function(tid) { - var data = { "tid": tid }; - api_call("POST", "/api/team/invite/accept", data, function(result) { - if (result["success"] == 1) { - location.reload(true); - } - }); -}; - -var accept_invitation_request = function(uid) { - var data = { "uid": uid }; - api_call("POST", "/api/team/invite/request/accept", data, function(result) { - if (result["success"] == 1) { - location.reload(true); - } - }); -}; - -// settings page - -var remove_profile_picture = function() { - api_call("POST", "/api/user/avatar/remove", { }, function(result) { - if (result["success"] == 1) { - location.reload(true); - } - }); -}; \ No newline at end of file diff --git a/web/js/epiceditor.js b/web/js/epiceditor.js deleted file mode 100644 index befaf54..0000000 --- a/web/js/epiceditor.js +++ /dev/null @@ -1,2899 +0,0 @@ -/** - * EpicEditor - An Embeddable JavaScript Markdown Editor (https://github.com/OscarGodson/EpicEditor) - * Copyright (c) 2011-2012, Oscar Godson. (MIT Licensed) - */ - -(function (window, undefined) { - /** - * Applies attributes to a DOM object - * @param {object} context The DOM obj you want to apply the attributes to - * @param {object} attrs A key/value pair of attributes you want to apply - * @returns {undefined} - */ - function _applyAttrs(context, attrs) { - for (var attr in attrs) { - if (attrs.hasOwnProperty(attr)) { - context[attr] = attrs[attr]; - } - } - } - - /** - * Applies styles to a DOM object - * @param {object} context The DOM obj you want to apply the attributes to - * @param {object} attrs A key/value pair of attributes you want to apply - * @returns {undefined} - */ - function _applyStyles(context, attrs) { - for (var attr in attrs) { - if (attrs.hasOwnProperty(attr)) { - context.style[attr] = attrs[attr]; - } - } - } - - /** - * Returns a DOM objects computed style - * @param {object} el The element you want to get the style from - * @param {string} styleProp The property you want to get from the element - * @returns {string} Returns a string of the value. If property is not set it will return a blank string - */ - function _getStyle(el, styleProp) { - var x = el - , y = null; - if (window.getComputedStyle) { - y = document.defaultView.getComputedStyle(x, null).getPropertyValue(styleProp); - } - else if (x.currentStyle) { - y = x.currentStyle[styleProp]; - } - return y; - } - - /** - * Saves the current style state for the styles requested, then applies styles - * to overwrite the existing one. The old styles are returned as an object so - * you can pass it back in when you want to revert back to the old style - * @param {object} el The element to get the styles of - * @param {string} type Can be "save" or "apply". apply will just apply styles you give it. Save will write styles - * @param {object} styles Key/value style/property pairs - * @returns {object} - */ - function _saveStyleState(el, type, styles) { - var returnState = {} - , style; - if (type === 'save') { - for (style in styles) { - if (styles.hasOwnProperty(style)) { - returnState[style] = _getStyle(el, style); - } - } - // After it's all done saving all the previous states, change the styles - _applyStyles(el, styles); - } - else if (type === 'apply') { - _applyStyles(el, styles); - } - return returnState; - } - - /** - * Gets an elements total width including it's borders and padding - * @param {object} el The element to get the total width of - * @returns {int} - */ - function _outerWidth(el) { - var b = parseInt(_getStyle(el, 'border-left-width'), 10) + parseInt(_getStyle(el, 'border-right-width'), 10) - , p = parseInt(_getStyle(el, 'padding-left'), 10) + parseInt(_getStyle(el, 'padding-right'), 10) - , w = el.offsetWidth - , t; - // For IE in case no border is set and it defaults to "medium" - if (isNaN(b)) { b = 0; } - t = b + p + w; - return t; - } - - /** - * Gets an elements total height including it's borders and padding - * @param {object} el The element to get the total width of - * @returns {int} - */ - function _outerHeight(el) { - var b = parseInt(_getStyle(el, 'border-top-width'), 10) + parseInt(_getStyle(el, 'border-bottom-width'), 10) - , p = parseInt(_getStyle(el, 'padding-top'), 10) + parseInt(_getStyle(el, 'padding-bottom'), 10) - , w = parseInt(_getStyle(el, 'height'), 10) - , t; - // For IE in case no border is set and it defaults to "medium" - if (isNaN(b)) { b = 0; } - t = b + p + w; - return t; - } - - /** - * Inserts a tag specifically for CSS - * @param {string} path The path to the CSS file - * @param {object} context In what context you want to apply this to (document, iframe, etc) - * @param {string} id An id for you to reference later for changing properties of the - * @returns {undefined} - */ - function _insertCSSLink(path, context, id) { - id = id || ''; - var headID = context.getElementsByTagName("head")[0] - , cssNode = context.createElement('link'); - - _applyAttrs(cssNode, { - type: 'text/css' - , id: id - , rel: 'stylesheet' - , href: path - , name: path - , media: 'screen' - }); - - headID.appendChild(cssNode); - } - - // Simply replaces a class (o), to a new class (n) on an element provided (e) - function _replaceClass(e, o, n) { - e.className = e.className.replace(o, n); - } - - // Feature detects an iframe to get the inner document for writing to - function _getIframeInnards(el) { - return el.contentDocument || el.contentWindow.document; - } - - // Grabs the text from an element and preserves whitespace - function _getText(el) { - var theText; - // Make sure to check for type of string because if the body of the page - // doesn't have any text it'll be "" which is falsey and will go into - // the else which is meant for Firefox and shit will break - if (typeof document.body.innerText == 'string') { - theText = el.innerText; - } - else { - // First replace
    s before replacing the rest of the HTML - theText = el.innerHTML.replace(/
    /gi, "\n"); - // Now we can clean the HTML - theText = theText.replace(/<(?:.|\n)*?>/gm, ''); - // Now fix HTML entities - theText = theText.replace(/</gi, '<'); - theText = theText.replace(/>/gi, '>'); - } - return theText; - } - - function _setText(el, content) { - // Don't convert lt/gt characters as HTML when viewing the editor window - // TODO: Write a test to catch regressions for this - content = content.replace(//g, '>'); - content = content.replace(/\n/g, '
    '); - - // Make sure to there aren't two spaces in a row (replace one with  ) - // If you find and replace every space with a   text will not wrap. - // Hence the name (Non-Breaking-SPace). - // TODO: Probably need to test this somehow... - content = content.replace(/
    \s/g, '
     ') - content = content.replace(/\s\s\s/g, '   ') - content = content.replace(/\s\s/g, '  ') - content = content.replace(/^ /, ' ') - - el.innerHTML = content; - return true; - } - - /** - * Converts the 'raw' format of a file's contents into plaintext - * @param {string} content Contents of the file - * @returns {string} the sanitized content - */ - function _sanitizeRawContent(content) { - // Get this, 2 spaces in a content editable actually converts to: - // 0020 00a0, meaning, "space no-break space". So, manually convert - // no-break spaces to spaces again before handing to marked. - // Also, WebKit converts no-break to unicode equivalent and FF HTML. - return content.replace(/\u00a0/g, ' ').replace(/ /g, ' '); - } - - /** - * Will return the version number if the browser is IE. If not will return -1 - * TRY NEVER TO USE THIS AND USE FEATURE DETECTION IF POSSIBLE - * @returns {Number} -1 if false or the version number if true - */ - function _isIE() { - var rv = -1 // Return value assumes failure. - , ua = navigator.userAgent - , re; - if (navigator.appName == 'Microsoft Internet Explorer') { - re = /MSIE ([0-9]{1,}[\.0-9]{0,})/; - if (re.exec(ua) != null) { - rv = parseFloat(RegExp.$1, 10); - } - } - return rv; - } - - /** - * Same as the isIE(), but simply returns a boolean - * THIS IS TERRIBLE AND IS ONLY USED BECAUSE FULLSCREEN IN SAFARI IS BORKED - * If some other engine uses WebKit and has support for fullscreen they - * probably wont get native fullscreen until Safari's fullscreen is fixed - * @returns {Boolean} true if Safari - */ - function _isSafari() { - var n = window.navigator; - return n.userAgent.indexOf('Safari') > -1 && n.userAgent.indexOf('Chrome') == -1; - } - - /** - * Same as the isIE(), but simply returns a boolean - * THIS IS TERRIBLE ONLY USE IF ABSOLUTELY NEEDED - * @returns {Boolean} true if Safari - */ - function _isFirefox() { - var n = window.navigator; - return n.userAgent.indexOf('Firefox') > -1 && n.userAgent.indexOf('Seamonkey') == -1; - } - - /** - * Determines if supplied value is a function - * @param {object} object to determine type - */ - function _isFunction(functionToCheck) { - var getType = {}; - return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]'; - } - - /** - * Overwrites obj1's values with obj2's and adds obj2's if non existent in obj1 - * @param {boolean} [deepMerge=false] If true, will deep merge meaning it will merge sub-objects like {obj:obj2{foo:'bar'}} - * @param {object} first object - * @param {object} second object - * @returnss {object} a new object based on obj1 and obj2 - */ - function _mergeObjs() { - // copy reference to target object - var target = arguments[0] || {} - , i = 1 - , length = arguments.length - , deep = false - , options - , name - , src - , copy - - // Handle a deep copy situation - if (typeof target === "boolean") { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } - - // Handle case when target is a string or something (possible in deep copy) - if (typeof target !== "object" && !_isFunction(target)) { - target = {}; - } - // extend jQuery itself if only one argument is passed - if (length === i) { - target = this; - --i; - } - - for (; i < length; i++) { - // Only deal with non-null/undefined values - if ((options = arguments[i]) != null) { - // Extend the base object - for (name in options) { - // @NOTE: added hasOwnProperty check - if (options.hasOwnProperty(name)) { - src = target[name]; - copy = options[name]; - // Prevent never-ending loop - if (target === copy) { - continue; - } - // Recurse if we're merging object values - if (deep && copy && typeof copy === "object" && !copy.nodeType) { - target[name] = _mergeObjs(deep, - // Never move original objects, clone them - src || (copy.length != null ? [] : {}) - , copy); - } else if (copy !== undefined) { // Don't bring in undefined values - target[name] = copy; - } - } - } - } - } - - // Return the modified object - return target; - } - - /** - * Initiates the EpicEditor object and sets up offline storage as well - * @class Represents an EpicEditor instance - * @param {object} options An optional customization object - * @returns {object} EpicEditor will be returned - */ - function EpicEditor(options) { - // Default settings will be overwritten/extended by options arg - var self = this - , opts = options || {} - , _defaultFileSchema - , _defaultFile - , defaults = { container: 'epiceditor' - , basePath: 'epiceditor' - , textarea: undefined - , clientSideStorage: true - , localStorageName: 'epiceditor' - , useNativeFullscreen: true - , file: { name: null - , defaultContent: '' - , autoSave: 100 // Set to false for no auto saving - } - , theme: { base: '/themes/base/epiceditor.css' - , preview: '/themes/preview/github.css' - , editor: '/themes/editor/epic-dark.css' - } - , focusOnLoad: false - , shortcut: { modifier: 18 // alt keycode - , fullscreen: 70 // f keycode - , preview: 80 // p keycode - } - , string: { togglePreview: 'Toggle Preview Mode' - , toggleEdit: 'Toggle Edit Mode' - , toggleFullscreen: 'Enter Fullscreen' - } - , parser: typeof marked == 'function' ? marked : null - , autogrow: false - , button: { fullscreen: true - , preview: true - , bar: "auto" - } - } - , defaultStorage - , autogrowDefaults = { minHeight: 80 - , maxHeight: false - , scroll: true - }; - - self.settings = _mergeObjs(true, defaults, opts); - - var buttons = self.settings.button; - self._fullscreenEnabled = typeof(buttons) === 'object' ? typeof buttons.fullscreen === 'undefined' || buttons.fullscreen : buttons === true; - self._editEnabled = typeof(buttons) === 'object' ? typeof buttons.edit === 'undefined' || buttons.edit : buttons === true; - self._previewEnabled = typeof(buttons) === 'object' ? typeof buttons.preview === 'undefined' || buttons.preview : buttons === true; - - if (!(typeof self.settings.parser == 'function' && typeof self.settings.parser('TEST') == 'string')) { - self.settings.parser = function (str) { - return str; - } - } - - if (self.settings.autogrow) { - if (self.settings.autogrow === true) { - self.settings.autogrow = autogrowDefaults; - } - else { - self.settings.autogrow = _mergeObjs(true, autogrowDefaults, self.settings.autogrow); - } - self._oldHeight = -1; - } - - // If you put an absolute link as the path of any of the themes ignore the basePath - // preview theme - if (!self.settings.theme.preview.match(/^https?:\/\//)) { - self.settings.theme.preview = self.settings.basePath + self.settings.theme.preview; - } - // editor theme - if (!self.settings.theme.editor.match(/^https?:\/\//)) { - self.settings.theme.editor = self.settings.basePath + self.settings.theme.editor; - } - // base theme - if (!self.settings.theme.base.match(/^https?:\/\//)) { - self.settings.theme.base = self.settings.basePath + self.settings.theme.base; - } - - // Grab the container element and save it to self.element - // if it's a string assume it's an ID and if it's an object - // assume it's a DOM element - if (typeof self.settings.container == 'string') { - self.element = document.getElementById(self.settings.container); - } - else if (typeof self.settings.container == 'object') { - self.element = self.settings.container; - } - - // Figure out the file name. If no file name is given we'll use the ID. - // If there's no ID either we'll use a namespaced file name that's incremented - // based on the calling order. As long as it doesn't change, drafts will be saved. - if (!self.settings.file.name) { - if (typeof self.settings.container == 'string') { - self.settings.file.name = self.settings.container; - } - else if (typeof self.settings.container == 'object') { - if (self.element.id) { - self.settings.file.name = self.element.id; - } - else { - if (!EpicEditor._data.unnamedEditors) { - EpicEditor._data.unnamedEditors = []; - } - EpicEditor._data.unnamedEditors.push(self); - self.settings.file.name = '__epiceditor-untitled-' + EpicEditor._data.unnamedEditors.length; - } - } - } - - if (self.settings.button.bar === "show") { - self.settings.button.bar = true; - } - - if (self.settings.button.bar === "hide") { - self.settings.button.bar = false; - } - - // Protect the id and overwrite if passed in as an option - // TODO: Put underscrore to denote that this is private - self._instanceId = 'epiceditor-' + Math.round(Math.random() * 100000); - self._storage = {}; - self._canSave = true; - - // Setup local storage of files - self._defaultFileSchema = function () { - return { - content: self.settings.file.defaultContent - , created: new Date() - , modified: new Date() - } - } - - if (localStorage && self.settings.clientSideStorage) { - this._storage = localStorage; - if (this._storage[self.settings.localStorageName] && self.getFiles(self.settings.file.name) === undefined) { - _defaultFile = self._defaultFileSchema(); - _defaultFile.content = self.settings.file.defaultContent; - } - } - - if (!this._storage[self.settings.localStorageName]) { - defaultStorage = {}; - defaultStorage[self.settings.file.name] = self._defaultFileSchema(); - defaultStorage = JSON.stringify(defaultStorage); - this._storage[self.settings.localStorageName] = defaultStorage; - } - - // A string to prepend files with to save draft versions of files - // and reset all preview drafts on each load! - self._previewDraftLocation = '__draft-'; - self._storage[self._previewDraftLocation + self.settings.localStorageName] = self._storage[self.settings.localStorageName]; - - // This needs to replace the use of classes to check the state of EE - self._eeState = { - fullscreen: false - , preview: false - , edit: false - , loaded: false - , unloaded: false - } - - // Now that it exists, allow binding of events if it doesn't exist yet - if (!self.events) { - self.events = {}; - } - - return this; - } - - /** - * Inserts the EpicEditor into the DOM via an iframe and gets it ready for editing and previewing - * @returns {object} EpicEditor will be returned - */ - EpicEditor.prototype.load = function (callback) { - - // Get out early if it's already loaded - if (this.is('loaded')) { return this; } - - // TODO: Gotta get the privates with underscores! - // TODO: Gotta document what these are for... - var self = this - , _HtmlTemplates - , iframeElement - , baseTag - , utilBtns - , utilBar - , utilBarTimer - , keypressTimer - , mousePos = { y: -1, x: -1 } - , _elementStates - , _isInEdit - , nativeFs = false - , nativeFsWebkit = false - , nativeFsMoz = false - , nativeFsW3C = false - , fsElement - , isMod = false - , isCtrl = false - , eventableIframes - , i // i is reused for loops - , boundAutogrow; - - // Startup is a way to check if this EpicEditor is starting up. Useful for - // checking and doing certain things before EpicEditor emits a load event. - self._eeState.startup = true; - - if (self.settings.useNativeFullscreen) { - nativeFsWebkit = document.body.webkitRequestFullScreen ? true : false; - nativeFsMoz = document.body.mozRequestFullScreen ? true : false; - nativeFsW3C = document.body.requestFullscreen ? true : false; - nativeFs = nativeFsWebkit || nativeFsMoz || nativeFsW3C; - } - - // Fucking Safari's native fullscreen works terribly - // REMOVE THIS IF SAFARI 7 WORKS BETTER - if (_isSafari()) { - nativeFs = false; - nativeFsWebkit = false; - } - - // It opens edit mode by default (for now); - if (!self.is('edit') && !self.is('preview')) { - self._eeState.edit = true; - } - - callback = callback || function () {}; - - // The editor HTML - // TODO: edit-mode class should be dynamically added - _HtmlTemplates = { - // This is wrapping iframe element. It contains the other two iframes and the utilbar - chrome: '
    ' + - '' + - '' + - '
    ' + - (self._previewEnabled ? ' ' : '') + - (self._editEnabled ? ' ' : '') + - (self._fullscreenEnabled ? '' : '') + - '
    ' + - '
    ' - - // The previewer is just an empty box for the generated HTML to go into - , previewer: '
    ' - , editor: '' - }; - - // Write an iframe and then select it for the editor - self.element.innerHTML = ''; - - // Because browsers add things like invisible padding and margins and stuff - // to iframes, we need to set manually set the height so that the height - // doesn't keep increasing (by 2px?) every time reflow() is called. - // FIXME: Figure out how to fix this without setting this - self.element.style.height = self.element.offsetHeight + 'px'; - - iframeElement = document.getElementById(self._instanceId); - - // Store a reference to the iframeElement itself - self.iframeElement = iframeElement; - - // Grab the innards of the iframe (returns the document.body) - // TODO: Change self.iframe to self.iframeDocument - self.iframe = _getIframeInnards(iframeElement); - self.iframe.open(); - self.iframe.write(_HtmlTemplates.chrome); - - // Now that we got the innards of the iframe, we can grab the other iframes - self.editorIframe = self.iframe.getElementById('epiceditor-editor-frame') - self.previewerIframe = self.iframe.getElementById('epiceditor-previewer-frame'); - - // Setup the editor iframe - self.editorIframeDocument = _getIframeInnards(self.editorIframe); - self.editorIframeDocument.open(); - // Need something for... you guessed it, Firefox - self.editorIframeDocument.write(_HtmlTemplates.editor); - self.editorIframeDocument.close(); - - // Setup the previewer iframe - self.previewerIframeDocument = _getIframeInnards(self.previewerIframe); - self.previewerIframeDocument.open(); - self.previewerIframeDocument.write(_HtmlTemplates.previewer); - - // Base tag is added so that links will open a new tab and not inside of the iframes - baseTag = self.previewerIframeDocument.createElement('base'); - baseTag.target = '_blank'; - self.previewerIframeDocument.getElementsByTagName('head')[0].appendChild(baseTag); - - self.previewerIframeDocument.close(); - - self.reflow(); - - // Insert Base Stylesheet - _insertCSSLink(self.settings.theme.base, self.iframe, 'theme'); - - // Insert Editor Stylesheet - _insertCSSLink(self.settings.theme.editor, self.editorIframeDocument, 'theme'); - - // Insert Previewer Stylesheet - _insertCSSLink(self.settings.theme.preview, self.previewerIframeDocument, 'theme'); - - // Add a relative style to the overall wrapper to keep CSS relative to the editor - self.iframe.getElementById('epiceditor-wrapper').style.position = 'relative'; - - // Set the position to relative so we hide them with left: -999999px - self.editorIframe.style.position = 'absolute'; - self.previewerIframe.style.position = 'absolute'; - - // Now grab the editor and previewer for later use - self.editor = self.editorIframeDocument.body; - self.previewer = self.previewerIframeDocument.getElementById('epiceditor-preview'); - - self.editor.contentEditable = true; - - // Firefox's gets all fucked up so, to be sure, we need to hardcode it - self.iframe.body.style.height = this.element.offsetHeight + 'px'; - - // Should actually check what mode it's in! - self.previewerIframe.style.left = '-999999px'; - - // Keep long lines from being longer than the editor - this.editorIframeDocument.body.style.wordWrap = 'break-word'; - - // FIXME figure out why it needs +2 px - if (_isIE() > -1) { - this.previewer.style.height = parseInt(_getStyle(this.previewer, 'height'), 10) + 2; - } - - // If there is a file to be opened with that filename and it has content... - this.open(self.settings.file.name); - - if (self.settings.focusOnLoad) { - // We need to wait until all three iframes are done loading by waiting until the parent - // iframe's ready state == complete, then we can focus on the contenteditable - self.iframe.addEventListener('readystatechange', function () { - if (self.iframe.readyState == 'complete') { - self.focus(); - } - }); - } - - // Because IE scrolls the whole window to hash links, we need our own - // method of scrolling the iframe to an ID from clicking a hash - self.previewerIframeDocument.addEventListener('click', function (e) { - var el = e.target - , body = self.previewerIframeDocument.body; - if (el.nodeName == 'A') { - // Make sure the link is a hash and the link is local to the iframe - if (el.hash && el.hostname == window.location.hostname) { - // Prevent the whole window from scrolling - e.preventDefault(); - // Prevent opening a new window - el.target = '_self'; - // Scroll to the matching element, if an element exists - if (body.querySelector(el.hash)) { - body.scrollTop = body.querySelector(el.hash).offsetTop; - } - } - } - }); - - utilBtns = self.iframe.getElementById('epiceditor-utilbar'); - - // TODO: Move into fullscreen setup function (_setupFullscreen) - _elementStates = {} - self._goFullscreen = function (el) { - this._fixScrollbars('auto'); - - if (self.is('fullscreen')) { - self._exitFullscreen(el); - return; - } - - if (nativeFs) { - if (nativeFsWebkit) { - el.webkitRequestFullScreen(); - } - else if (nativeFsMoz) { - el.mozRequestFullScreen(); - } - else if (nativeFsW3C) { - el.requestFullscreen(); - } - } - - _isInEdit = self.is('edit'); - - // Set the state of EE in fullscreen - // We set edit and preview to true also because they're visible - // we might want to allow fullscreen edit mode without preview (like a "zen" mode) - self._eeState.fullscreen = true; - self._eeState.edit = true; - self._eeState.preview = true; - - // Cache calculations - var windowInnerWidth = window.innerWidth - , windowInnerHeight = window.innerHeight - , windowOuterWidth = window.outerWidth - , windowOuterHeight = window.outerHeight; - - // Without this the scrollbars will get hidden when scrolled to the bottom in faux fullscreen (see #66) - if (!nativeFs) { - windowOuterHeight = window.innerHeight; - } - - // This MUST come first because the editor is 100% width so if we change the width of the iframe or wrapper - // the editor's width wont be the same as before - _elementStates.editorIframe = _saveStyleState(self.editorIframe, 'save', { - 'width': windowOuterWidth / 2 + 'px' - , 'height': windowOuterHeight + 'px' - , 'float': 'left' // Most browsers - , 'cssFloat': 'left' // FF - , 'styleFloat': 'left' // Older IEs - , 'display': 'block' - , 'position': 'static' - , 'left': '' - }); - - // the previewer - _elementStates.previewerIframe = _saveStyleState(self.previewerIframe, 'save', { - 'width': windowOuterWidth / 2 + 'px' - , 'height': windowOuterHeight + 'px' - , 'float': 'right' // Most browsers - , 'cssFloat': 'right' // FF - , 'styleFloat': 'right' // Older IEs - , 'display': 'block' - , 'position': 'static' - , 'left': '' - }); - - // Setup the containing element CSS for fullscreen - _elementStates.element = _saveStyleState(self.element, 'save', { - 'position': 'fixed' - , 'top': '0' - , 'left': '0' - , 'width': '100%' - , 'z-index': '9999' // Most browsers - , 'zIndex': '9999' // Firefox - , 'border': 'none' - , 'margin': '0' - // Should use the base styles background! - , 'background': _getStyle(self.editor, 'background-color') // Try to hide the site below - , 'height': windowInnerHeight + 'px' - }); - - // The iframe element - _elementStates.iframeElement = _saveStyleState(self.iframeElement, 'save', { - 'width': windowOuterWidth + 'px' - , 'height': windowInnerHeight + 'px' - }); - - // ...Oh, and hide the buttons and prevent scrolling - utilBtns.style.visibility = 'hidden'; - - if (!nativeFs) { - document.body.style.overflow = 'hidden'; - } - - self.preview(); - - self.focus(); - - self.emit('fullscreenenter'); - }; - - self._exitFullscreen = function (el) { - this._fixScrollbars(); - - _saveStyleState(self.element, 'apply', _elementStates.element); - _saveStyleState(self.iframeElement, 'apply', _elementStates.iframeElement); - _saveStyleState(self.editorIframe, 'apply', _elementStates.editorIframe); - _saveStyleState(self.previewerIframe, 'apply', _elementStates.previewerIframe); - - // We want to always revert back to the original styles in the CSS so, - // if it's a fluid width container it will expand on resize and not get - // stuck at a specific width after closing fullscreen. - self.element.style.width = self._eeState.reflowWidth ? self._eeState.reflowWidth : ''; - self.element.style.height = self._eeState.reflowHeight ? self._eeState.reflowHeight : ''; - - utilBtns.style.visibility = 'visible'; - - // Put the editor back in the right state - // TODO: This is ugly... how do we make this nicer? - // setting fullscreen to false here prevents the - // native fs callback from calling this function again - self._eeState.fullscreen = false; - - if (!nativeFs) { - document.body.style.overflow = 'auto'; - } - else { - if (nativeFsWebkit) { - document.webkitCancelFullScreen(); - } - else if (nativeFsMoz) { - document.mozCancelFullScreen(); - } - else if (nativeFsW3C) { - document.exitFullscreen(); - } - } - - if (_isInEdit) { - self.edit(); - } - else { - self.preview(); - } - - self.reflow(); - - self.emit('fullscreenexit'); - }; - - // This setups up live previews by triggering preview() IF in fullscreen on keyup - self.editor.addEventListener('keyup', function () { - if (keypressTimer) { - window.clearTimeout(keypressTimer); - } - keypressTimer = window.setTimeout(function () { - if (self.is('fullscreen')) { - self.preview(); - } - }, 250); - }); - - fsElement = self.iframeElement; - - // Sets up the onclick event on utility buttons - utilBtns.addEventListener('click', function (e) { - var targetClass = e.target.className; - if (targetClass.indexOf('epiceditor-toggle-preview-btn') > -1) { - self.preview(); - } - else if (targetClass.indexOf('epiceditor-toggle-edit-btn') > -1) { - self.edit(); - } - else if (targetClass.indexOf('epiceditor-fullscreen-btn') > -1) { - self._goFullscreen(fsElement); - } - }); - - // Sets up the NATIVE fullscreen editor/previewer for WebKit - if (nativeFsWebkit) { - document.addEventListener('webkitfullscreenchange', function () { - if (!document.webkitIsFullScreen && self._eeState.fullscreen) { - self._exitFullscreen(fsElement); - } - }, false); - } - else if (nativeFsMoz) { - document.addEventListener('mozfullscreenchange', function () { - if (!document.mozFullScreen && self._eeState.fullscreen) { - self._exitFullscreen(fsElement); - } - }, false); - } - else if (nativeFsW3C) { - document.addEventListener('fullscreenchange', function () { - if (document.fullscreenElement == null && self._eeState.fullscreen) { - self._exitFullscreen(fsElement); - } - }, false); - } - - // TODO: Move utilBar stuff into a utilBar setup function (_setupUtilBar) - utilBar = self.iframe.getElementById('epiceditor-utilbar'); - - // Hide it at first until they move their mouse - if (self.settings.button.bar !== true) { - utilBar.style.display = 'none'; - } - - utilBar.addEventListener('mouseover', function () { - if (utilBarTimer) { - clearTimeout(utilBarTimer); - } - }); - - function utilBarHandler(e) { - if (self.settings.button.bar !== "auto") { - return; - } - // Here we check if the mouse has moves more than 5px in any direction before triggering the mousemove code - // we do this for 2 reasons: - // 1. On Mac OS X lion when you scroll and it does the iOS like "jump" when it hits the top/bottom of the page itll fire off - // a mousemove of a few pixels depending on how hard you scroll - // 2. We give a slight buffer to the user in case he barely touches his touchpad or mouse and not trigger the UI - if (Math.abs(mousePos.y - e.pageY) >= 5 || Math.abs(mousePos.x - e.pageX) >= 5) { - utilBar.style.display = 'block'; - // if we have a timer already running, kill it out - if (utilBarTimer) { - clearTimeout(utilBarTimer); - } - - // begin a new timer that hides our object after 1000 ms - utilBarTimer = window.setTimeout(function () { - utilBar.style.display = 'none'; - }, 1000); - } - mousePos = { y: e.pageY, x: e.pageX }; - } - - // Add keyboard shortcuts for convenience. - function shortcutHandler(e) { - if (e.keyCode == self.settings.shortcut.modifier) { isMod = true } // check for modifier press(default is alt key), save to var - if (e.keyCode == 17) { isCtrl = true } // check for ctrl/cmnd press, in order to catch ctrl/cmnd + s - - // Check for alt+p and make sure were not in fullscreen - default shortcut to switch to preview - if (isMod === true && e.keyCode == self.settings.shortcut.preview && !self.is('fullscreen')) { - e.preventDefault(); - if (self.is('edit') && self._previewEnabled) { - self.preview(); - } - else if (self._editEnabled) { - self.edit(); - } - } - // Check for alt+f - default shortcut to make editor fullscreen - if (isMod === true && e.keyCode == self.settings.shortcut.fullscreen && self._fullscreenEnabled) { - e.preventDefault(); - self._goFullscreen(fsElement); - } - - // Set the modifier key to false once *any* key combo is completed - // or else, on Windows, hitting the alt key will lock the isMod state to true (ticket #133) - if (isMod === true && e.keyCode !== self.settings.shortcut.modifier) { - isMod = false; - } - - // When a user presses "esc", revert everything! - if (e.keyCode == 27 && self.is('fullscreen')) { - self._exitFullscreen(fsElement); - } - - // Check for ctrl + s (since a lot of people do it out of habit) and make it do nothing - if (isCtrl === true && e.keyCode == 83) { - self.save(); - e.preventDefault(); - isCtrl = false; - } - - // Do the same for Mac now (metaKey == cmd). - if (e.metaKey && e.keyCode == 83) { - self.save(); - e.preventDefault(); - } - - } - - function shortcutUpHandler(e) { - if (e.keyCode == self.settings.shortcut.modifier) { isMod = false } - if (e.keyCode == 17) { isCtrl = false } - } - - function pasteHandler(e) { - var content; - if (e.clipboardData) { - //FF 22, Webkit, "standards" - e.preventDefault(); - content = e.clipboardData.getData("text/plain"); - self.editorIframeDocument.execCommand("insertText", false, content); - } - else if (window.clipboardData) { - //IE, "nasty" - e.preventDefault(); - content = window.clipboardData.getData("Text"); - content = content.replace(//g, '>'); - content = content.replace(/\n/g, '
    '); - content = content.replace(/\r/g, ''); //fuck you, ie! - content = content.replace(/
    \s/g, '
     ') - content = content.replace(/\s\s\s/g, '   ') - content = content.replace(/\s\s/g, '  ') - self.editorIframeDocument.selection.createRange().pasteHTML(content); - } - } - - // Hide and show the util bar based on mouse movements - eventableIframes = [self.previewerIframeDocument, self.editorIframeDocument]; - - for (i = 0; i < eventableIframes.length; i++) { - eventableIframes[i].addEventListener('mousemove', function (e) { - utilBarHandler(e); - }); - eventableIframes[i].addEventListener('scroll', function (e) { - utilBarHandler(e); - }); - eventableIframes[i].addEventListener('keyup', function (e) { - shortcutUpHandler(e); - }); - eventableIframes[i].addEventListener('keydown', function (e) { - shortcutHandler(e); - }); - eventableIframes[i].addEventListener('paste', function (e) { - pasteHandler(e); - }); - } - - // Save the document every 100ms by default - // TODO: Move into autosave setup function (_setupAutoSave) - if (self.settings.file.autoSave) { - self._saveIntervalTimer = window.setInterval(function () { - if (!self._canSave) { - return; - } - self.save(false, true); - }, self.settings.file.autoSave); - } - - // Update a textarea automatically if a textarea is given so you don't need - // AJAX to submit a form and instead fall back to normal form behavior - if (self.settings.textarea) { - self._setupTextareaSync(); - } - - window.addEventListener('resize', function () { - // If NOT webkit, and in fullscreen, we need to account for browser resizing - // we don't care about webkit because you can't resize in webkit's fullscreen - if (self.is('fullscreen')) { - _applyStyles(self.iframeElement, { - 'width': window.outerWidth + 'px' - , 'height': window.innerHeight + 'px' - }); - - _applyStyles(self.element, { - 'height': window.innerHeight + 'px' - }); - - _applyStyles(self.previewerIframe, { - 'width': window.outerWidth / 2 + 'px' - , 'height': window.innerHeight + 'px' - }); - - _applyStyles(self.editorIframe, { - 'width': window.outerWidth / 2 + 'px' - , 'height': window.innerHeight + 'px' - }); - } - // Makes the editor support fluid width when not in fullscreen mode - else if (!self.is('fullscreen')) { - self.reflow(); - } - }); - - // Set states before flipping edit and preview modes - self._eeState.loaded = true; - self._eeState.unloaded = false; - - if (self.is('preview')) { - self.preview(); - } - else { - self.edit(); - } - - self.iframe.close(); - self._eeState.startup = false; - - if (self.settings.autogrow) { - self._fixScrollbars(); - - boundAutogrow = function () { - setTimeout(function () { - self._autogrow(); - }, 1); - }; - - //for if autosave is disabled or very slow - ['keydown', 'keyup', 'paste', 'cut'].forEach(function (ev) { - self.getElement('editor').addEventListener(ev, boundAutogrow); - }); - - self.on('__update', boundAutogrow); - self.on('edit', function () { - setTimeout(boundAutogrow, 50) - }); - self.on('preview', function () { - setTimeout(boundAutogrow, 50) - }); - - //for browsers that have rendering delays - setTimeout(boundAutogrow, 50); - boundAutogrow(); - } - - // The callback and call are the same thing, but different ways to access them - callback.call(this); - this.emit('load'); - return this; - } - - EpicEditor.prototype._setupTextareaSync = function () { - var self = this - , textareaFileName = self.settings.file.name - , _syncTextarea; - - // Even if autoSave is false, we want to make sure to keep the textarea synced - // with the editor's content. One bad thing about this tho is that we're - // creating two timers now in some configurations. We keep the textarea synced - // by saving and opening the textarea content from the draft file storage. - self._textareaSaveTimer = window.setInterval(function () { - if (!self._canSave) { - return; - } - self.save(true); - }, 100); - - _syncTextarea = function () { - // TODO: Figure out root cause for having to do this ||. - // This only happens for draft files. Probably has something to do with - // the fact draft files haven't been saved by the time this is called. - // TODO: Add test for this case. - self._textareaElement.value = self.exportFile(textareaFileName, 'text', true) || self.settings.file.defaultContent; - } - - if (typeof self.settings.textarea == 'string') { - self._textareaElement = document.getElementById(self.settings.textarea); - } - else if (typeof self.settings.textarea == 'object') { - self._textareaElement = self.settings.textarea; - } - - // On page load, if there's content in the textarea that means one of two - // different things: - // - // 1. The editor didn't load and the user was writing in the textarea and - // now he refreshed the page or the JS loaded and the textarea now has - // content. If this is the case the user probably expects his content is - // moved into the editor and not lose what he typed. - // - // 2. The developer put content in the textarea from some server side - // code. In this case, the textarea will take precedence. - // - // If the developer wants drafts to be recoverable they should check if - // the local file in localStorage's modified date is newer than the server. - if (self._textareaElement.value !== '') { - self.importFile(textareaFileName, self._textareaElement.value); - - // manually save draft after import so there is no delay between the - // import and exporting in _syncTextarea. Without this, _syncTextarea - // will pull the saved data from localStorage which will be <=100ms old. - self.save(true); - } - - // Update the textarea on load and pull from drafts - _syncTextarea(); - - // Make sure to keep it updated - self.on('__update', _syncTextarea); - } - - /** - * Will NOT focus the editor if the editor is still starting up AND - * focusOnLoad is set to false. This allows you to place this in code that - * gets fired during .load() without worrying about it overriding the user's - * option. For example use cases see preview() and edit(). - * @returns {undefined} - */ - - // Prevent focus when the user sets focusOnLoad to false by checking if the - // editor is starting up AND if focusOnLoad is true - EpicEditor.prototype._focusExceptOnLoad = function () { - var self = this; - if ((self._eeState.startup && self.settings.focusOnLoad) || !self._eeState.startup) { - self.focus(); - } - } - - /** - * Will remove the editor, but not offline files - * @returns {object} EpicEditor will be returned - */ - EpicEditor.prototype.unload = function (callback) { - - // Make sure the editor isn't already unloaded. - if (this.is('unloaded')) { - throw new Error('Editor isn\'t loaded'); - } - - var self = this - , editor = window.parent.document.getElementById(self._instanceId); - - editor.parentNode.removeChild(editor); - self._eeState.loaded = false; - self._eeState.unloaded = true; - callback = callback || function () {}; - - if (self.settings.textarea) { - self._textareaElement.value = ""; - self.removeListener('__update'); - } - - if (self._saveIntervalTimer) { - window.clearInterval(self._saveIntervalTimer); - } - if (self._textareaSaveTimer) { - window.clearInterval(self._textareaSaveTimer); - } - - callback.call(this); - self.emit('unload'); - return self; - } - - /** - * reflow allows you to dynamically re-fit the editor in the parent without - * having to unload and then reload the editor again. - * - * reflow will also emit a `reflow` event and will return the new dimensions. - * If it's called without params it'll return the new width and height and if - * it's called with just width or just height it'll just return the width or - * height. It's returned as an object like: { width: '100px', height: '1px' } - * - * @param {string|null} kind Can either be 'width' or 'height' or null - * if null, both the height and width will be resized - * @param {function} callback A function to fire after the reflow is finished. - * Will return the width / height in an obj as the first param of the callback. - * @returns {object} EpicEditor will be returned - */ - EpicEditor.prototype.reflow = function (kind, callback) { - var self = this - , widthDiff = _outerWidth(self.element) - self.element.offsetWidth - , heightDiff = _outerHeight(self.element) - self.element.offsetHeight - , elements = [self.iframeElement, self.editorIframe, self.previewerIframe] - , eventData = {} - , newWidth - , newHeight; - - if (typeof kind == 'function') { - callback = kind; - kind = null; - } - - if (!callback) { - callback = function () {}; - } - - for (var x = 0; x < elements.length; x++) { - if (!kind || kind == 'width') { - newWidth = self.element.offsetWidth - widthDiff + 'px'; - elements[x].style.width = newWidth; - self._eeState.reflowWidth = newWidth; - eventData.width = newWidth; - } - if (!kind || kind == 'height') { - newHeight = self.element.offsetHeight - heightDiff + 'px'; - elements[x].style.height = newHeight; - self._eeState.reflowHeight = newHeight - eventData.height = newHeight; - } - } - - self.emit('reflow', eventData); - callback.call(this, eventData); - return self; - } - - /** - * Will take the markdown and generate a preview view based on the theme - * @returns {object} EpicEditor will be returned - */ - EpicEditor.prototype.preview = function () { - var self = this - , x - , theme = self.settings.theme.preview - , anchors; - - _replaceClass(self.getElement('wrapper'), 'epiceditor-edit-mode', 'epiceditor-preview-mode'); - - // Check if no CSS theme link exists - if (!self.previewerIframeDocument.getElementById('theme')) { - _insertCSSLink(theme, self.previewerIframeDocument, 'theme'); - } - else if (self.previewerIframeDocument.getElementById('theme').name !== theme) { - self.previewerIframeDocument.getElementById('theme').href = theme; - } - - // Save a preview draft since it might not be saved to the real file yet - self.save(true); - - // Add the generated draft HTML into the previewer - self.previewer.innerHTML = self.exportFile(null, 'html', true); - - // Hide the editor and display the previewer - if (!self.is('fullscreen')) { - self.editorIframe.style.left = '-999999px'; - self.previewerIframe.style.left = ''; - self._eeState.preview = true; - self._eeState.edit = false; - self._focusExceptOnLoad(); - } - - self.emit('preview'); - return self; - } - - /** - * Helper to focus on the editor iframe. Will figure out which iframe to - * focus on based on which one is active and will handle the cross browser - * issues with focusing on the iframe vs the document body. - * @returns {object} EpicEditor will be returned - */ - EpicEditor.prototype.focus = function (pageload) { - var self = this - , isPreview = self.is('preview') - , focusElement = isPreview ? self.previewerIframeDocument.body - : self.editorIframeDocument.body; - - if (_isFirefox() && isPreview) { - focusElement = self.previewerIframe; - } - - focusElement.focus(); - return this; - } - - /** - * Puts the editor into fullscreen mode - * @returns {object} EpicEditor will be returned - */ - EpicEditor.prototype.enterFullscreen = function () { - if (this.is('fullscreen')) { return this; } - this._goFullscreen(this.iframeElement); - return this; - } - - /** - * Closes fullscreen mode if opened - * @returns {object} EpicEditor will be returned - */ - EpicEditor.prototype.exitFullscreen = function () { - if (!this.is('fullscreen')) { return this; } - this._exitFullscreen(this.iframeElement); - return this; - } - - /** - * Hides the preview and shows the editor again - * @returns {object} EpicEditor will be returned - */ - EpicEditor.prototype.edit = function () { - var self = this; - _replaceClass(self.getElement('wrapper'), 'epiceditor-preview-mode', 'epiceditor-edit-mode'); - self._eeState.preview = false; - self._eeState.edit = true; - self.editorIframe.style.left = ''; - self.previewerIframe.style.left = '-999999px'; - self._focusExceptOnLoad(); - self.emit('edit'); - return this; - } - - /** - * Grabs a specificed HTML node. Use it as a shortcut to getting the iframe contents - * @param {String} name The name of the node (can be document, body, editor, previewer, or wrapper) - * @returns {Object|Null} - */ - EpicEditor.prototype.getElement = function (name) { - var available = { - "container": this.element - , "wrapper": this.iframe.getElementById('epiceditor-wrapper') - , "wrapperIframe": this.iframeElement - , "editor": this.editorIframeDocument - , "editorIframe": this.editorIframe - , "previewer": this.previewerIframeDocument - , "previewerIframe": this.previewerIframe - } - - // Check that the given string is a possible option and verify the editor isn't unloaded - // without this, you'd be given a reference to an object that no longer exists in the DOM - if (!available[name] || this.is('unloaded')) { - return null; - } - else { - return available[name]; - } - } - - /** - * Returns a boolean of each "state" of the editor. For example "editor.is('loaded')" // returns true/false - * @param {String} what the state you want to check for - * @returns {Boolean} - */ - EpicEditor.prototype.is = function (what) { - var self = this; - switch (what) { - case 'loaded': - return self._eeState.loaded; - case 'unloaded': - return self._eeState.unloaded - case 'preview': - return self._eeState.preview - case 'edit': - return self._eeState.edit; - case 'fullscreen': - return self._eeState.fullscreen; - // TODO: This "works", but the tests are saying otherwise. Come back to this - // and figure out how to fix it. - // case 'focused': - // return document.activeElement == self.iframeElement; - default: - return false; - } - } - - /** - * Opens a file - * @param {string} name The name of the file you want to open - * @returns {object} EpicEditor will be returned - */ - EpicEditor.prototype.open = function (name) { - var self = this - , defaultContent = self.settings.file.defaultContent - , fileObj; - name = name || self.settings.file.name; - self.settings.file.name = name; - if (this._storage[self.settings.localStorageName]) { - fileObj = self.exportFile(name); - if (fileObj !== undefined) { - _setText(self.editor, fileObj); - self.emit('read'); - } - else { - _setText(self.editor, defaultContent); - self.save(); // ensure a save - self.emit('create'); - } - self.previewer.innerHTML = self.exportFile(null, 'html'); - self.emit('open'); - } - return this; - } - - /** - * Saves content for offline use - * @returns {object} EpicEditor will be returned - */ - EpicEditor.prototype.save = function (_isPreviewDraft, _isAuto) { - var self = this - , storage - , isUpdate = false - , file = self.settings.file.name - , previewDraftName = '' - , data = this._storage[previewDraftName + self.settings.localStorageName] - , content = _getText(this.editor); - - if (_isPreviewDraft) { - previewDraftName = self._previewDraftLocation; - } - - // This could have been false but since we're manually saving - // we know it's save to start autoSaving again - this._canSave = true; - - // Guard against storage being wiped out without EpicEditor knowing - // TODO: Emit saving error - storage seems to have been wiped - if (data) { - storage = JSON.parse(this._storage[previewDraftName + self.settings.localStorageName]); - - // If the file doesn't exist we need to create it - if (storage[file] === undefined) { - storage[file] = self._defaultFileSchema(); - } - - // If it does, we need to check if the content is different and - // if it is, send the update event and update the timestamp - else if (content !== storage[file].content) { - storage[file].modified = new Date(); - isUpdate = true; - } - //don't bother autosaving if the content hasn't actually changed - else if (_isAuto) { - return; - } - - storage[file].content = content; - this._storage[previewDraftName + self.settings.localStorageName] = JSON.stringify(storage); - - // After the content is actually changed, emit update so it emits the updated content - if (isUpdate) { - self.emit('update'); - // Emit a private update event so it can't get accidentally removed - self.emit('__update'); - } - - if (_isAuto) { - this.emit('autosave'); - } - else if (!_isPreviewDraft) { - this.emit('save'); - } - } - - return this; - } - - /** - * Removes a page - * @param {string} name The name of the file you want to remove from localStorage - * @returns {object} EpicEditor will be returned - */ - EpicEditor.prototype.remove = function (name) { - var self = this - , s; - name = name || self.settings.file.name; - - // If you're trying to delete a page you have open, block saving - if (name == self.settings.file.name) { - self._canSave = false; - } - - s = JSON.parse(this._storage[self.settings.localStorageName]); - delete s[name]; - this._storage[self.settings.localStorageName] = JSON.stringify(s); - this.emit('remove'); - return this; - }; - - /** - * Renames a file - * @param {string} oldName The old file name - * @param {string} newName The new file name - * @returns {object} EpicEditor will be returned - */ - EpicEditor.prototype.rename = function (oldName, newName) { - var self = this - , s = JSON.parse(this._storage[self.settings.localStorageName]); - s[newName] = s[oldName]; - delete s[oldName]; - this._storage[self.settings.localStorageName] = JSON.stringify(s); - self.open(newName); - return this; - }; - - /** - * Imports a file and it's contents and opens it - * @param {string} name The name of the file you want to import (will overwrite existing files!) - * @param {string} content Content of the file you want to import - * @param {string} kind The kind of file you want to import (TBI) - * @param {object} meta Meta data you want to save with your file. - * @returns {object} EpicEditor will be returned - */ - EpicEditor.prototype.importFile = function (name, content, kind, meta) { - var self = this - , isNew = false; - - name = name || self.settings.file.name; - content = content || ''; - kind = kind || 'md'; - meta = meta || {}; - - if (JSON.parse(this._storage[self.settings.localStorageName])[name] === undefined) { - isNew = true; - } - - // Set our current file to the new file and update the content - self.settings.file.name = name; - _setText(self.editor, content); - - if (isNew) { - self.emit('create'); - } - - self.save(); - - if (self.is('fullscreen')) { - self.preview(); - } - - //firefox has trouble with importing and working out the size right away - if (self.settings.autogrow) { - setTimeout(function () { - self._autogrow(); - }, 50); - } - - return this; - }; - - /** - * Gets the local filestore - * @param {string} name Name of the file in the store - * @returns {object|undefined} the local filestore, or a specific file in the store, if a name is given - */ - EpicEditor.prototype._getFileStore = function (name, _isPreviewDraft) { - var previewDraftName = '' - , store; - if (_isPreviewDraft) { - previewDraftName = this._previewDraftLocation; - } - store = JSON.parse(this._storage[previewDraftName + this.settings.localStorageName]); - if (name) { - return store[name]; - } - else { - return store; - } - } - - /** - * Exports a file as a string in a supported format - * @param {string} name Name of the file you want to export (case sensitive) - * @param {string} kind Kind of file you want the content in (currently supports html and text, default is the format the browser "wants") - * @returns {string|undefined} The content of the file in the content given or undefined if it doesn't exist - */ - EpicEditor.prototype.exportFile = function (name, kind, _isPreviewDraft) { - var self = this - , file - , content; - - name = name || self.settings.file.name; - kind = kind || 'text'; - - file = self._getFileStore(name, _isPreviewDraft); - - // If the file doesn't exist just return early with undefined - if (file === undefined) { - return; - } - - content = file.content; - - switch (kind) { - case 'html': - content = _sanitizeRawContent(content); - return self.settings.parser(content); - case 'text': - return _sanitizeRawContent(content); - case 'json': - file.content = _sanitizeRawContent(file.content); - return JSON.stringify(file); - case 'raw': - return content; - default: - return content; - } - } - - /** - * Gets the contents and metadata for files - * @param {string} name Name of the file whose data you want (case sensitive) - * @param {boolean} excludeContent whether the contents of files should be excluded - * @returns {object} An object with the names and data of every file, or just the data of one file if a name was given - */ - EpicEditor.prototype.getFiles = function (name, excludeContent) { - var file - , data = this._getFileStore(name); - - if (name) { - if (data !== undefined) { - if (excludeContent) { - delete data.content; - } - else { - data.content = _sanitizeRawContent(data.content); - } - } - return data; - } - else { - for (file in data) { - if (data.hasOwnProperty(file)) { - if (excludeContent) { - delete data[file].content; - } - else { - data[file].content = _sanitizeRawContent(data[file].content); - } - } - } - return data; - } - } - - // EVENTS - // TODO: Support for namespacing events like "preview.foo" - /** - * Sets up an event handler for a specified event - * @param {string} ev The event name - * @param {function} handler The callback to run when the event fires - * @returns {object} EpicEditor will be returned - */ - EpicEditor.prototype.on = function (ev, handler) { - var self = this; - if (!this.events[ev]) { - this.events[ev] = []; - } - this.events[ev].push(handler); - return self; - }; - - /** - * This will emit or "trigger" an event specified - * @param {string} ev The event name - * @param {any} data Any data you want to pass into the callback - * @returns {object} EpicEditor will be returned - */ - EpicEditor.prototype.emit = function (ev, data) { - var self = this - , x; - - data = data || self.getFiles(self.settings.file.name); - - if (!this.events[ev]) { - return; - } - - function invokeHandler(handler) { - handler.call(self, data); - } - - for (x = 0; x < self.events[ev].length; x++) { - invokeHandler(self.events[ev][x]); - } - - return self; - }; - - /** - * Will remove any listeners added from EpicEditor.on() - * @param {string} ev The event name - * @param {function} handler Handler to remove - * @returns {object} EpicEditor will be returned - */ - EpicEditor.prototype.removeListener = function (ev, handler) { - var self = this; - if (!handler) { - this.events[ev] = []; - return self; - } - if (!this.events[ev]) { - return self; - } - // Otherwise a handler and event exist, so take care of it - this.events[ev].splice(this.events[ev].indexOf(handler), 1); - return self; - } - - /** - * Handles autogrowing the editor - */ - EpicEditor.prototype._autogrow = function () { - var editorHeight - , newHeight - , minHeight - , maxHeight - , el - , style - , maxedOut = false; - - //autogrow in fullscreen is nonsensical - if (!this.is('fullscreen')) { - if (this.is('edit')) { - el = this.getElement('editor').documentElement; - } - else { - el = this.getElement('previewer').documentElement; - } - - editorHeight = _outerHeight(el); - newHeight = editorHeight; - - //handle minimum - minHeight = this.settings.autogrow.minHeight; - if (typeof minHeight === 'function') { - minHeight = minHeight(this); - } - - if (minHeight && newHeight < minHeight) { - newHeight = minHeight; - } - - //handle maximum - maxHeight = this.settings.autogrow.maxHeight; - if (typeof maxHeight === 'function') { - maxHeight = maxHeight(this); - } - - if (maxHeight && newHeight > maxHeight) { - newHeight = maxHeight; - maxedOut = true; - } - - if (maxedOut) { - this._fixScrollbars('auto'); - } else { - this._fixScrollbars('hidden'); - } - - //actual resize - if (newHeight != this.oldHeight) { - this.getElement('container').style.height = newHeight + 'px'; - this.reflow(); - if (this.settings.autogrow.scroll) { - window.scrollBy(0, newHeight - this.oldHeight); - } - this.oldHeight = newHeight; - } - } - } - - /** - * Shows or hides scrollbars based on the autogrow setting - * @param {string} forceSetting a value to force the overflow to - */ - EpicEditor.prototype._fixScrollbars = function (forceSetting) { - var setting; - if (this.settings.autogrow) { - setting = 'hidden'; - } - else { - setting = 'auto'; - } - setting = forceSetting || setting; - this.getElement('editor').documentElement.style.overflow = setting; - this.getElement('previewer').documentElement.style.overflow = setting; - } - - EpicEditor.version = '0.2.2'; - - // Used to store information to be shared across editors - EpicEditor._data = {}; - - window.EpicEditor = EpicEditor; -})(window); - -/** - * marked - a markdown parser - * Copyright (c) 2011-2013, Christopher Jeffrey. (MIT Licensed) - * https://github.com/chjj/marked - */ - -;(function() { - -/** - * Block-Level Grammar - */ - -var block = { - newline: /^\n+/, - code: /^( {4}[^\n]+\n*)+/, - fences: noop, - hr: /^( *[-*_]){3,} *(?:\n+|$)/, - heading: /^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/, - nptable: noop, - lheading: /^([^\n]+)\n *(=|-){3,} *\n*/, - blockquote: /^( *>[^\n]+(\n[^\n]+)*\n*)+/, - list: /^( *)(bull) [\s\S]+?(?:hr|\n{2,}(?! )(?!\1bull )\n*|\s*$)/, - html: /^ *(?:comment|closed|closing) *(?:\n{2,}|\s*$)/, - def: /^ *\[([^\]]+)\]: *([^\s]+)(?: +["(]([^\n]+)[")])? *(?:\n+|$)/, - table: noop, - paragraph: /^([^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+\n*/, - text: /^[^\n]+/ -}; - -block.bullet = /(?:[*+-]|\d+\.)/; -block.item = /^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/; -block.item = replace(block.item, 'gm') - (/bull/g, block.bullet) - (); - -block.list = replace(block.list) - (/bull/g, block.bullet) - ('hr', /\n+(?=(?: *[-*_]){3,} *(?:\n+|$))/) - (); - -block._tag = '(?!(?:' - + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code' - + '|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo' - + '|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|@)\\b'; - -block.html = replace(block.html) - ('comment', //) - ('closed', /<(tag)[\s\S]+?<\/\1>/) - ('closing', /])*?>/) - (/tag/g, block._tag) - (); - -block.paragraph = replace(block.paragraph) - ('hr', block.hr) - ('heading', block.heading) - ('lheading', block.lheading) - ('blockquote', block.blockquote) - ('tag', '<' + block._tag) - ('def', block.def) - (); - -/** - * Normal Block Grammar - */ - -block.normal = merge({}, block); - -/** - * GFM Block Grammar - */ - -block.gfm = merge({}, block.normal, { - fences: /^ *(`{3,}|~{3,}) *(\w+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/, - paragraph: /^/ -}); - -block.gfm.paragraph = replace(block.paragraph) - ('(?!', '(?!' + block.gfm.fences.source.replace('\\1', '\\2') + '|') - (); - -/** - * GFM + Tables Block Grammar - */ - -block.tables = merge({}, block.gfm, { - nptable: /^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/, - table: /^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/ -}); - -/** - * Block Lexer - */ - -function Lexer(options) { - this.tokens = []; - this.tokens.links = {}; - this.options = options || marked.defaults; - this.rules = block.normal; - - if (this.options.gfm) { - if (this.options.tables) { - this.rules = block.tables; - } else { - this.rules = block.gfm; - } - } -} - -/** - * Expose Block Rules - */ - -Lexer.rules = block; - -/** - * Static Lex Method - */ - -Lexer.lex = function(src, options) { - var lexer = new Lexer(options); - return lexer.lex(src); -}; - -/** - * Preprocessing - */ - -Lexer.prototype.lex = function(src) { - src = src - .replace(/\r\n|\r/g, '\n') - .replace(/\t/g, ' ') - .replace(/\u00a0/g, ' ') - .replace(/\u2424/g, '\n'); - - return this.token(src, true); -}; - -/** - * Lexing - */ - -Lexer.prototype.token = function(src, top) { - var src = src.replace(/^ +$/gm, '') - , next - , loose - , cap - , item - , space - , i - , l; - - while (src) { - // newline - if (cap = this.rules.newline.exec(src)) { - src = src.substring(cap[0].length); - if (cap[0].length > 1) { - this.tokens.push({ - type: 'space' - }); - } - } - - // code - if (cap = this.rules.code.exec(src)) { - src = src.substring(cap[0].length); - cap = cap[0].replace(/^ {4}/gm, ''); - this.tokens.push({ - type: 'code', - text: !this.options.pedantic - ? cap.replace(/\n+$/, '') - : cap - }); - continue; - } - - // fences (gfm) - if (cap = this.rules.fences.exec(src)) { - src = src.substring(cap[0].length); - this.tokens.push({ - type: 'code', - lang: cap[2], - text: cap[3] - }); - continue; - } - - // heading - if (cap = this.rules.heading.exec(src)) { - src = src.substring(cap[0].length); - this.tokens.push({ - type: 'heading', - depth: cap[1].length, - text: cap[2] - }); - continue; - } - - // table no leading pipe (gfm) - if (top && (cap = this.rules.nptable.exec(src))) { - src = src.substring(cap[0].length); - - item = { - type: 'table', - header: cap[1].replace(/^ *| *\| *$/g, '').split(/ *\| */), - align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */), - cells: cap[3].replace(/\n$/, '').split('\n') - }; - - for (i = 0; i < item.align.length; i++) { - if (/^ *-+: *$/.test(item.align[i])) { - item.align[i] = 'right'; - } else if (/^ *:-+: *$/.test(item.align[i])) { - item.align[i] = 'center'; - } else if (/^ *:-+ *$/.test(item.align[i])) { - item.align[i] = 'left'; - } else { - item.align[i] = null; - } - } - - for (i = 0; i < item.cells.length; i++) { - item.cells[i] = item.cells[i].split(/ *\| */); - } - - this.tokens.push(item); - - continue; - } - - // lheading - if (cap = this.rules.lheading.exec(src)) { - src = src.substring(cap[0].length); - this.tokens.push({ - type: 'heading', - depth: cap[2] === '=' ? 1 : 2, - text: cap[1] - }); - continue; - } - - // hr - if (cap = this.rules.hr.exec(src)) { - src = src.substring(cap[0].length); - this.tokens.push({ - type: 'hr' - }); - continue; - } - - // blockquote - if (cap = this.rules.blockquote.exec(src)) { - src = src.substring(cap[0].length); - - this.tokens.push({ - type: 'blockquote_start' - }); - - cap = cap[0].replace(/^ *> ?/gm, ''); - - // Pass `top` to keep the current - // "toplevel" state. This is exactly - // how markdown.pl works. - this.token(cap, top); - - this.tokens.push({ - type: 'blockquote_end' - }); - - continue; - } - - // list - if (cap = this.rules.list.exec(src)) { - src = src.substring(cap[0].length); - - this.tokens.push({ - type: 'list_start', - ordered: isFinite(cap[2]) - }); - - // Get each top-level item. - cap = cap[0].match(this.rules.item); - - next = false; - l = cap.length; - i = 0; - - for (; i < l; i++) { - item = cap[i]; - - // Remove the list item's bullet - // so it is seen as the next token. - space = item.length; - item = item.replace(/^ *([*+-]|\d+\.) +/, ''); - - // Outdent whatever the - // list item contains. Hacky. - if (~item.indexOf('\n ')) { - space -= item.length; - item = !this.options.pedantic - ? item.replace(new RegExp('^ {1,' + space + '}', 'gm'), '') - : item.replace(/^ {1,4}/gm, ''); - } - - // Determine whether item is loose or not. - // Use: /(^|\n)(?! )[^\n]+\n\n(?!\s*$)/ - // for discount behavior. - loose = next || /\n\n(?!\s*$)/.test(item); - if (i !== l - 1) { - next = item[item.length-1] === '\n'; - if (!loose) loose = next; - } - - this.tokens.push({ - type: loose - ? 'loose_item_start' - : 'list_item_start' - }); - - // Recurse. - this.token(item, false); - - this.tokens.push({ - type: 'list_item_end' - }); - } - - this.tokens.push({ - type: 'list_end' - }); - - continue; - } - - // html - if (cap = this.rules.html.exec(src)) { - src = src.substring(cap[0].length); - this.tokens.push({ - type: this.options.sanitize - ? 'paragraph' - : 'html', - pre: cap[1] === 'pre', - text: cap[0] - }); - continue; - } - - // def - if (top && (cap = this.rules.def.exec(src))) { - src = src.substring(cap[0].length); - this.tokens.links[cap[1].toLowerCase()] = { - href: cap[2], - title: cap[3] - }; - continue; - } - - // table (gfm) - if (top && (cap = this.rules.table.exec(src))) { - src = src.substring(cap[0].length); - - item = { - type: 'table', - header: cap[1].replace(/^ *| *\| *$/g, '').split(/ *\| */), - align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */), - cells: cap[3].replace(/(?: *\| *)?\n$/, '').split('\n') - }; - - for (i = 0; i < item.align.length; i++) { - if (/^ *-+: *$/.test(item.align[i])) { - item.align[i] = 'right'; - } else if (/^ *:-+: *$/.test(item.align[i])) { - item.align[i] = 'center'; - } else if (/^ *:-+ *$/.test(item.align[i])) { - item.align[i] = 'left'; - } else { - item.align[i] = null; - } - } - - for (i = 0; i < item.cells.length; i++) { - item.cells[i] = item.cells[i] - .replace(/^ *\| *| *\| *$/g, '') - .split(/ *\| */); - } - - this.tokens.push(item); - - continue; - } - - // top-level paragraph - if (top && (cap = this.rules.paragraph.exec(src))) { - src = src.substring(cap[0].length); - this.tokens.push({ - type: 'paragraph', - text: cap[0] - }); - continue; - } - - // text - if (cap = this.rules.text.exec(src)) { - // Top-level should never reach here. - src = src.substring(cap[0].length); - this.tokens.push({ - type: 'text', - text: cap[0] - }); - continue; - } - - if (src) { - throw new - Error('Infinite loop on byte: ' + src.charCodeAt(0)); - } - } - - return this.tokens; -}; - -/** - * Inline-Level Grammar - */ - -var inline = { - escape: /^\\([\\`*{}\[\]()#+\-.!_>|])/, - autolink: /^<([^ >]+(@|:\/)[^ >]+)>/, - url: noop, - tag: /^|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/, - link: /^!?\[(inside)\]\(href\)/, - reflink: /^!?\[(inside)\]\s*\[([^\]]*)\]/, - nolink: /^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/, - strong: /^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/, - em: /^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/, - code: /^(`+)([\s\S]*?[^`])\1(?!`)/, - br: /^ {2,}\n(?!\s*$)/, - del: noop, - text: /^[\s\S]+?(?=[\\?(?:\s+['"]([\s\S]*?)['"])?\s*/; - -inline.link = replace(inline.link) - ('inside', inline._inside) - ('href', inline._href) - (); - -inline.reflink = replace(inline.reflink) - ('inside', inline._inside) - (); - -/** - * Normal Inline Grammar - */ - -inline.normal = merge({}, inline); - -/** - * Pedantic Inline Grammar - */ - -inline.pedantic = merge({}, inline.normal, { - strong: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/, - em: /^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/ -}); - -/** - * GFM Inline Grammar - */ - -inline.gfm = merge({}, inline.normal, { - escape: replace(inline.escape)('])', '~])')(), - url: /^(https?:\/\/[^\s]+[^.,:;"')\]\s])/, - del: /^~{2,}([\s\S]+?)~{2,}/, - text: replace(inline.text) - (']|', '~]|') - ('|', '|https?://|') - () -}); - -/** - * GFM + Line Breaks Inline Grammar - */ - -inline.breaks = merge({}, inline.gfm, { - br: replace(inline.br)('{2,}', '*')(), - text: replace(inline.gfm.text)('{2,}', '*')() -}); - -/** - * Inline Lexer & Compiler - */ - -function InlineLexer(links, options) { - this.options = options || marked.defaults; - this.links = links; - this.rules = inline.normal; - - if (!this.links) { - throw new - Error('Tokens array requires a `links` property.'); - } - - if (this.options.gfm) { - if (this.options.breaks) { - this.rules = inline.breaks; - } else { - this.rules = inline.gfm; - } - } else if (this.options.pedantic) { - this.rules = inline.pedantic; - } -} - -/** - * Expose Inline Rules - */ - -InlineLexer.rules = inline; - -/** - * Static Lexing/Compiling Method - */ - -InlineLexer.output = function(src, links, opt) { - var inline = new InlineLexer(links, opt); - return inline.output(src); -}; - -/** - * Lexing/Compiling - */ - -InlineLexer.prototype.output = function(src) { - var out = '' - , link - , text - , href - , cap; - - while (src) { - // escape - if (cap = this.rules.escape.exec(src)) { - src = src.substring(cap[0].length); - out += cap[1]; - continue; - } - - // autolink - if (cap = this.rules.autolink.exec(src)) { - src = src.substring(cap[0].length); - if (cap[2] === '@') { - text = cap[1][6] === ':' - ? this.mangle(cap[1].substring(7)) - : this.mangle(cap[1]); - href = this.mangle('mailto:') + text; - } else { - text = escape(cap[1]); - href = text; - } - out += '' - + text - + ''; - continue; - } - - // url (gfm) - if (cap = this.rules.url.exec(src)) { - src = src.substring(cap[0].length); - text = escape(cap[1]); - href = text; - out += '' - + text - + ''; - continue; - } - - // tag - if (cap = this.rules.tag.exec(src)) { - src = src.substring(cap[0].length); - out += this.options.sanitize - ? escape(cap[0]) - : cap[0]; - continue; - } - - // link - if (cap = this.rules.link.exec(src)) { - src = src.substring(cap[0].length); - out += this.outputLink(cap, { - href: cap[2], - title: cap[3] - }); - continue; - } - - // reflink, nolink - if ((cap = this.rules.reflink.exec(src)) - || (cap = this.rules.nolink.exec(src))) { - src = src.substring(cap[0].length); - link = (cap[2] || cap[1]).replace(/\s+/g, ' '); - link = this.links[link.toLowerCase()]; - if (!link || !link.href) { - out += cap[0][0]; - src = cap[0].substring(1) + src; - continue; - } - out += this.outputLink(cap, link); - continue; - } - - // strong - if (cap = this.rules.strong.exec(src)) { - src = src.substring(cap[0].length); - out += '' - + this.output(cap[2] || cap[1]) - + ''; - continue; - } - - // em - if (cap = this.rules.em.exec(src)) { - src = src.substring(cap[0].length); - out += '' - + this.output(cap[2] || cap[1]) - + ''; - continue; - } - - // code - if (cap = this.rules.code.exec(src)) { - src = src.substring(cap[0].length); - out += '' - + escape(cap[2], true) - + ''; - continue; - } - - // br - if (cap = this.rules.br.exec(src)) { - src = src.substring(cap[0].length); - out += '
    '; - continue; - } - - // del (gfm) - if (cap = this.rules.del.exec(src)) { - src = src.substring(cap[0].length); - out += '' - + this.output(cap[1]) - + ''; - continue; - } - - // text - if (cap = this.rules.text.exec(src)) { - src = src.substring(cap[0].length); - out += escape(cap[0]); - continue; - } - - if (src) { - throw new - Error('Infinite loop on byte: ' + src.charCodeAt(0)); - } - } - - return out; -}; - -/** - * Compile Link - */ - -InlineLexer.prototype.outputLink = function(cap, link) { - if (cap[0][0] !== '!') { - return '' - + this.output(cap[1]) - + ''; - } else { - return ''
-      + escape(cap[1])
-      + ''; - } -}; - -/** - * Mangle Links - */ - -InlineLexer.prototype.mangle = function(text) { - var out = '' - , l = text.length - , i = 0 - , ch; - - for (; i < l; i++) { - ch = text.charCodeAt(i); - if (Math.random() > 0.5) { - ch = 'x' + ch.toString(16); - } - out += '&#' + ch + ';'; - } - - return out; -}; - -/** - * Parsing & Compiling - */ - -function Parser(options) { - this.tokens = []; - this.token = null; - this.options = options || marked.defaults; -} - -/** - * Static Parse Method - */ - -Parser.parse = function(src, options) { - var parser = new Parser(options); - return parser.parse(src); -}; - -/** - * Parse Loop - */ - -Parser.prototype.parse = function(src) { - this.inline = new InlineLexer(src.links, this.options); - this.tokens = src.reverse(); - - var out = ''; - while (this.next()) { - out += this.tok(); - } - - return out; -}; - -/** - * Next Token - */ - -Parser.prototype.next = function() { - return this.token = this.tokens.pop(); -}; - -/** - * Preview Next Token - */ - -Parser.prototype.peek = function() { - return this.tokens[this.tokens.length-1] || 0; -}; - -/** - * Parse Text Tokens - */ - -Parser.prototype.parseText = function() { - var body = this.token.text; - - while (this.peek().type === 'text') { - body += '\n' + this.next().text; - } - - return this.inline.output(body); -}; - -/** - * Parse Current Token - */ - -Parser.prototype.tok = function() { - switch (this.token.type) { - case 'space': { - return ''; - } - case 'hr': { - return '
    \n'; - } - case 'heading': { - return '' - + this.inline.output(this.token.text) - + '\n'; - } - case 'code': { - if (this.options.highlight) { - var code = this.options.highlight(this.token.text, this.token.lang); - if (code != null && code !== this.token.text) { - this.token.escaped = true; - this.token.text = code; - } - } - - if (!this.token.escaped) { - this.token.text = escape(this.token.text, true); - } - - return '
    '
    -        + this.token.text
    -        + '
    \n'; - } - case 'table': { - var body = '' - , heading - , i - , row - , cell - , j; - - // header - body += '\n\n'; - for (i = 0; i < this.token.header.length; i++) { - heading = this.inline.output(this.token.header[i]); - body += this.token.align[i] - ? '' + heading + '\n' - : '' + heading + '\n'; - } - body += '\n\n'; - - // body - body += '\n' - for (i = 0; i < this.token.cells.length; i++) { - row = this.token.cells[i]; - body += '\n'; - for (j = 0; j < row.length; j++) { - cell = this.inline.output(row[j]); - body += this.token.align[j] - ? '' + cell + '\n' - : '' + cell + '\n'; - } - body += '\n'; - } - body += '\n'; - - return '\n' - + body - + '
    \n'; - } - case 'blockquote_start': { - var body = ''; - - while (this.next().type !== 'blockquote_end') { - body += this.tok(); - } - - return '
    \n' - + body - + '
    \n'; - } - case 'list_start': { - var type = this.token.ordered ? 'ol' : 'ul' - , body = ''; - - while (this.next().type !== 'list_end') { - body += this.tok(); - } - - return '<' - + type - + '>\n' - + body - + '\n'; - } - case 'list_item_start': { - var body = ''; - - while (this.next().type !== 'list_item_end') { - body += this.token.type === 'text' - ? this.parseText() - : this.tok(); - } - - return '
  • ' - + body - + '
  • \n'; - } - case 'loose_item_start': { - var body = ''; - - while (this.next().type !== 'list_item_end') { - body += this.tok(); - } - - return '
  • ' - + body - + '
  • \n'; - } - case 'html': { - return !this.token.pre && !this.options.pedantic - ? this.inline.output(this.token.text) - : this.token.text; - } - case 'paragraph': { - return '

    ' - + this.inline.output(this.token.text) - + '

    \n'; - } - case 'text': { - return '

    ' - + this.parseText() - + '

    \n'; - } - } -}; - -/** - * Helpers - */ - -function escape(html, encode) { - return html - .replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&') - .replace(//g, '>') - .replace(/"/g, '"') - .replace(/'/g, '''); -} - -function replace(regex, opt) { - regex = regex.source; - opt = opt || ''; - return function self(name, val) { - if (!name) return new RegExp(regex, opt); - val = val.source || val; - val = val.replace(/(^|[^\[])\^/g, '$1'); - regex = regex.replace(name, val); - return self; - }; -} - -function noop() {} -noop.exec = noop; - -function merge(obj) { - var i = 1 - , target - , key; - - for (; i < arguments.length; i++) { - target = arguments[i]; - for (key in target) { - if (Object.prototype.hasOwnProperty.call(target, key)) { - obj[key] = target[key]; - } - } - } - - return obj; -} - -/** - * Marked - */ - -function marked(src, opt) { - try { - return Parser.parse(Lexer.lex(src, opt), opt); - } catch (e) { - e.message += '\nPlease report this to https://github.com/chjj/marked.'; - if ((opt || marked.defaults).silent) { - return 'An error occured:\n' + e.message; - } - throw e; - } -} - -/** - * Options - */ - -marked.options = -marked.setOptions = function(opt) { - marked.defaults = opt; - return marked; -}; - -marked.defaults = { - gfm: true, - tables: true, - breaks: false, - pedantic: false, - sanitize: false, - silent: false, - highlight: null -}; - -/** - * Expose - */ - -marked.Parser = Parser; -marked.parser = Parser.parse; - -marked.Lexer = Lexer; -marked.lexer = Lexer.lex; - -marked.InlineLexer = InlineLexer; -marked.inlineLexer = InlineLexer.output; - -marked.parse = marked; - -if (typeof module !== 'undefined') { - module.exports = marked; -} else if (typeof define === 'function' && define.amd) { - define(function() { return marked; }); -} else { - this.marked = marked; -} - -}).call(function() { - return this || (typeof window !== 'undefined' ? window : global); -}()); diff --git a/web/js/epiceditor.min.js b/web/js/epiceditor.min.js deleted file mode 100644 index e664025..0000000 --- a/web/js/epiceditor.min.js +++ /dev/null @@ -1,5 +0,0 @@ -/** - * EpicEditor - An Embeddable JavaScript Markdown Editor (https://github.com/OscarGodson/EpicEditor) - * Copyright (c) 2011-2012, Oscar Godson. (MIT Licensed) - */(function(e,t){function n(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}function r(e,t){for(var n in t)t.hasOwnProperty(n)&&(e.style[n]=t[n])}function i(t,n){var r=t,i=null;return e.getComputedStyle?i=document.defaultView.getComputedStyle(r,null).getPropertyValue(n):r.currentStyle&&(i=r.currentStyle[n]),i}function s(e,t,n){var s={},o;if(t==="save"){for(o in n)n.hasOwnProperty(o)&&(s[o]=i(e,o));r(e,n)}else t==="apply"&&r(e,n);return s}function o(e){var t=parseInt(i(e,"border-left-width"),10)+parseInt(i(e,"border-right-width"),10),n=parseInt(i(e,"padding-left"),10)+parseInt(i(e,"padding-right"),10),r=e.offsetWidth,s;return isNaN(t)&&(t=0),s=t+n+r,s}function u(e){var t=parseInt(i(e,"border-top-width"),10)+parseInt(i(e,"border-bottom-width"),10),n=parseInt(i(e,"padding-top"),10)+parseInt(i(e,"padding-bottom"),10),r=parseInt(i(e,"height"),10),s;return isNaN(t)&&(t=0),s=t+n+r,s}function a(e,t,r){r=r||"";var i=t.getElementsByTagName("head")[0],s=t.createElement("link");n(s,{type:"text/css",id:r,rel:"stylesheet",href:e,name:e,media:"screen"}),i.appendChild(s)}function f(e,t,n){e.className=e.className.replace(t,n)}function l(e){return e.contentDocument||e.contentWindow.document}function c(e){var t;return typeof document.body.innerText=="string"?t=e.innerText:(t=e.innerHTML.replace(/
    /gi,"\n"),t=t.replace(/<(?:.|\n)*?>/gm,""),t=t.replace(/</gi,"<"),t=t.replace(/>/gi,">")),t}function h(e,t){return t=t.replace(//g,">"),t=t.replace(/\n/g,"
    "),t=t.replace(/
    \s/g,"
     "),t=t.replace(/\s\s\s/g,"   "),t=t.replace(/\s\s/g,"  "),t=t.replace(/^ /," "),e.innerHTML=t,!0}function p(e){return e.replace(/\u00a0/g," ").replace(/ /g," ")}function d(){var e=-1,t=navigator.userAgent,n;return navigator.appName=="Microsoft Internet Explorer"&&(n=/MSIE ([0-9]{1,}[\.0-9]{0,})/,n.exec(t)!=null&&(e=parseFloat(RegExp.$1,10))),e}function v(){var t=e.navigator;return t.userAgent.indexOf("Safari")>-1&&t.userAgent.indexOf("Chrome")==-1}function m(){var t=e.navigator;return t.userAgent.indexOf("Firefox")>-1&&t.userAgent.indexOf("Seamonkey")==-1}function g(e){var t={};return e&&t.toString.call(e)==="[object Function]"}function y(){var e=arguments[0]||{},n=1,r=arguments.length,i=!1,s,o,u,a;typeof e=="boolean"&&(i=e,e=arguments[1]||{},n=2),typeof e!="object"&&!g(e)&&(e={}),r===n&&(e=this,--n);for(;n=5||Math.abs(g.x-t.pageX)>=5)h.style.display="block",p&&clearTimeout(p),p=e.setTimeout(function(){h.style.display="none"},1e3);g={y:t.pageY,x:t.pageX}}function M(e){e.keyCode==n.settings.shortcut.modifier&&(N=!0),e.keyCode==17&&(C=!0),N===!0&&e.keyCode==n.settings.shortcut.preview&&!n.is("fullscreen")&&(e.preventDefault(),n.is("edit")&&n._previewEnabled?n.preview():n._editEnabled&&n.edit()),N===!0&&e.keyCode==n.settings.shortcut.fullscreen&&n._fullscreenEnabled&&(e.preventDefault(),n._goFullscreen(T)),N===!0&&e.keyCode!==n.settings.shortcut.modifier&&(N=!1),e.keyCode==27&&n.is("fullscreen")&&n._exitFullscreen(T),C===!0&&e.keyCode==83&&(n.save(),e.preventDefault(),C=!1),e.metaKey&&e.keyCode==83&&(n.save(),e.preventDefault())}function _(e){e.keyCode==n.settings.shortcut.modifier&&(N=!1),e.keyCode==17&&(C=!1)}function D(t){var r;t.clipboardData?(t.preventDefault(),r=t.clipboardData.getData("text/plain"),n.editorIframeDocument.execCommand("insertText",!1,r)):e.clipboardData&&(t.preventDefault(),r=e.clipboardData.getData("Text"),r=r.replace(//g,">"),r=r.replace(/\n/g,"
    "),r=r.replace(/\r/g,""),r=r.replace(/
    \s/g,"
     "),r=r.replace(/\s\s\s/g,"   "),r=r.replace(/\s\s/g,"  "),n.editorIframeDocument.selection.createRange().pasteHTML(r))}if(this.is("loaded"))return this;var n=this,o,u,f,c,h,p,m,g={y:-1,x:-1},y,b,w=!1,E=!1,S=!1,x=!1,T,N=!1,C=!1,k,L,A;n._eeState.startup=!0,n.settings.useNativeFullscreen&&(E=document.body.webkitRequestFullScreen?!0:!1,S=document.body.mozRequestFullScreen?!0:!1,x=document.body.requestFullscreen?!0:!1,w=E||S||x),v()&&(w=!1,E=!1),!n.is("edit")&&!n.is("preview")&&(n._eeState.edit=!0),t=t||function(){},o={chrome:'
    '+(n._previewEnabled?' ':"")+(n._editEnabled?' ':"")+(n._fullscreenEnabled?'':"")+"
    "+"
    ",previewer:'
    ',editor:""},n.element.innerHTML='',n.element.style.height=n.element.offsetHeight+"px",u=document.getElementById(n._instanceId),n.iframeElement=u,n.iframe=l(u),n.iframe.open(),n.iframe.write(o.chrome),n.editorIframe=n.iframe.getElementById("epiceditor-editor-frame"),n.previewerIframe=n.iframe.getElementById("epiceditor-previewer-frame"),n.editorIframeDocument=l(n.editorIframe),n.editorIframeDocument.open(),n.editorIframeDocument.write(o.editor),n.editorIframeDocument.close(),n.previewerIframeDocument=l(n.previewerIframe),n.previewerIframeDocument.open(),n.previewerIframeDocument.write(o.previewer),f=n.previewerIframeDocument.createElement("base"),f.target="_blank",n.previewerIframeDocument.getElementsByTagName("head")[0].appendChild(f),n.previewerIframeDocument.close(),n.reflow(),a(n.settings.theme.base,n.iframe,"theme"),a(n.settings.theme.editor,n.editorIframeDocument,"theme"),a(n.settings.theme.preview,n.previewerIframeDocument,"theme"),n.iframe.getElementById("epiceditor-wrapper").style.position="relative",n.editorIframe.style.position="absolute",n.previewerIframe.style.position="absolute",n.editor=n.editorIframeDocument.body,n.previewer=n.previewerIframeDocument.getElementById("epiceditor-preview"),n.editor.contentEditable=!0,n.iframe.body.style.height=this.element.offsetHeight+"px",n.previewerIframe.style.left="-999999px",this.editorIframeDocument.body.style.wordWrap="break-word",d()>-1&&(this.previewer.style.height=parseInt(i(this.previewer,"height"),10)+2),this.open(n.settings.file.name),n.settings.focusOnLoad&&n.iframe.addEventListener("readystatechange",function(){n.iframe.readyState=="complete"&&n.focus()}),n.previewerIframeDocument.addEventListener("click",function(t){var r=t.target,i=n.previewerIframeDocument.body;r.nodeName=="A"&&r.hash&&r.hostname==e.location.hostname&&(t.preventDefault(),r.target="_self",i.querySelector(r.hash)&&(i.scrollTop=i.querySelector(r.hash).offsetTop))}),c=n.iframe.getElementById("epiceditor-utilbar"),y={},n._goFullscreen=function(t){this._fixScrollbars("auto");if(n.is("fullscreen")){n._exitFullscreen(t);return}w&&(E?t.webkitRequestFullScreen():S?t.mozRequestFullScreen():x&&t.requestFullscreen()),b=n.is("edit"),n._eeState.fullscreen=!0,n._eeState.edit=!0,n._eeState.preview=!0;var r=e.innerWidth,o=e.innerHeight,u=e.outerWidth,a=e.outerHeight;w||(a=e.innerHeight),y.editorIframe=s(n.editorIframe,"save",{width:u/2+"px",height:a+"px","float":"left",cssFloat:"left",styleFloat:"left",display:"block",position:"static",left:""}),y.previewerIframe=s(n.previewerIframe,"save",{width:u/2+"px",height:a+"px","float":"right",cssFloat:"right",styleFloat:"right",display:"block",position:"static",left:""}),y.element=s(n.element,"save",{position:"fixed",top:"0",left:"0",width:"100%","z-index":"9999",zIndex:"9999",border:"none",margin:"0",background:i(n.editor,"background-color"),height:o+"px"}),y.iframeElement=s(n.iframeElement,"save",{width:u+"px",height:o+"px"}),c.style.visibility="hidden",w||(document.body.style.overflow="hidden"),n.preview(),n.focus(),n.emit("fullscreenenter")},n._exitFullscreen=function(e){this._fixScrollbars(),s(n.element,"apply",y.element),s(n.iframeElement,"apply",y.iframeElement),s(n.editorIframe,"apply",y.editorIframe),s(n.previewerIframe,"apply",y.previewerIframe),n.element.style.width=n._eeState.reflowWidth?n._eeState.reflowWidth:"",n.element.style.height=n._eeState.reflowHeight?n._eeState.reflowHeight:"",c.style.visibility="visible",n._eeState.fullscreen=!1,w?E?document.webkitCancelFullScreen():S?document.mozCancelFullScreen():x&&document.exitFullscreen():document.body.style.overflow="auto",b?n.edit():n.preview(),n.reflow(),n.emit("fullscreenexit")},n.editor.addEventListener("keyup",function(){m&&e.clearTimeout(m),m=e.setTimeout(function(){n.is("fullscreen")&&n.preview()},250)}),T=n.iframeElement,c.addEventListener("click",function(e){var t=e.target.className;t.indexOf("epiceditor-toggle-preview-btn")>-1?n.preview():t.indexOf("epiceditor-toggle-edit-btn")>-1?n.edit():t.indexOf("epiceditor-fullscreen-btn")>-1&&n._goFullscreen(T)}),E?document.addEventListener("webkitfullscreenchange",function(){!document.webkitIsFullScreen&&n._eeState.fullscreen&&n._exitFullscreen(T)},!1):S?document.addEventListener("mozfullscreenchange",function(){!document.mozFullScreen&&n._eeState.fullscreen&&n._exitFullscreen(T)},!1):x&&document.addEventListener("fullscreenchange",function(){document.fullscreenElement==null&&n._eeState.fullscreen&&n._exitFullscreen(T)},!1),h=n.iframe.getElementById("epiceditor-utilbar"),n.settings.button.bar!==!0&&(h.style.display="none"),h.addEventListener("mouseover",function(){p&&clearTimeout(p)}),k=[n.previewerIframeDocument,n.editorIframeDocument];for(L=0;Li&&(n=i,a=!0),a?this._fixScrollbars("auto"):this._fixScrollbars("hidden"),n!=this.oldHeight&&(this.getElement("container").style.height=n+"px",this.reflow(),this.settings.autogrow.scroll&&e.scrollBy(0,n-this.oldHeight),this.oldHeight=n))},b.prototype._fixScrollbars=function(e){var t;this.settings.autogrow?t="hidden":t="auto",t=e||t,this.getElement("editor").documentElement.style.overflow=t,this.getElement("previewer").documentElement.style.overflow=t},b.version="0.2.2",b._data={},e.EpicEditor=b})(window),function(){function t(t){this.tokens=[],this.tokens.links={},this.options=t||f.defaults,this.rules=e.normal,this.options.gfm&&(this.options.tables?this.rules=e.tables:this.rules=e.gfm)}function r(e,t){this.options=t||f.defaults,this.links=e,this.rules=n.normal;if(!this.links)throw new Error("Tokens array requires a `links` property.");this.options.gfm?this.options.breaks?this.rules=n.breaks:this.rules=n.gfm:this.options.pedantic&&(this.rules=n.pedantic)}function i(e){this.tokens=[],this.token=null,this.options=e||f.defaults}function s(e,t){return e.replace(t?/&/g:/&(?!#?\w+;)/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function o(e,t){return e=e.source,t=t||"",function n(r,i){return r?(i=i.source||i,i=i.replace(/(^|[^\[])\^/g,"$1"),e=e.replace(r,i),n):new RegExp(e,t)}}function u(){}function a(e){var t=1,n,r;for(;t[^\n]+(\n[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment|closed|closing) *(?:\n{2,}|\s*$)/,def:/^ *\[([^\]]+)\]: *([^\s]+)(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:u,paragraph:/^([^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+\n*/,text:/^[^\n]+/};e.bullet=/(?:[*+-]|\d+\.)/,e.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,e.item=o(e.item,"gm")(/bull/g,e.bullet)(),e.list=o(e.list)(/bull/g,e.bullet)("hr",/\n+(?=(?: *[-*_]){3,} *(?:\n+|$))/)(),e._tag="(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|@)\\b",e.html=o(e.html)("comment",//)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/])*?>/)(/tag/g,e._tag)(),e.paragraph=o(e.paragraph)("hr",e.hr)("heading",e.heading)("lheading",e.lheading)("blockquote",e.blockquote)("tag","<"+e._tag)("def",e.def)(),e.normal=a({},e),e.gfm=a({},e.normal,{fences:/^ *(`{3,}|~{3,}) *(\w+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/,paragraph:/^/}),e.gfm.paragraph=o(e.paragraph)("(?!","(?!"+e.gfm.fences.source.replace("\\1","\\2")+"|")(),e.tables=a({},e.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/}),t.rules=e,t.lex=function(e,n){var r=new t(n);return r.lex(e)},t.prototype.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(e,!0)},t.prototype.token=function(e,t){var e=e.replace(/^ +$/gm,""),n,r,i,s,o,u,a;while(e){if(i=this.rules.newline.exec(e))e=e.substring(i[0].length),i[0].length>1&&this.tokens.push({type:"space"});if(i=this.rules.code.exec(e)){e=e.substring(i[0].length),i=i[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:this.options.pedantic?i:i.replace(/\n+$/,"")});continue}if(i=this.rules.fences.exec(e)){e=e.substring(i[0].length),this.tokens.push({type:"code",lang:i[2],text:i[3]});continue}if(i=this.rules.heading.exec(e)){e=e.substring(i[0].length),this.tokens.push({type:"heading",depth:i[1].length,text:i[2]});continue}if(t&&(i=this.rules.nptable.exec(e))){e=e.substring(i[0].length),s={type:"table",header:i[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:i[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:i[3].replace(/\n$/,"").split("\n")};for(u=0;u ?/gm,""),this.token(i,t),this.tokens.push({type:"blockquote_end"});continue}if(i=this.rules.list.exec(e)){e=e.substring(i[0].length),this.tokens.push({type:"list_start",ordered:isFinite(i[2])}),i=i[0].match(this.rules.item),n=!1,a=i.length,u=0;for(;u|])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:u,tag:/^|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)([\s\S]*?[^`])\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:u,text:/^[\s\S]+?(?=[\\?(?:\s+['"]([\s\S]*?)['"])?\s*/,n.link=o(n.link)("inside",n._inside)("href",n._href)(),n.reflink=o(n.reflink)("inside",n._inside)(),n.normal=a({},n),n.pedantic=a({},n.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/}),n.gfm=a({},n.normal,{escape:o(n.escape)("])","~])")(),url:/^(https?:\/\/[^\s]+[^.,:;"')\]\s])/,del:/^~{2,}([\s\S]+?)~{2,}/,text:o(n.text)("]|","~]|")("|","|https?://|")()}),n.breaks=a({},n.gfm,{br:o(n.br)("{2,}","*")(),text:o(n.gfm.text)("{2,}","*")()}),r.rules=n,r.output=function(e,t,n){var i=new r(t,n);return i.output(e)},r.prototype.output=function(e){var t="",n,r,i,o;while(e){if(o=this.rules.escape.exec(e)){e=e.substring(o[0].length),t+=o[1];continue}if(o=this.rules.autolink.exec(e)){e=e.substring(o[0].length),o[2]==="@"?(r=o[1][6]===":"?this.mangle(o[1].substring(7)):this.mangle(o[1]),i=this.mangle("mailto:")+r):(r=s(o[1]),i=r),t+=''+r+"";continue}if(o=this.rules.url.exec(e)){e=e.substring(o[0].length),r=s(o[1]),i=r,t+=''+r+"";continue}if(o=this.rules.tag.exec(e)){e=e.substring(o[0].length),t+=this.options.sanitize?s(o[0]):o[0];continue}if(o=this.rules.link.exec(e)){e=e.substring(o[0].length),t+=this.outputLink(o,{href:o[2],title:o[3]});continue}if((o=this.rules.reflink.exec(e))||(o=this.rules.nolink.exec(e))){e=e.substring(o[0].length),n=(o[2]||o[1]).replace(/\s+/g," "),n=this.links[n.toLowerCase()];if(!n||!n.href){t+=o[0][0],e=o[0].substring(1)+e;continue}t+=this.outputLink(o,n);continue}if(o=this.rules.strong.exec(e)){e=e.substring(o[0].length),t+=""+this.output(o[2]||o[1])+"";continue}if(o=this.rules.em.exec(e)){e=e.substring(o[0].length),t+=""+this.output(o[2]||o[1])+"";continue}if(o=this.rules.code.exec(e)){e=e.substring(o[0].length),t+=""+s(o[2],!0)+"";continue}if(o=this.rules.br.exec(e)){e=e.substring(o[0].length),t+="
    ";continue}if(o=this.rules.del.exec(e)){e=e.substring(o[0].length),t+=""+this.output(o[1])+"";continue}if(o=this.rules.text.exec(e)){e=e.substring(o[0].length),t+=s(o[0]);continue}if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}return t},r.prototype.outputLink=function(e,t){return e[0][0]!=="!"?'"+this.output(e[1])+"":''+s(e[1])+'"},r.prototype.mangle=function(e){var t="",n=e.length,r=0,i;for(;r.5&&(i="x"+i.toString(16)),t+="&#"+i+";";return t},i.parse=function(e,t){var n=new i(t);return n.parse(e)},i.prototype.parse=function(e){this.inline=new r(e.links,this.options),this.tokens=e.reverse();var t="";while(this.next())t+=this.tok();return t},i.prototype.next=function(){return this.token=this.tokens.pop()},i.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},i.prototype.parseText=function(){var e=this.token.text;while(this.peek().type==="text")e+="\n"+this.next().text;return this.inline.output(e)},i.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return"
    \n";case"heading":return""+this.inline.output(this.token.text)+"\n";case"code":if(this.options.highlight){var e=this.options.highlight(this.token.text,this.token.lang);e!=null&&e!==this.token.text&&(this.token.escaped=!0,this.token.text=e)}return this.token.escaped||(this.token.text=s(this.token.text,!0)),"
    "+this.token.text+"
    \n";case"table":var t="",n,r,i,o,u;t+="\n\n";for(r=0;r'+n+"\n":""+n+"\n";t+="\n\n",t+="\n";for(r=0;r\n";for(u=0;u'+o+"\n":""+o+"\n";t+="\n"}return t+="\n","\n"+t+"
    \n";case"blockquote_start":var t="";while(this.next().type!=="blockquote_end" -)t+=this.tok();return"
    \n"+t+"
    \n";case"list_start":var a=this.token.ordered?"ol":"ul",t="";while(this.next().type!=="list_end")t+=this.tok();return"<"+a+">\n"+t+"\n";case"list_item_start":var t="";while(this.next().type!=="list_item_end")t+=this.token.type==="text"?this.parseText():this.tok();return"
  • "+t+"
  • \n";case"loose_item_start":var t="";while(this.next().type!=="list_item_end")t+=this.tok();return"
  • "+t+"
  • \n";case"html":return!this.token.pre&&!this.options.pedantic?this.inline.output(this.token.text):this.token.text;case"paragraph":return"

    "+this.inline.output(this.token.text)+"

    \n";case"text":return"

    "+this.parseText()+"

    \n"}},u.exec=u,f.options=f.setOptions=function(e){return f.defaults=e,f},f.defaults={gfm:!0,tables:!0,breaks:!1,pedantic:!1,sanitize:!1,silent:!1,highlight:null},f.Parser=i,f.parser=i.parse,f.Lexer=t,f.lexer=t.lex,f.InlineLexer=r,f.inlineLexer=r.output,f.parse=f,typeof module!="undefined"?module.exports=f:typeof define=="function"&&define.amd?define(function(){return f}):this.marked=f}.call(function(){return this||(typeof window!="undefined"?window:global)}()); \ No newline at end of file diff --git a/web/js/problems.js b/web/js/problems.js deleted file mode 100644 index 79de5b8..0000000 --- a/web/js/problems.js +++ /dev/null @@ -1,44 +0,0 @@ -function render_problems() { - $.post("/api/problem/data", { - }, function(data) { - data = data["data"]; - for (var i = 0; i < data.length; i++) { - files = data[i]["files"]; - problem = -`
    -
    -

    ` + data[i]["name"] + ` | ` + data[i]["category"] + `` + data[i]["value"] + ` points

    -
    -
    -

    ` + data[i]["description"] + `

    -
    - - - - - -
    -
    -
    ` - $("#problems").append(problem); - } - }); -} - -function show_hint(pid) { - $("#hint_" + pid).slideToggle(120, "swing"); -} - -$(document).ready( render_problems() ); diff --git a/web/js/scoreboard.js b/web/js/scoreboard.js deleted file mode 100644 index 00fdf8c..0000000 --- a/web/js/scoreboard.js +++ /dev/null @@ -1,45 +0,0 @@ -var chart = c3.generate({ - data: { - x: 'x', - columns: [ - ['x', '2013-01-01', '2013-01-02', '2013-01-03', '2013-01-04', '2013-01-05', '2013-01-06'], - ['Team Thomas', 30, 250, 380, 500, 620, 740], - ] - }, - axis: { - x: { - type: 'timeseries', - tick: { - format: '%Y-%m-%d' - } - } - } -}); -setTimeout(function() { - chart.load({ - columns: [ - ['Team Charles', 100, 210, 320, 430, 540, 650] - ] - }); -}, 1000); -setTimeout(function() { - chart.load({ - columns: [ - ['Team Zach', 10, 120, 230, 340, 450, 560] - ] - }); -}, 2000); -setTimeout(function() { - chart.load({ - columns: [ - ['Team Michael', 0, 80, 190, 300, 410, 520] - ] - }); -}, 3000); -setTimeout(function() { - chart.load({ - columns: [ - ['Team James', 0, 100, 250, 300, 450, 600] - ] - }); -}, 4000); diff --git a/web/pages/404.html b/web/pages/404.html deleted file mode 100644 index f7801a5..0000000 --- a/web/pages/404.html +++ /dev/null @@ -1,5 +0,0 @@ - - -

    Ok, ok, here's your flag: bm8gZWFzdGVyIGVnZyBoZXJl.

    \ No newline at end of file diff --git a/web/pages/about.html b/web/pages/about.html deleted file mode 100644 index eedf38a..0000000 --- a/web/pages/about.html +++ /dev/null @@ -1,93 +0,0 @@ - -
    -

    About

    - - - -
    -
    -
    - -
    -
    diff --git a/web/pages/admin/problems.html b/web/pages/admin/problems.html deleted file mode 100644 index 03712a5..0000000 --- a/web/pages/admin/problems.html +++ /dev/null @@ -1,71 +0,0 @@ - - - - -
    -
    - -
    -
    -
    -
    -

    New Problem

    -
    -
    -
    -
    -
    -
    -
    -
    -

    {{ problem["title"] }}

    -
    -
    -
    -
    -
    -
    -
    -
    - - \ No newline at end of file diff --git a/web/pages/blank.html b/web/pages/blank.html deleted file mode 100644 index e69de29..0000000 diff --git a/web/pages/chat.html b/web/pages/chat.html deleted file mode 100644 index 572f502..0000000 --- a/web/pages/chat.html +++ /dev/null @@ -1,6 +0,0 @@ -
    -

    EasyCTF IRC

    -
    - -
    -
    diff --git a/web/pages/forgot.html b/web/pages/forgot.html deleted file mode 100644 index 01f210f..0000000 --- a/web/pages/forgot.html +++ /dev/null @@ -1,92 +0,0 @@ -
    -

     

    -
    -
    - {{ body }} -
    -
    - -
    -
    -
    -
    -

    Reset Password

    -
    -
    -
    -
    -
    -
    -
    -
    -

    Reset your password here

    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    -
    -
    -
    - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Reset Password

    -
    -
    -
    -
    -
    -
    -
    -
    -

    Enter the email you used to sign up with, and we'll send you an an email with a link to reset your password.

    -
    - -
    - -
    -
    -
    -
    -
    -
    - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    diff --git a/web/pages/home.html b/web/pages/home.html deleted file mode 100644 index fab8137..0000000 --- a/web/pages/home.html +++ /dev/null @@ -1,5 +0,0 @@ -
    -
    -

    EasyCTF 3

    -
    -
    diff --git a/web/pages/learn.html b/web/pages/learn.html deleted file mode 100644 index e69de29..0000000 diff --git a/web/pages/login.html b/web/pages/login.html deleted file mode 100644 index 16f254b..0000000 --- a/web/pages/login.html +++ /dev/null @@ -1,54 +0,0 @@ -
    -

     

    -
    -
    -
    -
    -

    Login

    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    -
    - - -
    -
    -
    -
    -
    -
    - - Forgot Password? - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    diff --git a/web/pages/problems.html b/web/pages/problems.html deleted file mode 100644 index 614ed91..0000000 --- a/web/pages/problems.html +++ /dev/null @@ -1,11 +0,0 @@ - -
    -

    Problems

    -
    -
    - \ No newline at end of file diff --git a/web/pages/programming.html b/web/pages/programming.html deleted file mode 100644 index 42af714..0000000 --- a/web/pages/programming.html +++ /dev/null @@ -1,11 +0,0 @@ -
    -

    Programming

    -
    -
    -

    Problems Avalible: NaN?

    -
    -
    -

    Insert Programming Client Here

    -
    -
    -
    diff --git a/web/pages/register.html b/web/pages/register.html deleted file mode 100644 index 46238ce..0000000 --- a/web/pages/register.html +++ /dev/null @@ -1,103 +0,0 @@ -
    -

     

    -
    -
    -
    -
    -

    Register

    -
    -
    -
    -
    -
    -
    -
    -

    Register your individual account here. Make sure that members of your team also register accounts. You'll be able to create teams and add members after you register!

    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    -
    - -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - \ No newline at end of file diff --git a/web/pages/rules.html b/web/pages/rules.html deleted file mode 100644 index 18f8c37..0000000 --- a/web/pages/rules.html +++ /dev/null @@ -1,43 +0,0 @@ -
    -

    Info

    - -

    Rules

    -

    - Below lie the rules regarding EasyCTF. These rules have been specifically formulated in order to preserve the integrity of the competition for every participant. These rules exist only serve as a auxillary to your own common sense. One of EasyCTF's core - goals is to gauge your team's understanding of the relevant computer science principles. If we wanted to measure the magnitude of your teacher's knowledge of computer science, we would attend a local CSTA meeting. Due to the nature of the competition's - content, the whole of the world wide web is free game. Do not, however, use forums or other services in which the problem is forwarded to unregistered member of EasyCTF. Sharing flags is obviously against rules, and will not be permitted. Do not - confuse EasyCTF with an attack-defense CTF platform; if you attack either the EasyCTF infrastructure or another team, you will be subject to complete team explusion, as well as the possibility of legal pursuance. All decisions made by an administrator - from the EasyCTF Team are final. -

    - -

    Flag Format

    -

    - Similar to previous years, our flags will be formatted like so: - EasyCTF{example_flag}. Although our magical judge programs are expecting only the text in between the curly braces ( - example_flag), EasyCTF will ignore the - EasyCTF{} and mark your submission correct or incorrect. Rapid, repeated guesses (brute forcing) will serve as sufficient grounds for team penalization. As forementioned, sharing of flags outside members of your own team can, and will have - severe penalties or explusion from the CTF competition. Finally, creating writeups for your solved problems is highly encouraged. However, for the integrity of the competition, writeups may not be posted before the end of the competition. After - the competition has successfuly ended, the EasyCTF team will post writeups for all of the problems. -

    - -

    Scoring

    -

    In EasyCTF, every problem has an assigned point value. This point value is assigned based on the difficulty or the extent of time required to solve the problem. Your team's total score is the sum of the points you obtain from every problem you solve. - A few problems may have speed bonuses, meaning that the first solve on a problem will earn a bonus percent of the original problem value. These bonus points will also count toward your team total. Here is a screenshot from the problems page to - demonstrate. Teams with higher points will outrank teams with lower points. Should a tie occur between two teams, the time of the last submission will be used to break the tie. For example, if two teams are tied at 100 points, the team that reached - 100 points first will outrank the team that reached 100 points afterwards.

    - -

    Eligibility and Observer Accounts/Teams

    -

    EasyCTF is targeted at students enrolled in high schools or middle schools across the United States. Therefore, only students who are enrolled in high schools or middle schools in the United States are eligible for prizes. The EasyCTF Team will verify - the winning teams meet these conditions; if a winning team does not meet these conditions, then the prizes will be given to the next highest team. If you don't live in the United States, or you're not a high school or middle school student, you - are still encouraged to compete, but under an Observer account. Teams with at least one Observer member will be considered an Observer team. Observer teams still appear in the scoreboard, but are not eligible for prizes. Teachers also wishing - to take part in the CTF may also create an Observer team.

    - -

    Prizes

    -

    1st Place: $512 -
    2nd Place: $256 -
    3rd Place: $128 -
    Top 20: Laptop Stickers

    -
    -
    -
    -
    diff --git a/web/pages/scoreboard.html b/web/pages/scoreboard.html deleted file mode 100644 index 2299e67..0000000 --- a/web/pages/scoreboard.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - -
    RankTeam NameSchoolPoints
    {{ team['rank'] }}{{ team['teamname'] }}{{ team['school'] }}{{ team['points'] }}
    \ No newline at end of file diff --git a/web/pages/settings.html b/web/pages/settings.html deleted file mode 100644 index d2bc0fe..0000000 --- a/web/pages/settings.html +++ /dev/null @@ -1,192 +0,0 @@ - - -
    -
    -
    -
    -

    Account Settings

    -
    - -
    -
    -
    -
    -
    -
    -

    Public Profile

    -
    -
    - -
    -
    - -
    -
    -
    -
    -
    - Upload new picture - -
    - - Remove profile picture - -
    -
    -
    -

    If you remove your picture, an automatically generated identicon will be used.

    - -
    -
    -
    -
    -
    -
    -
    -
    -

    Email

    -
    -
    -

    Hi.

    -
    -
    -
    -
    -

    Email Preferences

    -
    -
    -

    Hi.

    -
    -
    -
    -
    -
    -
    -

    Change Password

    -
    -
    -

    Hi.

    -
    -
    -
    -
    -

    Active Sessions

    -
    -
    -

    Hi.

    -
    -
    -
    -
    -
    - - \ No newline at end of file diff --git a/web/pages/shell.html b/web/pages/shell.html deleted file mode 100644 index 901619c..0000000 --- a/web/pages/shell.html +++ /dev/null @@ -1,11 +0,0 @@ -
    -

    Shell

    -
    -
    -

    Username: (insert username) | Password: (insert password)

    -
    -
    -

    Insert Shell Here

    -
    -
    -
    diff --git a/web/pages/team.html b/web/pages/team.html deleted file mode 100644 index 5e0c622..0000000 --- a/web/pages/team.html +++ /dev/null @@ -1,224 +0,0 @@ - - -
    -
    -
    -
    -
    -

    {{ team['teamname'] }}

    -

    {{ team['school'] || 'Add School' }}

    -
    -
    -

    {{ team['teamname'] }}

    -

    {{ team['school'] || 'Unknown Affiliation' }}

    -
    -
    -
    - - I'm in the team! -
    -
    - - OBSERVER -
    -
    -
    -
    -

    {{ team['teamname'] }}

    -

    {{ team['school'] || 'Unknown Affiliation' }}

    -
    -
    - - OBSERVER -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Team Members

    -
    -
    -
    -

    {{ member['name'] }}

    -
    Owner
    -

    @{{ member['username'] }}

    -
    -
    - - -
    -
    -
    -

    Pending Invitations

    -
    -
    -
    - -

    {{ member['name'] }}

    -

    @{{ member['username'] }}

    -
    -
    -
    -
    -
    -

    Invitation Requests

    -
    -
    -
    - -

    {{ member['name'] }}

    -

    @{{ member['username'] }}

    -
    -
    -
    -
    -
    - -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    - -

    To participate in EasyCTF, you must be on a team. If you'd like to go solo, just create a team by yourself. Read about team eligibility in the rules.

    - -
    -
    -
    -
    -
    -
    -
    -
    -

    Create a Team

    -
    -
    - -
    -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    - -

    You need an invitation to join another team. If you'd like to request to be a member of their team, go to their team page and click the Request button.

    - -
    -
    -
    -
    - - -

    The team you were looking for doesn't exist. Check to make sure you've spelled the name right.

    -
    - - \ No newline at end of file diff --git a/web/pages/updates.html b/web/pages/updates.html deleted file mode 100644 index 272091c..0000000 --- a/web/pages/updates.html +++ /dev/null @@ -1,18 +0,0 @@ -
    -

    News / Updates

    -

    This is where updates about the competition and clarifications about the problems will be posted. -
    Make sure you check this page frequently during the competition!

    - - -
    diff --git a/web/themes/base/epiceditor.css b/web/themes/base/epiceditor.css deleted file mode 100644 index 76e58fc..0000000 --- a/web/themes/base/epiceditor.css +++ /dev/null @@ -1,70 +0,0 @@ -html, body, iframe, div { - margin:0; - padding:0; -} - -#epiceditor-utilbar { - position:fixed; - bottom:10px; - right:10px; -} - -#epiceditor-utilbar button { - display:block; - float:left; - width:30px; - height:30px; - border:none; - background:none; -} - -#epiceditor-utilbar button.epiceditor-toggle-preview-btn { - background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAf9JREFUeNrsVu1twjAQLZmAEcIGYYKGDWACkgkSkPiQ+CifAoEgyQTQDegEpROQDZoRMgH0HToj1yIglKr90Vg62T6f/e4d9gu50+n09BctlwFnwP8TOAgCA10VRr2ZELaHhbBXx3HCVMC+71voXmD6g4Qi2NB13e1DwAAkZhtmmKYRcxsJhHeBPc8bMMufbDU0PxF4vV4TSyth8477csI6lTV/a71er9tioonBarXaIAmLErliNWyqoM8nrJPpHFNLWLcI4xvj5XKpMo2ZgcvzIvs+75S0wKwPPB/CnpWXsG00Gra2WCwshekOVoC9Sb6IGN1ge2HNsWK+B0iJqxAL5oSpYeDJJW02mxVYLAWSGfDtebylA68Bc4wh+ahK5PcxLh6PR5GUpym/iTOfz89PqNVqhRI4iQf1/o174HNMVYDSGeTDmXQ3znogCGrtdpsYVBhER1aH2Wzm8iE7UR74DMTWGNxUQWmNYqTEzq8APoo9sJ8wKoR5eU7T6VQVjZAvx4YvDJWt1Ol0QsTqkppF8EW8/12OhTnSpT2LCe2/KiCTyUQVkJgPuwgb6XG32w05Xui4q0imLLNDxA/uSuZ4PNaZqZlSsejDYfd6veihj8RoNDK5XOUHAen3Dfr9/j7VZxEJ6AwuxCCvhMTM7oNAARhl/0Ay4Az419qXAAMAfBdK7281j6YAAAAASUVORK5CYII=); -} - -#epiceditor-utilbar button.epiceditor-toggle-edit-btn { - background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAnVJREFUeNrsV+lt4lAQNtEWAB2QCtZ0ABWsqYB1BU5AgDgkQOISl9cV4FQQtgLYCuKtIN4K4gogM9H3pMmLTTh24c+O9An7+XnOb8aP1G63M64hN8aV5GqGvxyyyfO8Y3S6hDtc2wTfcZyLRPwdvxEbPSviIwjIRtO49s9ONSRLMIGvwkBI+EPYEEqyQmcZdl2Xo3BgcJ90xPUGDh1veLFYWCBK9oQ6P4BgiXVO6fUjg5zCJcE6kVxsLEN4QTlWzO5yuRwlGp7P55zOxz1RRqK2SfKD8BvOG4IHxUqlEnxop9lsZpITa0KWndGwIeQIXswzHbynpK2xzjXbeBfxdDrlhbUWjYyuiJS9fBJxgL3PItKsprNQrVaD1GQyYUVP2oYelDziPoPnT5+k2QajleEC3usI/exM7oYiXor0hpxS8qhLv5FIVVrcBwkp5ueclbS27qNMvkj7kg3nZX1qtVqAaSUN5OGUwn2M4RUb3263plh700E6I7wTKn1suCAW3PF4zL1r1Ov1SBhXZLEJFqGTQCq5N1BZIp3s+DOi5fXcG7lGo1Ea5DIFSWzcq7a4R6uYqJmlkSqHoeGKeq+w905MtGKj0Yje9TE5ID9pqictQQwmXTfh82cIJ0NML0d0QY8MdhMn13A4zENB0hAJEYn6EnGL3MZ0hsyG3Ww2g70jU8lgMOhqHicJz+KfovVkz3J5/FardfhBgDZzS90SeoJ8cXjQJlUAEmZUCx30kYiTfr9vgFRc72+ChCHSzNH+Qgk+fA7b7fZZJ5AAiIRhT4zUv3/Y07LiaPW9yPE2L5jrI/p/d7wVEZe0U8bJkvr/F+ZS8irAAIorRozUvI0gAAAAAElFTkSuQmCC); -} - -#epiceditor-utilbar button.epiceditor-fullscreen-btn { - background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAY5JREFUeNrsV8tthDAQhYgCtoV04BKghK2En5AQBw4IITjwq2RLgBJcwpawHZAxMpGDYGwTFPaQkUbG1sybj58NmNM0GVfIh3GRXBbYEid932N9d1zXHWWAGAb4m+9VsUA0H5SubKkKIGA4qyUC2qKBxSCe541HKln7dV2nVbHRtq0Nw7CXGNtz/jzwqjZ5odtqTOagQRC82KRpGkcS/L2Ok7lXZV3Xp7Q6DMNR2mqNthMhKXLqzcUCc6Wgn3wU1wlX1PboHs8tjaLoyVtLT7JFK2ZZM6CZvWyE+X1Voaj3la3DMA63epGqqm4wfyCBH8xmz1+Z1WVZ2vyqU2HvHtv9OI4PsRpjL91YV2a7pcB8onmOifYFUhSFLQCTnQtkDpokyYv73JBtcAQsA3zGTXJBEgNXgrF3CcrBZGwnC+4uqxHnH+zN8/ybvexZwvZNhlsHbrt5CyCgDtu1XosUe58K4kuOF9EKnKYp20eVrxDUJssyreM0bDg4kIw0EfCbftvqQ6KKYf7/wvyVfAkwAMjqoFSaWbrBAAAAAElFTkSuQmCC); -} - -@media -only screen and (-webkit-min-device-pixel-ratio: 2), -only screen and ( min--moz-device-pixel-ratio: 2), -only screen and ( -o-min-device-pixel-ratio: 2/1), -only screen and ( min-device-pixel-ratio: 2), -only screen and ( min-resolution: 192dpi), -only screen and ( min-resolution: 2dppx) { - #epiceditor-utilbar button.epiceditor-toggle-preview-btn { - background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAMAAAANIilAAAABrVBMVEWIiIiHh4eIiIiJiYmEhISEhISEhISMjIyNjY2MjIyNjY2MjIyFhYWDg4OFhYWKioqKioqBgYGJiYmJiYmJiYmKioqKioqFhYWIiIiJiYmIiIiJiYmIiIiGhoaIiIiGhoaIiIiHh4eHh4eGhoaFhYWKioqFhYWEhISFhYWEhISDg4ONjY2NjY2MjIyHh4eMjIyLi4uCgoKCgoKCgoKBgYGBgYGOjo6Ojo6BgYGPj4+Ojo6Hh4eNjY2Pj4+BgYGNjY2BgYGHh4eQkJCNjY2FhYWHh4eDg4OQkJCQkJCAgICCgoKAgICAgICQkJCQkJCQkJCAgICQkJCAgICQkJCFhYWHh4eHh4eGhoaKioqGhoaMjIyDg4OEhISDg4OEhISDg4OEhISKioqBgYGJiYmKioqKioqJiYmMjIyEhISCgoKGhoaLi4uPj4+Pj4+BgYGKioqDg4OGhoaGhoaMjIyHh4eEhISE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uNP59Hhkbn53+QkzPjo+NZP6TZOSM/L/LfwAJ69Ba3fXmtwAAAABJRU5ErkJggg==); - background-size: 30px 30px; - } - - #epiceditor-utilbar button.epiceditor-toggle-edit-btn { - background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAMAAAANIilAAAACNFBMVEWIiIiHh4eIiIiGhoaEhISDg4OCgoKDg4OMjIyNjY2MjIyMjIyLi4uMjIyKioqCgoKNjY2Ojo6Dg4ONjY2FhYWFhYWCgoKKioqKioqLi4uLi4uMjIyLi4uFhYWKioqKioqEhISJiYmJiYmEhISEhISFhYWEhISGhoaHh4eJiYmNjY2Hh4eKioqDg4ODg4OCgoKOjo6Ojo6Dg4OOjo6BgYGOjo6AgICCgoKNjY2Dg4OPj4+BgYGBgYGAgICOjo6BgYGOjo6AgICOjo6BgYGBgYGAgICPj4+QkJCQkJCQkJCQkJCPj4+NjY2IiIiIiIiFhYWFhYWEhISEhISGhoaDg4OGhoaDg4OHh4eDg4OCgoKMjIyLi4uLi4uKioqNjY2KioqNjY2NjY2NjY2Dg4OKioqGhoaJiYmIiIiGhoaFhYWEhISFhYWFhYWOjo6Pj4+FhYWGhoaPj4+Hh4eMjIyMjIyMjIyJiYmIiIiIiIiOjo6Ojo6CgoKBgYGPj4+QkJCHh4eHh4eEhISIiIiDg4OEhISDg4ODg4OLi4uHh4eEhISMjIyFhYWGhoaHh4eOjo6IiIiKioqKioqMjIyGhoaIiIiJiYmIiIiFhYWGhoaGhoaHh4eKioqJiYmLi4uIiIiGhoaJiYmHh4eGhoaGhoaJiYmFhYWKioqPj4+IiIiGhoYAAACAgICCgoKQkJCPj4+BgYGDg4OFhYWHh4eOjo6JiYmGhoaLi4uEhISIiIiNjY2MjIyKioqRGRgVAAAAq3RSTlNQz7+Pz4AQr4/vIK+Av99QICBQzyCv37/PcM+f378QgHAwgIBgnxBQMK+PgFCf34Bwn0BQv2Ag7zBwEFDvj4CAv1DvYK/f398gUICA39+fYHAwQHAQn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fUyffIvQ118pNBiTvq5AeDxNV//W+CFX4Doxg1lHC8FNUAAAAASUVORK5CYII=); - background-size: 30px 30px; - } - - #epiceditor-utilbar button.epiceditor-fullscreen-btn { - background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAMAAAANIilAAAAA5FBMVEWPj4+JiYmJiYmCgoKGhoaPj4+Li4uEhISAgICNjY2Li4uNjY2QkJCFhYWEhISLi4uHh4eHh4eIiIiHh4eGhoaHh4eEhISOjo6EhISJiYmFhYWJiYmFhYWNjY2NjY2Hh4eOjo6CgoKGhoaKioqKioqJiYmKioqDg4ODg4OBgYGGhoaKioqKioqLi4uMjIyMjIyIiIiIiIiMjIyOjo6GhoaDg4ONjY2EhISPj4+CgoIAAACJiYmHh4eIiIiFhYWCgoKPj4+Li4uAgICKioqEhISGhoaBgYGOjo6MjIyQkJCNjY2Dg4O2Jy/OAAAAO3RSTlMQz0DPEHDPz0DvMDBAQBBAQBAQz88wMM/v7zAw788Q7xAQQM9AEBDPEEAwMO/v7zDvMEBA70BAQEBAAAENmbYAAAG1SURBVHja7dftM0JREMdxD5GkEEqKpBJRSc8rQq7Q////2Dnm3t85jtkTmmGG75t7Z3c/t9fN0Tf6x1/Dz0ZrZGZf/BJ8a9QjM/vCwks9Px5aBcslC+P3nPVmi8dcczrcHHM2flug1CHRYcoYNd0YFlrAL1yHqPOC9g9IdbAfjHAjYFjoT+FI1MfRiAM/cZdEl0+oVidVvRaMcAOMgJWGBUYSVhrWjdfvjKqrq1Vzsu7Cy1Vo7XXZhYuj0ahwfHY+sjo/Oy7woyhitkTQsESsZawstG6VlvDCfIlUmfSVVjpDqtL8goBLbKFhsRcwalxcB100CDkxLLQbJxKwpvb3At7Y2iRuJzd4V26HuM2tDQkPWMOamu1Awkeetx2qtDy/lvZaCW173pGIWetA/xBbF+ZgiVgjGcdutLJ7xO1l9VnMiWGhJdzl4vx4CNpN+ifJXUy7RPEuZ2C1AIY1NG5kHI4Dx8MynnBtovYkqHzi25OyP8ONiKFh3djQsCIecn2i/lBvMU+UXxwi3HyE832jvD0RsLuP8CN3Oh0+feRmixE+g7CdLb43WiEz++Jb+M//x/gB/ArCl0G4nsFuEQAAAABJRU5ErkJggg==); - background-size: 30px 30px; - } -} - -#epiceditor-utilbar button:last-child { - margin-left:15px; -} - -#epiceditor-utilbar button:hover { - cursor:pointer; -} - -.epiceditor-edit-mode #epiceditor-utilbar button.epiceditor-toggle-edit-btn { - display:none; -} - -.epiceditor-preview-mode #epiceditor-utilbar button.epiceditor-toggle-preview-btn { - display:none; -} diff --git a/web/themes/editor/epic-dark.css b/web/themes/editor/epic-dark.css deleted file mode 100644 index 058ace6..0000000 --- a/web/themes/editor/epic-dark.css +++ /dev/null @@ -1,13 +0,0 @@ -html { padding:10px; } - -body { - border:0; - background:rgb(41,41,41); - font-family:monospace; - font-size:14px; - padding:10px; - color:#ddd; - line-height:1.35em; - margin:0; - padding:0; -} diff --git a/web/themes/editor/epic-light.css b/web/themes/editor/epic-light.css deleted file mode 100644 index 9411cec..0000000 --- a/web/themes/editor/epic-light.css +++ /dev/null @@ -1,12 +0,0 @@ -html { padding:10px; } - -body { - border:0; - background:#fcfcfc; - font-family:monospace; - font-size:14px; - padding:10px; - line-height:1.35em; - margin:0; - padding:0; -} diff --git a/web/themes/preview/bartik.css b/web/themes/preview/bartik.css deleted file mode 100644 index 2ffb6d5..0000000 --- a/web/themes/preview/bartik.css +++ /dev/null @@ -1,167 +0,0 @@ -body { - font-family: Georgia, "Times New Roman", Times, serif; - line-height: 1.5; - font-size: 87.5%; - word-wrap: break-word; - margin: 2em; - padding: 0; - border: 0; - outline: 0; - background: #fff; -} - -h1, -h2, -h3, -h4, -h5, -h6 { - margin: 1.0em 0 0.5em; - font-weight: inherit; -} - -h1 { - font-size: 1.357em; - color: #000; -} - -h2 { - font-size: 1.143em; -} - -p { - margin: 0 0 1.2em; -} - -del { - text-decoration: line-through; -} - -tr:nth-child(odd) { - background-color: #dddddd; -} - -img { - outline: 0; -} - -code { - background-color: #f2f2f2; - background-color: rgba(40, 40, 0, 0.06); -} - -pre { - background-color: #f2f2f2; - background-color: rgba(40, 40, 0, 0.06); - margin: 10px 0; - overflow: hidden; - padding: 15px; - white-space: pre-wrap; -} - -pre code { - font-size: 100%; - background-color: transparent; -} - -blockquote { - background: #f7f7f7; - border-left: 1px solid #bbb; - font-style: italic; - margin: 1.5em 10px; - padding: 0.5em 10px; -} - -blockquote:before { - color: #bbb; - content: "\201C"; - font-size: 3em; - line-height: 0.1em; - margin-right: 0.2em; - vertical-align: -.4em; -} - -blockquote:after { - color: #bbb; - content: "\201D"; - font-size: 3em; - line-height: 0.1em; - vertical-align: -.45em; -} - -blockquote > p:first-child { - display: inline; -} - -table { - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - border: 0; - border-spacing: 0; - font-size: 0.857em; - margin: 10px 0; - width: 100%; -} - -table table { - font-size: 1em; -} - -table tr th { - background: #757575; - background: rgba(0, 0, 0, 0.51); - border-bottom-style: none; -} - -table tr th, -table tr th a, -table tr th a:hover { - color: #FFF; - font-weight: bold; -} - -table tbody tr th { - vertical-align: top; -} - -tr td, -tr th { - padding: 4px 9px; - border: 1px solid #fff; - text-align: left; /* LTR */ -} - -tr:nth-child(odd) { - background: #e4e4e4; - background: rgba(0, 0, 0, 0.105); -} - -tr, -tr:nth-child(even) { - background: #efefef; - background: rgba(0, 0, 0, 0.063); -} - -a { - color: #0071B3; -} - -a:hover, -a:focus { - color: #018fe2; -} - -a:active { - color: #23aeff; -} - -a:link, -a:visited { - text-decoration: none; -} - -a:hover, -a:active, -a:focus { - text-decoration: underline; -} - diff --git a/web/themes/preview/github.css b/web/themes/preview/github.css deleted file mode 100644 index 4c78db4..0000000 --- a/web/themes/preview/github.css +++ /dev/null @@ -1,368 +0,0 @@ -html { padding:0 10px; } - -body { - margin:0; - padding:0; - background:#fff; -} - -#epiceditor-wrapper{ - background:white; -} - -#epiceditor-preview{ - padding-top:10px; - padding-bottom:10px; - font-family: Helvetica,arial,freesans,clean,sans-serif; - font-size:13px; - line-height:1.6; -} - -#epiceditor-preview>*:first-child{ - margin-top:0!important; -} - -#epiceditor-preview>*:last-child{ - margin-bottom:0!important; -} - -#epiceditor-preview a{ - color:#4183C4; - text-decoration:none; -} - -#epiceditor-preview a:hover{ - text-decoration:underline; -} - -#epiceditor-preview h1, -#epiceditor-preview h2, -#epiceditor-preview h3, -#epiceditor-preview h4, -#epiceditor-preview h5, -#epiceditor-preview h6{ - margin:20px 0 10px; - padding:0; - font-weight:bold; - -webkit-font-smoothing:antialiased; -} - -#epiceditor-preview h1 tt, -#epiceditor-preview h1 code, -#epiceditor-preview h2 tt, -#epiceditor-preview h2 code, -#epiceditor-preview h3 tt, -#epiceditor-preview h3 code, -#epiceditor-preview h4 tt, -#epiceditor-preview h4 code, -#epiceditor-preview h5 tt, -#epiceditor-preview h5 code, -#epiceditor-preview h6 tt, -#epiceditor-preview h6 code{ - font-size:inherit; -} - -#epiceditor-preview h1{ - font-size:28px; - color:#000; -} - -#epiceditor-preview h2{ - font-size:24px; - border-bottom:1px solid #ccc; - color:#000; -} - -#epiceditor-preview h3{ - font-size:18px; -} - -#epiceditor-preview h4{ - font-size:16px; -} - -#epiceditor-preview h5{ - font-size:14px; -} - -#epiceditor-preview h6{ - color:#777; - font-size:14px; -} - -#epiceditor-preview p, -#epiceditor-preview blockquote, -#epiceditor-preview ul, -#epiceditor-preview ol, -#epiceditor-preview dl, -#epiceditor-preview li, -#epiceditor-preview table, -#epiceditor-preview pre{ - margin:15px 0; -} - -#epiceditor-preview hr{ - background:transparent url('../../images/modules/pulls/dirty-shade.png') repeat-x 0 0; - border:0 none; - color:#ccc; - height:4px; - padding:0; -} - -#epiceditor-preview>h2:first-child, -#epiceditor-preview>h1:first-child, -#epiceditor-preview>h1:first-child+h2, -#epiceditor-preview>h3:first-child, -#epiceditor-preview>h4:first-child, -#epiceditor-preview>h5:first-child, -#epiceditor-preview>h6:first-child{ - margin-top:0; - padding-top:0; -} - -#epiceditor-preview h1+p, -#epiceditor-preview h2+p, -#epiceditor-preview h3+p, -#epiceditor-preview h4+p, -#epiceditor-preview h5+p, -#epiceditor-preview h6+p{ - margin-top:0; -} - -#epiceditor-preview li p.first{ - display:inline-block; -} - -#epiceditor-preview ul, -#epiceditor-preview ol{ - padding-left:30px; -} - -#epiceditor-preview ul li>:first-child, -#epiceditor-preview ol li>:first-child{ - margin-top:0; -} - -#epiceditor-preview ul li>:last-child, -#epiceditor-preview ol li>:last-child{ - margin-bottom:0; -} - -#epiceditor-preview dl{ - padding:0; -} - -#epiceditor-preview dl dt{ - font-size:14px; - font-weight:bold; - font-style:italic; - padding:0; - margin:15px 0 5px; -} - -#epiceditor-preview dl dt:first-child{ - padding:0; -} - -#epiceditor-preview dl dt>:first-child{ - margin-top:0; -} - -#epiceditor-preview dl dt>:last-child{ - margin-bottom:0; -} - -#epiceditor-preview dl dd{ - margin:0 0 15px; - padding:0 15px; -} - -#epiceditor-preview dl dd>:first-child{ - margin-top:0; -} - -#epiceditor-preview dl dd>:last-child{ - margin-bottom:0; -} - -#epiceditor-preview blockquote{ - border-left:4px solid #DDD; - padding:0 15px; - color:#777; -} - -#epiceditor-preview blockquote>:first-child{ - margin-top:0; -} - -#epiceditor-preview blockquote>:last-child{ - margin-bottom:0; -} - -#epiceditor-preview table{ - padding:0; - border-collapse: collapse; - border-spacing: 0; - font-size: 100%; - font: inherit; -} - -#epiceditor-preview table tr{ - border-top:1px solid #ccc; - background-color:#fff; - margin:0; - padding:0; -} - -#epiceditor-preview table tr:nth-child(2n){ - background-color:#f8f8f8; -} - -#epiceditor-preview table tr th{ - font-weight:bold; -} - -#epiceditor-preview table tr th, -#epiceditor-preview table tr td{ - border:1px solid #ccc; - text-align:left; - margin:0; - padding:6px 13px; -} - -#epiceditor-preview table tr th>:first-child, -#epiceditor-preview table tr td>:first-child{ - margin-top:0; -} - -#epiceditor-preview table tr th>:last-child, -#epiceditor-preview table tr td>:last-child{ - margin-bottom:0; -} - -#epiceditor-preview img{ - max-width:100%; -} - -#epiceditor-preview span.frame{ - display:block; - overflow:hidden; -} - -#epiceditor-preview span.frame>span{ - border:1px solid #ddd; - display:block; - float:left; - overflow:hidden; - margin:13px 0 0; - padding:7px; - width:auto; -} - -#epiceditor-preview span.frame span img{ - display:block; - float:left; -} - -#epiceditor-preview span.frame span span{ - clear:both; - color:#333; - display:block; - padding:5px 0 0; -} - -#epiceditor-preview span.align-center{ - display:block; - overflow:hidden; - clear:both; -} - -#epiceditor-preview span.align-center>span{ - display:block; - overflow:hidden; - margin:13px auto 0; - text-align:center; -} - -#epiceditor-preview span.align-center span img{ - margin:0 auto; - text-align:center; -} - -#epiceditor-preview span.align-right{ - display:block; - overflow:hidden; - clear:both; -} - -#epiceditor-preview span.align-right>span{ - display:block; - overflow:hidden; - margin:13px 0 0; - text-align:right; -} - -#epiceditor-preview span.align-right span img{ - margin:0; - text-align:right; -} - -#epiceditor-preview span.float-left{ - display:block; - margin-right:13px; - overflow:hidden; - float:left; -} - -#epiceditor-preview span.float-left span{ - margin:13px 0 0; -} - -#epiceditor-preview span.float-right{ - display:block; - margin-left:13px; - overflow:hidden; - float:right; -} - -#epiceditor-preview span.float-right>span{ - display:block; - overflow:hidden; - margin:13px auto 0; - text-align:right; -} - -#epiceditor-preview code, -#epiceditor-preview tt{ - margin:0 2px; - padding:0 5px; - white-space:nowrap; - border:1px solid #eaeaea; - background-color:#f8f8f8; - border-radius:3px; -} - -#epiceditor-preview pre>code{ - margin:0; - padding:0; - white-space:pre; - border:none; - background:transparent; -} - -#epiceditor-preview .highlight pre, -#epiceditor-preview pre{ - background-color:#f8f8f8; - border:1px solid #ccc; - font-size:13px; - line-height:19px; - overflow:auto; - padding:6px 10px; - border-radius:3px; -} - -#epiceditor-preview pre code, -#epiceditor-preview pre tt{ - background-color:transparent; - border:none; -} diff --git a/web/themes/preview/preview-dark.css b/web/themes/preview/preview-dark.css deleted file mode 100644 index 620c193..0000000 --- a/web/themes/preview/preview-dark.css +++ /dev/null @@ -1,121 +0,0 @@ -html { padding:0 10px; } - -body { - margin:0; - padding:10px 0; - background:#000; -} - -#epiceditor-preview h1, -#epiceditor-preview h2, -#epiceditor-preview h3, -#epiceditor-preview h4, -#epiceditor-preview h5, -#epiceditor-preview h6, -#epiceditor-preview p, -#epiceditor-preview blockquote { - margin: 0; - padding: 0; -} -#epiceditor-preview { - background:#000; - font-family: "Helvetica Neue", Helvetica, "Hiragino Sans GB", Arial, sans-serif; - font-size: 13px; - line-height: 18px; - color: #ccc; -} -#epiceditor-preview a { - color: #fff; -} -#epiceditor-preview a:hover { - color: #00ff00; - text-decoration: none; -} -#epiceditor-preview a img { - border: none; -} -#epiceditor-preview p { - margin-bottom: 9px; -} -#epiceditor-preview h1, -#epiceditor-preview h2, -#epiceditor-preview h3, -#epiceditor-preview h4, -#epiceditor-preview h5, -#epiceditor-preview h6 { - color: #cdcdcd; - line-height: 36px; -} -#epiceditor-preview h1 { - margin-bottom: 18px; - font-size: 30px; -} -#epiceditor-preview h2 { - font-size: 24px; -} -#epiceditor-preview h3 { - font-size: 18px; -} -#epiceditor-preview h4 { - font-size: 16px; -} -#epiceditor-preview h5 { - font-size: 14px; -} -#epiceditor-preview h6 { - font-size: 13px; -} -#epiceditor-preview hr { - margin: 0 0 19px; - border: 0; - border-bottom: 1px solid #ccc; -} -#epiceditor-preview blockquote { - padding: 13px 13px 21px 15px; - margin-bottom: 18px; - font-family:georgia,serif; - font-style: italic; -} -#epiceditor-preview blockquote:before { - content:"\201C"; - font-size:40px; - margin-left:-10px; - font-family:georgia,serif; - color:#eee; -} -#epiceditor-preview blockquote p { - font-size: 14px; - font-weight: 300; - line-height: 18px; - margin-bottom: 0; - font-style: italic; -} -#epiceditor-preview code, #epiceditor-preview pre { - font-family: Monaco, Andale Mono, Courier New, monospace; -} -#epiceditor-preview code { - background-color: #000; - color: #f92672; - padding: 1px 3px; - font-size: 12px; - -webkit-border-radius: 3px; - -moz-border-radius: 3px; - border-radius: 3px; -} -#epiceditor-preview pre { - display: block; - padding: 14px; - color:#66d9ef; - margin: 0 0 18px; - line-height: 16px; - font-size: 11px; - border: 1px solid #d9d9d9; - white-space: pre-wrap; - word-wrap: break-word; -} -#epiceditor-preview pre code { - background-color: #000; - color:#ccc; - font-size: 11px; - padding: 0; -}